<div dir="ltr">On 19 September 2013 11:36, 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> GLSL 1.50 section 4.6.1 (The Invariant Qualifier) says:<br>
   To ensure that a particular output variable is invariant, it is necessary<br>
   to use the invariant qualifier. It can either be used to qualify a<br>
   previously declared variable as being invariant<br>
       invariant gl_Position; // make existing gl_Position be invariant<br>
       out vec3 Color; // make existing Color be invariant<br>
       invariant Color;<br>
   or as part of a declaration when a variable is declared<br>
       invariant centroid out vec3 Color;<br>
   The invariant qualifier must appear before any interpolation qualifiers or<br>
   storage qualifiers when combined with a declaration. Only variables output<br>
   from a shader (including those that are then input to a subsequent shader)<br>
   can be candidates for invariance. This includes user-defined output variables<br>
   and the built-in output variables. For variables leaving one shader and coming<br>
   into another shader, the invariant keyword has to be used in both shaders,<br>
   or a link error will result.<br>
---<br>
 .../invariant-qualifier-everywhere.shader_test     | 83 +++++++++++++++++++++<br>
 ...fier-everywhere-gs-fs-inconsistency.shader_test | 83 +++++++++++++++++++++<br>
 ...fier-everywhere-vs-gs-inconsistency.shader_test | 84 ++++++++++++++++++++++<br>
 3 files changed, 250 insertions(+)<br>
 create mode 100644 tests/spec/glsl-1.50/execution/invariant-qualifier-everywhere.shader_test<br>
 create mode 100644 tests/spec/glsl-1.50/linker/invariant-qualifier-everywhere-gs-fs-inconsistency.shader_test<br>
 create mode 100644 tests/spec/glsl-1.50/linker/invariant-qualifier-everywhere-vs-gs-inconsistency.shader_test<br></blockquote><div><br></div><div>Thanks, Steve.  I've made a minor correction and pushed this patch to piglit master.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
