mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2025-05-31 00:47:45 +00:00
Added test for defragmentation of empty pool.
This commit is contained in:
parent
9a4f508f88
commit
e168191f3d
1 changed files with 17 additions and 0 deletions
|
@ -1240,6 +1240,23 @@ void TestDefragmentationSimple()
|
||||||
VmaPool pool;
|
VmaPool pool;
|
||||||
ERR_GUARD_VULKAN( vmaCreatePool(g_hAllocator, &poolCreateInfo, &pool) );
|
ERR_GUARD_VULKAN( vmaCreatePool(g_hAllocator, &poolCreateInfo, &pool) );
|
||||||
|
|
||||||
|
// Defragmentation of empty pool.
|
||||||
|
{
|
||||||
|
VmaDefragmentationInfo2 defragInfo = {};
|
||||||
|
defragInfo.maxCpuBytesToMove = VK_WHOLE_SIZE;
|
||||||
|
defragInfo.maxCpuAllocationsToMove = UINT32_MAX;
|
||||||
|
defragInfo.poolCount = 1;
|
||||||
|
defragInfo.pPools = &pool;
|
||||||
|
|
||||||
|
VmaDefragmentationStats defragStats = {};
|
||||||
|
VmaDefragmentationContext defragCtx = nullptr;
|
||||||
|
VkResult res = vmaDefragmentationBegin(g_hAllocator, &defragInfo, &defragStats, &defragCtx);
|
||||||
|
TEST(res >= VK_SUCCESS);
|
||||||
|
vmaDefragmentationEnd(g_hAllocator, defragCtx);
|
||||||
|
TEST(defragStats.allocationsMoved == 0 && defragStats.bytesFreed == 0 &&
|
||||||
|
defragStats.bytesMoved == 0 && defragStats.deviceMemoryBlocksFreed == 0);
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<AllocInfo> allocations;
|
std::vector<AllocInfo> allocations;
|
||||||
|
|
||||||
// persistentlyMappedOption = 0 - not persistently mapped.
|
// persistentlyMappedOption = 0 - not persistently mapped.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue