Fixing logic of VmaDefragmentationAlgorithm_Fast::PostprocessMetadata broken by #201

Closes #202
This commit is contained in:
Adam Sawicki 2021-10-21 13:37:10 +02:00
parent 2b9ee46c40
commit e821342782

View File

@ -13071,9 +13071,9 @@ void VmaDefragmentationAlgorithm_Fast::PostprocessMetadata()
freeSize, // size freeSize, // size
VMA_NULL, // hAllocation VMA_NULL, // hAllocation
VMA_SUBALLOCATION_TYPE_FREE }; VMA_SUBALLOCATION_TYPE_FREE };
VmaSuballocationList::iterator precedingFreeIt = pMetadata->m_Suballocations.insert(it, suballoc);
if(freeSize >= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER) if(freeSize >= VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)
{ {
VmaSuballocationList::iterator precedingFreeIt = pMetadata->m_Suballocations.insert(it, suballoc);
pMetadata->m_FreeSuballocationsBySize.push_back(precedingFreeIt); pMetadata->m_FreeSuballocationsBySize.push_back(precedingFreeIt);
} }
} }
@ -13093,9 +13093,9 @@ void VmaDefragmentationAlgorithm_Fast::PostprocessMetadata()
VMA_NULL, // hAllocation VMA_NULL, // hAllocation
VMA_SUBALLOCATION_TYPE_FREE }; VMA_SUBALLOCATION_TYPE_FREE };
VMA_ASSERT(it == pMetadata->m_Suballocations.end()); VMA_ASSERT(it == pMetadata->m_Suballocations.end());
VmaSuballocationList::iterator trailingFreeIt = pMetadata->m_Suballocations.insert(it, suballoc);
if(freeSize > VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER) if(freeSize > VMA_MIN_FREE_SUBALLOCATION_SIZE_TO_REGISTER)
{ {
VmaSuballocationList::iterator trailingFreeIt = pMetadata->m_Suballocations.insert(it, suballoc);
pMetadata->m_FreeSuballocationsBySize.push_back(trailingFreeIt); pMetadata->m_FreeSuballocationsBySize.push_back(trailingFreeIt);
} }
} }