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 |
(...skipping 19 matching lines...) Expand all Loading... |
30 // 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. |
31 SkASSERT(0 == fDesc.fID); | 31 SkASSERT(0 == fDesc.fID); |
32 } | 32 } |
33 | 33 |
34 void abandon(); | 34 void abandon(); |
35 void release(GrGLGpu* gpu); | 35 void release(GrGLGpu* gpu); |
36 | 36 |
37 GrGLuint bufferID() const { return fDesc.fID; } | 37 GrGLuint bufferID() const { return fDesc.fID; } |
38 size_t baseOffset() const { return reinterpret_cast<size_t>(fCPUData); } | 38 size_t baseOffset() const { return reinterpret_cast<size_t>(fCPUData); } |
39 | 39 |
40 void bind(GrGLGpu* gpu) const; | |
41 | |
42 void* map(GrGLGpu* gpu); | 40 void* map(GrGLGpu* gpu); |
43 void unmap(GrGLGpu* gpu); | 41 void unmap(GrGLGpu* gpu); |
44 bool isMapped() const; | 42 bool isMapped() const; |
45 bool updateData(GrGLGpu* gpu, const void* src, size_t srcSizeInBytes); | 43 bool updateData(GrGLGpu* gpu, const void* src, size_t srcSizeInBytes); |
46 | 44 |
47 private: | 45 private: |
48 void validate() const; | 46 void validate() const; |
49 | 47 |
50 Desc fDesc; | 48 Desc fDesc; |
51 GrGLenum fBufferType; // GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER | 49 GrGLenum fBufferType; // GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER |
52 void* fCPUData; | 50 void* fCPUData; |
53 void* fMapPtr; | 51 void* fMapPtr; |
54 size_t fGLSizeInBytes; // In certain cases we make the size of the
GL buffer object | 52 size_t fGLSizeInBytes; // In certain cases we make the size of the
GL buffer object |
55 // smaller or larger than the size in fDesc
. | 53 // smaller or larger than the size in fDesc
. |
56 | 54 |
57 typedef SkNoncopyable INHERITED; | 55 typedef SkNoncopyable INHERITED; |
58 }; | 56 }; |
59 | 57 |
60 #endif | 58 #endif |
OLD | NEW |