blob: 5d2ba3089884f8e68eeb037b33b76ff09cb092e8 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
reed@google.comac10a2d2010-12-22 21:39:39 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * 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.
reed@google.comac10a2d2010-12-22 21:39:39 +00007 */
8
9
epoger@google.comec3ed6a2011-07-28 14:26:00 +000010
reed@google.comac10a2d2010-12-22 21:39:39 +000011#ifndef GrGLVertexBuffer_DEFINED
12#define GrGLVertexBuffer_DEFINED
13
tomhudson@google.comdd182cb2012-02-10 21:01:00 +000014#include "../GrVertexBuffer.h"
tomhudson@google.com6bf38b52012-02-14 15:11:59 +000015#include "gl/GrGLInterface.h"
reed@google.comac10a2d2010-12-22 21:39:39 +000016
17class GrGpuGL;
18
19class GrGLVertexBuffer : public GrVertexBuffer {
reed@google.comac10a2d2010-12-22 21:39:39 +000020
21public:
bsalomon@google.com8fe72472011-03-30 21:26:44 +000022 virtual ~GrGLVertexBuffer() { this->release(); }
reed@google.comac10a2d2010-12-22 21:39:39 +000023 // overrides of GrVertexBuffer
reed@google.comac10a2d2010-12-22 21:39:39 +000024 virtual void* lock();
bsalomon@google.com1c13c962011-02-14 16:51:21 +000025 virtual void* lockPtr() const;
reed@google.comac10a2d2010-12-22 21:39:39 +000026 virtual void unlock();
27 virtual bool isLocked() const;
bsalomon@google.com1c13c962011-02-14 16:51:21 +000028 virtual bool updateData(const void* src, size_t srcSizeInBytes);
twiz@google.com0f31ca72011-03-18 17:38:11 +000029 GrGLuint bufferID() const;
reed@google.comac10a2d2010-12-22 21:39:39 +000030
bsalomon@google.com8fe72472011-03-30 21:26:44 +000031protected:
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
reed@google.comac10a2d2010-12-22 21:39:39 +000041private:
bsalomon@google.com1c13c962011-02-14 16:51:21 +000042 void bind() const;
bsalomon@google.com8fe72472011-03-30 21:26:44 +000043
twiz@google.com0f31ca72011-03-18 17:38:11 +000044 GrGLuint fBufferID;
reed@google.comac10a2d2010-12-22 21:39:39 +000045 void* fLockPtr;
46
47 friend class GrGpuGL;
48
49 typedef GrVertexBuffer INHERITED;
50};
51
52#endif