From 2446790ae6f35c5493f3588a13fcc0d678b531ab Mon Sep 17 00:00:00 2001 From: Adam Sawicki Date: Wed, 11 Dec 2024 15:13:25 +0100 Subject: [PATCH] Added support for Vulkan version 1.4 --- README.md | 2 +- include/vk_mem_alloc.h | 24 ++++++++++-------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 156cb1c0..d6fc6404 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Additional features: - Support for sparse binding and sparse residency: Convenience functions that allocate or free multiple memory pages at once. - Custom memory pools: Create a pool with desired parameters (e.g. fixed or limited maximum size) and allocate memory out of it. - Linear allocator: Create a pool with linear algorithm and use it for much faster allocations and deallocations in free-at-once, stack, double stack, or ring buffer fashion. -- Support for Vulkan 1.0, 1.1, 1.2, 1.3. +- Support for Vulkan 1.0...1.4. - Support for extensions (and equivalent functionality included in new Vulkan versions): - VK_KHR_dedicated_allocation: Just enable it and it will be used automatically by the library. - VK_KHR_bind_memory2. diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h index 39f6ef34..66d7220e 100644 --- a/include/vk_mem_alloc.h +++ b/include/vk_mem_alloc.h @@ -133,7 +133,9 @@ extern "C" { #endif #if !defined(VMA_VULKAN_VERSION) - #if defined(VK_VERSION_1_3) + #if defined(VK_VERSION_1_4) + #define VMA_VULKAN_VERSION 1004000 + #elif defined(VK_VERSION_1_3) #define VMA_VULKAN_VERSION 1003000 #elif defined(VK_VERSION_1_2) #define VMA_VULKAN_VERSION 1002000 @@ -1121,7 +1123,7 @@ typedef struct VmaAllocatorCreateInfo It must be a value in the format as created by macro `VK_MAKE_VERSION` or a constant like: `VK_API_VERSION_1_1`, `VK_API_VERSION_1_0`. The patch version number specified is ignored. Only the major and minor versions are considered. - Only versions 1.0, 1.1, 1.2, 1.3 are supported by the current implementation. + Only versions 1.0...1.4 are supported by the current implementation. Leaving it initialized to zero is equivalent to `VK_API_VERSION_1_0`. It must match the Vulkan version used by the application and supported on the selected physical device, so it must be no higher than `VkApplicationInfo::apiVersion` passed to `vkCreateInstance` @@ -12977,23 +12979,17 @@ VmaAllocator_T::VmaAllocator_T(const VmaAllocatorCreateInfo* pCreateInfo) : VMA_ASSERT(0 && "VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT is set but required extension or Vulkan 1.2 is not available in your Vulkan header or its support in VMA has been disabled by a preprocessor macro."); } #endif +#if VMA_VULKAN_VERSION < 1004000 + VMA_ASSERT(m_VulkanApiVersion < VK_MAKE_VERSION(1, 4, 0) && "vulkanApiVersion >= VK_API_VERSION_1_4 but required Vulkan version is disabled by preprocessor macros."); +#endif #if VMA_VULKAN_VERSION < 1003000 - if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 3, 0)) - { - VMA_ASSERT(0 && "vulkanApiVersion >= VK_API_VERSION_1_3 but required Vulkan version is disabled by preprocessor macros."); - } + VMA_ASSERT(m_VulkanApiVersion < VK_MAKE_VERSION(1, 3, 0) && "vulkanApiVersion >= VK_API_VERSION_1_3 but required Vulkan version is disabled by preprocessor macros."); #endif #if VMA_VULKAN_VERSION < 1002000 - if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 2, 0)) - { - VMA_ASSERT(0 && "vulkanApiVersion >= VK_API_VERSION_1_2 but required Vulkan version is disabled by preprocessor macros."); - } + VMA_ASSERT(m_VulkanApiVersion < VK_MAKE_VERSION(1, 2, 0) && "vulkanApiVersion >= VK_API_VERSION_1_2 but required Vulkan version is disabled by preprocessor macros."); #endif #if VMA_VULKAN_VERSION < 1001000 - if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0)) - { - VMA_ASSERT(0 && "vulkanApiVersion >= VK_API_VERSION_1_1 but required Vulkan version is disabled by preprocessor macros."); - } + VMA_ASSERT(m_VulkanApiVersion < VK_MAKE_VERSION(1, 1, 0) && "vulkanApiVersion >= VK_API_VERSION_1_1 but required Vulkan version is disabled by preprocessor macros."); #endif #if !(VMA_MEMORY_PRIORITY) if(m_UseExtMemoryPriority)