Thanks, sadly the same error still occurs.
Changing the version to "#version 420 core" also didn't help.
If you have a cycle whose condition expression is evaluated entirely from uniform variables, you should be ok even in the down deep versions of GLSL, even in pixel function.
Quite complicative is your break instruction inside the loop. Though this instruction has in condition an uniform variable again, it still could confuse NVIDIA driver too much, you can try to rewrite the code to this to emit the same instructions:
const int MAX_LIGHTS = 8; // Maximum amount of lights
uniform int numLights; // Actual amount of lights (Cannot exceed MAX_LIGHTS)
.
.
.
void Test()
{
int shadejobcount= min(MAX_LIGHTS,numLights);
for(int i=0;i<shadejobcount;i++)
{
/* if(i >= numLights)
break; */
vec3 pos = LightSources[i].position; // Causes "index must be constant expression" error on Nvidia cards
[...]
}
}
Might help.
If still would not, you may be facing a "safe gpu code" kind of alert from the NVIDIA driver, refusing to compile a shader in which it does not know the (maximum) amount of instructions at compile time. In that case, I cannot think of better limitting method than a min() with a compile constant and the uniform :)