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

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

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 unified diff | Download patch
« no previous file with comments | « no previous file | src/gpu/vk/GrVkCommandBuffer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef GrVkCommandBuffer_DEFINED 8 #ifndef GrVkCommandBuffer_DEFINED
9 #define GrVkCommandBuffer_DEFINED 9 #define GrVkCommandBuffer_DEFINED
10 10
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 uint32_t firstVertex, 110 uint32_t firstVertex,
111 uint32_t firstInstance) const; 111 uint32_t firstInstance) const;
112 112
113 // Add ref-counted resource that will be tracked and released when this 113 // Add ref-counted resource that will be tracked and released when this
114 // command buffer finishes execution 114 // command buffer finishes execution
115 void addResource(const GrVkResource* resource) { 115 void addResource(const GrVkResource* resource) {
116 resource->ref(); 116 resource->ref();
117 fTrackedResources.push_back(resource); 117 fTrackedResources.push_back(resource);
118 } 118 }
119 119
120 // Add ref-counted resource that will be tracked and released when this comm and buffer finishes
121 // execution. When it is released, it will signal that the resource can be r ecycled for reuse.
122 void addRecycledResource(const GrVkRecycledResource* resource) {
123 resource->ref();
124 fTrackedRecycledResources.push_back(resource);
125 }
126
120 void reset(GrVkGpu* gpu); 127 void reset(GrVkGpu* gpu);
121 128
122 protected: 129 protected:
123 GrVkCommandBuffer(VkCommandBuffer cmdBuffer, const GrVkRenderPass* rp = VK_NULL_HANDLE) 130 GrVkCommandBuffer(VkCommandBuffer cmdBuffer, const GrVkRenderPass* rp = VK_NULL_HANDLE)
124 : fTrackedResources(kInitialTrackedResourcesCount) 131 : fTrackedResources(kInitialTrackedResourcesCount)
132 , fTrackedRecycledResources(kInitialTrackedResourcesCount)
125 , fIsActive(false) 133 , fIsActive(false)
126 , fActiveRenderPass(rp) 134 , fActiveRenderPass(rp)
127 , fCmdBuffer(cmdBuffer) 135 , fCmdBuffer(cmdBuffer)
128 , fBoundVertexBufferIsValid(false) 136 , fBoundVertexBufferIsValid(false)
129 , fBoundIndexBufferIsValid(false) { 137 , fBoundIndexBufferIsValid(false) {
130 this->invalidateState(); 138 this->invalidateState();
131 } 139 }
132 SkTArray<const GrVkResource*, true> fTrackedResources; 140 SkTArray<const GrVkResource*, true> fTrackedResources;
141 SkTArray<const GrVkRecycledResource*, true> fTrackedRecycledResources;
133 142
134 // Tracks whether we are in the middle of a command buffer begin/end cal ls and thus can add 143 // Tracks whether we are in the middle of a command buffer begin/end cal ls and thus can add
135 // new commands to the buffer; 144 // new commands to the buffer;
136 bool fIsActive; 145 bool fIsActive;
137 146
138 // Stores a pointer to the current active render pass (i.e. begin has be en called but not 147 // Stores a pointer to the current active render pass (i.e. begin has be en called but not
139 // end). A nullptr means there is no active render pass. The GrVKCommand Buffer does not own 148 // end). A nullptr means there is no active render pass. The GrVKCommand Buffer does not own
140 // the render pass. 149 // the render pass.
141 const GrVkRenderPass* fActiveRenderPass; 150 const GrVkRenderPass* fActiveRenderPass;
142 151
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 } 314 }
306 315
307 void onFreeGPUData(const GrVkGpu* gpu) const override {} 316 void onFreeGPUData(const GrVkGpu* gpu) const override {}
308 317
309 friend class GrVkPrimaryCommandBuffer; 318 friend class GrVkPrimaryCommandBuffer;
310 319
311 typedef GrVkCommandBuffer INHERITED; 320 typedef GrVkCommandBuffer INHERITED;
312 }; 321 };
313 322
314 #endif 323 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/vk/GrVkCommandBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698