diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 12cbd7ee94b..74864bb7911 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -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_DISCARD | WINED3DLOCK_NOOVERWRITE)) - { - if(d3d_flags & WINED3DLOCK_DISCARD) ret |= GL_MAP_INVALIDATE_BUFFER_BIT; - ret |= GL_MAP_UNSYNCHRONIZED_BIT; - } - else - { + 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) + ret |= GL_MAP_INVALIDATE_BUFFER_BIT; + if (d3d_flags & WINED3DLOCK_NOOVERWRITE) + ret |= GL_MAP_UNSYNCHRONIZED_BIT; return ret; }