GLUniformBlockCache class
Caches the contents of a uniform block and uploads it through a buffer object.
Holds a host-side data buffer mirroring a GLUniformBlock and manages a GLUniformCache for each of the block's member uniforms, pointing each one into the appropriate offset of the shared buffer. The contents are uploaded to the GL as a single uniform buffer object (UBO).
Constructors, destructors, conversion operators
- GLUniformBlockCache()
- Creates an empty cache not associated with any uniform block.
- GLUniformBlockCache(GLUniformBlock* uniformBlock) explicit
- Creates a cache for the specified uniform block.
Public functions
- auto uniformBlock() const -> const GLUniformBlock*
- Returns the uniform block described by this cache.
- auto GetIndex() const -> GLuint
- Wrapper around GLUniformBlock::
GetIndex(). - auto GetBindingIndex() const -> GLuint
- Wrapper around GLUniformBlock::
GetBindingIndex(). - auto GetSize() const -> GLint
- Wrapper around GLUniformBlock::
GetSize(). -
auto GetAlignAmount() const -> std::
uint8_t - Wrapper around GLUniformBlock::
GetAlignAmount(). - auto GetDataPointer() -> GLubyte*
- Returns the host-side data buffer mirroring the block.
- auto GetDataPointer() const -> const GLubyte*
- Returns the host-side data buffer mirroring the block.
- void SetDataPointer(GLubyte* dataPointer)
- Sets the host-side data buffer and repoints each member uniform cache into it.
- auto usedSize() const -> GLint
- Returns how many bytes of the cache are uploaded to the UBO.
- void SetUsedSize(GLint usedSize)
- Sets how many bytes of the cache are uploaded to the UBO.
-
auto CopyData(std::
uint32_t destIndex, const GLubyte* src, std:: uint32_t numBytes) -> bool - Copies a range of bytes into the data buffer and returns whether it succeeded.
- auto CopyData(const GLubyte* src) -> bool
- Copies the whole used size from the source into the data buffer.
- auto GetUniform(StringView name) -> GLUniformCache*
- Returns the member uniform cache with the specified name, or
nullptrif not found. - void SetBlockBinding(GLuint blockBinding)
- Wrapper around GLUniformBlock::
SetBlockBinding().