wined3d: Omit GL_MAP_FLUSH_EXPLICIT_BIT for incoherent maps when ARB_MAP_BUFFER_RANGE is used.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-10-14 23:44:16 -05:00 committed by Alexandre Julliard
parent 2a92c58e11
commit 86e4d3aa8c
3 changed files with 22 additions and 15 deletions

View File

@ -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,6 +2754,8 @@ 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 (!bo->coherent)
{
if (gl_info->supported[ARB_MAP_BUFFER_RANGE])
{
for (i = 0; i < range_count; ++i)
@ -2762,7 +2764,7 @@ void wined3d_context_gl_unmap_bo_address(struct wined3d_context_gl *context_gl,
(UINT_PTR)data->addr + ranges[i].offset, ranges[i].size));
}
}
else if (!bo->coherent && gl_info->supported[APPLE_FLUSH_BUFFER_RANGE])
else if (gl_info->supported[APPLE_FLUSH_BUFFER_RANGE])
{
for (i = 0; i < range_count; ++i)
{
@ -2771,6 +2773,7 @@ void wined3d_context_gl_unmap_bo_address(struct wined3d_context_gl *context_gl,
checkGLcall("glFlushMappedBufferRangeAPPLE");
}
}
}
GL_EXTCALL(glUnmapBuffer(bo->binding));
wined3d_context_gl_bind_bo(context_gl, bo->binding, 0);

View File

@ -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

View File

@ -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;