KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
Karma::OpenGLUniformBuffer Struct Reference

OpenGL's uniform buffer, used in OpenGLShader type instance of Shader object. More...

#include <OpenGLBuffer.h>

Inheritance diagram for Karma::OpenGLUniformBuffer:
Collaboration diagram for Karma::OpenGLUniformBuffer:

Public Member Functions

 OpenGLUniformBuffer (std::vector< ShaderDataType > dataTypes, uint32_t bindingPointIndex)
 Constructor Generate the buffers for uniforms and bind them.
 
uint32_t GetUniformsID () const
 Getter for the uniform id.
 
virtual ~OpenGLUniformBuffer ()
 Delete the buffers and clean up the resources appropriately.
 
virtual void UploadUniformBuffer (size_t frameIndex) override
 Upload the uniform to GPU.
 
- Public Member Functions inherited from Karma::UniformBufferObject
 UniformBufferObject (std::vector< ShaderDataType > dataTypes, uint32_t bindingPointIndex)
 An agnostic constructor provided for precomputation of offset and buffer size.
 
virtual ~UniformBufferObject ()=default
 Pure virtual destructor and sub class should have appropriate implementation.
 
template<typename... T>
void UpdateUniforms (T &&... uniforms)
 Set the m_UniformList with latest supplied uniforms.
 
uint32_t GetBufferSize () const
 
const std::vector< UBODataPointer > & GetUniformList () const
 
const std::vector< ShaderDataType > & GetUniformDataType () const
 
const std::vector< uint32_t > & GetAlignedOffsets () const
 
const std::vector< uint32_t > & GetUniformSize () const
 
uint32_t GetBindingPointIndex () const
 

Additional Inherited Members

- Static Public Member Functions inherited from Karma::UniformBufferObject
static UniformBufferObjectCreate (std::vector< ShaderDataType > dataTypes, uint32_t bindingPointIndex)
 A function for appropriate initialization of UBO based on programmer selected rendered (Vulkan or OpenGL)
 
- Protected Member Functions inherited from Karma::UniformBufferObject
void CalculateOffsetsAndBufferSize ()
 Calculate offsets and buffer size of the uniform buffer object(s).
 
- Protected Attributes inherited from Karma::UniformBufferObject
uint32_t m_BufferSize
 Total size of the buffer in bytes.
 
uint32_t m_BindingPoint
 The binding point prescribed in vertex shader for instance https://github.com/ravimohan1991/KarmaEngine/blob/5ff57f5747c19efcea050646bc2d217c99d74015/Resources/Shaders/shader.vert#L14-L18.
 
std::vector< UBODataPointerm_UniformList
 List of uniforms to be uploaded.
 
std::vector< ShaderDataTypem_UniformDataType
 List of data types (ShaderDataType) for the m_UniformList.
 
std::vector< uint32_t > m_UniformAlignedOffsets
 List of individual uniform boundary aligned (with multiple of individual uniform size) offsets.
 
std::vector< uint32_t > m_UniformSizes
 List of individual uniform sizes.
 

Detailed Description

OpenGL's uniform buffer, used in OpenGLShader type instance of Shader object.

Constructor & Destructor Documentation

◆ OpenGLUniformBuffer()

Karma::OpenGLUniformBuffer::OpenGLUniformBuffer ( std::vector< ShaderDataType > dataTypes,
uint32_t bindingPointIndex )

Constructor Generate the buffers for uniforms and bind them.

Parameters
dataTypesThe vector of ShaderDataType. See UniformBufferObject::Create for information
Since
Karma 1.0.0

◆ ~OpenGLUniformBuffer()

Karma::OpenGLUniformBuffer::~OpenGLUniformBuffer ( )
virtual

Delete the buffers and clean up the resources appropriately.

Since
Karma 1.0.0

Member Function Documentation

◆ GetUniformsID()

uint32_t Karma::OpenGLUniformBuffer::GetUniformsID ( ) const
inline

Getter for the uniform id.

Since
Karma 1.0.0

◆ UploadUniformBuffer()

void Karma::OpenGLUniformBuffer::UploadUniformBuffer ( size_t frameIndex)
overridevirtual

Upload the uniform to GPU.

Since
Karma 1.0.0

Implements Karma::UniformBufferObject.


The documentation for this struct was generated from the following files: