Sign in to follow this  
Followers 0
PhillipHamlyn

Effect Parameters - Question on Efficiency

1 post in this topic

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
1

Share this post


Link to post
Share on other sites
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.
0

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