Changed vmaEndDefragmentation to return void (somewhat compatibility breaking)

It couldn't fail anyway.
This commit is contained in:
Adam Sawicki 2022-03-04 14:24:29 +01:00
parent b1427085f3
commit f828262f43
2 changed files with 8 additions and 15 deletions

View File

@ -2152,7 +2152,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaBeginDefragmentation(
Use this function to finish defragmentation started by 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, VmaAllocator VMA_NOT_NULL allocator,
VmaDefragmentationContext VMA_NOT_NULL context, VmaDefragmentationContext VMA_NOT_NULL context,
VmaDefragmentationStats* VMA_NULLABLE pStats); VmaDefragmentationStats* VMA_NULLABLE pStats);
@ -16860,7 +16860,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaBeginDefragmentation(
return VK_SUCCESS; return VK_SUCCESS;
} }
VMA_CALL_PRE VkResult VMA_CALL_POST vmaEndDefragmentation( VMA_CALL_PRE void VMA_CALL_POST vmaEndDefragmentation(
VmaAllocator allocator, VmaAllocator allocator,
VmaDefragmentationContext context, VmaDefragmentationContext context,
VmaDefragmentationStats* pStats) VmaDefragmentationStats* pStats)
@ -16874,7 +16874,6 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaEndDefragmentation(
if (pStats) if (pStats)
context->GetStats(*pStats); context->GetStats(*pStats);
vma_delete(allocator, context); vma_delete(allocator, context);
return VK_SUCCESS;
} }
VMA_CALL_PRE VkResult VMA_CALL_POST vmaBeginDefragmentationPass( VMA_CALL_PRE VkResult VMA_CALL_POST vmaBeginDefragmentationPass(

View File

@ -1642,8 +1642,7 @@ static void Defragment(VmaDefragmentationInfo& defragmentationInfo,
} }
TEST(res == VK_SUCCESS); TEST(res == VK_SUCCESS);
res = vmaEndDefragmentation(g_hAllocator, defragCtx, defragmentationStats); vmaEndDefragmentation(g_hAllocator, defragCtx, defragmentationStats);
TEST(res == VK_SUCCESS);
} }
static void ValidateAllocationsData(const AllocInfo* allocs, size_t allocCount) static void ValidateAllocationsData(const AllocInfo* allocs, size_t allocCount)
@ -1703,8 +1702,7 @@ void TestDefragmentationSimple()
TEST(res == VK_SUCCESS); TEST(res == VK_SUCCESS);
VmaDefragmentationStats defragStats = {}; VmaDefragmentationStats defragStats = {};
res = vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats); vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats);
TEST(res == VK_SUCCESS);
TEST(defragStats.allocationsMoved == 0 && defragStats.bytesFreed == 0 && TEST(defragStats.allocationsMoved == 0 && defragStats.bytesFreed == 0 &&
defragStats.bytesMoved == 0 && defragStats.deviceMemoryBlocksFreed == 0); defragStats.bytesMoved == 0 && defragStats.deviceMemoryBlocksFreed == 0);
} }
@ -1818,8 +1816,7 @@ void TestDefragmentationSimple()
} }
VmaDefragmentationStats defragStats = {}; VmaDefragmentationStats defragStats = {};
res = vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats); vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats);
TEST(res == VK_SUCCESS);
TEST(defragStats.allocationsMoved == 4 && defragStats.bytesMoved == 4 * BUF_SIZE); TEST(defragStats.allocationsMoved == 4 && defragStats.bytesMoved == 4 * BUF_SIZE);
ValidateAllocationsData(allocations.data(), allocations.size()); ValidateAllocationsData(allocations.data(), allocations.size());
@ -1916,8 +1913,7 @@ void TestDefragmentationSimple()
TEST(res == VK_SUCCESS); TEST(res == VK_SUCCESS);
VmaDefragmentationStats defragStats; VmaDefragmentationStats defragStats;
res = vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats); vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats);
TEST(res == VK_SUCCESS);
ValidateAllocationsData(allocations.data(), allocations.size()); ValidateAllocationsData(allocations.data(), allocations.size());
DestroyAllAllocations(allocations); DestroyAllAllocations(allocations);
@ -2117,8 +2113,7 @@ void TestDefragmentationAlgorithms()
TEST(res == VK_SUCCESS); TEST(res == VK_SUCCESS);
VmaDefragmentationStats defragStats; VmaDefragmentationStats defragStats;
res = vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats); vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats);
TEST(res == VK_SUCCESS);
SaveAllocatorStatsToFile((output + L"_After.json").c_str()); SaveAllocatorStatsToFile((output + L"_After.json").c_str());
ValidateAllocationsData(allocations.data(), allocations.size()); ValidateAllocationsData(allocations.data(), allocations.size());
@ -5029,8 +5024,7 @@ static void TestPool_SameSize()
TEST(res == VK_SUCCESS); TEST(res == VK_SUCCESS);
VmaDefragmentationStats defragmentationStats; VmaDefragmentationStats defragmentationStats;
res = vmaEndDefragmentation(g_hAllocator, defragCtx, &defragmentationStats); vmaEndDefragmentation(g_hAllocator, defragCtx, &defragmentationStats);
TEST(res == VK_SUCCESS);
TEST(defragmentationStats.allocationsMoved == 24); TEST(defragmentationStats.allocationsMoved == 24);
} }