title: Certain elements in uniform array incorrectly being optimized out?
body: <p>I'm beginning to create a basic diffuse lighting shader, I'm using uniforms arrays to store the lights' infos.</p>
  <p>The loops are of variable size dictated by the &quot;DirectionLightsLength&quot; uniform. For some reason, all elements asides from the zeroeth is being optimized out of my code (OpenGL can't find it's location). Is there anyway to prevent this without manually unrolling my for-loops and removing their variable length?</p>
  <p>I'm setting up the arrays on the shader end by setting the uniform location of &quot;shaderName[index]&quot;,</p>
  <pre><code>uniform vec3 DirectionLightsDirections[4];
  uniform vec3 DirectionLightsColors[4];
  uniform int  DirectionLightsLength;
  
  out vec2 v2f_uv;
  out vec3 v2f_diffuse;
  out vec3 v2f_normal_world;
  
  uniform mat4 ModelRotation;
  uniform mat4 ModelToWorld;
  uniform mat4 WorldToView;
  
  
  void main()
  {
      vec4 worldPos =  vec4(in_position, 1f) * ModelToWorld;
      vec4 viewPos =   worldPos * WorldToView;
  
      gl_Position = viewPos;
      v2f_uv = in_uv;
  
      v2f_normal_world = (vec4(in_normal, 1f) * ModelRotation).xyz;
      
      vec3 diffuseColorSum = vec3(0,0,0);
      for (int i = 0; i &lt; DirectionLightsLength; i++){
          float product = dot(DirectionLightsDirections[i], v2f_normal_world);
          float diffuseShade = clamp(product, 0, 1);
          vec3 diffuseColor = product * DirectionLightsColors[i];
          diffuseColorSum += diffuseColor;
      }
      v2f_diffuse = clamp(diffuseColorSum, 0, 1);
  }
  </code></pre>
  <p>Thanks for any help!
  I'm using OpenTK, a c# wrapper for OpenGL.</p>