title: GLSL branching behaviour
body: <p>I have a rather simple fragment shader with a branch and I'm a bit unsure how it is handled by the GLSL compiler and how it would affect performance.</p>
  
  <pre><code>uniform sampler2D sampler;
  uniform vec2 texSize;
  uniform vec2 targetSize; 
  
  void main()               
  {                  
      vec4 color;
      if(texSize == targetSize)
          color = texture2DNearest(sampler, gl_TexCoord[0]);
      else
          color = texture2DBicubic(sampler, gl_TexCoord[0]);
      gl_FragColor = color;        
  }
  </code></pre>
  
  <p>I have read from an <a href="http://developer.amd.com/media/gpu_assets/04%20Clever%20Shader%20Tricks.pdf" rel="noreferrer">AMDs document</a> that sometimes both branches are executed, which would not be a good idea in this case. Without further information nor access to disassembly I'm unsure what to think about this, and how to avoid it if it is a problem?</p>
  
  <p>And also from my understanding a branch based on a uniform variable will not incur any significant overhead since it is constant over a single pass?</p>