[Piglit] [PATCH 9/9] glsl-1.20: Access constant array of structs.

Fabian Bieler fabianbieler at fastmail.fm
Wed Jun 12 09:27:43 PDT 2013


Add two tests:
Test reading from a constant array of structs.
Test reading from a constant array of structs with an array member.

This test provokes failed assertions in st/mesa: glsl_to_tgsi.
---
 .../fs-const-array-of-struct-of-array.shader_test  | 42 ++++++++++++++++++++++
 .../execution/fs-const-array-of-struct.shader_test | 42 ++++++++++++++++++++++
 2 files changed, 84 insertions(+)
 create mode 100644 tests/spec/glsl-1.20/execution/fs-const-array-of-struct-of-array.shader_test
 create mode 100644 tests/spec/glsl-1.20/execution/fs-const-array-of-struct.shader_test

diff --git a/tests/spec/glsl-1.20/execution/fs-const-array-of-struct-of-array.shader_test b/tests/spec/glsl-1.20/execution/fs-const-array-of-struct-of-array.shader_test
new file mode 100644
index 0000000..7217d04
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/fs-const-array-of-struct-of-array.shader_test
@@ -0,0 +1,42 @@
+# Test accessing a constant array of structs.
+[require]
+GL >= 2.0
+GLSL >= 1.20
+
+
+[vertex shader]
+#version 120
+
+void
+main()
+{
+	gl_Position = gl_Vertex;
+}
+
+
+[fragment shader]
+#version 120
+
+struct S
+{
+	vec4 v[1];
+};
+
+uniform int zero;
+
+const S colors[1] = S[1](
+	S( vec4[1](vec4(1, 0, 0, 1)))
+);
+
+void
+main()
+{
+	S c = colors[zero];
+	gl_FragColor = c.v[zero];
+}
+
+
+[test]
+uniform int zero 0
+draw rect -1 -1 2 2
+probe all rgba 1.0 0.0 0.0 1.0
diff --git a/tests/spec/glsl-1.20/execution/fs-const-array-of-struct.shader_test b/tests/spec/glsl-1.20/execution/fs-const-array-of-struct.shader_test
new file mode 100644
index 0000000..7971994
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/fs-const-array-of-struct.shader_test
@@ -0,0 +1,42 @@
+# Test accessing a constant array of structs with an array member.
+[require]
+GL >= 2.0
+GLSL >= 1.20
+
+
+[vertex shader]
+#version 120
+
+void
+main()
+{
+	gl_Position = gl_Vertex;
+}
+
+
+[fragment shader]
+#version 120
+
+struct S
+{
+	vec4 v;
+};
+
+uniform int zero;
+
+const S colors[1] = S[1](
+	S( vec4(1, 0, 0, 1))
+);
+
+void
+main()
+{
+	S c = colors[zero];
+	gl_FragColor = c.v;
+}
+
+
+[test]
+uniform int zero 0
+draw rect -1 -1 2 2
+probe all rgba 1.0 0.0 0.0 1.0
-- 
1.8.1.2



More information about the Piglit mailing list