Merge branch 'Vulkan1_2'
diff --git a/README.md b/README.md
index 8e5d1c0..d2cf3df 100644
--- a/README.md
+++ b/README.md
@@ -46,7 +46,7 @@
- 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 as well as 1.1.
+- Support for Vulkan 1.0, 1.1, 1.2.
- Support for VK_KHR_dedicated_allocation extension: Just enable it and it will be used automatically by the library.
- Support for VK_AMD_device_coherent_memory extension.
- Defragmentation of GPU and CPU memory: Let the library move data around to free some memory blocks and make your allocations better compacted.
diff --git a/src/VmaUsage.h b/src/VmaUsage.h
index bec7ac7..9adcdc9 100644
--- a/src/VmaUsage.h
+++ b/src/VmaUsage.h
@@ -59,6 +59,7 @@
//#define VMA_DEBUG_GLOBAL_MUTEX 1
//#define VMA_MEMORY_BUDGET 0
+//#define VMA_VULKAN_VERSION 1002000 // Vulkan 1.2
#define VMA_VULKAN_VERSION 1001000 // Vulkan 1.1
//#define VMA_VULKAN_VERSION 1000000 // Vulkan 1.0
@@ -95,4 +96,4 @@
#pragma warning(pop)
#endif
-#endif
\ No newline at end of file
+#endif
diff --git a/src/VulkanSample.cpp b/src/VulkanSample.cpp
index 7b6774f..819bd12 100644
--- a/src/VulkanSample.cpp
+++ b/src/VulkanSample.cpp
@@ -32,8 +32,8 @@
static const char* const SHADER_PATH2 = "../bin/";
static const wchar_t* const WINDOW_CLASS_NAME = L"VULKAN_MEMORY_ALLOCATOR_SAMPLE";
static const char* const VALIDATION_LAYER_NAME = "VK_LAYER_LUNARG_standard_validation";
-static const char* const APP_TITLE_A = "Vulkan Memory Allocator Sample 2.3.0";
-static const wchar_t* const APP_TITLE_W = L"Vulkan Memory Allocator Sample 2.3.0";
+static const char* const APP_TITLE_A = "Vulkan Memory Allocator Sample 2.4.0";
+static const wchar_t* const APP_TITLE_W = L"Vulkan Memory Allocator Sample 2.4.0";
static const bool VSYNC = true;
static const uint32_t COMMAND_BUFFER_COUNT = 2;
@@ -1118,7 +1118,16 @@
static constexpr uint32_t GetVulkanApiVersion()
{
- return VMA_VULKAN_VERSION == 1001000 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0;
+#if VMA_VULKAN_VERSION == 1002000
+ return VK_API_VERSION_1_2;
+#elif VMA_VULKAN_VERSION == 1001000
+ return VK_API_VERSION_1_1;
+#elif VMA_VULKAN_VERSION == 1000000
+ return VK_API_VERSION_1_0;
+#else
+ #error Invalid VMA_VULKAN_VERSION.
+ return UINT32_MAX;
+#endif
}
void SetAllocatorCreateInfo(VmaAllocatorCreateInfo& outInfo)
diff --git a/src/vk_mem_alloc.h b/src/vk_mem_alloc.h
index 267485f..39ddb08 100644
--- a/src/vk_mem_alloc.h
+++ b/src/vk_mem_alloc.h
@@ -1843,7 +1843,9 @@
// where AAA = major, BBB = minor, CCC = patch.
// If you want to use version > 1.0, it still needs to be enabled via VmaAllocatorCreateInfo::vulkanApiVersion.
#if !defined(VMA_VULKAN_VERSION)
- #if defined(VK_VERSION_1_1)
+ #if defined(VK_VERSION_1_2)
+ #define VMA_VULKAN_VERSION 1002000
+ #elif defined(VK_VERSION_1_1)
#define VMA_VULKAN_VERSION 1001000
#else
#define VMA_VULKAN_VERSION 1000000
@@ -15032,6 +15034,12 @@
VMA_ASSERT(0 && "VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT set but required extension 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.");
+ }
+#endif
#if VMA_VULKAN_VERSION < 1001000
if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))
{
@@ -16838,7 +16846,7 @@
{
VMA_ASSERT(pCreateInfo && pAllocator);
VMA_ASSERT(pCreateInfo->vulkanApiVersion == 0 ||
- (VK_VERSION_MAJOR(pCreateInfo->vulkanApiVersion) == 1 && VK_VERSION_MINOR(pCreateInfo->vulkanApiVersion) <= 1));
+ (VK_VERSION_MAJOR(pCreateInfo->vulkanApiVersion) == 1 && VK_VERSION_MINOR(pCreateInfo->vulkanApiVersion) <= 2));
VMA_DEBUG_LOG("vmaCreateAllocator");
*pAllocator = vma_new(pCreateInfo->pAllocationCallbacks, VmaAllocator_T)(pCreateInfo);
return (*pAllocator)->Init(pCreateInfo);