wined3d: Use the bo bindings in wined3d_context_gl_copy_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-21 22:37:11 +04:30 committed by Alexandre Julliard
parent 1fb85cd573
commit 97272f58ce
4 changed files with 12 additions and 22 deletions

View File

@ -4654,14 +4654,7 @@ static void adapter_gl_copy_bo_address(struct wined3d_context *context,
const struct wined3d_bo_address *dst, uint32_t dst_bind_flags, const struct wined3d_bo_address *dst, uint32_t dst_bind_flags,
const struct wined3d_bo_address *src, uint32_t src_bind_flags, size_t size) const struct wined3d_bo_address *src, uint32_t src_bind_flags, size_t size)
{ {
struct wined3d_context_gl *context_gl; wined3d_context_gl_copy_bo_address(wined3d_context_gl(context), dst, src, size);
GLenum dst_binding, src_binding;
context_gl = wined3d_context_gl(context);
dst_binding = wined3d_buffer_gl_binding_from_bind_flags(context_gl->gl_info, dst_bind_flags);
src_binding = wined3d_buffer_gl_binding_from_bind_flags(context_gl->gl_info, src_bind_flags);
wined3d_context_gl_copy_bo_address(context_gl, dst, dst_binding, src, src_binding, size);
} }
static HRESULT adapter_gl_create_swapchain(struct wined3d_device *device, struct wined3d_swapchain_desc *desc, static HRESULT adapter_gl_create_swapchain(struct wined3d_device *device, struct wined3d_swapchain_desc *desc,

View File

@ -2581,8 +2581,7 @@ void wined3d_context_gl_unmap_bo_address(struct wined3d_context_gl *context_gl,
} }
void wined3d_context_gl_copy_bo_address(struct wined3d_context_gl *context_gl, void wined3d_context_gl_copy_bo_address(struct wined3d_context_gl *context_gl,
const struct wined3d_bo_address *dst, GLenum dst_binding, const struct wined3d_bo_address *dst, const struct wined3d_bo_address *src, size_t size)
const struct wined3d_bo_address *src, GLenum src_binding, size_t size)
{ {
const struct wined3d_gl_info *gl_info; const struct wined3d_gl_info *gl_info;
struct wined3d_bo_gl *src_bo, *dst_bo; struct wined3d_bo_gl *src_bo, *dst_bo;
@ -2605,27 +2604,27 @@ void wined3d_context_gl_copy_bo_address(struct wined3d_context_gl *context_gl,
} }
else else
{ {
src_ptr = wined3d_context_gl_map_bo_address(context_gl, src, size, src_binding, WINED3D_MAP_READ); 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_binding, WINED3D_MAP_WRITE); dst_ptr = wined3d_context_gl_map_bo_address(context_gl, dst, size, dst_bo->binding, WINED3D_MAP_WRITE);
memcpy(dst_ptr, src_ptr, size); memcpy(dst_ptr, src_ptr, size);
range.offset = 0; range.offset = 0;
range.size = size; range.size = size;
wined3d_context_gl_unmap_bo_address(context_gl, dst, dst_binding, 1, &range); wined3d_context_gl_unmap_bo_address(context_gl, dst, dst_bo->binding, 1, &range);
wined3d_context_gl_unmap_bo_address(context_gl, src, src_binding, 0, NULL); wined3d_context_gl_unmap_bo_address(context_gl, src, src_bo->binding, 0, NULL);
} }
} }
else if (!dst_bo && src_bo) else if (!dst_bo && src_bo)
{ {
wined3d_context_gl_bind_bo(context_gl, src_binding, src_bo->id); wined3d_context_gl_bind_bo(context_gl, src_bo->binding, src_bo->id);
GL_EXTCALL(glGetBufferSubData(src_binding, (GLintptr)src->addr, size, dst->addr)); GL_EXTCALL(glGetBufferSubData(src_bo->binding, (GLintptr)src->addr, size, dst->addr));
checkGLcall("buffer download"); checkGLcall("buffer download");
} }
else if (dst_bo && !src_bo) else if (dst_bo && !src_bo)
{ {
wined3d_context_gl_bind_bo(context_gl, dst_binding, dst_bo->id); wined3d_context_gl_bind_bo(context_gl, dst_bo->binding, dst_bo->id);
GL_EXTCALL(glBufferSubData(dst_binding, (GLintptr)dst->addr, size, src->addr)); GL_EXTCALL(glBufferSubData(dst_bo->binding, (GLintptr)dst->addr, size, src->addr));
checkGLcall("buffer upload"); checkGLcall("buffer upload");
} }
else else

View File

@ -1073,8 +1073,7 @@ void wined3d_unordered_access_view_copy_counter(struct wined3d_unordered_access_
src.buffer_object = (uintptr_t)&view_gl->counter_bo; src.buffer_object = (uintptr_t)&view_gl->counter_bo;
src.addr = NULL; src.addr = NULL;
wined3d_context_gl_copy_bo_address(context_gl, &dst, wined3d_buffer_gl(buffer)->bo.binding, wined3d_context_gl_copy_bo_address(context_gl, &dst, &src, sizeof(GLuint));
&src, GL_ATOMIC_COUNTER_BUFFER, sizeof(GLuint));
wined3d_buffer_invalidate_location(buffer, ~dst_location); wined3d_buffer_invalidate_location(buffer, ~dst_location);
} }

View File

@ -2176,8 +2176,7 @@ void wined3d_context_gl_bind_texture(struct wined3d_context_gl *context_gl,
GLenum target, GLuint name) DECLSPEC_HIDDEN; GLenum target, GLuint name) DECLSPEC_HIDDEN;
void wined3d_context_gl_check_fbo_status(const struct wined3d_context_gl *context_gl, GLenum target) DECLSPEC_HIDDEN; void wined3d_context_gl_check_fbo_status(const struct wined3d_context_gl *context_gl, GLenum target) DECLSPEC_HIDDEN;
void wined3d_context_gl_copy_bo_address(struct wined3d_context_gl *context_gl, void wined3d_context_gl_copy_bo_address(struct wined3d_context_gl *context_gl,
const struct wined3d_bo_address *dst, GLenum dst_binding, const struct wined3d_bo_address *dst, const struct wined3d_bo_address *src, size_t size) DECLSPEC_HIDDEN;
const struct wined3d_bo_address *src, GLenum src_binding, size_t size) DECLSPEC_HIDDEN;
void wined3d_context_gl_destroy(struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN; void wined3d_context_gl_destroy(struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN;
void wined3d_context_gl_draw_shaded_quad(struct wined3d_context_gl *context_gl, struct wined3d_texture_gl *texture_gl, void wined3d_context_gl_draw_shaded_quad(struct wined3d_context_gl *context_gl, struct wined3d_texture_gl *texture_gl,
unsigned int sub_resource_idx, const RECT *src_rect, const RECT *dst_rect, unsigned int sub_resource_idx, const RECT *src_rect, const RECT *dst_rect,