Skip to content

Commit c5b223f

Browse files
VmaAllocator_T::FreeMemory: Fixed synchronization bug for cases when an allocation becomes lost at the same time as it is being freed.
1 parent a5d5ffa commit c5b223f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/vk_mem_alloc.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11542,8 +11542,7 @@ void VmaAllocator_T::FreeMemory(const VmaAllocation allocation)
1154211542
{
1154311543
VMA_ASSERT(allocation);
1154411544

11545-
if(allocation->CanBecomeLost() == false ||
11546-
allocation->GetLastUseFrameIndex() != VMA_FRAME_INDEX_LOST)
11545+
if(TouchAllocation(allocation))
1154711546
{
1154811547
if(VMA_DEBUG_INITIALIZE_ALLOCATIONS)
1154911548
{
@@ -11762,7 +11761,7 @@ void VmaAllocator_T::GetAllocationInfo(VmaAllocation hAllocation, VmaAllocationI
1176211761
Warning: This is a carefully designed algorithm.
1176311762
Do not modify unless you really know what you're doing :)
1176411763
*/
11765-
uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();
11764+
const uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();
1176611765
uint32_t localLastUseFrameIndex = hAllocation->GetLastUseFrameIndex();
1176711766
for(;;)
1176811767
{

0 commit comments

Comments
 (0)