1 // SwiftShader Software Renderer
\r
3 // Copyright(c) 2005-2012 TransGaming Inc.
\r
5 // All rights reserved. No part of this software may be copied, distributed, transmitted,
\r
6 // transcribed, stored in a retrieval system, translated into any human or computer
\r
7 // language by any means, or disclosed to third parties without the explicit written
\r
8 // agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
\r
9 // or implied, including but not limited to any patent rights, are granted to you.
\r
12 // Buffer.h: Defines the Buffer class, representing storage of vertex and/or
\r
13 // index data. Implements GL buffer objects and related functionality.
\r
14 // [OpenGL ES 2.0.24] section 2.9 page 21.
\r
16 #ifndef LIBGLESV2_BUFFER_H_
\r
17 #define LIBGLESV2_BUFFER_H_
\r
19 #include "RefCountObject.h"
\r
20 #include "Common/Resource.hpp"
\r
23 #include <GLES2/gl2.h>
\r
30 class Buffer : public RefCountObject
\r
33 explicit Buffer(GLuint id);
\r
37 void bufferData(const void *data, GLsizeiptr size, GLenum usage);
\r
38 void bufferSubData(const void *data, GLsizeiptr size, GLintptr offset);
\r
40 const void *data() { return mContents ? mContents->getBuffer() : 0; }
\r
41 size_t size() const { return mSize; }
\r
42 GLenum usage() const { return mUsage; }
\r
44 sw::Resource *getResource();
\r
47 sw::Resource *mContents;
\r
54 #endif // LIBGLESV2_BUFFER_H_
\r