Kanzi 3.9.10
kanzi::CompositionStack Class Reference

Composition stack for managing current render context. More...

#include <kanzi/core.ui/graphics2d/composition_stack.hpp>

Public Member Functions

void apply2D (Renderer3D &renderer)
 Applies the topmost render settings for 2D rendering.
 
void apply3D (Renderer3D &renderer)
 Applies the topmost render settings for 3D rendering.
 
void applyColorBlend2D (Renderer &renderer)
 Applies the topmost color/blend stack state.
 
void applyColorBlend3D (Renderer &renderer)
 Applies the topmost color/blend stack state.
 
void applyComposition2D (Renderer &renderer)
 Applies the topmost composition stack state for 2D rendering.
 
void applyComposition3D (Renderer &renderer)
 Applies the topmost composition stack state for 3D rendering.
 
void applyDepthStencil2D (Renderer &renderer)
 Applies the topmost depth/stencil stack state.
 
void applyDepthStencil3D (Renderer &renderer)
 Applies the topmost depth/stencil stack state.
 
void applyPerspective2D (Renderer3D &renderer, const Matrix4x4 &cameraMatrix, const Matrix4x4 &projectionMatrix)
 Applies the topmost render settings for 2D perspective rendering.
 
void applyRasterization2D (Renderer &renderer)
 Applies the topmost rasterization stack state.
 
void applyRasterization3D (Renderer &renderer)
 Applies the topmost rasterization stack state.
 
 CompositionStack ()
 Constructor.
 
 CompositionStack (NativeFramebufferHandle handle, Vector2 size)
 Constructor.
 
 CompositionStack (NativeFramebufferHandle handle, Vector2 size, Vector4 viewport, optional< Vector4 > scissor)
 Constructor.
 
RenderPassSharedPtr getDebugComposer () const
 Get the debug composer used by this render context stack.
 
void invalidateAllState ()
 Invalidates all distinct stacks.
 
void invalidateColorBlend ()
 Invalidates color/blend stack state.
 
void invalidateComposition ()
 Invalidates composition stack state.
 
void invalidateDepthStencil ()
 Invalidates depth/stencil stack state.
 
void invalidateRasterization ()
 Invalidates rasterization stack state.
 
bool isCompositionStackEmpty () const
 Tells if composition stack is empty.
 
optional< NativeFramebufferHandlepeekCompositionTargetHandle () const
 Kanzi uses this function internally to get the handle of the current composition target.
 
optional< Vector2peekPolygonOffset ()
 Kanzi uses this function internally to get the current polygon offset.
 
optional< Vector2peekRenderContextSize () const
 Kanzi uses this function internally to get the size of the current composition target.
 
optional< Vector4peekScissor () const
 Gets current scissor.
 
optional< ViewportRectanglepeekScissorDeviceCoordinates ()
 Kanzi uses this function internally to get the current scissor area in device coordinates.
 
optional< Texture * > peekTexture () const
 Gets the current composition target texture.
 
optional< Vector4peekViewport () const
 Gets current viewport.
 
optional< ViewportRectanglepeekViewportDeviceCoordinates ()
 Kanzi uses this function internally to get the current viewport in device coordinates.
 
optional< Vector2peekViewportOffset () const
 Gets current viewport offset.
 
optional< Vector2peekViewportSize () const
 Gets current viewport size.
 
void popColorBlend ()
 Pop blend state from blend stack.
 
void popComposition ()
 Pop a composition target state from the stack.
 
void popDepthStencil ()
 Pop a depth stencil state from the stack.
 
void popRasterization ()
 Pop a rasterization state from the stack.
 
void pushColorBlend (optional< int > blendMode, optional< GraphicsColorWriteMode > colorWriteMode)
 Pushes blend state into the blend stack.
 
void pushComposition (NativeFramebufferHandle handle, unsigned int bufferCount, Vector2 size)
 Pushes a composition target into the composition stack.
 
void pushComposition (NativeFramebufferHandle handle, unsigned int bufferCount, Vector2 size, Vector4 viewport, optional< Vector4 > scissor)
 Pushes a composition target and a viewport into the composition stack.
 
void pushComposition (NativeFramebufferHandle handle, unsigned int bufferCount, Vector2 size, Vector4 viewport, optional< Vector4 > scissor, optional< Texture * > texture)
 Pushes a composition target and a viewport into the composition stack.
 
void pushComposition (NativeFramebufferHandle handle, Vector2 size)
 Pushes a composition target into the composition stack.
 
void pushComposition (NativeFramebufferHandle handle, Vector2 size, Vector4 viewport, optional< Vector4 > scissor)
 Pushes a composition target and a viewport into the composition stack.
 
void pushComposition (optional< Vector4 > viewport, optional< Vector4 > scissor)
 Pushes a viewport and/or scissor onto composition stack.
 
