d3d: Bug in handling of depth-stencil surfaces, and potential patch

Jim Cameron jim_24601 at btinternet.com
Thu Oct 9 16:27:48 CDT 2008


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.

Cheers, jim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Protect-current-depth-stencil-surface-from-deletion.patch
Type: text/x-diff
Size: 2675 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20081009/c3b0bbbf/attachment.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Test-for-depth-stencil-surface-deletion.patch
Type: text/x-diff
Size: 1861 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20081009/c3b0bbbf/attachment-0001.patch 


More information about the wine-devel mailing list