Henri Verbeet : wined3d: Only drop WINED3D_MAP_DISCARD right before mapping the buffer object in wined3d_buffer_map ().

Alexandre Julliard julliard at winehq.org
Thu Mar 30 15:18:01 CDT 2017


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Wed Mar 29 23:17:27 2017 +0200

wined3d: Only drop WINED3D_MAP_DISCARD right before mapping the buffer object in wined3d_buffer_map().

Dropping WINED3D_MAP_DISCARD too early means we go through the system memory
path unnecessarily. Worse, as mentioned in an earlier comment, Darkstar One
depends on the entire buffer being uploaded in case of WINED3D_MAP_DISCARD
maps, and dropping the flag too early prevents that as well. This fixes a
regression introduced by commit 15d53761a5fbfc12fc5f9974c029dace00eab33d.

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/buffer.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 4e8569c..cb3cbbd 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -1004,14 +1004,6 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
 
     TRACE("buffer %p, offset %u, size %u, data %p, flags %#x.\n", buffer, offset, size, data, flags);
 
-    /* Filter redundant WINED3D_MAP_DISCARD maps. The 3DMark2001 multitexture
-     * fill rate test seems to depend on this. When we map a buffer with
-     * GL_MAP_INVALIDATE_BUFFER_BIT, the driver is free to discard the
-     * previous contents of the buffer. The r600g driver only does this when
-     * the buffer is currently in use, while the proprietary NVIDIA driver
-     * appears to do this unconditionally. */
-    if (buffer->flags & WINED3D_BUFFER_DISCARD)
-        flags &= ~WINED3D_MAP_DISCARD;
     count = ++buffer->resource.map_count;
 
     if (buffer->buffer_object)
@@ -1064,6 +1056,16 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
             {
                 buffer_bind(buffer, context);
 
+                /* Filter redundant WINED3D_MAP_DISCARD maps. The 3DMark2001
+                 * multitexture fill rate test seems to depend on this. When
+                 * we map a buffer with GL_MAP_INVALIDATE_BUFFER_BIT, the
+                 * driver is free to discard the previous contents of the
+                 * buffer. The r600g driver only does this when the buffer is
+                 * currently in use, while the proprietary NVIDIA driver
+                 * appears to do this unconditionally. */
+                if (buffer->flags & WINED3D_BUFFER_DISCARD)
+                    flags &= ~WINED3D_MAP_DISCARD;
+
                 if (gl_info->supported[ARB_MAP_BUFFER_RANGE])
                 {
                     GLbitfield mapflags = wined3d_resource_gl_map_flags(flags);




More information about the wine-cvs mailing list