Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/adapter_gl.c | 6 +++--- dlls/wined3d/adapter_vk.c | 14 +++++++------- dlls/wined3d/buffer.c | 8 ++++++-- dlls/wined3d/context_gl.c | 2 +- dlls/wined3d/directx.c | 4 ++-- dlls/wined3d/view.c | 2 +- dlls/wined3d/wined3d_private.h | 12 ++++++------ 7 files changed, 26 insertions(+), 22 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index 902b9620f30..7c2e0460df7 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -4588,10 +4588,10 @@ static void adapter_gl_unmap_bo_address(struct wined3d_context *context, 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, - const struct wined3d_bo_address *dst, const struct wined3d_bo_address *src, size_t size) +static void adapter_gl_copy_bo_address(struct wined3d_context *context, const struct wined3d_bo_address *dst, + const struct wined3d_bo_address *src, size_t size, uint32_t map_flags) { - wined3d_context_gl_copy_bo_address(wined3d_context_gl(context), dst, src, size); + wined3d_context_gl_copy_bo_address(wined3d_context_gl(context), dst, src, size, map_flags); }
static HRESULT adapter_gl_create_swapchain(struct wined3d_device *device, diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c index 9f36ee39080..7e7a6b4b0bd 100644 --- a/dlls/wined3d/adapter_vk.c +++ b/dlls/wined3d/adapter_vk.c @@ -999,8 +999,8 @@ static void adapter_vk_unmap_bo_address(struct wined3d_context *context, wined3d_bo_vk_unmap(bo, context_vk); }
-static void adapter_vk_copy_bo_address(struct wined3d_context *context, - const struct wined3d_bo_address *dst, const struct wined3d_bo_address *src, size_t size) +static void adapter_vk_copy_bo_address(struct wined3d_context *context, const struct wined3d_bo_address *dst, + const struct wined3d_bo_address *src, size_t size, uint32_t map_flags) { struct wined3d_context_vk *context_vk = wined3d_context_vk(context); const struct wined3d_vk_info *vk_info = context_vk->vk_info; @@ -1084,8 +1084,8 @@ static void adapter_vk_copy_bo_address(struct wined3d_context *context,
staging.buffer_object = (uintptr_t)&staging_bo; staging.addr = NULL; - adapter_vk_copy_bo_address(context, &staging, src, size); - adapter_vk_copy_bo_address(context, dst, &staging, size); + adapter_vk_copy_bo_address(context, &staging, src, size, WINED3D_MAP_WRITE | WINED3D_MAP_DISCARD); + adapter_vk_copy_bo_address(context, dst, &staging, size, map_flags);
wined3d_context_vk_destroy_bo(context_vk, &staging_bo);
@@ -1104,8 +1104,8 @@ static void adapter_vk_copy_bo_address(struct wined3d_context *context,
staging.buffer_object = (uintptr_t)&staging_bo; staging.addr = NULL; - adapter_vk_copy_bo_address(context, &staging, src, size); - adapter_vk_copy_bo_address(context, dst, &staging, size); + adapter_vk_copy_bo_address(context, &staging, src, size, WINED3D_MAP_WRITE | WINED3D_MAP_DISCARD); + adapter_vk_copy_bo_address(context, dst, &staging, size, map_flags);
wined3d_context_vk_destroy_bo(context_vk, &staging_bo);
@@ -1113,7 +1113,7 @@ static void adapter_vk_copy_bo_address(struct wined3d_context *context, }
src_ptr = adapter_vk_map_bo_address(context, src, size, WINED3D_MAP_READ); - dst_ptr = adapter_vk_map_bo_address(context, dst, size, WINED3D_MAP_WRITE); + dst_ptr = adapter_vk_map_bo_address(context, dst, size, map_flags);
memcpy(dst_ptr, src_ptr, size);
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 7b8c8904961..01e1aad8bad 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -1012,13 +1012,17 @@ static HRESULT buffer_resource_sub_resource_unmap(struct wined3d_resource *resou void wined3d_buffer_copy_bo_address(struct wined3d_buffer *dst_buffer, struct wined3d_context *context, unsigned int dst_offset, const struct wined3d_const_bo_address *src_addr, unsigned int size) { + DWORD map_flags = WINED3D_MAP_WRITE; struct wined3d_bo_address dst_addr; DWORD dst_location;
+ if (!dst_offset && size == dst_buffer->resource.size) + map_flags |= WINED3D_MAP_DISCARD; + dst_location = wined3d_buffer_get_memory(dst_buffer, context, &dst_addr); dst_addr.addr += dst_offset;
- wined3d_context_copy_bo_address(context, &dst_addr, (const struct wined3d_bo_address *)src_addr, size); + wined3d_context_copy_bo_address(context, &dst_addr, (const struct wined3d_bo_address *)src_addr, size, map_flags); wined3d_buffer_invalidate_range(dst_buffer, ~dst_location, dst_offset, size); }
@@ -1526,7 +1530,7 @@ static void wined3d_buffer_vk_upload_ranges(struct wined3d_buffer *buffer, struc
src.addr = (uint8_t *)data + range->offset - data_offset; dst.addr = (void *)(uintptr_t)range->offset; - wined3d_context_copy_bo_address(context, &dst, &src, range->size); + wined3d_context_copy_bo_address(context, &dst, &src, range->size, flags); }
return; diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c index 43c086ac758..3f5c492d8b7 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c @@ -2759,7 +2759,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, - const struct wined3d_bo_address *dst, const struct wined3d_bo_address *src, size_t size) + const struct wined3d_bo_address *dst, const struct wined3d_bo_address *src, size_t size, uint32_t map_flags) { const struct wined3d_gl_info *gl_info; struct wined3d_bo_gl *src_bo, *dst_bo; diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index a39c6d75750..3cc06e683fc 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -2785,8 +2785,8 @@ static void adapter_no3d_unmap_bo_address(struct wined3d_context *context, 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, const struct wined3d_bo_address *src, size_t size) +static void adapter_no3d_copy_bo_address(struct wined3d_context *context, const struct wined3d_bo_address *dst, + const struct wined3d_bo_address *src, size_t size, uint32_t map_flags) { if (dst->buffer_object) ERR("Unsupported dst buffer object %#lx.\n", dst->buffer_object); diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c index e8c91ec6413..3ce26fa9c98 100644 --- a/dlls/wined3d/view.c +++ b/dlls/wined3d/view.c @@ -1597,7 +1597,7 @@ void wined3d_unordered_access_view_set_counter(struct wined3d_unordered_access_v dst.buffer_object = view->counter_bo; dst.addr = NULL;
- wined3d_context_copy_bo_address(context, &dst, &src, sizeof(uint32_t)); + wined3d_context_copy_bo_address(context, &dst, &src, sizeof(uint32_t), WINED3D_MAP_WRITE | WINED3D_MAP_DISCARD);
context_release(context); } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index da1cf638606..95d1a2f6dab 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2309,8 +2309,8 @@ void wined3d_context_gl_bind_dummy_textures(const struct wined3d_context_gl *con void wined3d_context_gl_bind_texture(struct wined3d_context_gl *context_gl, 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_copy_bo_address(struct wined3d_context_gl *context_gl, - const struct wined3d_bo_address *dst, const struct wined3d_bo_address *src, size_t size) DECLSPEC_HIDDEN; +void wined3d_context_gl_copy_bo_address(struct wined3d_context_gl *context_gl, const struct wined3d_bo_address *dst, + const struct wined3d_bo_address *src, size_t size, uint32_t map_flags) DECLSPEC_HIDDEN; bool wined3d_context_gl_create_bo(struct wined3d_context_gl *context_gl, GLsizeiptr size, GLenum binding, GLenum usage, bool coherent, GLbitfield flags, struct wined3d_bo_gl *bo) DECLSPEC_HIDDEN; void wined3d_context_gl_destroy(struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN; @@ -3317,8 +3317,8 @@ struct wined3d_adapter_ops const struct wined3d_bo_address *data, size_t size, uint32_t map_flags); void (*adapter_unmap_bo_address)(struct wined3d_context *context, const struct wined3d_bo_address *data, unsigned int range_count, const struct wined3d_range *ranges); - void (*adapter_copy_bo_address)(struct wined3d_context *context, - const struct wined3d_bo_address *dst, const struct wined3d_bo_address *src, size_t size); + void (*adapter_copy_bo_address)(struct wined3d_context *context, const struct wined3d_bo_address *dst, + const struct wined3d_bo_address *src, size_t size, uint32_t map_flags); HRESULT (*adapter_create_swapchain)(struct wined3d_device *device, struct wined3d_swapchain_desc *desc, struct wined3d_swapchain_state_parent *state_parent, void *parent, @@ -6111,9 +6111,9 @@ static inline void wined3d_context_unmap_bo_address(struct wined3d_context *cont }
static inline void wined3d_context_copy_bo_address(struct wined3d_context *context, - const struct wined3d_bo_address *dst, const struct wined3d_bo_address *src, size_t size) + const struct wined3d_bo_address *dst, const struct wined3d_bo_address *src, size_t size, uint32_t map_flags) { - context->device->adapter->adapter_ops->adapter_copy_bo_address(context, dst, src, size); + context->device->adapter->adapter_ops->adapter_copy_bo_address(context, dst, src, size, map_flags); }
static inline void wined3d_context_vk_reference_bo(const struct wined3d_context_vk *context_vk,