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

Unified Diff: src/gpu/GrGpuResource.cpp

Issue 1810323002: Cache render targets that render to wrapped textures Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 7c053b31d702e160ddfde601ae3422b2d1fbf5b2..708a4f9619fe4304bd1d164b4e0e457425f764c0 100644
--- a/src/gpu/GrGpuResource.cpp
+++ b/src/gpu/GrGpuResource.cpp
@@ -20,10 +20,10 @@ static inline GrResourceCache* get_resource_cache(GrGpu* gpu) {
return gpu->getContext()->getResourceCache();
}
-GrGpuResource::GrGpuResource(GrGpu* gpu, LifeCycle lifeCycle)
+GrGpuResource::GrGpuResource(GrGpu* gpu, SkBudgeted budgeted)
: fGpu(gpu)
, fGpuMemorySize(kInvalidGpuMemorySize)
- , fLifeCycle(lifeCycle)
+ , fBudgeted(budgeted)
, fUniqueID(CreateUniqueID()) {
SkDEBUGCODE(fCacheArrayIndex = -1);
}
@@ -169,7 +169,8 @@ void GrGpuResource::setScratchKey(const GrScratchKey& scratchKey) {
SkASSERT(!fScratchKey.isValid());
SkASSERT(scratchKey.isValid());
// Wrapped resources can never have a scratch key.
- if (this->resourcePriv().isExternal()) {
+ if (this->resourcePriv().refsWrappedResources()) {
+ SkASSERT(false);
return;
}
fScratchKey = scratchKey;
@@ -183,16 +184,16 @@ void GrGpuResource::removeScratchKey() {
}
void GrGpuResource::makeBudgeted() {
- if (!this->wasDestroyed() && GrGpuResource::kUncached_LifeCycle == fLifeCycle) {
- fLifeCycle = kCached_LifeCycle;
+ if (!this->wasDestroyed() && SkBudgeted::kNo == fBudgeted) {
+ fBudgeted = SkBudgeted::kYes;
get_resource_cache(fGpu)->resourceAccess().didChangeBudgetStatus(this);
}
}
void GrGpuResource::makeUnbudgeted() {
- if (!this->wasDestroyed() && GrGpuResource::kCached_LifeCycle == fLifeCycle &&
+ if (!this->wasDestroyed() && SkBudgeted::kYes == fBudgeted &&
!fUniqueKey.isValid()) {
- fLifeCycle = kUncached_LifeCycle;
+ fBudgeted = SkBudgeted::kNo;
get_resource_cache(fGpu)->resourceAccess().didChangeBudgetStatus(this);
}
}
« no previous file with comments | « src/gpu/GrGpu.cpp ('k') | src/gpu/GrGpuResourceCacheAccess.h » ('j') | src/gpu/gl/GrGLGpu.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698