summaryrefslogtreecommitdiff
path: root/tests/shaders/glsl-fs-main-return-conditional.shader_test
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2013-03-23 02:40:34 +0100
committerRoland Scheidegger <sroland@vmware.com>2013-03-24 00:41:39 +0100
commit3e442a30a2bccdc07b5b0bf7930b1edadfa46fa8 (patch)
tree538269ce0ce5b19c3880cb8cd715138b80ad2f1b /tests/shaders/glsl-fs-main-return-conditional.shader_test
parent66a9f82bd01c56d0f835232d7ffe98b5ceb5544e (diff)
glsl-fs-main-return-conditional: Test for using return in main
Similar to glsl-fs-main-return (and glsl-vs-main-return), this is testing using return in main. Contrary to the these other tests, this hits both the cases where the return path is and is NOT taken (the gallivm code got it wrong and always did an early exit which got unnoticed by the existing tests, see https://bugs.freedesktop.org/show_bug.cgi?id=62357). v2: use mod() instead of integer arithmetic suggested by Ian Romanick. This gets rid of the glsl 1.30 requirement. And do minor simplifications. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'tests/shaders/glsl-fs-main-return-conditional.shader_test')
-rw-r--r--tests/shaders/glsl-fs-main-return-conditional.shader_test28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/shaders/glsl-fs-main-return-conditional.shader_test b/tests/shaders/glsl-fs-main-return-conditional.shader_test
new file mode 100644
index 000000000..173ae03ba
--- /dev/null
+++ b/tests/shaders/glsl-fs-main-return-conditional.shader_test
@@ -0,0 +1,28 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+void main()
+{
+ gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+const vec4 v = vec4(0., 1., 0., 1.);
+
+void main()
+{
+ gl_FragColor = v;
+ if (mod(gl_FragCoord.x, 2.0) >= 1.0)
+ return; // return for every second pixel
+
+ gl_FragColor = vec4(1.0) - v;
+}
+
+[test]
+draw rect -1 -1 2 2
+probe rgb 0 0 1 0 1
+probe rgb 1 0 0 1 0
+probe rgb 2 0 1 0 1
+probe rgb 3 0 0 1 0
+