Zebediah Figura : wined3d: Handle WINED3D_LOCATION_CLEARED in wined3d_texture_load_location().

Alexandre Julliard julliard at winehq.org
Thu Feb 24 15:33:40 CST 2022


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

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Wed Feb 23 20:21:37 2022 -0600

wined3d: Handle WINED3D_LOCATION_CLEARED in wined3d_texture_load_location().

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

---

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

diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index b6908dac891..6a11f613732 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -815,6 +815,23 @@ 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_bo_address(texture, sub_resource_idx, &addr, WINED3D_LOCATION_SYSMEM);
+        memset(addr.addr, 0, texture->sub_resources[sub_resource_idx].size);
+        wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_SYSMEM);
+        current |= WINED3D_LOCATION_SYSMEM;
+
+        if (current & location)
+            return TRUE;
+    }
+
     if (!current)
     {
         ERR("Sub-resource %u of texture %p does not have any up to date location.\n",




More information about the wine-cvs mailing list