Skip to content

Commit cb45f35

Browse files
darksylinctGautot
authored andcommitted
Fix performance regression introduced in godotengine#90993
PR godotengine#90993 needed to get rid of VMA_MEMORY_USAGE_AUTO_PREFER_HOST because we no longer used vmaCreateBuffer so we could specify the allocation callbacks. This however resulted in the wrong memory pool being chosen, causing signficant performance slowdown. Indicate additional preferred flags to help VMA select the proper pool. Fixes godotengine#101905
1 parent c7115e3 commit cb45f35

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/vulkan/rendering_device_driver_vulkan.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -1530,10 +1530,12 @@ RDD::BufferID RenderingDeviceDriverVulkan::buffer_create(uint64_t p_size, BitFie
15301530
if (is_src && !is_dst) {
15311531
// Looks like a staging buffer: CPU maps, writes sequentially, then GPU copies to VRAM.
15321532
alloc_create_info.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT;
1533+
alloc_create_info.preferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
15331534
}
15341535
if (is_dst && !is_src) {
15351536
// Looks like a readback buffer: GPU copies from VRAM, then CPU maps and reads.
15361537
alloc_create_info.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT;
1538+
alloc_create_info.preferredFlags |= VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
15371539
}
15381540
alloc_create_info.requiredFlags = (VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
15391541
} break;

0 commit comments

Comments
 (0)