summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2015-10-05 15:54:57 -0700
committerIan Romanick <ian.d.romanick@intel.com>2015-10-07 14:59:20 -0700
commit53a7f990e1ba5306274a1b458570b67b2ed85445 (patch)
treeeeeec923e375e9da604858b107604b938c02efe4
parent464e175a4f42c128918bf303d0e34dc92cfc8792 (diff)
glsl-es: Test whether or not sequence can be a constant expression
The rules changed from GLSL ES 1.00 to GLSL ES 3.00, so the two tests expect opposite results. NOTE: Mesa currently fails tests/spec/glsl-es-3.00/compiler/constant-sequence.vert and the related GLES3 conformance test. v2: s/sequnece/sequence/ noticed by Matt. v3: Move tests into const-initializer subdirectories. Add tests with more complex use of sequence operator. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com> [v2] Cc: Tapani Pälli <tapani.palli@intel.com> Cc: Mark Janes <mark.a.janes@intel.com> Cc: Marta Lofstedt <marta.lofstedt@intel.com>
-rw-r--r--tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-complex.vert17
-rw-r--r--tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence.vert17
-rw-r--r--tests/spec/glsl-es-3.00/compiler/const-initializer/from-sequence-complex.vert21
-rw-r--r--tests/spec/glsl-es-3.00/compiler/const-initializer/from-sequence.vert21
4 files changed, 76 insertions, 0 deletions
diff --git a/tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-complex.vert b/tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-complex.vert
new file mode 100644
index 000000000..2276e623c
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-complex.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.
+ */
+
+const float f = 3.0 + (1.0, 2.0);
+
+void main()
+{
+ gl_Position = vec4(f);
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence.vert b/tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence.vert
new file mode 100644
index 000000000..ae855237a
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence.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.
+ */
+
+const float f = (1.0, 2.0);
+
+void main()
+{
+ gl_Position = vec4(f);
+}
diff --git a/tests/spec/glsl-es-3.00/compiler/const-initializer/from-sequence-complex.vert b/tests/spec/glsl-es-3.00/compiler/const-initializer/from-sequence-complex.vert
new file mode 100644
index 000000000..dea2ea328
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/const-initializer/from-sequence-complex.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."
+ */
+
+const float f = 3.0 + (1.0, 2.0);
+
+void main()
+{
+ gl_Position = vec4(f);
+}
diff --git a/tests/spec/glsl-es-3.00/compiler/const-initializer/from-sequence.vert b/tests/spec/glsl-es-3.00/compiler/const-initializer/from-sequence.vert
new file mode 100644
index 000000000..260e8efe0
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/const-initializer/from-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."
+ */
+
+const float f = (1.0, 2.0);
+
+void main()
+{
+ gl_Position = vec4(f);
+}