Sign in to follow this  
The Lion King

When we reset Direct3D9 Device

Recommended Posts

When we reset Direct3D9 Device, we have to De-Initialize and Re-Initialize other information like sprites or vertex buffers. Does that goes for textures too? I have loaded textures with two ways ... one with TextureFromFile and other one with TextureFromFileEX. The one I have loaded with TextureFromFile does not need to be re-loaded after device re-set. But the other one (EX) I have to unload it and then reload it ... if I dont do that my device won't reset. Is that correct ... or I am missing a point here? Any clues?

Share this post


Link to post
Share on other sites
If they are in the default pool, yes you need to release them before resetting the device, and create them again (if you need them of course) afterwards. That goes for all resources.

Share this post


Link to post
Share on other sites
Yes, since textures, VBs, etc. are created for a single device (you specify it when creating them), if the device changes or is reset, so must they.

Share this post


Link to post
Share on other sites
OK! Thanks!

Quote:
Original post by Kibble
If they are in the default pool, yes you need to release them before resetting the device, and create them again (if you need them of course) afterwards. That goes for all resources.


But what if they aren't in default pool. Mine were in default pool ... I am going to try to remove them from the default and see if I do not have to reload them again. Thanks!

Share this post


Link to post
Share on other sites
Quote:
Original post by The Lion King
OK! Thanks!

Quote:
Original post by Kibble
If they are in the default pool, yes you need to release them before resetting the device, and create them again (if you need them of course) afterwards. That goes for all resources.


But what if they aren't in default pool. Mine were in default pool ... I am going to try to remove them from the default and see if I do not have to reload them again. Thanks!

If you specify the D3DPOOL_MANAGED flag instead of D3DPOOL_DEFAULT on creation then you will not have to release that entity before you reset the device. Managed items restore themselves after the device is reset. ID3DXMesh* items can specify the flag D3DXMESH_MANAGED to the same effect.

It should be noted that some D3DX entities use defaul pool resources and need to be release and recreated such as ID3DXFont*

Share this post


Link to post
Share on other sites
Quote:
Original post by __Daedalus__
It should be noted that some D3DX entities use defaul pool resources and need to be release and recreated such as ID3DXFont*


You don't actually have to release and recreate the ID3DXFont by yourself - they provide two simple functions OnLostDevice and OnResetDevice. But I'm sure you new that :)

Share this post


Link to post
Share on other sites
As Daedalus said, managed resources survive, default ones do not. Basically what I want to add is that there are a few types of D3D objects which do survive a device reset - vertex and pixel shaders for example, and don't need recreating. The details are in the docs for the IDirect3DDevice9::Reset() method.

-Mezz

Share this post


Link to post
Share on other sites
Quote:
Original post by FoxHunter2
You don't actually have to release and recreate the ID3DXFont by yourself - they provide two simple functions OnLostDevice and OnResetDevice. But I'm sure you new that :)


Yes ... but it is not for all the objects. I was talking of Textures. Anyway thanks ... the point is pretty much clear to me now :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this