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

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

Issue 2163673002: Setup system in Vulkan to reuse VkDescriptorSet allocations. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nit 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 | « src/gpu/vk/GrVkPipelineState.cpp ('k') | src/gpu/vk/GrVkResourceProvider.h » ('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 GrVkResource_DEFINED 8 #ifndef GrVkResource_DEFINED
9 #define GrVkResource_DEFINED 9 #define GrVkResource_DEFINED
10 10
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 uint32_t fKey; 188 uint32_t fKey;
189 #endif 189 #endif
190 190
191 typedef SkNoncopyable INHERITED; 191 typedef SkNoncopyable INHERITED;
192 }; 192 };
193 193
194 // This subclass allows for recycling 194 // This subclass allows for recycling
195 class GrVkRecycledResource : public GrVkResource { 195 class GrVkRecycledResource : public GrVkResource {
196 public: 196 public:
197 // When recycle is called and there is only one ref left on the resource, we will signal that 197 // When recycle is called and there is only one ref left on the resource, we will signal that
198 // the resource can be recycled for reuse. This function will always unref t he object. Thus 198 // the resource can be recycled for reuse. If the sublass (or whoever is man aging this resource)
199 // if the object is recycled it should be ref'd inside the onRecycle call. 199 // decides not to recycle the objects, it is their responsibility to call un ref on the object.
200 void recycle(GrVkGpu* gpu) const { 200 void recycle(GrVkGpu* gpu) const {
201 if (this->unique()) { 201 if (this->unique()) {
202 this->onRecycle(gpu); 202 this->onRecycle(gpu);
203 } else {
204 this->unref(gpu);
203 } 205 }
204 this->unref(gpu);
205 } 206 }
206 207
207 private: 208 private:
208 virtual void onRecycle(GrVkGpu* gpu) const = 0; 209 virtual void onRecycle(GrVkGpu* gpu) const = 0;
209 }; 210 };
210 211
211 #endif 212 #endif
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkPipelineState.cpp ('k') | src/gpu/vk/GrVkResourceProvider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698