wined3d: Discard texture resources before unloading them in wined3d_texture_destroy_object().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2022-01-20 17:30:53 +01:00 committed by Alexandre Julliard
parent e44afcd8bf
commit 8b4ae5951d
1 changed files with 10 additions and 0 deletions

View File

@ -1507,6 +1507,16 @@ static void wined3d_texture_destroy_object(void *object)
heap_free(texture->dirty_regions); heap_free(texture->dirty_regions);
} }
/* Discard the contents of resources with CPU access, to avoid downloading
* them to SYSMEM on unload. */
if (resource->access & WINED3D_RESOURCE_ACCESS_CPU)
{
for (i = 0; i < sub_count; ++i)
{
wined3d_texture_validate_location(texture, i, WINED3D_LOCATION_DISCARDED);
wined3d_texture_invalidate_location(texture, i, ~WINED3D_LOCATION_DISCARDED);
}
}
resource->resource_ops->resource_unload(resource); resource->resource_ops->resource_unload(resource);
} }