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

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

Issue 1831133004: Revert of Consolidate GPU buffer implementations (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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/GrGLTransferBuffer.h ('k') | src/gpu/gl/GrGLVertexArray.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLTransferBuffer.cpp
diff --git a/src/gpu/gl/GrGLTransferBuffer.cpp b/src/gpu/gl/GrGLTransferBuffer.cpp
new file mode 100755
index 0000000000000000000000000000000000000000..b7ee766d92844fee961954cfbda95ccb62be38fe
--- /dev/null
+++ b/src/gpu/gl/GrGLTransferBuffer.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "GrGLTransferBuffer.h"
+#include "GrGLGpu.h"
+#include "SkTraceMemoryDump.h"
+
+GrGLTransferBuffer::GrGLTransferBuffer(GrGLGpu* gpu, const Desc& desc, GrGLenum type)
+ : INHERITED(gpu, desc.fSizeInBytes)
+ , fImpl(gpu, desc, type) {
+ this->registerWithCache();
+}
+
+void GrGLTransferBuffer::onRelease() {
+ if (!this->wasDestroyed()) {
+ fImpl.release(this->getGpuGL());
+ }
+
+ INHERITED::onRelease();
+}
+
+void GrGLTransferBuffer::onAbandon() {
+ fImpl.abandon();
+ INHERITED::onAbandon();
+}
+
+void* GrGLTransferBuffer::onMap() {
+ if (!this->wasDestroyed()) {
+ return fImpl.map(this->getGpuGL());
+ } else {
+ return nullptr;
+ }
+}
+
+void GrGLTransferBuffer::onUnmap() {
+ if (!this->wasDestroyed()) {
+ fImpl.unmap(this->getGpuGL());
+ }
+}
+
+void GrGLTransferBuffer::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());
+}
« no previous file with comments | « src/gpu/gl/GrGLTransferBuffer.h ('k') | src/gpu/gl/GrGLVertexArray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698