summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2015-10-07 16:23:17 -0700
committerIan Romanick <ian.d.romanick@intel.com>2015-10-13 16:37:13 -0700
commit6aacf6f370846879cc7d80b25235420c666ae1b2 (patch)
tree698f6616d093615742b6711cc40791fd628003d7
parentde21e2443f6135cac6adab51dd6dfcf32ad6f099 (diff)
glsl-es: Additional constant initializer tests.
Most built-in functions with constant-expression parameters are also constant expressions. GLSL ES 1.00 and 3.00 differ as to whether or not the sequence operator is a constant expression. Note: spec/glsl-es-1.00/compiler/const-initializer/from-function.* and spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.* currently fail on Mesa. This is very confusing because the nearly identical spec/glsl-es-3.00/compiler/const-initializer/from-function.* tests both pass! Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
-rw-r--r--tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.frag25
-rw-r--r--tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.vert23
-rw-r--r--tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.frag28
-rw-r--r--tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.vert26
-rw-r--r--tests/spec/glsl-es-3.00/compiler/const-initializer/from-function.frag17
-rw-r--r--tests/spec/glsl-es-3.00/compiler/const-initializer/from-function.vert14
-rw-r--r--tests/spec/glsl-es-3.00/compiler/const-initializer/from-sequence-in-function.frag24
-rw-r--r--tests/spec/glsl-es-3.00/compiler/const-initializer/from-sequence-in-function.vert21
8 files changed, 178 insertions, 0 deletions
diff --git a/tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.frag b/tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.frag
new file mode 100644
index 000000000..fe0268c22
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.frag
@@ -0,0 +1,25 @@
+#version 100
+
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * Section 5.10 (Constant Expressions) of the GLSL ES 1.00.17 spec says:
+ *
+ * "A constant expression is one of
+ *
+ * ...
+ *
+ * - a built-in function call whose arguments are all constant
+ * expressions, with the exception of the texture lookup functions."
+ */
+
+precision mediump float;
+
+const float f = cos(0.0);
+
+void main()
+{
+ gl_FragData[0] = vec4(f);
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.vert b/tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.vert
new file mode 100644
index 000000000..b96fcf800
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.vert
@@ -0,0 +1,23 @@
+#version 100
+
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * Section 5.10 (Constant Expressions) of the GLSL ES 1.00.17 spec says:
+ *
+ * "A constant expression is one of
+ *
+ * ...
+ *
+ * - a built-in function call whose arguments are all constant
+ * expressions, with the exception of the texture lookup functions."
+ */
+
+const float f = cos(0.0);
+
+void main()
+{
+ gl_Position = vec4(f);
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.frag b/tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.frag
new file mode 100644
index 000000000..0e398173d
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.frag
@@ -0,0 +1,28 @@
+#version 100
+
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * Section 5.10 (Constant Expressions) of the GLSL ES 1.00.17 spec says:
+ *
+ * "A constant expression is one of
+ *
+ * ...
+ *
+ * - a built-in function call whose arguments are all constant
+ * expressions, with the exception of the texture lookup functions."
+ *
+ * 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.
+ */
+
+precision mediump float;
+
+const float f = cos((1.0, 2.0));
+
+void main()
+{
+ gl_FragData[0] = vec4(f);
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.vert b/tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.vert
new file mode 100644
index 000000000..ffebd6bac
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.vert
@@ -0,0 +1,26 @@
+#version 100
+
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * Section 5.10 (Constant Expressions) of the GLSL ES 1.00.17 spec says:
+ *
+ * "A constant expression is one of
+ *
+ * ...
+ *
+ * - a built-in function call whose arguments are all constant
+ * expressions, with the exception of the texture lookup functions."
+ *
+ * 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 = cos((1.0, 2.0));
+
+void main()
+{
+ gl_Position = vec4(f);
+}
diff --git a/tests/spec/glsl-es-3.00/compiler/const-initializer/from-function.frag b/tests/spec/glsl-es-3.00/compiler/const-initializer/from-function.frag
new file mode 100644
index 000000000..8a90994e5
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/const-initializer/from-function.frag
@@ -0,0 +1,17 @@
+#version 300 es
+
+/* [config]
+ * expect_result: pass
+ * glsl_version: 3.00
+ * [end config]
+ */
+
+precision mediump float;
+
+const float f = cos(0.0);
+out vec4 fragdata;
+
+void main()
+{
+ fragdata = vec4(f);
+}
diff --git a/tests/spec/glsl-es-3.00/compiler/const-initializer/from-function.vert b/tests/spec/glsl-es-3.00/compiler/const-initializer/from-function.vert
new file mode 100644
index 000000000..851ba76ef
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/const-initializer/from-function.vert
@@ -0,0 +1,14 @@
+#version 300 es
+
+/* [config]
+ * expect_result: pass
+ * glsl_version: 3.00
+ * [end config]
+ */
+
+const float f = cos(0.0);
+
+void main()
+{
+ gl_Position = vec4(f);
+}
diff --git a/tests/spec/glsl-es-3.00/compiler/const-initializer/from-sequence-in-function.frag b/tests/spec/glsl-es-3.00/compiler/const-initializer/from-sequence-in-function.frag
new file mode 100644
index 000000000..84ed272ac
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/const-initializer/from-sequence-in-function.frag
@@ -0,0 +1,24 @@
+#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."
+ */
+
+precision mediump float;
+
+const float f = cos((1.0, 2.0));
+out vec4 fragdata;
+
+void main()
+{
+ fragdata = vec4(f);
+}
diff --git a/tests/spec/glsl-es-3.00/compiler/const-initializer/from-sequence-in-function.vert b/tests/spec/glsl-es-3.00/compiler/const-initializer/from-sequence-in-function.vert
new file mode 100644
index 000000000..5dad4194f
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/const-initializer/from-sequence-in-function.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 = cos((1.0, 2.0));
+
+void main()
+{
+ gl_Position = vec4(f);
+}