Skip to content

Commit 1f38a49

Browse files
Merge pull request #347 from Rob2309/extends-marker
Add attribute to mark pNext pointers with the Vulkan struct they extend
2 parents 0aa3989 + 1d0e8ba commit 1f38a49

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

include/vk_mem_alloc.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,12 @@ extern "C" {
234234
#define VMA_CALL_POST
235235
#endif
236236

237+
// Define this macro to decorate pNext pointers with an attribute specifying the Vulkan
238+
// structure that will be extended via the pNext chain.
239+
#ifndef VMA_EXTENDS_VK_STRUCT
240+
#define VMA_EXTENDS_VK_STRUCT(vkStruct)
241+
#endif
242+
237243
// Define this macro to decorate pointers with an attribute specifying the
238244
// length of the array they point to if they are not null.
239245
//
@@ -1319,7 +1325,7 @@ typedef struct VmaPoolCreateInfo
13191325
Please note that some structures, e.g. `VkMemoryPriorityAllocateInfoEXT`, `VkMemoryDedicatedAllocateInfoKHR`,
13201326
can be attached automatically by this library when using other, more convenient of its features.
13211327
*/
1322-
void* VMA_NULLABLE pMemoryAllocateNext;
1328+
void* VMA_NULLABLE VMA_EXTENDS_VK_STRUCT(VkMemoryAllocateInfo) pMemoryAllocateNext;
13231329
} VmaPoolCreateInfo;
13241330

13251331
/** @} */
@@ -2227,7 +2233,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindBufferMemory2(
22272233
VmaAllocation VMA_NOT_NULL allocation,
22282234
VkDeviceSize allocationLocalOffset,
22292235
VkBuffer VMA_NOT_NULL_NON_DISPATCHABLE buffer,
2230-
const void* VMA_NULLABLE pNext);
2236+
const void* VMA_NULLABLE VMA_EXTENDS_VK_STRUCT(VkBindBufferMemoryInfoKHR) pNext);
22312237

22322238
/** \brief Binds image to allocation.
22332239

@@ -2264,7 +2270,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindImageMemory2(
22642270
VmaAllocation VMA_NOT_NULL allocation,
22652271
VkDeviceSize allocationLocalOffset,
22662272
VkImage VMA_NOT_NULL_NON_DISPATCHABLE image,
2267-
const void* VMA_NULLABLE pNext);
2273+
const void* VMA_NULLABLE VMA_EXTENDS_VK_STRUCT(VkBindImageMemoryInfoKHR) pNext);
22682274

22692275
/** \brief Creates a new `VkBuffer`, allocates and binds memory for it.
22702276

0 commit comments

Comments
 (0)