OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrGLRenderTarget.h" | 8 #include "GrGLRenderTarget.h" |
9 | 9 |
10 #include "GrGLGpu.h" | 10 #include "GrGLGpu.h" |
11 #include "SkTraceMemoryDump.h" | |
11 | 12 |
12 #define GPUGL static_cast<GrGLGpu*>(this->getGpu()) | 13 #define GPUGL static_cast<GrGLGpu*>(this->getGpu()) |
13 #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X) | 14 #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X) |
14 | 15 |
15 // Because this class is virtually derived from GrSurface we must explicitly cal l its constructor. | 16 // Because this class is virtually derived from GrSurface we must explicitly cal l its constructor. |
16 GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu, const GrSurfaceDesc& desc, cons t IDDesc& idDesc) | 17 GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu, const GrSurfaceDesc& desc, cons t IDDesc& idDesc) |
17 : GrSurface(gpu, idDesc.fLifeCycle, desc) | 18 : GrSurface(gpu, idDesc.fLifeCycle, desc) |
18 , INHERITED(gpu, idDesc.fLifeCycle, desc, idDesc.fSampleConfig) { | 19 , INHERITED(gpu, idDesc.fLifeCycle, desc, idDesc.fSampleConfig) { |
19 this->init(desc, idDesc); | 20 this->init(desc, idDesc); |
20 this->registerWithCache(); | 21 this->registerWithCache(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 fMSColorRenderbufferID = 0; | 78 fMSColorRenderbufferID = 0; |
78 INHERITED::onRelease(); | 79 INHERITED::onRelease(); |
79 } | 80 } |
80 | 81 |
81 void GrGLRenderTarget::onAbandon() { | 82 void GrGLRenderTarget::onAbandon() { |
82 fRTFBOID = 0; | 83 fRTFBOID = 0; |
83 fTexFBOID = 0; | 84 fTexFBOID = 0; |
84 fMSColorRenderbufferID = 0; | 85 fMSColorRenderbufferID = 0; |
85 INHERITED::onAbandon(); | 86 INHERITED::onAbandon(); |
86 } | 87 } |
88 | |
89 void GrGLRenderTarget::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | |
90 // Don't log the backing texture's contribution to the memory size. This wil l be handled by the | |
91 // texture object. | |
92 | |
93 // If we have a renderbuffer and it is not auto-resolving, dump it. | |
94 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
| |
95 size_t colorBytes = GrBytesPerPixel(fDesc.fConfig); | |
96 size_t size = SkTMax(1, fDesc.fSampleCnt) * fDesc.fWidth * fDesc.fHeight * colorBytes; | |
97 | |
98 // Due to this resource having both a texture and a renderbuffer compone nt, dump as | |
99 // skia/gpu_resources/resource_#/renderbuffer | |
100 SkString dumpName("skia/gpu_resources/resource_"); | |
101 dumpName.appendS32(this->getUniqueID()); | |
102 dumpName.append("/renderbuffer"); | |
103 | |
104 traceMemoryDump->dumpNumericValue(dumpName.c_str(), "size", "bytes", siz e); | |
105 | |
106 if (this->isPurgeable()) { | |
107 traceMemoryDump->dumpNumericValue(dumpName.c_str(), "purgeable_size" , "bytes", size); | |
108 } | |
109 | |
110 SkString renderbuffer_id; | |
111 renderbuffer_id.appendU32(fMSColorRenderbufferID); | |
112 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_renderbuffer", | |
113 renderbuffer_id.c_str()); | |
114 } | |
115 } | |
OLD | NEW |