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

@ -2652,11 +2652,6 @@ void VmaAllocation::FreeSuballocation(VmaSuballocationList::iterator suballocIte
} }
void VmaAllocation::Free(const VkMappedMemoryRange* pMemory) 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(); for(VmaSuballocationList::iterator suballocItem = m_Suballocations.begin();
suballocItem != m_Suballocations.end(); suballocItem != m_Suballocations.end();
@ -2672,23 +2667,6 @@ void VmaAllocation::Free(const VkMappedMemoryRange* pMemory)
} }
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 == pMemory->offset)
{
FreeSuballocation(suballocItem);
VMA_HEAVY_ASSERT(Validate());
return;
}
}
VMA_ASSERT(0 && "Not found!");
}
}
#if VMA_STATS_STRING_ENABLED #if VMA_STATS_STRING_ENABLED