title: GLSL fragment shader flat in are considered dynamically uniform expressions?
body: <p>In <a href="https://www.opengl.org/discussion_boards/showthread.php/200208-Cascade-Shadow-Mapping-artefacts-via-sampler2D-array?styleid=12" rel="nofollow noreferrer">this OpenGL forum post</a> it was said that:</p>
  
  <blockquote>
    <p>In GLSL 4.x, arrays of samplers may only be indexed with dynamically-uniform expressions (in a vertex shader the expression may only involve uniform variables, in a fragment shader it may only involve uniform variables and flat-qualified inputs).</p>
  </blockquote>
  
  <p>I was trying to look for this in the GLSL specification but can't find it. I'm a bit nervous to try and spend time changing up code if it doesn't work. My biggest worry is if I do it and it somehow appears to work on my computer but I'm invoking undefined behavior without knowing (which would probably end badly somewhere, sometime).</p>
  
  <p>An example of what I'd like to do (I have not run this, it's an example and should be considered pseudocode):</p>
  
  <pre><code>// Fragment shader
  
  in vec3 uv;
  flat in uint index;  // Assume in the range of 0 to 3 inclusive
  
  uniform sampler3D textureSampler[4];
  
  void main() {
      someColor = texture(textureSampler[index], uv);
      // ...
  }
  </code></pre>
  
  <p>Is this defined behavior because it has the <strong>flat</strong> qualifier? Or no?</p>