mesa: 2271c793e8650e0e55c054301ab85b5b92b9bf11 The Mesa GLSL compiler allows recursion in GLSL 1.20 shaders. According to the GLSL 1.20 specification this is not allowed. GLSL 1.20 6.1.1 Function Calling Conventions Recursion is not allowed, not even statically. Static recursion is present if the static function call graph of the program contains cycles. piglit/tests/glslparsertest/glsl2/function-12.vert 12 #version 120 13 14 int A() 15 { 16 return A(); 17 } 18 19 void main() 20 { 21 gl_Position = gl_Vertex; 22 }
We do need to fix this. Many GLSL compilers crash in the presence of recursion (ours probably does too at link-time). I'm not too worried about not generating a compile-time error for this. Because of that, I'm lowering the priority. Thanks for the test case, though.
This should have been fixed on the 7.11 branch by: commit 7c98381ed4a2293c5797a2ff003584566a0ce762 Author: Ian Romanick <ian.d.romanick@intel.com> Date: Mon Jul 11 10:46:01 2011 -0700 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> (cherry picked from commit 02c5ae1b3fef75d5c0a715313a69e6b95ebd5b95) This also squashes in the following commit to make sure that bisects in scons builds work: glsl: Add ir_function_detect_recursion.cpp to SConscript. (cherry picked from commit 76bccaff0c54aed10ffbc7c7dc744f1708921409)
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.