Kanzi 4.0.0-beta2
kanzi::GlRenderState Class Reference

Kanzi graphics render state. More...

#include <kanzi/core.ui/graphics3d/gl_render_state.hpp>

Classes

struct  DrawParameters
 Parameters for full-featured draw. More...
 
struct  ResourceSet
 Creation information for a RenderResourceSet. More...
 
struct  TextureRenderValue
 Per texture value. More...
 
struct  UniformBufferObject
 Contents and upload information for an uniform buffer object. More...
 

Public Types

using HandleType
 Type for handle identifiers into values in the render state.
 

Public Member Functions

void attach (MaterialSharedPtr material)
 Attach to a certain material/node combination.
 
bool bind (Renderer &renderer)
 Applies the render state the render state.
 
void draw (Renderer &renderer, const Geometry &geometry)
 Draws the entire geometry with the current render state.
 
void draw (Renderer &renderer, const Geometry &geometry, size_t elementOffset, size_t elementCount)
 Draws a partial geometry with the current render state.
 
void draw (Renderer &renderer, DrawParameters &params)
 Draws content based on the parameters.
 
void draw (Renderer &renderer, GraphicsPrimitiveType vertexPrimitive, gfx::BufferHandleGuard vertexBuffer, size_t vertexBufferOffset, size_t elementOffset, size_t elementCount)
 Draws a vertex buffer with the current render state.
 
void draw (Renderer &renderer, Mesh &mesh, size_t index)
 Draws the mesh with the current render state.
 
void drawIndirect (Renderer &renderer, DrawParameters &params, gfx::BufferHandleGuard buffer, uint32_t drawCount, uint32_t drawStride, uint32_t offset=0)
 Indirect draw based on the parameters.
 
void drawIndirect (Renderer &renderer, GraphicsPrimitiveType primitive, gfx::BufferHandleGuard buffer, uint32_t drawCount, uint32_t drawStride, uint32_t offset=0)
 Indirect draw with the current render state.
 
template<typename T >
void fillDefaultValues (GlRenderState::HandleType handle, size_t startIndex, size_t endIndex)
 Fills a uniform array with default values.
 
optional< intgetBlendModeValue () const
 Get blend mode value.
 
template<typename T >
size_t getElementCount (GlRenderState::HandleType handle) const
 Gets the number of elements for given handle.
 
template<>
size_t getElementCount (GlRenderState::HandleType handle) const
 GlRenderState::getElementCount() specialization.
 
template<typename T >
HandleType getHandle (string_view name)
 Access handle by type.
 
template<>
GlRenderState::HandleType getHandle (string_view name)
 GlRenderState::getHandle() specialization.
 
MaterialSharedPtr getMaterial () const
 Gets the attached material.
 
template<>
TextureSharedPtr getValue (GlRenderState::HandleType handle) const
 GlRenderState::getValue() specialization.
 
template<>
Matrix3x3 getValue (GlRenderState::HandleType handle, size_t index) const
 GlRenderState::getValue() specialization.
 
template<>
Matrix4x4 getValue (GlRenderState::HandleType handle, size_t index) const
 GlRenderState::getValue() specialization.
 
template<typename T >
T getValue (HandleType handle) const
 Accesses a value by handle.
 
template<typename T >
T getValue (HandleType handle, size_t index) const
 Accesses a value by handle.
 
 GlRenderState ()=default
 Empty constructor.
 
template<>
bool handleMatches (GlRenderState::HandleType handle, string_view name) const
 GlRenderState::handleMatches() specialization.
 
template<typename T >
bool handleMatches (HandleType handle, string_view name) const
 Checks whether given handle matches the current render state.
 
bool hasMaterial () const
 Returns whether the render state has a valid material.
 
void reattach ()
 Reattach already-attached material.
 
void setBlendModeValue (optional< int > value)
 Sets the blend mode value.
 
template<typename T >
bool setRange (GlRenderState::HandleType handle, AbstractRange &range)
 Specialized implementation for assigning range.
 
template<>
bool setRange (GlRenderState::HandleType, AbstractRange &)
 GlRenderState::setRange() specialization.
 
template<>
bool setRange (GlRenderState::HandleType, AbstractRange &)
 GlRenderState::setRange() specialization.
 
template<>
bool setRange (GlRenderState::HandleType, AbstractRange &)
 GlRenderState::setRange() specialization.
 
template<>
bool setRange (GlRenderState::HandleType, AbstractRange &)
 GlRenderState::setRange() specialization.
 
bool setRange (HandleType handle, AbstractRange &range)
 Sets values of a render target array from a range.
 
bool setRange (HandleType handle, AbstractRange *range)
 Sets values of a render target array from a range.
 
bool setRange (HandleType handle, const AbstractRangeSharedPtr &range)
 Sets values of a render target array from a range.
 
