glsl: Reject shaders that contain static recursion
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 11 Jul 2011 17:46:01 +0000 (10:46 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 21 Jul 2011 01:20:59 +0000 (18:20 -0700)
commit02c5ae1b3fef75d5c0a715313a69e6b95ebd5b95
tree25b08fc7dd9d6dd68b32d0847f95d18ad4b19d0d
parent1ad3ba4ad954b86751bd5b6ad0a431920bff9958
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 <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/Makefile
src/glsl/ast_to_hir.cpp
src/glsl/ir.h
src/glsl/ir_function_detect_recursion.cpp [new file with mode: 0644]
src/glsl/linker.cpp