From 0726d7e82f9ea8023e97539ba95e33577f8824f2 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 25 May 2017 12:04:02 +0200 Subject: [PATCH] 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 Signed-off-by: Alexandre Julliard --- 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 61be9a25196..476295cecc5 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.11.4.GIT