<div dir="ltr">On 12 August 2013 10:30, Steve Miller <span dir="ltr"><<a href="mailto:dervishx@gmail.com" target="_blank">dervishx@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="im">Compiler test for layout qualifiers and redeclaration of gl_FragCoord.<br>
<br>
</div>v2 : typecast data to fragcolor as vec4 (was error in original)<br>
v3 : added entry to all.tests for compiler directory<br>
<div class="im">   : compiler tests now require gl110 and extension. piglit passes<br>
</div>v4 : comment consistency, quote change, frag swizzle<br>
V5 : renamed two tests for illegal usage -01-PointCoord and -02-FrontFacing<br>
   : added test for redeclaration on vertex input<br>
   : added test for redeclaration on uniform value in FS<br>
---<br>
 tests/all.tests                                    |  3 ++<br>
 .../basic-qualifiers-both-origin-and-pixel.frag    | 31 +++++++++++++++++++<br>
 ...ic-qualifiers-layout-illegal-01-PointCoord.frag | 33 ++++++++++++++++++++<br>
 ...c-qualifiers-layout-illegal-02-FrontFacing.frag | 33 ++++++++++++++++++++<br>
 .../compiler/basic-qualifiers-nothing.frag         | 34 ++++++++++++++++++++<br>
 .../compiler/basic-qualifiers-origin.frag          | 31 +++++++++++++++++++<br>
 .../compiler/basic-qualifiers-pixel-center.frag    | 31 +++++++++++++++++++<br>
 .../compiler/redeclaration-after-use.frag          | 28 +++++++++++++++++<br>
 .../compiler/redeclaration-outside-fs.vert         | 36 ++++++++++++++++++++++<br>
 .../redeclaration-qualifier-applied-to-uniform.fs  | 34 ++++++++++++++++++++<br>
 ...laration-qualifier-applied-to-vertex-input.vert | 34 ++++++++++++++++++++<br>
 11 files changed, 328 insertions(+)<br>
 create mode 100644 tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-both-origin-and-pixel.frag<br>
 create mode 100644 tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal-01-PointCoord.frag<br>
 create mode 100644 tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal-02-FrontFacing.frag<br>
<div class="im"> create mode 100644 tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-nothing.frag<br>
 create mode 100644 tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-origin.frag<br>
 create mode 100644 tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-pixel-center.frag<br>
 create mode 100644 tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-after-use.frag<br>
 create mode 100644 tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-outside-fs.vert<br>
</div> create mode 100644 tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-qualifier-applied-to-uniform.fs<br>
 create mode 100644 tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-qualifier-applied-to-vertex-input.vert<br>
<br>
diff --git a/tests/all.tests b/tests/all.tests<br>
index a914a2a..9dfa275 100644<br>
--- a/tests/all.tests<br>
+++ b/tests/all.tests<br>
@@ -1088,6 +1088,9 @@ arb_fragment_coord_conventions = Group()<br>
<div class="im"> spec['ARB_fragment_coord_conventions'] = arb_fragment_coord_conventions<br>
 add_vpfpgeneric(arb_fragment_coord_conventions, 'fp-arb-fragment-coord-conventions-none')<br>
 add_vpfpgeneric(arb_fragment_coord_conventions, 'fp-arb-fragment-coord-conventions-integer')<br>
+import_glsl_parser_tests(arb_fragment_coord_conventions,<br>
+                        os.path.join(testsDir, 'spec',<br>
+                         'arb_fragment_coord_conventions'), ['compiler'])<br>
<br>
 ati_fragment_shader = Group()<br>
 spec['ATI_fragment_shader'] = ati_fragment_shader<br>
diff --git a/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-both-origin-and-pixel.frag b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-both-origin-and-pixel.frag<br>
new file mode 100644<br>
</div>index 0000000..216da13<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-both-origin-and-pixel.frag<br>
@@ -0,0 +1,31 @@<br>
+/* [config]<br>
+ * expect_result: pass<br>
+ * glsl_version: 1.10<br>
+ * require_extensions: GL_ARB_fragment_coord_conventions<br>
+ * check_link: false<br>
+ * [end config]<br>
+ */<br>
+<br>
+/*<br>
+ * Section 4.3.x.1 (Input Layout Qualifiers) of the<br>
+ * ARB_fragment_coord_conventions spec says:<br>
+ *<br>
+ *     "Fragment shaders can have an input layout only for redeclaring the<br>
+ *     built-in variable gl_FragCoord (see section 7.2). The layout qualifier<br>
+ *     identifiers for gl_FragCoord are<br>
+ *<br>
+ *         <layout-qualifier-id><br>
+ *             origin_upper_left<br>
+ *             pixel_center_integer"<br>
+ */<br>
<div class="im">+<br>
+#version 110<br>
+<br>
+#extension GL_ARB_fragment_coord_conventions : require<br>
+<br>
+layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;<br>
+<br>
+void main()<br>
+{<br>
</div>+     gl_FragColor = gl_FragCoord.xyzz;<br>
+}<br>
diff --git a/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal-01-PointCoord.frag b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal-01-PointCoord.frag<br>

