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

Side by Side Diff: src/gpu/gl/GrGLBuffer.h

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 unified diff | Download patch
« no previous file with comments | « src/gpu/effects/GrDashingEffect.cpp ('k') | src/gpu/gl/GrGLBuffer.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 2016 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 #ifndef GrGLBuffer_DEFINED
9 #define GrGLBuffer_DEFINED
10
11 #include "GrBuffer.h"
12 #include "gl/GrGLTypes.h"
13
14 class GrGLGpu;
15 class GrGLCaps;
16
17 class GrGLBuffer : public GrBuffer {
18 public:
19 static GrGLBuffer* Create(GrGLGpu*, GrBufferType, size_t size, GrAccessPatte rn);
20
21 ~GrGLBuffer() {
22 // either release or abandon should have been called by the owner of thi s object.
23 SkASSERT(0 == fBufferID);
24 }
25
26 GrGLenum target() const { return fTarget; }
27 GrGLuint bufferID() const { return fBufferID; }
28 size_t baseOffset() const { return reinterpret_cast<size_t>(fCPUData); }
29
30 protected:
31 GrGLBuffer(GrGLGpu*, GrBufferType, size_t size, GrAccessPattern, bool cpuBac ked);
32
33 void onAbandon() override;
34 void onRelease() override;
35 void setMemoryBacking(SkTraceMemoryDump* traceMemoryDump,
36 const SkString& dumpName) const override;
37
38 private:
39 GrGLGpu* glGpu() const;
40 const GrGLCaps& glCaps() const;
41
42 void onMap() override;
43 void onUnmap() override;
44 bool onUpdateData(const void* src, size_t srcSizeInBytes) override;
45
46 #ifdef SK_DEBUG
47 void validate() const;
48 #endif
49
50 void* fCPUData;
51 GrGLenum fTarget; // GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER, e.g.
52 GrGLuint fBufferID;
53 size_t fSizeInBytes;
54 GrGLenum fUsage;
55 size_t fGLSizeInBytes; // In certain cases we make the size of the GL buffer object
56 // smaller or larger than the size in fDesc .
57
58 typedef GrBuffer INHERITED;
59 };
60
61 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrDashingEffect.cpp ('k') | src/gpu/gl/GrGLBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698