From 7d43577d89e3be02372c472c95ad42d35bc456f0 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 22 Apr 2020 17:42:42 +0430 Subject: [PATCH] wined3d: Use the bo binding in wined3d_context_gl_map_bo_address(). Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/adapter_gl.c | 8 +------- dlls/wined3d/context_gl.c | 14 +++++++------- dlls/wined3d/texture.c | 6 ++---- dlls/wined3d/wined3d_private.h | 2 +- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index ec8a2cadd23..f2cbb068605 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -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, diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c index 4e0af7474c1..2bb11c30680 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c @@ -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); diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index d075ccc9cd2..e549a413099 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -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); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 5f0b1eee7f2..f835432b685 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -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;