bgfx/3rdparty/glsl-optimizer/tests/fragment/bug-const-variable-in.txt

20 lines
426 B
Text
Raw Normal View History

2013-04-09 01:40:18 -04:00
// Used to expose bugs in constant variable optimization,
// when variables were deemed constant not taking into
// account branches or previous dereferences of them.
uniform float mode;
float func (float c) {
if (mode == 2.0)
return c;
if (mode == 3.0)
discard;
if (mode == 10.0)
c = 0.1;
return c;
}
void main() {
vec4 c = gl_FragCoord;
c.x = func(c.x);
gl_FragColor = c;
}