Skip to content

Commit f828262

Browse files
Changed vmaEndDefragmentation to return void (somewhat compatibility breaking)
It couldn't fail anyway.
1 parent b142708 commit f828262

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

include/vk_mem_alloc.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2152,7 +2152,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaBeginDefragmentation(
21522152

21532153
Use this function to finish defragmentation started by vmaBeginDefragmentation().
21542154
*/
2155-
VMA_CALL_PRE VkResult VMA_CALL_POST vmaEndDefragmentation(
2155+
VMA_CALL_PRE void VMA_CALL_POST vmaEndDefragmentation(
21562156
VmaAllocator VMA_NOT_NULL allocator,
21572157
VmaDefragmentationContext VMA_NOT_NULL context,
21582158
VmaDefragmentationStats* VMA_NULLABLE pStats);
@@ -16860,7 +16860,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaBeginDefragmentation(
1686016860
return VK_SUCCESS;
1686116861
}
1686216862

16863-
VMA_CALL_PRE VkResult VMA_CALL_POST vmaEndDefragmentation(
16863+
VMA_CALL_PRE void VMA_CALL_POST vmaEndDefragmentation(
1686416864
VmaAllocator allocator,
1686516865
VmaDefragmentationContext context,
1686616866
VmaDefragmentationStats* pStats)
@@ -16874,7 +16874,6 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaEndDefragmentation(
1687416874
if (pStats)
1687516875
context->GetStats(*pStats);
1687616876
vma_delete(allocator, context);
16877-
return VK_SUCCESS;
1687816877
}
1687916878

1688016879
VMA_CALL_PRE VkResult VMA_CALL_POST vmaBeginDefragmentationPass(

src/Tests.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,8 +1642,7 @@ static void Defragment(VmaDefragmentationInfo& defragmentationInfo,
16421642
}
16431643
TEST(res == VK_SUCCESS);
16441644

1645-
res = vmaEndDefragmentation(g_hAllocator, defragCtx, defragmentationStats);
1646-
TEST(res == VK_SUCCESS);
1645+
vmaEndDefragmentation(g_hAllocator, defragCtx, defragmentationStats);
16471646
}
16481647

16491648
static void ValidateAllocationsData(const AllocInfo* allocs, size_t allocCount)
@@ -1703,8 +1702,7 @@ void TestDefragmentationSimple()
17031702
TEST(res == VK_SUCCESS);
17041703

17051704
VmaDefragmentationStats defragStats = {};
1706-
res = vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats);
1707-
TEST(res == VK_SUCCESS);
1705+
vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats);
17081706
TEST(defragStats.allocationsMoved == 0 && defragStats.bytesFreed == 0 &&
17091707
defragStats.bytesMoved == 0 && defragStats.deviceMemoryBlocksFreed == 0);
17101708
}
@@ -1818,8 +1816,7 @@ void TestDefragmentationSimple()
18181816
}
18191817

18201818
VmaDefragmentationStats defragStats = {};
1821-
res = vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats);
1822-
TEST(res == VK_SUCCESS);
1819+
vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats);
18231820
TEST(defragStats.allocationsMoved == 4 && defragStats.bytesMoved == 4 * BUF_SIZE);
18241821

18251822
ValidateAllocationsData(allocations.data(), allocations.size());
@@ -1916,8 +1913,7 @@ void TestDefragmentationSimple()
19161913
TEST(res == VK_SUCCESS);
19171914

19181915
VmaDefragmentationStats defragStats;
1919-
res = vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats);
1920-
TEST(res == VK_SUCCESS);
1916+
vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats);
19211917

19221918
ValidateAllocationsData(allocations.data(), allocations.size());
19231919
DestroyAllAllocations(allocations);
@@ -2117,8 +2113,7 @@ void TestDefragmentationAlgorithms()
21172113
TEST(res == VK_SUCCESS);
21182114

21192115
VmaDefragmentationStats defragStats;
2120-
res = vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats);
2121-
TEST(res == VK_SUCCESS);
2116+
vmaEndDefragmentation(g_hAllocator, defragCtx, &defragStats);
21222117

21232118
SaveAllocatorStatsToFile((output + L"_After.json").c_str());
21242119
ValidateAllocationsData(allocations.data(), allocations.size());
@@ -5029,8 +5024,7 @@ static void TestPool_SameSize()
50295024
TEST(res == VK_SUCCESS);
50305025

50315026
VmaDefragmentationStats defragmentationStats;
5032-
res = vmaEndDefragmentation(g_hAllocator, defragCtx, &defragmentationStats);
5033-
TEST(res == VK_SUCCESS);
5027+
vmaEndDefragmentation(g_hAllocator, defragCtx, &defragmentationStats);
50345028
TEST(defragmentationStats.allocationsMoved == 24);
50355029
}
50365030

0 commit comments

Comments
 (0)