• Advertisement
Sign in to follow this  

Effect Parameters - Question on Efficiency

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

Hi,

I have read that you should only set effect parameters if they have changed (typically by checking inside your effect wrapper classes get/set blocks) for 'performance reasons'. I'm puzzled as to what those performance benefits are - as I understand it all the textures you might want to pass to the effect are already loaded in the GPU, so the passing of them as a parameter is essentially an instruction to 'select' them, not 'load' them.

In my render loop I sort my artefacts by effect, and then subsort by shared textures. Of course, this cannot always have a single solution set - some artefacts share multiple resources with other artefacts, and there is no 'best' way to sort them from the point of view of the effect having the same parameters from one call to the next. My question is, in general terms, how much effect on performance is incurred by setting a texture to an effect when that is already the last texture the effect used (i.e. shouldn't 'need' resetting).

Phillip

Share this post


Link to post
Share on other sites
Advertisement
The number of drawcalls and state changes is what you have to look out for, performance wise. Basically this is what drives the sort order in most cases.

In older versions of Direct3D, many calls required a context switch, which was expensive, but this isn't true in newer versions.

If it were me, i'd be more concerned with batching (less draw calls) than anything else.

As for your "performance benefits" query, you can try both - using PIX to record the performance and compare.

Share this post


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

  • Advertisement