[Piglit] [PATCH 11/11] arb_shader_subroutine: Add negative tests for recursion

Ilia Mirkin imirkin at alum.mit.edu
Mon Aug 11 21:10:28 PDT 2014


On Sun, Aug 10, 2014 at 7:07 AM, Chris Forbes <chrisf at ijw.co.nz> wrote:
> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
> ---
>  .../linker/no-mutual-recursion.vert                | 29 ++++++++++++++++++++++
>  .../linker/no-simple-recursion.vert                | 23 +++++++++++++++++
>  2 files changed, 52 insertions(+)
>  create mode 100644 tests/spec/arb_shader_subroutine/linker/no-mutual-recursion.vert
>  create mode 100644 tests/spec/arb_shader_subroutine/linker/no-simple-recursion.vert
>
> diff --git a/tests/spec/arb_shader_subroutine/linker/no-mutual-recursion.vert b/tests/spec/arb_shader_subroutine/linker/no-mutual-recursion.vert
> new file mode 100644
> index 0000000..726a641
> --- /dev/null
> +++ b/tests/spec/arb_shader_subroutine/linker/no-mutual-recursion.vert
> @@ -0,0 +1,29 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_shader_subroutine
> +// check_link: true
> +// [end config]
> +
> +#version 150
> +#extension GL_ARB_shader_subroutine: require
> +
> +/* Two mutually-recursive subroutines */
> +
> +subroutine void func_type_a(int x);
> +subroutine void func_type_b(int x);
> +
> +subroutine uniform func_type_a func_a;
> +subroutine uniform func_type_b func_b;
> +
> +subroutine (func_type) void impl_a(int x) {

func_type_a

> +       if (x > 0) func_b(x - 1);
> +}
> +
> +subroutine (func_type) void impl_b(int x) {

func_type_b

Also what about a situation that hides the recursion a bit, e.g.
impl_a -> non-subroutine func -> subroutine()

> +       if (x > 0) func_a(x - 1);
> +}
> +
> +void main() {
> +       func_a(42);
> +}
> diff --git a/tests/spec/arb_shader_subroutine/linker/no-simple-recursion.vert b/tests/spec/arb_shader_subroutine/linker/no-simple-recursion.vert
> new file mode 100644
> index 0000000..5b4e41a
> --- /dev/null
> +++ b/tests/spec/arb_shader_subroutine/linker/no-simple-recursion.vert
> @@ -0,0 +1,23 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_shader_subroutine
> +// check_link: true
> +// [end config]
> +
> +#version 150
> +#extension GL_ARB_shader_subroutine: require
> +
> +/* Simple recursion via a subroutine */
> +
> +subroutine void func_type(int x);
> +
> +subroutine uniform func_type func;
> +
> +subroutine (func_type) void impl(int x) {
> +       if (x > 0) func(x - 1);
> +}
> +
> +void main() {
> +       func(42);
> +}
> --
> 2.0.4
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list