diff --git a/tests/spec/glsl-1.50/execution/invariant-qualifier-everywhere.shader_test b/tests/spec/glsl-1.50/execution/invariant-qualifier-everywhere.shader_test<br>
new file mode 100644<br>
index 0000000..3cee960<br>
--- /dev/null<br>
+++ b/tests/spec/glsl-1.50/execution/invariant-qualifier-everywhere.shader_test<br>
@@ -0,0 +1,83 @@<br>
+# Test that invariant qualifier is available to all shaders<br>
+#<br>
+# GLSL 1.50 section 4.6.1 (The Invariant Qualifier) says:<br>
+#   To ensure that a particular output variable is invariant, it is necessary<br>
+#   to use the invariant qualifier. It can either be used to qualify a<br>
+#   previously declared variable as being invariant<br>
+#       invariant gl_Position; // make existing gl_Position be invariant<br>
+#       out vec3 Color; // make existing Color be invariant<br>
+#       invariant Color;<br>
+#   or as part of a declaration when a variable is declared<br>
+#       invariant centroid out vec3 Color;<br>
+#   The invariant qualifier must appear before any interpolation qualifiers or<br>
+#   storage qualifiers when combined with a declaration. Only variables output<br>
+#   from a shader (including those that are then input to a subsequent shader)<br>
+#   can be candidates for invariance. This includes user-defined output variables<br>
+#   and the built-in output variables. For variables leaving one shader and coming<br>
+#   into another shader, the invariant keyword has to be used in both shaders,<br>
+#   or a link error will result.<br>
+#<br>
+# Test is expected to pass.<br>
+<br>
+[require]<br>
+GL >= 3.2<br>
+GLSL >= 1.50<br>
+<br>
+[vertex shader]<br>
+#version 150<br>
+<br>
+in vec4 vertex;<br>
+invariant out vec4 pos;<br>
+invariant gl_Position;<br>
+invariant out vec4 extra01;<br>
+<br>
+void main()<br>
+{<br>
+    gl_Position = vertex;<br>
+    pos = vertex;<br>
+}<br>
+<br>
+[geometry shader]<br>
+#version 150<br>
+<br>
+layout(triangles) in;<br>
+layout(triangles, max_vertices=3) out;<br>
+<br>
+invariant in vec4 pos[];<br>
+invariant in vec4 extra01[];<br>
+invariant out vec4 extra02;<br>
+<br>
+<br>
+void main()<br>
+{<br>
+    for(int i = 0; i < 3; i++) {<br>
+        gl_Position = pos[i] * 0.5;<br>
+        extra02 = extra01[i] * 0.5;<br>
+        EmitVertex();<br>
+    }<br>
+<br>
+}<br>
+<br>
+<br>
+[fragment shader]<br>
+#version 150<br>
+<br>
+in vec4 extra02;<br>
+invariant extra02; //should be legal according to example<br>
+out vec4 FragColor;<br>
+<br>
+void main()<br>
+{<br>
+    FragColor = vec4(extra02);<br>
+}<br>
+<br>
+[vertex data]<br>
+vertex/float/2<br>
+-1.0 -1.0<br>
+ 1.0 -1.0<br>
+ 1.0  1.0<br>
+-1.0  1.0<br>
+<br>
+[test]<br>
+draw arrays GL_TRIANGLE_FAN 0 4<br>
+probe all rgba 0.5 0.5 0.5 0.5<br>
diff --git a/tests/spec/glsl-1.50/linker/invariant-qualifier-everywhere-gs-fs-inconsistency.shader_test b/tests/spec/glsl-1.50/linker/invariant-qualifier-everywhere-gs-fs-inconsistency.shader_test<br>
new file mode 100644<br>
index 0000000..6454283<br>
--- /dev/null<br>
+++ b/tests/spec/glsl-1.50/linker/invariant-qualifier-everywhere-gs-fs-inconsistency.shader_test<br>
@@ -0,0 +1,83 @@<br>
+# Test that invariant qualifier is available to all shaders<br>
+#<br>
+# GLSL 1.50 section 4.6.1 (The Invariant Qualifier) says:<br>
+#   To ensure that a particular output variable is invariant, it is necessary<br>
+#   to use the invariant qualifier. It can either be used to qualify a<br>
+#   previously declared variable as being invariant<br>
+#       invariant gl_Position; // make existing gl_Position be invariant<br>
+#       out vec3 Color; // make existing Color be invariant<br>
+#       invariant Color;<br>
+#   or as part of a declaration when a variable is declared<br>
+#       invariant centroid out vec3 Color;<br>
+#   The invariant qualifier must appear before any interpolation qualifiers or<br>
+#   storage qualifiers when combined with a declaration. Only variables output<br>
+#   from a shader (including those that are then input to a subsequent shader)<br>
+#   can be candidates for invariance. This includes user-defined output variables<br>
+#   and the built-in output variables. For variables leaving one shader and coming<br>
+#   into another shader, the invariant keyword has to be used in both shaders,<br>
+#   or a link error will result.<br>
+#<br>
+# Test leaves out the required invariant qualifier from the fragment shader,<br>
+# and produce corresponding link error.<br>
+<br>
+[require]<br>
+GL >= 3.2<br>
+GLSL >= 1.50<br>
+<br>
+[vertex shader]<br>
+#version 150<br>
+<br>
+in vec4 vertex;<br>
+invariant out vec4 pos;<br>
+invariant gl_Position;<br>
+invariant out vec4 extra01;<br>
+<br>
+void main()<br>
+{<br>
+    gl_Position = vertex;<br>
+    pos = vertex;<br>
+}<br>
+<br>
+[geometry shader]<br>
+#version 150<br>
+<br>
+layout(triangles) in;<br>
+layout(triangles, max_vertices=3) out;<br>
+<br>
+invariant in vec4 pos[];<br>
+invariant in vec4 extra01[];<br>
+invariant out vec4 extra02;<br>
+<br>
+<br>
+void main()<br>
+{<br>
+    for(int i = 0; i < 3; i++) {<br>
+        gl_Position = pos[i] * 0.5;<br>
+        extra02 = extra01[i] * 0.5;<br>
+        EmitVertex();<br>
+    }<br>
+<br>
+}<br>
+<br>
+<br>
+[fragment shader]<br>
+#version 150<br>
+<br>
+in vec4 extra02;<br>
+//invariant extra02; //redeclaration left out<br>
+out vec4 FragColor;<br>
+<br>
+void main()<br>
+{<br>
+    FragColor = vec4(extra02);<br>
+}<br>
+<br>
+[vertex data]<br>
+vertex/float/2<br>
+-1.0 -1.0<br>
+ 1.0 -1.0<br>
+ 1.0  1.0<br>
+-1.0  1.0<br>
+<br>
+[test]<br>
+link error<br>
diff --git a/tests/spec/glsl-1.50/linker/invariant-qualifier-everywhere-vs-gs-inconsistency.shader_test b/tests/spec/glsl-1.50/linker/invariant-qualifier-everywhere-vs-gs-inconsistency.shader_test<br>
new file mode 100644<br>
index 0000000..56af4f8<br>
--- /dev/null<br>
+++ b/tests/spec/glsl-1.50/linker/invariant-qualifier-everywhere-vs-gs-inconsistency.shader_test<br>
@@ -0,0 +1,84 @@<br>
+# Test that invariant qualifier is available to all shaders<br>
+#<br>
+# GLSL 1.50 section 4.6.1 (The Invariant Qualifier) says:<br>
+#   To ensure that a particular output variable is invariant, it is necessary<br>
+#   to use the invariant qualifier. It can either be used to qualify a<br>
+#   previously declared variable as being invariant<br>
+#       invariant gl_Position; // make existing gl_Position be invariant<br>
+#       out vec3 Color; // make existing Color be invariant<br>
+#       invariant Color;<br>
+#   or as part of a declaration when a variable is declared<br>
+#       invariant centroid out vec3 Color;<br>
+#   The invariant qualifier must appear before any interpolation qualifiers or<br>
+#   storage qualifiers when combined with a declaration. Only variables output<br>
+#   from a shader (including those that are then input to a subsequent shader)<br>
+#   can be candidates for invariance. This includes user-defined output variables<br>
+#   and the built-in output variables. For variables leaving one shader and coming<br>
+#   into another shader, the invariant keyword has to be used in both shaders,<br>
+#   or a link error will result.<br>
+#<br>
+# Test leaves out the required invariant qualifier from the geometry shader,<br>
+# and produce corresponding link error.<br>
+<br>
+[require]<br>
+GL >= 3.2<br>
+GLSL >= 1.50<br>
+<br>
+[vertex shader]<br>
+#version 150<br>
+<br>
+in vec4 vertex;<br>
+invariant out vec4 pos;<br>
+invariant gl_Position;<br>
+invariant out vec4 extra01;<br>
+<br>
+void main()<br>
+{<br>
+    gl_Position = vertex;<br>
+    pos = vertex;<br>
+}<br>
+<br>
+[geometry shader]<br>
+#version 150<br>
+<br>
+layout(triangles) in;<br>
+layout(triangles, max_vertices=3) out;<br>
+<br>
+//invariant<br>
+in vec4 pos[];<br>
+invariant in vec4 extra01[];<br>
+invariant out vec4 extra02;<br>
+<br>
+<br>
+void main()<br>
+{<br>
+    for(int i = 0; i < 3; i++) {<br>
+        gl_Position = pos[i] * 0.5;<br>
+        extra02 = extra01[i] * 0.5;<br>
+        EmitVertex();<br>
+    }<br>
+<br>
+}<br>
+<br>
+<br>
+[fragment shader]<br>
+#version 150<br>
+<br>
+in vec4 extra02;<br>
+invariant extra02; //should be legal according to example<br>
+out vec4 FragColor;<br>
+<br>
+void main()<br>
+{<br>
+    FragColor = vec4(extra02);<br>
+}<br>
+<br>
+[vertex data]<br>
+vertex/float/2<br>
+-1.0 -1.0<br>
+ 1.0 -1.0<br>
+ 1.0  1.0<br>
+-1.0  1.0<br>
+<br>
+[test]<br>
+link error<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.3.1<br>
<br>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</font></span></blockquote></div><br></div></div>