new file mode 100644<br>
index 0000000..b5358eb<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal-01-PointCoord.frag<br>
@@ -0,0 +1,33 @@<br>
+/* [config]<br>
+ * expect_result: fail<br>
+ * glsl_version: 1.10<br>
+ * require_extensions: GL_ARB_fragment_coord_conventions<br>
+ * check_link: false<br>
+ * [end config]<br>
+ */<br>
+<br>
+/*<br>
+ * Section 4.3.x.1 (Input Layout Qualifiers) of the<br>
+ * ARB_fragment_coord_conventions spec says:<br>
+ *<br>
+ *     "Fragment shaders can have an input layout only for redeclaring the<br>
+ *     built-in variable gl_FragCoord (see section 7.2). The layout qualifier<br>
+ *     identifiers for gl_FragCoord are<br>
+ *<br>
+ *         <layout-qualifier-id><br>
+ *             origin_upper_left<br>
+ *             pixel_center_integer"<br>
+ *<br>
+ * Test should fail because input layout should only apply to gl_FragCoord.<br>
<div class="im">+ */<br>
+<br>
+#version 110<br>
+<br>
+#extension GL_ARB_fragment_coord_conventions : require<br>
+<br>
+layout(origin_upper_left, pixel_center_integer) in vec2 gl_PointCoord;<br>
+<br>
+void main()<br>
+{<br>
</div>+     gl_FragColor = gl_FragCoord.xyzz;<br>
+}<br>
diff --git a/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal-02-FrontFacing.frag b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal-02-FrontFacing.frag<br>

