wined3d: Make the adapter responsible for copying between buffer objects.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f2c668e779
commit
422fa49668
|
@ -4611,6 +4611,20 @@ static void adapter_gl_unmap_bo_address(struct wined3d_context *context, const s
|
|||
wined3d_context_gl_unmap_bo_address(context_gl, data, binding, range_count, ranges);
|
||||
}
|
||||
|
||||
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 *src, uint32_t src_bind_flags, size_t size)
|
||||
{
|
||||
struct wined3d_context_gl *context_gl;
|
||||
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,
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain)
|
||||
{
|
||||
|
@ -5095,6 +5109,7 @@ static const struct wined3d_adapter_ops wined3d_adapter_gl_ops =
|
|||
adapter_gl_uninit_3d,
|
||||
adapter_gl_map_bo_address,
|
||||
adapter_gl_unmap_bo_address,
|
||||
adapter_gl_copy_bo_address,
|
||||
adapter_gl_create_swapchain,
|
||||
adapter_gl_destroy_swapchain,
|
||||
adapter_gl_create_buffer,
|
||||
|
|
|
@ -490,6 +490,24 @@ static void adapter_vk_unmap_bo_address(struct wined3d_context *context, const s
|
|||
ERR("Unsupported buffer object %#lx.\n", data->buffer_object);
|
||||
}
|
||||
|
||||
static void adapter_vk_copy_bo_address(struct wined3d_context *context,
|
||||
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)
|
||||
{
|
||||
struct wined3d_map_range range;
|
||||
void *dst_ptr, *src_ptr;
|
||||
|
||||
src_ptr = adapter_vk_map_bo_address(context, src, size, src_bind_flags, WINED3D_MAP_READ);
|
||||
dst_ptr = adapter_vk_map_bo_address(context, dst, size, dst_bind_flags, WINED3D_MAP_WRITE);
|
||||
|
||||
memcpy(dst_ptr, src_ptr, size);
|
||||
|
||||
range.offset = 0;
|
||||
range.size = size;
|
||||
adapter_vk_unmap_bo_address(context, dst, dst_bind_flags, 1, &range);
|
||||
adapter_vk_unmap_bo_address(context, src, src_bind_flags, 0, NULL);
|
||||
}
|
||||
|
||||
static HRESULT adapter_vk_create_swapchain(struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain)
|
||||
{
|
||||
|
@ -821,6 +839,7 @@ static const struct wined3d_adapter_ops wined3d_adapter_vk_ops =
|
|||
adapter_vk_uninit_3d,
|
||||
adapter_vk_map_bo_address,
|
||||
adapter_vk_unmap_bo_address,
|
||||
adapter_vk_copy_bo_address,
|
||||
adapter_vk_create_swapchain,
|
||||
adapter_vk_destroy_swapchain,
|
||||
adapter_vk_create_buffer,
|
||||
|
|
|
@ -1188,9 +1188,8 @@ void wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_off
|
|||
src.addr += src_offset;
|
||||
|
||||
context = context_acquire(dst_buffer->resource.device, NULL, 0);
|
||||
wined3d_context_gl_copy_bo_address(wined3d_context_gl(context),
|
||||
&dst, wined3d_buffer_gl(dst_buffer)->buffer_type_hint,
|
||||
&src, wined3d_buffer_gl(src_buffer)->buffer_type_hint, size);
|
||||
wined3d_context_copy_bo_address(context, &dst, dst_buffer->resource.bind_flags,
|
||||
&src, src_buffer->resource.bind_flags, size);
|
||||
context_release(context);
|
||||
|
||||
wined3d_buffer_invalidate_range(dst_buffer, ~dst_location, dst_offset, size);
|
||||
|
|
|
@ -2372,6 +2372,19 @@ static void adapter_no3d_unmap_bo_address(struct wined3d_context *context, const
|
|||
ERR("Unsupported buffer object %#lx.\n", data->buffer_object);
|
||||
}
|
||||
|
||||
static void adapter_no3d_copy_bo_address(struct wined3d_context *context,
|
||||
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)
|
||||
{
|
||||
if (dst->buffer_object)
|
||||
ERR("Unsupported dst buffer object %#lx.\n", dst->buffer_object);
|
||||
if (src->buffer_object)
|
||||
ERR("Unsupported src buffer object %#lx.\n", src->buffer_object);
|
||||
if (dst->buffer_object || src->buffer_object)
|
||||
return;
|
||||
memcpy(dst->addr, src->addr, size);
|
||||
}
|
||||
|
||||
static HRESULT adapter_no3d_create_swapchain(struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain)
|
||||
{
|
||||
|
@ -2626,6 +2639,7 @@ static const struct wined3d_adapter_ops wined3d_adapter_no3d_ops =
|
|||
adapter_no3d_uninit_3d,
|
||||
adapter_no3d_map_bo_address,
|
||||
adapter_no3d_unmap_bo_address,
|
||||
adapter_no3d_copy_bo_address,
|
||||
adapter_no3d_create_swapchain,
|
||||
adapter_no3d_destroy_swapchain,
|
||||
adapter_no3d_create_buffer,
|
||||
|
|
|
@ -2821,6 +2821,9 @@ struct wined3d_adapter_ops
|
|||
const struct wined3d_bo_address *data, size_t size, uint32_t bind_flags, uint32_t map_flags);
|
||||
void (*adapter_unmap_bo_address)(struct wined3d_context *context, const struct wined3d_bo_address *data,
|
||||
uint32_t bind_flags, unsigned int range_count, const struct wined3d_map_range *ranges);
|
||||
void (*adapter_copy_bo_address)(struct wined3d_context *context,
|
||||
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);
|
||||
HRESULT (*adapter_create_swapchain)(struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain);
|
||||
void (*adapter_destroy_swapchain)(struct wined3d_swapchain *swapchain);
|
||||
|
@ -5267,6 +5270,14 @@ static inline void wined3d_context_unmap_bo_address(struct wined3d_context *cont
|
|||
context->device->adapter->adapter_ops->adapter_unmap_bo_address(context, data, bind_flags, range_count, ranges);
|
||||
}
|
||||
|
||||
static inline void wined3d_context_copy_bo_address(struct wined3d_context *context,
|
||||
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)
|
||||
{
|
||||
context->device->adapter->adapter_ops->adapter_copy_bo_address(context,
|
||||
dst, dst_bind_flags, src, src_bind_flags, size);
|
||||
}
|
||||
|
||||
/* The WNDCLASS-Name for the fake window which we use to retrieve the GL capabilities */
|
||||
#define WINED3D_OPENGL_WINDOW_CLASS_NAME "WineD3D_OpenGL"
|
||||
|
||||
|
|
Loading…
Reference in New Issue