OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #ifndef GrGLBufferImpl_DEFINED | 8 #ifndef GrGLBufferImpl_DEFINED |
9 #define GrGLBufferImpl_DEFINED | 9 #define GrGLBufferImpl_DEFINED |
10 | 10 |
11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
12 #include "gl/GrGLFunctions.h" | 12 #include "gl/GrGLFunctions.h" |
13 | 13 |
14 class GrGLGpu; | 14 class GrGLGpu; |
15 | 15 |
16 /** | 16 /** |
17 * This class serves as the implementation of GrGL*Buffer classes. It was writte
n to avoid code | 17 * This class serves as the implementation of GrGL*Buffer classes. It was writte
n to avoid code |
18 * duplication in those classes. | 18 * duplication in those classes. |
19 */ | 19 */ |
20 class GrGLBufferImpl : SkNoncopyable { | 20 class GrGLBufferImpl : SkNoncopyable { |
21 public: | 21 public: |
22 struct Desc { | 22 struct Desc { |
23 bool fIsWrapped; | |
24 GrGLuint fID; // set to 0 to indicate buffer is CPU-backed
and not a VBO. | 23 GrGLuint fID; // set to 0 to indicate buffer is CPU-backed
and not a VBO. |
25 size_t fSizeInBytes; | 24 size_t fSizeInBytes; |
26 bool fDynamic; | 25 bool fDynamic; |
27 }; | 26 }; |
28 | 27 |
29 GrGLBufferImpl(GrGLGpu*, const Desc&, GrGLenum bufferType); | 28 GrGLBufferImpl(GrGLGpu*, const Desc&, GrGLenum bufferType); |
30 ~GrGLBufferImpl() { | 29 ~GrGLBufferImpl() { |
31 // either release or abandon should have been called by the owner of thi
s object. | 30 // either release or abandon should have been called by the owner of thi
s object. |
32 SkASSERT(0 == fDesc.fID); | 31 SkASSERT(0 == fDesc.fID); |
33 } | 32 } |
(...skipping 18 matching lines...) Expand all Loading... |
52 GrGLenum fBufferType; // GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER | 51 GrGLenum fBufferType; // GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER |
53 void* fCPUData; | 52 void* fCPUData; |
54 void* fMapPtr; | 53 void* fMapPtr; |
55 size_t fGLSizeInBytes; // In certain cases we make the size of the
GL buffer object | 54 size_t fGLSizeInBytes; // In certain cases we make the size of the
GL buffer object |
56 // smaller or larger than the size in fDesc
. | 55 // smaller or larger than the size in fDesc
. |
57 | 56 |
58 typedef SkNoncopyable INHERITED; | 57 typedef SkNoncopyable INHERITED; |
59 }; | 58 }; |
60 | 59 |
61 #endif | 60 #endif |
OLD | NEW |