diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c index b08003c697a..4510fe5b155 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c @@ -2712,7 +2712,7 @@ map: if (gl_info->supported[ARB_MAP_BUFFER_RANGE]) { - map_ptr = GL_EXTCALL(glMapBufferRange(bo->binding, offset, size, wined3d_resource_gl_map_flags(flags))); + map_ptr = GL_EXTCALL(glMapBufferRange(bo->binding, offset, size, wined3d_resource_gl_map_flags(bo, flags))); } else { @@ -2754,21 +2754,24 @@ void wined3d_context_gl_unmap_bo_address(struct wined3d_context_gl *context_gl, gl_info = context_gl->gl_info; wined3d_context_gl_bind_bo(context_gl, bo->binding, bo->id); - if (gl_info->supported[ARB_MAP_BUFFER_RANGE]) + if (!bo->coherent) { - for (i = 0; i < range_count; ++i) + if (gl_info->supported[ARB_MAP_BUFFER_RANGE]) { - GL_EXTCALL(glFlushMappedBufferRange(bo->binding, - (UINT_PTR)data->addr + ranges[i].offset, ranges[i].size)); + for (i = 0; i < range_count; ++i) + { + GL_EXTCALL(glFlushMappedBufferRange(bo->binding, + (UINT_PTR)data->addr + ranges[i].offset, ranges[i].size)); + } } - } - else if (!bo->coherent && gl_info->supported[APPLE_FLUSH_BUFFER_RANGE]) - { - for (i = 0; i < range_count; ++i) + else if (gl_info->supported[APPLE_FLUSH_BUFFER_RANGE]) { - GL_EXTCALL(glFlushMappedBufferRangeAPPLE(bo->binding, - (uintptr_t)data->addr + ranges[i].offset, ranges[i].size)); - checkGLcall("glFlushMappedBufferRangeAPPLE"); + for (i = 0; i < range_count; ++i) + { + GL_EXTCALL(glFlushMappedBufferRangeAPPLE(bo->binding, + (uintptr_t)data->addr + ranges[i].offset, ranges[i].size)); + checkGLcall("glFlushMappedBufferRangeAPPLE"); + } } } diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index 8f31996595c..abf07682c76 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -388,12 +388,16 @@ GLbitfield wined3d_resource_gl_storage_flags(const struct wined3d_resource *reso return flags; } -GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags) +GLbitfield wined3d_resource_gl_map_flags(const struct wined3d_bo_gl *bo, DWORD d3d_flags) { GLbitfield ret = 0; if (d3d_flags & WINED3D_MAP_WRITE) - ret |= GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT; + { + ret |= GL_MAP_WRITE_BIT; + if (!bo->coherent) + ret |= GL_MAP_FLUSH_EXPLICIT_BIT; + } if (d3d_flags & WINED3D_MAP_READ) ret |= GL_MAP_READ_BIT; else diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 161d36ad76c..41956f1f061 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4217,7 +4217,7 @@ void wined3d_resource_free_sysmem(struct wined3d_resource *resource) DECLSPEC_HI const struct wined3d_format *wined3d_resource_get_decompress_format( const struct wined3d_resource *resource) DECLSPEC_HIDDEN; unsigned int wined3d_resource_get_sample_count(const struct wined3d_resource *resource) DECLSPEC_HIDDEN; -GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN; +GLbitfield wined3d_resource_gl_map_flags(const struct wined3d_bo_gl *bo, DWORD d3d_flags) DECLSPEC_HIDDEN; GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN; GLbitfield wined3d_resource_gl_storage_flags(const struct wined3d_resource *resource) DECLSPEC_HIDDEN; BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource) DECLSPEC_HIDDEN;