Jump to content
  • Advertisement
Sign in to follow this  
The C modest god

IDirect3DDevice9::Reset

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

"Before calling the IDirect3DDevice9::Reset method for a device, an application should release any explicit render targets, depth stencil surfaces, additional swap chains, state blocks and D3DPOOL_DEFAULT resources associated with the device." To what interfaces does the specified objects refer to? I saw a swapchain9, statblock9 interfaces, but to what interfaces does explicit render targets and depth stencil surfaces refer to? Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
They're not refering to specific interfaces, but objects created by functions such as IDirect3DDevice9::CreateRenderTarget(), IDirect3DDevice9::CreateDepthStencilSurface(), etcetera. Those two functions create an object with the IDirect3DSurface9 interface, but that doesn't mean that all IDirect3DSurface9 objects need to be released. Only the ones that are created as certain types of objects (render targets, depth stencil surfaces, etcetera.) (Yes, I use the word "etcetera" too often.)

Share this post


Link to post
Share on other sites
The Reset method also fails ("The method call is invalid. For example, a method's parameter may not be a valid pointer.") if I have created a Direct3DVertexBuffer9 and not released it before the call to reset.
If I dont create this vertex buffer, the Reset does not give error.
Are there more interfaces which need to be released before the call to Reset, which are not documented in the DX9 documentation?

Share this post


Link to post
Share on other sites
Quote:
Original post by The C modest god
The Reset method also fails ("The method call is invalid. For example, a method's parameter may not be a valid pointer.") if I have created a Direct3DVertexBuffer9 and not released it before the call to reset.
If I dont create this vertex buffer, the Reset does not give error.
Are there more interfaces which need to be released before the call to Reset, which are not documented in the DX9 documentation?

Did you create the Vertex Buffer in D3DPOOL_DEFAULT? If so, then you wil notice the part you quoted originally says that everything in that pool needs to be released before a Reset and then recreated. This is just because you have lost control of the video card, and anything you had stored on it is likely to be gone.

The other solution to this is to create the Vertex Buffer in D3DPOOL_MANAGED. According to Microsoft most objects should be in that pool, but I don't tend to see code that uses it too often. No idea why, either.

Share this post


Link to post
Share on other sites
Quote:
Original post by intrest86
Quote:
Original post by The C modest god
The Reset method also fails ("The method call is invalid. For example, a method's parameter may not be a valid pointer.") if I have created a Direct3DVertexBuffer9 and not released it before the call to reset.
If I dont create this vertex buffer, the Reset does not give error.
Are there more interfaces which need to be released before the call to Reset, which are not documented in the DX9 documentation?

Did you create the Vertex Buffer in D3DPOOL_DEFAULT? If so, then you wil notice the part you quoted originally says that everything in that pool needs to be released before a Reset and then recreated. This is just because you have lost control of the video card, and anything you had stored on it is likely to be gone.

The other solution to this is to create the Vertex Buffer in D3DPOOL_MANAGED. According to Microsoft most objects should be in that pool, but I don't tend to see code that uses it too often. No idea why, either.


What I dont understand is why do I have to explixitly release it, and it cant be automatically released like in the case of textures.
Actually, I didnt understand what happens with the textures. It says all its memory and data is lost, but do I need to relase the textures before calling reset? Do I need to release the textures before using them again?

Share this post


Link to post
Share on other sites
You need to release ANYTHING that you have put in D3DPOOL_DEFAULT. That includes textures. Of course, you don't have to release and recreate anything that you put in D3DPOOL_MANAGED, because DirectX keeps copies of everything for you in memory and can copy them back to the device in the case of a reset.

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.

GameDev.net 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!