Are there any rules to obey in releasing directx8 interfaces?
I find some people release interfaces like d3d8 d3ddevice d3dvertexbuffer in reverse order as creating them , but I try reshuffling the releasing order and no problem occur...
so, any critical rule to obey or just a good habit???
I find some people release interfaces like d3d8 d3ddevice d3dvertexbuffer in reverse order as creating them , but I try reshuffling the releasing order and no problem occur...
so, any critical rule to obey or just a good habit???
I'm going to take a wild guess....
All those interfaces are COM interface, each with its own Release method. Each Release method should be responsible for cleaning up its OWN interface.
So I'm going to say it does not matter what order you release in.
/waits for one on the COM experts to tell me I'm wrong. Or maybe I'm right :grin: (purrrr)
All those interfaces are COM interface, each with its own Release method. Each Release method should be responsible for cleaning up its OWN interface.
So I'm going to say it does not matter what order you release in.
/waits for one on the COM experts to tell me I'm wrong. Or maybe I'm right :grin: (purrrr)
There has been tradition for releasing resources in the previous order of which you obtained them. This made _very_ much sense in the dark old days of programming, where heap managers were pretty crappy.
I don't know the exact rules (perhaps they're documented somewhere), but... I wouldn't worry too much about strict reverse-order deallocation. If you can do it, that's fine. However, I'd feel weird about stuff like deallocating the DirectDraw object before deallocating it's surfaces and stuff.
Perhaps the DirectX documentation has something to say about all this - hopefully somebody has a better memory than me :grin:
I don't know the exact rules (perhaps they're documented somewhere), but... I wouldn't worry too much about strict reverse-order deallocation. If you can do it, that's fine. However, I'd feel weird about stuff like deallocating the DirectDraw object before deallocating it's surfaces and stuff.
Perhaps the DirectX documentation has something to say about all this - hopefully somebody has a better memory than me :grin:
I think it shouldn't matter, since if there's any reference to an object, it won't be deleted. So you can't force deletion of an object while another pointer to it exists (provided you don't mess up the number of Release calls you do, which is easy :)).
Thomas
Thomas
Afternoon, Inya.
from DX SDK for 8.1
Apart from the main D3D object, plus your D3D device, anything else can be released in any order.
It's only recommended to unlock resources paired to their lock call.
i.e.
; lock vertexbuffer A
; lock vertexbuffer B
...
; unlock vertexbuffer B
; unlock vertexbuffer A
Cheers,
Scronty
from DX SDK for 8.1
The Direct3D object is the first object that your application creates and the last object that your application releases.
Apart from the main D3D object, plus your D3D device, anything else can be released in any order.
It's only recommended to unlock resources paired to their lock call.
i.e.
; lock vertexbuffer A
; lock vertexbuffer B
...
; unlock vertexbuffer B
; unlock vertexbuffer A
Cheers,
Scronty
Scronty Rules~~~:o)
And thanks go to other experts
Regards
Inya
And thanks go to other experts
Regards
Inya