aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLRenderTarget.cpp
diff options
context:
space:
mode:
authorGravatar Eric Karl <ericrk@chromium.org>2018-03-19 13:04:03 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-19 20:37:25 +0000
commitaf7700265b74123d8ad3de6dde0c21545453140b (patch)
treee642696535d8ad9fa814bb9b3dde6c2f4e37a18a /src/gpu/gl/GrGLRenderTarget.cpp
parent72040d9d709a27b53bbce5f11ede02bfcf72dfdf (diff)
Allow SkTraceMemoryDump to exclude wrapped objects
Allow SkTraceMemoryDump to exclude wrapped objects from dumps. This helps avoid duplicate dumping when Skia is wrapping an external object which is already dumped externally. Bug: 795358 Change-Id: Icbda96b564c81b958d40f74693280ac7d5ba7332 Reviewed-on: https://skia-review.googlesource.com/114681 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Eric Karl <ericrk@chromium.org>
Diffstat (limited to 'src/gpu/gl/GrGLRenderTarget.cpp')
-rw-r--r--src/gpu/gl/GrGLRenderTarget.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/gpu/gl/GrGLRenderTarget.cpp b/src/gpu/gl/GrGLRenderTarget.cpp
index e1a4eb0bae..9500e7d6fe 100644
--- a/src/gpu/gl/GrGLRenderTarget.cpp
+++ b/src/gpu/gl/GrGLRenderTarget.cpp
@@ -195,11 +195,21 @@ bool GrGLRenderTarget::canAttemptStencilAttachment() const {
}
void GrGLRenderTarget::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const {
- // Don't log the backing texture's contribution to the memory size. This will be handled by the
- // texture object.
+ // Don't check this->fRefsWrappedObjects, as we might be the base of a GrGLTextureRenderTarget
+ // which is multiply inherited from both ourselves and a texture. In these cases, one part
+ // (texture, rt) may be wrapped, while the other is owned by Skia.
+ bool refsWrappedRenderTargetObjects =
+ this->fRTFBOOwnership == GrBackendObjectOwnership::kBorrowed;
+ if (refsWrappedRenderTargetObjects && !traceMemoryDump->shouldDumpWrappedObjects()) {
+ return;
+ }
+
+ // Don't log the framebuffer, as the framebuffer itself doesn't contribute to meaningful
+ // memory usage. It is always a wrapper around either:
+ // - a texture, which is owned elsewhere, and will be dumped there
+ // - a renderbuffer, which will be dumped below.
- // Log any renderbuffer's contribution to memory. We only do this if we own the renderbuffer
- // (have a fMSColorRenderbufferID).
+ // Log any renderbuffer's contribution to memory.
if (fMSColorRenderbufferID) {
size_t size = GrSurface::ComputeSize(this->config(), this->width(), this->height(),
this->msaaSamples(), GrMipMapped::kNo);