<div dir="ltr"><div>Both patches are</div><div><br></div><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>></div><div><br></div><div>Please send a 3rd with switch statements. :-) Or, you can rev this patch. I don't care.<br></div><div><br></div><div>--Jason<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Aug 28, 2018 at 5:13 PM Ian Romanick <<a href="mailto:idr@freedesktop.org">idr@freedesktop.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com" target="_blank">ian.d.romanick@intel.com</a>><br>
<br>
The negative tests in this group require some inference from various<br>
specs. A spec bug has been submitted against the<br>
GL_ARB_fragment_shader_interlock spec.<br>
<br>
Currently none of the negative tests produce the expected result on<br>
Mesa.<br>
<br>
Signed-off-by: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com" target="_blank">ian.d.romanick@intel.com</a>><br>
---<br>
.../beginInvocationInterlock-after-discard.frag | 27 +++++++++++<br>
.../beginInvocationInterlock-after-return.frag | 51 +++++++++++++++++++++<br>
.../beginInvocationInterlock-inside-do-while.frag | 49 ++++++++++++++++++++<br>
.../beginInvocationInterlock-inside-for.frag | 50 +++++++++++++++++++++<br>
.../beginInvocationInterlock-inside-if.frag | 48 ++++++++++++++++++++<br>
...vocationInterlock-inside-non-main-function.frag | 51 +++++++++++++++++++++<br>
.../beginInvocationInterlock-inside-while.frag | 49 ++++++++++++++++++++<br>
.../endInvocationInterlock-after-discard.frag | 28 ++++++++++++<br>
.../endInvocationInterlock-after-return.frag | 52 ++++++++++++++++++++++<br>
.../endInvocationInterlock-inside-do-while.frag | 49 ++++++++++++++++++++<br>
.../endInvocationInterlock-inside-for.frag | 50 +++++++++++++++++++++<br>
.../compiler/endInvocationInterlock-inside-if.frag | 48 ++++++++++++++++++++<br>
...vocationInterlock-inside-non-main-function.frag | 51 +++++++++++++++++++++<br>
.../endInvocationInterlock-inside-while.frag | 50 +++++++++++++++++++++<br>
14 files changed, 653 insertions(+)<br>
create mode 100644 tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-after-discard.frag<br>
create mode 100644 tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-after-return.frag<br>
create mode 100644 tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-inside-do-while.frag<br>
create mode 100644 tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-inside-for.frag<br>
create mode 100644 tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-inside-if.frag<br>
create mode 100644 tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-inside-non-main-function.frag<br>
create mode 100644 tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-inside-while.frag<br>
create mode 100644 tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-after-discard.frag<br>
create mode 100644 tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-after-return.frag<br>
create mode 100644 tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-inside-do-while.frag<br>
create mode 100644 tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-inside-for.frag<br>
create mode 100644 tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-inside-if.frag<br>
create mode 100644 tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-inside-non-main-function.frag<br>
create mode 100644 tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-inside-while.frag<br>
<br>
diff --git a/tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-after-discard.frag b/tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-after-discard.frag<br>
new file mode 100644<br>
index 000000000..1c74fa49c<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-after-discard.frag<br>
@@ -0,0 +1,27 @@<br>
+// [config]<br>
+// expect_result: pass<br>
+// glsl_version: 4.20<br>
+// require_extensions: GL_ARB_fragment_shader_interlock<br>
+// [end config]<br>
+<br>
+/* The GL_ARB_fragment_shader_interlock spec says:<br>
+ *<br>
+ * The beginInvocationInterlockARB() and endInvocationInterlockARB() may<br>
+ * only be placed inside the function main() of a fragment shader and may<br>
+ * not be called within any flow control. These functions may not be<br>
+ * called after a return statement in the function main(), but may be<br>
+ * called after a discard statement.<br>
+ */<br>
+#version 420<br>
+#extension GL_ARB_fragment_shader_interlock: require<br>
+<br>
+in float f;<br>
+<br>
+void main()<br>
+{<br>
+ if (f < 0.5)<br>
+ discard;<br>
+<br>
+ beginInvocationInterlockARB();<br>
+ endInvocationInterlockARB();<br>
+}<br>
diff --git a/tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-after-return.frag b/tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-after-return.frag<br>
new file mode 100644<br>
index 000000000..29493ff9e<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-after-return.frag<br>
@@ -0,0 +1,51 @@<br>
+// [config]<br>
+// expect_result: fail<br>
+// glsl_version: 4.20<br>
+// require_extensions: GL_ARB_fragment_shader_interlock<br>
+// check_link: false<br>
+// [end config]<br>
+<br>
+/* The GL_ARB_fragment_shader_interlock spec says:<br>
+ *<br>
+ * The beginInvocationInterlockARB() and endInvocationInterlockARB() may<br>
+ * only be placed inside the function main() of a fragment shader and may<br>
+ * not be called within any flow control. These functions may not be<br>
+ * called after a return statement in the function main(), but may be<br>
+ * called after a discard statement.<br>
+ *<br>
+ * and<br>
+ *<br>
+ * (8) What restrictions should be imposed on the use of the<br>
+ * beginInvocationInterlockARB() and endInvocationInterlockARB()<br>
+ * functions delimiting a critical section?<br>
+ *<br>
+ * RESOLVED: We impose restrictions similar to those on the barrier()<br>
+ * built-in function in tessellation control shaders to ensure that any<br>
+ * shader using this functionality has a single critical section that can<br>
+ * be easily identified during compilation...<br>
+ *<br>
+ * The GLSL 4.60 spec says:<br>
+ *<br>
+ * For tessellation control shaders, the barrier() function may only be<br>
+ * placed inside the function main() of the tessellation control shader and<br>
+ * may not be called within any control flow. Barriers are also disallowed<br>
+ * after a return statement in the function main(). Any such misplaced<br>
+ * barriers result in a compile-time error.<br>
+ *<br>
+ * From this we infer that the first errors mentioned in the<br>
+ * GL_ARB_fragment_shader_interlock spec are intended to generate compile-time<br>
+ * errors.<br>
+ */<br>
+#version 420<br>
+#extension GL_ARB_fragment_shader_interlock: require<br>
+<br>
+uniform bool condition;<br>
+<br>
+void main()<br>
+{<br>
+ if (condition)<br>
+ return;<br>
+<br>
+ beginInvocationInterlockARB();<br>
+ endInvocationInterlockARB();<br>
+}<br>
diff --git a/tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-inside-do-while.frag b/tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-inside-do-while.frag<br>
new file mode 100644<br>
index 000000000..f68d7936a<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-inside-do-while.frag<br>
@@ -0,0 +1,49 @@<br>
+// [config]<br>
+// expect_result: fail<br>
+// glsl_version: 4.20<br>
+// require_extensions: GL_ARB_fragment_shader_interlock<br>
+// check_link: false<br>
+// [end config]<br>
+<br>
+/* The GL_ARB_fragment_shader_interlock spec says:<br>
+ *<br>
+ * The beginInvocationInterlockARB() and endInvocationInterlockARB() may<br>
+ * only be placed inside the function main() of a fragment shader and may<br>
+ * not be called within any flow control. These functions may not be<br>
+ * called after a return statement in the function main(), but may be<br>
+ * called after a discard statement.<br>
+ *<br>
+ * and<br>
+ *<br>
+ * (8) What restrictions should be imposed on the use of the<br>
+ * beginInvocationInterlockARB() and endInvocationInterlockARB()<br>
+ * functions delimiting a critical section?<br>
+ *<br>
+ * RESOLVED: We impose restrictions similar to those on the barrier()<br>
+ * built-in function in tessellation control shaders to ensure that any<br>
+ * shader using this functionality has a single critical section that can<br>
+ * be easily identified during compilation...<br>
+ *<br>
+ * The GLSL 4.60 spec says:<br>
+ *<br>
+ * For tessellation control shaders, the barrier() function may only be<br>
+ * placed inside the function main() of the tessellation control shader and<br>
+ * may not be called within any control flow. Barriers are also disallowed<br>
+ * after a return statement in the function main(). Any such misplaced<br>
+ * barriers result in a compile-time error.<br>
+ *<br>
+ * From this we infer that the first errors mentioned in the<br>
+ * GL_ARB_fragment_shader_interlock spec are intended to generate compile-time<br>
+ * errors.<br>
+ */<br>
+#version 420<br>
+#extension GL_ARB_fragment_shader_interlock: require<br>
+<br>
+void main()<br>
+{<br>
+ do {<br>
+ beginInvocationInterlockARB();<br>
+ } while (false);<br>
+<br>
+ endInvocationInterlockARB();<br>
+}<br>
diff --git a/tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-inside-for.frag b/tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-inside-for.frag<br>
new file mode 100644<br>
index 000000000..2ca54bc8a<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-inside-for.frag<br>
@@ -0,0 +1,50 @@<br>
+// [config]<br>
+// expect_result: fail<br>
+// glsl_version: 4.20<br>
+// require_extensions: GL_ARB_fragment_shader_interlock<br>
+// check_link: false<br>
+// [end config]<br>
+<br>
+/* The GL_ARB_fragment_shader_interlock spec says:<br>
+ *<br>
+ * The beginInvocationInterlockARB() and endInvocationInterlockARB() may<br>
+ * only be placed inside the function main() of a fragment shader and may<br>
+ * not be called within any flow control. These functions may not be<br>
+ * called after a return statement in the function main(), but may be<br>
+ * called after a discard statement.<br>
+ *<br>
+ * and<br>
+ *<br>
+ * (8) What restrictions should be imposed on the use of the<br>
+ * beginInvocationInterlockARB() and endInvocationInterlockARB()<br>
+ * functions delimiting a critical section?<br>
+ *<br>
+ * RESOLVED: We impose restrictions similar to those on the barrier()<br>
+ * built-in function in tessellation control shaders to ensure that any<br>
+ * shader using this functionality has a single critical section that can<br>
+ * be easily identified during compilation...<br>
+ *<br>
+ * The GLSL 4.60 spec says:<br>
+ *<br>
+ * For tessellation control shaders, the barrier() function may only be<br>
+ * placed inside the function main() of the tessellation control shader and<br>
+ * may not be called within any control flow. Barriers are also disallowed<br>
+ * after a return statement in the function main(). Any such misplaced<br>
+ * barriers result in a compile-time error.<br>
+ *<br>
+ * From this we infer that the first errors mentioned in the<br>
+ * GL_ARB_fragment_shader_interlock spec are intended to generate compile-time<br>
+ * errors.<br>
+ */<br>
+#version 420<br>
+#extension GL_ARB_fragment_shader_interlock: require<br>
+<br>
+void main()<br>
+{<br>
+ for (;;) {<br>
+ beginInvocationInterlockARB();<br>
+ break;<br>
+ }<br>
+<br>
+ endInvocationInterlockARB();<br>
+}<br>
diff --git a/tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-inside-if.frag b/tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-inside-if.frag<br>
new file mode 100644<br>
index 000000000..53fe7e7d9<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-inside-if.frag<br>
@@ -0,0 +1,48 @@<br>
+// [config]<br>
+// expect_result: fail<br>
+// glsl_version: 4.20<br>
+// require_extensions: GL_ARB_fragment_shader_interlock<br>
+// check_link: false<br>
+// [end config]<br>
+<br>
+/* The GL_ARB_fragment_shader_interlock spec says:<br>
+ *<br>
+ * The beginInvocationInterlockARB() and endInvocationInterlockARB() may<br>
+ * only be placed inside the function main() of a fragment shader and may<br>
+ * not be called within any flow control. These functions may not be<br>
+ * called after a return statement in the function main(), but may be<br>
+ * called after a discard statement.<br>
+ *<br>
+ * and<br>
+ *<br>
+ * (8) What restrictions should be imposed on the use of the<br>
+ * beginInvocationInterlockARB() and endInvocationInterlockARB()<br>
+ * functions delimiting a critical section?<br>
+ *<br>
+ * RESOLVED: We impose restrictions similar to those on the barrier()<br>
+ * built-in function in tessellation control shaders to ensure that any<br>
+ * shader using this functionality has a single critical section that can<br>
+ * be easily identified during compilation...<br>
+ *<br>
+ * The GLSL 4.60 spec says:<br>
+ *<br>
+ * For tessellation control shaders, the barrier() function may only be<br>
+ * placed inside the function main() of the tessellation control shader and<br>
+ * may not be called within any control flow. Barriers are also disallowed<br>
+ * after a return statement in the function main(). Any such misplaced<br>
+ * barriers result in a compile-time error.<br>
+ *<br>
+ * From this we infer that the first errors mentioned in the<br>
+ * GL_ARB_fragment_shader_interlock spec are intended to generate compile-time<br>
+ * errors.<br>
+ */<br>
+#version 420<br>
+#extension GL_ARB_fragment_shader_interlock: require<br>
+<br>
+void main()<br>
+{<br>
+ if (true)<br>
+ beginInvocationInterlockARB();<br>
+<br>
+ endInvocationInterlockARB();<br>
+}<br>
diff --git a/tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-inside-non-main-function.frag b/tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-inside-non-main-function.frag<br>
new file mode 100644<br>
index 000000000..63c1c6c4b<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-inside-non-main-function.frag<br>
@@ -0,0 +1,51 @@<br>
+// [config]<br>
+// expect_result: fail<br>
+// glsl_version: 4.20<br>
+// require_extensions: GL_ARB_fragment_shader_interlock<br>
+// check_link: false<br>
+// [end config]<br>
+<br>
+/* The GL_ARB_fragment_shader_interlock spec says:<br>
+ *<br>
+ * The beginInvocationInterlockARB() and endInvocationInterlockARB() may<br>
+ * only be placed inside the function main() of a fragment shader and may<br>
+ * not be called within any flow control. These functions may not be<br>
+ * called after a return statement in the function main(), but may be<br>
+ * called after a discard statement.<br>
+ *<br>
+ * and<br>
+ *<br>
+ * (8) What restrictions should be imposed on the use of the<br>
+ * beginInvocationInterlockARB() and endInvocationInterlockARB()<br>
+ * functions delimiting a critical section?<br>
+ *<br>
+ * RESOLVED: We impose restrictions similar to those on the barrier()<br>
+ * built-in function in tessellation control shaders to ensure that any<br>
+ * shader using this functionality has a single critical section that can<br>
+ * be easily identified during compilation...<br>
+ *<br>
+ * The GLSL 4.60 spec says:<br>
+ *<br>
+ * For tessellation control shaders, the barrier() function may only be<br>
+ * placed inside the function main() of the tessellation control shader and<br>
+ * may not be called within any control flow. Barriers are also disallowed<br>
+ * after a return statement in the function main(). Any such misplaced<br>
+ * barriers result in a compile-time error.<br>
+ *<br>
+ * From this we infer that the first errors mentioned in the<br>
+ * GL_ARB_fragment_shader_interlock spec are intended to generate compile-time<br>
+ * errors.<br>
+ */<br>
+#version 420<br>
+#extension GL_ARB_fragment_shader_interlock: require<br>
+<br>
+void wrapper()<br>
+{<br>
+ beginInvocationInterlockARB();<br>
+}<br>
+<br>
+void main()<br>
+{<br>
+ wrapper();<br>
+ endInvocationInterlockARB();<br>
+}<br>
diff --git a/tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-inside-while.frag b/tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-inside-while.frag<br>
new file mode 100644<br>
index 000000000..6283c5ef7<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_shader_interlock/compiler/beginInvocationInterlock-inside-while.frag<br>
@@ -0,0 +1,49 @@<br>
+// [config]<br>
+// expect_result: fail<br>
+// glsl_version: 4.20<br>
+// require_extensions: GL_ARB_fragment_shader_interlock<br>
+// check_link: false<br>
+// [end config]<br>
+<br>
+/* The GL_ARB_fragment_shader_interlock spec says:<br>
+ *<br>
+ * A compile- or link-time error will be generated if main() calls either<br>
+ * function more than once, contains a call to one function without a<br>
+ * matching call to the other, or calls endInvocationInterlockARB() before<br>
+ * calling beginInvocationInterlockARB().<br>
+ *<br>
+ * and<br>
+ *<br>
+ * (8) What restrictions should be imposed on the use of the<br>
+ * beginInvocationInterlockARB() and endInvocationInterlockARB() functions<br>
+ * delimiting a critical section?<br>
+ *<br>
+ * RESOLVED: We impose restrictions similar to those on the barrier()<br>
+ * built-in function in tessellation control shaders to ensure that any<br>
+ * shader using this functionality has a single critical section that can<br>
+ * be easily identified during compilation...<br>
+ *<br>
+ * The GLSL 4.60 spec says:<br>
+ *<br>
+ * For tessellation control shaders, the barrier() function may only be<br>
+ * placed inside the function main() of the tessellation control shader and<br>
+ * may not be called within any control flow. Barriers are also disallowed<br>
+ * after a return statement in the function main(). Any such misplaced<br>
+ * barriers result in a compile-time error.<br>
+ *<br>
+ * From this we infer that the first errors mentioned in the<br>
+ * GL_ARB_fragment_shader_interlock spec are intended to generate compile-time<br>
+ * errors.<br>
+ */<br>
+#version 420<br>
+#extension GL_ARB_fragment_shader_interlock: require<br>
+<br>
+void main()<br>
+{<br>
+ while (true) {<br>
+ beginInvocationInterlockARB();<br>
+ break;<br>
+ }<br>
+<br>
+ endInvocationInterlockARB();<br>
+}<br>
diff --git a/tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-after-discard.frag b/tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-after-discard.frag<br>
new file mode 100644<br>
index 000000000..82344231d<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-after-discard.frag<br>
@@ -0,0 +1,28 @@<br>
+// [config]<br>
+// expect_result: pass<br>
+// glsl_version: 4.20<br>
+// require_extensions: GL_ARB_fragment_shader_interlock<br>
+// [end config]<br>
+<br>
+/* The GL_ARB_fragment_shader_interlock spec says:<br>
+ *<br>
+ * The beginInvocationInterlockARB() and endInvocationInterlockARB() may<br>
+ * only be placed inside the function main() of a fragment shader and may<br>
+ * not be called within any flow control. These functions may not be<br>
+ * called after a return statement in the function main(), but may be<br>
+ * called after a discard statement.<br>
+ */<br>
+#version 420<br>
+#extension GL_ARB_fragment_shader_interlock: require<br>
+<br>
+in float f;<br>
+<br>
+void main()<br>
+{<br>
+ beginInvocationInterlockARB();<br>
+<br>
+ if (f < 0.5)<br>
+ discard;<br>
+<br>
+ endInvocationInterlockARB();<br>
+}<br>
diff --git a/tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-after-return.frag b/tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-after-return.frag<br>
new file mode 100644<br>
index 000000000..83fcaf47a<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-after-return.frag<br>
@@ -0,0 +1,52 @@<br>
+// [config]<br>
+// expect_result: fail<br>
+// glsl_version: 4.20<br>
+// require_extensions: GL_ARB_fragment_shader_interlock<br>
+// check_link: false<br>
+// [end config]<br>
+<br>
+/* The GL_ARB_fragment_shader_interlock spec says:<br>
+ *<br>
+ * The beginInvocationInterlockARB() and endInvocationInterlockARB() may<br>
+ * only be placed inside the function main() of a fragment shader and may<br>
+ * not be called within any flow control. These functions may not be<br>
+ * called after a return statement in the function main(), but may be<br>
+ * called after a discard statement.<br>
+ *<br>
+ * and<br>
+ *<br>
+ * (8) What restrictions should be imposed on the use of the<br>
+ * beginInvocationInterlockARB() and endInvocationInterlockARB()<br>
+ * functions delimiting a critical section?<br>
+ *<br>
+ * RESOLVED: We impose restrictions similar to those on the barrier()<br>
+ * built-in function in tessellation control shaders to ensure that any<br>
+ * shader using this functionality has a single critical section that can<br>
+ * be easily identified during compilation...<br>
+ *<br>
+ * The GLSL 4.60 spec says:<br>
+ *<br>
+ * For tessellation control shaders, the barrier() function may only be<br>
+ * placed inside the function main() of the tessellation control shader and<br>
+ * may not be called within any control flow. Barriers are also disallowed<br>
+ * after a return statement in the function main(). Any such misplaced<br>
+ * barriers result in a compile-time error.<br>
+ *<br>
+ * From this we infer that the first errors mentioned in the<br>
+ * GL_ARB_fragment_shader_interlock spec are intended to generate compile-time<br>
+ * errors.<br>
+ */<br>
+#version 420<br>
+#extension GL_ARB_fragment_shader_interlock: require<br>
+<br>
+uniform bool condition;<br>
+<br>
+void main()<br>
+{<br>
+ beginInvocationInterlockARB();<br>
+<br>
+ if (condition)<br>
+ return;<br>
+<br>
+ endInvocationInterlockARB();<br>
+}<br>
diff --git a/tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-inside-do-while.frag b/tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-inside-do-while.frag<br>
new file mode 100644<br>
index 000000000..8875e1ff7<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-inside-do-while.frag<br>
@@ -0,0 +1,49 @@<br>
+// [config]<br>
+// expect_result: fail<br>
+// glsl_version: 4.20<br>
+// require_extensions: GL_ARB_fragment_shader_interlock<br>
+// check_link: false<br>
+// [end config]<br>
+<br>
+/* The GL_ARB_fragment_shader_interlock spec says:<br>
+ *<br>
+ * The beginInvocationInterlockARB() and endInvocationInterlockARB() may<br>
+ * only be placed inside the function main() of a fragment shader and may<br>
+ * not be called within any flow control. These functions may not be<br>
+ * called after a return statement in the function main(), but may be<br>
+ * called after a discard statement.<br>
+ *<br>
+ * and<br>
+ *<br>
+ * (8) What restrictions should be imposed on the use of the<br>
+ * beginInvocationInterlockARB() and endInvocationInterlockARB()<br>
+ * functions delimiting a critical section?<br>
+ *<br>
+ * RESOLVED: We impose restrictions similar to those on the barrier()<br>
+ * built-in function in tessellation control shaders to ensure that any<br>
+ * shader using this functionality has a single critical section that can<br>
+ * be easily identified during compilation...<br>
+ *<br>
+ * The GLSL 4.60 spec says:<br>
+ *<br>
+ * For tessellation control shaders, the barrier() function may only be<br>
+ * placed inside the function main() of the tessellation control shader and<br>
+ * may not be called within any control flow. Barriers are also disallowed<br>
+ * after a return statement in the function main(). Any such misplaced<br>
+ * barriers result in a compile-time error.<br>
+ *<br>
+ * From this we infer that the first errors mentioned in the<br>
+ * GL_ARB_fragment_shader_interlock spec are intended to generate compile-time<br>
+ * errors.<br>
+ */<br>
+#version 420<br>
+#extension GL_ARB_fragment_shader_interlock: require<br>
+<br>
+void main()<br>
+{<br>
+ beginInvocationInterlockARB();<br>
+<br>
+ do {<br>
+ endInvocationInterlockARB();<br>
+ } while (false);<br>
+}<br>
diff --git a/tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-inside-for.frag b/tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-inside-for.frag<br>
new file mode 100644<br>
index 000000000..468054fbf<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-inside-for.frag<br>
@@ -0,0 +1,50 @@<br>
+// [config]<br>
+// expect_result: fail<br>
+// glsl_version: 4.20<br>
+// require_extensions: GL_ARB_fragment_shader_interlock<br>
+// check_link: false<br>
+// [end config]<br>
+<br>
+/* The GL_ARB_fragment_shader_interlock spec says:<br>
+ *<br>
+ * The beginInvocationInterlockARB() and endInvocationInterlockARB() may<br>
+ * only be placed inside the function main() of a fragment shader and may<br>
+ * not be called within any flow control. These functions may not be<br>
+ * called after a return statement in the function main(), but may be<br>
+ * called after a discard statement.<br>
+ *<br>
+ * and<br>
+ *<br>
+ * (8) What restrictions should be imposed on the use of the<br>
+ * beginInvocationInterlockARB() and endInvocationInterlockARB()<br>
+ * functions delimiting a critical section?<br>
+ *<br>
+ * RESOLVED: We impose restrictions similar to those on the barrier()<br>
+ * built-in function in tessellation control shaders to ensure that any<br>
+ * shader using this functionality has a single critical section that can<br>
+ * be easily identified during compilation...<br>
+ *<br>
+ * The GLSL 4.60 spec says:<br>
+ *<br>
+ * For tessellation control shaders, the barrier() function may only be<br>
+ * placed inside the function main() of the tessellation control shader and<br>
+ * may not be called within any control flow. Barriers are also disallowed<br>
+ * after a return statement in the function main(). Any such misplaced<br>
+ * barriers result in a compile-time error.<br>
+ *<br>
+ * From this we infer that the first errors mentioned in the<br>
+ * GL_ARB_fragment_shader_interlock spec are intended to generate compile-time<br>
+ * errors.<br>
+ */<br>
+#version 420<br>
+#extension GL_ARB_fragment_shader_interlock: require<br>
+<br>
+void main()<br>
+{<br>
+ beginInvocationInterlockARB();<br>
+<br>
+ for (;;) {<br>
+ endInvocationInterlockARB();<br>
+ break;<br>
+ }<br>
+}<br>
diff --git a/tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-inside-if.frag b/tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-inside-if.frag<br>
new file mode 100644<br>
index 000000000..648f10709<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-inside-if.frag<br>
@@ -0,0 +1,48 @@<br>
+// [config]<br>
+// expect_result: fail<br>
+// glsl_version: 4.20<br>
+// require_extensions: GL_ARB_fragment_shader_interlock<br>
+// check_link: false<br>
+// [end config]<br>
+<br>
+/* The GL_ARB_fragment_shader_interlock spec says:<br>
+ *<br>
+ * The beginInvocationInterlockARB() and endInvocationInterlockARB() may<br>
+ * only be placed inside the function main() of a fragment shader and may<br>
+ * not be called within any flow control. These functions may not be<br>
+ * called after a return statement in the function main(), but may be<br>
+ * called after a discard statement.<br>
+ *<br>
+ * and<br>
+ *<br>
+ * (8) What restrictions should be imposed on the use of the<br>
+ * beginInvocationInterlockARB() and endInvocationInterlockARB()<br>
+ * functions delimiting a critical section?<br>
+ *<br>
+ * RESOLVED: We impose restrictions similar to those on the barrier()<br>
+ * built-in function in tessellation control shaders to ensure that any<br>
+ * shader using this functionality has a single critical section that can<br>
+ * be easily identified during compilation...<br>
+ *<br>
+ * The GLSL 4.60 spec says:<br>
+ *<br>
+ * For tessellation control shaders, the barrier() function may only be<br>
+ * placed inside the function main() of the tessellation control shader and<br>
+ * may not be called within any control flow. Barriers are also disallowed<br>
+ * after a return statement in the function main(). Any such misplaced<br>
+ * barriers result in a compile-time error.<br>
+ *<br>
+ * From this we infer that the first errors mentioned in the<br>
+ * GL_ARB_fragment_shader_interlock spec are intended to generate compile-time<br>
+ * errors.<br>
+ */<br>
+#version 420<br>
+#extension GL_ARB_fragment_shader_interlock: require<br>
+<br>
+void main()<br>
+{<br>
+ beginInvocationInterlockARB();<br>
+<br>
+ if (true)<br>
+ endInvocationInterlockARB();<br>
+}<br>
diff --git a/tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-inside-non-main-function.frag b/tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-inside-non-main-function.frag<br>
new file mode 100644<br>
index 000000000..0d34cb765<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-inside-non-main-function.frag<br>
@@ -0,0 +1,51 @@<br>
+// [config]<br>
+// expect_result: fail<br>
+// glsl_version: 4.20<br>
+// require_extensions: GL_ARB_fragment_shader_interlock<br>
+// check_link: false<br>
+// [end config]<br>
+<br>
+/* The GL_ARB_fragment_shader_interlock spec says:<br>
+ *<br>
+ * The beginInvocationInterlockARB() and endInvocationInterlockARB() may<br>
+ * only be placed inside the function main() of a fragment shader and may<br>
+ * not be called within any flow control. These functions may not be<br>
+ * called after a return statement in the function main(), but may be<br>
+ * called after a discard statement.<br>
+ *<br>
+ * and<br>
+ *<br>
+ * (8) What restrictions should be imposed on the use of the<br>
+ * beginInvocationInterlockARB() and endInvocationInterlockARB()<br>
+ * functions delimiting a critical section?<br>
+ *<br>
+ * RESOLVED: We impose restrictions similar to those on the barrier()<br>
+ * built-in function in tessellation control shaders to ensure that any<br>
+ * shader using this functionality has a single critical section that can<br>
+ * be easily identified during compilation...<br>
+ *<br>
+ * The GLSL 4.60 spec says:<br>
+ *<br>
+ * For tessellation control shaders, the barrier() function may only be<br>
+ * placed inside the function main() of the tessellation control shader and<br>
+ * may not be called within any control flow. Barriers are also disallowed<br>
+ * after a return statement in the function main(). Any such misplaced<br>
+ * barriers result in a compile-time error.<br>
+ *<br>
+ * From this we infer that the first errors mentioned in the<br>
+ * GL_ARB_fragment_shader_interlock spec are intended to generate compile-time<br>
+ * errors.<br>
+ */<br>
+#version 420<br>
+#extension GL_ARB_fragment_shader_interlock: require<br>
+<br>
+void wrapper()<br>
+{<br>
+ endInvocationInterlockARB();<br>
+}<br>
+<br>
+void main()<br>
+{<br>
+ beginInvocationInterlockARB();<br>
+ wrapper();<br>
+}<br>
diff --git a/tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-inside-while.frag b/tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-inside-while.frag<br>
new file mode 100644<br>
index 000000000..9b3fc424d<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_shader_interlock/compiler/endInvocationInterlock-inside-while.frag<br>
@@ -0,0 +1,50 @@<br>
+// [config]<br>
+// expect_result: fail<br>
+// glsl_version: 4.20<br>
+// require_extensions: GL_ARB_fragment_shader_interlock<br>
+// check_link: false<br>
+// [end config]<br>
+<br>
+/* The GL_ARB_fragment_shader_interlock spec says:<br>
+ *<br>
+ * The beginInvocationInterlockARB() and endInvocationInterlockARB() may<br>
+ * only be placed inside the function main() of a fragment shader and may<br>
+ * not be called within any flow control. These functions may not be<br>
+ * called after a return statement in the function main(), but may be<br>
+ * called after a discard statement.<br>
+ *<br>
+ * and<br>
+ *<br>
+ * (8) What restrictions should be imposed on the use of the<br>
+ * beginInvocationInterlockARB() and endInvocationInterlockARB()<br>
+ * functions delimiting a critical section?<br>
+ *<br>
+ * RESOLVED: We impose restrictions similar to those on the barrier()<br>
+ * built-in function in tessellation control shaders to ensure that any<br>
+ * shader using this functionality has a single critical section that can<br>
+ * be easily identified during compilation...<br>
+ *<br>
+ * The GLSL 4.60 spec says:<br>
+ *<br>
+ * For tessellation control shaders, the barrier() function may only be<br>
+ * placed inside the function main() of the tessellation control shader and<br>
+ * may not be called within any control flow. Barriers are also disallowed<br>
+ * after a return statement in the function main(). Any such misplaced<br>
+ * barriers result in a compile-time error.<br>
+ *<br>
+ * From this we infer that the first errors mentioned in the<br>
+ * GL_ARB_fragment_shader_interlock spec are intended to generate compile-time<br>
+ * errors.<br>
+ */<br>
+#version 420<br>
+#extension GL_ARB_fragment_shader_interlock: require<br>
+<br>
+void main()<br>
+{<br>
+ beginInvocationInterlockARB();<br>
+<br>
+ while (true) {<br>
+ endInvocationInterlockARB();<br>
+ break;<br>
+ }<br>
+}<br>
-- <br>
2.14.4<br>
<br>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org" target="_blank">Piglit@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/piglit" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</blockquote></div>