Skip to content

Commit 0927dd6

Browse files
egdanielSkia Commit-Bot
authored andcommitted
Make sure we free secondary command buffers we don't cache.
We weren't leaking previously cause when we free the command pool it frees all the buffers, but this allows us to reclaim the memory earlier. Bug: skia:10438 Change-Id: I1364f3dc123aa89ebb2280f3b9691cffbd67aa78 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304156 Reviewed-by: Brian Salomon <[email protected]> Commit-Queue: Greg Daniel <[email protected]>
1 parent fe7aed6 commit 0927dd6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/gpu/vk/GrVkCommandPool.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ void GrVkCommandPool::recycleSecondaryCommandBuffer(GrVkSecondaryCommandBuffer*
6666
std::unique_ptr<GrVkSecondaryCommandBuffer> scb(buffer);
6767
if (fAvailableSecondaryBuffers.count() < fMaxCachedSecondaryCommandBuffers) {
6868
fAvailableSecondaryBuffers.push_back(std::move(scb));
69+
} else {
70+
VkCommandBuffer vkBuffer = buffer->vkCommandBuffer();
71+
GR_VK_CALL(fGpu->vkInterface(),
72+
FreeCommandBuffers(fGpu->device(), fCommandPool, 1, &vkBuffer));
6973
}
7074
}
7175

0 commit comments

Comments
 (0)