blob: 7df759e0436b3fa6f5cfcd98b4cf5d244be17a85 [file] [log] [blame]
reed@google.comac10a2d2010-12-22 21:39:39 +00001/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00002 * Copyright 2011 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
reed@google.comac10a2d2010-12-22 21:39:39 +00006 */
7
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
reed@google.comac10a2d2010-12-22 21:39:39 +000010#ifndef GrGLVertexBuffer_DEFINED
11#define GrGLVertexBuffer_DEFINED
12
tomhudson@google.comd8f856c2012-05-10 12:13:36 +000013#include "GrVertexBuffer.h"
tomhudson@google.com6bf38b52012-02-14 15:11:59 +000014#include "gl/GrGLInterface.h"
reed@google.comac10a2d2010-12-22 21:39:39 +000015
16class GrGpuGL;
17
18class GrGLVertexBuffer : public GrVertexBuffer {
reed@google.comac10a2d2010-12-22 21:39:39 +000019
20public:
bsalomon@google.com8fe72472011-03-30 21:26:44 +000021 virtual ~GrGLVertexBuffer() { this->release(); }
reed@google.comac10a2d2010-12-22 21:39:39 +000022 // overrides of GrVertexBuffer
reed@google.comac10a2d2010-12-22 21:39:39 +000023 virtual void* lock();
bsalomon@google.com1c13c962011-02-14 16:51:21 +000024 virtual void* lockPtr() const;
reed@google.comac10a2d2010-12-22 21:39:39 +000025 virtual void unlock();
26 virtual bool isLocked() const;
bsalomon@google.com1c13c962011-02-14 16:51:21 +000027 virtual bool updateData(const void* src, size_t srcSizeInBytes);
twiz@google.com0f31ca72011-03-18 17:38:11 +000028 GrGLuint bufferID() const;
reed@google.comac10a2d2010-12-22 21:39:39 +000029
bsalomon@google.com8fe72472011-03-30 21:26:44 +000030protected:
31 GrGLVertexBuffer(GrGpuGL* gpu,
32 GrGLuint id,
33 size_t sizeInBytes,
34 bool dynamic);
35
36 // overrides of GrResource
37 virtual void onAbandon();
38 virtual void onRelease();
39
reed@google.comac10a2d2010-12-22 21:39:39 +000040private:
bsalomon@google.com1c13c962011-02-14 16:51:21 +000041 void bind() const;
bsalomon@google.com8fe72472011-03-30 21:26:44 +000042
twiz@google.com0f31ca72011-03-18 17:38:11 +000043 GrGLuint fBufferID;
reed@google.comac10a2d2010-12-22 21:39:39 +000044 void* fLockPtr;
45
46 friend class GrGpuGL;
47
48 typedef GrVertexBuffer INHERITED;
49};
50
51#endif