[PATCH 1/5] wined3d: Store texture user memory pointer per sub resource.

Henri Verbeet hverbeet at gmail.com
Mon Jun 15 11:06:21 CDT 2020


On Sun, 14 Jun 2020 at 22:47, Paul Gofman <pgofman at codeweavers.com> wrote:
> @@ -1432,8 +1433,14 @@ ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture)
>           * since the application is allowed to free that memory once the
>           * texture is destroyed. Note that this implies that
>           * the destroy handler can't access that memory either. */
> -        if (texture->user_memory)
> +        sub_resource_count = texture->layer_count * texture->level_count;
> +        for (i = 0; i < sub_resource_count; ++i)
> +            if (texture->sub_resources[i].user_memory)
> +                break;
> +
> +        if (i < sub_resource_count)
>              wined3d_resource_wait_idle(&texture->resource);
> +
Why not simply call wined3d_resource_wait_idle() inside the loop?

> @@ -1872,7 +1879,7 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
>          }
>      }
>
> -    if ((texture->user_memory = mem))
> +    if ((texture->sub_resources[0].user_memory = mem))
>      {
That breaks ddraw_surface_reserve_memory() for mip-mapped textures. It
turns out those were slightly broken already (i.e., see
wined3d_texture_get_memory()), but no need to make it worse.



More information about the wine-devel mailing list