diff options
author | bsalomon <bsalomon@google.com> | 2015-01-26 11:46:52 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-26 11:46:52 -0800 |
commit | 66e09a87d48acd7ac3300cce0e55b8c0896300f6 (patch) | |
tree | 799c8346b74264dafa38ecb717e153a129e96cf9 /src | |
parent | 98b0315ad6beb7dbc311fd365ffe5c24d7ef2d0f (diff) |
discard scratch render targets when they are recycled.
Review URL: https://codereview.chromium.org/871373007
Diffstat (limited to 'src')
-rwxr-xr-x | src/gpu/GrContext.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index ea3ea281fe..6879b109cd 100755 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -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) { |