Henri Verbeet : wined3d: Fix "sysmem_count" accounting in wined3d_texture_invalidate_location().

Alexandre Julliard julliard at winehq.org
Thu May 25 14:42:16 CDT 2017


Module: wine
Branch: master
Commit: 0726d7e82f9ea8023e97539ba95e33577f8824f2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0726d7e82f9ea8023e97539ba95e33577f8824f2

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu May 25 12:04:02 2017 +0200

wined3d: Fix "sysmem_count" accounting in wined3d_texture_invalidate_location().

Only increase it if the sub-resource wasn't already exclusively in system
memory.

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

---

 dlls/wined3d/texture.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 61be9a2..476295c 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -155,6 +155,7 @@ void wined3d_texture_invalidate_location(struct wined3d_texture *texture,
         unsigned int sub_resource_idx, DWORD location)
 {
     struct wined3d_texture_sub_resource *sub_resource;
+    DWORD previous_locations;
 
     TRACE("texture %p, sub_resource_idx %u, location %s.\n",
             texture, sub_resource_idx, wined3d_debug_location(location));
@@ -163,8 +164,9 @@ void wined3d_texture_invalidate_location(struct wined3d_texture *texture,
         wined3d_texture_set_dirty(texture);
 
     sub_resource = &texture->sub_resources[sub_resource_idx];
+    previous_locations = sub_resource->locations;
     sub_resource->locations &= ~location;
-    if (sub_resource->locations == WINED3D_LOCATION_SYSMEM)
+    if (previous_locations != WINED3D_LOCATION_SYSMEM && sub_resource->locations == WINED3D_LOCATION_SYSMEM)
         ++texture->sysmem_count;
 
     TRACE("New locations flags are %s.\n", wined3d_debug_location(sub_resource->locations));




More information about the wine-cvs mailing list