[Piglit] [PATCH] Add tests of whole-array assignment and out/inout params.

Ian Romanick idr at freedesktop.org
Tue Sep 13 08:23:01 PDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/12/2011 06:12 PM, Paul Berry wrote:
> In GLSL 1.10, whole arrays are not lvalues (even though their
> elements are).  This means it is illegal to use an array on the
> left hand side of an assigment, or to use it as an out or inout
> parameter of a function.
> 
> In GLSL 1.20 and later versions, an array is a proper lvalue, so
> all of these uses are allowed.
> 
> This patch adds tests to verify that all the above usages are 
> prohibited in GLSL 1.10 and allowed in GLSL 1.20.  In addition it 
> verifies that in GLSL 1.20, a built-in array may be used as an
> lvalue (since this currently exercises a different code path in
> Mesa).

There are a few comments below.

Since the GLSL ES 1.00 behavior is different from both GLSL 1.10 and
GLSL 1.20, we should have tests for that as well.

> --- .../assign-array-prohibited.frag                   |   19
> ++++++++++++++++ .../assign-array-prohibited.vert
> |   19 ++++++++++++++++ .../fn-inout-array-prohibited-cstyle.frag
> |   21 ++++++++++++++++++ .../fn-inout-array-prohibited-cstyle.vert
> |   21 ++++++++++++++++++ 
> .../qualifiers/fn-inout-array-prohibited.frag      |   21
> ++++++++++++++++++ .../qualifiers/fn-inout-array-prohibited.vert
> |   21 ++++++++++++++++++ 
> .../qualifiers/fn-out-array-prohibited-cstyle.frag |   21
> ++++++++++++++++++ 
> .../qualifiers/fn-out-array-prohibited-cstyle.vert |   21
> ++++++++++++++++++ .../qualifiers/fn-out-array-prohibited.frag
> |   21 ++++++++++++++++++ 
> .../qualifiers/fn-out-array-prohibited.vert        |   21
> ++++++++++++++++++ 
> .../assignment-operators/assign-array-allowed.frag |   21
> ++++++++++++++++++ 
> .../assignment-operators/assign-array-allowed.vert |   21
> ++++++++++++++++++ .../assign-builtin-array-allowed.vert
> |   21 ++++++++++++++++++ 
> .../qualifiers/fn-inout-array-allowed-cstyle.frag  |   23
> ++++++++++++++++++++ 
> .../qualifiers/fn-inout-array-allowed-cstyle.vert  |   23
> ++++++++++++++++++++ .../qualifiers/fn-inout-array-allowed.frag
> |   23 ++++++++++++++++++++ 
> .../qualifiers/fn-inout-array-allowed.vert         |   23
> ++++++++++++++++++++ 
> .../qualifiers/fn-out-array-allowed-cstyle.frag    |   23
> ++++++++++++++++++++ 
> .../qualifiers/fn-out-array-allowed-cstyle.vert    |   23
> ++++++++++++++++++++ 
> .../compiler/qualifiers/fn-out-array-allowed.frag  |   23
> ++++++++++++++++++++ 
> .../compiler/qualifiers/fn-out-array-allowed.vert  |   23
> ++++++++++++++++++++ 21 files changed, 453 insertions(+), 0
> deletions(-) create mode 100644
> tests/spec/glsl-1.10/compiler/assignment-operators/assign-array-prohibited.frag
>
> 
create mode 100644
tests/spec/glsl-1.10/compiler/assignment-operators/assign-array-prohibited.vert
> create mode 100644
> tests/spec/glsl-1.10/compiler/qualifiers/fn-inout-array-prohibited-cstyle.frag
>
> 
create mode 100644
tests/spec/glsl-1.10/compiler/qualifiers/fn-inout-array-prohibited-cstyle.vert
> create mode 100644
> tests/spec/glsl-1.10/compiler/qualifiers/fn-inout-array-prohibited.frag
>
> 
create mode 100644
tests/spec/glsl-1.10/compiler/qualifiers/fn-inout-array-prohibited.vert
> create mode 100644
> tests/spec/glsl-1.10/compiler/qualifiers/fn-out-array-prohibited-cstyle.frag
>
> 
create mode 100644
tests/spec/glsl-1.10/compiler/qualifiers/fn-out-array-prohibited-cstyle.vert
> create mode 100644
> tests/spec/glsl-1.10/compiler/qualifiers/fn-out-array-prohibited.frag
>
> 
create mode 100644
tests/spec/glsl-1.10/compiler/qualifiers/fn-out-array-prohibited.vert
> create mode 100644
> tests/spec/glsl-1.20/compiler/assignment-operators/assign-array-allowed.frag
>
> 
create mode 100644
tests/spec/glsl-1.20/compiler/assignment-operators/assign-array-allowed.vert
> create mode 100644
> tests/spec/glsl-1.20/compiler/assignment-operators/assign-builtin-array-allowed.vert
>
> 
create mode 100644
tests/spec/glsl-1.20/compiler/qualifiers/fn-inout-array-allowed-cstyle.frag
> create mode 100644
> tests/spec/glsl-1.20/compiler/qualifiers/fn-inout-array-allowed-cstyle.vert
>
> 
create mode 100644
tests/spec/glsl-1.20/compiler/qualifiers/fn-inout-array-allowed.frag
> create mode 100644
> tests/spec/glsl-1.20/compiler/qualifiers/fn-inout-array-allowed.vert
>
> 
create mode 100644
tests/spec/glsl-1.20/compiler/qualifiers/fn-out-array-allowed-cstyle.frag
> create mode 100644
> tests/spec/glsl-1.20/compiler/qualifiers/fn-out-array-allowed-cstyle.vert
>
> 
create mode 100644
tests/spec/glsl-1.20/compiler/qualifiers/fn-out-array-allowed.frag
> create mode 100644
> tests/spec/glsl-1.20/compiler/qualifiers/fn-out-array-allowed.vert
> 
> diff --git
> a/tests/spec/glsl-1.10/compiler/assignment-operators/assign-array-prohibited.frag
> b/tests/spec/glsl-1.10/compiler/assignment-operators/assign-array-prohibited.frag
>
> 
new file mode 100644
> index 0000000..086b574 --- /dev/null +++
> b/tests/spec/glsl-1.10/compiler/assignment-operators/assign-array-prohibited.frag
>
> 
@@ -0,0 +1,19 @@
> +// [config] +// expect_result: fail +// glsl_version: 1.10 +//
> [end config] +// +// Check that assignment to an array is illegal
> in GLSL 1.10. +// +// From section 5.8 of the GLSL 1.10 spec: +//
> Other binary or unary expressions, non-dereferenced arrays, +//
> function names, swizzles with repeated fields, and constants +//
> cannot be l-values. + +#version 110 + +void f(float[2] x)

