[Piglit] [PATCH] arb_tessellation_shader: add compiler tests for barrier()
Chris Forbes
chrisf at ijw.co.nz
Wed Aug 27 20:02:15 PDT 2014
Reviewed-by: Chris Forbes <chrisf at ijw.co.nz>
On Thu, Aug 28, 2014 at 12:27 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>
> barrier-return/switch/func fail on NVIDIA 340.32 -- apparently it's
> perfectly happy with them, despite what the spec appears to say. That
> said, they *would* be perfectly safe, but not allowed by the spec.
>
> .../compiler/barrier-for.tesc | 28 ++++++++++++++++
> .../compiler/barrier-func.tesc | 31 ++++++++++++++++++
> .../compiler/barrier-if.tesc | 29 +++++++++++++++++
> .../compiler/barrier-return.tesc | 30 +++++++++++++++++
> .../compiler/barrier-switch.tesc | 38 ++++++++++++++++++++++
> .../arb_tessellation_shader/compiler/barrier.tesc | 17 ++++++++++
> .../arb_tessellation_shader/compiler/barrier.tese | 11 +++++++
> 7 files changed, 184 insertions(+)
> create mode 100644 tests/spec/arb_tessellation_shader/compiler/barrier-for.tesc
> create mode 100644 tests/spec/arb_tessellation_shader/compiler/barrier-func.tesc
> create mode 100644 tests/spec/arb_tessellation_shader/compiler/barrier-if.tesc
> create mode 100644 tests/spec/arb_tessellation_shader/compiler/barrier-return.tesc
> create mode 100644 tests/spec/arb_tessellation_shader/compiler/barrier-switch.tesc
> create mode 100644 tests/spec/arb_tessellation_shader/compiler/barrier.tesc
> create mode 100644 tests/spec/arb_tessellation_shader/compiler/barrier.tese
>
> diff --git a/tests/spec/arb_tessellation_shader/compiler/barrier-for.tesc b/tests/spec/arb_tessellation_shader/compiler/barrier-for.tesc
> new file mode 100644
> index 0000000..51683f4
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/compiler/barrier-for.tesc
> @@ -0,0 +1,28 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_tessellation_shader
> +// check_link: true
> +// [end config]
> +
> +/**
> + * From issue 42:
> + *
> + * As a result, we choose a heavy-handed approach in which we only allow
> + * calls to barrier() inside main(). Even within main, barrier() calls are
> + * forbidden inside loops (even those that turn out to have constant loop
> + * counts and don't execute "break" or "continue" statements), if
> + * statements, or after a return statement.
> + */
> +
> +#version 150
> +#extension GL_ARB_tessellation_shader: require
> +layout(vertices = 3) out;
> +
> +void main() {
> + gl_out[gl_InvocationID].gl_Position = vec4(0.0);
> + for (int i = 0; i < 3; i++)
> + barrier();
> + gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
> + gl_TessLevelInner = float[2](1.0, 1.0);
> +}
> diff --git a/tests/spec/arb_tessellation_shader/compiler/barrier-func.tesc b/tests/spec/arb_tessellation_shader/compiler/barrier-func.tesc
> new file mode 100644
> index 0000000..f31443f
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/compiler/barrier-func.tesc
> @@ -0,0 +1,31 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_tessellation_shader
> +// check_link: true
> +// [end config]
> +
> +/**
> + * From issue 42:
> + *
> + * As a result, we choose a heavy-handed approach in which we only allow
> + * calls to barrier() inside main(). Even within main, barrier() calls are
> + * forbidden inside loops (even those that turn out to have constant loop
> + * counts and don't execute "break" or "continue" statements), if
> + * statements, or after a return statement.
> + */
> +
> +#version 150
> +#extension GL_ARB_tessellation_shader: require
> +layout(vertices = 3) out;
> +
> +void func() {
> + barrier();
> +}
> +
> +void main() {
> + gl_out[gl_InvocationID].gl_Position = vec4(0.0);
> + func();
> + gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
> + gl_TessLevelInner = float[2](1.0, 1.0);
> +}
> diff --git a/tests/spec/arb_tessellation_shader/compiler/barrier-if.tesc b/tests/spec/arb_tessellation_shader/compiler/barrier-if.tesc
> new file mode 100644
> index 0000000..061ca02
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/compiler/barrier-if.tesc
> @@ -0,0 +1,29 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_tessellation_shader
> +// check_link: true
> +// [end config]
> +
> +/**
> + * From issue 42:
> + *
> + * As a result, we choose a heavy-handed approach in which we only allow
> + * calls to barrier() inside main(). Even within main, barrier() calls are
> + * forbidden inside loops (even those that turn out to have constant loop
> + * counts and don't execute "break" or "continue" statements), if
> + * statements, or after a return statement.
> + */
> +
> +#version 150
> +#extension GL_ARB_tessellation_shader: require
> +layout(vertices = 3) out;
> +uniform bool cond;
> +
> +void main() {
> + gl_out[gl_InvocationID].gl_Position = vec4(0.0);
> + if (cond)
> + barrier();
> + gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
> + gl_TessLevelInner = float[2](1.0, 1.0);
> +}
> diff --git a/tests/spec/arb_tessellation_shader/compiler/barrier-return.tesc b/tests/spec/arb_tessellation_shader/compiler/barrier-return.tesc
> new file mode 100644
> index 0000000..4cab7e1
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/compiler/barrier-return.tesc
> @@ -0,0 +1,30 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_tessellation_shader
> +// check_link: true
> +// [end config]
> +
> +/**
> + * From issue 42:
> + *
> + * As a result, we choose a heavy-handed approach in which we only allow
> + * calls to barrier() inside main(). Even within main, barrier() calls are
> + * forbidden inside loops (even those that turn out to have constant loop
> + * counts and don't execute "break" or "continue" statements), if
> + * statements, or after a return statement.
> + */
> +
> +#version 150
> +#extension GL_ARB_tessellation_shader: require
> +layout(vertices = 3) out;
> +uniform bool cond;
> +
> +void main() {
> + gl_out[gl_InvocationID].gl_Position = vec4(0.0);
> + if (cond)
> + return;
> + barrier();
> + gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
> + gl_TessLevelInner = float[2](1.0, 1.0);
> +}
> diff --git a/tests/spec/arb_tessellation_shader/compiler/barrier-switch.tesc b/tests/spec/arb_tessellation_shader/compiler/barrier-switch.tesc
> new file mode 100644
> index 0000000..e08b7e3
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/compiler/barrier-switch.tesc
> @@ -0,0 +1,38 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_tessellation_shader
> +// check_link: true
> +// [end config]
> +
> +/**
> + * From issue 42:
> + *
> + * As a result, we choose a heavy-handed approach in which we only allow
> + * calls to barrier() inside main(). Even within main, barrier() calls are
> + * forbidden inside loops (even those that turn out to have constant loop
> + * counts and don't execute "break" or "continue" statements), if
> + * statements, or after a return statement.
> + *
> + * Further, from the spec text:
> + *
> + * In particular, barrier() may not be called inside
> + * a switch statement, in either sub-statement of an if statement, inside a
> + * do, for, or while loop, or at any point after a return statement in the
> + * function main().
> + */
> +
> +#version 150
> +#extension GL_ARB_tessellation_shader: require
> +layout(vertices = 3) out;
> +uniform int val;
> +
> +void main() {
> + gl_out[gl_InvocationID].gl_Position = vec4(0.0);
> + switch (val) {
> + default:
> + barrier();
> + }
> + gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
> + gl_TessLevelInner = float[2](1.0, 1.0);
> +}
> diff --git a/tests/spec/arb_tessellation_shader/compiler/barrier.tesc b/tests/spec/arb_tessellation_shader/compiler/barrier.tesc
> new file mode 100644
> index 0000000..8a59206
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/compiler/barrier.tesc
> @@ -0,0 +1,17 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_tessellation_shader
> +// check_link: true
> +// [end config]
> +
> +#version 150
> +#extension GL_ARB_tessellation_shader: require
> +layout(vertices = 3) out;
> +
> +void main() {
> + gl_out[gl_InvocationID].gl_Position = vec4(0.0);
> + barrier();
> + gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
> + gl_TessLevelInner = float[2](1.0, 1.0);
> +}
> diff --git a/tests/spec/arb_tessellation_shader/compiler/barrier.tese b/tests/spec/arb_tessellation_shader/compiler/barrier.tese
> new file mode 100644
> index 0000000..9d2392b
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/compiler/barrier.tese
> @@ -0,0 +1,11 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_tessellation_shader
> +// [end config]
> +
> +#version 150
> +#extension GL_ARB_tessellation_shader: require
> +layout(triangles) in;
> +
> +void main() { barrier(); gl_Position = vec4(0.0);}
> --
> 1.8.5.5
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
More information about the Piglit
mailing list