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