[dx9-12] Major change to desgin

Ann and Jason Edmeades us at the-edmeades.demon.co.uk
Fri Oct 22 14:49:37 CDT 2004


Ok, so I now realize my design had a fatal flaw, and this patch changes the
wined3d design into something I think will cope with all eventualities. Here
are some notes which I might as well write here so I dont forget them!

The problem was the existing deisgn had 2 independant COM objects, ie
Direct3D<interface><8/9> -> IWineD3D<interface>, and they had individual
reference counts etc. The problem is I need the other direction as well, as
things like GetStreamSource show - where reference counts of the Direct3D8/9
interface needs to be changed inside the wined3d library!

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.
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 now means that d3d8/d3d9 dont need to know the implementation details
of wined3d, and in turn wined3d can handle being called from either d3d8 or
d3d9 without knowing or caring which.

The only 'odd' thing in the patch is that since ALL the direct3d8/9
interfaces extend IUnknown, I can increase and decrease the reference counts
by casting them to an IUnknown interface and calling AddRef/Release. This
would pick up the appropriate VTbl entrypoint for the interface in question.
It also means when calling a Get function from wined3d you get back a
wined3d object, and you need to call Getparent and cast into the appropriate
d3d8 or d3d9 interface.

Thats why the patch is the size it is, but it also adds 2 trivial functions
to prove it works. Once this is committed, I can get down to the serious
effort of getting the device functions complete so the stateblock code can
work.

Changelog

Implement Get/SetStream Source
Change the design to accomodate changing of reference counts of the direct3d
interfaces inside the wined3d library

Jason
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dx9.12.patch
Type: application/octet-stream
Size: 44205 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20041022/e09c702d/dx9.12.obj


More information about the wine-patches mailing list