From 02c5ae1b3fef75d5c0a715313a69e6b95ebd5b95 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 11 Jul 2011 10:46:01 -0700 Subject: glsl: Reject shaders that contain static recursion The GLSL 1.20 and later specs say: "Recursion is not allowed, not even statically. Static recursion is present if the static function call graph of the program contains cycles." Recursion is detected and rejected both a compile-time and at link-time. The complie-time check happens to detect some cases that may be removed by various optimization passes. The spec doesn't seem to allow this, but other vendors (e.g., NVIDIA) appear to only check at link-time after all optimizations. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33885 Reviewed-by: Paul Berry Reviewed-by: Eric Anholt Reviewed-by: Kenneth Graunke --- src/glsl/linker.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/glsl/linker.cpp') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 5ec08446d16..fe570b6cc45 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1702,6 +1702,10 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) if (prog->_LinkedShaders[i] == NULL) continue; + detect_recursion_linked(prog, prog->_LinkedShaders[i]->ir); + if (!prog->LinkStatus) + goto done; + while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, 32)) ; } -- cgit v1.2.3