diff options
author | Pavel Ondračka <pavel.ondracka@gmail.com> | 2022-06-05 22:07:47 +0200 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2022-06-14 20:08:54 +0000 |
commit | 1d5899d94546ec83941c92f2e08258de0f98e392 (patch) | |
tree | 866085dca3bdb5a6d50bfa0a63844215ef9e7f51 | |
parent | b84975ef4575d8121dbc50fca72341aad4572cdc (diff) |
Add loop test to demonstrate bug in r300 compiler
This is based on the existing vs-loop-complex-unroll-with-else-break
test, however this one can't be unrolled and demonstrates an issue
with copy propagation in r300 compiler.
More details in: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6467
Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/694>
-rw-r--r-- | tests/spec/glsl-1.10/execution/vs-loop-complex-with-else-break.shader_test | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/spec/glsl-1.10/execution/vs-loop-complex-with-else-break.shader_test b/tests/spec/glsl-1.10/execution/vs-loop-complex-with-else-break.shader_test new file mode 100644 index 000000000..43430071b --- /dev/null +++ b/tests/spec/glsl-1.10/execution/vs-loop-complex-with-else-break.shader_test @@ -0,0 +1,57 @@ +# This tests a bug in the r300 compiler where it was too aggresive +# with optimizations (copy propagation) of movs in loops. +# +# See: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6467 +[require] +GLSL >= 1.10 + +[vertex shader] +uniform int loop_count; +uniform int limit; + +void main() +{ + gl_Position = gl_Vertex; + + vec4 colour = vec4(1.0, 1.0, 1.0, 1.0); + for (int i = 0; i < loop_count; i++) { + + if (i > limit) { + colour = vec4(1.0, 0.0, 0.0, 1.0); + } + + if (i <= limit) { + colour = vec4(0.0, 1.0, 0.0, 1.0); + } else { + break; + } + } + + gl_FrontColor = colour; +} + +[fragment shader] +void main() +{ + gl_FragColor = gl_Color; +} + +[test] +clear color 0.5 0.5 0.5 0.5 + +uniform int limit 1 +uniform int loop_count 3 +draw rect -1 -1 2 2 +probe all rgba 1.0 0.0 0.0 1.0 + +uniform int loop_count 2 +draw rect -1 -1 2 2 +probe all rgba 0.0 1.0 0.0 1.0 + +uniform int loop_count 1 +draw rect -1 -1 2 2 +probe all rgba 0.0 1.0 0.0 1.0 + +uniform int loop_count 0 +draw rect -1 -1 2 2 +probe all rgba 1.0 1.0 1.0 1.0 |