File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1240,6 +1240,23 @@ void TestDefragmentationSimple()
12401240 VmaPool pool;
12411241 ERR_GUARD_VULKAN ( vmaCreatePool (g_hAllocator, &poolCreateInfo, &pool) );
12421242
1243+ // Defragmentation of empty pool.
1244+ {
1245+ VmaDefragmentationInfo2 defragInfo = {};
1246+ defragInfo.maxCpuBytesToMove = VK_WHOLE_SIZE;
1247+ defragInfo.maxCpuAllocationsToMove = UINT32_MAX;
1248+ defragInfo.poolCount = 1 ;
1249+ defragInfo.pPools = &pool;
1250+
1251+ VmaDefragmentationStats defragStats = {};
1252+ VmaDefragmentationContext defragCtx = nullptr ;
1253+ VkResult res = vmaDefragmentationBegin (g_hAllocator, &defragInfo, &defragStats, &defragCtx);
1254+ TEST (res >= VK_SUCCESS);
1255+ vmaDefragmentationEnd (g_hAllocator, defragCtx);
1256+ TEST (defragStats.allocationsMoved == 0 && defragStats.bytesFreed == 0 &&
1257+ defragStats.bytesMoved == 0 && defragStats.deviceMemoryBlocksFreed == 0 );
1258+ }
1259+
12431260 std::vector<AllocInfo> allocations;
12441261
12451262 // persistentlyMappedOption = 0 - not persistently mapped.
You can’t perform that action at this time.
0 commit comments