void setStorageBuffer (uint32_t setIndex, string_view name, gfx::BufferHandleGuard buffer)
 Sets the Storage Buffer in the render resource set.
 
void setTexelBuffer (uint32_t setIndex, string_view name, gfx::BufferHandleGuard buffer, const gfx::Format format)
 Sets the Texel Buffer in the render resource set.
 
template<typename T >
bool setTypedValue (GlRenderState::HandleType handle, const Variant &value, size_t elementIndex)
 Sets a variant value.
 
template<typename T >
void setValue (HandleType handle, const T &value)
 Wrapper for setting a render value by handle.
 
template<typename T >
void setValue (HandleType handle, const T &value, size_t elementIndex)
 Set a render value identified by handle.
 
template<typename T >
void setValueArray (HandleType handle, span< const T > values)
 Set a render value array identified by handle.
 
span< UniformBufferObjectuniformBufferObjects ()
 Gets the uniform buffer objects.
 
void updateFixedFunctionUniforms (Renderer &renderer, RenderPass *renderPass, Node *node)
 Updates fixed function uniforms and applies transformations.
 
void updateTransformationUniforms (Renderer &renderer)
 

Protected Member Functions

void applyFixedOperationUniform (Renderer &renderer, ShaderProgram::FixedUniform uniform, GlRenderState::HandleType handle)
 Apply a single fixed operation uniform.
 
void drawSetup (Renderer &renderer, DrawParameters &params)
 Setup the Command Recorder for either a direct or indirect draw.
 
HandleType getHandle (PropertyDataType type, string_view name, size_t count)
 Accesses a handle by explicit information.
 
size_t getUniformElementCount (AbstractPropertyType propertyType) const
 Get uniform element count wrapper.
 
size_t getUniformElementCount (string_view name) const
 Gets the number of uniform elements in the attached material.
 
span< floatgetValueArrayFloat (HandleType handle, size_t elementIndex)
 Gets a reference into the uniform staging buffers (as floats).
 
span< intgetValueArrayInt (HandleType handle, size_t elementIndex)
 Gets a reference into the uniform staging buffers (as ints).
 
ByteSpan getValueBytes (const ShaderProgram::UniformProperty &prop)
 Gets the writable bytes for a uniform from the uniform buffer stage.
 
ConstByteSpan getValueBytes (const ShaderProgram::UniformProperty &prop) const
 Gets the read only bytes for a uniform from the uniform buffer stage.
 
bool isPropertyDataTypeCompatible (PropertyDataType valueType, PropertyDataType definitionType) const
 Tests if a value of valueType can be used with a uniform of definitionType.
 
void setTypedValue (HandleType handle, bool value, size_t elementIndex)
 Specialization for setting a value of specific type.
 
void setTypedValue (HandleType handle, ColorRGBA value, size_t elementIndex)
 Specialization for setting a value of specific type.
 
void setTypedValue (HandleType handle, const Matrix3x3 &value, size_t elementIndex)
 Specialization for setting a value of specific type.
 
void setTypedValue (HandleType handle, const Matrix4x4 &value, size_t elementIndex)
 Specialization for setting a value of specific type.
 
void setTypedValue (HandleType handle, const SRTValue2D &value, size_t elementIndex)
 Specialization for setting a value of specific type.
 
void setTypedValue (HandleType handle, const SRTValue3D &value, size_t elementIndex)
 Specialization for setting a value of specific type.
 
void setTypedValue (HandleType handle, float value, size_t elementIndex)
 Specialization for setting a value of specific type.
 
void setTypedValue (HandleType handle, int value, size_t elementIndex)
 Specialization for setting a value of specific type.
 
void setTypedValue (HandleType handle, TextureSharedPtr value, size_t elementIndex)
 Specialization for setting a value of specific type.
 
void setTypedValue (HandleType handle, Vector2 value, size_t elementIndex)
 Specialization for setting a value of specific type.
 
void setTypedValue (HandleType handle, Vector3 value, size_t elementIndex)
 Specialization for setting a value of specific type.
 
void setTypedValue (HandleType handle, Vector4 value, size_t elementIndex)
 Specialization for setting a value of specific type.
 
void setTypedValue (HandleType handle, void *value, size_t elementIndex)
 Specialization for setting a value of specific type.
 
void setTypedValueArray (HandleType handle, span< const bool > values)
 Specialization for setting a value array of specific type.
 
void setTypedValueArray (HandleType handle, span< const ColorRGBA > values)
 Specialization for setting a value array of specific type.
 
void setTypedValueArray (HandleType handle, span< const float > values)
 Specialization for setting a value array of specific type.
 
void setTypedValueArray (HandleType handle, span< const int > values)
 Specialization for setting a value array of specific type.
 
