On 24/04/07, Stefan Dösinger stefandoesinger@gmx.at wrote:
- hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(This->wineD3DDevice,
&pDecl,
(IUnknown *) ICOM_INTERFACE(This, IDirectDraw7),
fvf);
Is this right? Passing the IDirectDrawImpl as parent looks a bit questionable.
Am Mittwoch 25 April 2007 09:02 schrieb H. Verbeet:
On 24/04/07, Stefan Dösinger stefandoesinger@gmx.at wrote:
- hr =
IWineD3DDevice_CreateVertexDeclarationFromFVF(This->wineD3DDevice, + &pDecl,
(IUnknown *)
ICOM_INTERFACE(This, IDirectDraw7), + fvf);
Is this right? Passing the IDirectDrawImpl as parent looks a bit questionable.
Well, I don't pass the impl, I pass the IDirectDraw7 interface. Of course I could create an additional IParent interface, but I'd have to digg it out later when destroying the declaration. As long as WineD3D doesn't destroy the parent behind my back it is ok. It does not do at the moment, and when we change WineD3D from that regard we'll have to adjust ddraw anyway, even if I passed a seperate IParent.
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.
Of course I could create an additional IParent interface, but I'd have to digg it out later when destroying the declaration. As long as WineD3D doesn't destroy the parent behind my back it is ok. It does not do at the moment, and when we change WineD3D from that regard we'll have to adjust ddraw anyway, even if I passed a seperate IParent.
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 :-/