[Piglit] [PATCH 4/4] glsl-1.30: Split test switch-default-notlast in two.

Fabian Bieler fabianbieler at fastmail.fm
Wed May 29 01:58:20 PDT 2013


Split the test into one test with and one without fallthrough case statements.

Signed-off-by: Fabian Bieler <fabianbieler at fastmail.fm>
---
 .../fs-default-notlast-fallthrough.shader_test     | 40 ++++++++++++++++++++++
 .../switch/fs-default_notlast.shader_test          | 22 ++++++++----
 2 files changed, 56 insertions(+), 6 deletions(-)
 create mode 100644 tests/spec/glsl-1.30/execution/switch/fs-default-notlast-fallthrough.shader_test

diff --git a/tests/spec/glsl-1.30/execution/switch/fs-default-notlast-fallthrough.shader_test b/tests/spec/glsl-1.30/execution/switch/fs-default-notlast-fallthrough.shader_test
new file mode 100644
index 0000000..4fa6445
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/switch/fs-default-notlast-fallthrough.shader_test
@@ -0,0 +1,40 @@
+[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, 0.0, 0.0, 0.0);
+	vec4 tmp = vec4(0.0, 0.0, 0.0, 0.0);
+	switch (i) {
+	case 0:
+		gl_FragColor.x = 1.0;
+	default:
+		gl_FragColor.z = 1.0;
+	case 1:
+		gl_FragColor.y = 1.0;
+	}
+}
+
+[test]
+uniform int i 0
+draw rect -1 -1 1 1
+uniform int i 1
+draw rect 0 -1 1 1
+uniform int i 2
+draw rect -1 0 1 1
+
+relative probe rgba (0, 0) (1, 1, 1, 0)
+relative probe rgba (1, 0) (0, 1, 0, 0)
+relative probe rgba (0, 1) (0, 1, 1, 0)
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
index 385fd78..e1e2079 100644
--- 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
@@ -15,19 +15,29 @@ uniform int i;
 
 void main()
 {
+	gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
 	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);
+		gl_FragColor.x = 1.0;
+		break;
+	default:
+		gl_FragColor.z = 1.0;
+		break;
+	case 1:
+		gl_FragColor.y = 1.0;
 		break;
 	}
-	gl_FragColor = gl_FragColor + tmp;
 }
 
 [test]
 uniform int i 0
-draw rect -1 -1 2 2
+draw rect -1 -1 1 1
+uniform int i 1
+draw rect 0 -1 1 1
+uniform int i 2
+draw rect -1 0 1 1
 
-probe all rgba 0 1 0 0
+relative probe rgba (0, 0) (1, 0, 0, 0)
+relative probe rgba (1, 0) (0, 1, 0, 0)
+relative probe rgba (0, 1) (0, 0, 1, 0)
-- 
1.8.1.2



More information about the Piglit mailing list