Jump to content
  • Advertisement
Sign in to follow this  
Subotron

Disadvantages of putting multiple Cg shaders in one file

This topic is 4148 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

In my app, I use multiple shaders for different effects. For example an animation shader for a model, a parallax shader for a wall, and a lighting shader for... both. At first I kept all shaders in seperate files, but this meant I had to include the lighting code in both the animation and parallax shader (both objects require lighting). So instead I decided to put all the shaders together in one file (different functions), and made a generic lighting function which is called by both shaders. This works perfectly. However, I was wondering if there are any disadvantages to the approach of putting all shaders in one file. For example, does it mather speed/memory wise? (because a lot more data is read from the file whenever it is used). Thanks for the help.

Share this post


Link to post
Share on other sites
Advertisement
Additional: I don't know if it matters, but I use cgCreateProgramFromFile() and cgGLLoadProgram() to compile and load my Cg programs.

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!