You got that twisted. Conditional statements which are dynamically uniform and evaluate to false will not trigger execution of the code. Since your statement isn't dynamically uniform, potentially both branches are executed as GClements pointed out and if then excuted code triggers undefined behavior which isn't handled graciously by the implementation, you get into trouble.Originally Posted by fred_em
Here's why your condition isn't dynamically uniform:
- it's not a constant expression, so the trivial case is out
- gl_FragColor is not a uniform but a built-in fragment shader input:
Code :in vec4 gl_FragCoord;
The GLSL Spec states:
It should be obvious that this is generally not (if ever)the case for an expression involving gl_FragCoord - even though it will always evaluates to false.A fragment-shader expression is dynamically uniform if all fragments evaluating it get the same resulting value.