summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Berry <stereotype441@gmail.com>2013-10-15 10:57:04 -0700
committerPaul Berry <stereotype441@gmail.com>2013-11-11 15:09:33 -0800
commit1348b320d888eeb1144fb3cee58624891bcdbc71 (patch)
tree9301cfe323959b52d09e48f46673164cf26dc4c6 /tests
parentd37328c3658fe49c4dbeb780d2daffbc6c8b3f19 (diff)
Test a corner case involving arrays, structs, and interface blocks.
This patch exercises the same corner case as https://bugs.freedesktop.org/show_bug.cgi?id=70368. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/spec/glsl-1.50/execution/interface-block-struct-nesting.shader_test54
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/spec/glsl-1.50/execution/interface-block-struct-nesting.shader_test b/tests/spec/glsl-1.50/execution/interface-block-struct-nesting.shader_test
new file mode 100644
index 000000000..a51b8b422
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/interface-block-struct-nesting.shader_test
@@ -0,0 +1,54 @@
+# This test exercises a particular corner case involving interface
+# blocks and structs which is broken as of Mesa 975c6ce.
+#
+# The corner case occurs when an unnamed interface block contains a
+# struct (or an array of structs), and the struct contains an array.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+struct A {
+ float b[2];
+};
+out Block {
+ A a;
+ A aa[2];
+};
+in vec4 piglit_vertex;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+ a.b[0] = 1.0;
+ a.b[1] = 2.0;
+ aa[0].b[0] = 3.0;
+ aa[0].b[1] = 4.0;
+ aa[1].b[0] = 5.0;
+ aa[1].b[1] = 6.0;
+}
+
+[fragment shader]
+struct A {
+ float b[2];
+};
+in Block {
+ A a;
+ A aa[2];
+};
+
+void main()
+{
+ bool ok = true;
+ if (a.b[0] != 1.0) ok = false;
+ if (a.b[1] != 2.0) ok = false;
+ if (aa[0].b[0] != 3.0) ok = false;
+ if (aa[0].b[1] != 4.0) ok = false;
+ if (aa[1].b[0] != 5.0) ok = false;
+ if (aa[1].b[1] != 6.0) ok = false;
+ gl_FragColor = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0