Jump to content
  • Advertisement
Sign in to follow this  
WinstonPennypacker

Effect File Changes vs. Constants Changes

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

Hey everyone, I'm working on a project where I'm implementing the shader management system and am curious about the best architecture. More specifically, I'm currently designing it so that every Effect file (I'm in DX9c ) is loaded into memory only once and a pointer to it is shared across any object that uses it to render. With this implementation the only device state changes are the parameters that have to be set by the specific object ( WorldViewProj, diffuse textures, etc ). From a memory standpoint, this seems right to me. But, I considered that all of those object specific state-changes might be more expensive than just having the same Effect in memory once for each object. That way, the object could set its parameters when it loaded the effect and not have to worry about updating Textures or light positions or diffuse colors during runtime. This would greatly reduce the number of state changes. So long story short, does anyone know if its more expensive to switch Effects ( vertex and pixel shader ), or to make changes to the constants? Thanks and sorry if my wording is confusing. -Winston

Share this post


Link to post
Share on other sites
Advertisement
Use a hybrid approach. Initially have a single instance of each effect that has the default parameters set. Then allow objects to make clones of the effect if they each want to have their own custom parameters. Link it to the parent effect so that default parameter values can still be set if the object has no overrides.

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!