Sign in to follow this  
klapancius

texture change (and other state-change) costs on modern GPU-s

Recommended Posts

klapancius    100
Hi all,

I'm working on a scene-graph based graphics engine for modeling purposes using XNA 4.0, and I'm really new in this.
On many places I have been reading, that texture changes (and other state changes) should be minimized during rendering (so I have to order my primitives by materials, etc.).

I created a small test application in XNA 4, which was rendering hundreds of 70k triangle models with a single texture, then doing the same toggling 2 different textures per models. There was no difference in rendering time (however I used small ~100x100 textures).

So my questions are:
[list][*]Should I really care about shorting my primitives by texture/color/other material parameters? Or is it less important on modern GPU-s?[*]What is the expectable percentage of performance loss, if I don't?[*]Are there any other state changes, which can effect the performance?[*]Where can I find some up to date literature/best practice guide about this?[/list]

Thank you for any help or links!

Share this post


Link to post
Share on other sites
n3Xus    951
[color="#1C2837"][size="2"][quote]Are there any other state changes, which can effect the performance?[/quote][/size][/color]All state changes affect performance.


[color="#1C2837"] [/color][color="#1C2837"][size="2"][quote]Should I really care about shorting my primitives by texture/color/other material parameters? Or is it less important on modern GPU-s?[/quote][/size][/color]
Depends if you are GPU or CPU limited.
If you draw thousand(s) objects you will be more and more CPU bound. If on the other hand you draw few objects with very complex shaders you will be GPU bound.

You should try to minimize all state changes, the driver overhead of API calls is the biggest downside to the PC (compared to consoles).


[color="#1C2837"][size="2"][quote]What is the expectable percentage of performance loss, if I don't?[/quote][/size][/color]
[size="2"][color="#1c2837"]Probably can't be answered, totaly depends on what you plan to do.[/color][/size]
[size="2"][color="#1c2837"]Could be 0%,10%,...
[/color][/size]
[size="2"] [/size]
[color="#1C2837"] [/color][quote][color="#1C2837"][size="2"]Where can[/size][/color][color="#1C2837"][size="2"] I find some up to date literature/best practice guide about this?[/size][/color][/quote][color="#1C2837"] [/color]
[url="http://origin-developer.nvidia.com/docs/IO/8230/BatchBatchBatch.ppt?q=docs/IO/8230/BatchBatchBatch.ppt"]http://origin-develo...hBatchBatch.ppt[/url]

Don't go too much into details if you're new to this. Get something working first.
Only once you can easily load in many models and make a game or something,
then come back and try to improve you renderer based on what you need.

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