void setTypedValueArray (HandleType handle, span< const Matrix3x3 > values)
 Specialization for setting a value array of specific type.
 
void setTypedValueArray (HandleType handle, span< const Matrix4x4 > values)
 Specialization for setting a value array of specific type.
 
void setTypedValueArray (HandleType handle, span< const SRTValue2D > values)
 Specialization for setting a value array of specific type.
 
void setTypedValueArray (HandleType handle, span< const SRTValue3D > values)
 Specialization for setting a value array of specific type.
 
void setTypedValueArray (HandleType handle, span< const Vector2 > values)
 Specialization for setting a value array of specific type.
 
void setTypedValueArray (HandleType handle, span< const Vector3 > values)
 Specialization for setting a value array of specific type.
 
void setTypedValueArray (HandleType handle, span< const Vector4 > values)
 Specialization for setting a value array of specific type.
 
void uploadUniformBuffer (CommandRecorder &commandRecorder, size_t bufferIndex)
 Record an upload operation for the uniform buffer stage.
 

Static Protected Member Functions

template<typename T >
static size_t getValueSize ()
 Gets the size of a render value type.
 
template<>
size_t getValueSize ()
 GlRenderState::getValueSize() specialization.
 
template<>
size_t getValueSize ()
 GlRenderState::getValueSize() specialization.
 
template<typename T >
static PropertyDataType getValueType ()
 Gets the property type of a render value type.
 

Protected Attributes

optional< intm_blendModeValue
 Singular property value for blend mode.
 
MaterialSharedPtr m_material
 Currently attached material.
 
vector< ResourceSetm_resources
 Render Resource Set array.
 
span< const ShaderProgram::TexturePropertym_textures
 Texture definition array that is owned by the material.
 
vector< TextureRenderValuem_textureValues
 Texture value array.
 
span< const ShaderProgram::UniformBufferm_uniformBuffers
 
span< const ShaderProgram::UniformPropertym_uniforms
 Uniform definition array that is owned by the material.
 
vector< UniformBufferObjectm_uniformStaging
 Uniform buffer staging memory.
 

Detailed Description

Kanzi graphics render state.

Member Typedef Documentation

◆ HandleType

Type for handle identifiers into values in the render state.

Constructor & Destructor Documentation

◆ GlRenderState()

kanzi::GlRenderState::GlRenderState ( )
explicitdefault

Empty constructor.

Member Function Documentation

◆ bind()

bool kanzi::GlRenderState::bind ( Renderer & renderer)

Applies the render state the render state.

After calling this function, geometry can be rendered using the render state settings.

Parameters
rendererRenderer to use.
Returns
If the shader program was available and bound, true, otherwise false.

◆ updateFixedFunctionUniforms()

void kanzi::GlRenderState::updateFixedFunctionUniforms ( Renderer & renderer,
RenderPass * renderPass,
Node * node )

Updates fixed function uniforms and applies transformations.

Parameters
rendererThe renderer to get global render state from.
renderPassCurrent render pass of the local context.
nodeCurrent node of the local context.
Since
Kanzi 4.0.0

◆ updateTransformationUniforms()

void kanzi::GlRenderState::updateTransformationUniforms ( Renderer & renderer)
Parameters
rendererThe renderer that contains the transformation matrices.
Since
Kanzi 4.0.0

◆ draw() [1/5]

void kanzi::GlRenderState::draw ( Renderer & renderer,
const Geometry & geometry )

Draws the entire geometry with the current render state.

Parameters
rendererThe renderer.
geometryThe geometry to draw.
Since
kanzi 4.0.0

◆ draw() [2/5]

void kanzi::GlRenderState::draw ( Renderer & renderer,
Mesh & mesh,
size_t index )

Draws the mesh with the current render state.

The vertex input state is constructed for the mesh.

Parameters
rendererThe renderer.
meshMesh to render.
indexCluster index within the mesh.
Since
kanzi 4.0.0

◆ draw() [3/5]

void kanzi::GlRenderState::draw ( Renderer & renderer,
const Geometry & geometry,
size_t elementOffset,
size_t elementCount )

Draws a partial geometry with the current render state.

Parameters
rendererThe renderer.
geometryThe geometry to draw.
elementOffsetThe element offset within the geometry.
elementCountThe count of elements to draw.
Since
kanzi 4.0.0

◆ draw() [4/5]

void kanzi::GlRenderState::draw ( Renderer & renderer,
GraphicsPrimitiveType vertexPrimitive,
gfx::BufferHandleGuard vertexBuffer,
size_t vertexBufferOffset,
size_t elementOffset,
size_t elementCount )

Draws a vertex buffer with the current render state.

