wined3d: Use the bo binding in wined3d_context_gl_unmap_bo_address().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2020-04-22 17:42:43 +04:30 committed by Alexandre Julliard
parent 7d43577d89
commit b29ea85885
4 changed files with 13 additions and 18 deletions

View File

@ -4635,13 +4635,7 @@ static void *adapter_gl_map_bo_address(struct wined3d_context *context,
static void adapter_gl_unmap_bo_address(struct wined3d_context *context, const struct wined3d_bo_address *data,
uint32_t bind_flags, unsigned int range_count, const struct wined3d_range *ranges)
{
struct wined3d_context_gl *context_gl;
GLenum binding;
context_gl = wined3d_context_gl(context);
binding = wined3d_buffer_gl_binding_from_bind_flags(context_gl->gl_info, bind_flags);
wined3d_context_gl_unmap_bo_address(context_gl, data, binding, range_count, ranges);
wined3d_context_gl_unmap_bo_address(wined3d_context_gl(context), data, range_count, ranges);
}
static void adapter_gl_copy_bo_address(struct wined3d_context *context,

View File

@ -2554,8 +2554,8 @@ void *wined3d_context_gl_map_bo_address(struct wined3d_context_gl *context_gl,
return memory;
}
void wined3d_context_gl_unmap_bo_address(struct wined3d_context_gl *context_gl, const struct wined3d_bo_address *data,
GLenum binding, unsigned int range_count, const struct wined3d_range *ranges)
void wined3d_context_gl_unmap_bo_address(struct wined3d_context_gl *context_gl,
const struct wined3d_bo_address *data, unsigned int range_count, const struct wined3d_range *ranges)
{
const struct wined3d_gl_info *gl_info;
struct wined3d_bo_gl *bo;
@ -2565,18 +2565,19 @@ void wined3d_context_gl_unmap_bo_address(struct wined3d_context_gl *context_gl,
return;
gl_info = context_gl->gl_info;
wined3d_context_gl_bind_bo(context_gl, binding, bo->id);
wined3d_context_gl_bind_bo(context_gl, bo->binding, bo->id);
if (gl_info->supported[ARB_MAP_BUFFER_RANGE])
{
for (i = 0; i < range_count; ++i)
{
GL_EXTCALL(glFlushMappedBufferRange(binding, (UINT_PTR)data->addr + ranges[i].offset, ranges[i].size));
GL_EXTCALL(glFlushMappedBufferRange(bo->binding,
(UINT_PTR)data->addr + ranges[i].offset, ranges[i].size));
}
}
GL_EXTCALL(glUnmapBuffer(binding));
wined3d_context_gl_bind_bo(context_gl, binding, 0);
GL_EXTCALL(glUnmapBuffer(bo->binding));
wined3d_context_gl_bind_bo(context_gl, bo->binding, 0);
checkGLcall("Unmap buffer object");
}
@ -2611,8 +2612,8 @@ void wined3d_context_gl_copy_bo_address(struct wined3d_context_gl *context_gl,
range.offset = 0;
range.size = size;
wined3d_context_gl_unmap_bo_address(context_gl, dst, dst_bo->binding, 1, &range);
wined3d_context_gl_unmap_bo_address(context_gl, src, src_bo->binding, 0, NULL);
wined3d_context_gl_unmap_bo_address(context_gl, dst, 1, &range);
wined3d_context_gl_unmap_bo_address(context_gl, src, 0, NULL);
}
}
else if (!dst_bo && src_bo)

View File

@ -2178,7 +2178,7 @@ static void wined3d_texture_gl_upload_data(struct wined3d_context *context,
dst_z + z, update_w, update_h, 1, converted_mem, srgb, dst_texture, gl_info);
}
wined3d_context_gl_unmap_bo_address(context_gl, &bo, GL_PIXEL_UNPACK_BUFFER, 0, NULL);
wined3d_context_gl_unmap_bo_address(context_gl, &bo, 0, NULL);
heap_free(converted_mem);
}
else
@ -2820,7 +2820,7 @@ static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_g
width, height, &texture_gl->t.async.gl_color_key);
src_row_pitch = dst_row_pitch;
src_slice_pitch = dst_slice_pitch;
wined3d_context_gl_unmap_bo_address(context_gl, &data, GL_PIXEL_UNPACK_BUFFER, 0, NULL);
wined3d_context_gl_unmap_bo_address(context_gl, &data, 0, NULL);
data.buffer_object = 0;
data.addr = dst_mem;

View File

@ -2209,7 +2209,7 @@ void wined3d_context_gl_texture_update(struct wined3d_context_gl *context_gl,
const struct wined3d_texture_gl *texture_gl) DECLSPEC_HIDDEN;
void wined3d_context_gl_unload_tex_coords(const struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN;
void wined3d_context_gl_unmap_bo_address(struct wined3d_context_gl *context_gl, const struct wined3d_bo_address *data,
GLenum binding, unsigned int range_count, const struct wined3d_range *ranges) DECLSPEC_HIDDEN;
unsigned int range_count, const struct wined3d_range *ranges) DECLSPEC_HIDDEN;
void wined3d_context_gl_update_stream_sources(struct wined3d_context_gl *context_gl,
const struct wined3d_state *state) DECLSPEC_HIDDEN;