Added support for VK_KHR_maintenance5 extension

Added VMA_ALLOCATOR_CREATE_KHR_MAINTENANCE5_BIT flag.
See #411 - thanks @qbojj
This commit is contained in:
Adam Sawicki 2024-02-27 13:57:18 +01:00
parent b6fb84ede2
commit 19b940e864
30 changed files with 517 additions and 443 deletions

View file

@ -67,6 +67,7 @@ bool VK_AMD_device_coherent_memory_enabled = false;
bool VK_KHR_buffer_device_address_enabled = false;
bool VK_EXT_memory_priority_enabled = false;
bool VK_EXT_debug_utils_enabled = false;
bool VK_KHR_maintenance5_enabled = false;
bool g_SparseBindingEnabled = false;
// # Pointers to functions from extensions
@ -1396,7 +1397,8 @@ static void PrintEnabledFeatures()
{
wprintf(L"bufferDeviceAddress: %d\n", VK_KHR_buffer_device_address_enabled ? 1 : 0);
}
wprintf(L"VK_EXT_memory_priority: %d\n", VK_EXT_memory_priority ? 1 : 0);
wprintf(L"VK_EXT_memory_priority: %d\n", VK_EXT_memory_priority_enabled ? 1 : 0);
wprintf(L"VK_KHR_maintenance5: %d\n", VK_KHR_maintenance5_enabled? 1 : 0);
}
void SetAllocatorCreateInfo(VmaAllocatorCreateInfo& outInfo)
@ -1437,6 +1439,10 @@ void SetAllocatorCreateInfo(VmaAllocatorCreateInfo& outInfo)
outInfo.flags |= VMA_ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT;
}
#endif
if(VK_KHR_maintenance5_enabled)
{
outInfo.flags |= VMA_ALLOCATOR_CREATE_KHR_MAINTENANCE5_BIT;
}
if(USE_CUSTOM_CPU_ALLOCATION_CALLBACKS)
{
@ -1836,6 +1842,8 @@ static void InitializeApplication()
}
else if(strcmp(physicalDeviceExtensionProperties[i].extensionName, VK_EXT_MEMORY_PRIORITY_EXTENSION_NAME) == 0)
VK_EXT_memory_priority_enabled = true;
else if(strcmp(physicalDeviceExtensionProperties[i].extensionName, VK_KHR_MAINTENANCE_5_EXTENSION_NAME) == 0)
VK_KHR_maintenance5_enabled = true;
}
if(GetVulkanApiVersion() >= VK_API_VERSION_1_2)
@ -1994,6 +2002,8 @@ static void InitializeApplication()
enabledDeviceExtensions.push_back(VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME);
if(VK_EXT_memory_priority_enabled)
enabledDeviceExtensions.push_back(VK_EXT_MEMORY_PRIORITY_EXTENSION_NAME);
if(VK_KHR_maintenance5_enabled)
enabledDeviceExtensions.push_back(VK_KHR_MAINTENANCE_5_EXTENSION_NAME);
VkPhysicalDeviceFeatures2 deviceFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2 };
deviceFeatures.features.samplerAnisotropy = VK_TRUE;