• Advertisement
Sign in to follow this  

User-defined GLSL functions are...macros?

This topic is 2685 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

Would I be right in thinking that user-defined functions in GLSL are a convenience for the programmer rather than a a means to keep the shader size down? I.e. will the compiler simply expand them, thus increasing the shader size?

Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
No, they are not macros. It depends on hardware and compiler. The compiler will try to optimize the code i.e. inlining short code parts or unrolling loops etc. An other reason for inlining code is, that not every hardware supports branching.

The behaviour might change with newer driver (=compiler) versions or newer hardware.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement