mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
synced 2024-11-05 12:20:07 +00:00
Fixed algorithm in VmaBlockMetadata_TLSF::CreateAllocationRequest
Code by @medranSolus
This commit is contained in:
parent
c161ba93d5
commit
ab134958f5
@ -9928,12 +9928,15 @@ bool VmaBlockMetadata_TLSF::CreateAllocationRequest(
|
|||||||
|
|
||||||
// Round up to the next block
|
// Round up to the next block
|
||||||
VkDeviceSize sizeForNextList = allocSize;
|
VkDeviceSize sizeForNextList = allocSize;
|
||||||
if (allocSize >= (1 << SECOND_LEVEL_INDEX))
|
VkDeviceSize smallSizeStep = SMALL_BUFFER_SIZE / (IsVirtual() ? 1 << SECOND_LEVEL_INDEX : 4);
|
||||||
|
if (allocSize > SMALL_BUFFER_SIZE)
|
||||||
{
|
{
|
||||||
sizeForNextList += (1ULL << (VMA_BITSCAN_MSB(allocSize) - SECOND_LEVEL_INDEX)) - 1;
|
sizeForNextList += (1ULL << (VMA_BITSCAN_MSB(allocSize) - SECOND_LEVEL_INDEX));
|
||||||
}
|
}
|
||||||
|
else if (allocSize > SMALL_BUFFER_SIZE - smallSizeStep)
|
||||||
|
sizeForNextList = SMALL_BUFFER_SIZE + 1;
|
||||||
else
|
else
|
||||||
sizeForNextList += (1 << SECOND_LEVEL_INDEX) - 1;
|
sizeForNextList += smallSizeStep;
|
||||||
|
|
||||||
uint32_t nextListIndex = 0;
|
uint32_t nextListIndex = 0;
|
||||||
uint32_t prevListIndex = 0;
|
uint32_t prevListIndex = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user