diff options
author | 2016-03-25 01:54:54 -0700 | |
---|---|---|
committer | 2016-03-25 01:54:55 -0700 | |
commit | 8b1bff29675afd25843439eade634a57f68fe16f (patch) | |
tree | 07e7676e54f5520b14e2e1896c64e96b4f61f3c3 /src/gpu/gl/GrGLVertexBuffer.cpp | |
parent | 6b3eacb0dfaeb3374d410c8c041bd39cd066e1ea (diff) |
Consolidate GPU buffer implementations
Consolidates all the different buffer implementations into a single
GrBuffer class. This will allow us to add new buffer types, use DSA in
OpenGL, track buffer bindings by unique ID, cache buffers without
respect to the type of data they have been used for previously, etc.
This change is strictly a refactor; it introduces no change in
functionality.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1825393002
Review URL: https://codereview.chromium.org/1825393002
Diffstat (limited to 'src/gpu/gl/GrGLVertexBuffer.cpp')
-rw-r--r-- | src/gpu/gl/GrGLVertexBuffer.cpp | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/src/gpu/gl/GrGLVertexBuffer.cpp b/src/gpu/gl/GrGLVertexBuffer.cpp deleted file mode 100644 index 2294844fc4..0000000000 --- a/src/gpu/gl/GrGLVertexBuffer.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "GrGLVertexBuffer.h" -#include "GrGLGpu.h" -#include "SkTraceMemoryDump.h" - -GrGLVertexBuffer::GrGLVertexBuffer(GrGLGpu* gpu, const Desc& desc) - : INHERITED(gpu, desc.fSizeInBytes, GrGLBufferImpl::kDynamicDraw_Usage == desc.fUsage, - 0 == desc.fID) - , fImpl(gpu, desc, GR_GL_ARRAY_BUFFER) { - this->registerWithCache(); -} - -void GrGLVertexBuffer::onRelease() { - if (!this->wasDestroyed()) { - fImpl.release(this->getGpuGL()); - } - - INHERITED::onRelease(); -} - -void GrGLVertexBuffer::onAbandon() { - fImpl.abandon(); - INHERITED::onAbandon(); -} - -void* GrGLVertexBuffer::onMap() { - if (!this->wasDestroyed()) { - return fImpl.map(this->getGpuGL()); - } else { - return nullptr; - } -} - -void GrGLVertexBuffer::onUnmap() { - if (!this->wasDestroyed()) { - fImpl.unmap(this->getGpuGL()); - } -} - -bool GrGLVertexBuffer::onUpdateData(const void* src, size_t srcSizeInBytes) { - if (!this->wasDestroyed()) { - return fImpl.updateData(this->getGpuGL(), src, srcSizeInBytes); - } else { - return false; - } -} - -void GrGLVertexBuffer::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, - const SkString& dumpName) const { - SkString buffer_id; - buffer_id.appendU32(this->bufferID()); - traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_buffer", - buffer_id.c_str()); -} |