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 GrGLIndexBuffer_DEFINED |
| 19 | #define GrGLIndexBuffer_DEFINED |
| 20 | |
| 21 | #include "GrIndexBuffer.h" |
| 22 | #include "GrGLConfig.h" |
| 23 | |
| 24 | class GrGpuGL; |
| 25 | |
| 26 | class GrGLIndexBuffer : public GrIndexBuffer { |
| 27 | protected: |
| 28 | GrGLIndexBuffer(GLuint id, |
| 29 | GrGpuGL* gl, |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame^] | 30 | size_t sizeInBytes, |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 31 | bool dynamic); |
| 32 | public: |
| 33 | virtual ~GrGLIndexBuffer(); |
| 34 | |
| 35 | GLuint bufferID() const; |
| 36 | |
| 37 | // overrides of GrIndexBuffer |
| 38 | virtual void abandon(); |
| 39 | virtual void* lock(); |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame^] | 40 | virtual void* lockPtr() const; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 41 | virtual void unlock(); |
| 42 | virtual bool isLocked() const; |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame^] | 43 | virtual bool updateData(const void* src, size_t srcSizeInBytes); |
| 44 | virtual bool updateSubData(const void* src, |
| 45 | size_t srcSizeInBytes, |
| 46 | size_t offset); |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 47 | private: |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame^] | 48 | void bind() const; |
| 49 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 50 | GrGpuGL* fGL; |
| 51 | GLuint fBufferID; |
| 52 | void* fLockPtr; |
| 53 | |
| 54 | friend class GrGpuGL; |
| 55 | |
| 56 | typedef GrIndexBuffer INHERITED; |
| 57 | }; |
| 58 | |
| 59 | #endif |