• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /*
3  * Copyright 2011 Google Inc.
4  *
5  * Use of this source code is governed by a BSD-style license that can be
6  * found in the LICENSE file.
7  */
8 
9 
10 
11 #ifndef GrGLVertexBuffer_DEFINED
12 #define GrGLVertexBuffer_DEFINED
13 
14 #include "../GrVertexBuffer.h"
15 #include "gl/GrGLInterface.h"
16 
17 class GrGpuGL;
18 
19 class GrGLVertexBuffer : public GrVertexBuffer {
20 
21 public:
~GrGLVertexBuffer()22     virtual ~GrGLVertexBuffer() { this->release(); }
23     // overrides of GrVertexBuffer
24     virtual void* lock();
25     virtual void* lockPtr() const;
26     virtual void unlock();
27     virtual bool isLocked() const;
28     virtual bool updateData(const void* src, size_t srcSizeInBytes);
29     GrGLuint bufferID() const;
30 
31 protected:
32     GrGLVertexBuffer(GrGpuGL* gpu,
33                      GrGLuint id,
34                      size_t sizeInBytes,
35                      bool dynamic);
36 
37     // overrides of GrResource
38     virtual void onAbandon();
39     virtual void onRelease();
40 
41 private:
42     void bind() const;
43 
44     GrGLuint     fBufferID;
45     void*        fLockPtr;
46 
47     friend class GrGpuGL;
48 
49     typedef GrVertexBuffer INHERITED;
50 };
51 
52 #endif
53