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

Chris Forbes chrisf at ijw.co.nz
Sun Aug 10 04:07:02 PDT 2014


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) {
+	if (x > 0) func_b(x - 1);
+}
+
+subroutine (func_type) void impl_b(int x) {
+	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



More information about the Piglit mailing list