Henri Verbeet : wined3d: Simplify DISCARD / READONLY handling in wined3d_buffer_map() a bit.

Alexandre Julliard julliard at winehq.org
Tue Apr 16 13:37:17 CDT 2013


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Apr 16 08:13:42 2013 +0200

wined3d: Simplify DISCARD / READONLY handling in wined3d_buffer_map() a bit.

---

 dlls/wined3d/buffer.c |   27 ++++++++++++---------------
 1 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index dc5b4d2..9110bbd 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -986,22 +986,19 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN
     TRACE("buffer %p, offset %u, size %u, data %p, flags %#x\n", buffer, offset, size, data, flags);
 
     flags = buffer_sanitize_flags(buffer, flags);
-    if (!(flags & WINED3D_MAP_READONLY))
+    if (flags & WINED3D_MAP_DISCARD)
     {
-        if (flags & WINED3D_MAP_DISCARD)
-        {
-            /* DISCARD invalidates the entire buffer, regardless of the
-             * specified offset and size. Some applications also depend on the
-             * entire buffer being uploaded in that case. Two such
-             * applications are Port Royale and Darkstar One. */
-            if (!buffer_add_dirty_area(buffer, 0, 0))
-                return E_OUTOFMEMORY;
-        }
-        else
-        {
-            if (!buffer_add_dirty_area(buffer, offset, size))
-                return E_OUTOFMEMORY;
-        }
+        /* DISCARD invalidates the entire buffer, regardless of the specified
+         * offset and size. Some applications also depend on the entire buffer
+         * being uploaded in that case. Two such applications are Port Royale
+         * and Darkstar One. */
+        if (!buffer_add_dirty_area(buffer, 0, 0))
+            return E_OUTOFMEMORY;
+    }
+    else if (!(flags & WINED3D_MAP_READONLY))
+    {
+        if (!buffer_add_dirty_area(buffer, offset, size))
+            return E_OUTOFMEMORY;
     }
 
     count = ++buffer->resource.map_count;




More information about the wine-cvs mailing list