summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Forbes <chrisf@ijw.co.nz>2014-09-07 21:28:36 +1200
committerMarek Olšák <marek.olsak@amd.com>2015-07-27 12:27:41 +0200
commita1c980414bef722a7fc695633cb1338877f8263b (patch)
treecbe966fbeedf6f88f81b27ba16c2a0bc702ed21d
parent5fc6d17c72738937cd691618785c7d4d5d11ccca (diff)
arb_tessellation_shader: test that redeclared barrier() is unrestricted
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
-rw-r--r--tests/spec/arb_tessellation_shader/compiler/barrier-redeclared.tesc44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/spec/arb_tessellation_shader/compiler/barrier-redeclared.tesc b/tests/spec/arb_tessellation_shader/compiler/barrier-redeclared.tesc
new file mode 100644
index 000000000..e1ea1095b
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/compiler/barrier-redeclared.tesc
@@ -0,0 +1,44 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_tessellation_shader
+// check_link: true
+// [end config]
+
+/**
+ * ARB_tessellation_shader imposes tight restrictions on where calls to the
+ * built-in function barrier() may appear.
+ *
+ * If the app provides its own function named 'barrier', then the usual suppression
+ * of the builtin function should apply, and the app-provided function should be
+ * freely callable in any context.
+ */
+
+#version 150
+#extension GL_ARB_tessellation_shader: require
+layout(vertices = 3) out;
+
+void barrier() {} /* suppresses the builtin */
+
+void calls_barrier() {
+ barrier(); /* in non-main OK */
+}
+
+void main() {
+ gl_out[gl_InvocationID].gl_Position = vec4(0.0);
+
+ for (int i = 0; i < 3; i++)
+ barrier(); /* in loops OK */
+
+ calls_barrier();
+
+ gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
+ gl_TessLevelInner = float[2](1.0, 1.0);
+
+ if (gl_in[0].gl_Position.x < 0) {
+ barrier(); /* in control flow OK */
+ return;
+ }
+
+ barrier(); /* after return OK */
+}