Sparkle 0.0.1
Loading...
Searching...
No Matches
spk::OpenGL::ShaderStorageBufferObject Class Reference

Wraps a SSBO with fixed and optional dynamic array sections using BufferLayout. More...

#include <spk_shader_storage_buffer_object.hpp>

Inheritance diagram for spk::OpenGL::ShaderStorageBufferObject:
Inheritance graph
Collaboration diagram for spk::OpenGL::ShaderStorageBufferObject:
Collaboration graph

Public Member Functions

 ShaderStorageBufferObject (GLuint p_bindingPoint, BufferObject::Usage p_usage, const size_t &p_size)
 Creates an SSBO bound to a binding point.
 ShaderStorageBufferObject (const ShaderStorageBufferObject &p_other)
 Copies buffer binding and layout configuration from another SSBO.
ShaderStorageBufferObjectoperator= (const ShaderStorageBufferObject &p_other)
 Copies buffer binding and layout configuration from another SSBO.
BufferLayoutlayout ()
 Accesses the layout describing the buffer.
const BufferLayoutlayout () const
 Accesses the layout describing the buffer.
void setDynamicElement (const std::wstring &p_name, const BufferLayout::Element &p_elementPrototype)
 Defines the prototype for the dynamic array section.
void setDynamicPadding (std::size_t p_padding)
 Sets padding between fixed and dynamic sections.
void resizeDynamicArray (std::size_t p_newCount)
 Resizes the dynamic array section.
template<typename TType>
TType pullFixed () const
 Reads the fixed section of the SSBO into a trivially copyable type.
template<typename TElement>
std::vector< TElement > pullDynamic () const
 Reads the dynamic array section into a vector of elements.
Buffer::value_type * data ()
 Mutable pointer to underlying bytes.
const Buffer::value_type * data () const
 Const pointer to underlying bytes.
size_t size () const
 Returns the current CPU buffer size.

Detailed Description

Wraps a SSBO with fixed and optional dynamic array sections using BufferLayout.

See also
BufferLayout, UniformBufferObject

Constructor & Destructor Documentation

◆ ShaderStorageBufferObject() [1/2]

spk::OpenGL::ShaderStorageBufferObject::ShaderStorageBufferObject ( GLuint p_bindingPoint,
BufferObject::Usage p_usage,
const size_t & p_size )

Creates an SSBO bound to a binding point.

Parameters
p_bindingPointBinding index.
p_usageUsage hint.
p_sizeInitial buffer size.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShaderStorageBufferObject() [2/2]

spk::OpenGL::ShaderStorageBufferObject::ShaderStorageBufferObject ( const ShaderStorageBufferObject & p_other)

Copies buffer binding and layout configuration from another SSBO.

Parameters
p_otherSource buffer.
Here is the call graph for this function:

Member Function Documentation

◆ data() [1/2]

BufferObject::Buffer::value_type * spk::OpenGL::BufferObject::data ( )

Mutable pointer to underlying bytes.

Returns
Pointer or nullptr if empty.

◆ data() [2/2]

const BufferObject::Buffer::value_type * spk::OpenGL::BufferObject::data ( ) const

Const pointer to underlying bytes.

Returns
Pointer or nullptr if empty.

◆ layout() [1/2]

BufferLayout & spk::OpenGL::ShaderStorageBufferObject::layout ( )

Accesses the layout describing the buffer.

Returns
Mutable layout.

◆ layout() [2/2]

const BufferLayout & spk::OpenGL::ShaderStorageBufferObject::layout ( ) const

Accesses the layout describing the buffer.

Returns
Const layout.

◆ operator=()

ShaderStorageBufferObject & spk::OpenGL::ShaderStorageBufferObject::operator= ( const ShaderStorageBufferObject & p_other)

Copies buffer binding and layout configuration from another SSBO.

Parameters
p_otherSource buffer.
Returns
Reference to this.
Here is the call graph for this function:

◆ pullDynamic()

template<typename TElement>
std::vector< TElement > spk::OpenGL::ShaderStorageBufferObject::pullDynamic ( ) const
inline

Reads the dynamic array section into a vector of elements.

Template Parameters
TElementTrivially copyable element type.
Returns
Vector containing the dynamic portion.

◆ pullFixed()

template<typename TType>
TType spk::OpenGL::ShaderStorageBufferObject::pullFixed ( ) const
inline

Reads the fixed section of the SSBO into a trivially copyable type.

Template Parameters
TTypeDestination POD type.
Returns
Value copied from the beginning of the buffer.

◆ resizeDynamicArray()

void spk::OpenGL::ShaderStorageBufferObject::resizeDynamicArray ( std::size_t p_newCount)

Resizes the dynamic array section.

Parameters
p_newCountElement count.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDynamicElement()

void spk::OpenGL::ShaderStorageBufferObject::setDynamicElement ( const std::wstring & p_name,
const BufferLayout::Element & p_elementPrototype )

Defines the prototype for the dynamic array section.

Parameters
p_nameName of the dynamic array field.
p_elementPrototypeElement layout to repeat.

◆ setDynamicPadding()

void spk::OpenGL::ShaderStorageBufferObject::setDynamicPadding ( std::size_t p_padding)

Sets padding between fixed and dynamic sections.

Parameters
p_paddingByte padding.
Here is the call graph for this function:

◆ size()

size_t spk::OpenGL::BufferObject::size ( ) const

Returns the current CPU buffer size.

Returns
Byte size.

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