Jump to content
  • Advertisement
Sign in to follow this  
Axiverse

Sorting by states textures, etc

This topic is 4813 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!