Skip to content

Commit 2446790

Browse files
Added support for Vulkan version 1.4
1 parent 5a53a19 commit 2446790

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Additional features:
4848
- Support for sparse binding and sparse residency: Convenience functions that allocate or free multiple memory pages at once.
4949
- Custom memory pools: Create a pool with desired parameters (e.g. fixed or limited maximum size) and allocate memory out of it.
5050
- 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.
51-
- Support for Vulkan 1.0, 1.1, 1.2, 1.3.
51+
- Support for Vulkan 1.0...1.4.
5252
- Support for extensions (and equivalent functionality included in new Vulkan versions):
5353
- VK_KHR_dedicated_allocation: Just enable it and it will be used automatically by the library.
5454
- VK_KHR_bind_memory2.

include/vk_mem_alloc.h

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ extern "C" {
133133
#endif
134134

135135
#if !defined(VMA_VULKAN_VERSION)
136-
#if defined(VK_VERSION_1_3)
136+
#if defined(VK_VERSION_1_4)
137+
#define VMA_VULKAN_VERSION 1004000
138+
#elif defined(VK_VERSION_1_3)
137139
#define VMA_VULKAN_VERSION 1003000
138140
#elif defined(VK_VERSION_1_2)
139141
#define VMA_VULKAN_VERSION 1002000
@@ -1121,7 +1123,7 @@ typedef struct VmaAllocatorCreateInfo
11211123

11221124
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`.
11231125
The patch version number specified is ignored. Only the major and minor versions are considered.
1124-
Only versions 1.0, 1.1, 1.2, 1.3 are supported by the current implementation.
1126+
Only versions 1.0...1.4 are supported by the current implementation.
11251127
Leaving it initialized to zero is equivalent to `VK_API_VERSION_1_0`.
11261128
It must match the Vulkan version used by the application and supported on the selected physical device,
11271129
so it must be no higher than `VkApplicationInfo::apiVersion` passed to `vkCreateInstance`
@@ -12977,23 +12979,17 @@ VmaAllocator_T::VmaAllocator_T(const VmaAllocatorCreateInfo* pCreateInfo) :
1297712979
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.");
1297812980
}
1297912981
#endif
12982+
#if VMA_VULKAN_VERSION < 1004000
12983+
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.");
12984+
#endif
1298012985
#if VMA_VULKAN_VERSION < 1003000
12981-
if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 3, 0))
12982-
{
12983-
VMA_ASSERT(0 && "vulkanApiVersion >= VK_API_VERSION_1_3 but required Vulkan version is disabled by preprocessor macros.");
12984-
}
12986+
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.");
1298512987
#endif
1298612988
#if VMA_VULKAN_VERSION < 1002000
12987-
if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 2, 0))
12988-
{
12989-
VMA_ASSERT(0 && "vulkanApiVersion >= VK_API_VERSION_1_2 but required Vulkan version is disabled by preprocessor macros.");
12990-
}
12989+
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.");
1299112990
#endif
1299212991
#if VMA_VULKAN_VERSION < 1001000
12993-
if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))
12994-
{
12995-
VMA_ASSERT(0 && "vulkanApiVersion >= VK_API_VERSION_1_1 but required Vulkan version is disabled by preprocessor macros.");
12996-
}
12992+
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.");
1299712993
#endif
1299812994
#if !(VMA_MEMORY_PRIORITY)
1299912995
if(m_UseExtMemoryPriority)

0 commit comments

Comments
 (0)