Om
1.0.0
A universal framework for multimedia simulation
|
A class that represents a buffer of shader attributes stored in GPU memory. More...
#include <omGraphicsDeviceBuffer.h>
Public Member Functions | |
const BufferType & | getType () const |
Return the type of attribute buffer that this device buffer represents. More... | |
virtual BufferUsage | getUsage () const =0 |
Return the current expected usage pattern for this hardware attribute buffer. More... | |
virtual Size | getCapacity () const =0 |
Return the number of bytes that this buffer is able to hold. More... | |
virtual Bool | setCapacity (Size newCapacityInBytes)=0 |
Set the number of bytes that this buffer is able to hold. More... | |
virtual Bool | setCapacity (Size newCapacityInBytes, BufferUsage newUsage)=0 |
Set the number of bytes that this buffer is able to hold. More... | |
virtual Bool | reallocate ()=0 |
Reallocate this buffer's data store using its current capacity. More... | |
virtual Bool | reallocate (BufferUsage newUsage)=0 |
Reallocate this buffer's data store using its current capacity, changing its usage type. More... | |
virtual Bool | getData (void *data, Size &numBytes) const =0 |
Read the specified number of bytes from the attribute buffer into the output data pointer. More... | |
virtual Bool | setData (const void *data, Size numBytes, BufferUsage newUsage=BufferUsage::STATIC)=0 |
Replace the contents of this attribute buffer with the specified data. More... | |
virtual Bool | updateData (const void *data, Size numBytes, Index startIndex=0)=0 |
Update a region of this attribute buffer with the specified data. More... | |
virtual void * | map (BufferAccessType accessType)=0 |
Map this buffer's data store to the main memory address space and return a pointer to it. More... | |
virtual void * | mapRange (BufferAccessType accessType, Index byteOffset, Size numBytes)=0 |
Map this buffer's data store to the main memory address space and return a pointer to it. More... | |
virtual void | unmap () const =0 |
Unmap this buffer's data store from the main memory address space. More... | |
virtual Bool | isMapped () const =0 |
Return whether or not this attribute buffer is currently mapped to main memory. More... | |
Public Member Functions inherited from om::graphics::devices::DeviceResource | |
virtual | ~DeviceResource () |
Destroy a device object, releasing all internal state. More... | |
GraphicsContext * | getContext () const |
Return a pointer to the graphics context associated with this DeviceResource. More... | |
virtual Bool | isValid () const =0 |
Return whether or not the state of this device resource is valid and able to be used for rendering. More... | |
Protected Member Functions | |
DeviceBuffer (devices::GraphicsContext *newContext, BufferType newBufferType) | |
Create a device attribute buffer for the specified context with the given buffer type. More... | |
Protected Member Functions inherited from om::graphics::devices::DeviceResource | |
DeviceResource (GraphicsContext *newContext) | |
Create a new device object that is associated with the specified graphics context. More... | |
Protected Attributes | |
BufferType | bufferType |
An enum value that is set by subclasses that specifies the kind of attribute buffer this is. More... | |
A class that represents a buffer of shader attributes stored in GPU memory.
This class allows attribute data to be stored in the graphics card's RAM for faster access. It is analogous to the Texture class that performs the same function but for pixel data.
|
inlineprotected |
Create a device attribute buffer for the specified context with the given buffer type.
|
inline |
Return the type of attribute buffer that this device buffer represents.
|
pure virtual |
Return the current expected usage pattern for this hardware attribute buffer.
Implemented in om::graphics::devices::opengl::OpenGLBuffer.
|
pure virtual |
Return the number of bytes that this buffer is able to hold.
Implemented in om::graphics::devices::opengl::OpenGLBuffer.
|
pure virtual |
Set the number of bytes that this buffer is able to hold.
Calling this method reallocates the buffer with the new capacity. The method returns whether or not the capacity change was successful.
Implemented in om::graphics::devices::opengl::OpenGLBuffer.
|
pure virtual |
Set the number of bytes that this buffer is able to hold.
Calling this method reallocates the buffer with the new capacity and changes the usage type of this buffer. The method returns whether or not the capacity change was successful.
Implemented in om::graphics::devices::opengl::OpenGLBuffer.
|
pure virtual |
Reallocate this buffer's data store using its current capacity.
This method allows the user to get a new data store for the buffer, releasing the previous data store. This is useful if you are using a memory-mapped buffer to transfer vertices to the GPU. By releasing the buffer before mapping it, you signal that you don't need the old buffer anymore, avoiding synchronization stalls.
The resulting contents of the buffer are undefined.
Implemented in om::graphics::devices::opengl::OpenGLBuffer.
|
pure virtual |
Reallocate this buffer's data store using its current capacity, changing its usage type.
This method allows the user to get a new data store for the buffer, releasing the previous data store. This is useful if you are using a memory-mapped buffer to transfer vertices to the GPU. By releasing the buffer before mapping it, you signal that you don't need the old buffer anymore, avoiding synchronization stalls.
The resulting contents of the buffer are undefined.
This variant allows the user to change the usage of the buffer when it is reallocated.
Implemented in om::graphics::devices::opengl::OpenGLBuffer.
|
pure virtual |
Read the specified number of bytes from the attribute buffer into the output data pointer.
Implemented in om::graphics::devices::opengl::OpenGLBuffer.
|
pure virtual |
Replace the contents of this attribute buffer with the specified data.
The usage of the buffer is set to the specified usage type and will have a capacity equal to the input data. The method returns whether or not the buffer set operation was successful.
Implemented in om::graphics::devices::opengl::OpenGLBuffer.
|
pure virtual |
Update a region of this attribute buffer with the specified data.
The specified nubmer of bytes are copied from the data pointer to the given start offset in bytes in the attribute buffer. The method returns whether or not the update operation was successful.
Implemented in om::graphics::devices::opengl::OpenGLBuffer.
|
pure virtual |
Map this buffer's data store to the main memory address space and return a pointer to it.
The method returns NULL if the buffer is unable to be mapped with the given access type.
Implemented in om::graphics::devices::opengl::OpenGLBuffer.
|
pure virtual |
Map this buffer's data store to the main memory address space and return a pointer to it.
The method returns NULL if the buffer is unable to be mapped with the given access type. The method allows the user to specify a range of bytes within the buffer that is mapped. Mapping smaller ranges of a buffer can be faster than mapping the whole buffer since less data must be copied.
Implemented in om::graphics::devices::opengl::OpenGLBuffer.
|
pure virtual |
Unmap this buffer's data store from the main memory address space.
This starts a transfer of the mapped data to GPU memory if the access type was WRITE or READ_WRITE.
Implemented in om::graphics::devices::opengl::OpenGLBuffer.
|
pure virtual |
Return whether or not this attribute buffer is currently mapped to main memory.
If this method returns TRUE, it means that the buffer is currently mapped. The buffer cannot be used for any drawing until the buffer is unmapped.
Implemented in om::graphics::devices::opengl::OpenGLBuffer.
|
protected |
An enum value that is set by subclasses that specifies the kind of attribute buffer this is.
This can be used to specify that a buffer is a vertex buffer or an index buffer or some other kind of buffer. These buffers types allow different kinds of attributes to be stored in them.