[Piglit] [PATCH V2 2/9] tests/spec: ARB_arrays_of_arrays function parameter and comparision tests

Ian Romanick idr at freedesktop.org
Thu Jan 16 10:01:16 PST 2014


On 01/14/2014 12:20 AM, Timothy Arceri wrote:
> ---
>  .../compiler/equal-implicit-size.vert              |   28 ++++++++++++++++++++
>  .../compiler/equal-mismatched-size.vert            |   23 ++++++++++++++++
>  .../spec/arb_arrays_of_arrays/compiler/equal.vert  |   23 ++++++++++++++++
>  ...tion-parameter-declaration-array-array-var.vert |   19 +++++++++++++
>  ...tion-parameter-declaration-array-var-array.vert |   19 +++++++++++++
>  ...tion-parameter-declaration-var-array-array.vert |   19 +++++++++++++
>  ...ction-parameter-definition-array-array-var.vert |   22 +++++++++++++++
>  ...ction-parameter-definition-array-var-array.vert |   22 +++++++++++++++
>  ...ction-parameter-definition-var-array-array.vert |   22 +++++++++++++++
>  .../compiler/function-parameter-unsized.vert       |   22 +++++++++++++++
>  10 files changed, 219 insertions(+)
>  create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/equal-implicit-size.vert
>  create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/equal-mismatched-size.vert
>  create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/equal.vert
>  create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/function-parameter-declaration-array-array-var.vert
>  create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/function-parameter-declaration-array-var-array.vert
>  create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/function-parameter-declaration-var-array-array.vert
>  create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/function-parameter-definition-array-array-var.vert
>  create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/function-parameter-definition-array-var-array.vert
>  create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/function-parameter-definition-var-array-array.vert
>  create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/function-parameter-unsized.vert
> 
> diff --git a/tests/spec/arb_arrays_of_arrays/compiler/equal-implicit-size.vert b/tests/spec/arb_arrays_of_arrays/compiler/equal-implicit-size.vert
> new file mode 100644
> index 0000000..9559a63
> --- /dev/null
> +++ b/tests/spec/arb_arrays_of_arrays/compiler/equal-implicit-size.vert
> @@ -0,0 +1,28 @@
> +/* [config]
> + * expect_result: fail
> + * glsl_version: 1.20
> + * require_extensions: GL_ARB_arrays_of_arrays
> + * [end config]
> + *
> + * From page 35 (page 41 of the PDF) of the GLSL 1.20 spec:
> + *
> + *     "The equality operators and assignment operator are only allowed if the
> + *     two operands are same size and type....Both array operands must be
> + *     explicitly sized. When using the equality operators ... two arrays are
> + *     equal if and only if all the elements are element-wise equal.
> + */
> +#version 120
> +#extension GL_ARB_arrays_of_arrays: enable
> +
> +uniform vec4 a[2][3];
> +
> +void main()
> +{
> +  vec4 b[][3];
> +
> +  // Implicitly size b to match a.
> +  b[0][2] = vec4(1.0);
> +  b[1][2] = vec4(1.0);
> +
> +  gl_Position = vec4(a == b);
> +}
> diff --git a/tests/spec/arb_arrays_of_arrays/compiler/equal-mismatched-size.vert b/tests/spec/arb_arrays_of_arrays/compiler/equal-mismatched-size.vert
> new file mode 100644
> index 0000000..52591cc
> --- /dev/null
> +++ b/tests/spec/arb_arrays_of_arrays/compiler/equal-mismatched-size.vert
> @@ -0,0 +1,23 @@
> +/* [config]
> + * expect_result: fail
> + * glsl_version: 1.20
> + * require_extensions: GL_ARB_arrays_of_arrays
> + * [end config]
> + *
> + * From page 35 (page 41 of the PDF) of the GLSL 1.20 spec:
> + *
> + *     "The equality operators and assignment operator are only allowed if the
> + *     two operands are same size and type....Both array operands must be
> + *     explicitly sized. When using the equality operators ... two arrays are
> + *     equal if and only if all the elements are element-wise equal.
> + */
> +#version 120
> +#extension GL_ARB_arrays_of_arrays: enable
> +
> +uniform vec4 a[2][3];
> +uniform vec4 b[3][2]; // Note the differing size
> +
> +void main()
> +{
> +  gl_Position = vec4(a == b);
> +}
> diff --git a/tests/spec/arb_arrays_of_arrays/compiler/equal.vert b/tests/spec/arb_arrays_of_arrays/compiler/equal.vert
> new file mode 100644
> index 0000000..381bb7d
> --- /dev/null
> +++ b/tests/spec/arb_arrays_of_arrays/compiler/equal.vert
> @@ -0,0 +1,23 @@
> +/* [config]
> + * expect_result: pass
> + * glsl_version: 1.20
> + * require_extensions: GL_ARB_arrays_of_arrays
> + * [end config]
> + *
> + * From page 35 (page 41 of the PDF) of the GLSL 1.20 spec:
> + *
> + *     "The equality operators and assignment operator are only allowed if the
> + *     two operands are same size and type....Both array operands must be
> + *     explicitly sized. When using the equality operators ... two arrays are
> + *     equal if and only if all the elements are element-wise equal.
> + */
> +#version 120
> +#extension GL_ARB_arrays_of_arrays: enable
> +
> +uniform vec4 a[2][3];
> +uniform vec4 b[2][3]; // Note the differing size

                         // Note the same size :)


