[Piglit] [PATCH 1/2] glsl-1.20: Add more tests for various 'invariant' scenarios

Anuj Phogat anuj.phogat at gmail.com
Fri Apr 25 14:41:29 PDT 2014


On Sun, Apr 20, 2014 at 9:05 PM, Chris Forbes <chrisf at ijw.co.nz> wrote:
> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
> ---
>  .../glsl-1.20/compiler/qualifiers/invariant-02.vert     | 15 +++++++++++++++
>  .../glsl-1.20/compiler/qualifiers/invariant-03.frag     | 14 ++++++++++++++
>  .../glsl-1.20/compiler/qualifiers/invariant-04.vert     | 13 +++++++++++++
>  .../glsl-1.20/compiler/qualifiers/invariant-05.vert     | 16 ++++++++++++++++
>  .../glsl-1.20/compiler/qualifiers/invariant-06.vert     | 16 ++++++++++++++++
>  .../glsl-1.20/compiler/qualifiers/invariant-07.vert     | 17 +++++++++++++++++
>  .../glsl-1.20/compiler/qualifiers/invariant-08.vert     | 16 ++++++++++++++++
>  7 files changed, 107 insertions(+)
>  create mode 100644 tests/spec/glsl-1.20/compiler/qualifiers/invariant-02.vert
>  create mode 100644 tests/spec/glsl-1.20/compiler/qualifiers/invariant-03.frag
>  create mode 100644 tests/spec/glsl-1.20/compiler/qualifiers/invariant-04.vert
>  create mode 100644 tests/spec/glsl-1.20/compiler/qualifiers/invariant-05.vert
>  create mode 100644 tests/spec/glsl-1.20/compiler/qualifiers/invariant-06.vert
>  create mode 100644 tests/spec/glsl-1.20/compiler/qualifiers/invariant-07.vert
>  create mode 100644 tests/spec/glsl-1.20/compiler/qualifiers/invariant-08.vert
>
> diff --git a/tests/spec/glsl-1.20/compiler/qualifiers/invariant-02.vert b/tests/spec/glsl-1.20/compiler/qualifiers/invariant-02.vert
> new file mode 100644
> index 0000000..05a722f
> --- /dev/null
> +++ b/tests/spec/glsl-1.20/compiler/qualifiers/invariant-02.vert
> @@ -0,0 +1,15 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.20
> +// [end config]
> +//
> +// ensure that invariant-qualifier can be used on vs outputs
> +#version 120
> +
> +invariant varying vec4 x;
> +
> +void main()
> +{
> +  x = vec4(0,0,0,1);
> +  gl_Position = vec4(0,0,0,1);
> +}
> diff --git a/tests/spec/glsl-1.20/compiler/qualifiers/invariant-03.frag b/tests/spec/glsl-1.20/compiler/qualifiers/invariant-03.frag
> new file mode 100644
> index 0000000..4cef447
> --- /dev/null
> +++ b/tests/spec/glsl-1.20/compiler/qualifiers/invariant-03.frag
> @@ -0,0 +1,14 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.20
> +// [end config]
> +//
> +// ensure that invariant-qualifier can be used on fs inputs
> +#version 120
> +
> +invariant varying vec4 x;
> +
> +void main()
> +{
> +  gl_FragColor = x;
> +}
> diff --git a/tests/spec/glsl-1.20/compiler/qualifiers/invariant-04.vert b/tests/spec/glsl-1.20/compiler/qualifiers/invariant-04.vert
> new file mode 100644
> index 0000000..721e14f
> --- /dev/null
> +++ b/tests/spec/glsl-1.20/compiler/qualifiers/invariant-04.vert
> @@ -0,0 +1,13 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.20
> +// [end config]
> +//
> +// all uses of invariant-qualifier must be at global scope.
> +#version 120
> +
> +void main()
> +{
> +  invariant vec4 x;
> +  gl_Position = vec4(0);
> +}
> diff --git a/tests/spec/glsl-1.20/compiler/qualifiers/invariant-05.vert b/tests/spec/glsl-1.20/compiler/qualifiers/invariant-05.vert
> new file mode 100644
> index 0000000..a5c3dcb
> --- /dev/null
> +++ b/tests/spec/glsl-1.20/compiler/qualifiers/invariant-05.vert
> @@ -0,0 +1,16 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.20
> +// [end config]
> +//
> +// all uses of invariant-qualifier must be at global scope.
> +#version 120
> +
> +varying vec4 x;
> +
> +void main()
> +{
> +  invariant x;         /* redeclaration */
> +  gl_Position = vec4(0);
> +}
> +
> diff --git a/tests/spec/glsl-1.20/compiler/qualifiers/invariant-06.vert b/tests/spec/glsl-1.20/compiler/qualifiers/invariant-06.vert
> new file mode 100644
> index 0000000..75bf9db
> --- /dev/null
> +++ b/tests/spec/glsl-1.20/compiler/qualifiers/invariant-06.vert
> @@ -0,0 +1,16 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.20
> +// [end config]
> +//
> +// test that a straightforward redeclaration of a user-defined varying
> +// as invariant works.
> +#version 120
> +
> +varying vec4 x;
> +invariant x;
> +
> +void main()
> +{
> +  gl_Position = vec4(0);
> +}
> diff --git a/tests/spec/glsl-1.20/compiler/qualifiers/invariant-07.vert b/tests/spec/glsl-1.20/compiler/qualifiers/invariant-07.vert
> new file mode 100644
> index 0000000..1c8b96c
> --- /dev/null
> +++ b/tests/spec/glsl-1.20/compiler/qualifiers/invariant-07.vert
> @@ -0,0 +1,17 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.20
> +// [end config]
> +//
> +// test that a straightforward redeclaration of a user-defined varying
> +// as invariant works.
Invalid comment. Copy paste error I think.

> +#version 120
> +
> +varying vec4 x;
> +x = vec4(0);
> +invariant x;           /* redeclaration after use! */
> +
> +void main()
> +{
> +  gl_Position = vec4(0);
> +}
> diff --git a/tests/spec/glsl-1.20/compiler/qualifiers/invariant-08.vert b/tests/spec/glsl-1.20/compiler/qualifiers/invariant-08.vert
> new file mode 100644
> index 0000000..82ec6a8
> --- /dev/null
> +++ b/tests/spec/glsl-1.20/compiler/qualifiers/invariant-08.vert
> @@ -0,0 +1,16 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.20
> +// [end config]
> +//
> +// invariant-qualifier should not be allowed on struct members.

Is below case allowed?:
invariant struct x {
      vec4 y;
}  x1;

> +#version 120
> +
> +struct x {
> +       invariant vec4 y;
> +};
> +
> +void main()
> +{
> +  gl_Position = vec4(0);
> +}
> --
> 1.9.2
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit

With fixed comment in invariant-07.vert, patch is:
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the Piglit mailing list