void pushComposition (Texture &texture)
 Pushes a composition target into the composition stack.
 
void pushComposition (Texture &texture, Vector2 size)
 Pushes a composition target into the composition stack.
 
void pushComposition (Texture &texture, Vector4 viewport, optional< Vector4 > scissor)
 Pushes a composition target and a viewport into the composition stack.
 
void pushDepthStencil (optional< GraphicsCompareFunction > depthFunc, optional< bool > depthWrite, optional< GraphicsCompareFunction > stencilFunc, optional< unsigned int > referenceValue, optional< unsigned int > maskValue, optional< GraphicsStencilOperation > stencilFail, optional< GraphicsStencilOperation > stencilPassDepthFail, optional< GraphicsStencilOperation > stencilPassDepthPass, optional< bool > stencilWrite)
 Pushes depth stencil state.
 
void pushRasterization (optional< GraphicsCullMode > cullMode, optional< Vector2 > polygonOffset)
 Pushes rasterization state.
 
void setDebugComposer (RenderPassSharedPtr debugComposer)
 Set the debug composer to be used by this render context stack.
 

Detailed Description

Composition stack for managing current render context.

The stack has no ownership over the stored render targets - they will not be reserved or deleted.

Constructor & Destructor Documentation

◆ CompositionStack() [1/3]

kanzi::CompositionStack::CompositionStack ( )
inlineexplicit

Constructor.

◆ CompositionStack() [2/3]

kanzi::CompositionStack::CompositionStack ( NativeFramebufferHandle handle,
Vector2 size )
inlineexplicit

Constructor.

Parameters
handleComposition target handle.
sizeComposition target size.

◆ CompositionStack() [3/3]

kanzi::CompositionStack::CompositionStack ( NativeFramebufferHandle handle,
Vector2 size,
Vector4 viewport,
optional< Vector4 > scissor )
inlineexplicit

Constructor.

Parameters
handleComposition target handle.
sizeComposition target size.
viewportViewport area.
scissorScissor area.

Member Function Documentation

◆ isCompositionStackEmpty()

bool kanzi::CompositionStack::isCompositionStackEmpty ( ) const
inline

Tells if composition stack is empty.

Empty composition stack has no states whatsoever.

◆ pushColorBlend()

void kanzi::CompositionStack::pushColorBlend ( optional< int > blendMode,
optional< GraphicsColorWriteMode > colorWriteMode )

Pushes blend state into the blend stack.

Using nullopt with any parameter will take the default value or the last value pushed.

Parameters
blendModeBlend mode.
colorWriteModeColor write mode.
Since
Kanzi 3.9.1 type of blendMode parameter changed from GraphicsBlendMode to int.

◆ popColorBlend()

void kanzi::CompositionStack::popColorBlend ( )
inline

Pop blend state from blend stack.

◆ pushComposition() [1/9]

void kanzi::CompositionStack::pushComposition ( NativeFramebufferHandle handle,
Vector2 size )

Pushes a composition target into the composition stack.

Parameters
handleComposition target handle.
sizeComposition target size.

◆ pushComposition() [2/9]

void kanzi::CompositionStack::pushComposition ( NativeFramebufferHandle handle,
unsigned int bufferCount,
Vector2 size )

Pushes a composition target into the composition stack.

Parameters
handleComposition target handle.
bufferCountComposition target handle.
sizeComposition target size.

◆ pushComposition() [3/9]

void kanzi::CompositionStack::pushComposition ( Texture & texture)

Pushes a composition target into the composition stack.

Parameters
textureComposition target.

◆ pushComposition() [4/9]

void kanzi::CompositionStack::pushComposition ( Texture & texture,
Vector2 size )

Pushes a composition target into the composition stack.

Parameters
textureComposition target.
sizeComposition target size.

◆ pushComposition() [5/9]

void kanzi::CompositionStack::pushComposition ( optional< Vector4 > viewport,
optional< Vector4 > scissor )

Pushes a viewport and/or scissor onto composition stack.

Parameters
viewportoptional viewport area.
scissoroptional scissor area.

◆ pushComposition() [6/9]

void kanzi::CompositionStack::pushComposition ( Texture & texture,
Vector4 viewport,
optional< Vector4 > scissor )

Pushes a composition target and a viewport into the composition stack.

Parameters
textureComposition target.
viewportViewport area.
scissorScissor area.

◆ pushComposition() [7/9]

void kanzi::CompositionStack::pushComposition ( NativeFramebufferHandle handle,
Vector2 size,
Vector4 viewport,
optional< Vector4 > scissor )

Pushes a composition target and a viewport into the composition stack.

Parameters
handleComposition target handle.
sizeComposition target size.
viewportViewport area.
scissorScissor area.

◆ pushComposition() [8/9]

void kanzi::CompositionStack::pushComposition ( NativeFramebufferHandle handle,
unsigned int bufferCount,
Vector2 size,
Vector4 viewport,
optional< Vector4 > scissor )
inline

Pushes a composition target and a viewport into the composition stack.

Parameters
handleComposition target handle.
bufferCountNumber of draw buffers bound to the handle.
sizeComposition target size.
viewportViewport area.
scissorScissor area.

◆ pushComposition() [9/9]

void kanzi::CompositionStack::pushComposition ( NativeFramebufferHandle handle,
unsigned int bufferCount,
Vector2 size,
Vector4 viewport,
optional< Vector4 > scissor,
optional< Texture * > texture )
inline

Pushes a composition target and a viewport into the composition stack.

Parameters
handleComposition target handle.
bufferCountNumber of draw buffers bound to the handle.
sizeComposition target size.
viewportViewport area.
scissorScissor area.
textureThe texture to use as the composition target.
Since
Kanzi 3.9.7

◆ popComposition()

void kanzi::CompositionStack::popComposition ( )
inline

Pop a composition target state from the stack.

◆ pushDepthStencil()

void kanzi::CompositionStack::pushDepthStencil ( optional< GraphicsCompareFunction > depthFunc,
optional< bool > depthWrite,
optional< GraphicsCompareFunction > stencilFunc,
optional< unsigned int > referenceValue,
optional< unsigned int > maskValue,
optional< GraphicsStencilOperation > stencilFail,
optional< GraphicsStencilOperation > stencilPassDepthFail,
optional< GraphicsStencilOperation > stencilPassDepthPass,
optional< bool > stencilWrite )

Pushes depth stencil state.

Using nullopt with any parameter will take the default value or the last value pushed.

Parameters
depthFuncDepth testing function.
depthWriteDepth write enabled?
stencilFuncStencil function.
referenceValueStencil reference value.
maskValueStencil mask value.
stencilFailOperation for stencil fail.
stencilPassDepthFailOperation for stencil pass but depth fail.
stencilPassDepthPassOperation for stencil and depth pass.
stencilWriteStencil write enabled?

◆ popDepthStencil()

void kanzi::CompositionStack::popDepthStencil ( )
inline

Pop a depth stencil state from the stack.

◆ pushRasterization()

void kanzi::CompositionStack::pushRasterization ( optional< GraphicsCullMode > cullMode,
optional< Vector2 > polygonOffset )

Pushes rasterization state.

Using nullopt with any parameter will take the default value or the last value pushed.

Parameters
cullModeCulling mode.
polygonOffsetPolygon offset.
Since
Kanzi 3.9.4 polygonOffset parameter

◆ popRasterization()

void kanzi::CompositionStack::popRasterization ( )
inline

Pop a rasterization state from the stack.

◆ getDebugComposer()

RenderPassSharedPtr kanzi::CompositionStack::getDebugComposer ( ) const
inline

Get the debug composer used by this render context stack.

◆ setDebugComposer()

void kanzi::CompositionStack::setDebugComposer ( RenderPassSharedPtr debugComposer)
inline

Set the debug composer to be used by this render context stack.

◆ apply2D()

void kanzi::CompositionStack::apply2D ( Renderer3D & renderer)

Applies the topmost render settings for 2D rendering.

Parameters
rendererRenderer to use.

◆ apply3D()

void kanzi::CompositionStack::apply3D ( Renderer3D & renderer)

Applies the topmost render settings for 3D rendering.

Default values will be used for those states with empty stacks.

◆ applyPerspective2D()

void kanzi::CompositionStack::applyPerspective2D ( Renderer3D & renderer,
const Matrix4x4 & cameraMatrix,
const Matrix4x4 & projectionMatrix )

Applies the topmost render settings for 2D perspective rendering.

Parameters
rendererRenderer to use.
cameraMatrixPrecalculated cameraMatrix.
projectionMatrixPrecalculated projectionMatrix.

◆ peekCompositionTargetHandle()

optional< NativeFramebufferHandle > kanzi::CompositionStack::peekCompositionTargetHandle ( ) const
inline

Kanzi uses this function internally to get the handle of the current composition target.

Returns
Framebuffer handle.

◆ peekRenderContextSize()

optional< Vector2 > kanzi::CompositionStack::peekRenderContextSize ( ) const
inline

Kanzi uses this function internally to get the size of the current composition target.

Returns
Composition target size.

◆ peekScissor()

optional< Vector4 > kanzi::CompositionStack::peekScissor ( ) const
inline

Gets current scissor.

Returns
Scissor in Node2D coordinates or an empty optional if no scissor is set.

◆ peekViewport()

