[resend v2 4/4] ddraw: Do refcounting only through wined3d_texture_{inc, dec}ref().

Riccardo Bortolato rikyz619 at gmail.com
Sun Jan 3 14:19:24 CST 2016


2016-01-03 19:06 GMT+01:00 Henri Verbeet <hverbeet at gmail.com>:
> On 22 December 2015 at 22:43, Riccardo Bortolato <rikyz619 at gmail.com> wrote:
>> @@ -1227,6 +1221,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Flip(IDirectDrawSurface7
>>      struct wined3d_texture *texture;
>>      IDirectDrawSurface7 *current;
>>      struct wined3d_surface *tmp;
>> +    unsigned int tmp_idx;
> You shouldn't need that. Flippable surfaces aren't supposed to be
> textures, and only textures should have mip-levels. It should be
> enough to validate the sub-resource index is 0 and print an ERR if it
> somehow isn't. I don't think we enforce that DDSCAPS_MIPMAP needs
> DDSCAPS_TEXTURE. That would be a bug and needs tests.
>

Hi Henri,

I know it should be 0 but the idea here is to keep the current
functionality and eventual issues or quirks that may or may not be
contained within the already existing code.

>> @@ -6286,8 +6287,10 @@ void ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw, stru
>>      }
>>      desc->lpSurface = NULL;
>>
>> -    wined3d_surface_incref(wined3d_surface);
>> +    wined3d_texture_incref(wined3d_texture);
>>      surface->wined3d_surface = wined3d_surface;
>> +    surface->wined3d_texture = wined3d_texture;
> The reference counting here is odd. You'd normally increment the
> reference count right before or after storing the pointer.
>
> You also store wined3d_surface without increasing the reference count,
> although that's probably ok because it's protected by the one from the
> texture. Still, it would probably be nicer to just get rid of the
> wined3d_surface field first.
>
>

I will reorder the lines if that helps, the final goal here is exactly
to get rid of wined3d_surface (you can find the whole updated patchset
compared against current git master at this address:
https://github.com/wine-mirror/wine/compare/master...c10ud:surf6). I
can send you the patches but I don't want to clog your inbox or
wine-devel.


Ciao,
Riccardo



More information about the wine-devel mailing list