<div dir="ltr">On 12 September 2013 10:47, Nicholas Mack <span dir="ltr"><<a href="mailto:nichmack@gmail.com" target="_blank">nichmack@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">---<br>
 .../execution/vs-gs-arrays-fail.shader_test        | 63 ++++++++++++++++<br>
 .../vs-gs-arrays-within-blocks-pass.shader_test    | 86 ++++++++++++++++++++++<br>
 2 files changed, 149 insertions(+)<br>
 create mode 100644 tests/spec/glsl-1.50/execution/vs-gs-arrays-fail.shader_test<br>
 create mode 100644 tests/spec/glsl-1.50/execution/vs-gs-arrays-within-blocks-pass.shader_test<br>
<br>
diff --git a/tests/spec/glsl-1.50/execution/vs-gs-arrays-fail.shader_test b/tests/spec/glsl-1.50/execution/vs-gs-arrays-fail.shader_test<br>
new file mode 100644<br>
index 0000000..877b0a6<br>
--- /dev/null<br>
+++ b/tests/spec/glsl-1.50/execution/vs-gs-arrays-fail.shader_test<br>
@@ -0,0 +1,63 @@<br>
+# Test that vertex array outputs are not allowed outside of output blocks since<br>
+# 2D arrays are not supported.<br></blockquote><div><br></div><div>This comment is a little misleading because vertex array outputs acually *are* allowed.  What you're actually testing is that the linker rejects trying to link a vertex array outputs up to a geometry shader array input.  I'd recommend saying something like:<br>
<br></div><div>"Test that a vertex shader array output (outside an interface block) can't be linked to a geometry shader array input."<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

+#<br>
+# From the GLSL 1.50 specification, section 4.3.4 ("Inputs"):<br>
+#<br>
+# "If the output of a vertex shader is itself an array to be consumed by a<br>
+#  geometry shader, then it must appear in an output block (see interface blocks<br>
+#  below) in the vertex shader and in an input block in the geometry shader with<br>
+#  a block instance name declared as an array. This is required for arrays<br>
+#  output from a vertex shader because two-dimensional arrays are not<br>
+#  supported."<br>
+<br>
+[require]<br>
+GL >= 3.2<br>
+GLSL >= 1.50<br>
+<br>
+[vertex shader]<br>
+<br>
+in vec4 vertex;<br>
+<br>
+out vec4 pos;<br>
+out float a[3];<br>
+<br>
+void main()<br>
+{<br>
+       gl_Position = vertex;<br>
+       pos = vertex;<br>
+       for(int i = 0; i < 3; i++) {<br>
+               a[i] = i+1;<br>
+       }<br>
+}<br>
+<br>
+[geometry shader]<br>
+<br>
+layout(triangles) in;<br>
+layout(triangle_strip, max_vertices = 3) out;<br>
+<br>
+in vec4 pos[];<br>
+in float a[3];<br>
+<br>
+<br>
+void main()<br>
+{<br>
+}<br>
+<br>
+[fragment shader]<br>
+<br>
+out vec4 color;<br>
+<br>
+void main()<br>
+{<br>
+       color = vec4(1.0, 0.0, 0.0, 1.0);<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/execution/vs-gs-arrays-within-blocks-pass.shader_test b/tests/spec/glsl-1.50/execution/vs-gs-arrays-within-blocks-pass.shader_test<br>
new file mode 100644<br>
index 0000000..52b8b00<br>
--- /dev/null<br>
+++ b/tests/spec/glsl-1.50/execution/vs-gs-arrays-within-blocks-pass.shader_test<br>
@@ -0,0 +1,86 @@<br>
+# Test that vertex array outputs that are passed to a geometry shader are only<br>
+#  valid if they are declared within an output block.<br></blockquote><div><br></div><div>I'd drop the word "only" from the test description here, since this partuclar test checks that vertex array outputs work when they are in an interface block; it doesn't check that they don't work when they aren't.<br>
<br></div><div>With those two minor comment changes, this patch is:<br><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

+#<br>
+# From the GLSL 1.50 specification, section 4.3.4 ("Inputs"):<br>
+#<br>
+# "If the output of a vertex shader is itself an array to be consumed by a<br>
+#  geometry shader, then it must appear in an output block (see interface blocks<br>
+#  below) in the vertex shader and in an input block in the geometry shader with<br>
+#  a block instance name declared as an array. This is required for arrays<br>
+#  output from a vertex shader because two-dimensional arrays are not<br>
+#  supported."<br>
+<br>
+[require]<br>
+GL >= 3.2<br>
+GLSL >= 1.50<br>
+<br>
+[vertex shader]<br>
+<br>
+in vec4 vertex;<br>
+<br>
+out vec4 pos;<br>
+out block {<br>
+       float a[4];<br>
+};<br>
+<br>
+void main()<br>
+{<br>
+       gl_Position = vertex;<br>
+       pos = vertex;<br>
+       for(int i = 0; i < 4; i++) {<br>
+               a[i] = i+1;<br>
+       }<br>
+}<br>
+<br>
+[geometry shader]<br>
+<br>
+layout(triangles) in;<br>
+layout(triangle_strip, max_vertices = 3) out;<br>
+<br>
+in vec4 pos[];<br>
+in block {<br>
+       float a[4];<br>
+} b[];<br>
+<br>
+out float aa[4];<br>
+<br>
+void main()<br>
+{<br>
+       for(int i = 0; i < 3; i++) {<br>
+               gl_Position = pos[i];<br>
+               for(int j = 0; j < 4; j++) {<br>
+                       aa[j] = b[i].a[j];<br>
+               }<br>
+               EmitVertex();<br>
+       }<br>
+}<br>
+<br>
+[fragment shader]<br>
+<br>
+in float aa[4];<br>
+<br>
+out vec4 color;<br>
+<br>
+void main()<br>
+{<br>
+       bool fail = false;<br>
+       for(int i = 0; i < 4; i++) {<br>
+               if(aa[i] != i + 1) fail = true;<br>
+       }<br>
+<br>
+       if (fail)<br>
+               color = vec4(1.0, 0.0, 0.0, 1.0);<br>
+       else<br>
+               color = vec4(0.0, 1.0, 0.0, 1.0);<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.0 1.0 0.0 1.0<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>