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

Alexandre Julliard julliard at winehq.org
Thu Jan 20 15:44:49 CST 2022


Module: wine
Branch: master
Commit: 8b4ae5951defedc8b9b74a212c5e8401062a5ba0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=8b4ae5951defedc8b9b74a212c5e8401062a5ba0

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Jan 20 17:30:53 2022 +0100

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

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/texture.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index a638ec4eeae..34d76249084 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1507,6 +1507,16 @@ static void wined3d_texture_destroy_object(void *object)
         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);
 }
 




More information about the wine-cvs mailing list