[Piglit] [PATCH 1/4] glsl-es-3.00: Check array sizing rules in GLSL ES 3.00.

Ian Romanick idr at freedesktop.org
Sat Nov 17 17:08:50 PST 2012


From: Ian Romanick <ian.d.romanick at intel.com>

Mesa currently fails array-sized-by-initializer.vert.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 .../compiler/array-sized-by-initializer.vert       | 31 ++++++++++++++++++++++
 .../compiler/no-unsized-arrays-01.vert             | 25 +++++++++++++++++
 .../compiler/no-unsized-arrays-02.vert             | 19 +++++++++++++
 3 files changed, 75 insertions(+)
 create mode 100644 tests/spec/glsl-es-3.00/compiler/array-sized-by-initializer.vert
 create mode 100644 tests/spec/glsl-es-3.00/compiler/no-unsized-arrays-01.vert
 create mode 100644 tests/spec/glsl-es-3.00/compiler/no-unsized-arrays-02.vert

diff --git a/tests/spec/glsl-es-3.00/compiler/array-sized-by-initializer.vert b/tests/spec/glsl-es-3.00/compiler/array-sized-by-initializer.vert
new file mode 100644
index 0000000..ff4648b
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/array-sized-by-initializer.vert
@@ -0,0 +1,31 @@
+#version 300 es
+
+/* [config]
+ * expect_result: pass
+ * glsl_version: 3.00
+ * [end config]
+ *
+ * Page 28 (page 34 of the PDF) of the OpenGL ES Shading Language 3.00
+ * spec says:
+ *
+ *     "An array type can also be formed without specifying a size if
+ *     the definition includes an initializer:
+ *
+ *         float x[] = float[2] (1.0, 2.0);
+ *         // declares an array of size 2
+ *         float y[] = float[] (1.0, 2.0, 3.0); // declares an array of size 3
+ *         float a[5];
+ *         float b[] = a;"
+ */
+
+void main()
+{
+  float x[] = float[2] (1.0, 2.0);
+  // declares an array of size 2
+  float y[] = float[] (1.0, 2.0, 3.0); // declares an array of size 3
+  float a[5];
+  float b[] = a;
+  float c[5] = b; // verify that b got the correct size
+
+  gl_Position = vec4(0.);
+}
diff --git a/tests/spec/glsl-es-3.00/compiler/no-unsized-arrays-01.vert b/tests/spec/glsl-es-3.00/compiler/no-unsized-arrays-01.vert
new file mode 100644
index 0000000..60d4cf3
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/no-unsized-arrays-01.vert
@@ -0,0 +1,25 @@
+#version 300 es
+
+/* [config]
+ * expect_result: fail
+ * glsl_version: 3.00
+ * [end config]
+ *
+ * Page 35 of the OpenGL ES Shading Language 3.00 spec says:
+ *
+ *     "An array declaration which leaves the size unspecified is an
+ *     error."
+ */
+
+void main()
+{
+  /* This is valid in desktop GL.  The initial declaration lacks a
+   * size, but a later re-declaration provides one.  GLSL ES does not
+   * allow this.
+   */
+  float a[];
+
+  float a[5];
+
+  gl_Position = vec4(0.);
+}
diff --git a/tests/spec/glsl-es-3.00/compiler/no-unsized-arrays-02.vert b/tests/spec/glsl-es-3.00/compiler/no-unsized-arrays-02.vert
new file mode 100644
index 0000000..b08683b
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/no-unsized-arrays-02.vert
@@ -0,0 +1,19 @@
+#version 300 es
+
+/* [config]
+ * expect_result: fail
+ * glsl_version: 3.00
+ * [end config]
+ *
+ * Page 35 of the OpenGL ES Shading Language 3.00 spec says:
+ *
+ *     "An array declaration which leaves the size unspecified is an
+ *     error."
+ */
+
+void main()
+{
+  float a[];
+
+  gl_Position = vec4(0.);
+}
-- 
1.7.11.7



More information about the Piglit mailing list