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

Unified Diff: src/gpu/GrGpuResource.cpp

Issue 870743002: Allow unbudgeted resources to be recycled by the cache as scratch. (Closed) Base URL: https://skia.googlesource.com/skia.git@ckey
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrGpuResource.cpp
diff --git a/src/gpu/GrGpuResource.cpp b/src/gpu/GrGpuResource.cpp
index 3e9964f1a029642642a0bd39b69d32c4c3e8867c..15d5888cc07384d74f2c7db5a1ff078a6030be2a 100644
--- a/src/gpu/GrGpuResource.cpp
+++ b/src/gpu/GrGpuResource.cpp
@@ -86,8 +86,8 @@ bool GrGpuResource::setContentKey(const GrContentKey& key) {
// Currently this can only be called once and can't be called when the resource is scratch.
SkASSERT(this->internalHasRef());
- // Wrapped resources can never have a key.
- if (this->isWrapped()) {
+ // Wrapped and uncached resources can never have a content key.
+ if (!this->cacheAccess().isBudgeted()) {
return false;
}
@@ -138,6 +138,13 @@ void GrGpuResource::makeBudgeted() {
}
}
+void GrGpuResource::makeUnbudgeted() {
+ if (GrGpuResource::kCached_LifeCycle == fLifeCycle && !fContentKey.isValid()) {
+ fLifeCycle = kUncached_LifeCycle;
+ get_resource_cache2(fGpu)->resourceAccess().didChangeBudgetStatus(this);
+ }
+}
+
uint32_t GrGpuResource::CreateUniqueID() {
static int32_t gUniqueID = SK_InvalidUniqueID;
uint32_t id;

Powered by Google App Engine
This is Rietveld 408576698