Parameters
rendererThe renderer.
vertexPrimitiveThe vertex buffer primitive type.
vertexBufferThe kanzi graphics buffer that contains the vertex buffer.
vertexBufferOffsetThe byte offset of the vertex buffer data within the vertex buffer.
elementOffsetThe element offset within the vertex buffer.
elementCountThe count of elements to draw.
Since
kanzi 4.0.0

◆ drawIndirect() [1/2]

void kanzi::GlRenderState::drawIndirect ( Renderer & renderer,
GraphicsPrimitiveType primitive,
gfx::BufferHandleGuard buffer,
uint32_t drawCount,
uint32_t drawStride,
uint32_t offset = 0 )

Indirect draw with the current render state.

Parameters
rendererThe renderer.
primitiveThe primitive type.
bufferThe kanzi graphics buffer that contains indirect draw information.
drawCountThe number of draws in the buffer.
drawStrideThe stride of each draw call.
offsetThe offset of the draw information in the buffer.

◆ draw() [5/5]

void kanzi::GlRenderState::draw ( Renderer & renderer,
DrawParameters & params )

Draws content based on the parameters.

Parameters
rendererThe renderer.
paramsThe draw parameters.
Since
kanzi 4.0.0

◆ drawIndirect() [2/2]

void kanzi::GlRenderState::drawIndirect ( Renderer & renderer,
DrawParameters & params,
gfx::BufferHandleGuard buffer,
uint32_t drawCount,
uint32_t drawStride,
uint32_t offset = 0 )

Indirect draw based on the parameters.

Parameters
rendererThe renderer.
paramsThe draw parameters.
bufferThe kanzi graphics buffer that contains indirect draw information.
drawCountThe number of draws in the buffer.
drawStrideThe stride of each draw call.
offsetThe offset of the draw information in the buffer.

◆ attach()

void kanzi::GlRenderState::attach ( MaterialSharedPtr material)

Attach to a certain material/node combination.

Parameters
materialMaterial to attach to.

◆ reattach()

void kanzi::GlRenderState::reattach ( )

Reattach already-attached material.

Does nothing if no material attached.

◆ getMaterial()

MaterialSharedPtr kanzi::GlRenderState::getMaterial ( ) const
inline

Gets the attached material.

Returns
Shared pointer to material.

◆ hasMaterial()

bool kanzi::GlRenderState::hasMaterial ( ) const
inline

Returns whether the render state has a valid material.

Returns
If a valid material is attached, true, otherwise false.

◆ setValue() [1/2]

template<typename T >
void kanzi::GlRenderState::setValue ( HandleType handle,
const T & value,
size_t elementIndex )
inline

Set a render value identified by handle.

The handle may be invalid (negative), in which case this function does nothing.

Parameters
handleIdentifying handle.
valueValue to set.
elementIndexIndex of the element in the value to set.

◆ setValue() [2/2]

template<typename T >
void kanzi::GlRenderState::setValue ( HandleType handle,
const T & value )
inline

Wrapper for setting a render value by handle.

Element index is zero.

Parameters
handleIdentifying handle.
valueValue to set.

◆ setValueArray()

template<typename T >
void kanzi::GlRenderState::setValueArray ( HandleType handle,
span< const T > values )
inline

Set a render value array identified by handle.

The handle may be invalid (negative), in which case this function does nothing.

Parameters
handleIdentifying handle.
valuesValues to set.

◆ getBlendModeValue()

optional< int > kanzi::GlRenderState::getBlendModeValue ( ) const
inline

Get blend mode value.

Returns
Optional blend mode value.
Since
Kanzi 3.9.1 return data type changed from optional<GraphicsBlendMode> to optional<int>.

◆ setBlendModeValue()

void kanzi::GlRenderState::setBlendModeValue ( optional< int > value)
inline

Sets the blend mode value.

Parameters
valueOptional blend mode value.
Since
Kanzi 3.9.1 data type of value parameter changed from GraphicsBlendMode to optional<int>.

◆ getHandle() [1/3]

template<typename T >
HandleType kanzi::GlRenderState::getHandle ( string_view name)
inline

Access handle by type.

Parameters
nameValue name.
Returns
Handle (index) to info array.

◆ getElementCount() [1/2]

template<typename T >
size_t kanzi::GlRenderState::getElementCount ( GlRenderState::HandleType handle) const
inline

Gets the number of elements for given handle.

Parameters
handleHandle.
Returns
Number of elements for the handle.

◆ getValue() [1/5]

template<typename T >
T kanzi::GlRenderState::getValue ( HandleType handle,
size_t index ) const
inline

Accesses a value by handle.

Handle must be valid, access with invalid handle is undefined behavior.

Parameters
handleHandle to value.
indexIndex of the value to access.
Returns
Value previously stored with the handle.

◆ getValue() [2/5]

template<typename T >
T kanzi::GlRenderState::getValue ( HandleType handle) const
inline

Accesses a value by handle.

Index of the accessed value is zero.

Parameters
handleHandle to value.
Returns
Value previously stored with the handle.

◆ handleMatches() [1/2]

template<typename T >
bool kanzi::GlRenderState::handleMatches ( HandleType handle,
string_view name ) const
inline

Checks whether given handle matches the current render state.

Parameters
handleHandle to check.
nameName to compare against.
Returns
True if given handle and name match in the render state, false otherwise.

◆ setTypedValue() [1/14]

template<typename T >
bool kanzi::GlRenderState::setTypedValue ( GlRenderState::HandleType handle,
const Variant & value,
size_t elementIndex )
inline

Sets a variant value.

If the value is not an exact match, tries to cast the value to T.

Parameters
handleThe identifying handle.
valueThe variant value.
elementIndexThe index of the array element.
Returns
If setting the value succeeds, true, otherwise false.
Since
Kanzi 3.9.6

◆ fillDefaultValues()

template<typename T >
void kanzi::GlRenderState::fillDefaultValues ( GlRenderState::HandleType handle,
size_t startIndex,
size_t endIndex )
inline

Fills a uniform array with default values.

Parameters
handleThe identifying handle.
startIndexThe start index for the fill operation.
endIndexThe end index pointing to one after the last fill element.
Since
Kanzi 3.9.6.

◆ setRange() [1/8]

template<typename T >
bool kanzi::GlRenderState::setRange ( GlRenderState::HandleType handle,
AbstractRange & range )
inline

Specialized implementation for assigning range.

If the array is larger than the range, writes default values to the remaining values in the end of the array. You must validate the handle before calling this function.

Parameters
handleValid handle from the render state.
rangeRange input.
Returns
If setting the value succeeds, true, otherwise false.
Since
Kanzi 3.9.6

◆ setRange() [2/8]

bool kanzi::GlRenderState::setRange ( HandleType handle,
AbstractRange & range )

Sets values of a render target array from a range.

If the array is larger than the range, writes default values to the remaining values in the end of the array.

Parameters
handleHandle from the render state.
rangeRange input.
Returns
If setting the value succeeds, true, otherwise false.
Since
Kanzi 3.9.0
Kanzi 3.9.6 changed the type of the range parameter.

◆ setRange() [3/8]

bool kanzi::GlRenderState::setRange ( HandleType handle,
AbstractRange * range )

Sets values of a render target array from a range.

If the array is larger than the range, writes default values to the remaining values in the end of the array. If the range is a nullptr, sets all the elements of the render target array to default values.

Parameters
handleHandle from the render state.
rangeRange input.
Returns
If value was successfully set, true, otherwise false.
Since
Kanzi 3.9.0

◆ setRange() [4/8]

bool kanzi::GlRenderState::setRange ( HandleType handle,
const AbstractRangeSharedPtr & range )
inline

Sets values of a render target array from a range.

If the array is larger than the range, writes default values to the remaining values in the end of the array. If the range is a nullptr, sets all the elements of the render target array to default values.

Parameters
handleHandle from the render state.
rangeRange input.
Returns
If value was successfully set, true, otherwise false.
Since
Kanzi 3.9.0

◆ uniformBufferObjects()

span< UniformBufferObject > kanzi::GlRenderState::uniformBufferObjects ( )
inline

Gets the uniform buffer objects.

Returns
A span of uniform buffer objects.
Since
Kanzi 4.0.0

◆ setStorageBuffer()

void kanzi::GlRenderState::setStorageBuffer ( uint32_t setIndex,
string_view name,
gfx::BufferHandleGuard buffer )

Sets the Storage Buffer in the render resource set.

Parameters
setIndexThe resource set index.
nameThe storage buffer name.
bufferThe storage buffer.
Since
Kanzi 4.0.0

◆ setTexelBuffer()

void kanzi::GlRenderState::setTexelBuffer ( uint32_t setIndex,
string_view name,
gfx::BufferHandleGuard buffer,
const gfx::Format format )

Sets the Texel Buffer in the render resource set.

Parameters
setIndexThe resource set index.
nameThe storage buffer name.
bufferThe storage buffer.
formatThe storage format of the buffer.
Since
Kanzi 4.0.0

◆ isPropertyDataTypeCompatible()

bool kanzi::GlRenderState::isPropertyDataTypeCompatible ( PropertyDataType valueType,
PropertyDataType definitionType ) const
protected

Tests if a value of valueType can be used with a uniform of definitionType.

Parameters
valueTypeThe data type of the value.
definitionTypeThe data type of the uniform definition.
Returns
Returns true if the valueType can be assigned to a definitionType, else false.
Since
Kanzi 4.0.0

◆ getUniformElementCount() [1/2]

size_t kanzi::GlRenderState::getUniformElementCount ( string_view name) const
protected

