Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Unified Diff: src/gpu/gl/GrGLRenderTarget.cpp

Issue 1313743002: Add onMemoryDump to GrContext (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Re-add missing file Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLRenderTarget.h ('k') | src/gpu/gl/GrGLStencilAttachment.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLRenderTarget.cpp
diff --git a/src/gpu/gl/GrGLRenderTarget.cpp b/src/gpu/gl/GrGLRenderTarget.cpp
index cb9d310010b596fb7a90cf2d58b3064cca9cccbe..14a53ff7e4c50dce88c6bd6411e12117f24c2164 100644
--- a/src/gpu/gl/GrGLRenderTarget.cpp
+++ b/src/gpu/gl/GrGLRenderTarget.cpp
@@ -8,6 +8,7 @@
#include "GrGLRenderTarget.h"
#include "GrGLGpu.h"
+#include "SkTraceMemoryDump.h"
#define GPUGL static_cast<GrGLGpu*>(this->getGpu())
#define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X)
@@ -84,3 +85,31 @@ void GrGLRenderTarget::onAbandon() {
fMSColorRenderbufferID = 0;
INHERITED::onAbandon();
}
+
+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.
+
+ // If we have a renderbuffer and it is not auto-resolving, dump it.
+ if (fMSColorRenderbufferID && fRTFBOID != 0) {
bsalomon 2015/09/08 15:00:49 A bug in similar logic was fixed recently in GrGLR
ericrk 2015/09/14 21:55:54 This isn't quite what we want to do here... we onl
+ size_t colorBytes = GrBytesPerPixel(fDesc.fConfig);
+ size_t size = SkTMax(1, fDesc.fSampleCnt) * fDesc.fWidth * fDesc.fHeight * colorBytes;
+
+ // Due to this resource having both a texture and a renderbuffer component, dump as
+ // skia/gpu_resources/resource_#/renderbuffer
+ SkString dumpName("skia/gpu_resources/resource_");
+ dumpName.appendS32(this->getUniqueID());
+ dumpName.append("/renderbuffer");
+
+ traceMemoryDump->dumpNumericValue(dumpName.c_str(), "size", "bytes", size);
+
+ if (this->isPurgeable()) {
+ traceMemoryDump->dumpNumericValue(dumpName.c_str(), "purgeable_size", "bytes", size);
+ }
+
+ SkString renderbuffer_id;
+ renderbuffer_id.appendU32(fMSColorRenderbufferID);
+ traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_renderbuffer",
+ renderbuffer_id.c_str());
+ }
+}
« no previous file with comments | « src/gpu/gl/GrGLRenderTarget.h ('k') | src/gpu/gl/GrGLStencilAttachment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698