H. Verbeet wrote:
On 14/11/06, Markus Amsler markus.amsler@oribi.org wrote:
The implicit surfaces now gets released if the refcount is -1. Somehow we have to force releasing d3d8 sufaces from wined3d. No idea how.
You could probably either force the refcount to 0 (ie, something like "while(IWineD3DSurface_Release(surface));"),
I'm not sure what you mean. IWineD3DSurface_Release won't release the d3d8 surface. Besides, the surface shouldn't be released with refcount==0, only on device destruction.
or add an explicit destructor to the d3d8 implementation. That's not too pretty either, but I suppose it's better than releasing on -1.
This would mean a wine specific d3d8 interface extension. I'm not sure whether that's acceptable. Perhaps we could misuse an existing function (e.g QueryInterface with a magic refiid, to destroy the surface, or set/get maigc private data). Or handle implicit surface destruction in IDirect3DDevice8_Release and not in IWineD3DDevice_Uninit3D. There we could use our private d3d8 destruct function. Looks for me like the way to go.
I added a flag to mark the implicit surfaces. It's redundant, because wined3d knows the implicit surfaces. The other idea is calling GetRenderTarget and friends in Surface_(AddRef/Release). Besides the problem of an endless recursion, it would be quite an overhead.
Shouldn't we just check if the surface's container is the same as the surface's device?
For d3d8 this would be a nice solution. But in d3d9 the implicit RenderTarget's container is the swapchain. I think we should handle d3d8 and d3d9 the same way.
Totally unrelated to this, are you ever on IRC?
Not yet, but I could. Is it easier to discuss such stuff on IRC?