GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::graphics::UniformBuffer< ParameterStruct, Name > Class Template Reference

GPU memory buffer containing a fixed-size struct of uniform parameters to be read by a shader program. More...

#include <GREM/graphics/buffers.hpp>

Inheritance diagram for grem::graphics::UniformBuffer< ParameterStruct, Name >:

Public Types

using parameters_type = ParameterStruct
 Parameter struct type of the buffer.

Public Member Functions

 UniformBuffer (Device &device)
 Create a new buffer set up to contain the specified parameters, starting with uninitialized values.
void upload (const ParameterStruct &newParameterValues)
 Upload new parameter values to the buffer for the next shader invocation that reads from it.

Static Public Attributes

static constexpr UniformBufferLayout< ParameterStruct, Name > LAYOUT {}
 Layout of the buffer.
static constexpr BufferLayoutReference LAYOUT_REFERENCE = static_cast<UniformBufferLayoutReference>(LAYOUT)
 Type-erased reference to the layout of the buffer.
static constexpr CStringView NAME = Name
 Name of the buffer.

Detailed Description

template<typename ParameterStruct, ConstantString Name>
class grem::graphics::UniformBuffer< ParameterStruct, Name >

GPU memory buffer containing a fixed-size struct of uniform parameters to be read by a shader program.

Template Parameters
ParameterStructuser-defined aggregate type of parameters that the buffer should contain.
Namename of the uniform buffer. Must be globally unique among all buffer type instantiations.

Member Typedef Documentation

◆ parameters_type

template<typename ParameterStruct, ConstantString Name>
using grem::graphics::UniformBuffer< ParameterStruct, Name >::parameters_type = ParameterStruct

Parameter struct type of the buffer.

Constructor & Destructor Documentation

◆ UniformBuffer()

template<typename ParameterStruct, ConstantString Name>
grem::graphics::UniformBuffer< ParameterStruct, Name >::UniformBuffer ( Device & device)
inlineexplicit

Create a new buffer set up to contain the specified parameters, starting with uninitialized values.

Parameters
devicedevice to create the buffer for. Must outlive the buffer.
Exceptions
graphics::Errorif resource creation failed.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

Member Function Documentation

◆ upload()

template<typename ParameterStruct, ConstantString Name>
void grem::graphics::UniformBuffer< ParameterStruct, Name >::upload ( const ParameterStruct & newParameterValues)
inline

Upload new parameter values to the buffer for the next shader invocation that reads from it.

Parameters
newParameterValuesnew parameter values to upload.
Exceptions
graphics::Errorif resource creation failed.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

Member Data Documentation

◆ LAYOUT

template<typename ParameterStruct, ConstantString Name>
UniformBufferLayout<ParameterStruct, Name> grem::graphics::UniformBuffer< ParameterStruct, Name >::LAYOUT {}
staticconstexpr

Layout of the buffer.

◆ LAYOUT_REFERENCE

template<typename ParameterStruct, ConstantString Name>
BufferLayoutReference grem::graphics::UniformBuffer< ParameterStruct, Name >::LAYOUT_REFERENCE = static_cast<UniformBufferLayoutReference>(LAYOUT)
staticconstexpr

Type-erased reference to the layout of the buffer.

◆ NAME

template<typename ParameterStruct, ConstantString Name>
CStringView grem::graphics::UniformBuffer< ParameterStruct, Name >::NAME = Name
staticconstexpr

Name of the buffer.


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