diff options
Diffstat (limited to 'tests/spec/glsl-1.10/execution/vs-loop-simple-unroll-cf-inside-terminator.shader_test')
-rw-r--r-- | tests/spec/glsl-1.10/execution/vs-loop-simple-unroll-cf-inside-terminator.shader_test | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/spec/glsl-1.10/execution/vs-loop-simple-unroll-cf-inside-terminator.shader_test b/tests/spec/glsl-1.10/execution/vs-loop-simple-unroll-cf-inside-terminator.shader_test new file mode 100644 index 000000000..182e65655 --- /dev/null +++ b/tests/spec/glsl-1.10/execution/vs-loop-simple-unroll-cf-inside-terminator.shader_test @@ -0,0 +1,60 @@ +# This tests unrolling of a loop with a single exit point. +# +# Here we test that control flow nested inside the limiting terminator is +# correctly unrolled. +[require] +GLSL >= 1.10 + +[vertex shader] +void main() +{ + gl_Position = gl_Vertex; + + vec4 colour = vec4(1.0, 0.0, 0.0, 1.0); + + int i = 0; + int j = 0; // we use this so the if doesn't get reduced to a series of bcsel + do { + i++; + j++; + + if (i >= 3) { + if (i == 3) { + colour = vec4(0.0, 1.0, 0.0, 1.0); + j++; + if (j != 6) + colour = vec4(1.0, 0.0, 1.0, 1.0); + } else { + colour = vec4(1.0, 1.0, 0.0, 1.0); + } + break; + } else { + if (i != 1) { + j++; + } + } + + if (i >= 5) { + j++; // unreachable + break; + } else { + if (i != 1) { + j++; + } + } + } while (i < 4); + + gl_FrontColor = colour; +} + +[fragment shader] +void main() +{ + gl_FragColor = gl_Color; +} + +[test] +clear color 0.5 0.5 0.5 0.5 + +draw rect -1 -1 2 2 +probe all rgba 0.0 1.0 0.0 1.0 |