[dx9-12] Major change to desgin

Ann and Jason Edmeades us at the-edmeades.demon.co.uk
Mon Oct 25 17:16:46 CDT 2004


Ok, I think I understand what you mean by the IWineUser concept - and
actually that enables me to solve one of my other problems (I will need to
create d3d8 or d3d9 objects from within the device interface, and I can do
this by defining an IWineUserDevice which extends IWineUser - ok with this?)

The problem I am trying to avoid with reference counting is circular
references. I need to get my head around avoiding them, and exactly when a
reference count is needed. I suspect when I get some things running I'll
spend some time fixing what I miss, but I am starting to understand it.

>Well, you have to follow the rules: when a pointer to the interface is
>returned you AddRef it, and when you no longer need the pointer you
>Release it. If all you ever do is store the pointer in the d3d
>interface and release it when the d3d interface is freed, then you'll
>never have other AddRef/Release calls. Just don't try to invent new
>rules, that won't work right.

My limited understanding was that the reference count should go up each time
a new pointer instance was created, whether stored internally or returned to
the user. This was what was causing me trouble, because I ended up with
circular reference counts, ie because each object had a reference to each
other - then neither would ever get freed!

BTW I just tried this on Windows, and this confirmed it - a device has a
reference count increment on createvertexbuffer (because it has to store an
internal pointer back to the device).

I think this patch should keep you happy (It doesn't do any of the
IWineUserDevice stuff as the code isn't ready for it, but does the dual ref
count + adds Set/Get Stream source). Let me know if you have problems with
it.

Changelog

Implement Get/SetStreamSource, and add the ability to increment use counts
of d3dx objects from within IWineD3D* interfaces

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


More information about the wine-patches mailing list