IDirect3DDevice9::Reset

Started by
6 comments, last by The C modest god 18 years, 8 months ago
"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.
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
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.)
"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas only, and not for things themselves." - John Locke
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?
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
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.
Turring Machines are better than C++ any day ^_~
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?
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
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.
Turring Machines are better than C++ any day ^_~
I have a texture created with D3DPOOL_MANAGED, and unless I release it, my direct3Ddevice9 fails to reset.
Why does that happen?
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
Ok, it works now.
Thanks for the help.
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.

This topic is closed to new replies.

Advertisement