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

Unified Diff: src/gpu/GrContext.cpp

Issue 650283002: Prefer to recycle non-RT scratch textures that don't have pending IO (Closed) Base URL: https://skia.googlesource.com/skia.git@ast
Patch Set: Address comments Created 6 years, 2 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
« no previous file with comments | « no previous file | src/gpu/GrResourceCache2.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index b9cbf3f1a3a97ac044ed210a136ec9a072f5dcfb..6ad98ff0f7a83290094d3217d599c739dc1bd22d 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -470,8 +470,15 @@ GrTexture* GrContext::refScratchTexture(const GrTextureDesc& inDesc, ScratchTexM
do {
GrResourceKey key = GrTexturePriv::ComputeScratchKey(*desc);
- GrGpuResource* resource = fResourceCache2->findAndRefScratchResource(key,
- calledDuringFlush);
+ uint32_t scratchFlags = 0;
+ if (calledDuringFlush) {
+ scratchFlags = GrResourceCache2::kRequireNoPendingIO_ScratchFlag;
+ } else if (!(desc->fFlags & kRenderTarget_GrTextureFlagBit)) {
+ // If it is not a render target then it will most likely be populated by
+ // writePixels() which will trigger a flush if the texture has pending IO.
+ scratchFlags = GrResourceCache2::kPreferNoPendingIO_ScratchFlag;
+ }
+ GrGpuResource* resource = fResourceCache2->findAndRefScratchResource(key, scratchFlags);
if (resource) {
fResourceCache->makeResourceMRU(resource);
return static_cast<GrTexture*>(resource);
« no previous file with comments | « no previous file | src/gpu/GrResourceCache2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698