I have changed the design so only the Direct3D<interface><8/9> ones
extend
IUnknown, and so there is no reference counting of the IWineD3D objects.
I don't think that's a good idea. If you are using COM interfaces then you need to use them the COM way, this means IWineD3D should derive from IUnknown and freeing it should be done through the Release method. If you don't want to use standard COM then don't declare COM interfaces at all, create your own mechanism.
Well I have an interface, it just doesnt extend IUnknown. Aside from that it is identical to any other com interface - I dont want to export all the functions provided. Is it 100% required to extend IUnknown (and would this mechanism not be equivalent to creating my own :-) )?
I really dont want reference counting on the objects either as it needs to be forced that the reference counting is done on the IDirect3D* versions. I ran out of ideas, and just dropped IUnknown!
Instead, when any Direct3D<interface><8/9> is Released to zero, then it calls a Free method in its WineD3D equivalent interface. I also changed
the
IWineD3D interface to contain, as a void *, a pointer to its 'parent' (by which I mean the Direct3D8/9 interface) plus a function (GetParent) which returns that pointer.
This is bad too, you shouldn't use void*, you should use proper types, at the very least IUnknown*, but preferably define an IWineD3DUser interface or something like that.
I would be happy with IUnknown *, but cant see any way to use my own type other than a straight typedef to either void * or IUnknown. The problem is wined3d needs to deal with both d3d8 and d3d9 interfaces and cannot #include both d3d8 and d3d9 header files due to conflicts. We must store a pointer which can go from the IWineD3D<interface> object to the IDirect3D<interface>Object. I am happy to change it to anything, IUnknown * is as good as any - Would this be ok?
Jason