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

Side by Side Diff: src/gpu/gl/GrGLStencilAttachment.cpp

Issue 1862043002: Refactor to separate backend object lifecycle and GpuResource budget decision (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix unrelated GrBuffer::onGpuMemorySize() lack of override keyword compile error Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLStencilAttachment.h ('k') | src/gpu/gl/GrGLTexture.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8
9 #include "GrGLStencilAttachment.h" 9 #include "GrGLStencilAttachment.h"
10 #include "GrGLGpu.h" 10 #include "GrGLGpu.h"
11 #include "SkTraceMemoryDump.h" 11 #include "SkTraceMemoryDump.h"
12 12
13 size_t GrGLStencilAttachment::onGpuMemorySize() const { 13 size_t GrGLStencilAttachment::onGpuMemorySize() const {
14 uint64_t size = this->width(); 14 uint64_t size = this->width();
15 size *= this->height(); 15 size *= this->height();
16 size *= fFormat.fTotalBits; 16 size *= fFormat.fTotalBits;
17 size *= SkTMax(1,this->numSamples()); 17 size *= SkTMax(1,this->numSamples());
18 return static_cast<size_t>(size / 8); 18 return static_cast<size_t>(size / 8);
19 } 19 }
20 20
21 void GrGLStencilAttachment::onRelease() { 21 void GrGLStencilAttachment::onRelease() {
22 if (0 != fRenderbufferID && this->shouldFreeResources()) { 22 if (0 != fRenderbufferID) {
23 GrGLGpu* gpuGL = (GrGLGpu*) this->getGpu(); 23 GrGLGpu* gpuGL = (GrGLGpu*) this->getGpu();
24 const GrGLInterface* gl = gpuGL->glInterface(); 24 const GrGLInterface* gl = gpuGL->glInterface();
25 GR_GL_CALL(gl, DeleteRenderbuffers(1, &fRenderbufferID)); 25 GR_GL_CALL(gl, DeleteRenderbuffers(1, &fRenderbufferID));
26 fRenderbufferID = 0; 26 fRenderbufferID = 0;
27 } 27 }
28 28
29 INHERITED::onRelease(); 29 INHERITED::onRelease();
30 } 30 }
31 31
32 void GrGLStencilAttachment::onAbandon() { 32 void GrGLStencilAttachment::onAbandon() {
33 fRenderbufferID = 0; 33 fRenderbufferID = 0;
34 34
35 INHERITED::onAbandon(); 35 INHERITED::onAbandon();
36 } 36 }
37 37
38 void GrGLStencilAttachment::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, 38 void GrGLStencilAttachment::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump,
39 const SkString& dumpName) const { 39 const SkString& dumpName) const {
40 SkString renderbuffer_id; 40 SkString renderbuffer_id;
41 renderbuffer_id.appendU32(this->renderbufferID()); 41 renderbuffer_id.appendU32(this->renderbufferID());
42 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_renderbuffer", 42 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_renderbuffer",
43 renderbuffer_id.c_str()); 43 renderbuffer_id.c_str());
44 } 44 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLStencilAttachment.h ('k') | src/gpu/gl/GrGLTexture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698