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

Unified Diff: include/gpu/GrGpuResource.h

Issue 721353002: Allow GPU resources to not be counted against the cache budget. (Closed) Base URL: https://skia.googlesource.com/skia.git@wrap
Patch Set: fix constructor order 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/gpu/GrContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrGpuResource.h
diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h
index c5b8ca5fbb7f4b990d4c128509ef2c3d65a26043..806a45aa1147b075e39971e52e71f0f8a23332bb 100644
--- a/include/gpu/GrGpuResource.h
+++ b/include/gpu/GrGpuResource.h
@@ -191,7 +191,7 @@ protected:
backend API calls should be made. */
virtual void onAbandon() { }
- bool isWrapped() const { return kWrapped_FlagBit & fFlags; }
+ bool isWrapped() const { return SkToBool(kWrapped_Flag & fFlags); }
/**
* This entry point should be called whenever gpuMemorySize() should report a different size.
@@ -221,7 +221,7 @@ private:
// See comments in CacheAccess.
bool setContentKey(const GrResourceKey& contentKey);
-
+ void setBudgeted(bool countsAgainstBudget);
void notifyIsPurgable() const;
#ifdef SK_DEBUG
@@ -233,31 +233,39 @@ private:
// We're in an internal doubly linked list owned by GrResourceCache2
SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrGpuResource);
- // This is not ref'ed but abandon() or release() will be called before the GrGpu object
- // is destroyed. Those calls set will this to NULL.
- GrGpu* fGpu;
+ static const size_t kInvalidGpuMemorySize = ~static_cast<size_t>(0);
enum Flags {
/**
- * This object wraps a GPU object given to us by the user.
- * Lifetime management is left up to the user (i.e., we will not
- * free it).
+ * The resource counts against the resource cache's budget.
*/
- kWrapped_FlagBit = 0x1,
- };
+ kBudgeted_Flag = 0x1,
- static const size_t kInvalidGpuMemorySize = ~static_cast<size_t>(0);
-
- uint32_t fFlags;
+ /**
+ * This object wraps a GPU object given to us by Skia's client. Skia will not free the
+ * underlying backend API GPU resources when the GrGpuResource is destroyed. This also
+ * implies that kBudgeted_Flag is not set.
+ */
+ kWrapped_Flag = 0x2,
- mutable size_t fGpuMemorySize;
- const uint32_t fUniqueID;
+ /**
+ * If set then fContentKey is valid and the resource is cached based on its content.
+ */
+ kContentKeySet_Flag = 0x4,
+ };
// TODO(bsalomon): Remove GrResourceKey and use different simpler types for content and scratch
// keys.
GrResourceKey fScratchKey;
GrResourceKey fContentKey;
- bool fContentKeySet;
+
+ // This is not ref'ed but abandon() or release() will be called before the GrGpu object
+ // is destroyed. Those calls set will this to NULL.
+ GrGpu* fGpu;
+ mutable size_t fGpuMemorySize;
+
+ uint32_t fFlags;
+ const uint32_t fUniqueID;
typedef GrIORef<GrGpuResource> INHERITED;
friend class GrIORef<GrGpuResource>; // to access notifyIsPurgable.
« no previous file with comments | « no previous file | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698