Gets the number of uniform elements in the attached material.

Parameters
nameName to query.
Returns
Number of elements in the uniform or 0 if not valid.
Since
Kanzi 3.9.7 changed the type of the return value to size_t.

◆ getUniformElementCount() [2/2]

size_t kanzi::GlRenderState::getUniformElementCount ( AbstractPropertyType propertyType) const
inlineprotected

Get uniform element count wrapper.

Parameters
propertyTypeProperty type to query.
Returns
Number of elements in the uniform or 0 if not valid.
Since
Kanzi 3.9.7 changed the type of the return value to size_t.

◆ getHandle() [2/3]

HandleType kanzi::GlRenderState::getHandle ( PropertyDataType type,
string_view name,
size_t count )
protected

Accesses a handle by explicit information.

Parameters
typeValue type.
nameValue name.
countNumber of values to allocate per element if new handle is required.
Returns
Handle (index) to info array.

◆ getValueArrayInt()

span< int > kanzi::GlRenderState::getValueArrayInt ( HandleType handle,
size_t elementIndex )
inlineprotected

Gets a reference into the uniform staging buffers (as ints).

Contents of the value are not guaranteed, it points directly to the memory block within a uniform staging buffer.

Parameters
handleHandle to value info.
elementIndexIndex of the element for the render value, used only for error checking.
Returns
Span of integers within the uniform staging buffer.
Since
Kanzi 4.0.0 changed the return type to a span.

◆ getValueArrayFloat()

span< float > kanzi::GlRenderState::getValueArrayFloat ( HandleType handle,
size_t elementIndex )
inlineprotected

Gets a reference into the uniform staging buffers (as floats).

Contents of the value are not guaranteed, it points directly to the memory block within a uniform staging buffer.

Parameters
handleHandle to value info.
elementIndexIndex of the element for the render value, used only for error checking.
Returns
Span of floats within the uniform staging buffer.
Since
Kanzi 4.0.0 changed the return type to a span.

◆ setTypedValue() [2/14]

void kanzi::GlRenderState::setTypedValue ( HandleType handle,
bool value,
size_t elementIndex )
inlineprotected

Specialization for setting a value of specific type.

Parameters
handleName.
valueValue.
elementIndexIndex of the element to set.

◆ setTypedValueArray() [1/11]

void kanzi::GlRenderState::setTypedValueArray ( HandleType handle,
span< const bool > values )
inlineprotected

Specialization for setting a value array of specific type.

Parameters
handleName.
valuesValues.

◆ setTypedValue() [3/14]

void kanzi::GlRenderState::setTypedValue ( HandleType handle,
int value,
size_t elementIndex )
inlineprotected

Specialization for setting a value of specific type.

Parameters
handleName.
valueValue.
elementIndexIndex of the element to set.

◆ setTypedValueArray() [2/11]

void kanzi::GlRenderState::setTypedValueArray ( HandleType handle,
span< const int > values )
inlineprotected

Specialization for setting a value array of specific type.

Parameters
handleName.
valuesValues.

◆ setTypedValue() [4/14]

void kanzi::GlRenderState::setTypedValue ( HandleType handle,
float value,
size_t elementIndex )
inlineprotected

Specialization for setting a value of specific type.

Parameters
handleName.
valueValue.
elementIndexIndex of the element to set.

◆ setTypedValueArray() [3/11]

void kanzi::GlRenderState::setTypedValueArray ( HandleType handle,
span< const float > values )
inlineprotected

Specialization for setting a value array of specific type.

Parameters
handleName.
valuesValues.

◆ setTypedValue() [5/14]

void kanzi::GlRenderState::setTypedValue ( HandleType handle,
ColorRGBA value,
size_t elementIndex )
inlineprotected

Specialization for setting a value of specific type.

Parameters
handleName.
valueValue.
elementIndexIndex of the element to set.

◆ setTypedValueArray() [4/11]

void kanzi::GlRenderState::setTypedValueArray ( HandleType handle,
span< const ColorRGBA > values )
inlineprotected

Specialization for setting a value array of specific type.

Parameters
handleName.
valuesValues.

◆ setTypedValue() [6/14]

void kanzi::GlRenderState::setTypedValue ( HandleType handle,
Vector2 value,
size_t elementIndex )
inlineprotected

Specialization for setting a value of specific type.

Parameters
handleName.
valueValue.
elementIndexIndex of the element to set.

◆ setTypedValueArray() [5/11]

void kanzi::GlRenderState::setTypedValueArray ( HandleType handle,
span< const Vector2 > values )
inlineprotected

Specialization for setting a value array of specific type.

Parameters
handleName.
valuesValues.

◆ setTypedValue() [7/14]

