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

Fabian Bieler fabianbieler at fastmail.fm
Mon Mar 3 01:41:37 PST 2014


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.

Signed-off-by: Fabian Bieler <fabianbieler at fastmail.fm>
---
 .../fs-const-array-of-struct-of-array.shader_test  | 37 ++++++++++++++++++++++
 .../execution/fs-const-array-of-struct.shader_test | 37 ++++++++++++++++++++++
 2 files changed, 74 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..7289982
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/fs-const-array-of-struct-of-array.shader_test
@@ -0,0 +1,37 @@
+# Test accessing a constant array of structs.
+[require]
+GLSL >= 1.20
+
+
+[vertex shader]
+void
+main()
+{
+	gl_Position = gl_Vertex;
+}
+
+
+[fragment shader]
+struct S
+{
+	vec4 v[1];
+};
+
+uniform int zero;
+
+const S colors[1] = S[1](
+	S( vec4[1](vec4(0.0, 1.0, 0.0, 1.0)))
+);
+
+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 0.0 1.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..51cc9aa
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/fs-const-array-of-struct.shader_test
@@ -0,0 +1,37 @@
+# Test accessing a constant array of structs with an array member.
+[require]
+GLSL >= 1.20
+
+
+[vertex shader]
+void
+main()
+{
+	gl_Position = gl_Vertex;
+}
+
+
+[fragment shader]
+struct S
+{
+	vec4 v;
+};
+
+uniform int zero;
+
+const S colors[1] = S[1](
+	S( vec4(0.0, 1.0, 0.0, 1.0))
+);
+
+void
+main()
+{
+	S c = colors[zero];
+	gl_FragColor = c.v;
+}
+
+
+[test]
+uniform int zero 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
1.8.3.2



More information about the Piglit mailing list