From c5b223fe4b379478485ca95af56dbf76416acaa3 Mon Sep 17 00:00:00 2001 From: Adam Sawicki Date: Mon, 27 Aug 2018 11:53:02 +0200 Subject: [PATCH] VmaAllocator_T::FreeMemory: Fixed synchronization bug for cases when an allocation becomes lost at the same time as it is being freed. --- src/vk_mem_alloc.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/vk_mem_alloc.h b/src/vk_mem_alloc.h index aef6b1b..2975335 100644 --- a/src/vk_mem_alloc.h +++ b/src/vk_mem_alloc.h @@ -11542,8 +11542,7 @@ void VmaAllocator_T::FreeMemory(const VmaAllocation allocation) { VMA_ASSERT(allocation); - if(allocation->CanBecomeLost() == false || - allocation->GetLastUseFrameIndex() != VMA_FRAME_INDEX_LOST) + if(TouchAllocation(allocation)) { if(VMA_DEBUG_INITIALIZE_ALLOCATIONS) { @@ -11762,7 +11761,7 @@ void VmaAllocator_T::GetAllocationInfo(VmaAllocation hAllocation, VmaAllocationI Warning: This is a carefully designed algorithm. 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(); for(;;) {