Effect Parameters - Question on Efficiency

Started by
0 comments, last by DJTN 11 years, 9 months ago
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
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.

This topic is closed to new replies.

Advertisement