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

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

Issue 2115993002: Add resource tracking output and command buffer recycling (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments 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/GrVkRenderPass.h ('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
11 #include "SkAtomics.h" 11 #include "SkAtomics.h"
12 #include "SkTDynamicHash.h" 12 #include "SkTDynamicHash.h"
13 #include "SkRandom.h" 13 #include "SkRandom.h"
14 14
15 class GrVkGpu; 15 class GrVkGpu;
16 16
17 // uncomment to enable tracing of resource refs 17 // uncomment to enable tracing of resource refs
18 //#ifdef SK_DEBUG 18 #ifdef SK_DEBUG
19 //#define SK_TRACE_VK_RESOURCES 19 #define SK_TRACE_VK_RESOURCES
20 //#endif 20 #endif
21 21
22 /** \class GrVkResource 22 /** \class GrVkResource
23 23
24 GrVkResource is the base class for Vulkan resources that may be shared by mult iple 24 GrVkResource is the base class for Vulkan resources that may be shared by mult iple
25 objects. When an existing owner wants to share a reference, it calls ref(). 25 objects. When an existing owner wants to share a reference, it calls ref().
26 When an owner wants to release its reference, it calls unref(). When the 26 When an owner wants to release its reference, it calls unref(). When the
27 shared object's reference count goes to zero as the result of an unref() 27 shared object's reference count goes to zero as the result of an unref()
28 call, its (virtual) destructor is called. It is an error for the 28 call, its (virtual) destructor is called. It is an error for the
29 destructor to be called explicitly (or via the object going out of scope on 29 destructor to be called explicitly (or via the object going out of scope on
30 the stack or calling delete) if getRefCnt() > 1. 30 the stack or calling delete) if getRefCnt() > 1.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 this->internal_dispose(); 114 this->internal_dispose();
115 } 115 }
116 } 116 }
117 117
118 #ifdef SK_DEBUG 118 #ifdef SK_DEBUG
119 void validate() const { 119 void validate() const {
120 SkASSERT(fRefCnt > 0); 120 SkASSERT(fRefCnt > 0);
121 } 121 }
122 #endif 122 #endif
123 123
124 #ifdef SK_TRACE_VK_RESOURCES
125 /** Output a human-readable dump of this resource's information
126 */
127 virtual void dumpInfo() const = 0;
128 #endif
129
124 private: 130 private:
125 /** Must be implemented by any subclasses. 131 /** Must be implemented by any subclasses.
126 * Deletes any Vk data associated with this resource 132 * Deletes any Vk data associated with this resource
127 */ 133 */
128 virtual void freeGPUData(const GrVkGpu* gpu) const = 0; 134 virtual void freeGPUData(const GrVkGpu* gpu) const = 0;
129 135
130 /** Must be overridden by subclasses that themselves store GrVkResources. 136 /** Must be overridden by subclasses that themselves store GrVkResources.
131 * Will unrefAndAbandon those resources without deleting the underlying Vk data 137 * Will unrefAndAbandon those resources without deleting the underlying Vk data
132 */ 138 */
133 virtual void abandonSubResources() const {} 139 virtual void abandonSubResources() const {}
(...skipping 27 matching lines...) Expand all
161 mutable int32_t fRefCnt; 167 mutable int32_t fRefCnt;
162 #ifdef SK_TRACE_VK_RESOURCES 168 #ifdef SK_TRACE_VK_RESOURCES
163 uint32_t fKey; 169 uint32_t fKey;
164 #endif 170 #endif
165 171
166 typedef SkNoncopyable INHERITED; 172 typedef SkNoncopyable INHERITED;
167 }; 173 };
168 174
169 175
170 #endif 176 #endif
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkRenderPass.h ('k') | src/gpu/vk/GrVkResourceProvider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698