wined3d: Do not use a staging buffer if discarding a mappable buffer in adapter_vk_copy_bo_address().
As in wined3d_buffer_vk_upload_ranges(). Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
783c850d96
commit
f226540ee2
|
@ -1007,6 +1007,7 @@ static void adapter_vk_copy_bo_address(struct wined3d_context *context,
|
|||
struct wined3d_bo_vk staging_bo, *src_bo, *dst_bo;
|
||||
VkAccessFlags src_access_mask, dst_access_mask;
|
||||
VkBufferMemoryBarrier vk_barrier[2];
|
||||
DWORD map_flags = WINED3D_MAP_WRITE;
|
||||
struct wined3d_bo_address staging;
|
||||
VkCommandBuffer vk_command_buffer;
|
||||
struct wined3d_range range;
|
||||
|
@ -1016,6 +1017,9 @@ static void adapter_vk_copy_bo_address(struct wined3d_context *context,
|
|||
src_bo = (struct wined3d_bo_vk *)src->buffer_object;
|
||||
dst_bo = (struct wined3d_bo_vk *)dst->buffer_object;
|
||||
|
||||
if (dst_bo && !dst->addr && size == dst_bo->size)
|
||||
map_flags |= WINED3D_MAP_DISCARD;
|
||||
|
||||
if (src_bo && dst_bo)
|
||||
{
|
||||
if (!(vk_command_buffer = wined3d_context_vk_get_command_buffer(context_vk)))
|
||||
|
@ -1092,8 +1096,8 @@ static void adapter_vk_copy_bo_address(struct wined3d_context *context,
|
|||
return;
|
||||
}
|
||||
|
||||
if (dst_bo && (dst_bo->command_buffer_id > context_vk->completed_command_buffer_id
|
||||
|| !(dst_bo->memory_type & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)))
|
||||
if (dst_bo && (!(dst_bo->memory_type & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) || (!(map_flags & WINED3D_MAP_DISCARD)
|
||||
&& dst_bo->command_buffer_id > context_vk->completed_command_buffer_id)))
|
||||
{
|
||||
if (!(wined3d_context_vk_create_bo(context_vk, size, VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
||||
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, &staging_bo)))
|
||||
|
@ -1113,7 +1117,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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue