blob: 5755c073bc072224843a7d11d638ee30b13a2727 [file] [log] [blame]
reed@google.comac10a2d2010-12-22 21:39:39 +00001/*
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
24class GrGpuGL;
25
26class GrGLIndexBuffer : public GrIndexBuffer {
27protected:
28 GrGLIndexBuffer(GLuint id,
29 GrGpuGL* gl,
bsalomon@google.com1c13c962011-02-14 16:51:21 +000030 size_t sizeInBytes,
reed@google.comac10a2d2010-12-22 21:39:39 +000031 bool dynamic);
32public:
33 virtual ~GrGLIndexBuffer();
34
35 GLuint bufferID() const;
36
37 // overrides of GrIndexBuffer
38 virtual void abandon();
39 virtual void* lock();
bsalomon@google.com1c13c962011-02-14 16:51:21 +000040 virtual void* lockPtr() const;
reed@google.comac10a2d2010-12-22 21:39:39 +000041 virtual void unlock();
42 virtual bool isLocked() const;
bsalomon@google.com1c13c962011-02-14 16:51:21 +000043 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.comac10a2d2010-12-22 21:39:39 +000047private:
bsalomon@google.com1c13c962011-02-14 16:51:21 +000048 void bind() const;
49
reed@google.comac10a2d2010-12-22 21:39:39 +000050 GrGpuGL* fGL;
51 GLuint fBufferID;
52 void* fLockPtr;
53
54 friend class GrGpuGL;
55
56 typedef GrIndexBuffer INHERITED;
57};
58
59#endif