From 2a6e123b16ffb9e04237aa8d6390852c3022ba80 Mon Sep 17 00:00:00 2001 From: Charlie Lao Date: Wed, 27 Apr 2022 15:27:46 -0700 Subject: [PATCH] Vulkan: Move pruneOrphanedBufferBlocks to last RendererVk::cleanupGarbage() should call pruneOrphanedBufferBlocks() after clean up mSuballocationGarbage, so that we will be able to find the orphaned buffer block being empty if mSuballocationGarbage actually made it empty. Bug: chromium:1318110 Change-Id: I0cc6e45c192f406e7bbb15c7427d30e06208dd06 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3611648 Reviewed-by: Ian Elliott Reviewed-by: Shahbaz Youssefi Commit-Queue: Charlie Lao --- src/libANGLE/renderer/vulkan/RendererVk.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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; }