new refcount for d3d ??

Henri Verbeet hverbeet at gmail.com
Sun Apr 5 16:59:01 CDT 2009


2009/4/5 Stefan Dösinger <stefan at codeweavers.com>:
> After a discussion on #winehackers I want to add something for the archives:
>
> This is a situation that cannot be solved in d3d9 alone, a fix has to involve
> wined3d. This is because there is a hidden reference kept on every object
> that is referenced in any stateblock, even the non-primary ones. d3d9 does
> not know which objects are in which stateblock, so it cannot adjust the
> hidden references properly in the setters(if a stateblock is recorded) or in
> stateblock::capture.
>
I don't know what was discussed on IRC, but essentially we need to
keep track of which resources (in a broad way, not just objects
derived from IWineD3DResource) are in use by a stateblock in wined3d,
and delay destroying the d3d9 object as long as the wined3d object is
in use.

The most reasonable way I can think of to do this at the moment is to
have the d3d9 Release() methods not do the cleanup themselves, but
instead have a destroy/cleanup function which the wined3d object calls
once its refcount reaches zero. That also means the stateblock needs
to keep a reference to these objects, of course. I think Stefan wrote
something along those lines once for vertex buffers.



More information about the wine-devel mailing list