Jump to content
  • Advertisement
Sign in to follow this  
LoreKeeper

Gaining focus and state blocks

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

Hi :) I'm happily using IDirect3DStateBlock9 to handle states in my system - but I've come across something that just feels clunky in the code. Whenever my full-screen application loses focus and then regains it - the data in state blocks is lost, thus I have to explicitly recreate the state block. Isn't there a convenient dump-to-main-memory or something from which I can recover the state block without major effort? Something that requires one line of code, rather then a full state recoding. thanks

Share this post


Link to post
Share on other sites
Advertisement
hey, i didnt come across the State block thing, but i think its the same concept as other Direct3D objects, you have to recreate it on ur own.

that is as far as i know.

Share this post


Link to post
Share on other sites
That's kind of interesting - I would have thought that state blocks were natively allocated in system memory, not video memory. However, it doesn't look like you can choose a specific pool, so you can't really control where it is created. I suggest that you code your state block creation routine(s) in a specific function, so that it doesn't have to be copied.

For example:
HRESULT CreateStateBlocks()
{
if( FAILED( d3dDevice->CreateStateBlock( D3DSBT_ALL, &block ) ) )
{
return E_FAIL;
}

d3dDevice->BeginStateBlock();

// Set all the states
.
.
.

block->Capture();
d3dDevice->EndStateBlock();

return S_OK;
}

Share this post


Link to post
Share on other sites
I didn't verify this - but I suppose that setting up the DX Device as D3DPOOL_MANAGED would automatically save and recover the state-block. I work without the DX management though... alas. Thanks :)

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!