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

Side by Side Diff: include/gpu/GrGpuResource.h

Issue 715333003: Revert of Replace GrResourceCache with GrResourceCache2. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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 | « include/gpu/GrContext.h ('k') | include/gpu/GrUserConfig.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 2014 Google Inc. 2 * Copyright 2014 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 GrGpuResource_DEFINED 8 #ifndef GrGpuResource_DEFINED
9 #define GrGpuResource_DEFINED 9 #define GrGpuResource_DEFINED
10 10
11 #include "GrResourceKey.h" 11 #include "GrResourceKey.h"
12 #include "GrTypesPriv.h" 12 #include "GrTypesPriv.h"
13 #include "SkInstCnt.h" 13 #include "SkInstCnt.h"
14 #include "SkTInternalLList.h" 14 #include "SkTInternalLList.h"
15 15
16 class GrContext; 16 class GrContext;
17 class GrGpu; 17 class GrGpu;
18 class GrResourceCache2; 18 class GrResourceCache2;
19 class GrResourceCacheEntry;
19 20
20 /** 21 /**
21 * Base class for GrGpuResource. Handles the various types of refs we need. Sepa rated out as a base 22 * Base class for GrGpuResource. Handles the various types of refs we need. Sepa rated out as a base
22 * class to isolate the ref-cnting behavior and provide friendship without expos ing all of 23 * class to isolate the ref-cnting behavior and provide friendship without expos ing all of
23 * GrGpuResource. 24 * GrGpuResource.
24 * 25 *
25 * Gpu resources can have three types of refs: 26 * Gpu resources can have three types of refs:
26 * 1) Normal ref (+ by ref(), - by unref()): These are used by code that is is suing draw calls 27 * 1) Normal ref (+ by ref(), - by unref()): These are used by code that is is suing draw calls
27 * that read and write the resource via GrDrawTarget and by any object that must own a 28 * that read and write the resource via GrDrawTarget and by any object that must own a
28 * GrGpuResource and is itself owned (directly or indirectly) by Skia-clien t code. 29 * GrGpuResource and is itself owned (directly or indirectly) by Skia-clien t code.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 mutable int32_t fPendingWrites; 119 mutable int32_t fPendingWrites;
119 120
120 // This class is used to manage conversion of refs to pending reads/writes. 121 // This class is used to manage conversion of refs to pending reads/writes.
121 friend class GrGpuResourceRef; 122 friend class GrGpuResourceRef;
122 friend class GrResourceCache2; // to check IO ref counts. 123 friend class GrResourceCache2; // to check IO ref counts.
123 124
124 template <typename, GrIOType> friend class GrPendingIOResource; 125 template <typename, GrIOType> friend class GrPendingIOResource;
125 }; 126 };
126 127
127 /** 128 /**
128 * Base class for objects that can be kept in the GrResourceCache2. 129 * Base class for objects that can be kept in the GrResourceCache.
129 */ 130 */
130 class SK_API GrGpuResource : public GrIORef<GrGpuResource> { 131 class SK_API GrGpuResource : public GrIORef<GrGpuResource> {
131 public: 132 public:
132 SK_DECLARE_INST_COUNT(GrGpuResource) 133 SK_DECLARE_INST_COUNT(GrGpuResource)
133 134
134 /** 135 /**
135 * Frees the object in the underlying 3D API. It must be safe to call this 136 * Frees the object in the underlying 3D API. It must be safe to call this
136 * when the object has been previously abandoned. 137 * when the object has been previously abandoned.
137 */ 138 */
138 void release(); 139 void release();
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 * Lifetime management is left up to the user (i.e., we will not 250 * Lifetime management is left up to the user (i.e., we will not
250 * free it). 251 * free it).
251 */ 252 */
252 kWrapped_FlagBit = 0x1, 253 kWrapped_FlagBit = 0x1,
253 }; 254 };
254 255
255 static const size_t kInvalidGpuMemorySize = ~static_cast<size_t>(0); 256 static const size_t kInvalidGpuMemorySize = ~static_cast<size_t>(0);
256 257
257 uint32_t fFlags; 258 uint32_t fFlags;
258 259
260 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache
259 mutable size_t fGpuMemorySize; 261 mutable size_t fGpuMemorySize;
260 const uint32_t fUniqueID; 262 const uint32_t fUniqueID;
261 263
262 // TODO(bsalomon): Remove GrResourceKey and use different simpler types for content and scratch 264 // TODO(bsalomon): Remove GrResourceKey and use different simpler types for content and scratch
263 // keys. 265 // keys.
264 GrResourceKey fScratchKey; 266 GrResourceKey fScratchKey;
265 GrResourceKey fContentKey; 267 GrResourceKey fContentKey;
266 bool fContentKeySet; 268 bool fContentKeySet;
267 269
268 typedef GrIORef<GrGpuResource> INHERITED; 270 typedef GrIORef<GrGpuResource> INHERITED;
269 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgable. 271 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgable.
270 }; 272 };
271 273
272 #endif 274 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrContext.h ('k') | include/gpu/GrUserConfig.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698