Chromium Code Reviews| Index: src/gpu/GrContext.cpp |
| diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp |
| index 20596d2b0d4c1db324b02c9f0227815de90d6c36..f3fd4e193b4eb6c41a844be0a977f0dc77162927 100755 |
| --- a/src/gpu/GrContext.cpp |
| +++ b/src/gpu/GrContext.cpp |
| @@ -471,8 +471,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)) { |
|
robertphillips
2014/10/15 20:06:13
Why not just always pass Prefer if !calledDuringFl
bsalomon
2014/10/16 01:51:14
I think it's better to keep reusing the same textu
|
| + // If it is not a render target then it will most likley 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); |