Jump to content
  • Advertisement
Sign in to follow this  
darkelf2k5

[DX10] sprite state save

This topic is 3660 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
Advertisement
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
draw
ID3DXSprite::begin( save state flag )
...
ID3DXSprite::end()
[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.
http://forums.xna.com/forums/t/5893.aspx
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:
"D3DX10_SPRITE_SAVE_STATE
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 GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!