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

wined3d: Don't set GL_MAP_UNSYNCHRONIZED_BIT for WINED3D_BUFFER_DISCARD maps.

WINED3D_BUFFER_DISCARD means the (current) buffer contents are undefined for subsequent operations. I.e., the map doesn't have to wait for any pending operations to finish, and can just return a new buffer with undefined contents. GL_MAP_UNSYNCHRONIZED_BIT means the driver doesn't wait for previous operations to finish, and just maps a buffer that's potentially in use. Proper synchronization is left to the application. Note that we set both GL_MAP_INVALIDATE_BUFFER_BIT and GL_MAP_UNSYNCHRONIZED_BIT. GL_MAP_INVALIDATE_BUFFER_BIT corresponds to WINED3D_BUFFER_DISCARD, and might cause the driver to return a new buffer, but it's not required to make that optimization.
parent bc8a2b1f
......@@ -683,13 +683,9 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined
GLbitfield mapflags;
mapflags = GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT;
if (flags & WINED3D_BUFFER_DISCARD)
{
mapflags |= GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_BUFFER_BIT;
}
else if (flags & WINED3D_BUFFER_NOSYNC)
{
mapflags |= GL_MAP_INVALIDATE_BUFFER_BIT;
if (flags & WINED3D_BUFFER_NOSYNC)
mapflags |= GL_MAP_UNSYNCHRONIZED_BIT;
}
map = GL_EXTCALL(glMapBufferRange(This->buffer_type_hint, 0,
This->resource.size, mapflags));
checkGLcall("glMapBufferRange");
......@@ -976,17 +972,15 @@ static GLbitfield buffer_gl_map_flags(DWORD d3d_flags)
{
GLbitfield ret = 0;
if (!(d3d_flags & WINED3DLOCK_READONLY)) ret = GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT;
if (!(d3d_flags & WINED3DLOCK_READONLY))
ret |= GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT;
if (!(d3d_flags & (WINED3DLOCK_DISCARD | WINED3DLOCK_NOOVERWRITE)))
ret |= GL_MAP_READ_BIT;
if (d3d_flags & (WINED3DLOCK_DISCARD | WINED3DLOCK_NOOVERWRITE))
{
if(d3d_flags & WINED3DLOCK_DISCARD) ret |= GL_MAP_INVALIDATE_BUFFER_BIT;
if (d3d_flags & WINED3DLOCK_DISCARD)
ret |= GL_MAP_INVALIDATE_BUFFER_BIT;
if (d3d_flags & WINED3DLOCK_NOOVERWRITE)
ret |= GL_MAP_UNSYNCHRONIZED_BIT;
}
else
{
ret |= GL_MAP_READ_BIT;
}
return ret;
}
......
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