new file mode 100644
@@ -0,0 +1,28 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * Page 24, GLSL ES 1.00.17 spec:
+ *
+ * " The array size must be an integral constant expression (see Section 4.3.3
+ * "Integral Constant Expressions") greater than zero."
+ *
+ * Further Section 10.17 Unsized Array Declarations on page 93 states:
+ *
+ * "gl_TexCoord is part of fixed functionality so unsigned arrays should be
+ * removed for GLSL ES
+ *
+ * RESOLUTION: Remove unsized array declarations"
+ */
+
+
+uniform float a[5];
+
+void main()
+{
+ float b[];
+ b = a;
+
+ gl_Position = vec4(0);
+}
new file mode 100644
@@ -0,0 +1,18 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * From page 30 of the GLSL ES 1.00.17 spec:
+ *
+ * "Attribute variables cannot be declared as arrays or structures."
+ */
+
+
+attribute vec4 a[2]
+uniform int i;
+
+void main()
+{
+ gl_Position = a[i];
+}
new file mode 100644
@@ -0,0 +1,15 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * Page 41, GLSL ES 1.00.17 spec:
+ *
+ * "Semantically, the number of parameters much be of sufficient size
+ * and correct type to perform the initialization."
+ */
+
+
+vec4 a[] = vec4[2](vec4(0.0), vec4(1.0), vec4(2.0));
+
+void main() { gl_Position = a[0]; }
new file mode 100644
@@ -0,0 +1,29 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * From page 79 of the GLSL ES 1.00.17 spec:
+ *
+ * expression:
+ * assignment_expression
+ * expression COMMA assignment_expression
+ *
+ * constant_expression:
+ * conditional_expression
+ *
+ * ...
+ *
+ * init_declarator_list:
+ * single_declaration
+ * init_declarator_list COMMA IDENTIFIER
+ * init_declarator_list COMMA IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET
+ * init_declarator_list COMMA IDENTIFIER EQUAL initializer
+ */
+
+
+vec4 a[2] = vec4[2](vec4(0.0), vec4(2.0));
+vec4 b[2] = vec4[ ](vec4(0.5), vec4(2.0));
+vec4 c[ ] = vec4[ ](vec4(1.0), vec4(2.0));
+
+void main() { gl_Position = a[0] + b[0] + c[0]; }
new file mode 100644
@@ -0,0 +1,21 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * Page 24, GLSL ES 1.00 spec:
+ *
+ * "The array size must be an integral constant expression (see
+ * Section 4.3.3 "Integral Constant Expressions") greater than
+ * zero."
+ */
+
+
+void main()
+{
+ float b[];
+
+ b[2] = 1.0; // Implicitly size array to have at least 3 elements
+
+ gl_Position = vec4(b.length());
+}
new file mode 100644
@@ -0,0 +1,13 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ */
+
+
+uniform vec4 a[2];
+
+void main()
+{
+ gl_Position = vec4(a.length(5));
+}
new file mode 100644
@@ -0,0 +1,15 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * The GLSL ES 1.00.17 spec appears to be silent on this.
+ */
+
+
+uniform vec4 a[2];
+
+void main()
+{
+ gl_Position = vec4(a.length());
+}
new file mode 100644
@@ -0,0 +1,19 @@
+/* [config]
+ * expect_result: fail
+ * glsles_version: 1.00
+ * [end config]
+ *
+ * From page 48 of the GLSL ES 1.00.17 spec:
+ *
+ * "The arithmetic unary operators negate (-), post- and pre-increment
+ * and decrement (-- and ++) operate on integer or floating point
+ * values (including vectors and matrices).
+ */
+
+
+uniform vec4 a[2];
+
+void main()
+{
+ gl_Position = (--a)[0];
+}
new file mode 100644
@@ -0,0 +1,19 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * From page 48 of the GLSL ES 1.00.17 spec:
+ *
+ * "The arithmetic unary operators negate (-), post- and pre-increment
+ * and decrement (-- and ++) operate on integer or floating point
+ * values (including vectors and matrices).
+ */
+
+
+uniform vec4 a[2];
+
+void main()
+{
+ gl_Position = (++a)[0];
+}
new file mode 100644
@@ -0,0 +1,29 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * Page 24, GLSL ES 1.00.17 spec:
+ *
+ * " The array size must be an integral constant expression (see Section 4.3.3
+ * "Integral Constant Expressions") greater than zero."
+ *
+ * Further Section 10.17 Unsized Array Declarations on page 93 states:
+ *
+ * "gl_TexCoord is part of fixed functionality so unsigned arrays should be
+ * removed for GLSL ES
+ *
+ * RESOLUTION: Remove unsized array declarations"
+ */
+
+
+/* Assume the array is sized in a different compilation unit.
+ */
+vec4 [] an_array;
+
+uniform int i;
+
+void main()
+{
+ gl_Position = an_array[i];
+}
new file mode 100644
@@ -0,0 +1,34 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * Page 24, GLSL ES 1.00.17 spec:
+ *
+ * " The array size must be an integral constant expression (see Section 4.3.3
+ * "Integral Constant Expressions") greater than zero."
+ *
+ * Further Section 10.17 Unsized Array Declarations on page 93 states:
+ *
+ * "gl_TexCoord is part of fixed functionality so unsigned arrays should be
+ * removed for GLSL ES
+ *
+ * RESOLUTION: Remove unsized array declarations"
+ */
+
+
+attribute vec4 a;
+attribute vec4 b;
+
+uniform int i;
+
+void main()
+{
+ vec4 [] an_array;
+
+ an_array[0] = a;
+ an_array[1] = vec4(0);
+ an_array[2] = b;
+
+ gl_Position = an_array[i];
+}
Add to tests/spec/glsl-es-1.00/compiler/structure-and-array-operations glslparser tests for array assignment using implicit size, attributes, array constructor tests, array length() fn, array preincrement, array predecrement, and array variable index tests using implicit array sizes. Signed-off-by: Tom Gall <tom.gall@linaro.org> --- .../array-assign-implicit-size.vert | 28 ++++++++++++++++ .../array-attribute.vert | 18 +++++++++++ .../array-ctor-mismatched-size.vert | 15 +++++++++ .../structure-and-array-operations/array-ctor.vert | 29 +++++++++++++++++ .../array-length-implicit-size.vert | 21 ++++++++++++ .../array-length-with-argument.vert | 13 ++++++++ .../array-length.vert | 15 +++++++++ .../array-predecrement.vert | 19 +++++++++++ .../array-preincrement.vert | 19 +++++++++++ .../array-variable-index-implicit-size-global.vert | 29 +++++++++++++++++ .../array-variable-index-implicit-size-local.vert | 34 ++++++++++++++++++++ 11 files changed, 240 insertions(+) create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-assign-implicit-size.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-attribute.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-ctor-mismatched-size.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-ctor.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length-implicit-size.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length-with-argument.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-predecrement.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-preincrement.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-variable-index-implicit-size-global.vert create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-variable-index-implicit-size-local.vert