[Piglit] [PATCH] tests/spec: ARB_arrays_of_arrays compiler tests
Paul Berry
stereotype441 at gmail.com
Fri Oct 18 19:26:00 CEST 2013
On 5 October 2013 04:21, Timothy Arceri <t_arceri at yahoo.com.au> wrote:
>
> Signed-off-by: Timothy Arceri <t_arceri at yahoo.com.au>
> ---
> tests/all.tests | 7 +++++++
> ...-function-parameter-declaration-new-syntax.vert | 17 ++++++++++++++++
> ...ay-of-array-function-parameter-declaration.vert | 17 ++++++++++++++++
> ...y-function-parameter-definition-new-syntax.vert | 20
> +++++++++++++++++++
> ...ray-of-array-function-parameter-definition.vert | 20
> +++++++++++++++++++
> .../array-of-array-structure-field-new-syntax.frag | 17 ++++++++++++++++
> .../compiler/array-of-array-structure-field.frag | 17 ++++++++++++++++
> .../array-of-array-uniform-new-syntax.vert | 15 ++++++++++++++
> ...f-array-uniform-unsized-invalid-new-syntax.vert | 21
> ++++++++++++++++++++
> ...-array-uniform-unsized-invalid-new-syntax2.vert | 21
> ++++++++++++++++++++
> .../array-of-array-uniform-unsized-invalid.vert | 21
> ++++++++++++++++++++
> .../array-of-array-uniform-unsized-invalid2.vert | 21
> ++++++++++++++++++++
> .../array-of-array-uniform-unsized-new-syntax.vert | 15 ++++++++++++++
> .../compiler/array-of-array-uniform-unsized.vert | 15 ++++++++++++++
> .../compiler/array-of-array-uniform.vert | 15 ++++++++++++++
> 15 files changed, 259 insertions(+)
> create mode 100644
> tests/spec/arb_arrays_of_arrays/compiler/array-of-array-function-parameter-declaration-new-syntax.vert
> create mode 100644
> tests/spec/arb_arrays_of_arrays/compiler/array-of-array-function-parameter-declaration.vert
> create mode 100644
> tests/spec/arb_arrays_of_arrays/compiler/array-of-array-function-parameter-definition-new-syntax.vert
> create mode 100644
> tests/spec/arb_arrays_of_arrays/compiler/array-of-array-function-parameter-definition.vert
> create mode 100644
> tests/spec/arb_arrays_of_arrays/compiler/array-of-array-structure-field-new-syntax.frag
> create mode 100644
> tests/spec/arb_arrays_of_arrays/compiler/array-of-array-structure-field.frag
> create mode 100644
> tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-new-syntax.vert
> create mode 100644
> tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized-invalid-new-syntax.vert
> create mode 100644
> tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized-invalid-new-syntax2.vert
> create mode 100644
> tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized-invalid.vert
> create mode 100644
> tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized-invalid2.vert
> create mode 100644
> tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized-new-syntax.vert
> create mode 100644
> tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized.vert
> create mode 100644
> tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform.vert
>
General comment: it seems redundant to have "arb_arrays_of_arrays" in the
folder name and "array-of-array-" as a prefix to each parser test. Can we
remove "array-of-array-" from the parser test file names (so for example
tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform.vert
becomes tests/spec/arb_arrays_of_arrays/compiler/uniform.vert).
>
> diff --git a/tests/all.tests b/tests/all.tests
> index 3e5e1a3..1737138 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -1272,6 +1272,13 @@ for backing_type in ('texture', 'renderbuffer'):
> 'arb_framebuffer_srgb-' + test_name)
> add_plain_test(arb_framebuffer_srgb, 'framebuffer-srgb')
>
> +# Group ARB_arrays_of_arrays
> +arb_arrays_of_arrays = Group()
> +spec['ARB_arrays_of_arrays'] = arb_arrays_of_arrays
> +import_glsl_parser_tests(arb_arrays_of_arrays,
> + os.path.join(testsDir, 'spec',
> 'arb_arrays_of_arrays'),
> + ['compiler'])
> +
> arb_gpu_shader5 = Group()
> spec['ARB_gpu_shader5'] = arb_gpu_shader5
> add_shader_test_dir(arb_gpu_shader5,
> diff --git
> a/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-function-parameter-declaration-new-syntax.vert
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-function-parameter-declaration-new-syntax.vert
> new file mode 100644
> index 0000000..d4f8bf8
> --- /dev/null
> +++
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-function-parameter-declaration-new-syntax.vert
>
Calling this test "new syntax" is confusing. All three of these syntaxes
are new:
vec4[3][2] a;
vec4[2] a[3];
vec4 a[3][2];
I'd suggest a naming convention that just names the syntax elements in the
order they appear. So for instance:
vec4[3][2] a; // tested by *-array-array-var
vec4[2] a[3]; // tested by *-array-var-array
vec4 a[3][2]; // tested by *-var-array-array
> @@ -0,0 +1,17 @@
> +/* [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]);
> +
> +void main()
> +{
>
It would be nice to include a call to the function here in main(), so that
we can verify that the compiler's type checking logic correctly deduces
that the function can be called.
> + gl_Position = vert;
> +}
> diff --git
> a/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-function-parameter-declaration.vert
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-function-parameter-declaration.vert
> new file mode 100644
> index 0000000..60fec71
> --- /dev/null
> +++
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-function-parameter-declaration.vert
> @@ -0,0 +1,17 @@
> +/* [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()
> +{
>
Same comment applies here.
> + gl_Position = vert;
> +}
>
Can we also add a test to verify that the following works:
void foo(vec4[3][2] x);
(this is explicitly allowed by the spec).
A similar comment goes for all the other tests in this patch.
> diff --git
> a/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-function-parameter-definition-new-syntax.vert
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-function-parameter-definition-new-syntax.vert
> new file mode 100644
> index 0000000..c93ed9d
> --- /dev/null
> +++
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-function-parameter-definition-new-syntax.vert
> @@ -0,0 +1,20 @@
> +/* [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()
> +{
> + gl_Position = vert;
> +}
> diff --git
> a/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-function-parameter-definition.vert
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-function-parameter-definition.vert
> new file mode 100644
> index 0000000..f43284a
> --- /dev/null
> +++
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-function-parameter-definition.vert
> @@ -0,0 +1,20 @@
> +/* [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()
> +{
> + gl_Position = vert;
> +}
> diff --git
> a/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-structure-field-new-syntax.frag
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-structure-field-new-syntax.frag
> new file mode 100644
> index 0000000..54c4da5
> --- /dev/null
> +++
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-structure-field-new-syntax.frag
> @@ -0,0 +1,17 @@
> +/* [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
> +
> +struct S {
> + vec4 [2] x[2];
> +};
> +
> +void main()
> +{
> + gl_FragData[0] = vec4(0.0);
> +}
> diff --git
> a/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-structure-field.frag
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-structure-field.frag
> new file mode 100644
> index 0000000..e0de2b9
> --- /dev/null
> +++
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-structure-field.frag
> @@ -0,0 +1,17 @@
> +/* [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
> +
> +struct S {
> + vec4 x[2][3];
> +};
> +
> +void main()
> +{
> + gl_FragData[0] = vec4(0.0);
> +}
> diff --git
> a/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-new-syntax.vert
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-new-syntax.vert
> new file mode 100644
> index 0000000..588152e
> --- /dev/null
> +++
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-new-syntax.vert
> @@ -0,0 +1,15 @@
> +/* [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
> +
> +uniform vec4 [1] an_array[1];
> +
> +void main()
> +{
> + gl_Position = an_array[0][0];
> +}
> diff --git
> a/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized-invalid-new-syntax.vert
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized-invalid-new-syntax.vert
> new file mode 100644
> index 0000000..7af032a
> --- /dev/null
> +++
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized-invalid-new-syntax.vert
> @@ -0,0 +1,21 @@
> +/* [config]
> + * expect_result: fail
> + * glsl_version: 1.20
> + * require_extensions: GL_ARB_arrays_of_arrays
> + * [end config]
> + *
> + * For ARB_arrays_of_arrays spec:
> + *
> + * "For unsized arrays, only the outermost dimension can be lacking a
> + * size. A type that includes an unknown array size cannot be formed into
> + * an array until it gets an explicit size."
> + */
> +#version 120
> +#extension GL_ARB_arrays_of_arrays: enable
> +
> +uniform vec4 [] an_array[];
> +
> +void main()
> +{
> + gl_Position = an_array[0][0];
> +}
> diff --git
> a/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized-invalid-new-syntax2.vert
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized-invalid-new-syntax2.vert
> new file mode 100644
> index 0000000..fcb0239
> --- /dev/null
> +++
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized-invalid-new-syntax2.vert
> @@ -0,0 +1,21 @@
> +/* [config]
> + * expect_result: fail
> + * glsl_version: 1.20
> + * require_extensions: GL_ARB_arrays_of_arrays
> + * [end config]
> + *
> + * For ARB_arrays_of_arrays spec:
> + *
> + * "For unsized arrays, only the outermost dimension can be lacking a
> + * size. A type that includes an unknown array size cannot be formed into
> + * an array until it gets an explicit size."
> + */
> +#version 120
> +#extension GL_ARB_arrays_of_arrays: enable
> +
> +uniform vec4 [] an_array[1];
> +
> +void main()
> +{
> + gl_Position = an_array[0][0];
> +}
> diff --git
> a/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized-invalid.vert
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized-invalid.vert
> new file mode 100644
> index 0000000..83da6cc
> --- /dev/null
> +++
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized-invalid.vert
> @@ -0,0 +1,21 @@
> +/* [config]
> + * expect_result: fail
> + * glsl_version: 1.20
> + * require_extensions: GL_ARB_arrays_of_arrays
> + * [end config]
> + *
> + * For ARB_arrays_of_arrays spec:
> + *
> + * "For unsized arrays, only the outermost dimension can be lacking a
> + * size. A type that includes an unknown array size cannot be formed into
> + * an array until it gets an explicit size."
> + */
> +#version 120
> +#extension GL_ARB_arrays_of_arrays: enable
> +
> +uniform vec4 an_array[][];
> +
> +void main()
> +{
> + gl_Position = an_array[0][0];
> +}
> diff --git
> a/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized-invalid2.vert
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized-invalid2.vert
> new file mode 100644
> index 0000000..49aacce
> --- /dev/null
> +++
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized-invalid2.vert
> @@ -0,0 +1,21 @@
> +/* [config]
> + * expect_result: fail
> + * glsl_version: 1.20
> + * require_extensions: GL_ARB_arrays_of_arrays
> + * [end config]
> + *
> + * For ARB_arrays_of_arrays spec:
> + *
> + * "For unsized arrays, only the outermost dimension can be lacking a
> + * size. A type that includes an unknown array size cannot be formed into
> + * an array until it gets an explicit size."
> + */
> +#version 120
> +#extension GL_ARB_arrays_of_arrays: enable
> +
> +uniform vec4 an_array[1][];
> +
> +void main()
> +{
> + gl_Position = an_array[0][0];
> +}
> diff --git
> a/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized-new-syntax.vert
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized-new-syntax.vert
> new file mode 100644
> index 0000000..e801f65
> --- /dev/null
> +++
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized-new-syntax.vert
> @@ -0,0 +1,15 @@
> +/* [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
> +
> +uniform vec4 [1] an_array[];
> +
> +void main()
> +{
> + gl_Position = an_array[0][0];
> +}
> diff --git
> a/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized.vert
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized.vert
> new file mode 100644
> index 0000000..99a52a1
> --- /dev/null
> +++
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform-unsized.vert
> @@ -0,0 +1,15 @@
> +/* [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
> +
> +uniform vec4 an_array[][1];
> +
> +void main()
> +{
> + gl_Position = an_array[0][0];
> +}
> diff --git
> a/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform.vert
> b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform.vert
> new file mode 100644
> index 0000000..95215bb
> --- /dev/null
> +++ b/tests/spec/arb_arrays_of_arrays/compiler/array-of-array-uniform.vert
> @@ -0,0 +1,15 @@
> +/* [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
> +
> +uniform vec4 an_array[1][1];
> +
> +void main()
> +{
> + gl_Position = an_array[0][0];
> +}
> --
> 1.7.9.5
>
As a side note, are you planning to add other tests in subsequent patches?
Glancing at the spec, it seems like there's a lot more that still needs to
be tested.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20131018/05e140d4/attachment-0001.html>
More information about the Piglit
mailing list