<div dir="ltr">On 15 July 2013 16:12, 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">

<div><div>Tested datatypes: float[2], int[2], vec3[2]<br>
---<br>
 .../execution/input-arrays-basic-vs.shader_test    | 107 +++++++++++++++++++++<br>
 1 file changed, 107 insertions(+)<br>
 create mode 100644 tests/spec/glsl-1.50/execution/input-arrays-basic-vs.shader_test<br>
<br>
diff --git a/tests/spec/glsl-1.50/execution/input-arrays-basic-vs.shader_test b/tests/spec/glsl-1.50/execution/input-arrays-basic-vs.shader_test<br>
new file mode 100644<br>
index 0000000..39e0105<br>
--- /dev/null<br>
+++ b/tests/spec/glsl-1.50/execution/input-arrays-basic-vs.shader_test<br>
@@ -0,0 +1,107 @@<br>
+# Test that vertex shader inputs can be arrays<br>
+#<br>
+# GLSLLangSpec.1.50.09 4.3.4 Inputs:<br>
+# Vertex shader inputs can only be float, floating-point vectors, matrices,<br>
+# signed and unsigned integers and integer vectors.Vertex shader inputs can<br>
+# also form arrays of these types, but not structures.<br>
+#<br>
+# This test verifies basic functionality of vertex shader inputs using<br>
+# arrays of vec4 and mat4 respectively<br>
+<br>
+# author to blame: Steve Miller<br></div></div></blockquote><div><br></div><div>This line isn't necessary.  We'll be able to tell from git history that the test came from you.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><div>
+<br>
+[require]<br>
+GL >= 3.2<br>
+GLSL >= 1.50<br>
+<br>
+[vertex shader]<br>
+#version 150<br>
+<br>
+in vec4 vertex;<br>
+<br>
+in float a[2];<br>
+in int          b[2];<br></div></div></blockquote><div><br></div><div>Extra spaces in front of "b[2]"<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><div>
+in vec3  c[2];<br>
+<br>
+flat out int i_failed;<br>
+<br>
+float ca[2];<br>
+int cb[2];<br>
+vec3 cc[2];<br>
+<br>
+float d[2];<br>
+int   e[2];<br>
+vec3  f[2];<br>
+<br>
+#define CHECK(value, expected) \<br>
+       if (distance(value, expected) > 0.00001) \<br>
+               failed = true<br>
+<br>
+void main()<br>
+{<br>
+       gl_Position = vertex;<br>
+<br>
+       ca[0] = a[0];<br>
+       ca[1] = a[1];<br>
+<br>
+       cb[0] = b[0];<br>
+       cb[1] = b[1];<br>
+<br>
+       cc[0] = c[0];<br>
+       cc[1] = c[1];<br>
+<br>
+       d[0] = a[0];<br>
+       d[1] = a[1];<br>
+<br>
+       e[0] = b[0];<br>
+       e[1] = b[1];<br>
+<br>
+       f[0] = c[0];<br>
+       f[1] = c[1];<br>
+<br>
+       bool failed = false;<br>
+<br>
+       CHECK( d[0], ca[0] );<br>
+       CHECK( d[1], ca[1] );<br>
+       CHECK( e[0], cb[0] );<br>
+       CHECK( e[1], cb[1] );<br>
+       CHECK( f[0], cc[0] );<br>
+       CHECK( f[1], cc[1] );<br></div></div></blockquote><div><br></div><div>I don't think this is a thorough enough test.  For example, since d[0] and ca[0] both came from a[0], effectively you're just checking that a[0] == a[0].  The test is going to pass regardless of whether the data got correctly passed from the OpenGL API through to the shader.<br>

<br></div><div>To verify that the data gets correctly passed, you need to set up some vertex data in the [vertex data] section, and then have the shader compare the data it receives to the data that you expect it to receive.<br>

</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
+<br>
+       if (failed)<br>
+               i_failed = 1;<br>
+       else<br>
+               i_failed = 0;<br>
+<br>
+}<br>
+<br>
+[fragment shader]<br>
+#version 150<br>
+<br>
+flat in int i_failed;<br>
+<br>
+#define CHECK(value, expected) \<br>
+       if (distance(value, expected) > 0.00001) \<br>
+               failed = true<br>
+<br>
+void main()<br>
+{<br>
+<br>
+       bool failed = bool(i_failed);<br>
+<br>
+       if (failed)<br>
+               gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);<br>
+       else<br>
+               gl_FragColor = 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>
--<br>
1.8.3.1<br>
<br>
</div></div>_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org" target="_blank">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>
</blockquote></div><br></div></div>