This array declaration syntax is not legal in GLSL 1.10.  It was added
in GLSL 1.20.

> +{ +  float[2] y; +  y = x; +} diff --git
> a/tests/spec/glsl-1.10/compiler/assignment-operators/assign-array-prohibited.vert
> b/tests/spec/glsl-1.10/compiler/assignment-operators/assign-array-prohibited.vert
>
> 
new file mode 100644
> index 0000000..086b574 --- /dev/null +++
> b/tests/spec/glsl-1.10/compiler/assignment-operators/assign-array-prohibited.vert
>
> 
@@ -0,0 +1,19 @@
> +// [config] +// expect_result: fail +// glsl_version: 1.10 +//
> [end config] +// +// Check that assignment to an array is illegal
> in GLSL 1.10. +// +// From section 5.8 of the GLSL 1.10 spec: +//
> Other binary or unary expressions, non-dereferenced arrays, +//
> function names, swizzles with repeated fields, and constants +//
> cannot be l-values. + +#version 110 + +void f(float[2] x) +{ +
> float[2] y; +  y = x; +} diff --git
> a/tests/spec/glsl-1.10/compiler/qualifiers/fn-inout-array-prohibited-cstyle.frag
> b/tests/spec/glsl-1.10/compiler/qualifiers/fn-inout-array-prohibited-cstyle.frag
>
> 
new file mode 100644
> index 0000000..a56d197 --- /dev/null +++
> b/tests/spec/glsl-1.10/compiler/qualifiers/fn-inout-array-prohibited-cstyle.frag
>
> 
@@ -0,0 +1,21 @@
> +// [config] +// expect_result: fail +// glsl_version: 1.10 +//
> [end config] +// +// Check that an array can't be used as a
> function inout parameter in +// GLSL 1.10. +// +// In this test,
> the array is declared using C-style array +// declaration syntax
> (float x[2] as opposed to float[2] x). +// +// From section 5.8 of
> the GLSL 1.10 spec: +//     Other binary or unary expressions,
> non-dereferenced arrays, +//     function names, swizzles with
> repeated fields, and constants +//     cannot be l-values. + 
> +#version 110 + +void f(inout float x[2]) +{ +} diff --git
> a/tests/spec/glsl-1.10/compiler/qualifiers/fn-inout-array-prohibited-cstyle.vert
> b/tests/spec/glsl-1.10/compiler/qualifiers/fn-inout-array-prohibited-cstyle.vert
>
> 
new file mode 100644
> index 0000000..a56d197 --- /dev/null +++
> b/tests/spec/glsl-1.10/compiler/qualifiers/fn-inout-array-prohibited-cstyle.vert
>
> 
@@ -0,0 +1,21 @@
> +// [config] +// expect_result: fail +// glsl_version: 1.10 +//
> [end config] +// +// Check that an array can't be used as a
> function inout parameter in +// GLSL 1.10. +// +// In this test,
> the array is declared using C-style array +// declaration syntax
> (float x[2] as opposed to float[2] x). +// +// From section 5.8 of
> the GLSL 1.10 spec: +//     Other binary or unary expressions,
> non-dereferenced arrays, +//     function names, swizzles with
> repeated fields, and constants +//     cannot be l-values. + 
> +#version 110 + +void f(inout float x[2]) +{ +} diff --git
> a/tests/spec/glsl-1.10/compiler/qualifiers/fn-inout-array-prohibited.frag
> b/tests/spec/glsl-1.10/compiler/qualifiers/fn-inout-array-prohibited.frag
>
> 
new file mode 100644
> index 0000000..a2836e2 --- /dev/null +++
> b/tests/spec/glsl-1.10/compiler/qualifiers/fn-inout-array-prohibited.frag
>
> 
@@ -0,0 +1,21 @@
> +// [config] +// expect_result: fail +// glsl_version: 1.10 +//
> [end config] +// +// Check that an array can't be used as a
> function inout parameter in +// GLSL 1.10. +// +// In this test,
> the array is declared using GLSL-style array +// declaration syntax
> (float[2] x as opposed to float x[2]). +// +// From section 5.8 of
> the GLSL 1.10 spec: +//     Other binary or unary expressions,
> non-dereferenced arrays, +//     function names, swizzles with
> repeated fields, and constants +//     cannot be l-values. + 
> +#version 110 + +void f(inout float[2] x) +{ +} diff --git
> a/tests/spec/glsl-1.10/compiler/qualifiers/fn-inout-array-prohibited.vert
> b/tests/spec/glsl-1.10/compiler/qualifiers/fn-inout-array-prohibited.vert
>
> 
new file mode 100644
> index 0000000..a2836e2 --- /dev/null +++
> b/tests/spec/glsl-1.10/compiler/qualifiers/fn-inout-array-prohibited.vert
>
> 
@@ -0,0 +1,21 @@
> +// [config] +// expect_result: fail +// glsl_version: 1.10 +//
> [end config] +// +// Check that an array can't be used as a
> function inout parameter in +// GLSL 1.10. +// +// In this test,
> the array is declared using GLSL-style array +// declaration syntax
> (float[2] x as opposed to float x[2]). +// +// From section 5.8 of
> the GLSL 1.10 spec: +//     Other binary or unary expressions,
> non-dereferenced arrays, +//     function names, swizzles with
> repeated fields, and constants +//     cannot be l-values. + 
> +#version 110 + +void f(inout float[2] x) +{ +} diff --git
> a/tests/spec/glsl-1.10/compiler/qualifiers/fn-out-array-prohibited-cstyle.frag
> b/tests/spec/glsl-1.10/compiler/qualifiers/fn-out-array-prohibited-cstyle.frag
>
> 
new file mode 100644
> index 0000000..d9a8f8a --- /dev/null +++
> b/tests/spec/glsl-1.10/compiler/qualifiers/fn-out-array-prohibited-cstyle.frag
>
> 
@@ -0,0 +1,21 @@
> +// [config] +// expect_result: fail +// glsl_version: 1.10 +//
> [end config] +// +// Check that an array can't be used as a
> function out parameter in +// GLSL 1.10. +// +// In this test, the
> array is declared using C-style array +// declaration syntax (float
> x[2] as opposed to float[2] x). +// +// From section 5.8 of the
> GLSL 1.10 spec: +//     Other binary or unary expressions,
> non-dereferenced arrays, +//     function names, swizzles with
> repeated fields, and constants +//     cannot be l-values. + 
> +#version 110 + +void f(out float x[2]) +{ +} diff --git
> a/tests/spec/glsl-1.10/compiler/qualifiers/fn-out-array-prohibited-cstyle.vert
> b/tests/spec/glsl-1.10/compiler/qualifiers/fn-out-array-prohibited-cstyle.vert
>
> 
new file mode 100644
> index 0000000..d9a8f8a --- /dev/null +++
> b/tests/spec/glsl-1.10/compiler/qualifiers/fn-out-array-prohibited-cstyle.vert
>
> 
@@ -0,0 +1,21 @@
> +// [config] +// expect_result: fail +// glsl_version: 1.10 +//
> [end config] +// +// Check that an array can't be used as a
> function out parameter in +// GLSL 1.10. +// +// In this test, the
> array is declared using C-style array +// declaration syntax (float
> x[2] as opposed to float[2] x). +// +// From section 5.8 of the
> GLSL 1.10 spec: +//     Other binary or unary expressions,
> non-dereferenced arrays, +//     function names, swizzles with
> repeated fields, and constants +//     cannot be l-values. + 
> +#version 110 + +void f(out float x[2]) +{ +} diff --git
> a/tests/spec/glsl-1.10/compiler/qualifiers/fn-out-array-prohibited.frag
> b/tests/spec/glsl-1.10/compiler/qualifiers/fn-out-array-prohibited.frag
>
> 
new file mode 100644
> index 0000000..43cb43e --- /dev/null +++
> b/tests/spec/glsl-1.10/compiler/qualifiers/fn-out-array-prohibited.frag
>
> 
@@ -0,0 +1,21 @@
> +// [config] +// expect_result: fail +// glsl_version: 1.10 +//
> [end config] +// +// Check that an array can't be used as a
> function out parameter in +// GLSL 1.10. +// +// In this test, the
> array is declared using GLSL-style array +// declaration syntax
> (float[2] x as opposed to float x[2]). +// +// From section 5.8 of
> the GLSL 1.10 spec: +//     Other binary or unary expressions,
> non-dereferenced arrays, +//     function names, swizzles with
> repeated fields, and constants +//     cannot be l-values. + 
> +#version 110 + +void f(out float[2] x) +{ +} diff --git
> a/tests/spec/glsl-1.10/compiler/qualifiers/fn-out-array-prohibited.vert
> b/tests/spec/glsl-1.10/compiler/qualifiers/fn-out-array-prohibited.vert
>
> 
new file mode 100644
> index 0000000..43cb43e --- /dev/null +++
> b/tests/spec/glsl-1.10/compiler/qualifiers/fn-out-array-prohibited.vert
>
> 
@@ -0,0 +1,21 @@
> +// [config] +// expect_result: fail +// glsl_version: 1.10 +//
> [end config] +// +// Check that an array can't be used as a
> function out parameter in +// GLSL 1.10. +// +// In this test, the
> array is declared using GLSL-style array +// declaration syntax
> (float[2] x as opposed to float x[2]). +// +// From section 5.8 of
> the GLSL 1.10 spec: +//     Other binary or unary expressions,
> non-dereferenced arrays, +//     function names, swizzles with
> repeated fields, and constants +//     cannot be l-values. + 
> +#version 110 + +void f(out float[2] x) +{ +} diff --git
> a/tests/spec/glsl-1.20/compiler/assignment-operators/assign-array-allowed.frag
> b/tests/spec/glsl-1.20/compiler/assignment-operators/assign-array-allowed.frag
>
> 
new file mode 100644
> index 0000000..7b65d4b --- /dev/null +++
> b/tests/spec/glsl-1.20/compiler/assignment-operators/assign-array-allowed.frag
>
> 
@@ -0,0 +1,21 @@
> +// [config] +// expect_result: pass +// glsl_version: 1.20 +//
> [end config] +// +// Check that assignment to an array is allowed
> in GLSL 1.20. +// +// From section 5.8 of the GLSL 1.20 spec: +//
> Variables that are built-in types, entire structures or arrays, +//
> structure fields, l-values with the field selector ( . ) +//
> applied to select components or swizzles without repeated +//
> fields, l-values within parentheses, and l-values dereferenced +//
> with the array subscript operator ( [] ) are all l-values. + 
> +#version 120 + +void f(float[2] x) +{ +  float[2] y; +  y = x; +} 
> diff --git
> a/tests/spec/glsl-1.20/compiler/assignment-operators/assign-array-allowed.vert
> b/tests/spec/glsl-1.20/compiler/assignment-operators/assign-array-allowed.vert
>
> 
new file mode 100644
> index 0000000..7b65d4b --- /dev/null +++
> b/tests/spec/glsl-1.20/compiler/assignment-operators/assign-array-allowed.vert
>
> 
@@ -0,0 +1,21 @@
> +// [config] +// expect_result: pass +// glsl_version: 1.20 +//
> [end config] +// +// Check that assignment to an array is allowed
> in GLSL 1.20. +// +// From section 5.8 of the GLSL 1.20 spec: +//
> Variables that are built-in types, entire structures or arrays, +//
> structure fields, l-values with the field selector ( . ) +//
> applied to select components or swizzles without repeated +//
> fields, l-values within parentheses, and l-values dereferenced +//
> with the array subscript operator ( [] ) are all l-values. + 
> +#version 120 + +void f(float[2] x) +{ +  float[2] y; +  y = x; +} 
> diff --git
> a/tests/spec/glsl-1.20/compiler/assignment-operators/assign-builtin-array-allowed.vert
> b/tests/spec/glsl-1.20/compiler/assignment-operators/assign-builtin-array-allowed.vert
>
> 
new file mode 100644
> index 0000000..0daf6e0 --- /dev/null +++
> b/tests/spec/glsl-1.20/compiler/assignment-operators/assign-builtin-array-allowed.vert
>
> 
@@ -0,0 +1,21 @@
> +// [config] +// expect_result: pass +// glsl_version: 1.20 +//
> [end config] +// +// Check that bulk assignment to a built-in array
> is allowed in GLSL 1.20. +// +// From section 5.8 of the GLSL 1.20
> spec: +//     Variables that are built-in types, entire structures
> or arrays, +//     structure fields, l-values with the field
> selector ( . ) +//     applied to select components or swizzles
> without repeated +//     fields, l-values within parentheses, and
> l-values dereferenced +//     with the array subscript operator (
> [] ) are all l-values. + +#version 120 +varying vec4
> gl_TexCoord[gl_MaxTextureCoords]; + +void
> f(vec4[gl_MaxTextureCoords] x) +{ +  gl_TexCoord = x; +}