void kanzi::GlRenderState::setTypedValue ( HandleType handle,
Vector3 value,
size_t elementIndex )
inlineprotected

Specialization for setting a value of specific type.

Parameters
handleName.
valueValue.
elementIndexIndex of the element to set.

◆ setTypedValueArray() [6/11]

void kanzi::GlRenderState::setTypedValueArray ( HandleType handle,
span< const Vector3 > values )
inlineprotected

Specialization for setting a value array of specific type.

Parameters
handleName.
valuesValues.

◆ setTypedValue() [8/14]

void kanzi::GlRenderState::setTypedValue ( HandleType handle,
Vector4 value,
size_t elementIndex )
inlineprotected

Specialization for setting a value of specific type.

Parameters
handleName.
valueValue.
elementIndexIndex of the element to set.

◆ setTypedValueArray() [7/11]

void kanzi::GlRenderState::setTypedValueArray ( HandleType handle,
span< const Vector4 > values )
inlineprotected

Specialization for setting a value array of specific type.

Parameters
handleName.
valuesValues.

◆ setTypedValue() [9/14]

void kanzi::GlRenderState::setTypedValue ( HandleType handle,
const Matrix3x3 & value,
size_t elementIndex )
inlineprotected

Specialization for setting a value of specific type.

Parameters
handleName.
valueValue.
elementIndexIndex of the element to set.

◆ setTypedValueArray() [8/11]

void kanzi::GlRenderState::setTypedValueArray ( HandleType handle,
span< const Matrix3x3 > values )
inlineprotected

Specialization for setting a value array of specific type.

Parameters
handleName.
valuesValues.

◆ setTypedValue() [10/14]

void kanzi::GlRenderState::setTypedValue ( HandleType handle,
const Matrix4x4 & value,
size_t elementIndex )
inlineprotected

Specialization for setting a value of specific type.

Parameters
handleName.
valueValue.
elementIndexIndex of the element to set.

◆ setTypedValueArray() [9/11]

void kanzi::GlRenderState::setTypedValueArray ( HandleType handle,
span< const Matrix4x4 > values )
inlineprotected

Specialization for setting a value array of specific type.

Parameters
handleName.
valuesValues.

◆ setTypedValue() [11/14]

void kanzi::GlRenderState::setTypedValue ( HandleType handle,
const SRTValue2D & value,
size_t elementIndex )
inlineprotected

Specialization for setting a value of specific type.

Parameters
handleName.
valueValue.
elementIndexIndex of the element to set.

◆ setTypedValueArray() [10/11]

void kanzi::GlRenderState::setTypedValueArray ( HandleType handle,
span< const SRTValue2D > values )
inlineprotected

Specialization for setting a value array of specific type.

Parameters
handleName.
valuesValues.

◆ setTypedValue() [12/14]

void kanzi::GlRenderState::setTypedValue ( HandleType handle,
const SRTValue3D & value,
size_t elementIndex )
inlineprotected

Specialization for setting a value of specific type.

Parameters
handleName.
valueValue.
elementIndexIndex of the element to set.

◆ setTypedValueArray() [11/11]

void kanzi::GlRenderState::setTypedValueArray ( HandleType handle,
span< const SRTValue3D > values )
inlineprotected

Specialization for setting a value array of specific type.

Parameters
handleName.
valuesValues.

◆ setTypedValue() [13/14]

void kanzi::GlRenderState::setTypedValue ( HandleType handle,
void * value,
size_t elementIndex )
inlineprotected

Specialization for setting a value of specific type.

This version intentionally exists to throw an exception on an invalid call.

Parameters
handleName.
valueValue.
elementIndexIndex of the element to set.

◆ setTypedValue() [14/14]

void kanzi::GlRenderState::setTypedValue ( HandleType handle,
TextureSharedPtr value,
size_t elementIndex )
protected

Specialization for setting a value of specific type.

Parameters
handleThe uniform handle.
valueThe uniform value..
elementIndexIndex of the element to set.

◆ getValueSize() [1/3]

template<typename T >
static size_t kanzi::GlRenderState::getValueSize ( )
inlinestaticprotected

Gets the size of a render value type.

Returns
Number of values type requires.

◆ getValueType()

template<typename T >
static PropertyDataType kanzi::GlRenderState::getValueType ( )
inlinestaticprotected

Gets the property type of a render value type.

Returns
Number of values type requires.

◆ getValueBytes() [1/2]

ByteSpan kanzi::GlRenderState::getValueBytes ( const ShaderProgram::UniformProperty & prop)
inlineprotected

Gets the writable bytes for a uniform from the uniform buffer stage.

Any previous upload of the uniform buffer is invalidated.

Parameters
propThe Uniform Property to return.
Returns
A span of writable bytes in the uniform buffer stage.
Since
Kanzi 4.0.0

◆ getValueBytes() [2/2]

