VmaAllocator_T::FreeMemory: Fixed synchronization bug for cases when an allocation becomes lost at the same time as it is being freed.

This commit is contained in:
Adam Sawicki 2018-08-27 11:53:02 +02:00
parent a5d5ffafe2
commit c5b223fe4b

View File

@ -11542,8 +11542,7 @@ void VmaAllocator_T::FreeMemory(const VmaAllocation allocation)
{ {
VMA_ASSERT(allocation); VMA_ASSERT(allocation);
if(allocation->CanBecomeLost() == false || if(TouchAllocation(allocation))
allocation->GetLastUseFrameIndex() != VMA_FRAME_INDEX_LOST)
{ {
if(VMA_DEBUG_INITIALIZE_ALLOCATIONS) if(VMA_DEBUG_INITIALIZE_ALLOCATIONS)
{ {
@ -11762,7 +11761,7 @@ void VmaAllocator_T::GetAllocationInfo(VmaAllocation hAllocation, VmaAllocationI
Warning: This is a carefully designed algorithm. Warning: This is a carefully designed algorithm.
Do not modify unless you really know what you're doing :) Do not modify unless you really know what you're doing :)
*/ */
uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load(); const uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();
uint32_t localLastUseFrameIndex = hAllocation->GetLastUseFrameIndex(); uint32_t localLastUseFrameIndex = hAllocation->GetLastUseFrameIndex();
for(;;) for(;;)
{ {