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

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

Issue 815833004: Add a simpler key type for scratch resource keys. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: final fix Created 5 years, 11 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 | « bench/GrResourceCacheBench.cpp ('k') | include/gpu/GrResourceKey.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
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 /** 221 /**
222 * This entry point should be called whenever gpuMemorySize() should report a different size. 222 * This entry point should be called whenever gpuMemorySize() should report a different size.
223 * The cache will call gpuMemorySize() to update the current size of the res ource. 223 * The cache will call gpuMemorySize() to update the current size of the res ource.
224 */ 224 */
225 void didChangeGpuMemorySize() const; 225 void didChangeGpuMemorySize() const;
226 226
227 /** 227 /**
228 * Optionally called by the GrGpuResource subclass if the resource can be us ed as scratch. 228 * Optionally called by the GrGpuResource subclass if the resource can be us ed as scratch.
229 * By default resources are not usable as scratch. This should only be calle d once. 229 * By default resources are not usable as scratch. This should only be calle d once.
230 **/ 230 **/
231 void setScratchKey(const GrResourceKey& scratchKey); 231 void setScratchKey(const GrScratchKey& scratchKey);
232 232
233 private: 233 private:
234 /** 234 /**
235 * Frees the object in the underlying 3D API. Called by CacheAccess. 235 * Frees the object in the underlying 3D API. Called by CacheAccess.
236 */ 236 */
237 void release(); 237 void release();
238 238
239 virtual size_t onGpuMemorySize() const = 0; 239 virtual size_t onGpuMemorySize() const = 0;
240 240
241 // See comments in CacheAccess. 241 // See comments in CacheAccess.
(...skipping 25 matching lines...) Expand all
267 * implies that kBudgeted_Flag is not set. 267 * implies that kBudgeted_Flag is not set.
268 */ 268 */
269 kWrapped_Flag = 0x2, 269 kWrapped_Flag = 0x2,
270 270
271 /** 271 /**
272 * If set then fContentKey is valid and the resource is cached based on its content. 272 * If set then fContentKey is valid and the resource is cached based on its content.
273 */ 273 */
274 kContentKeySet_Flag = 0x4, 274 kContentKeySet_Flag = 0x4,
275 }; 275 };
276 276
277 // TODO(bsalomon): Remove GrResourceKey and use different simpler types for content and scratch 277 GrScratchKey fScratchKey;
278 // keys. 278 // TODO(bsalomon): Remove GrResourceKey and use different simpler type for c ontent keys.
279 GrResourceKey fScratchKey;
280 GrResourceKey fContentKey; 279 GrResourceKey fContentKey;
281 280
282 // This is not ref'ed but abandon() or release() will be called before the G rGpu object 281 // This is not ref'ed but abandon() or release() will be called before the G rGpu object
283 // is destroyed. Those calls set will this to NULL. 282 // is destroyed. Those calls set will this to NULL.
284 GrGpu* fGpu; 283 GrGpu* fGpu;
285 mutable size_t fGpuMemorySize; 284 mutable size_t fGpuMemorySize;
286 285
287 uint32_t fFlags; 286 uint32_t fFlags;
288 const uint32_t fUniqueID; 287 const uint32_t fUniqueID;
289 288
290 SkAutoTUnref<const SkData> fData; 289 SkAutoTUnref<const SkData> fData;
291 290
292 typedef GrIORef<GrGpuResource> INHERITED; 291 typedef GrIORef<GrGpuResource> INHERITED;
293 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgable. 292 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgable.
294 }; 293 };
295 294
296 #endif 295 #endif
OLDNEW
« no previous file with comments | « bench/GrResourceCacheBench.cpp ('k') | include/gpu/GrResourceKey.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698