[Piglit] [PATCH 2/4] glsl-1.30: Add a new test for a bug in Mesa with nested switch statements.

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


---
 .../execution/switch/fs-uniform-nested.shader_test |   68 ++++++++++++++++++++
 1 files changed, 68 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/glsl-1.30/execution/switch/fs-uniform-nested.shader_test

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



More information about the Piglit mailing list