IDirect3DDevice9::Reset
"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.
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.)
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?
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?
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.
Quote:Original post by intrest86Quote: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?
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement