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 <[email protected]> --- .../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 diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-assign-implicit-size.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-assign-implicit-size.vert new file mode 100644 index 0000000..49ae6be --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-assign-implicit-size.vert @@ -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); +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-attribute.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-attribute.vert new file mode 100644 index 0000000..aef953c --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-attribute.vert @@ -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]; +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-ctor-mismatched-size.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-ctor-mismatched-size.vert new file mode 100644 index 0000000..42dc232 --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-ctor-mismatched-size.vert @@ -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]; } diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-ctor.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-ctor.vert new file mode 100644 index 0000000..e57e0f6 --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-ctor.vert @@ -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]; } diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length-implicit-size.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length-implicit-size.vert new file mode 100644 index 0000000..847733e --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length-implicit-size.vert @@ -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()); +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length-with-argument.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length-with-argument.vert new file mode 100644 index 0000000..1767ab7b --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length-with-argument.vert @@ -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)); +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length.vert new file mode 100644 index 0000000..d20bd97 --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-length.vert @@ -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()); +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-predecrement.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-predecrement.vert new file mode 100644 index 0000000..6b73258 --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-predecrement.vert @@ -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]; +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-preincrement.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-preincrement.vert new file mode 100644 index 0000000..d4c84c3 --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-preincrement.vert @@ -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]; +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-variable-index-implicit-size-global.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-variable-index-implicit-size-global.vert new file mode 100644 index 0000000..042dbd3 --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-variable-index-implicit-size-global.vert @@ -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]; +} diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-variable-index-implicit-size-local.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-variable-index-implicit-size-local.vert new file mode 100644 index 0000000..d24e0ee --- /dev/null +++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-variable-index-implicit-size-local.vert @@ -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]; +} -- 1.7.10.4 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
