From f828262f433896c09d7bcaf0c0674136b665143a Mon Sep 17 00:00:00 2001 From: Adam Sawicki Date: Fri, 4 Mar 2022 14:24:29 +0100 Subject: [PATCH] Changed vmaEndDefragmentation to return void (somewhat compatibility breaking) It couldn't fail anyway. --- include/vk_mem_alloc.h | 5 ++--- src/Tests.cpp | 18 ++++++------------ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h index b415e78..a841483 100644 --- a/include/vk_mem_alloc.h +++ b/include/vk_mem_alloc.h @@ -2152,7 +2152,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaBeginDefragmentation( Use this function to finish defragmentation started by vmaBeginDefragmentation(). */ -VMA_CALL_PRE VkResult VMA_CALL_POST vmaEndDefragmentation( +VMA_CALL_PRE void VMA_CALL_POST vmaEndDefragmentation( VmaAllocator VMA_NOT_NULL allocator, VmaDefragmentationContext VMA_NOT_NULL context, VmaDefragmentationStats* VMA_NULLABLE pStats); @@ -16860,7 +16860,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaBeginDefragmentation( return VK_SUCCESS; } -VMA_CALL_PRE VkResult VMA_CALL_POST vmaEndDefragmentation( +VMA_CALL_PRE void VMA_CALL_POST vmaEndDefragmentation( VmaAllocator allocator, VmaDefragmentationContext context, VmaDefragmentationStats* pStats) @@ -16874,7 +16874,6 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaEndDefragmentation( if (pStats) context->GetStats(*pStats); vma_delete(allocator, context); - return VK_SUCCESS; } VMA_CALL_PRE VkResult VMA_CALL_POST vmaBeginDefragmentationPass( diff --git a/src/Tests.cpp b/src/Tests.cpp index 5467f8c..26e0323 100644 --- a/src/Tests.cpp +++ b/src/Tests.cpp @@ -1642,8 +1642,7 @@ static void Defragment(VmaDefragmentationInfo& defragmentationInfo, } TEST(res == VK_SUCCESS); - res = vmaEndDefragmentation(g_hAllocator, defragCtx, defragmentationStats); - TEST(res == VK_SUCCESS); + vmaEndDefragmentation(g_hAllocator, defragCtx, defragmentationStats); } static void ValidateAllocationsData(const AllocInfo* allocs, size_t allocCount) @@ -1703,8 +1702,7 @@ void TestDefragmentationSimple() TEST(res == VK_SUCCESS); VmaDefragmentationStats defragStats = {}; - res = vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats); - TEST(res == VK_SUCCESS); + vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats); TEST(defragStats.allocationsMoved == 0 && defragStats.bytesFreed == 0 && defragStats.bytesMoved == 0 && defragStats.deviceMemoryBlocksFreed == 0); } @@ -1818,8 +1816,7 @@ void TestDefragmentationSimple() } VmaDefragmentationStats defragStats = {}; - res = vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats); - TEST(res == VK_SUCCESS); + vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats); TEST(defragStats.allocationsMoved == 4 && defragStats.bytesMoved == 4 * BUF_SIZE); ValidateAllocationsData(allocations.data(), allocations.size()); @@ -1916,8 +1913,7 @@ void TestDefragmentationSimple() TEST(res == VK_SUCCESS); VmaDefragmentationStats defragStats; - res = vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats); - TEST(res == VK_SUCCESS); + vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats); ValidateAllocationsData(allocations.data(), allocations.size()); DestroyAllAllocations(allocations); @@ -2117,8 +2113,7 @@ void TestDefragmentationAlgorithms() TEST(res == VK_SUCCESS); VmaDefragmentationStats defragStats; - res = vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats); - TEST(res == VK_SUCCESS); + vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats); SaveAllocatorStatsToFile((output + L"_After.json").c_str()); ValidateAllocationsData(allocations.data(), allocations.size()); @@ -5029,8 +5024,7 @@ static void TestPool_SameSize() TEST(res == VK_SUCCESS); VmaDefragmentationStats defragmentationStats; - res = vmaEndDefragmentation(g_hAllocator, defragCtx, &defragmentationStats); - TEST(res == VK_SUCCESS); + vmaEndDefragmentation(g_hAllocator, defragCtx, &defragmentationStats); TEST(defragmentationStats.allocationsMoved == 24); }