[PATCH 1/5] wined3d: Fix "sysmem_count" accounting in wined3d_texture_invalidate_location().

Henri Verbeet hverbeet at codeweavers.com
Thu May 25 05:04:02 CDT 2017


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

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 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));
-- 
2.1.4




More information about the wine-patches mailing list