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

## Create an account

Register a new account

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627657
• Total Posts
2978472

• 10
• 12
• 22
• 13
• 33