Resource handle with shared ownership of a GPU memory buffer with copy-on-write value semantics containing an array of structs to be used as instances when drawing meshes to a RenderPass.
More...
#include <GREM/graphics/buffers.hpp>
|
| | InstanceBuffer (Device &device) |
| | Create a new empty buffer set up to contain the specified element type.
|
| uint32_t | append (StridedSpan< const Instance > instances) |
| | Append an array of instances to the buffer, growing the buffer capacity if necessary.
|
| uint32_t | push (const Instance &instance) |
| | Append an instance to the buffer, growing the buffer capacity if necessary.
|
template<typename Instance>
class grem::graphics::InstanceBuffer< Instance >
Resource handle with shared ownership of a GPU memory buffer with copy-on-write value semantics containing an array of structs to be used as instances when drawing meshes to a RenderPass.
- Template Parameters
-
| Instance | user-defined aggregate type with the fields that each element of the buffer should contain. |
◆ instance_type
template<typename Instance>
Instance type of the buffer.
◆ InstanceBuffer()
template<typename Instance>
Create a new empty buffer set up to contain the specified element type.
- Parameters
-
| device | device to create the buffer for. Must outlive the buffer. |
◆ append()
template<typename Instance>
Append an array of instances to the buffer, growing the buffer capacity if necessary.
- Parameters
-
| instances | instances to write. |
- Returns
- the index of the first instance written to the buffer.
- Exceptions
-
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
◆ push()
template<typename Instance>
Append an instance to the buffer, growing the buffer capacity if necessary.
- Parameters
-
| instance | instance to write. |
- Returns
- the index of the instance written to the buffer.
- Exceptions
-
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
The documentation for this class was generated from the following file: