| reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame^] | 1 | /* | 
 | 2 |     Copyright 2010 Google Inc. | 
 | 3 |  | 
 | 4 |     Licensed under the Apache License, Version 2.0 (the "License"); | 
 | 5 |     you may not use this file except in compliance with the License. | 
 | 6 |     You may obtain a copy of the License at | 
 | 7 |  | 
 | 8 |          http://www.apache.org/licenses/LICENSE-2.0 | 
 | 9 |  | 
 | 10 |     Unless required by applicable law or agreed to in writing, software | 
 | 11 |     distributed under the License is distributed on an "AS IS" BASIS, | 
 | 12 |     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
 | 13 |     See the License for the specific language governing permissions and | 
 | 14 |     limitations under the License. | 
 | 15 |  */ | 
 | 16 |  | 
 | 17 |  | 
 | 18 | #ifndef GrGLVertexBuffer_DEFINED | 
 | 19 | #define GrGLVertexBuffer_DEFINED | 
 | 20 |  | 
 | 21 | #include "GrVertexBuffer.h" | 
 | 22 | #include "GrGLConfig.h" | 
 | 23 |  | 
 | 24 | class GrGpuGL; | 
 | 25 |  | 
 | 26 | class GrGLVertexBuffer : public GrVertexBuffer { | 
 | 27 | protected: | 
 | 28 |     GrGLVertexBuffer(GLuint id, | 
 | 29 |                      GrGpuGL* gl, | 
 | 30 |                      uint32_t sizeInBytes, | 
 | 31 |                      bool dynamic); | 
 | 32 |  | 
 | 33 | public: | 
 | 34 |     virtual ~GrGLVertexBuffer(); | 
 | 35 |      | 
 | 36 |     // overrides of GrVertexBuffer | 
 | 37 |     virtual void abandon(); | 
 | 38 |     virtual void* lock(); | 
 | 39 |     virtual void unlock(); | 
 | 40 |     virtual bool isLocked() const; | 
 | 41 |     virtual bool updateData(const void* src, uint32_t srcSizeInBytes); | 
 | 42 |  | 
 | 43 |     GLuint bufferID() const; | 
 | 44 |  | 
 | 45 | private: | 
 | 46 |     GrGpuGL*     fGL; | 
 | 47 |     GLuint       fBufferID; | 
 | 48 |     void*        fLockPtr; | 
 | 49 |  | 
 | 50 |     friend class GrGpuGL; | 
 | 51 |  | 
 | 52 |     typedef GrVertexBuffer INHERITED; | 
 | 53 | }; | 
 | 54 |  | 
 | 55 | #endif |