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

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

Issue 1825393002: Consolidate GPU buffer implementations (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: asserts 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/GrGLVertexBuffer.h ('k') | src/gpu/vk/GrVkCaps.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2011 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "GrGLVertexBuffer.h"
9 #include "GrGLGpu.h"
10 #include "SkTraceMemoryDump.h"
11
12 GrGLVertexBuffer::GrGLVertexBuffer(GrGLGpu* gpu, const Desc& desc)
13 : INHERITED(gpu, desc.fSizeInBytes, GrGLBufferImpl::kDynamicDraw_Usage == de sc.fUsage,
14 0 == desc.fID)
15 , fImpl(gpu, desc, GR_GL_ARRAY_BUFFER) {
16 this->registerWithCache();
17 }
18
19 void GrGLVertexBuffer::onRelease() {
20 if (!this->wasDestroyed()) {
21 fImpl.release(this->getGpuGL());
22 }
23
24 INHERITED::onRelease();
25 }
26
27 void GrGLVertexBuffer::onAbandon() {
28 fImpl.abandon();
29 INHERITED::onAbandon();
30 }
31
32 void* GrGLVertexBuffer::onMap() {
33 if (!this->wasDestroyed()) {
34 return fImpl.map(this->getGpuGL());
35 } else {
36 return nullptr;
37 }
38 }
39
40 void GrGLVertexBuffer::onUnmap() {
41 if (!this->wasDestroyed()) {
42 fImpl.unmap(this->getGpuGL());
43 }
44 }
45
46 bool GrGLVertexBuffer::onUpdateData(const void* src, size_t srcSizeInBytes) {
47 if (!this->wasDestroyed()) {
48 return fImpl.updateData(this->getGpuGL(), src, srcSizeInBytes);
49 } else {
50 return false;
51 }
52 }
53
54 void GrGLVertexBuffer::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump,
55 const SkString& dumpName) const {
56 SkString buffer_id;
57 buffer_id.appendU32(this->bufferID());
58 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_buffer",
59 buffer_id.c_str());
60 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLVertexBuffer.h ('k') | src/gpu/vk/GrVkCaps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698