Jump to content
  • Advertisement
Sign in to follow this  
Tommato

GLSL Mega-shader Subdivision

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

Hello

 

Now I'm using ? single GLSL shader for all materials. It's about 900 lines of code, works slowly. There are no predefined materials/textures, user can construct any one in runtime. Also user can have any card. Thus many pieces of code are used seldom. For example the shader has a code for all 8 textures that can be combined with 16 photoshop blending modes, but in practice absolute most of materials have 2-3 textures (or less yet) combined with alpha masks only. Similar for lights

 

As I understand, to improve performance I need to generate ? set of shaders, each one without unused code. So my questions are:

 

- is such subdivision the main way to improve performance? Or modern GPU(s) are more tolerant to unused code?

- how many shaders can be built in runtime painless? In other words where is a limit when a new shader generating makes no sense and it's better to use "if(s)" ?

 

I realize my problem is very typical, so informative links are welcome.

 

Thank you

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!