ConstByteSpan kanzi::GlRenderState::getValueBytes ( const ShaderProgram::UniformProperty & prop) const
inlineprotected

Gets the read only bytes for a uniform from the uniform buffer stage.

Parameters
propThe Uniform Property to return.
Returns
A span of read only bytes in the uniform buffer stage.
Since
Kanzi 4.0.0

◆ applyFixedOperationUniform()

void kanzi::GlRenderState::applyFixedOperationUniform ( Renderer & renderer,
ShaderProgram::FixedUniform uniform,
GlRenderState::HandleType handle )
protected

Apply a single fixed operation uniform.

Parameters
rendererThe Renderer to use.
uniformThe fixed uniform operation.
handleThe uniform handle.
Since
Kanzi 4.0.0

◆ drawSetup()

void kanzi::GlRenderState::drawSetup ( Renderer & renderer,
DrawParameters & params )
protected

Setup the Command Recorder for either a direct or indirect draw.

Parameters
rendererThe renderer.
paramsThe draw parameters.
Since
kanzi 4.0.0

◆ uploadUniformBuffer()

void kanzi::GlRenderState::uploadUniformBuffer ( CommandRecorder & commandRecorder,
size_t bufferIndex )
protected

Record an upload operation for the uniform buffer stage.

Parameters
commandRecorderThe command recorder.
bufferIndexThe uniform buffer index.
Since
Kanzi 4.0.0

◆ getHandle() [3/3]

template<>
GlRenderState::HandleType kanzi::GlRenderState::getHandle ( string_view name)

GlRenderState::getHandle() specialization.

◆ handleMatches() [2/2]

template<>
bool kanzi::GlRenderState::handleMatches ( GlRenderState::HandleType handle,
string_view name ) const

◆ getValue() [3/5]

template<>
Matrix3x3 kanzi::GlRenderState::getValue ( GlRenderState::HandleType handle,
size_t index ) const

GlRenderState::getValue() specialization.

◆ getValue() [4/5]

template<>
Matrix4x4 kanzi::GlRenderState::getValue ( GlRenderState::HandleType handle,
size_t index ) const

GlRenderState::getValue() specialization.

◆ getValue() [5/5]

template<>
TextureSharedPtr kanzi::GlRenderState::getValue ( GlRenderState::HandleType handle) const

GlRenderState::getValue() specialization.

◆ getElementCount() [2/2]

template<>
size_t kanzi::GlRenderState::getElementCount ( GlRenderState::HandleType handle) const

◆ getValueSize() [2/3]

template<>
size_t kanzi::GlRenderState::getValueSize ( )
staticprotected

◆ getValueSize() [3/3]

template<>
size_t kanzi::GlRenderState::getValueSize ( )
staticprotected

◆ setRange() [5/8]

template<>
bool kanzi::GlRenderState::setRange ( GlRenderState::HandleType ,
AbstractRange &  )

GlRenderState::setRange() specialization.

◆ setRange() [6/8]

template<>
bool kanzi::GlRenderState::setRange ( GlRenderState::HandleType ,
AbstractRange &  )

GlRenderState::setRange() specialization.

◆ setRange() [7/8]

template<>
bool kanzi::GlRenderState::setRange ( GlRenderState::HandleType ,
AbstractRange &  )

GlRenderState::setRange() specialization.

◆ setRange() [8/8]

template<>
bool kanzi::GlRenderState::setRange ( GlRenderState::HandleType ,
AbstractRange &  )

GlRenderState::setRange() specialization.

Member Data Documentation

◆ m_blendModeValue

optional<int> kanzi::GlRenderState::m_blendModeValue
protected

Singular property value for blend mode.

Since
Kanzi 3.9.1 data type changed from optional<GraphicsBlendMode> to optional<int>.

◆ m_material

MaterialSharedPtr kanzi::GlRenderState::m_material
protected

Currently attached material.

◆ m_uniformStaging

vector<UniformBufferObject> kanzi::GlRenderState::m_uniformStaging
protected

Uniform buffer staging memory.

◆ m_uniforms

span<const ShaderProgram::UniformProperty> kanzi::GlRenderState::m_uniforms
protected

Uniform definition array that is owned by the material.

◆ m_uniformBuffers

span<const ShaderProgram::UniformBuffer> kanzi::GlRenderState::m_uniformBuffers
protected

◆ m_textures

span<const ShaderProgram::TextureProperty> kanzi::GlRenderState::m_textures
protected

Texture definition array that is owned by the material.

◆ m_textureValues

vector<TextureRenderValue> kanzi::GlRenderState::m_textureValues
protected

Texture value array.

◆ m_resources

vector<ResourceSet> kanzi::GlRenderState::m_resources
protected

Render Resource Set array.


The documentation for this class was generated from the following file: