[PATCH 7/8] ddraw: Fix SetTexture reference count behaviour.

Henri Verbeet hverbeet at gmail.com
Mon Aug 8 08:45:37 CDT 2011

On 8 August 2011 01:03, Stefan Dösinger <stefandoesinger at gmx.at> wrote:
> On Monday 08 August 2011 00:26:38 Ričardas Barkauskas wrote:
>> +    hr = wined3d_device_get_texture(This->wined3d_device, stage,
> &wined3d_texture);
> This will cause problems when the application is recording a stateblock. In
It also violates COM rules wrt. reference counting. Though in
fairness, ddraw as an API is probably good at that anyway.

I think the more important question here is why it matters. Does the
application really care about the number returned by AddRef() /
Release(), or is this just about not destroying surfaces that are
still in use? If it's the latter, you can fix this just by fixing
ddraw surface destruction to not actually destroy anything until
ddraw_surface_wined3d_object_destroyed() is called. (See how this is
done in d3d8 and d3d9.)

> The really crappy thing, and that's where my sorry feeling comes from, is that
> I haven't seen any application yet that uses d3d7's stateblocks. But I'm
> afraid if we want to stop the fix one app, regress another app problem we have
> with ddraw we'll have to do this properly and not hope no app ever runs into
> this.
I agree that ddraw needs more and better tests, though stateblocks
wouldn't be on top of my list. To a lesser extent this is also true of
d3d8. If anyone has some spare time (haha), porting tests that are
currently d3d9-only to d3d8 and ddraw would be an useful thing to do.

More information about the wine-devel mailing list