Visualization Library v1.0.3A lightweight C++ OpenGL middleware for 2D/3D graphics |
[Download] [Tutorials] [All Classes] [Grouped Classes] |
Implements a buffer whose storage is in local memory. More...
#include <Buffer.hpp>
Public Types | |
enum | EAllocationMode { UserAllocatedBuffer, AutoAllocatedBuffer } |
Public Member Functions | |
Buffer () | |
Buffer (const Buffer &other) | |
Buffer & | operator= (const Buffer &other) |
void | swap (Buffer &other) |
~Buffer () | |
void | clear () |
void | resize (size_t byte_count, size_t alignment=0) |
void | setUserAllocatedBuffer (void *ptr, size_t bytes) |
Uses a user-allocated buffer as storage. | |
void | setAllocationMode (EAllocationMode mode) |
EAllocationMode | allocationMode () const |
size_t | bytesUsed () const |
bool | empty () const |
unsigned char * | ptr () |
const unsigned char * | ptr () const |
size_t | alignment () const |
Static Public Member Functions | |
static void * | alignedMalloc (size_t bytes, size_t alignment) |
static void | alignedFree (void *ptr) |
Protected Attributes | |
unsigned char * | mPtr |
size_t | mByteCount |
size_t | mAlignment |
EAllocationMode | mAllocationMode |
Implements a buffer whose storage is in local memory.
Definition at line 46 of file Buffer.hpp.
Definition at line 51 of file Buffer.hpp.
vl::Buffer::Buffer | ( | ) | [inline] |
Definition at line 58 of file Buffer.hpp.
References AutoAllocatedBuffer, mAlignment, mAllocationMode, mByteCount, mPtr, NULL, VL_DEBUG_SET_OBJECT_NAME, and VL_DEFAULT_BUFFER_BYTE_ALIGNMENT.
vl::Buffer::Buffer | ( | const Buffer & | other ) | [inline] |
Definition at line 66 of file Buffer.hpp.
References AutoAllocatedBuffer, mAlignment, mAllocationMode, mByteCount, mPtr, NULL, VL_DEBUG_SET_OBJECT_NAME, and VL_DEFAULT_BUFFER_BYTE_ALIGNMENT.
vl::Buffer::~Buffer | ( | ) | [inline] |
Definition at line 114 of file Buffer.hpp.
References clear().
Definition at line 76 of file Buffer.hpp.
References AutoAllocatedBuffer, bytesUsed(), mAlignment, mAllocationMode, mByteCount, mPtr, ptr(), resize(), and VL_CHECK.
void vl::Buffer::swap | ( | Buffer & | other ) | [inline] |
Definition at line 98 of file Buffer.hpp.
References mAlignment, mByteCount, and mPtr.
void vl::Buffer::clear | ( | ) | [inline] |
Definition at line 119 of file Buffer.hpp.
References alignedFree(), AutoAllocatedBuffer, mAllocationMode, mByteCount, mPtr, and NULL.
Referenced by vl::ArrayAbstract::clear(), resize(), setAllocationMode(), vl::BufferObject::setBufferData(), vl::BufferObject::setBufferSubData(), setUserAllocatedBuffer(), and ~Buffer().
void vl::Buffer::resize | ( | size_t | byte_count, |
size_t | alignment = 0 |
||
) | [inline] |
Definition at line 128 of file Buffer.hpp.
References alignedFree(), alignedMalloc(), alignment(), AutoAllocatedBuffer, clear(), mAlignment, mAllocationMode, mByteCount, vl::min(), mPtr, NULL, ptr(), and VL_CHECK.
Referenced by vl::BufferObject::downloadBufferObject(), vl::ArrayAbstract::operator=(), operator=(), and vl::Array< bvec2, GLbyte, 2, GL_BYTE >::resize().
void vl::Buffer::setUserAllocatedBuffer | ( | void * | ptr, |
size_t | bytes | ||
) | [inline] |
Uses a user-allocated buffer as storage.
After calling this function any call to resize() is illegal. Calling this function enables the UserAllocatedBuffer mode. Call setAllocationMode( AutoAllocatedBuffer ) to revert to the default behaviour.
Definition at line 171 of file Buffer.hpp.
References clear(), mAlignment, mAllocationMode, mByteCount, mPtr, and UserAllocatedBuffer.
void vl::Buffer::setAllocationMode | ( | EAllocationMode | mode ) | [inline] |
Definition at line 180 of file Buffer.hpp.
References clear(), mAlignment, mAllocationMode, mByteCount, and mPtr.
EAllocationMode vl::Buffer::allocationMode | ( | ) | const [inline] |
Definition at line 193 of file Buffer.hpp.
References mAllocationMode.
size_t vl::Buffer::bytesUsed | ( | ) | const [inline] |
Definition at line 195 of file Buffer.hpp.
References mByteCount.
Referenced by vl::ArrayAbstract::bytesUsed(), vl::ArrayAbstract::operator=(), operator=(), and vl::BufferObject::setBufferData().
bool vl::Buffer::empty | ( | ) | const [inline] |
Definition at line 197 of file Buffer.hpp.
References mByteCount.
unsigned char* vl::Buffer::ptr | ( | ) | [inline] |
Definition at line 199 of file Buffer.hpp.
References mPtr.
Referenced by vl::OpenGLContext::bindVAS(), vl::BufferObject::downloadBufferObject(), vl::BufferObject::mapBufferObject(), operator=(), vl::ArrayAbstract::ptr(), resize(), vl::BufferObject::setBufferData(), and vl::BufferObject::setBufferSubData().
const unsigned char* vl::Buffer::ptr | ( | ) | const [inline] |
Definition at line 201 of file Buffer.hpp.
References mPtr.
size_t vl::Buffer::alignment | ( | ) | const [inline] |
static void* vl::Buffer::alignedMalloc | ( | size_t | bytes, |
size_t | alignment | ||
) | [inline, static] |
static void vl::Buffer::alignedFree | ( | void * | ptr ) | [inline, static] |
unsigned char* vl::Buffer::mPtr [protected] |
Definition at line 263 of file Buffer.hpp.
Referenced by Buffer(), clear(), operator=(), ptr(), resize(), setAllocationMode(), setUserAllocatedBuffer(), and swap().
size_t vl::Buffer::mByteCount [protected] |
Definition at line 264 of file Buffer.hpp.
Referenced by Buffer(), bytesUsed(), clear(), empty(), operator=(), resize(), setAllocationMode(), setUserAllocatedBuffer(), and swap().
size_t vl::Buffer::mAlignment [protected] |
Definition at line 265 of file Buffer.hpp.
Referenced by alignment(), Buffer(), operator=(), resize(), setAllocationMode(), setUserAllocatedBuffer(), and swap().
EAllocationMode vl::Buffer::mAllocationMode [protected] |
Definition at line 266 of file Buffer.hpp.
Referenced by allocationMode(), Buffer(), clear(), operator=(), resize(), setAllocationMode(), and setUserAllocatedBuffer().