Commit cd4223b0 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Only drop WINED3D_MAP_DISCARD right before mapping the buffer object in…

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 15d53761. Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 4bfa0d82
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment