kanzi::CompositionManager Class Reference

Composition manager. More...

#include <kanzi/core.ui/platform/graphics_backend/gl/composition_manager.hpp>

Public Member Functions

 CompositionManager (ResourceManager *resourceManager)
 Constructor. More...
 
virtual ~CompositionManager ()
 Destructor. More...
 
void initialize (Renderer &renderer)
 Initialize composition manager. More...
 
virtual TextureSharedPtr acquireTemporaryCompositionTarget (unsigned int width, unsigned int height, bool alpha, bool depth, bool stencil)
 Request a frame buffer. More...
 
TextureSharedPtr createPersistentCompositionTarget (unsigned int width, unsigned int height, GraphicsFormat colorFormat, GraphicsFormat depthStencilFormat, Sampler::AddressingMode addressingMode)
 Create a persistent composition target. More...
 
TextureSharedPtr createPersistentCompositionTarget (unsigned int width, unsigned int height, GraphicsFormat colorFormat, GraphicsFormat depthStencilFormat)
 Create a persistent composition target. More...
 
TextureSharedPtr createPersistentCompositionTarget (unsigned int width, unsigned int height, bool alpha, bool depth, bool stencil)
 Create a persistent composition target. More...
 
virtual void releaseTemporaryCompositionTarget (TextureSharedPtr framebuffer)
 Release an earlier framebuffer. More...
 
ResourceManagergetResourceManager () const
 Access resource manager owning this composition manager. More...
 
GraphicsFormat getDepthFormat () const
 Gets depth format. More...
 
GraphicsFormat getDepthStencilFormat () const
 Gets depth + stencil format. More...
 
GraphicsFormat getStencilFormat () const
 Gets stencil format. More...
 
bool compositionTargetMatches (const Texture &texture, unsigned int width, unsigned int height, GraphicsFormat colorFormat, GraphicsFormat depthStencilFormat, Sampler::AddressingMode addressingMode, float downScaleLimit)
 Checks if a given framebuffer is an acceptable match for given requirements. More...
 
bool compositionTargetMatches (const Texture &texture, unsigned int width, unsigned int height, GraphicsFormat colorFormat, GraphicsFormat depthStencilFormat)
 Checks if a given framebuffer is an acceptable match for given requirements. More...
 
bool compositionTargetMatches (const Texture &texture, unsigned int width, unsigned int height, bool alpha, bool depth, bool stencil, float downScaleLimit)
 Checks if a given framebuffer is an acceptable match for given requirements. More...
 
bool compositionTargetMatches (const Texture &texture, unsigned int width, unsigned int height, bool alpha, bool depth, bool stencil)
 Checks if a given framebuffer is an acceptable match for given requirements. More...
 
void clear ()
 Remove all allocated temporary composition targets. More...
 

Detailed Description

Composition manager.

Used for storing and managing composition targets and keeping track of their use. The rationale is to minimize memory used by composition targets.

Constructor & Destructor Documentation

kanzi::CompositionManager::CompositionManager ( ResourceManager resourceManager)
explicit

Constructor.

Parameters
resourceManagerResource manager owning this composition manager.
rendererRenderer to query capabilities from.
virtual kanzi::CompositionManager::~CompositionManager ( )
inlinevirtual

Destructor.

Member Function Documentation

void kanzi::CompositionManager::initialize ( Renderer renderer)

Initialize composition manager.

Should be run after Renderer is initialized.

Parameters
rendererRenderer to retrieve information about supported framebuffer types from.
virtual TextureSharedPtr kanzi::CompositionManager::acquireTemporaryCompositionTarget ( unsigned int  width,
unsigned int  height,
bool  alpha,
bool  depth,
bool  stencil 
)
virtual

Request a frame buffer.

Parameters
widthRequested width.
heightRequested height.
alphaIs alpha channel requested?
depthIs depth buffer requested?
stencilIs stencil buffer requested?
Returns
Framebuffer that fulfills the requirements.
TextureSharedPtr kanzi::CompositionManager::createPersistentCompositionTarget ( unsigned int  width,
unsigned int  height,
GraphicsFormat  colorFormat,
GraphicsFormat  depthStencilFormat,
Sampler::AddressingMode  addressingMode 
)

Create a persistent composition target.

Caller has ownership of this composition target, it is not stored within the composition manager.

Parameters
widthRequested width.
heightRequested height.
colorFormatColor buffer format.
depthStencilFormatDepth/stencil buffer format.
addressingModeAddressing mode (wrap/clamp/etc.).
Returns
Shared pointer to render target.
TextureSharedPtr kanzi::CompositionManager::createPersistentCompositionTarget ( unsigned int  width,
unsigned int  height,
GraphicsFormat  colorFormat,
GraphicsFormat  depthStencilFormat 
)
inline

Create a persistent composition target.

Caller has ownership of this composition target, it is not stored within the composition manager.

Parameters
widthRequested width.
heightRequested height.
colorFormatColor buffer format.
depthStencilFormatDepth/stencil buffer format.
Returns
Shared pointer to render target.
TextureSharedPtr kanzi::CompositionManager::createPersistentCompositionTarget ( unsigned int  width,
unsigned int  height,
bool  alpha,
bool  depth,
bool  stencil 
)

Create a persistent composition target.

Caller has ownership of this composition target, it is not stored within the composition manager. Determines color, depth and stencil formats from on/off boolean values.

Parameters
widthRequested width.
heightRequested height.
alphaAlpha channel requirement.
depthDepth buffer requirement.
stencilStencil buffer requirement.
Returns
Shared pointer to render target.
virtual void kanzi::CompositionManager::releaseTemporaryCompositionTarget ( TextureSharedPtr  framebuffer)
virtual

Release an earlier framebuffer.

This, released framebuffer may be re-used by successive requests.

Parameters
framebufferFramebuffer to release.
ResourceManager* kanzi::CompositionManager::getResourceManager ( ) const
inline

Access resource manager owning this composition manager.

Returns
Resource manager.
GraphicsFormat kanzi::CompositionManager::getDepthFormat ( ) const
inline

Gets depth format.

Returns
Graphics format enumeration.
GraphicsFormat kanzi::CompositionManager::getDepthStencilFormat ( ) const
inline

Gets depth + stencil format.

Returns
Graphics format enumeration.
GraphicsFormat kanzi::CompositionManager::getStencilFormat ( ) const
inline

Gets stencil format.

Returns
Graphics format enumeration.
bool kanzi::CompositionManager::compositionTargetMatches ( const Texture texture,
unsigned int  width,
unsigned int  height,
GraphicsFormat  colorFormat,
GraphicsFormat  depthStencilFormat,
Sampler::AddressingMode  addressingMode,
float  downScaleLimit 
)

Checks if a given framebuffer is an acceptable match for given requirements.

Parameters
textureComposition target to test.
widthRequested width.
heightRequested height.
colorFormatColor buffer format.
depthStencilFormatDepth/stencil buffer format.
downScaleLimitLimit for matching against smaller composition targets.
addressingModeAddressing mode (wrap/clamp/etc.).
Returns
True if acceptable, false if not.
bool kanzi::CompositionManager::compositionTargetMatches ( const Texture texture,
unsigned int  width,
unsigned int  height,
GraphicsFormat  colorFormat,
GraphicsFormat  depthStencilFormat 
)
inline

Checks if a given framebuffer is an acceptable match for given requirements.

Tolerance for how much smaller composition targets are accepted is determined automatically.

Parameters
textureComposition target to test.
widthRequested width.
heightRequested height.
colorFormatColor buffer format.
depthStencilFormatDepth/stencil buffer format.
Returns
True if acceptable, false if not.
bool kanzi::CompositionManager::compositionTargetMatches ( const Texture texture,
unsigned int  width,
unsigned int  height,
bool  alpha,
bool  depth,
bool  stencil,
float  downScaleLimit 
)

Checks if a given framebuffer is an acceptable match for given requirements.

Determines color, depth and stencil formats from on/off boolean values.

Parameters
textureComposition target to test.
widthRequested width.
heightRequested height.
alphaAlpha channel requirement.
depthDepth buffer requirement.
stencilStencil buffer requirement.
downScaleLimitLimit for matching against smaller composition targets.
Returns
True if acceptable, false if not.
bool kanzi::CompositionManager::compositionTargetMatches ( const Texture texture,
unsigned int  width,
unsigned int  height,
bool  alpha,
bool  depth,
bool  stencil 
)
inline

Checks if a given framebuffer is an acceptable match for given requirements.

Determines color, depth and stencil formats from on/off boolean values. Tolerance for how much smaller composition targets are accepted is determined automatically.

Parameters
textureComposition target to test.
widthRequested width.
heightRequested height.
alphaAlpha channel requirement.
depthDepth buffer requirement.
stencilStencil buffer requirement.
Returns
True if acceptable, false if not.
void kanzi::CompositionManager::clear ( )

Remove all allocated temporary composition targets.


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