diff options
author | bsalomon <bsalomon@google.com> | 2014-11-17 09:33:27 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-17 09:33:27 -0800 |
commit | 84c8e62fad59f0e19b40ac718467f5b7884b431d (patch) | |
tree | d1957e4aecfe83bd76b181f316ce3bda25604879 /src/gpu/GrGpuResourceCacheAccess.h | |
parent | bd27e514e29a38d369358d829560ffe3a58efd73 (diff) |
Allow GPU resources to not be counted against the cache budget.
BUG=skia:2889
Review URL: https://codereview.chromium.org/721353002
Diffstat (limited to 'src/gpu/GrGpuResourceCacheAccess.h')
-rw-r--r-- | src/gpu/GrGpuResourceCacheAccess.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/gpu/GrGpuResourceCacheAccess.h b/src/gpu/GrGpuResourceCacheAccess.h index 7d20fff473..c55bb07774 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); } + + /** * Is the resource currently cached as scratch? This means it has a valid scratch key and does * not have a content key. */ @@ -48,15 +53,27 @@ 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; + } + + /** * Called by the cache to delete the resource under normal circumstances. */ void release() { |