Wraps a UBO with a BufferLayout for structured writes.
More...
#include <spk_uniform_buffer_object.hpp>
Wraps a UBO with a BufferLayout for structured writes.
- See also
- BufferLayout, ShaderStorageBufferObject
◆ UniformBufferObject() [1/2]
| spk::OpenGL::UniformBufferObject::UniformBufferObject |
( |
GLuint | p_bindingPoint, |
|
|
BufferObject::Usage | p_usage, |
|
|
const size_t & | p_size ) |
Creates a UBO bound to a binding point.
- Parameters
-
| p_bindingPoint | Binding index. |
| p_usage | Usage hint. |
| p_size | Initial buffer size. |
◆ UniformBufferObject() [2/2]
Copies layout and buffer binding information from another UBO.
- Parameters
-
◆ 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]
Accesses the layout describing the UBO contents.
- Returns
- Mutable layout.
◆ layout() [2/2]
| const BufferLayout & spk::OpenGL::UniformBufferObject::layout |
( |
| ) |
const |
Accesses the layout describing the UBO contents.
- Returns
- Const layout.
◆ operator=()
Copies layout and buffer binding information from another UBO.
- Parameters
-
- Returns
- Reference to this.
◆ operator[]() [1/2]
Accesses a named field within the layout.
- Parameters
-
| p_name | Element identifier. |
- Returns
- Mutable layout element.
◆ operator[]() [2/2]
| const BufferLayout::Element & spk::OpenGL::UniformBufferObject::operator[] |
( |
const std::wstring & | p_name | ) |
const |
Accesses a named field within the layout.
- Parameters
-
| p_name | Element identifier. |
- Returns
- Const layout element.
◆ pull()
template<typename TType>
| TType spk::OpenGL::UniformBufferObject::pull |
( |
| ) |
const |
|
inline |
Reads the entire UBO content as a trivially copyable type.
- Template Parameters
-
| TType | Trivially copyable type expected in the buffer. |
- Returns
- Copy of the GPU buffer cast to the requested type.
- Exceptions
-
| std::runtime_error | When the GPU buffer is smaller than the requested type. |
◆ 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: