Ocular Engine
Ocular::Graphics::GPUBuffer Class Reference

A generic buffer that can be uploaded to the GPU. More...

#include <GPUBuffer.hpp>

Inheritance diagram for Ocular::Graphics::GPUBuffer:
Ocular::Graphics::D3D11StructuredBuffer

Public Member Functions

 GPUBuffer (GPUBufferDescriptor const &descriptor)
 
virtual void bind ()
 
virtual void unbind ()
 
virtual bool build (void const *source)
 
virtual bool read (void *destination, uint32_t start, uint32_t size)
 
virtual bool write (void const *source, uint32_t start, uint32_t size)
 
GPUBufferDescriptor const & getDescriptor () const
 

Protected Attributes

GPUBufferDescriptor m_Descriptor
 

Detailed Description

A generic buffer that can be uploaded to the GPU.

Member Function Documentation

void Ocular::Graphics::GPUBuffer::bind ( )
virtual

Binds the buffer to shader stage and slot specified in the descriptor.

Reimplemented in Ocular::Graphics::D3D11StructuredBuffer.

bool Ocular::Graphics::GPUBuffer::build ( void const *  source)
virtual

Attempts to (re)build the buffer. For buffers built without CPU write access, this is the only way to provide data.

Parameters
[in]sourceOptional source data. If NULL, buffer will be populated with 0.

Reimplemented in Ocular::Graphics::D3D11StructuredBuffer.

GPUBufferDescriptor const & Ocular::Graphics::GPUBuffer::getDescriptor ( ) const
Returns
Reference to the buffer descriptor.
bool Ocular::Graphics::GPUBuffer::read ( void *  destination,
uint32_t  start,
uint32_t  size 
)
virtual

Attempts to read data from the buffer. Only available to buffers created with Read CPU Access.

Parameters
[out]destinationDestination to copy buffer data into.
[in]startStarting offset into the GPU buffer to start reading from.
[in]sizeSize of data to be read.
Returns
May return FALSE if: buffer does not have read cpu access, start + size exceeds gpu buffer size, destination is NULL, or API failure during reading.

Reimplemented in Ocular::Graphics::D3D11StructuredBuffer.

void Ocular::Graphics::GPUBuffer::unbind ( )
virtual

Unbinds the buffer in the stage and slot specified by the descriptor.

Reimplemented in Ocular::Graphics::D3D11StructuredBuffer.

bool Ocular::Graphics::GPUBuffer::write ( void const *  source,
uint32_t  start,
uint32_t  size 
)
virtual

Attempts to write data to the buffer. Only available to buffers created with Write CPU Access.

Parameters
[in]sourceSource of data to place into buffer. If source is NULL, buffer will be filled with 0.
[in]startStarting offset into the GPU buffer to start writing to.
[in]sizeSize of the data to write.
Returns
May return FALSE if: buffer does not have write cpu access, start + size exceeds gpu buffer size, or API failure during reading.

Reimplemented in Ocular::Graphics::D3D11StructuredBuffer.


The documentation for this class was generated from the following files: