Vulkan: Enable maintenance4 in VMA

VK_KHR_maintenance4 is enabled when available. VMA isn't aware that we
enabled it and could still use less optimized code-paths. This PR will
inform VMA that it can use the optimized code-paths.

The improvement is that we can decide in which memory area a specific
resource will be allocated, without the need of allocating the resource
header (VkImage/VkBuffer).

Pull Request: https://projects.blender.org/blender/blender/pulls/144552
This commit is contained in:
Jeroen Bakker
2025-08-18 09:52:08 +02:00
parent ecba348b73
commit 066280446c
3 changed files with 9 additions and 0 deletions

View File

@@ -437,6 +437,7 @@ void VKBackend::detect_workarounds(VKDevice &device)
extensions.descriptor_buffer = device.supports_extension(
VK_EXT_DESCRIPTOR_BUFFER_EXTENSION_NAME);
#endif
extensions.maintenance4 = device.supports_extension(VK_KHR_MAINTENANCE_4_EXTENSION_NAME);
extensions.memory_priority = device.supports_extension(VK_EXT_MEMORY_PRIORITY_EXTENSION_NAME);
extensions.pageable_device_local_memory = device.supports_extension(
VK_EXT_PAGEABLE_DEVICE_LOCAL_MEMORY_EXTENSION_NAME);

View File

@@ -42,6 +42,7 @@ void VKExtensions::log() const
" - [%c] dynamic rendering local read\n"
" - [%c] dynamic rendering unused attachments\n"
" - [%c] external memory\n"
" - [%c] maintenance4\n"
" - [%c] memory priority\n"
" - [%c] pageable device local memory\n"
" - [%c] shader stencil export",
@@ -52,6 +53,7 @@ void VKExtensions::log() const
dynamic_rendering_local_read ? 'X' : ' ',
dynamic_rendering_unused_attachments ? 'X' : ' ',
external_memory ? 'X' : ' ',
maintenance4 ? 'X' : ' ',
memory_priority ? 'X' : ' ',
pageable_device_local_memory ? 'X' : ' ',
GPU_stencil_export_support() ? 'X' : ' ');
@@ -269,6 +271,9 @@ void VKDevice::init_memory_allocator()
if (extensions_.memory_priority) {
info.flags |= VMA_ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT;
}
if (extensions_.maintenance4) {
info.flags |= VMA_ALLOCATOR_CREATE_KHR_MAINTENANCE4_BIT;
}
vmaCreateAllocator(&info, &mem_allocator_);
if (!extensions_.external_memory) {

View File

@@ -55,6 +55,9 @@ struct VKExtensions {
*/
bool external_memory = false;
/** VK_KHR_maintenance4 */
bool maintenance4 = false;
/**
* Does the device support VK_EXT_descriptor_buffer.
*/