Sorting by states textures, etc
How much does changing states affect framrates today? I want to know if i need to have a sorter that sorts by states. Also, does changing shaders take alot of time too? Then how would you sort by both states and shaders? Are only objects that have the exact same materials sorted together?
Sorting by states should be still be done to increase FPS. For shaders, simply change shaders when you would change material states, which should go hand in hand.
Quote:Original post by Axiverse
How much does changing states affect framrates today? I want to know if i need to have a sorter that sorts by states.
It depends on how you define 'state'. A lot of different states are held by a modern OpenGL implementation. Some are very cheap to change, other extremely costly. Changing single shader attributes, for example, is relatively cheap. Changing texture object binding is already more costly, yet not as extreme as it used ot be in the past. Activating VBOs (through attribute pointers), and changing shaders are amongst the state changes with the highest performance impact.
Quote:Original post by Axiverse
Also, does changing shaders take alot of time too?
Yes.
Quote:
Then how would you sort by both states and shaders?
As I said, the term 'state' is just a superset. You need to differentiate much more. Set up a list of individual states you would like to sort by, and their relative importance and impact onto your engine. Then, use a multiple key sorting scheme: for example, your would first sort by shaders, then by eg. VBOs, then by textures, and finally by attribute changes. Of course the exact order and states to include depend on your engine.
Edit: the same is obviously valid for D3D as well, as you didn't specify which API you're using.
[Edited by - Yann L on September 12, 2005 5:02:19 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement