From 00632c0c269b313ecf484bf7aff6d61666d27ff9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 10 Oct 2013 19:18:06 +0200
Subject: wined3d: Ignore WINED3D_MAP_NO_DIRTY_UPDATE in resource_map.

TODO: This flag and add_dirty_rect need tests.

The primary purpose of this patch is to fix a memory leak in World of
Warcraft. WoW uses WINED3D_MAP_NO_DIRTY_UPDATE | WINED3D_MAP_DISCARD on
sysmem surfaces. A new block of memory is allocated, but never assigned
to heap_mem because wined3d_cs_emit_resource_changed is not called.

The bigger picture is that we don't know how this flag and AddDirtyRect
/ AddDirtyBox are supposed to work. Msdn mentions some interaction with
update_surface and update_texture, but personally I think it is more
likely that this functionality is used to update separate rectangles in
a texture, similar to what can be achieved by mapping a buffer twice.
---
 dlls/wined3d/resource.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index dd21986..805c6da 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -849,7 +849,7 @@ HRESULT wined3d_resource_map(struct wined3d_resource *resource,
         }
     }
 
-    if (!(flags & (WINED3D_MAP_NO_DIRTY_UPDATE | WINED3D_MAP_READONLY)))
+    if (!(flags & WINED3D_MAP_READONLY))
         resource->unmap_dirtify = TRUE;
 
     resource->map_count++;
-- 
2.1.3

