d3d: Bug in handling of depth-stencil surfaces, and potential patch
hverbeet at gmail.com
Fri Oct 10 04:23:22 CDT 2008
2008/10/9 Jim Cameron <jim_24601 at btinternet.com>:
> See bug 10758. If you create a depth-stencil surface with Direct3D 9 on Windows, select it into a D3D9 device with SetDepthStencilSurface() and then release it (so its reference count goes to zero), the surface will not be deleted. It will persist until its external reference count is zero /and/ it has been deselected with SetDepthStencilSurface() or Reset(). However, Wine's D3D implementation will delete the surface as soon as its refcount goes to zero, even if it is still selected into the device. This causes a crash with Myst IV.
> Attached is a patch that adds a private reference count to IDirect3DSurface9_Impl, plus a test case for it. The patch fixes the problem with Myst IV; could one of the resident D3D gurus have a look at it and see if I've got the approach right or if there's something else we should be doing?
> We'll probably also have to make the equivalent change in D3D8 as well, but I haven't considered that.
I think this may need a more generic change to the way we manage
resources and refcounts. I've got a few ideas on how this could be
done, but I need to find some time to work on it, and I'd like to
discuss it with Stefan as well.
More information about the wine-devel