From a1c980414bef722a7fc695633cb1338877f8263b Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 7 Sep 2014 21:28:36 +1200 Subject: arb_tessellation_shader: test that redeclared barrier() is unrestricted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chris Forbes Reviewed-by: Marek Olšák --- .../compiler/barrier-redeclared.tesc | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/spec/arb_tessellation_shader/compiler/barrier-redeclared.tesc 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 */ +} -- cgit v1.2.3