Class UniformBuffer#
Defined in File UniformBuffer.h
Class Documentation#
-
class UniformBuffer#
Public Functions
-
constexpr UniformBuffer(UniformBuffer&&) noexcept = default#
Move constructor.
-
constexpr UniformBuffer &operator=(UniformBuffer&&) noexcept = default#
Move assignment operator.
-
consteval UniformBuffer(const UniformBuffer&) noexcept = delete#
Copy constructor.
-
consteval UniformBuffer &operator=(const UniformBuffer&) noexcept = delete#
Copy assignment operator.
-
constexpr ~UniformBuffer() = default#
Destructor.
-
constexpr UpdateFrequency GetUpdateFrequency() const noexcept#
Retrieve the update frequency of the UBO.
- Returns:
Update frequency of the UBO.
-
constexpr const std::vector<TRAP::Ref<TRAP::Graphics::Buffer>> &GetUBOs() const noexcept#
Retrieve the underlying buffers.
- Returns:
Underlying buffers.
-
void SetData(const void *data, u64 size, u64 offset = 0)#
Update data of the UBO.
- Parameters:
data – New data.
size – Byte size of the data.
offset – Offset into the currently used data.
-
bool IsLoaded() const#
Check whether uploading data to the GPU has finished.
- Returns:
True if uploading data to the GPU has finished.
-
void AwaitLoading() const#
Wait until uploading data to the GPU has finished.
-
template<typename T>
TRAP::Scope<TRAP::Graphics::UniformBuffer> Create(const T *const data, const u64 size, const UpdateFrequency updateFrequency)#
-
template<typename T>
TRAP::Scope<TRAP::Graphics::UniformBuffer> Init(const T *const data, const u64 size, const UpdateFrequency updateFrequency)#
Public Static Functions
-
static u64 CalculateAlignedSize(u64 byteSize) noexcept#
Calculate the aligned size of the UBO.
- Parameters:
byteSize – Byte size of the UBO.
-
static Scope<UniformBuffer> Create(u64 size, UpdateFrequency updateFrequency)#
Create a new uniform buffer and set its size.
- Parameters:
size – Byte size for the uniform buffer.
updateFrequency – Update frequency for the buffer.
- Returns:
New uniform buffer.
-
template<typename T>
static Scope<UniformBuffer> Create(const T *data, u64 size, UpdateFrequency updateFrequency)# Create a new uniform buffer and set its data.
- Parameters:
data – Pointer to the data to upload.
size – Byte size of the data to upload.
updateFrequency – Update frequency for the buffer.
- Returns:
New uniform buffer.
-
constexpr UniformBuffer(UniformBuffer&&) noexcept = default#