Index: src/gpu/vk/GrVkCommandBuffer.cpp |
diff --git a/src/gpu/vk/GrVkCommandBuffer.cpp b/src/gpu/vk/GrVkCommandBuffer.cpp |
index 7fb143ed987065b4d2697a49ddf16cada071d3ed..c9037c28c3340ffd179f0577f281abc86a1e1845 100644 |
--- a/src/gpu/vk/GrVkCommandBuffer.cpp |
+++ b/src/gpu/vk/GrVkCommandBuffer.cpp |
@@ -40,6 +40,10 @@ void GrVkCommandBuffer::freeGPUData(const GrVkGpu* gpu) const { |
fTrackedResources[i]->unref(gpu); |
} |
+ for (int i = 0; i < fTrackedRecycledResources.count(); ++i) { |
+ fTrackedRecycledResources[i]->recycle(const_cast<GrVkGpu*>(gpu)); |
+ } |
+ |
GR_VK_CALL(gpu->vkInterface(), FreeCommandBuffers(gpu->device(), gpu->cmdPool(), |
1, &fCmdBuffer)); |
@@ -50,6 +54,11 @@ void GrVkCommandBuffer::abandonSubResources() const { |
for (int i = 0; i < fTrackedResources.count(); ++i) { |
fTrackedResources[i]->unrefAndAbandon(); |
} |
+ |
+ for (int i = 0; i < fTrackedRecycledResources.count(); ++i) { |
+ // We don't recycle resources when abandoning them. |
+ fTrackedRecycledResources[i]->unrefAndAbandon(); |
+ } |
} |
void GrVkCommandBuffer::reset(GrVkGpu* gpu) { |
@@ -59,6 +68,12 @@ void GrVkCommandBuffer::reset(GrVkGpu* gpu) { |
} |
fTrackedResources.reset(); |
+ for (int i = 0; i < fTrackedRecycledResources.count(); ++i) { |
+ fTrackedRecycledResources[i]->recycle(const_cast<GrVkGpu*>(gpu)); |
+ } |
+ fTrackedRecycledResources.reset(); |
+ |
+ |
this->invalidateState(); |
// we will retain resources for later use |