[08/10] glsl-es-1.00:=, !=, * and multidim structure and array operations

Message ID 1367013224-21359-8-git-send-email-tom.gall@linaro.org
State New
Headers show

Commit Message

Tom Gall April 26, 2013, 9:53 p.m.
Add to tests/spec/glsl-es-1.00/compiler/structure-and-array-operations
glslparser tests for arrays and assignment, multidimensional,
multiply, and not equal.

Signed-off-by: Tom Gall <tom.gall@linaro.org>
---
 .../array-assign.vert                              |   27 +++++++++++++++++++
 .../array-multidimensional-new-syntax.vert         |   17 ++++++++++++
 .../array-multidimensional.vert                    |   17 ++++++++++++
 .../array-multiply.vert                            |   23 ++++++++++++++++
 .../array-not-equal-implicit-size.vert             |   28 ++++++++++++++++++++
 .../array-not-equal-matrix.vert                    |   22 +++++++++++++++
 .../array-not-equal-mismatched-base-type.vert      |   22 +++++++++++++++
 .../array-not-equal-mismatched-size.vert           |   22 +++++++++++++++
 .../array-not-equal-vertor.vert                    |   22 +++++++++++++++
 .../array-not-equal.vert                           |   22 +++++++++++++++
 10 files changed, 222 insertions(+)
 create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-assign.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-multidimensional-new-syntax.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-multidimensional.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-multiply.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal-implicit-size.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal-matrix.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal-mismatched-base-type.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal-mismatched-size.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal-vertor.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal.vert

Patch hide | download patch | download mbox

diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-assign.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-assign.vert
new file mode 100644
index 0000000..56c480d
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-assign.vert
@@ -0,0 +1,27 @@ 
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * From page 46 of the GLSL ES 1.00.17 spec:
+ *
+ * "Assignments of values to variables are performed using the assignment
+ * operator (=).
+ * ...
+ * and l-values dereferenced with the array subsript operator ([]) are
+ * all l-values."
+ */
+
+
+void main()
+{
+  vec4 a[2];
+  vec4 b[2];
+  vec4 c[2];
+
+  a = vec4[2](vec4(0.0), vec4(2.0));
+  b = vec4[ ](vec4(0.5), vec4(2.0));
+  c = a;
+
+  gl_Position = a[0] + b[0] + c[1];
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-multidimensional-new-syntax.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-multidimensional-new-syntax.vert
new file mode 100644
index 0000000..05db993
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-multidimensional-new-syntax.vert
@@ -0,0 +1,17 @@ 
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * From page 24 of the GLSL ES 1.00.17 spec:
+ *
+ *     "Only one-dimensional arrays may be declared."
+ */
+
+
+uniform vec4 [1] an_array[1];
+
+void main()
+{
+  gl_Position = an_array[0][0];
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-multidimensional.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-multidimensional.vert
new file mode 100644
index 0000000..0c046f4
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-multidimensional.vert
@@ -0,0 +1,17 @@ 
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * From page 24 of the GLSL ES 1.00.17 spec:
+ *
+ *     "Only one-dimensional arrays may be declared."
+ */
+
+
+uniform vec4 an_array[1][1];
+
+void main()
+{
+  gl_Position = an_array[0][0];
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-multiply.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-multiply.vert
new file mode 100644
index 0000000..092150b
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-multiply.vert
@@ -0,0 +1,23 @@ 
+/* [config]
+ * expect_result: fail
+ * glsles_version: 1.00
+ * [end config]
+ *
+ * From page 48 of the GLSL ES 1.00.17 spec:
+ *
+ * "The arithmetic binary operators add (+), subtract (-), multiply (*),
+ * and divide (/) operate on integer and floating-point typed expressions
+ * (including vectors and matrices). The two operands must be of the same
+ * type or one can be a scalar float and the other a float vector or matrix
+ * or one can be a scalar integer and the other an integer vector."
+ */
+
+
+uniform vec4 a[2];
+uniform vec4 b[2];
+
+void main()
+{
+  vec4 c[2] = a * b;
+  gl_Position = c[0];
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal-implicit-size.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal-implicit-size.vert
new file mode 100644
index 0000000..548c2e5
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal-implicit-size.vert
@@ -0,0 +1,28 @@ 
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * Page 48 GLSL ES 1.00.17 spec:
+ *
+ * "The equality operations equal (==) and not equal (!=) operate on all
+ * types execpt arrays, structures containing arrays...."
+ *
+ * Further "For vectors, matricies, and structures, all components of
+ * the operands must be equal for the operands to be considered equal."
+ */
+
+
+uniform vec4 a[2];
+uniform vec4 b[2];
+
+void main()
+{
+  vec4 c[];
+
+  // Implicitly size c to match a and b.
+  c[0] = b[0];
+  c[1] = b[2];
+
+  gl_Position = vec4(a != c);
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal-matrix.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal-matrix.vert
new file mode 100644
index 0000000..15f2938
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal-matrix.vert
@@ -0,0 +1,22 @@ 
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * Page 48 GLSL ES 1.00.17 spec:
+ *
+ * "The equality operations equal (==) and not equal (!=) operate on all
+ * types execpt arrays, structures containing arrays...."
+ *
+ * Further "For vectors, matricies, and structures, all components of
+ * the operands must be equal for the operands to be considered equal."
+ */
+
+
+uniform vec4 a[4];
+uniform mat4 b;
+
+void main()
+{
+  gl_Position = vec4(a != b);
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal-mismatched-base-type.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal-mismatched-base-type.vert
new file mode 100644
index 0000000..6cd21d4
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal-mismatched-base-type.vert
@@ -0,0 +1,22 @@ 
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * Page 48 GLSL ES 1.00.17 spec:
+ *
+ * "The equality operations equal (==) and not equal (!=) operate on all
+ * types execpt arrays, structures containing arrays...."
+ *
+ * Further "For vectors, matricies, and structures, all components of
+ * the operands must be equal for the operands to be considered equal."
+ */
+
+
+uniform vec4 a[2];
+uniform vec3 b[2]; // Note the differing base type
+
+void main()
+{
+  gl_Position = vec4(a != b);
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal-mismatched-size.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal-mismatched-size.vert
new file mode 100644
index 0000000..707babd
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal-mismatched-size.vert
@@ -0,0 +1,22 @@ 
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * Page 48 GLSL ES 1.00.17 spec:
+ *
+ * "The equality operations equal (==) and not equal (!=) operate on all
+ * types execpt arrays, structures containing arrays...."
+ *
+ * Further "For vectors, matricies, and structures, all components of
+ * the operands must be equal for the operands to be considered equal."
+ */
+
+
+uniform vec4 a[2];
+uniform vec4 b[3]; // Note the differing size
+
+void main()
+{
+  gl_Position = vec4(a != b);
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal-vertor.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal-vertor.vert
new file mode 100644
index 0000000..a94152b
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal-vertor.vert
@@ -0,0 +1,22 @@ 
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * Page 48 GLSL ES 1.00.17 spec:
+ *
+ * "The equality operations equal (==) and not equal (!=) operate on all
+ * types execpt arrays, structures containing arrays...."
+ *
+ * Further "For vectors, matricies, and structures, all components of
+ * the operands must be equal for the operands to be considered equal."
+ */
+
+
+uniform float a[4];
+uniform vec4 b;
+
+void main()
+{
+  gl_Position = vec4(a != b);
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal.vert
new file mode 100644
index 0000000..208c169
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-not-equal.vert
@@ -0,0 +1,22 @@ 
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * Page 48 GLSL ES 1.00.17 spec:
+ *
+ * "The equality operations equal (==) and not equal (!=) operate on all
+ * types execpt arrays, structures containing arrays...."
+ *
+ * Further "For vectors, matricies, and structures, all components of
+ * the operands must be equal for the operands to be considered equal."
+ */
+
+
+uniform vec4 a[2];
+uniform vec4 b[2];
+
+void main()
+{
+  gl_Position = vec4(a != b);
+}