[Piglit] [PATCH 3/3] glsl-es-3.00: Verify that no statment is allowed before the first case in a switch

Ian Romanick idr at freedesktop.org
Fri Nov 16 16:08:18 PST 2012


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 tests/all.tests                                    |  7 +++++++
 .../compiler/no-statement-before-first-case.vert   | 24 ++++++++++++++++++++++
 2 files changed, 31 insertions(+)
 create mode 100644 tests/spec/glsl-es-3.00/compiler/no-statement-before-first-case.vert

diff --git a/tests/all.tests b/tests/all.tests
index 8f0d2c5..75d7cbb 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -825,6 +825,13 @@ for stage in ['vs', 'fs']:
 		spec['glsl-1.40/execution/texelFetch/' + stage + '-texelFetch-' + sampler] = concurrent_test('texelFetch 140 ' + stage + ' ' + sampler)
 		spec['glsl-1.40/execution/texelFetchOffset/' + stage + '-' + sampler] = concurrent_test('texelFetch offset 140 ' + stage + ' ' + sampler)
 
+# Group spec/glsl-es-3.00
+spec['glsl-es-3.00'] = Group()
+import_glsl_parser_tests(spec['glsl-es-3.00'],
+			 os.path.join(testsDir, 'spec', 'glsl-es-3.00'),
+			 ['compiler'])
+
+
 # Group AMD_conservative_depth
 spec['AMD_conservative_depth'] = Group()
 import_glsl_parser_tests(spec['AMD_conservative_depth'],
diff --git a/tests/spec/glsl-es-3.00/compiler/no-statement-before-first-case.vert b/tests/spec/glsl-es-3.00/compiler/no-statement-before-first-case.vert
new file mode 100644
index 0000000..737fda3
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/no-statement-before-first-case.vert
@@ -0,0 +1,24 @@
+#version 300 es
+
+/* [config]
+ * expect_result: fail
+ * glsl_version: 3.00
+ * [end config]
+ *
+ * Page 80 of the OpenGL ES Shading Language 3.00 spec says:
+ *
+ *     "No statements are allowed in a switch statement before the first case
+ *     statement."
+ */
+
+uniform int x;
+
+void main()
+{
+  switch (x) {
+    gl_Position = vec4(0.);
+  default:
+    gl_Position = vec4(1.);
+    break;
+  }
+}
-- 
1.7.11.7



More information about the Piglit mailing list