[Piglit] [PATCH 3/4] glsl-1.30: Test conditional breaks in switch statements.
Fabian Bieler
fabianbieler at fastmail.fm
Wed May 29 01:58:20 PDT 2013
Signed-off-by: Fabian Bieler <fabianbieler at fastmail.fm>
---
.../switch/fs-conditional-break.shader_test | 48 ++++++++++++++++++++++
1 file changed, 48 insertions(+)
create mode 100644 tests/spec/glsl-1.30/execution/switch/fs-conditional-break.shader_test
diff --git a/tests/spec/glsl-1.30/execution/switch/fs-conditional-break.shader_test b/tests/spec/glsl-1.30/execution/switch/fs-conditional-break.shader_test
new file mode 100644
index 0000000..f94df36
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/switch/fs-conditional-break.shader_test
@@ -0,0 +1,48 @@
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+void main()
+{
+ gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+#version 130
+
+uniform ivec4 i;
+
+void main()
+{
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
+ switch (i.x) {
+ case 0:
+ if(i.y == 1) {//false
+ gl_FragColor = vec4(0.0, 0.0, 1.0, 0.0);
+ break;
+ }
+ gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);//last assign
+ if(i.z == 0) {//true
+ break;
+ gl_FragColor = vec4(0.0, 1.0, 1.0, 0.0);
+ }
+ gl_FragColor = vec4(1.0, 0.0, 0.0, 0.0);
+ break;
+ gl_FragColor = vec4(1.0, 0.0, 1.0, 0.0);
+ if(i.w == 1) {//false
+ gl_FragColor = vec4(1.0, 1.0, 0.0, 0.0);
+ break;
+ }
+
+ default:
+ gl_FragColor = vec4(1.0, 1.0, 1.0, 0.0);
+ break;
+ }
+}
+
+[test]
+uniform ivec4 i 0 0 0 0
+draw rect -1 -1 2 2
+
+probe all rgba 0 1 0 0
--
1.8.1.2
More information about the Piglit
mailing list