[Piglit] [PATCH] Add interface blocks that make sure unsized arrays are not allowed.

Kenneth Graunke kenneth at whitecape.org
Fri Jun 7 23:28:25 PDT 2013


This is explicitly forbidden: "Geometry shader input blocks [...].  All
other input and output block arrays must specify an array size."

The vertex and fragment shader tests pass on Mesa.  The GS test has not
been tested.

Cc: Jordan Justen <jljusten at gmail.com>
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 .../interface-blocks-unsized-array-in.frag         | 22 ++++++++++++++++++
 .../interface-blocks-unsized-array-in.vert         | 22 ++++++++++++++++++
 .../interface-blocks-unsized-array-out.geom        | 27 ++++++++++++++++++++++
 .../interface-blocks-unsized-array-out.vert        | 20 ++++++++++++++++
 4 files changed, 91 insertions(+)
 create mode 100644 tests/spec/glsl-1.50/compiler/interface-blocks-unsized-array-in.frag
 create mode 100644 tests/spec/glsl-1.50/compiler/interface-blocks-unsized-array-in.vert
 create mode 100644 tests/spec/glsl-1.50/compiler/interface-blocks-unsized-array-out.geom
 create mode 100644 tests/spec/glsl-1.50/compiler/interface-blocks-unsized-array-out.vert

diff --git a/tests/spec/glsl-1.50/compiler/interface-blocks-unsized-array-in.frag b/tests/spec/glsl-1.50/compiler/interface-blocks-unsized-array-in.frag
new file mode 100644
index 0000000..e773b2d
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/interface-blocks-unsized-array-in.frag
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// check_link: true
+// [end config]
+
+#version 150
+
+/* From the GLSL 1.50 spefication, section 4.3.7, the second to last paragraph:
+ * "Geometry shader input blocks [...].  All other input and output block
+ *  arrays must specify an array size."
+ */
+in block {
+  vec4 v;
+} inputs[];
+
+out vec4 a;
+
+void main()
+{
+    a = inputs[0].v;
+}
diff --git a/tests/spec/glsl-1.50/compiler/interface-blocks-unsized-array-in.vert b/tests/spec/glsl-1.50/compiler/interface-blocks-unsized-array-in.vert
new file mode 100644
index 0000000..e903402
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/interface-blocks-unsized-array-in.vert
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// check_link: true
+// [end config]
+
+#version 150
+
+/* From the GLSL 1.50 spefication, section 4.3.7, the second to last paragraph:
+ * "Geometry shader input blocks [...].  All other input and output block
+ *  arrays must specify an array size."
+ */
+in block {
+  vec4 v;
+} attribs[];
+
+out vec4 a;
+
+void main()
+{
+    vec4 a = attribs[0].v;
+}
diff --git a/tests/spec/glsl-1.50/compiler/interface-blocks-unsized-array-out.geom b/tests/spec/glsl-1.50/compiler/interface-blocks-unsized-array-out.geom
new file mode 100644
index 0000000..f506b72
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/interface-blocks-unsized-array-out.geom
@@ -0,0 +1,27 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// check_link: true
+// [end config]
+
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+/* From the GLSL 1.50 spefication, section 4.3.7, the second to last paragraph:
+ * "Geometry shader input blocks [...].  All other input and output block
+ *  arrays must specify an array size."
+ */
+out block {
+  vec4 v;
+} varyings[];
+
+void main()
+{
+  for (int i = 0; i < 3; i++) {
+    gl_Position = vec4(0.0);
+    varyings[0].v = vec4(1.0);
+    EmitVertex();
+  }
+}
diff --git a/tests/spec/glsl-1.50/compiler/interface-blocks-unsized-array-out.vert b/tests/spec/glsl-1.50/compiler/interface-blocks-unsized-array-out.vert
new file mode 100644
index 0000000..c84b390
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/interface-blocks-unsized-array-out.vert
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// check_link: true
+// [end config]
+
+#version 150
+
+/* From the GLSL 1.50 spefication, section 4.3.7, the second to last paragraph:
+ * "Geometry shader input blocks [...].  All other input and output block
+ *  arrays must specify an array size."
+ */
+out block {
+  vec4 v;
+} varyings[];
+
+void main()
+{
+    varyings[0].v = vec4(1.0);
+}
-- 
1.8.3



More information about the Piglit mailing list