From ca5ce7df2333d7523a4e74ed17adb7cc7f0fe2cf Mon Sep 17 00:00:00 2001 From: Robin Quint Date: Fri, 30 Jun 2023 17:39:36 +0200 Subject: [PATCH 1/2] Added VMA_EXTENDS_VK_STRUCT --- include/vk_mem_alloc.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h index a094898..97291dc 100644 --- a/include/vk_mem_alloc.h +++ b/include/vk_mem_alloc.h @@ -234,6 +234,10 @@ extern "C" { #define VMA_CALL_POST #endif +#ifndef VMA_EXTENDS_VK_STRUCT + #define VMA_EXTENDS_VK_STRUCT(vkStruct) +#endif + // Define this macro to decorate pointers with an attribute specifying the // length of the array they point to if they are not null. // @@ -1319,7 +1323,7 @@ typedef struct VmaPoolCreateInfo Please note that some structures, e.g. `VkMemoryPriorityAllocateInfoEXT`, `VkMemoryDedicatedAllocateInfoKHR`, can be attached automatically by this library when using other, more convenient of its features. */ - void* VMA_NULLABLE pMemoryAllocateNext; + void* VMA_NULLABLE VMA_EXTENDS_VK_STRUCT(VkMemoryAllocateInfo) pMemoryAllocateNext; } VmaPoolCreateInfo; /** @} */ @@ -2227,7 +2231,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindBufferMemory2( VmaAllocation VMA_NOT_NULL allocation, VkDeviceSize allocationLocalOffset, VkBuffer VMA_NOT_NULL_NON_DISPATCHABLE buffer, - const void* VMA_NULLABLE pNext); + const void* VMA_NULLABLE VMA_EXTENDS_VK_STRUCT(VkBindBufferMemoryInfoKHR) pNext); /** \brief Binds image to allocation. @@ -2264,7 +2268,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindImageMemory2( VmaAllocation VMA_NOT_NULL allocation, VkDeviceSize allocationLocalOffset, VkImage VMA_NOT_NULL_NON_DISPATCHABLE image, - const void* VMA_NULLABLE pNext); + const void* VMA_NULLABLE VMA_EXTENDS_VK_STRUCT(VkBindImageMemoryInfoKHR) pNext); /** \brief Creates a new `VkBuffer`, allocates and binds memory for it. From 1d0e8ba3b3888966c4f40664ad7978bbd9b71958 Mon Sep 17 00:00:00 2001 From: Robin Quint Date: Fri, 30 Jun 2023 17:42:12 +0200 Subject: [PATCH 2/2] Added small documentation --- include/vk_mem_alloc.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h index 97291dc..fbe4f13 100644 --- a/include/vk_mem_alloc.h +++ b/include/vk_mem_alloc.h @@ -234,6 +234,8 @@ extern "C" { #define VMA_CALL_POST #endif +// Define this macro to decorate pNext pointers with an attribute specifying the Vulkan +// structure that will be extended via the pNext chain. #ifndef VMA_EXTENDS_VK_STRUCT #define VMA_EXTENDS_VK_STRUCT(vkStruct) #endif