mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-18 12:08:16 +00:00
wined3d: Do not create larger staging buffers than necessary in adapter_vk_copy_bo_address().
This greatly increases performance in "Discovery Tour by Assassin's Creed: Ancient Egypt". The application frequently performs small (< 1 kiB) uploads to a large (128 MiB) buffer. Without this patch, we will always create and destroy a new Vulkan memory allocation, and the Vulkan driver will waste time zeroing the entire allocation.
This commit is contained in:
parent
de95ee6c66
commit
35be2e76a6
|
@ -1165,9 +1165,12 @@ void adapter_vk_copy_bo_address(struct wined3d_context *context,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < range_count; ++i)
|
||||||
|
size = max(size, ranges[i].offset + ranges[i].size);
|
||||||
|
|
||||||
if (src_bo && !(src_bo->memory_type & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT))
|
if (src_bo && !(src_bo->memory_type & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT))
|
||||||
{
|
{
|
||||||
if (!(wined3d_context_vk_create_bo(context_vk, src_bo->size, VK_BUFFER_USAGE_TRANSFER_DST_BIT,
|
if (!(wined3d_context_vk_create_bo(context_vk, size, VK_BUFFER_USAGE_TRANSFER_DST_BIT,
|
||||||
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, &staging_bo)))
|
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, &staging_bo)))
|
||||||
{
|
{
|
||||||
ERR("Failed to create staging bo.\n");
|
ERR("Failed to create staging bo.\n");
|
||||||
|
@ -1187,7 +1190,7 @@ void adapter_vk_copy_bo_address(struct wined3d_context *context,
|
||||||
if (dst_bo && (!(dst_bo->memory_type & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) || (!(map_flags & WINED3D_MAP_DISCARD)
|
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)))
|
&& dst_bo->command_buffer_id > context_vk->completed_command_buffer_id)))
|
||||||
{
|
{
|
||||||
if (!(wined3d_context_vk_create_bo(context_vk, dst_bo->size, VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
if (!(wined3d_context_vk_create_bo(context_vk, size, VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
||||||
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, &staging_bo)))
|
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, &staging_bo)))
|
||||||
{
|
{
|
||||||
ERR("Failed to create staging bo.\n");
|
ERR("Failed to create staging bo.\n");
|
||||||
|
@ -1204,9 +1207,6 @@ void adapter_vk_copy_bo_address(struct wined3d_context *context,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < range_count; ++i)
|
|
||||||
size = max(size, ranges[i].offset + ranges[i].size);
|
|
||||||
|
|
||||||
src_ptr = adapter_vk_map_bo_address(context, src, size, WINED3D_MAP_READ);
|
src_ptr = adapter_vk_map_bo_address(context, src, size, WINED3D_MAP_READ);
|
||||||
dst_ptr = adapter_vk_map_bo_address(context, dst, size, map_flags);
|
dst_ptr = adapter_vk_map_bo_address(context, dst, size, map_flags);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue