Skip to main content
gamedev.net
🔒 Locked

Render States

Started by ProgrammerDX Sep 22, 2010 at 2:55 AM 6 replies 1k views
Original Post
ProgrammerDX
ProgrammerDX
Are Render States and StageStates reset to default on a new BeginScene()?

[Edited by - ProgrammerDX on September 22, 2010 3:12:08 AM]
Evil Steve
Evil Steve
Nope, only on device Reset().
ProgrammerDX
ProgrammerDX
So you can increase performance if you set 'global' render states only once?
Evil Steve
Evil Steve
Quote:
Original post by ProgrammerDX
So you can increase performance if you set 'global' render states only once?
Yes, but the performance inprovement will be absolutely tiny - The driver (And D3D if you're not running a pure device) will cache the render states, and not try to re-set a redundant state.
MJP
MJP
Quote:
Original post by Evil Steve
Quote:
Original post by ProgrammerDX
So you can increase performance if you set 'global' render states only once?
Yes, but the performance inprovement will be absolutely tiny - The driver (And D3D if you're not running a pure device) will cache the render states, and not try to re-set a redundant state.


Sure, but the less you hit the driver the better. In my experience it's always been a win to avoid redundant SetRenderState/SetSamplerState calls, especially since it's trivial to implement.

Evil Steve
Evil Steve
Quote:
Original post by MJP
Sure, but the less you hit the driver the better. In my experience it's always been a win to avoid redundant SetRenderState/SetSamplerState calls, especially since it's trivial to implement.
True - I generally cache all the state I can in my engine, so I can create a pure device and still have access to the current render state.

Quote:
Original post by Steve_Segreto
So on a PURE D3D device you need to cache renderstates and avoid resetting redundant ones? Does anybody happen to have a link to any literature about this?
Correct. It means that D3D doesn't have to do the buffering, which can be a performance win in some cases.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.