mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-30 02:04:35 +00:00
Small fix in VmaBlock::Free (thanks @dylanede for pointing this!)
This commit is contained in:
parent
a59788d60d
commit
f30ee85a15
@ -3146,12 +3146,7 @@ void VmaBlock::FreeSuballocation(VmaSuballocationList::iterator suballocItem)
|
|||||||
|
|
||||||
void VmaBlock::Free(const VmaAllocation allocation)
|
void VmaBlock::Free(const VmaAllocation allocation)
|
||||||
{
|
{
|
||||||
// If suballocation to free has offset smaller than half of allocation size, search forward.
|
|
||||||
// Otherwise search backward.
|
|
||||||
const VkDeviceSize allocationOffset = allocation->GetOffset();
|
const VkDeviceSize allocationOffset = allocation->GetOffset();
|
||||||
const bool forwardDirection = allocationOffset < (m_Size / 2);
|
|
||||||
if(forwardDirection)
|
|
||||||
{
|
|
||||||
for(VmaSuballocationList::iterator suballocItem = m_Suballocations.begin();
|
for(VmaSuballocationList::iterator suballocItem = m_Suballocations.begin();
|
||||||
suballocItem != m_Suballocations.end();
|
suballocItem != m_Suballocations.end();
|
||||||
++suballocItem)
|
++suballocItem)
|
||||||
@ -3165,23 +3160,6 @@ void VmaBlock::Free(const VmaAllocation allocation)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
VMA_ASSERT(0 && "Not found!");
|
VMA_ASSERT(0 && "Not found!");
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for(VmaSuballocationList::iterator suballocItem = m_Suballocations.begin();
|
|
||||||
suballocItem != m_Suballocations.end();
|
|
||||||
++suballocItem)
|
|
||||||
{
|
|
||||||
VmaSuballocation& suballoc = *suballocItem;
|
|
||||||
if(suballoc.offset == allocationOffset)
|
|
||||||
{
|
|
||||||
FreeSuballocation(suballocItem);
|
|
||||||
VMA_HEAVY_ASSERT(Validate());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
VMA_ASSERT(0 && "Not found!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if VMA_STATS_STRING_ENABLED
|
#if VMA_STATS_STRING_ENABLED
|
||||||
|
Loading…
Reference in New Issue
Block a user