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().
*/
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(

View File

@ -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);
}