Small fix in VmaBlock::Free (thanks @dylanede for pointing this!)

This commit is contained in:
Adam Sawicki 2017-07-11 15:25:19 +02:00
parent 7600059ae7
commit 0845f1c2e5

View File

@ -2653,11 +2653,6 @@ void VmaAllocation::FreeSuballocation(VmaSuballocationList::iterator suballocIte
void VmaAllocation::Free(const VkMappedMemoryRange* pMemory)
{
// If suballocation to free has offset smaller than half of allocation size, search forward.
// Otherwise search backward.
const bool forwardDirection = pMemory->offset < (m_Size / 2);
if(forwardDirection)
{
for(VmaSuballocationList::iterator suballocItem = m_Suballocations.begin();
suballocItem != m_Suballocations.end();
++suballocItem)
@ -2671,23 +2666,6 @@ void VmaAllocation::Free(const VkMappedMemoryRange* pMemory)
}
}
VMA_ASSERT(0 && "Not found!");
}
else
{
for(VmaSuballocationList::iterator suballocItem = m_Suballocations.begin();
suballocItem != m_Suballocations.end();
++suballocItem)
{
VmaSuballocation& suballoc = *suballocItem;
if(suballoc.offset == pMemory->offset)
{
FreeSuballocation(suballocItem);
VMA_HEAVY_ASSERT(Validate());
return;
}
}
VMA_ASSERT(0 && "Not found!");
}
}
#if VMA_STATS_STRING_ENABLED