new file mode 100644<br>
index 0000000..2e87c56<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal-02-FrontFacing.frag<br>
@@ -0,0 +1,33 @@<br>
+/* [config]<br>
+ * expect_result: fail<br>
+ * glsl_version: 1.10<br>
+ * require_extensions: GL_ARB_fragment_coord_conventions<br>
+ * check_link: false<br>
+ * [end config]<br>
+ */<br>
+<br>
+/*<br>
+ * Section 4.3.x.1 (Input Layout Qualifiers) of the<br>
+ * ARB_fragment_coord_conventions spec says:<br>
+ *<br>
+ *     "Fragment shaders can have an input layout only for redeclaring the<br>
+ *     built-in variable gl_FragCoord (see section 7.2). The layout qualifier<br>
+ *     identifiers for gl_FragCoord are<br>
+ *<br>
+ *         <layout-qualifier-id><br>
+ *             origin_upper_left<br>
+ *             pixel_center_integer<br>
+ *<br>
+ * Test should fail because input layout should only apply to gl_FragCoord.<br>
+ */<br>
<div class="im">+<br>
+#version 110<br>
+<br>
+#extension GL_ARB_fragment_coord_conventions : require<br>
+<br>
+layout(origin_upper_left, pixel_center_integer) in bool gl_FrontFacing;<br>
+<br>
+void main()<br>
+{<br>
</div>+    gl_FragColor = gl_FragCoord.xyzz;<br>
<div class="im">+}<br>
diff --git a/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-nothing.frag b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-nothing.frag<br>
new file mode 100644<br>
</div>index 0000000..4055dfe<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-nothing.frag<br>
@@ -0,0 +1,34 @@<br>
+/* [config]<br>
+ * expect_result: pass<br>
+ * glsl_version: 1.10<br>
+ * require_extensions: GL_ARB_fragment_coord_conventions<br>
+ * check_link: false<br>
+ * [end config]<br>
+ */<br>
+<br>
+/*<br>
+ * Section 4.3.x.1 (Input Layout Qualifiers) of the<br>
+ * ARB_fragment_coord_conventions spec says:<br>
+ *<br>
+ *     "Fragment shaders can have an input layout only for redeclaring the<br>
+ *     built-in variable gl_FragCoord (see section 7.2). The layout qualifier<br>
+ *     identifiers for gl_FragCoord are<br>
+ *<br>
+ *         <layout-qualifier-id><br>
+ *             origin_upper_left<br>
+ *             pixel_center_integer"<br>
+ *     ...<br>
+ *     Redeclarations are done as follows<br>
+ *         in vec4 gl_FragCoord; // redeclaration that changes nothing is allowed<br>
<div class="im">+ */<br>
+<br>
+#version 110<br>
+<br>
+#extension GL_ARB_fragment_coord_conventions : require<br>
+<br>
+in vec4 gl_FragCoord;<br>
+<br>
+void main()<br>
+{<br>
</div>+       gl_FragColor = gl_FragCoord.xyzz;<br>
<div class="im">+}<br>
diff --git a/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-origin.frag b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-origin.frag<br>
new file mode 100644<br>
</div>index 0000000..c09ca9b<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-origin.frag<br>
@@ -0,0 +1,31 @@<br>
+/* [config]<br>
+ * expect_result: pass<br>
+ * glsl_version: 1.10<br>
+ * require_extensions: GL_ARB_fragment_coord_conventions<br>
+ * check_link: false<br>
+ * [end config]<br>
+ */<br>
+<br>
+/*<br>
+ * Section 4.3.x.1 (Input Layout Qualifiers) of the<br>
+ * ARB_fragment_coord_conventions spec says:<br>
+ *<br>
+ *     "Fragment shaders can have an input layout only for redeclaring the<br>
+ *     built-in variable gl_FragCoord (see section 7.2). The layout qualifier<br>
+ *     identifiers for gl_FragCoord are<br>
+ *<br>
+ *         <layout-qualifier-id><br>
+ *             origin_upper_left<br>
+ *             pixel_center_integer"<br>
+ */<br>
<div class="im">+<br>
+#version 110<br>
+<br>
+#extension GL_ARB_fragment_coord_conventions : require<br>
+<br>
+layout(origin_upper_left) in vec4 gl_FragCoord;<br>
+<br>
+void main()<br>
+{<br>
</div>+       gl_FragColor = gl_FragCoord.xyzz;<br>
<div class="im">+}<br>
diff --git a/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-pixel-center.frag b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-pixel-center.frag<br>
new file mode 100644<br>
</div>index 0000000..f7b1a37<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-pixel-center.frag<br>
@@ -0,0 +1,31 @@<br>
+/* [config]<br>
+ * expect_result: pass<br>
+ * glsl_version: 1.10<br>
+ * require_extensions: GL_ARB_fragment_coord_conventions<br>
+ * check_link: false<br>
+ * [end config]<br>
+ */<br>
+<br>
+/*<br>
+ * Section 4.3.x.1 (Input Layout Qualifiers) of the<br>
+ * ARB_fragment_coord_conventions spec says:<br>
+ *<br>
+ *     "Fragment shaders can have an input layout only for redeclaring the<br>
+ *     built-in variable gl_FragCoord (see section 7.2). The layout qualifier<br>
+ *     identifiers for gl_FragCoord are<br>
+ *<br>
+ *         <layout-qualifier-id><br>
+ *             origin_upper_left<br>
+ *             pixel_center_integer"<br>
+ */<br>
<div class="im">+<br>
+#version 110<br>
+<br>
+#extension GL_ARB_fragment_coord_conventions : require<br>
+<br>
+layout(pixel_center_integer) in vec4 gl_FragCoord;<br>
+<br>
+void main()<br>
+{<br>
</div>+       gl_FragColor = gl_FragCoord.xyzz;<br>
<div class="im">+}<br>
diff --git a/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-after-use.frag b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-after-use.frag<br>
new file mode 100644<br>
</div>index 0000000..f9e67c1<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-after-use.frag<br>
@@ -0,0 +1,28 @@<br>
+/* [config]<br>
+ * expect_result: fail<br>
+ * glsl_version: 1.10<br>
+ * require_extensions: GL_ARB_fragment_coord_conventions<br>
+ * check_link: false<br>
+ * [end config]<br>
+ */<br>
+<br>
+/*<br>
+ * Section 4.3.x.1 (Input Layout Qualifiers) of the<br>
+ * ARB_fragment_coord_conventions spec says:<br>
+ *<br>
+ *     "Within any shader, the first redeclarations of gl_FragCoord must appear<br>
+ *     before any use of gl_FragCoord."<br>
<div class="im">+ */<br>
+<br>
+#version 110<br>
+<br>
+#extension GL_ARB_fragment_coord_conventions : require<br>
+<br>
+vec2 a = gl_FragCoord.xy;<br>
+<br>
+in vec4 gl_FragCoord; //redeclaration after use should be illegal<br>
+<br>
+void main()<br>
+{<br>
</div>+       gl_FragColor = gl_FragCoord.xyzz;<br>
<div class="im">+}<br>
diff --git a/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-outside-fs.vert b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-outside-fs.vert<br>
new file mode 100644<br>
</div>index 0000000..9550db7<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-outside-fs.vert<br>
@@ -0,0 +1,36 @@<br>
+/* [config]<br>
+ * expect_result: fail<br>
+ * glsl_version: 1.10<br>
+ * require_extensions: GL_ARB_fragment_coord_conventions<br>
+ * check_link: false<br>
+ * [end config]<br>
+ */<br>
+<br>
+/*<br>
+ * Section 4.3.x.1 (Input Layout Qualifiers) of the<br>
+ * ARB_fragment_coord_conventions spec says:<br>
+ *<br>
+ *     "Fragment shaders can have an input layout only for redeclaring the<br>
+ *     built-in variable gl_FragCoord (see section 7.2). The layout qualifier<br>
+ *     identifiers for gl_FragCoord are<br>
+ *<br>
+ *         <layout-qualifier-id><br>
+ *             origin_upper_left<br>
+ *             pixel_center_integer"<br>
+ *<br>
+ * This test assumes that gl_FragCoord cannot be redeclared anywhere other than<br>
<div class="im">+ * a fragment shader.<br>
+ */<br>
</div><div class="im">+<br>
+#version 110<br>
+<br>
+#extension GL_ARB_fragment_coord_conventions : require<br>
+<br>
</div>+in vec4 vertex;<br>
<div class="im">+<br>
+in vec4 gl_FragCoord; //redeclaration in a VS<br>
+<br>
+void main()<br>
+{<br>
</div>+       gl_Position = vertex;<br>
+}<br>
diff --git a/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-qualifier-applied-to-uniform.fs b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-qualifier-applied-to-uniform.fs<br>
new file mode 100644<br>
index 0000000..afbc090<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-qualifier-applied-to-uniform.fs<br></blockquote><div><br></div><div>The test name needs to end in ".frag", or it won't run.<br></div><div>
 </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
