[Piglit] [PATCH] glsl-1.30/compiler/switch-statement: Add new tests for duplicated case labels.

Eric Anholt eric at anholt.net
Wed Jan 11 12:52:13 PST 2012


We were quietly allowing these compile errors to get through.
---
 .../switch-statement/switch-case-duplicated.vert   |   22 ++++++++++++++++
 .../switch-default-duplicated.vert                 |   26 ++++++++++++++++++++
 2 files changed, 48 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/glsl-1.30/compiler/switch-statement/switch-case-duplicated.vert
 create mode 100644 tests/spec/glsl-1.30/compiler/switch-statement/switch-default-duplicated.vert

diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-duplicated.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-duplicated.vert
new file mode 100644
index 0000000..d1c466d
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-duplicated.vert
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+//     "It is an error to have more than one default or a replicated
+//      constant-expression."
+
+#version 130
+
+void main() {
+   int tmp = 0;
+   switch (1) {
+   case 0:
+   case 0:
+      tmp = 1;
+   }
+
+   gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-default-duplicated.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-default-duplicated.vert
new file mode 100644
index 0000000..308a416
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-default-duplicated.vert
@@ -0,0 +1,26 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+//     "It is an error to have more than one default or a replicated
+//      constant-expression."
+
+#version 130
+
+void main() {
+	int tmp = 0;
+
+	switch (1) {
+	case 0:
+		break;
+	default:
+	default:
+		tmp = 1;
+		break;
+	}
+
+	gl_Position = vec4(0.0);
+}
-- 
1.7.7.3



More information about the Piglit mailing list