Commit 2dd40d7f by Jamie Madill Committed by Commit Bot

Vulkan: Free pool allocation leak with graph disabled.

Our secondary command buffer pools were leaking memory every submit. This change pops the secondary command buffer pool allocator scope after commands are flushed during a submit. Fixes the memory leak observable on any Vulkan application. Bug: angleproject:4029 Bug: angleproject:4403 Change-Id: I3d0f8d53456336ef0b03c6d37425fb76c88d1551 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2057349Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 798a8375
...@@ -721,6 +721,8 @@ angle::Result ContextVk::initialize() ...@@ -721,6 +721,8 @@ angle::Result ContextVk::initialize()
if (!commandGraphEnabled()) if (!commandGraphEnabled())
{ {
// Push a scope in the pool allocator so we can easily reinitialize on flush.
mPoolAllocator.push();
mOutsideRenderPassCommands.getCommandBuffer().initialize(&mPoolAllocator); mOutsideRenderPassCommands.getCommandBuffer().initialize(&mPoolAllocator);
mRenderPassCommands.initialize(&mPoolAllocator); mRenderPassCommands.initialize(&mPoolAllocator);
ANGLE_TRY(startPrimaryCommandBuffer()); ANGLE_TRY(startPrimaryCommandBuffer());
...@@ -3698,6 +3700,13 @@ angle::Result ContextVk::flushImpl(const vk::Semaphore *signalSemaphore) ...@@ -3698,6 +3700,13 @@ angle::Result ContextVk::flushImpl(const vk::Semaphore *signalSemaphore)
{ {
mOutsideRenderPassCommands.flushToPrimary(&mPrimaryCommands); mOutsideRenderPassCommands.flushToPrimary(&mPrimaryCommands);
ANGLE_TRY(endRenderPass()); ANGLE_TRY(endRenderPass());
// Free secondary command pool allocations and restart command buffers with the new page.
mPoolAllocator.pop();
mPoolAllocator.push();
mOutsideRenderPassCommands.reset();
mRenderPassCommands.reset();
ANGLE_VK_TRY(this, mPrimaryCommands.end()); ANGLE_VK_TRY(this, mPrimaryCommands.end());
Serial serial = getCurrentQueueSerial(); Serial serial = getCurrentQueueSerial();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment