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

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


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

It was just impractical to generate these tests using scripts, so they
are hand-written.

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

diff --git a/tests/spec/glsl-1.20/execution/uniform-initializer/fs-structure.shader_test b/tests/spec/glsl-1.20/execution/uniform-initializer/fs-structure.shader_test
new file mode 100644
index 0000000..3b0c950
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/uniform-initializer/fs-structure.shader_test
@@ -0,0 +1,44 @@
+[require]
+GLSL >= 1.20
+
+[vertex shader]
+#version 120
+
+void main()
+{
+  gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+#version 120
+varying vec4 color;
+
+struct S {
+  int i;
+  float f;
+  vec4 v[2];
+};
+
+uniform S s = S(9, 33.3, vec4[2](vec4(1, 2, 3, 4),
+				 vec4(9, 8, 7, 6)));
+
+void main()
+{
+  vec4 color;
+
+  if (s.i == 9
+      && s.f == 33.3
+      && s.v[0] == vec4(1, 2, 3, 4)
+      && s.v[1] == vec4(9, 8, 7, 6)) {
+    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.shader_test b/tests/spec/glsl-1.20/execution/uniform-initializer/vs-structure.shader_test
new file mode 100644
index 0000000..f2fa32d
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/uniform-initializer/vs-structure.shader_test
@@ -0,0 +1,42 @@
+[require]
+GLSL >= 1.20
+
+[vertex shader]
+#version 120
+
+struct S {
+  int i;
+  float f;
+  vec4 v[2];
+};
+
+uniform S s = S(9, 33.3, vec4[2](vec4(1, 2, 3, 4),
+				 vec4(9, 8, 7, 6)));
+varying vec4 color;
+
+void main()
+{
+  if (s.i == 9
+      && s.f == 33.3
+      && s.v[0] == vec4(1, 2, 3, 4)
+      && s.v[1] == vec4(9, 8, 7, 6)) {
+    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