[Piglit] [PATCH 21/23] arb_shading_language_420pack: Test initialized structs are identical
Matt Turner
mattst88 at gmail.com
Sat Jun 29 19:43:14 PDT 2013
---
.../aggregate-initializer-struct.shader_test | 83 ++++++++++++++++++++++
1 file changed, 83 insertions(+)
create mode 100644 tests/spec/arb_shading_language_420pack/execution/aggregate-initializer-struct.shader_test
diff --git a/tests/spec/arb_shading_language_420pack/execution/aggregate-initializer-struct.shader_test b/tests/spec/arb_shading_language_420pack/execution/aggregate-initializer-struct.shader_test
new file mode 100644
index 0000000..ce86f69
--- /dev/null
+++ b/tests/spec/arb_shading_language_420pack/execution/aggregate-initializer-struct.shader_test
@@ -0,0 +1,83 @@
+[require]
+GLSL >= 1.30
+GL_ARB_shading_language_420pack
+
+[vertex shader]
+#extension GL_ARB_shading_language_420pack: enable
+
+in vec4 vertex;
+out vec4 color;
+
+void main()
+{
+ struct S {
+ vec4 v[2];
+ };
+
+ struct T {
+ S a[2], b;
+ int c;
+ }
+ s1 = T(
+ S[2](
+ S(vec4[2](vec4(1.0, 2.0, 3.0, 4.0), vec4(5.0, 6.0, 7.0, 8.0))),
+ S(vec4[2](vec4(1.0, 2.0, 3.0, 4.0), vec4(5.0, 6.0, 7.0, 8.0)))
+ ), // a
+ S(vec4[2](vec4(1.0, 2.0, 3.0, 4.0), vec4(5.0, 6.0, 7.0, 8.0))), // b
+ 4 // c
+ ),
+ s2 = {
+ {
+ {
+ {
+ {1.0, 2.0, 3.0, 4.0}, // a[0].v[0]
+ {5.0, 6.0, 7.0, 8.0} // a[0].v[1]
+ } // a[0].v
+ }, // a[0]
+ {
+ {
+ {1.0, 2.0, 3.0, 4.0}, // a[1].v[0]
+ {5.0, 6.0, 7.0, 8.0} // a[1].v[1]
+ } // a[1].v
+ } // a[1]
+ }, // a
+ {
+ {
+ {1.0, 2.0, 3.0, 4.0}, // b.v[0]
+ {5.0, 6.0, 7.0, 8.0} // b.v[1]
+ } // b.v
+ }, // b
+ 4 // c
+ };
+
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ if (s1.a[0].v[0] != s2.a[0].v[0] ||
+ s1.a[0].v[1] != s2.a[0].v[1] ||
+ s1.a[1].v[1] != s2.a[1].v[1] ||
+ s1.a[1].v[1] != s2.a[1].v[1] ||
+ s1.b.v[0] != s2.b.v[0] ||
+ s1.b.v[1] != s2.b.v[1] ||
+ s1.c != s2.c) {
+ color = vec4(1.0, 0.0, 0.0, 1.0);
+ }
+ gl_Position = vertex;
+}
+
+[fragment shader]
+in vec4 color;
+
+void main() {
+ gl_FragColor = color;;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0 1.0
+-1.0 1.0
+
+[test]
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 0.0 1.0
--
1.8.1.5
More information about the Piglit
mailing list