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

Side by Side Diff: src/gpu/vk/GrVkCommandBuffer.cpp

Issue 2338963004: Use STDArray to for tracked resources in vulkan command buffer (Closed)
Patch Set: nit Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrVkCommandBuffer.h" 8 #include "GrVkCommandBuffer.h"
9 9
10 #include "GrVkFramebuffer.h" 10 #include "GrVkFramebuffer.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // We don't recycle resources when abandoning them. 59 // We don't recycle resources when abandoning them.
60 fTrackedRecycledResources[i]->unrefAndAbandon(); 60 fTrackedRecycledResources[i]->unrefAndAbandon();
61 } 61 }
62 } 62 }
63 63
64 void GrVkCommandBuffer::reset(GrVkGpu* gpu) { 64 void GrVkCommandBuffer::reset(GrVkGpu* gpu) {
65 SkASSERT(!fIsActive); 65 SkASSERT(!fIsActive);
66 for (int i = 0; i < fTrackedResources.count(); ++i) { 66 for (int i = 0; i < fTrackedResources.count(); ++i) {
67 fTrackedResources[i]->unref(gpu); 67 fTrackedResources[i]->unref(gpu);
68 } 68 }
69 fTrackedResources.reset();
70
71 for (int i = 0; i < fTrackedRecycledResources.count(); ++i) { 69 for (int i = 0; i < fTrackedRecycledResources.count(); ++i) {
72 fTrackedRecycledResources[i]->recycle(const_cast<GrVkGpu*>(gpu)); 70 fTrackedRecycledResources[i]->recycle(const_cast<GrVkGpu*>(gpu));
73 } 71 }
74 fTrackedRecycledResources.reset(); 72
73 if (++fNumResets > kMaxNumberofRewindResets) {
74 fTrackedResources.reset();
75 fTrackedRecycledResources.reset();
76 fTrackedResources.setReserve(kInitialTrackedResourcesCount);
77 fTrackedRecycledResources.setReserve(kInitialTrackedResourcesCount);
jvanverth1 2016/09/19 18:51:04 fNumResets = 0; ?
egdaniel 2016/09/19 19:52:37 Done.
78 } else {
79 fTrackedResources.rewind();
80 fTrackedRecycledResources.rewind();
81 }
82
75 83
76 this->invalidateState(); 84 this->invalidateState();
77 85
78 // we will retain resources for later use 86 // we will retain resources for later use
79 VkCommandBufferResetFlags flags = 0; 87 VkCommandBufferResetFlags flags = 0;
80 GR_VK_CALL(gpu->vkInterface(), ResetCommandBuffer(fCmdBuffer, flags)); 88 GR_VK_CALL(gpu->vkInterface(), ResetCommandBuffer(fCmdBuffer, flags));
81 89
82 this->onReset(gpu); 90 this->onReset(gpu);
83 } 91 }
84 92
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 fIsActive = true; 659 fIsActive = true;
652 } 660 }
653 661
654 void GrVkSecondaryCommandBuffer::end(const GrVkGpu* gpu) { 662 void GrVkSecondaryCommandBuffer::end(const GrVkGpu* gpu) {
655 SkASSERT(fIsActive); 663 SkASSERT(fIsActive);
656 GR_VK_CALL_ERRCHECK(gpu->vkInterface(), EndCommandBuffer(fCmdBuffer)); 664 GR_VK_CALL_ERRCHECK(gpu->vkInterface(), EndCommandBuffer(fCmdBuffer));
657 this->invalidateState(); 665 this->invalidateState();
658 fIsActive = false; 666 fIsActive = false;
659 } 667 }
660 668
OLDNEW
« src/gpu/vk/GrVkCommandBuffer.h ('K') | « src/gpu/vk/GrVkCommandBuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698