Jump to content
  • Advertisement
Sign in to follow this  
JackTheRapper

User-defined GLSL functions are...macros?

This topic is 2946 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
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!