Am Mittwoch 25 April 2007 11:55 schrieb H. Verbeet:
On 25/04/07, Stefan Dösinger stefandoesinger@gmx.at wrote:
Well, I don't pass the impl, I pass the IDirectDraw7 interface.
True, but that isn't the issue :-)
What I think is a bit questionable is that the directdraw object isn't directly related to the vertexdeclaration we create. Ie, wrt refcounts as you mention below.
You're right in principle. In practise WineD3D doesn't use the vdecl parent. If wined3d was changed to make use of the decl parent, then we'd have to change ddraw anyhow, even if I used an IParent interface(e.g. ddraw releases Parent or WineD3D does that).
Right now the Parent for the decl just serves to give a valid interface pointer should someone call GetParent. Unless the interface is used by WineD3D in some way I don't think we should allocate an additional object and carry it around all the time, and have extra code to allocate and destroy it. For the other objects I have the rule to use IDirectDraw7, IDirectDrawSurface7, IDirect3DDevice7 and IDirect3DVertexBuffer7 as the parents, except if WineD3D destroys the Parent in a situation where the ddraw object must not be destroyed. This applies to swapchains and surfaces in a container. For this case I use my IParent interface.
Ok, design theory says that now we have some assertion about the wined3d vertex declaration that the interface does not destroy its parent, and we should document that somewhere. That goes to the "Document WineD3D" todo entry :-/