optional< Vector4 > kanzi::CompositionStack::peekViewport ( ) const
inline

Gets current viewport.

Returns
Viewport in Node2D coordinates or an empty optional if composition stack is empty.

◆ peekViewportOffset()

optional< Vector2 > kanzi::CompositionStack::peekViewportOffset ( ) const
inline

Gets current viewport offset.

Returns
Offset of topmost viewport or an empty optional if composition stack is empty.

◆ peekViewportSize()

optional< Vector2 > kanzi::CompositionStack::peekViewportSize ( ) const
inline

Gets current viewport size.

Disregards scissor.

Returns
Size of topmost viewport or an empty optional if composition stack is empty.

◆ peekTexture()

optional< Texture * > kanzi::CompositionStack::peekTexture ( ) const
inline

Gets the current composition target texture.

Returns
The target texture. If the composition stack is empty, returns an empty optional.
Since
Kanzi 3.9.7

◆ peekViewportDeviceCoordinates()

optional< ViewportRectangle > kanzi::CompositionStack::peekViewportDeviceCoordinates ( )
inline

Kanzi uses this function internally to get the current viewport in device coordinates.

Returns
Device coordinate viewport.

◆ peekScissorDeviceCoordinates()

optional< ViewportRectangle > kanzi::CompositionStack::peekScissorDeviceCoordinates ( )
inline

Kanzi uses this function internally to get the current scissor area in device coordinates.

Returns
Device coordinate viewport.

◆ peekPolygonOffset()

optional< Vector2 > kanzi::CompositionStack::peekPolygonOffset ( )
inline

Kanzi uses this function internally to get the current polygon offset.

Returns
Polygon offset.

◆ applyColorBlend2D()

void kanzi::CompositionStack::applyColorBlend2D ( Renderer & renderer)
inline

Applies the topmost color/blend stack state.

If stack is empty, default 2D blend settings are used.

Parameters
rendererRenderer to use.

◆ applyColorBlend3D()

void kanzi::CompositionStack::applyColorBlend3D ( Renderer & renderer)
inline

Applies the topmost color/blend stack state.

If stack is empty, default 3D blend settings are used.

Parameters
rendererRenderer to use.

◆ invalidateColorBlend()

void kanzi::CompositionStack::invalidateColorBlend ( )
inline

Invalidates color/blend stack state.

Should only be called when manually modifying color/blend state so that applying again will not assume no changes.

◆ applyComposition2D()

void kanzi::CompositionStack::applyComposition2D ( Renderer & renderer)
inline

Applies the topmost composition stack state for 2D rendering.

Default composition state for 2D is not defined.

Parameters
rendererRenderer to use.

◆ applyComposition3D()

void kanzi::CompositionStack::applyComposition3D ( Renderer & renderer)
inline

Applies the topmost composition stack state for 3D rendering.

Default composition state for 2D is not defined.

Parameters
rendererRenderer to use.

◆ invalidateComposition()

void kanzi::CompositionStack::invalidateComposition ( )
inline

Invalidates composition stack state.

Should only be called when manually modifying composition state so that applying again will not assume no changes.

◆ applyDepthStencil2D()

void kanzi::CompositionStack::applyDepthStencil2D ( Renderer & renderer)
inline

Applies the topmost depth/stencil stack state.

If stack is empty, default depth/stencil settings are used.

Parameters
rendererRenderer to use.

◆ applyDepthStencil3D()

void kanzi::CompositionStack::applyDepthStencil3D ( Renderer & renderer)
inline

Applies the topmost depth/stencil stack state.

If stack is empty, default depth/stencil settings are used.

Parameters
rendererRenderer to use.

◆ invalidateDepthStencil()

void kanzi::CompositionStack::invalidateDepthStencil ( )
inline

Invalidates depth/stencil stack state.

Should only be called when manually modifying depth/stencil state so that applying again will not assume no changes.

◆ applyRasterization2D()

void kanzi::CompositionStack::applyRasterization2D ( Renderer & renderer)
inline

Applies the topmost rasterization stack state.

If stack is empty, default rasterization settings are used.

Parameters
rendererRenderer to use.

◆ applyRasterization3D()

void kanzi::CompositionStack::applyRasterization3D ( Renderer & renderer)
inline

Applies the topmost rasterization stack state.

If stack is empty, default rasterization settings are used.

Parameters
rendererRenderer to use.

◆ invalidateRasterization()

void kanzi::CompositionStack::invalidateRasterization ( )
inline

Invalidates rasterization stack state.

Should only be called when manually modifying rasterization state so that applying again will not assume no changes.

◆ invalidateAllState()

void kanzi::CompositionStack::invalidateAllState ( )
inline

Invalidates all distinct stacks.

User should not need to call this function. Intended to be called along Renderer3D::reset() to signify context change.


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