wined3d: Use the bo binding in wined3d_context_gl_map_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:42 +04:30 committed by Alexandre Julliard
parent c4dab9b76e
commit 7d43577d89
4 changed files with 11 additions and 19 deletions

View File

@ -4629,13 +4629,7 @@ static void adapter_gl_uninit_3d(struct wined3d_device *device)
static void *adapter_gl_map_bo_address(struct wined3d_context *context,
const struct wined3d_bo_address *data, size_t size, uint32_t bind_flags, uint32_t map_flags)
{
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);
return wined3d_context_gl_map_bo_address(context_gl, data, size, binding, map_flags);
return wined3d_context_gl_map_bo_address(wined3d_context_gl(context), data, size, map_flags);
}
static void adapter_gl_unmap_bo_address(struct wined3d_context *context, const struct wined3d_bo_address *data,

View File

@ -2525,7 +2525,7 @@ void wined3d_context_gl_bind_texture(struct wined3d_context_gl *context_gl, GLen
}
void *wined3d_context_gl_map_bo_address(struct wined3d_context_gl *context_gl,
const struct wined3d_bo_address *data, size_t size, GLenum binding, DWORD flags)
const struct wined3d_bo_address *data, size_t size, uint32_t flags)
{
const struct wined3d_gl_info *gl_info;
struct wined3d_bo_gl *bo;
@ -2535,20 +2535,20 @@ void *wined3d_context_gl_map_bo_address(struct wined3d_context_gl *context_gl,
return data->addr;
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])
{
memory = GL_EXTCALL(glMapBufferRange(binding, (INT_PTR)data->addr,
memory = GL_EXTCALL(glMapBufferRange(bo->binding, (INT_PTR)data->addr,
size, wined3d_resource_gl_map_flags(flags)));
}
else
{
memory = GL_EXTCALL(glMapBuffer(binding, wined3d_resource_gl_legacy_map_flags(flags)));
memory = GL_EXTCALL(glMapBuffer(bo->binding, wined3d_resource_gl_legacy_map_flags(flags)));
memory += (INT_PTR)data->addr;
}
wined3d_context_gl_bind_bo(context_gl, binding, 0);
wined3d_context_gl_bind_bo(context_gl, bo->binding, 0);
checkGLcall("Map buffer object");
return memory;
@ -2604,8 +2604,8 @@ void wined3d_context_gl_copy_bo_address(struct wined3d_context_gl *context_gl,
}
else
{
src_ptr = wined3d_context_gl_map_bo_address(context_gl, src, size, src_bo->binding, WINED3D_MAP_READ);
dst_ptr = wined3d_context_gl_map_bo_address(context_gl, dst, size, dst_bo->binding, WINED3D_MAP_WRITE);
src_ptr = wined3d_context_gl_map_bo_address(context_gl, src, size, WINED3D_MAP_READ);
dst_ptr = wined3d_context_gl_map_bo_address(context_gl, dst, size, WINED3D_MAP_WRITE);
memcpy(dst_ptr, src_ptr, size);

View File

@ -2160,8 +2160,7 @@ static void wined3d_texture_gl_upload_data(struct wined3d_context *context,
return;
}
src_mem = wined3d_context_gl_map_bo_address(context_gl, &bo,
src_slice_pitch * update_d, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ);
src_mem = wined3d_context_gl_map_bo_address(context_gl, &bo, src_slice_pitch * update_d, WINED3D_MAP_READ);
for (z = 0; z < update_d; ++z, src_mem += src_slice_pitch)
{
@ -2811,8 +2810,7 @@ static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_g
wined3d_format_calculate_pitch(format, device->surface_alignment,
width, height, &dst_row_pitch, &dst_slice_pitch);
src_mem = wined3d_context_gl_map_bo_address(context_gl, &data,
src_slice_pitch, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ);
src_mem = wined3d_context_gl_map_bo_address(context_gl, &data, src_slice_pitch, WINED3D_MAP_READ);
if (!(dst_mem = heap_alloc(dst_slice_pitch)))
{
ERR("Out of memory (%u).\n", dst_slice_pitch);

View File

@ -2200,7 +2200,7 @@ HRESULT wined3d_context_gl_init(struct wined3d_context_gl *context_gl,
void wined3d_context_gl_load_tex_coords(const struct wined3d_context_gl *context_gl,
const struct wined3d_stream_info *si, GLuint *current_bo, const struct wined3d_state *state) DECLSPEC_HIDDEN;
void *wined3d_context_gl_map_bo_address(struct wined3d_context_gl *context_gl,
const struct wined3d_bo_address *data, size_t size, GLenum binding, DWORD flags) DECLSPEC_HIDDEN;
const struct wined3d_bo_address *data, size_t size, uint32_t flags) DECLSPEC_HIDDEN;
struct wined3d_context_gl *wined3d_context_gl_reacquire(struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN;
void wined3d_context_gl_release(struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN;
BOOL wined3d_context_gl_set_current(struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN;