[PATCH 1/5] wined3d: Simplify DISCARD / READONLY handling in wined3d_buffer_map() a bit.

Henri Verbeet hverbeet at codeweavers.com
Tue Apr 16 01:13:42 CDT 2013


---
 dlls/wined3d/buffer.c | 27 ++++++++++++---------------
 1 file 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;
-- 
1.8.1.5




More information about the wine-patches mailing list