Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(508)

Unified Diff: src/gpu/vk/GrVkCommandBuffer.cpp

Issue 2167453003: Add GrVkRecycledResource subclass (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove extra unref Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/vk/GrVkCommandBuffer.h ('k') | src/gpu/vk/GrVkResource.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/gpu/vk/GrVkCommandBuffer.h ('k') | src/gpu/vk/GrVkResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698