[Piglit] [PATCH 6/6] glsl-1.20: Add tests for uniform array-of-structures with initializers

Ian Romanick idr at freedesktop.org
Wed May 16 14:23:48 PDT 2012


From: Ian Romanick <ian.d.romanick at intel.com>

Like the non-array structure tests, it was just impractical to
generate these tests using scripts, so they are hand-written.
However, these tests currently fail on Mesa.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 .../fs-structure-array.shader_test                 |   48 ++++++++++++++++++++
 .../vs-structure-array.shader_test                 |   48 ++++++++++++++++++++
 2 files changed, 96 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/glsl-1.20/execution/uniform-initializer/fs-structure-array.shader_test
 create mode 100644 tests/spec/glsl-1.20/execution/uniform-initializer/vs-structure-array.shader_test

diff --git a/tests/spec/glsl-1.20/execution/uniform-initializer/fs-structure-array.shader_test b/tests/spec/glsl-1.20/execution/uniform-initializer/fs-structure-array.shader_test
new file mode 100644
index 0000000..36f5644
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/uniform-initializer/fs-structure-array.shader_test
@@ -0,0 +1,48 @@
+[require]
+GLSL >= 1.20
+
+[vertex shader]
+#version 120
+
+void main()
+{
+  gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+#version 120
+
+struct S {
+  int i;
+  float f;
+  vec4 v[2];
+};
+
+uniform S s[2] = S[2](S(9, 33.3, vec4[2](vec4(1, 2, 3, 4),
+					 vec4(9, 8, 7, 6))),
+		      S(7, 22.2, vec4[2](vec4(5, 6, 7, 8),
+					 vec4(3, 2, 1, 0))));
+
+void main()
+{
+  vec4 color;
+
+  if (s[0].i == 9
+      && s[0].f == 33.3
+      && s[0].v[0] == vec4(1, 2, 3, 4)
+      && s[0].v[1] == vec4(9, 8, 7, 6)
+      && s[1].i == 7
+      && s[1].f == 22.2
+      && s[1].v[0] == vec4(5, 6, 7, 8)
+      && s[1].v[1] == vec4(3, 2, 1, 0)) {
+    color = vec4(0, 1, 0, 1);
+  } else {
+    color = vec4(1, 0, 0, 1);
+  }
+
+  gl_FragColor = color;
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgb 0 1 0
diff --git a/tests/spec/glsl-1.20/execution/uniform-initializer/vs-structure-array.shader_test b/tests/spec/glsl-1.20/execution/uniform-initializer/vs-structure-array.shader_test
new file mode 100644
index 0000000..7b8bd50
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/uniform-initializer/vs-structure-array.shader_test
@@ -0,0 +1,48 @@
+[require]
+GLSL >= 1.20
+
+[vertex shader]
+#version 120
+
+struct S {
+  int i;
+  float f;
+  vec4 v[2];
+};
+
+uniform S s[2] = S[2](S(9, 33.3, vec4[2](vec4(1, 2, 3, 4),
+					 vec4(9, 8, 7, 6))),
+		      S(7, 22.2, vec4[2](vec4(5, 6, 7, 8),
+					 vec4(3, 2, 1, 0))));
+varying vec4 color;
+
+void main()
+{
+  if (s[0].i == 9
+      && s[0].f == 33.3
+      && s[0].v[0] == vec4(1, 2, 3, 4)
+      && s[0].v[1] == vec4(9, 8, 7, 6)
+      && s[1].i == 7
+      && s[1].f == 22.2
+      && s[1].v[0] == vec4(5, 6, 7, 8)
+      && s[1].v[1] == vec4(3, 2, 1, 0)) {
+    color = vec4(0, 1, 0, 1);
+  } else {
+    color = vec4(1, 0, 0, 1);
+  }
+
+  gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+#version 120
+varying vec4 color;
+
+void main()
+{
+  gl_FragColor = color;
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgb 0 1 0
-- 
1.7.6.5



More information about the Piglit mailing list