Index: src/gpu/vk/GrVkCommandBuffer.cpp |
diff --git a/src/gpu/vk/GrVkCommandBuffer.cpp b/src/gpu/vk/GrVkCommandBuffer.cpp |
index 317b735391f6391479cfe88ef5baaf0768b815dc..41a7bb51d7dce31d52782c40f341aea32fcf3f11 100644 |
--- a/src/gpu/vk/GrVkCommandBuffer.cpp |
+++ b/src/gpu/vk/GrVkCommandBuffer.cpp |
@@ -66,12 +66,21 @@ void GrVkCommandBuffer::reset(GrVkGpu* gpu) { |
for (int i = 0; i < fTrackedResources.count(); ++i) { |
fTrackedResources[i]->unref(gpu); |
} |
- fTrackedResources.reset(); |
- |
for (int i = 0; i < fTrackedRecycledResources.count(); ++i) { |
fTrackedRecycledResources[i]->recycle(const_cast<GrVkGpu*>(gpu)); |
} |
- fTrackedRecycledResources.reset(); |
+ |
+ if (++fNumResets > kNumRewindResetsBeforeFullReset) { |
+ fTrackedResources.reset(); |
+ fTrackedRecycledResources.reset(); |
+ fTrackedResources.setReserve(kInitialTrackedResourcesCount); |
+ fTrackedRecycledResources.setReserve(kInitialTrackedResourcesCount); |
+ fNumResets = 0; |
+ } else { |
+ fTrackedResources.rewind(); |
+ fTrackedRecycledResources.rewind(); |
+ } |
+ |
this->invalidateState(); |