diff --git a/src/libANGLE/renderer/vulkan/RendererVk.cpp b/src/libANGLE/renderer/vulkan/RendererVk.cpp index ddc58d7de..183450868 100644 --- a/src/libANGLE/renderer/vulkan/RendererVk.cpp +++ b/src/libANGLE/renderer/vulkan/RendererVk.cpp @@ -3831,11 +3831,6 @@ angle::Result RendererVk::cleanupGarbage(Serial lastCompletedQueueSerial) { std::lock_guard lock(mGarbageMutex); - if (!mOrphanedBufferBlocks.empty()) - { - pruneOrphanedBufferBlocks(); - } - // Clean up general garbages while (!mSharedGarbage.empty()) { @@ -3858,6 +3853,13 @@ angle::Result RendererVk::cleanupGarbage(Serial lastCompletedQueueSerial) mSuballocationGarbage.pop(); } + // Note: do this after clean up mSuballocationGarbage so that we will have more chances to find + // orphaned blocks being empty. + if (!mOrphanedBufferBlocks.empty()) + { + pruneOrphanedBufferBlocks(); + } + return angle::Result::Continue; }