diff options
author | Derek Sollenberger <djsollen@google.com> | 2017-05-25 16:43:59 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-05-26 18:14:33 +0000 |
commit | 5480a18d8799511034d0da219c72932cd8f25274 (patch) | |
tree | 0be82d1f2275f2df75a5bf77eb330fadf677166b /include | |
parent | dc8c34455849574e4e0260ea35485f093723c10d (diff) |
Add method to GrContext to purge unlocked resources.
Beyond setting the total cache limits this method enables clients to
request to purge a specific number of bytes, as well as specify their
preference to purge scratch resources over resources of other types.
Change-Id: I9259d5544d34251575d77eebe599388f213ff3ce
Reviewed-on: https://skia-review.googlesource.com/17987
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/GrContext.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index 5bd9574678..0f3d925113 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -172,6 +172,18 @@ public: */ void purgeResourcesNotUsedInMs(std::chrono::milliseconds ms); + /** + * Purge unlocked resources from the cache until the the provided byte count has been reached + * or we have purged all unlocked resources. The default policy is to purge in LRU order, but + * can be overridden to prefer purging scratch resources (in LRU order) prior to purging other + * resource types. + * + * @param maxBytesToPurge the desired number of bytes to be purged. + * @param preferScratchResources If true scratch resources will be purged prior to other + * resource types. + */ + void purgeUnlockedResources(size_t bytesToPurge, bool preferScratchResources); + /** Access the context capabilities */ const GrCaps* caps() const { return fCaps; } |