summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2013-04-12 23:20:07 +0200
committerRoland Scheidegger <sroland@vmware.com>2013-04-13 04:19:24 +0200
commit14893ffd613273e63f31f7bc787189febdb5245d (patch)
tree4f72f8c58ccfd8d0f125206326c4e2ea5aabbbd9 /tests
parentff0ac2938b1801ae264409d68bc2fb463e9b41ac (diff)
glsl-1.30: add test for default in switch not after all case statements
By the looks of it "default" is not required to appear as last statement in a switch expression, and c rules should be followed (which is probably a mess to implement thanks to fallthrough). Seems to fail with mesa glsl compiler (at least with tgsi translation). Reviewed-by: Jose Fonseca <jfonseca@vmware.com> Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'tests')
-rw-r--r--tests/spec/glsl-1.30/execution/switch/fs-default_notlast.shader_test33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/spec/glsl-1.30/execution/switch/fs-default_notlast.shader_test b/tests/spec/glsl-1.30/execution/switch/fs-default_notlast.shader_test
new file mode 100644
index 000000000..385fd78d8
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/switch/fs-default_notlast.shader_test
@@ -0,0 +1,33 @@
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+void main()
+{
+ gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+#version 130
+
+uniform int i;
+
+void main()
+{
+ vec4 tmp = vec4(0.0, 0.0, 0.0, 0.0);
+ switch (i) {
+ default:
+ tmp = vec4(0.5, 0.0, 0.5, 0.0);
+ case 0:
+ gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);
+ break;
+ }
+ gl_FragColor = gl_FragColor + tmp;
+}
+
+[test]
+uniform int i 0
+draw rect -1 -1 2 2
+
+probe all rgba 0 1 0 0