nCine::RHI::Software::SwShaderUniformBlocks class

Manages the uniform-block caches of a program (aliased as RHI::ShaderUniformBlocks).

Owns a SwUniformBlockCache per active block, distributes a shared host data buffer across them, copies the block contents into a suballocated range of the streaming uniform buffer on CommitUniformBlocks(), and on Bind() forwards each range to the device so the effect running the following draw can sample it.

Public types

using UniformHashMapType = std::vector<SwUniformBlockCache>
using UniformRangeAllocator = RHI::BufferRange(*)(std::uint32_t bytes)
Function that suballocates a range of the given size from the streaming uniform buffer.

Public static functions

static void SetUniformRangeAllocator(UniformRangeAllocator allocator)
Sets the allocator used by CommitUniformBlocks() (registered by the pipeline at startup).

Constructors, destructors, conversion operators

SwShaderUniformBlocks()
SwShaderUniformBlocks(SwShaderProgram* shaderProgram) explicit
SwShaderUniformBlocks(SwShaderProgram* shaderProgram, const char* includeOnly, const char* exclude)

Public functions

void SetProgram(SwShaderProgram* shaderProgram)
void SetProgram(SwShaderProgram* shaderProgram, const char* includeOnly, const char* exclude)
void SetUniformsDataPointer(std::uint8_t* dataPointer)
auto GetUniformBlockCount() const -> std::uint32_t
auto HasUniformBlock(const char* name) const -> bool
auto GetUniformBlock(const char* name) -> SwUniformBlockCache*
auto GetAllUniformBlocks() const -> const UniformHashMapType&
Returns the container of all managed block caches (range-iterates as SwUniformBlockCache&).
void CommitUniformBlocks()
void Bind()