[Piglit] [PATCH 4/4] glsl-1.30: New test for fallthrough behavior in switch statements.

Eric Anholt eric at anholt.net
Fri Jan 27 10:11:51 PST 2012


This surprised me by actually working.
---
 .../execution/switch/fs-fallthrough.shader_test    |   44 ++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/glsl-1.30/execution/switch/fs-fallthrough.shader_test

diff --git a/tests/spec/glsl-1.30/execution/switch/fs-fallthrough.shader_test b/tests/spec/glsl-1.30/execution/switch/fs-fallthrough.shader_test
new file mode 100644
index 0000000..88de642
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/switch/fs-fallthrough.shader_test
@@ -0,0 +1,44 @@
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+void main()
+{
+	gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+#version 130
+
+uniform int i;
+
+void main()
+{
+	gl_FragColor = vec4(0.0);
+
+	switch (i) {
+	case 0:
+		gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);
+		/* FALLTHROUGH */
+	case 1:
+		gl_FragColor += vec4(0.0, 0.0, 1.0, 0.0);
+		break;
+
+	default:
+		gl_FragColor += vec4(1.0, 0.0, 0.0, 0.0);
+		break;
+	}
+}
+
+[test]
+uniform int i 0
+draw rect -1 -1 1 2
+uniform int i 1
+draw rect 0 -1 1 2
+
+relative probe rgba (0.0, 0.0) (0.0, 1.0, 1.0, 0.0)
+relative probe rgba (0.0, 1.0) (0.0, 1.0, 1.0, 0.0)
+
+relative probe rgba (1.0, 0.0) (0.0, 0.0, 1.0, 0.0)
+relative probe rgba (1.0, 1.0) (0.0, 0.0, 1.0, 0.0)
-- 
1.7.7.3



More information about the Piglit mailing list