discard scratch render targets when they are recycled.

Review URL: https://codereview.chromium.org/871373007
This commit is contained in:
bsalomon 2015-01-26 11:46:52 -08:00 committed by Commit bot
parent 98b0315ad6
commit 66e09a87d4

View File

@ -473,7 +473,12 @@ GrTexture* GrContext::refScratchTexture(const GrSurfaceDesc& inDesc, ScratchTexM
}
GrGpuResource* resource = fResourceCache2->findAndRefScratchResource(key, scratchFlags);
if (resource) {
return static_cast<GrSurface*>(resource)->asTexture();
GrSurface* surface = static_cast<GrSurface*>(resource);
GrRenderTarget* rt = surface->asRenderTarget();
if (rt && fGpu->caps()->discardRenderTargetSupport()) {
rt->discard();
}
return surface->asTexture();
}
if (kExact_ScratchTexMatch == match) {