[Piglit] [PATCH 11/12] arb_tessellation_shader: split barrier-switch test
Chris Forbes
chrisf at ijw.co.nz
Wed Sep 17 00:42:24 PDT 2014
Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
.../compiler/barrier-switch-always.tesc | 43 ++++++++++++++++++++++
.../compiler/barrier-switch.tesc | 2 +
2 files changed, 45 insertions(+)
create mode 100644 tests/spec/arb_tessellation_shader/compiler/barrier-switch-always.tesc
diff --git a/tests/spec/arb_tessellation_shader/compiler/barrier-switch-always.tesc b/tests/spec/arb_tessellation_shader/compiler/barrier-switch-always.tesc
new file mode 100644
index 0000000..ad8baca
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/compiler/barrier-switch-always.tesc
@@ -0,0 +1,43 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_tessellation_shader
+// check_link: true
+// [end config]
+
+/**
+ * From issue 42:
+ *
+ * As a result, we choose a heavy-handed approach in which we only allow
+ * calls to barrier() inside main(). Even within main, barrier() calls are
+ * forbidden inside loops (even those that turn out to have constant loop
+ * counts and don't execute "break" or "continue" statements), if
+ * statements, or after a return statement.
+ *
+ * Further, from the spec text:
+ *
+ * In particular, barrier() may not be called inside
+ * a switch statement, in either sub-statement of an if statement, inside a
+ * do, for, or while loop, or at any point after a return statement in the
+ * function main().
+ *
+ * Technically, we should disallow this usage of barrier() inside the always-taken
+ * default case -- but this is an interesting edge case for Mesa's compiler, which
+ * at this time does not express switch statements in the IR, and so an always-taken
+ * default case is indistinguishable from code outside the switch.
+ */
+
+#version 150
+#extension GL_ARB_tessellation_shader: require
+layout(vertices = 3) out;
+uniform int val;
+
+void main() {
+ gl_out[gl_InvocationID].gl_Position = vec4(0.0);
+ switch (val) {
+ default:
+ barrier();
+ }
+ gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
+ gl_TessLevelInner = float[2](1.0, 1.0);
+}
diff --git a/tests/spec/arb_tessellation_shader/compiler/barrier-switch.tesc b/tests/spec/arb_tessellation_shader/compiler/barrier-switch.tesc
index e08b7e3..2cc2cfd 100644
--- a/tests/spec/arb_tessellation_shader/compiler/barrier-switch.tesc
+++ b/tests/spec/arb_tessellation_shader/compiler/barrier-switch.tesc
@@ -30,6 +30,8 @@ uniform int val;
void main() {
gl_out[gl_InvocationID].gl_Position = vec4(0.0);
switch (val) {
+ case 1:
+ break;
default:
barrier();
}
--
2.1.0
More information about the Piglit
mailing list