From d0353b538922675e66ca2a2d6415f57a18a68c64 Mon Sep 17 00:00:00 2001 From: YaaZ <764610@gmail.com> Date: Wed, 15 Oct 2025 20:30:30 +0200 Subject: [PATCH 1/2] Add VMA_RESULT for possible success codes --- include/vk_mem_alloc.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h index 77d41a79..d42b4731 100644 --- a/include/vk_mem_alloc.h +++ b/include/vk_mem_alloc.h @@ -273,6 +273,13 @@ extern "C" { #define VMA_EXTENDS_VK_STRUCT(vkStruct) #endif +// Define this macro to decorate the return type with possible success return codes. +// Undecorated functions are assumed to return VK_SUCCESS on success. +// Error codes are not included there. +#ifndef VMA_RESULT() + #define VMA_RESULT(...) +#endif + // Define this macro to decorate pointers with an attribute specifying the // length of the array they point to if they are not null. // @@ -2528,7 +2535,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaEndDefragmentation( - `VK_INCOMPLETE` if there are pending moves returned in `pPassInfo`. You need to perform them, call vmaEndDefragmentationPass(), and then preferably try another pass with vmaBeginDefragmentationPass(). */ -VMA_CALL_PRE VkResult VMA_CALL_POST vmaBeginDefragmentationPass( +VMA_CALL_PRE VMA_RESULT(VK_SUCCESS, VK_INCOMPLETE) VkResult VMA_CALL_POST vmaBeginDefragmentationPass( VmaAllocator VMA_NOT_NULL allocator, VmaDefragmentationContext VMA_NOT_NULL context, VmaDefragmentationPassMoveInfo* VMA_NOT_NULL pPassInfo); @@ -2551,7 +2558,7 @@ After this call: If no more moves are possible you can end whole defragmentation. */ -VMA_CALL_PRE VkResult VMA_CALL_POST vmaEndDefragmentationPass( +VMA_CALL_PRE VMA_RESULT(VK_SUCCESS, VK_INCOMPLETE) VkResult VMA_CALL_POST vmaEndDefragmentationPass( VmaAllocator VMA_NOT_NULL allocator, VmaDefragmentationContext VMA_NOT_NULL context, VmaDefragmentationPassMoveInfo* VMA_NOT_NULL pPassInfo); From a2a39f0f16547c800d1548f597d9ca17c850b096 Mon Sep 17 00:00:00 2001 From: Nikita Gubarkov <764610@gmail.com> Date: Thu, 16 Oct 2025 01:42:59 +0200 Subject: [PATCH 2/2] Fix #ifndef --- include/vk_mem_alloc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h index d42b4731..6558c23f 100644 --- a/include/vk_mem_alloc.h +++ b/include/vk_mem_alloc.h @@ -276,7 +276,7 @@ extern "C" { // Define this macro to decorate the return type with possible success return codes. // Undecorated functions are assumed to return VK_SUCCESS on success. // Error codes are not included there. -#ifndef VMA_RESULT() +#ifndef VMA_RESULT #define VMA_RESULT(...) #endif