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

Unified Diff: src/gpu/GrGpuResourceCacheAccess.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: update 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
Index: src/gpu/GrGpuResourceCacheAccess.h
diff --git a/src/gpu/GrGpuResourceCacheAccess.h b/src/gpu/GrGpuResourceCacheAccess.h
index ecb73f37eca21fbbccfb3eb19d8967e84f821702..7742aef5b03dab7c4191543097479f7a2aebcad5 100644
--- a/src/gpu/GrGpuResourceCacheAccess.h
+++ b/src/gpu/GrGpuResourceCacheAccess.h
@@ -29,6 +29,11 @@ public:
}
/**
+ * Changes whether the resource counts against the resource cache budget.
+ */
+ void setBudgeted(bool countsAgainstBudget) { fResource->setBudgeted(countsAgainstBudget); }
bsalomon 2014/11/13 19:20:54 This class provides privileged access the parts of
+
+ /**
* Is the resource currently cached as scratch? This means it has a valid scratch key and does
* not have a content key.
*/
@@ -48,14 +53,26 @@ public:
* If the resource is currently cached by a content key, the key is returned, otherwise NULL.
*/
const GrResourceKey* getContentKey() const {
- if (fResource->fContentKeySet) {
+ if (fResource->fFlags & GrGpuResource::kContentKeySet_Flag) {
return &fResource->fContentKey;
}
return NULL;
}
+ /**
+ * Is the resource object wrapping an externally allocated GPU resource?
+ */
bool isWrapped() const { return fResource->isWrapped(); }
+ /**
+ * Does the resource count against the resource budget?
+ */
+ bool isBudgeted() const {
+ bool ret = SkToBool(GrGpuResource::kBudgeted_Flag & fResource->fFlags);
+ SkASSERT(!(ret && fResource->isWrapped()));
+ return ret;
+ }
+
private:
CacheAccess(GrGpuResource* resource) : fResource(resource) { }
CacheAccess(const CacheAccess& that) : fResource(that.fResource) { }

Powered by Google App Engine
This is Rietveld 408576698