VmaAllocator_T::FreeMemory: Fixed synchronization bug for cases when an allocation becomes lost at the same time as it is being freed.
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 @@
{
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 @@
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(;;)
{