@@ -0,0 +1,34 @@<br>
+/* [config]<br>
+ * expect_result: fail<br>
+ * glsl_version: 1.10<br>
+ * require_extensions: GL_ARB_fragment_coord_conventions<br>
+ * check_link: false<br>
+ * [end config]<br>
+ */<br>
+<br>
+/*<br>
+ * Section 4.3.x.1 (Input Layout Qualifiers) of the<br>
+ * ARB_fragment_coord_conventions spec says:<br>
+ *<br>
+ *     "Fragment shaders can have an input layout only for redeclaring the<br>
+ *     built-in variable gl_FragCoord (see section 7.2). The layout qualifier<br>
+ *     identifiers for gl_FragCoord are<br>
+ *<br>
+ *         <layout-qualifier-id><br>
+ *             origin_upper_left<br>
+ *             pixel_center_integer"<br>
+ *<br>
+ * This test assumes that gl_FragCoord layout qualifiers cannot be applied to<br>
+ * uniform values.<br></blockquote><div><br></div><div>The comment says this test is testing uniforms...<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

+ */<br>
<div class="im">+<br>
+#version 110<br>
+<br>
+#extension GL_ARB_fragment_coord_conventions : require<br>
+<br>
</div>+layout(origin_upper_left, pixel_center_integer) vec4 a;<br></blockquote><div><br></div><div>But the test is testing a global variable, not a uniform.  Which did you intend?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

+<br>
+void main()<br>
+{<br>
+       gl_FragColor = a.xyzw;<br>
+}<br>
diff --git a/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-qualifier-applied-to-vertex-input.vert b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-qualifier-applied-to-vertex-input.vert<br>

new file mode 100644<br>
index 0000000..d68f11e<br>
--- /dev/null<br>
+++ b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-qualifier-applied-to-vertex-input.vert<br>
@@ -0,0 +1,34 @@<br>
+/* [config]<br>
+ * expect_result: fail<br>
+ * glsl_version: 1.10<br>
+ * require_extensions: GL_ARB_fragment_coord_conventions<br>
+ * check_link: false<br>
+ * [end config]<br>
+ */<br>
+<br>
+/*<br>
+ * Section 4.3.x.1 (Input Layout Qualifiers) of the<br>
+ * ARB_fragment_coord_conventions spec says:<br>
+ *<br>
+ *     "Fragment shaders can have an input layout only for redeclaring the<br>
+ *     built-in variable gl_FragCoord (see section 7.2). The layout qualifier<br>
+ *     identifiers for gl_FragCoord are<br>
+ *<br>
+ *         <layout-qualifier-id><br>
+ *             origin_upper_left<br>
+ *             pixel_center_integer"<br>
+ *<br>
+ * This test assumes that gl_FragCoord layout qualifiers cannot be used anywhere<br>
+ * other than a fragment shader.<br>
+ */<br>
<div class="im">+<br>
+#version 110<br>
+<br>
+#extension GL_ARB_fragment_coord_conventions : require<br>
+<br>
</div>+layout(origin_upper_left) in vec4 vertex;<br>
+<br>
+void main()<br>
+{<br>
+       gl_Position = vertex;<br>
+}<br></blockquote><div><br></div><div>I don't see anything addressing Ian's comment "Also, a test that applies the layout qualifiers to a user-defined varying in the fragment shader."<br><br></div><div>
Sorry you've had to re-spin this patch so many times.  Hopefully we've nearly converged...<br></div></div></div></div>