summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2015-10-07 16:45:16 -0700
committerIan Romanick <ian.d.romanick@intel.com>2015-10-13 16:37:13 -0700
commit3e75845b11f2d3fdb3e9075316fc9dad83f44e0d (patch)
treefba311ddb9b92f6394cf3117c557714a3c091ff3
parent6aacf6f370846879cc7d80b25235420c666ae1b2 (diff)
glsl-es: Verify rules about constant expressions w.r.t. sizing arrays
NOTE: Without patches recently posted to the mesa-dev mailing list, Mesa fails spec/glsl-es-3.00/compiler/array-sized-by-sequence.*. v2: Fix #version line in spec/glsl-es-1.00/compiler/array-sized-by-sequence-in-parenthesis.vert. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
-rw-r--r--tests/spec/glsl-es-1.00/compiler/array-sized-by-sequence-in-parenthesis.vert17
-rw-r--r--tests/spec/glsl-es-1.00/compiler/array-sized-by-sequence.vert17
-rw-r--r--tests/spec/glsl-es-3.00/compiler/array-sized-by-sequence-in-parenthesis.vert21
-rw-r--r--tests/spec/glsl-es-3.00/compiler/array-sized-by-sequence.vert21
4 files changed, 76 insertions, 0 deletions
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 000000000..e9dc552ee
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/array-sized-by-sequence-in-parenthesis.vert
@@ -0,0 +1,17 @@
+#version 100
+
+/* [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 000000000..68aea950d
--- /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 000000000..778c649b4
--- /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 000000000..d1ccae02d
--- /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]);
+}