VmaBlockMetadata_Buddy: Introduced concept of m_UsableSize to always use powers of two even when memory block size is not.

This commit is contained in:
Adam Sawicki 2018-09-21 14:07:02 +02:00
parent a79d2746f1
commit d6e6d6bdf2
2 changed files with 58 additions and 35 deletions

View file

@ -4125,7 +4125,8 @@ static void BasicTestBuddyAllocator()
VkResult res = vmaFindMemoryTypeIndexForBufferInfo(g_hAllocator, &sampleBufCreateInfo, &sampleAllocCreateInfo, &poolCreateInfo.memoryTypeIndex);
assert(res == VK_SUCCESS);
poolCreateInfo.blockSize = 1024 * 1024;
// Deliberately adding 1023 to test usable size smaller than memory block size.
poolCreateInfo.blockSize = 1024 * 1024 + 1023;
poolCreateInfo.flags = VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT;
//poolCreateInfo.minBlockCount = poolCreateInfo.maxBlockCount = 1;
@ -4160,7 +4161,6 @@ static void BasicTestBuddyAllocator()
assert(res == VK_SUCCESS);
bufInfo.push_back(newBufInfo);
VmaPoolStats stats = {};
vmaGetPoolStats(g_hAllocator, pool, &stats);
int DBG = 0; // Set breakpoint here to inspect `stats`.