I'm writing a scene-graph based graphics engine for modeling purposes. I'm using XNA 4. 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 stanford bunny models with a single texture, then doing the same toggling 2 different textures. There was no difference in rendering time (however I used small ~100x100 textures).
So my questions are:
Thank you for any help or links!
State changes haven't really been expensive for a long time. Batches are expensive. (And a state change necessitates a new batch). A batch is basically a call to a Draw*Primitives
function.
This PDF from nVidia explains it in detail. It also gives ideas for reducing your batch count.
Batches are a CPU-based limit (not GPU). That PDF lists "< 130 tris/batch" as the point where submitting batches dominates performance and the GPU sits idle waiting for more batches (details). It also says you get about 400 batches per frame, at 60 FPS, per 1GHz of CPU power dedicated to submitting batches. (Although the PDF is a bit old, so those figures are a bit out of date.)
My answer on the gamedev site to a similar question should provide some more details. This one too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With