[PATCH 1/5] wined3d: Handle WINED3D_LOCATION_CLEARED in wined3d_texture_load_location().
Henri Verbeet
hverbeet at gmail.com
Mon Feb 21 10:16:23 CST 2022
On Mon, 21 Feb 2022 at 06:22, Zebediah Figura <zfigura at codeweavers.com> wrote:
> @@ -789,6 +789,19 @@ BOOL wined3d_texture_load_location(struct wined3d_texture *texture,
> return TRUE;
> }
>
> + if (current & WINED3D_LOCATION_CLEARED)
> + {
> + struct wined3d_bo_address addr;
> +
> + /* FIXME: Clear textures on the GPU if possible. */
> +
> + if (!wined3d_texture_prepare_location(texture, sub_resource_idx, context, WINED3D_LOCATION_SYSMEM))
> + return FALSE;
> + wined3d_texture_get_memory(texture, sub_resource_idx, &addr, WINED3D_LOCATION_SYSMEM);
> + memset(addr.addr, 0, texture->sub_resources[sub_resource_idx].size);
> + current = WINED3D_LOCATION_SYSMEM;
> + }
> +
This is broken. If WINED3D_LOCATION_BUFFER exists,
wined3d_texture_get_memory() will return that instead of
WINED3D_LOCATION_SYSMEM. (It won't if WINED3D_LOCATION_CLEARED is the
only location that's current, but nothing prevents us from e.g. first
calling wined3d_load_location(..., WINED3D_LOCATION_BUFFER), and then
subsequently calling wined3d_load_location(...,
WINED3D_LOCATION_TEXTURE_RGB).)
More generally, wined3d_texture_get_memory() should only be used in
cases where we don't care about the exact location that's returned.
More information about the wine-devel
mailing list