Advertisement Jump to content
Sign in to follow this  

[DX10] sprite state save

This topic is 3869 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

Anyone noticed that providing D3DX10_SPRITE_SAVE_STATE will not restore all device states? At least in my case, even if I use D3DX10_SPRITE_SAVE_STATE in Begin(), the depth stencil state will be different after End() returns. Took me ages to track down this problem.

Share this post

Link to post
Share on other sites
Sounds like a bug. What SDK are you using?

I assume you're changing the depth state during drawing, and that the state is kept, instead of restored. (I.e., not some bizarre bug where the state is changed to something completely different.)

Share this post

Link to post
Share on other sites
Latest, June SDK.

I do it like this:

set states
ID3DXSprite::begin( save state flag )
[depth state messed up here]

I don't touch states while using the sprite, just invoke font functions.

Anyway, found an older post on a different forum, basically with the same problem.
That dates back to 2007/11, so it's not a new one. If I save all the states manually before sprite::begin and restore it after sprite::end, it works like it should. So it's not a big problem. It's just very hard to track down the disappearing depth state if you assume D3DX10_SPRITE_SAVE_STATE will restore everything.
From the docs:
Saves the state so that when ID3DX10Sprite::End is called, it will restore the state to the way it was before ID3DX10Sprite::Begin was called. "

Thus it seems using D3DX10_SPRITE_SAVE_STATE will not restore the ID3D10DepthStencilState assigned to the device before the begin().

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!