Bug 29186

Summary: [glsl2] fail to override built-in functions
Product: Mesa Reporter: Gordon Jin <gordon.jin>
Component: Mesa coreAssignee: mesa-dev
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Gordon Jin 2010-07-20 18:49:50 UTC
GLSL spec says: "User code can replace built-in functions with their own if they choose, by simply re-declaring and defining the same name and argument list."

But piglit/tests/glslparsertest/shaders/CorrectBuiltInOveride.frag fails when defining 'radians' (a built-in function) with below failure: 
error: function `radians' redefined

This happens with mesa glsl2 branch, while passes with master branch.

It seems the glsl2 ir reader doesn't consider built-in functions when processing redefining error.
Comment 1 Gordon Jin 2010-07-20 19:48:55 UTC
just seeing this has been mentioned in src/glsl/TODO as well:

- Handle over-riding built-in functions
Comment 2 Kenneth Graunke 2010-07-30 09:00:21 UTC
idr fixed this with his linker changes - probably in d5be2acae (linker: Link built-in functions instead of including them in every shader).  CorrectBuiltInOveride.frag now passes on Ironlake.
Comment 3 Gordon Jin 2010-08-09 17:46:25 UTC
verified

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.