Skip to content

Commit ea759b6

Browse files
Added missing mutexes for DefragmentPassEnd().
Code by @medranSolus
1 parent 9b8303f commit ea759b6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

include/vk_mem_alloc.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13252,6 +13252,8 @@ VkResult VmaDefragmentationContext_T::DefragmentPassEnd(VmaDefragmentationPassMo
1325213252
if (state.operation != StateExtensive::Operation::Cleanup)
1325313253
{
1325413254
VmaBlockVector* vector = m_pBlockVectors[block.data];
13255+
VmaMutexLockWrite lock(vector->GetMutex(), vector->GetAllocator()->m_UseMutex);
13256+
1325513257
for (size_t i = 0, count = vector->GetBlockCount() - m_ImmovableBlockCount; i < count; ++i)
1325613258
{
1325713259
if (vector->GetBlock(i) == block.block)
@@ -13281,6 +13283,8 @@ VkResult VmaDefragmentationContext_T::DefragmentPassEnd(VmaDefragmentationPassMo
1328113283
for (const FragmentedBlock& block : immovableBlocks)
1328213284
{
1328313285
VmaBlockVector* vector = m_pBlockVectors[block.data];
13286+
VmaMutexLockWrite lock(vector->GetMutex(), vector->GetAllocator()->m_UseMutex);
13287+
1328413288
for (size_t i = m_ImmovableBlockCount; i < vector->GetBlockCount(); ++i)
1328513289
{
1328613290
if (vector->GetBlock(i) == block.block)

0 commit comments

Comments
 (0)