d3d8: GetDepthStencilSurface/GetRenderTarget refcount issue

H. Verbeet hverbeet at gmail.com
Wed Oct 18 05:02:13 CDT 2006


On 18/10/06, Stefan Dösinger <stefandoesinger at gmx.at> wrote:
> We have an
> IDirect3DDevice?_AddRef call in CreateSurface / CreateTexture... Native seems
> to have this AddRef call in IDirect3DResource_AddRef:
>
> if(oldref == 0) IDirect3DDevice8_AddRef(This->myDevice);
>
> I guess this is the first thing we have to change.
Not sure how you read that from the test.

> The next is that the auto depth stencil surface and the implicit render
> targets seem to be created with a reference count of 0, that is why they have
> a ref of 1 on the first GetRenderTarget, and why the AddRef from above
> increases the device refcount.
It could just be that the surface object is only created on the first
call to GetRenderTarget. Note that in this test we don't do any actual
rendering, so it's not impossible that in a typical application the
depth stencil would already be created the moment GetRenderTarget is
called.

> It could be that the implicit render target and auto depth stencil COM objects
> are not COM objects in d3d's internal management and that they are
> constructed in the first call to GetRenderTarget. But we won't be able to do
> that. Or well, we can do it in d3d8.dll and d3d9.dll, but not in wined3d.dll.
Sure we can. Regular surfaces are currently created with a callback to
d3d8 / d3d9 as well.

I wonder what happens if you release the surface you get from
GetDepthStencilTarget, and then try to do some rendering with the
device.



More information about the wine-devel mailing list