[Piglit] [PATCH 2/2] glsl-es: Verify rules about constant expressions w.r.t. sizing arrays

Ian Romanick idr at freedesktop.org
Wed Oct 7 19:55:04 PDT 2015


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

NOTE: Without patches recently posted to the mesa-dev mailing list,
Mesa fails spec/glsl-es-3.00/compiler/array-sized-by-sequence.*.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 .../array-sized-by-sequence-in-parenthesis.vert     | 17 +++++++++++++++++
 .../compiler/array-sized-by-sequence.vert           | 17 +++++++++++++++++
 .../array-sized-by-sequence-in-parenthesis.vert     | 21 +++++++++++++++++++++
 .../compiler/array-sized-by-sequence.vert           | 21 +++++++++++++++++++++
 4 files changed, 76 insertions(+)
 create mode 100644 tests/spec/glsl-es-1.00/compiler/array-sized-by-sequence-in-parenthesis.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/array-sized-by-sequence.vert
 create mode 100644 tests/spec/glsl-es-3.00/compiler/array-sized-by-sequence-in-parenthesis.vert
 create mode 100644 tests/spec/glsl-es-3.00/compiler/array-sized-by-sequence.vert

diff --git a/tests/spec/glsl-es-1.00/compiler/array-sized-by-sequence-in-parenthesis.vert b/tests/spec/glsl-es-1.00/compiler/array-sized-by-sequence-in-parenthesis.vert
new file mode 100644
index 0000000..bdec205
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/array-sized-by-sequence-in-parenthesis.vert
@@ -0,0 +1,17 @@
+#version 100 es
+
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * While the sequence operator is specifically disallowed as a constant
+ * expression in GLSL ES 3.0 and later, it is allowed in GLSL ES 1.00.
+ */
+
+uniform float uf[(1, 2)];
+
+void main()
+{
+    gl_Position = vec4(uf[0]);
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/array-sized-by-sequence.vert b/tests/spec/glsl-es-1.00/compiler/array-sized-by-sequence.vert
new file mode 100644
index 0000000..68aea95
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/array-sized-by-sequence.vert
@@ -0,0 +1,17 @@
+#version 100
+
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * The spec does not explicitly forbid this.  However, the normative grammar
+ * in the specification does not allow this production.
+ */
+
+uniform float uf[1, 2];
+
+void main()
+{
+    gl_Position = vec4(uf[0]);
+}
diff --git a/tests/spec/glsl-es-3.00/compiler/array-sized-by-sequence-in-parenthesis.vert b/tests/spec/glsl-es-3.00/compiler/array-sized-by-sequence-in-parenthesis.vert
new file mode 100644
index 0000000..778c649
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/array-sized-by-sequence-in-parenthesis.vert
@@ -0,0 +1,21 @@
+#version 300 es
+
+/* [config]
+ * expect_result: fail
+ * glsl_version: 3.00
+ * [end config]
+ *
+ * Section 4.3.3 "Constant Expressions" of the OpenGL GLSL ES 3.00.4 spec
+ * says:
+ *
+ *     "However, the sequence operator ( , ) and the assignment operators ( =,
+ *     +=, ...)  are not included in the operators that can create a constant
+ *     expression."
+ */
+
+uniform float uf[(1, 2)];
+
+void main()
+{
+    gl_Position = vec4(uf[0]);
+}
diff --git a/tests/spec/glsl-es-3.00/compiler/array-sized-by-sequence.vert b/tests/spec/glsl-es-3.00/compiler/array-sized-by-sequence.vert
new file mode 100644
index 0000000..d1ccae0
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/array-sized-by-sequence.vert
@@ -0,0 +1,21 @@
+#version 300 es
+
+/* [config]
+ * expect_result: fail
+ * glsl_version: 3.00
+ * [end config]
+ *
+ * Section 4.3.3 "Constant Expressions" of the OpenGL GLSL ES 3.00.4 spec
+ * says:
+ *
+ *     "However, the sequence operator ( , ) and the assignment operators ( =,
+ *     +=, ...)  are not included in the operators that can create a constant
+ *     expression."
+ */
+
+uniform float uf[1, 2];
+
+void main()
+{
+    gl_Position = vec4(uf[0]);
+}
-- 
2.1.0



More information about the Piglit mailing list