Henri Verbeet : wined3d: Move the resource map count field up to wined3d_resource.

Alexandre Julliard julliard at winehq.org
Mon May 21 15:31:09 CDT 2012


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Mon May 21 20:48:33 2012 +0200

wined3d: Move the resource map count field up to wined3d_resource.

---

 dlls/wined3d/buffer.c          |    6 +++---
 dlls/wined3d/wined3d_private.h |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 0ee814b..aaa50d7 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -1008,7 +1008,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN
         if (!buffer_add_dirty_area(buffer, offset, size)) return E_OUTOFMEMORY;
     }
 
-    count = InterlockedIncrement(&buffer->lock_count);
+    count = ++buffer->resource.map_count;
 
     if (buffer->buffer_object)
     {
@@ -1121,13 +1121,13 @@ void CDECL wined3d_buffer_unmap(struct wined3d_buffer *buffer)
      * number of Map calls, d3d returns always D3D_OK.
      * This is also needed to prevent Map from returning garbage on
      * the next call (this will happen if the lock_count is < 0). */
-    if (!buffer->lock_count)
+    if (!buffer->resource.map_count)
     {
         WARN("Unmap called without a previous map call.\n");
         return;
     }
 
-    if (InterlockedDecrement(&buffer->lock_count))
+    if (--buffer->resource.map_count)
     {
         /* Delay loading the buffer until everything is unlocked */
         TRACE("Ignoring unmap.\n");
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 6a78b65..6dad53d 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1838,6 +1838,7 @@ struct wined3d_resource
 {
     LONG ref;
     LONG bind_count;
+    LONG map_count;
     struct wined3d_device *device;
     enum wined3d_resource_type type;
     const struct wined3d_format *format;
@@ -2410,7 +2411,6 @@ struct wined3d_buffer
     UINT buffer_object_size;
     DWORD flags;
 
-    LONG lock_count;
     struct wined3d_map_range *maps;
     ULONG maps_size, modified_areas;
     struct wined3d_event_query *query;




More information about the wine-cvs mailing list