bfasc2t
01-05-2007, 09:23 AM
I am working on a fragment shader running on a Quadro FX 350M.
The shader compiler complains:
error 6504: profile requires index expression to be compile-time constant
when my code contains
glFragColor = col[iu];
where col[] is an array of vec4 colors.
So I do this:
if(iu == 0) gl_FragColor = col[0];
else if(iu == 1) gl_FragColor = col[1];
else if(iu == 2) gl_FragColor = col[2];
else if(iu == 3) gl_FragColor = col[3];
else if(iu == 4) gl_FragColor = col[4];
else if(iu == 5) gl_FragColor = col[5];
else if(iu == 6) gl_FragColor = col[6];
else if(iu == 7) gl_FragColor = col[7];
else if(iu == 8) gl_FragColor = col[8];
else if(iu == 9) gl_FragColor = col[9];
The compiler is happy and the shader works. Of course for larger arrays this is impractical. Also, I must go through a similar contortion to write to an array.
I can't figure out what and where my profile is, let alone how to change it. Or is there another way around the kludge I'm using?
I'd appreciate any help.
The shader compiler complains:
error 6504: profile requires index expression to be compile-time constant
when my code contains
glFragColor = col[iu];
where col[] is an array of vec4 colors.
So I do this:
if(iu == 0) gl_FragColor = col[0];
else if(iu == 1) gl_FragColor = col[1];
else if(iu == 2) gl_FragColor = col[2];
else if(iu == 3) gl_FragColor = col[3];
else if(iu == 4) gl_FragColor = col[4];
else if(iu == 5) gl_FragColor = col[5];
else if(iu == 6) gl_FragColor = col[6];
else if(iu == 7) gl_FragColor = col[7];
else if(iu == 8) gl_FragColor = col[8];
else if(iu == 9) gl_FragColor = col[9];
The compiler is happy and the shader works. Of course for larger arrays this is impractical. Also, I must go through a similar contortion to write to an array.
I can't figure out what and where my profile is, let alone how to change it. Or is there another way around the kludge I'm using?
I'd appreciate any help.