Also, for the pass cases, I'd like to have checks for multiple ways of
declaring the variables.  So, maybe add

uniform vec4 [2] c[3];

and

> +
> +void main()
> +{
> +  gl_Position = vec4(a == b);

  gl_Position = vec4(float(a == b), float(b == c), 0, 1);

or something like that.

> +}
> diff --git a/tests/spec/arb_arrays_of_arrays/compiler/function-parameter-declaration-array-array-var.vert b/tests/spec/arb_arrays_of_arrays/compiler/function-parameter-declaration-array-array-var.vert
> new file mode 100644
> index 0000000..8c83f69
> --- /dev/null
> +++ b/tests/spec/arb_arrays_of_arrays/compiler/function-parameter-declaration-array-array-var.vert
> @@ -0,0 +1,19 @@
> +/* [config]
> + * expect_result: pass
> + * glsl_version: 1.20
> + * require_extensions: GL_ARB_arrays_of_arrays
> + * [end config]
> + */
> +#version 120
> +#extension GL_ARB_arrays_of_arrays: enable
> +
> +attribute vec4 vert;
> +
> +void foo(vec4[3][2] x);
> +
> +void main()
> +{
> +  vec4 y[3][2];
> +  foo(y);
> +  gl_Position = vert;
> +}
> diff --git a/tests/spec/arb_arrays_of_arrays/compiler/function-parameter-declaration-array-var-array.vert b/tests/spec/arb_arrays_of_arrays/compiler/function-parameter-declaration-array-var-array.vert
> new file mode 100644
> index 0000000..b003ed5
> --- /dev/null
> +++ b/tests/spec/arb_arrays_of_arrays/compiler/function-parameter-declaration-array-var-array.vert
> @@ -0,0 +1,19 @@
> +/* [config]
> + * expect_result: pass
> + * glsl_version: 1.20
> + * require_extensions: GL_ARB_arrays_of_arrays
> + * [end config]
> + */
> +#version 120
> +#extension GL_ARB_arrays_of_arrays: enable
> +
> +attribute vec4 vert;
> +
> +void foo(vec4 [2] x[4]);
> +
> +void main()
> +{
> +  vec4 y[4][2];
> +  foo(y);
> +  gl_Position = vert;
> +}
> diff --git a/tests/spec/arb_arrays_of_arrays/compiler/function-parameter-declaration-var-array-array.vert b/tests/spec/arb_arrays_of_arrays/compiler/function-parameter-declaration-var-array-array.vert
> new file mode 100644
> index 0000000..088a9cc
> --- /dev/null
> +++ b/tests/spec/arb_arrays_of_arrays/compiler/function-parameter-declaration-var-array-array.vert
> @@ -0,0 +1,19 @@
> +/* [config]
> + * expect_result: pass
> + * glsl_version: 1.20
> + * require_extensions: GL_ARB_arrays_of_arrays
> + * [end config]
> + */
> +#version 120
> +#extension GL_ARB_arrays_of_arrays: enable
> +
> +attribute vec4 vert;
> +
> +void foo(vec4 x[2][3]);
> +
> +void main()
> +{
> +  vec4 y[2][3];
> +  foo(y);
> +  gl_Position = vert;
> +}
> diff --git a/tests/spec/arb_arrays_of_arrays/compiler/function-parameter-definition-array-array-var.vert b/tests/spec/arb_arrays_of_arrays/compiler/function-parameter-definition-array-array-var.vert
> new file mode 100644
> index 0000000..12043db
> --- /dev/null
> +++ b/tests/spec/arb_arrays_of_arrays/compiler/function-parameter-definition-array-array-var.vert
> @@ -0,0 +1,22 @@
> +/* [config]
> + * expect_result: pass
> + * glsl_version: 1.20
> + * require_extensions: GL_ARB_arrays_of_arrays
> + * [end config]
> + */
> +#version 120
> +#extension GL_ARB_arrays_of_arrays: enable
> +
> +attribute vec4 vert;
> +
> +void foo(vec4[3][2] x)
> +{
> +  gl_Position = vert;
> +}
> +
> +void main()
> +{
> +  vec4 y[3][2];
> +  foo(y);
> +  gl_Position = vert;
> +}
> diff --git a/tests/spec/arb_arrays_of_arrays/compiler/function-parameter-definition-array-var-array.vert b/tests/spec/arb_arrays_of_arrays/compiler/function-parameter-definition-array-var-array.vert
> new file mode 100644
> index 0000000..63cf860
> --- /dev/null
> +++ b/tests/spec/arb_arrays_of_arrays/compiler/function-parameter-definition-array-var-array.vert
> @@ -0,0 +1,22 @@
> +/* [config]
> + * expect_result: pass
> + * glsl_version: 1.20
> + * require_extensions: GL_ARB_arrays_of_arrays
> + * [end config]
> + */
> +#version 120
> +#extension GL_ARB_arrays_of_arrays: enable
> +
> +attribute vec4 vert;
> +
> +void foo(vec4 [2] x[2])
> +{
> +  gl_Position = vert;
> +}
> +
> +void main()
> +{
> +  vec4 y[2][2];
> +  foo(y);
> +  gl_Position = vert;
> +}
> diff --git a/tests/spec/arb_arrays_of_arrays/compiler/function-parameter-definition-var-array-array.vert b/tests/spec/arb_arrays_of_arrays/compiler/function-parameter-definition-var-array-array.vert
> new file mode 100644
> index 0000000..f8ba53b
> --- /dev/null
> +++ b/tests/spec/arb_arrays_of_arrays/compiler/function-parameter-definition-var-array-array.vert
> @@ -0,0 +1,22 @@
> +/* [config]
> + * expect_result: pass
> + * glsl_version: 1.20
> + * require_extensions: GL_ARB_arrays_of_arrays
> + * [end config]
> + */
> +#version 120
> +#extension GL_ARB_arrays_of_arrays: enable
> +
> +attribute vec4 vert;
> +
> +void foo(vec4 x[2][3])
> +{
> +  gl_Position = vert;
> +}
> +
> +void main()
> +{
> +  vec4 y[2][3];
> +  foo(y);
> +  gl_Position = vert;
> +}
> diff --git a/tests/spec/arb_arrays_of_arrays/compiler/function-parameter-unsized.vert b/tests/spec/arb_arrays_of_arrays/compiler/function-parameter-unsized.vert
> new file mode 100644
> index 0000000..28af069
> --- /dev/null
> +++ b/tests/spec/arb_arrays_of_arrays/compiler/function-parameter-unsized.vert
> @@ -0,0 +1,22 @@
> +/* [config]
> + * expect_result: fail
> + * glsl_version: 1.20
> + * require_extensions: GL_ARB_arrays_of_arrays
> + * [end config]
> + *
> + * From page 19 (page 25 of the PDF) of the GLSL 1.20 spec:
> + *
> + *     "Arrays declared as formal parameters in a function declaration
> + *     must specify a size."
> + */
> +#version 120
> +#extension GL_ARB_arrays_of_arrays: enable
> +
> +vec4 a_function(vec4 [][6] p);
> +
> +uniform vec4 [9][6] an_array;
> +
> +void main()
> +{
> +  gl_Position = a_function(an_array);
> +}
> 



More information about the Piglit mailing list