glslparsertest tests that are expected to pass should also be
linkable.  That means they should have a main function and should
write  gl_Position in the vertex shader.

> diff --git
> a/tests/spec/glsl-1.20/compiler/qualifiers/fn-inout-array-allowed-cstyle.frag
> b/tests/spec/glsl-1.20/compiler/qualifiers/fn-inout-array-allowed-cstyle.frag
>
> 
new file mode 100644
> index 0000000..aebc81a --- /dev/null +++
> b/tests/spec/glsl-1.20/compiler/qualifiers/fn-inout-array-allowed-cstyle.frag
>
> 
@@ -0,0 +1,23 @@
> +// [config] +// expect_result: pass +// glsl_version: 1.20 +//
> [end config] +// +// Check that an array can be used as a function
> inout parameter in +// GLSL 1.20. +// +// In this test, the array
> is declared using C-style array +// declaration syntax (float x[2]
> as opposed to float[2] x). +// +// From section 5.8 of the GLSL
> 1.20 spec: +//     Variables that are built-in types, entire
> structures or arrays, +//     structure fields, l-values with the
> field selector ( . ) +//     applied to select components or
> swizzles without repeated +//     fields, l-values within
> parentheses, and l-values dereferenced +//     with the array
> subscript operator ( [] ) are all l-values. + +#version 120 + +void
> f(inout float x[2]) +{ +} diff --git
> a/tests/spec/glsl-1.20/compiler/qualifiers/fn-inout-array-allowed-cstyle.vert
> b/tests/spec/glsl-1.20/compiler/qualifiers/fn-inout-array-allowed-cstyle.vert
>
> 
new file mode 100644
> index 0000000..aebc81a --- /dev/null +++
> b/tests/spec/glsl-1.20/compiler/qualifiers/fn-inout-array-allowed-cstyle.vert
>
> 
@@ -0,0 +1,23 @@
> +// [config] +// expect_result: pass +// glsl_version: 1.20 +//
> [end config] +// +// Check that an array can be used as a function
> inout parameter in +// GLSL 1.20. +// +// In this test, the array
> is declared using C-style array +// declaration syntax (float x[2]
> as opposed to float[2] x). +// +// From section 5.8 of the GLSL
> 1.20 spec: +//     Variables that are built-in types, entire
> structures or arrays, +//     structure fields, l-values with the
> field selector ( . ) +//     applied to select components or
> swizzles without repeated +//     fields, l-values within
> parentheses, and l-values dereferenced +//     with the array
> subscript operator ( [] ) are all l-values. + +#version 120 + +void
> f(inout float x[2]) +{ +} diff --git
> a/tests/spec/glsl-1.20/compiler/qualifiers/fn-inout-array-allowed.frag
> b/tests/spec/glsl-1.20/compiler/qualifiers/fn-inout-array-allowed.frag
>
> 
new file mode 100644
> index 0000000..0d4b8c0 --- /dev/null +++
> b/tests/spec/glsl-1.20/compiler/qualifiers/fn-inout-array-allowed.frag
>
> 
@@ -0,0 +1,23 @@
> +// [config] +// expect_result: pass +// glsl_version: 1.20 +//
> [end config] +// +// Check that an array can be used as a function
> inout parameter in +// GLSL 1.20. +// +// In this test, the array
> is declared using GLSL-style array +// declaration syntax (float[2]
> x as opposed to float x[2]). +// +// From section 5.8 of the GLSL
> 1.20 spec: +//     Variables that are built-in types, entire
> structures or arrays, +//     structure fields, l-values with the
> field selector ( . ) +//     applied to select components or
> swizzles without repeated +//     fields, l-values within
> parentheses, and l-values dereferenced +//     with the array
> subscript operator ( [] ) are all l-values. + +#version 120 + +void
> f(inout float[2] x) +{ +} diff --git
> a/tests/spec/glsl-1.20/compiler/qualifiers/fn-inout-array-allowed.vert
> b/tests/spec/glsl-1.20/compiler/qualifiers/fn-inout-array-allowed.vert
>
> 
new file mode 100644
> index 0000000..0d4b8c0 --- /dev/null +++
> b/tests/spec/glsl-1.20/compiler/qualifiers/fn-inout-array-allowed.vert
>
> 
@@ -0,0 +1,23 @@
> +// [config] +// expect_result: pass +// glsl_version: 1.20 +//
> [end config] +// +// Check that an array can be used as a function
> inout parameter in +// GLSL 1.20. +// +// In this test, the array
> is declared using GLSL-style array +// declaration syntax (float[2]
> x as opposed to float x[2]). +// +// From section 5.8 of the GLSL
> 1.20 spec: +//     Variables that are built-in types, entire
> structures or arrays, +//     structure fields, l-values with the
> field selector ( . ) +//     applied to select components or
> swizzles without repeated +//     fields, l-values within
> parentheses, and l-values dereferenced +//     with the array
> subscript operator ( [] ) are all l-values. + +#version 120 + +void
> f(inout float[2] x) +{ +} diff --git
> a/tests/spec/glsl-1.20/compiler/qualifiers/fn-out-array-allowed-cstyle.frag
> b/tests/spec/glsl-1.20/compiler/qualifiers/fn-out-array-allowed-cstyle.frag
>
> 
new file mode 100644
> index 0000000..d3792a4 --- /dev/null +++
> b/tests/spec/glsl-1.20/compiler/qualifiers/fn-out-array-allowed-cstyle.frag
>
> 
@@ -0,0 +1,23 @@
> +// [config] +// expect_result: pass +// glsl_version: 1.20 +//
> [end config] +// +// Check that an array can be used as a function
> out parameter in +// GLSL 1.20. +// +// In this test, the array is
> declared using C-style array +// declaration syntax (float x[2] as
> opposed to float[2] x). +// +// From section 5.8 of the GLSL 1.20
> spec: +//     Variables that are built-in types, entire structures
> or arrays, +//     structure fields, l-values with the field
> selector ( . ) +//     applied to select components or swizzles
> without repeated +//     fields, l-values within parentheses, and
> l-values dereferenced +//     with the array subscript operator (
> [] ) are all l-values. + +#version 120 + +void f(out float x[2]) 
> +{ +} diff --git
> a/tests/spec/glsl-1.20/compiler/qualifiers/fn-out-array-allowed-cstyle.vert
> b/tests/spec/glsl-1.20/compiler/qualifiers/fn-out-array-allowed-cstyle.vert
>
> 
new file mode 100644
> index 0000000..d3792a4 --- /dev/null +++
> b/tests/spec/glsl-1.20/compiler/qualifiers/fn-out-array-allowed-cstyle.vert
>
> 
@@ -0,0 +1,23 @@
> +// [config] +// expect_result: pass +// glsl_version: 1.20 +//
> [end config] +// +// Check that an array can be used as a function
> out parameter in +// GLSL 1.20. +// +// In this test, the array is
> declared using C-style array +// declaration syntax (float x[2] as
> opposed to float[2] x). +// +// From section 5.8 of the GLSL 1.20
> spec: +//     Variables that are built-in types, entire structures
> or arrays, +//     structure fields, l-values with the field
> selector ( . ) +//     applied to select components or swizzles
> without repeated +//     fields, l-values within parentheses, and
> l-values dereferenced +//     with the array subscript operator (
> [] ) are all l-values. + +#version 120 + +void f(out float x[2]) 
> +{ +} diff --git
> a/tests/spec/glsl-1.20/compiler/qualifiers/fn-out-array-allowed.frag
> b/tests/spec/glsl-1.20/compiler/qualifiers/fn-out-array-allowed.frag
>
> 
new file mode 100644
> index 0000000..9351ba9 --- /dev/null +++
> b/tests/spec/glsl-1.20/compiler/qualifiers/fn-out-array-allowed.frag
>
> 
@@ -0,0 +1,23 @@
> +// [config] +// expect_result: pass +// glsl_version: 1.20 +//
> [end config] +// +// Check that an array can be used as a function
> out parameter in +// GLSL 1.20. +// +// In this test, the array is
> declared using GLSL-style array +// declaration syntax (float[2] x
> as opposed to float x[2]). +// +// From section 5.8 of the GLSL
> 1.20 spec: +//     Variables that are built-in types, entire
> structures or arrays, +//     structure fields, l-values with the
> field selector ( . ) +//     applied to select components or
> swizzles without repeated +//     fields, l-values within
> parentheses, and l-values dereferenced +//     with the array
> subscript operator ( [] ) are all l-values. + +#version 120 + +void
> f(out float[2] x) +{ +} diff --git
> a/tests/spec/glsl-1.20/compiler/qualifiers/fn-out-array-allowed.vert
> b/tests/spec/glsl-1.20/compiler/qualifiers/fn-out-array-allowed.vert
>
> 
new file mode 100644
> index 0000000..9351ba9 --- /dev/null +++
> b/tests/spec/glsl-1.20/compiler/qualifiers/fn-out-array-allowed.vert
>
> 
@@ -0,0 +1,23 @@
> +// [config] +// expect_result: pass +// glsl_version: 1.20 +//
> [end config] +// +// Check that an array can be used as a function
> out parameter in +// GLSL 1.20. +// +// In this test, the array is
> declared using GLSL-style array +// declaration syntax (float[2] x
> as opposed to float x[2]). +// +// From section 5.8 of the GLSL
> 1.20 spec: +//     Variables that are built-in types, entire
> structures or arrays, +//     structure fields, l-values with the
> field selector ( . ) +//     applied to select components or
> swizzles without repeated +//     fields, l-values within
> parentheses, and l-values dereferenced +//     with the array
> subscript operator ( [] ) are all l-values. + +#version 120 + +void
> f(out float[2] x) +{ +}
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5vdVUACgkQX1gOwKyEAw87GgCfW6ad15EAq0IOmds7kBV5aHOR
6poAoIcEvQmzabIjDKm32OzRLnvKlOkW
=AmSj
-----END PGP SIGNATURE-----


More information about the Piglit mailing list