mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2025-05-29 07:59:17 +00:00
VmaDefragmentationAlgorithm_Fast: Added support for memmove() of overlapping memory regions when defragmenting on CPU.
This commit is contained in:
parent
e168191f3d
commit
647cf24b7f
2 changed files with 56 additions and 15 deletions
|
@ -1375,6 +1375,30 @@ void TestDefragmentationSimple()
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Allocation that must be move to an overlapping place using memmove().
|
||||
Create 2 buffers, second slightly bigger than the first. Delete first. Then defragment.
|
||||
*/
|
||||
{
|
||||
AllocInfo allocInfo[2];
|
||||
|
||||
bufCreateInfo.size = BUF_SIZE;
|
||||
CreateBuffer(pool, bufCreateInfo, false, allocInfo[0]);
|
||||
const VkDeviceSize biggerBufSize = BUF_SIZE + BUF_SIZE / 256;
|
||||
bufCreateInfo.size = biggerBufSize;
|
||||
CreateBuffer(pool, bufCreateInfo, false, allocInfo[1]);
|
||||
|
||||
DestroyAllocation(allocInfo[0]);
|
||||
|
||||
VmaDefragmentationStats defragStats;
|
||||
Defragment(&allocInfo[1], 1, nullptr, &defragStats);
|
||||
// If this fails, it means we couldn't do memmove with overlapping regions.
|
||||
TEST(defragStats.allocationsMoved == 1 && defragStats.bytesMoved > 0);
|
||||
|
||||
ValidateAllocationsData(&allocInfo[1], 1);
|
||||
DestroyAllocation(allocInfo[1]);
|
||||
}
|
||||
|
||||
vmaDestroyPool(g_hAllocator, pool);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue