aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-01-26 11:46:52 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-26 11:46:52 -0800
commit66e09a87d48acd7ac3300cce0e55b8c0896300f6 (patch)
tree799c8346b74264dafa38ecb717e153a129e96cf9 /src
parent98b0315ad6beb7dbc311fd365ffe5c24d7ef2d0f (diff)
discard scratch render targets when they are recycled.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/gpu/GrContext.cpp7
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) {