Sign in to follow this  
Keba

is ID3DXEffect::Set* slow?

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this