On 14/11/06, Markus Amsler markus.amsler@oribi.org wrote:
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.
Nevermind, you're right, d3d8 releases wined3d, not the other way around. You can get to the wined3d surface's parent (ie, the d3d8 surface) from inside wined3d though.
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.
Well, it wouldn't get added to the public interface, but you could eg. pass it to the wined3d surface constructor.
Perhaps we could misuse an existing function (e.g QueryInterface with a magic refiid, to destroy the surface, or set/get maigc private data).
That would probably be worse.
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.
That's probably the cleanest option.
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.
Isn't it always the swapchain in wined3d? Anyway, that's not going to work then.
Totally unrelated to this, are you ever on IRC?
Not yet, but I could. Is it easier to discuss such stuff on IRC?
Sometimes. Most people doing d3d stuff are on there.