Jump to content
  • Advertisement
Sign in to follow this  
Keba

is ID3DXEffect::Set* slow?

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

is ID3DXEffect::Set* (Int,Float,Matrix...) functions slow? when slow i mean should i avoid doing this: (pseudo)

void UpdateFrame()
{
     // setting some variabel in the effect, each frame.
     Effect->SetInt(.....);
}

void Render()
{
     // do some rendering with this effect
}


should i try to avoid setting variabels in a Effect that ain't changing every frame....something like this: (pseudo)

void UpdateFrame()
{
     // setting some variabel in the effect, each frame.

     if(OldValue != newValue)
         Effect->SetInt(newValue...);
}

void Render()
{
     // do some rendering with this effect
}


now i only updating the int var if there is some new data, but is this check handled already in the ID3DXEffect interface? thanks

Share this post


Link to post
Share on other sites
Advertisement
D3DX Effects will do lazy state caching for you - and only apply the affected changes during a Begin/BeginPass/CommitChanges so you don't need to do your own state caching.

If you have a lot of variables shared between effects, you'll probably also want to check out effect pools which will cache the current state for all the effects using that parameter in one place.

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!