Effect Parameters - Question on Efficiency,
Members - Reputation: 523
Posted 21 July 2012 - 09:50 AM
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).
Members - Reputation: 207
Posted 23 July 2012 - 09:18 AM
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.