[Piglit] [PATCH] Add two new tests of non-const array sizes.

Ian Romanick idr at freedesktop.org
Tue Aug 2 18:32:21 PDT 2011


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

On 08/01/2011 04:01 PM, Paul Berry wrote:
> These tests exercise a bug that I'm fixing in Mesa: there should be a
> compilation error (but not a crash) if an array size is specified by
> an expression involving either:
> 
> - a call to a non-builtin function
> - or an expression with side effects (such as an assignment).

I'm really surprised that we didn't already have tests like these.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> ---
>  .../array-size-non-builtin-function.vert           |   18 ++++++++++++++++++
>  .../array-size-with-side-effect.vert               |   19 +++++++++++++++++++
>  2 files changed, 37 insertions(+), 0 deletions(-)
>  create mode 100644 tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-non-builtin-function.vert
>  create mode 100644 tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-with-side-effect.vert
> 
> diff --git a/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-non-builtin-function.vert b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-non-builtin-function.vert
> new file mode 100644
> index 0000000..fc15e88
> --- /dev/null
> +++ b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-non-builtin-function.vert
> @@ -0,0 +1,18 @@
> +/* [config]
> + * expect_result: fail
> + * glsl_version: 1.20
> + * [end config]
> + *
> + * From page 19 (page 25 of the PDF) of the GLSL 1.20 spec:
> + *
> + *     "When an array size is specified in a declaration, it must be an
> + *     integral constant expression (see Section 4.3.3 "Constant Expressions")
> + *     greater than zero."
> + */
> +#version 120
> +
> +int foo() { return 3; }
> +
> +uniform vec4 [foo()] a;
> +
> +void main() { gl_Position = vec4(0.0); }
> diff --git a/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-with-side-effect.vert b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-with-side-effect.vert
> new file mode 100644
> index 0000000..ccb2388
> --- /dev/null
> +++ b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-with-side-effect.vert
> @@ -0,0 +1,19 @@
> +/* [config]
> + * expect_result: fail
> + * glsl_version: 1.20
> + * [end config]
> + *
> + * From page 19 (page 25 of the PDF) of the GLSL 1.20 spec:
> + *
> + *     "When an array size is specified in a declaration, it must be an
> + *     integral constant expression (see Section 4.3.3 "Constant Expressions")
> + *     greater than zero."
> + */
> +#version 120
> +
> +void main()
> +{
> +  int x;
> +  vec4[(x = 3)] a;
> +  gl_Position = vec4(0.0);
> +}

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk44pSUACgkQX1gOwKyEAw/txgCglKNz2f00bDp3uOkFwbt1BpAV
TyYAn0ZUJjCJOb8oVlXfXeu0WNTC30x1
=llng
-----END PGP SIGNATURE-----


More information about the Piglit mailing list