Composition manager. More...
#include <kanzi/core.ui/graphics2d/composition_manager.hpp>
Classes | |
| struct | LRUTracker |
| Least Recently Used wrapper for different resource types. More... | |
| class | Request |
| Composition request class. More... | |
| struct | ReuseParameters |
| Reuse and pruning parameters for unused composition targets. More... | |
Public Types | |
| using | AvailableTextureContainer |
| Storage type for available textures. | |
| using | AvailableTextureSpan |
| Span type for available textures. | |
| using | UsedTextureSpan |
| Span type for used textures. | |
Public Member Functions | |
| TextureSharedPtr | acquireTemporaryCompositionTarget (const CompositionContentRequirements &requirements) |
| Requests a temporary composition target. | |
| virtual TextureSharedPtr | acquireTemporaryCompositionTarget (const Request &compositionReq) |
| Requests a temporary composition target. | |
| TextureSharedPtr | acquireTemporaryCompositionTarget (size_t width, size_t height, bool alpha, bool depth, bool stencil, Sampler::MipmapMode mipmapMode, size_t numSamples) |
| Requests a composition target. | |
| TextureSharedPtr | acquireTemporaryCompositionTarget (size_t width, size_t height, GraphicsFormat colorFormat, GraphicsFormat depthStencilFormat, Sampler::MipmapMode mipmapMode, size_t numSamples) |
| Requests a composition target. | |
| void | clear () |
| Removes all allocated temporary composition targets. | |
| CompositionManager (Domain *domain) | |
| Constructor. | |
| virtual TextureSharedPtr | createPersistentCompositionTarget (const Request &compositionReq) |
| Creates a persistent composition target. | |
| TextureSharedPtr | createPersistentCompositionTarget (size_t width, size_t height, bool alpha, bool depth, bool stencil) |
| Creates a persistent composition target. | |
| TextureSharedPtr | findClosestTexture (const CompositionManager::Request &compositionReq) |
| Finds the color texture, which most closely matches a given composition requirement, and marks it used. | |
| AvailableTextureSpan | getAvailableTextures () const |
| Gets a span over the available textures. | |
| GraphicsFormat | getColorFormat (bool alpha) const |
| Gets color texture format format depending on alpha requirement. | |
| GraphicsFormat | getDepthRenderbufferFormat () const |
| Gets depth renderbuffer format. | |
| GraphicsFormat | getDepthStencilFormat (bool depth, bool stencil) const |
| Gets the depth or stencil renderbuffer format depending on requirements. | |
| GraphicsFormat | getDepthStencilRenderbufferFormat () const |
| Gets depth + stencil format. | |
| GraphicsFormat | getDepthTextureFormat () const |
| Gets format for depth textures. | |
| ReuseParameters | getReuseParameters () const |
| Gets the reuse and pruning parameters for unused composition targets. | |
| GraphicsFormat | getStencilRenderbufferFormat () const |
| Gets stencil renderbuffer format. | |
| size_t | getUnusedTargetCount () const |
| Gets the numbers of unused composition targets for statistics and test purposes. | |
| UsedTextureSpan | getUsedTextures () const |
| Gets a span over the textures that are in use. | |
| void | initialize (Renderer &renderer) |
| Initializes the composition manager. | |
| void | pruneUnusedTargets () |
| Prunes unused composition targets from free lists. | |
| void | releasePendingTemporaryCompositionTarget (span< TextureSharedPtr > textures) |
| Releases the textures that have been pending release. | |
| virtual void | releaseTemporaryCompositionTarget (const TextureSharedPtr &texture) |
| Releases an composition target acquired earlier. | |
| void | setReuseParameters (const ReuseParameters &reuseParameters) |
| Sets the reuse and pruning parameters for unused composition targets. | |
| virtual | ~CompositionManager ()=default |
| Destructor. | |
Static Public Member Functions | |
| static bool | compositionTargetMatches (const Texture &target, const Request &compositionReq) |
| Checks if a given composition target texture is an acceptable match for given requirements. | |
| static bool | compositionTargetMatches (const Texture &target, const Request &compositionReq, float downScaleLimit) |
| Checks if a given composition target is an acceptable match for given requirements. | |
Protected Member Functions | |
| TextureSharedPtr | createCompositionTargetInternal (const CompositionManager::Request &compositionReq) const |
| Internal creation of the composition target. | |
| template<typename TargetType > | |
| size_t | getTargetMatchLevel (const Request &request, const TargetType &target) const |
| Calculates a match score between requested size and target size. | |
| size_t | getTextureMatchLevel (const Texture &texture, const Request &compositionReq) const |
| Gets texture match level for given requirements. | |
Static Protected Member Functions | |
| static bool | compositionTargetMatchesOmitSize (const Texture &target, const Request &compositionReq) |
| Checks if a given composition target texture is an acceptable match for given requirements. | |
Protected Attributes | |
| GraphicsFormat | m_alphaColorTextureFormat |
| Alpha color graphics format. | |
| AvailableTextureContainer | m_availableTextures |
| Temporary composition target textures available. | |
| GraphicsFormat | m_depthRenderbufferFormat |
| Depth format for renderbuffers. | |
| GraphicsFormat | m_depthStencilRenderbufferFormat |
| Depth + stencil format for renderbuffers. | |
| GraphicsFormat | m_depthTextureFormat |
| Depth format for depth textures. | |
| Domain * | m_domain |
| Owning domain. | |
| uint64_t | m_frameNumber |
| Current frame number used for freeing unused resources. | |
| GraphicsFormat | m_opaqueColorTextureFormat |
| Opaque color graphics format. | |
| vector< TextureSharedPtr > | m_pendingReleaseTextures |
| Composition target textures currently pending release. | |
| ReuseParameters | m_reuseParameters |
| Parameters for reuse and pruning of unused render targets. | |
| GraphicsFormat | m_stencilRenderbufferFormat |
| Stencil format for renderbuffers. | |
| vector< TextureSharedPtr > | m_usedTextures |
| Composition target textures currently in use. | |
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.
Storage type for available textures.
Span type for available textures.
Span type for used textures.
|
inlineexplicit |
Constructor.
| domain | The domain owning this composition manager. |
|
virtualdefault |
Destructor.
| void kanzi::CompositionManager::clear | ( | ) |
Removes all allocated temporary composition targets.
| void kanzi::CompositionManager::pruneUnusedTargets | ( | ) |
Prunes unused composition targets from free lists.
|
virtual |
Requests a temporary composition target.
Keep in mind that you must release the composition target using releaseTemporaryCompositionTarget().
| compositionReq | Request details. |
|
inline |
Requests a composition target.
Keep in mind that you must release the composition target using releaseTemporaryCompositionTarget().
| width | Requested width. |
| height | Requested height. |
| colorFormat | Color buffer format. |
| depthStencilFormat | Depth and/or stencil buffer format. |
| mipmapMode | Requested mipmap mode. |
| numSamples | Requested number of samples. |
mipmapMode parameter.
|
inline |
Requests a composition target.
Keep in mind that you must release the composition target using releaseTemporaryCompositionTarget().
| width | Requested width. |
| height | Requested height. |
| alpha | Whether to request the alpha channel. |
| depth | Whether to request the depth buffer. |
| stencil | Whether to request the stencil buffer. |
| mipmapMode | Requested mipmap mode. |
| numSamples | Requested number of samples. |
|
inline |
Requests a temporary composition target.
Keep in mind that you must release the composition target using releaseTemporaryCompositionTarget().
| requirements | Content requirements details. |
|
virtual |
Releases an composition target acquired earlier.
This, released composition target may be re-used by successive requests.
| texture | Target to release. |
|
virtual |
Creates a persistent composition target.
Caller has ownership of all the components of this composition target, it is not stored within the composition manager.
| compositionReq | Request details. |
|
inline |
Creates a persistent composition target.
This function returns only returns a color texture. Potential depth and stencil are renderbuffers. Caller has ownership of all the components of this composition target, it is not stored within the composition manager.
| width | Requested width. |
| height | Requested height. |
| alpha | Whether to require the alpha channel. |
| depth | Whether to require the depth buffer. |
| stencil | Whether to require the stencil buffer. |
| TextureSharedPtr kanzi::CompositionManager::findClosestTexture | ( | const CompositionManager::Request & | compositionReq | ) |
Finds the color texture, which most closely matches a given composition requirement, and marks it used.
| compositionReq | Request details. |
|
inline |
Gets the reuse and pruning parameters for unused composition targets.
|
inline |
Sets the reuse and pruning parameters for unused composition targets.
| reuseParameters | The struct that contains the reuse and pruning parameters. |
|
inline |
Gets color texture format format depending on alpha requirement.
| alpha | Whether to require alpha. |
|
inline |
Gets format for depth textures.
|
inline |
Gets the depth or stencil renderbuffer format depending on requirements.
| depth | Whether to require depth. |
| stencil | Whether to require stencil. |
|
inline |
Gets depth renderbuffer format.
|
inline |
Gets depth + stencil format.
|
inline |
Gets stencil renderbuffer format.
|
inline |
Gets a span over the available textures.
Do not call this function directly. Kanzi uses this function for internal verification.
|
inline |
Gets a span over the textures that are in use.
Do not call this function directly. Kanzi uses this function for internal verification.
|
inline |
Gets the numbers of unused composition targets for statistics and test purposes.
The returned value makes no distinction
|
static |
Checks if a given composition target is an acceptable match for given requirements.
| target | Composition target to test. |
| compositionReq | Request details. |
| downScaleLimit | Limit for matching against smaller composition targets. |
|
static |
Checks if a given composition target texture is an acceptable match for given requirements.
Size matching is exact.
| target | Composition target to test. |
| compositionReq | Request details. |
| void kanzi::CompositionManager::releasePendingTemporaryCompositionTarget | ( | span< TextureSharedPtr > | textures | ) |
Releases the textures that have been pending release.
This is called when command re-ordering will no longer occur for the affected textures meaning they are actually available for reuse. The textures processed by this function must have been previously released with the releaseTemporaryCompositionTarget function.
| textures | The pending textures to release. |
|
protected |
Internal creation of the composition target.
Both the temporary and permanent composition target creation paths eventually come here.
| compositionReq | Request details. |
|
staticprotected |
Checks if a given composition target texture is an acceptable match for given requirements.
Size checking is omitted. Called internally by compositionTargetMatches().
| target | Composition target to test. |
| compositionReq | Request details. |
|
inlineprotected |
Calculates a match score between requested size and target size.
| request | Composition request. |
| target | Composition target candidate for reuse. |
| TargetType | Composition target type. |
|
protected |
Temporary composition target textures available.
|
protected |
Composition target textures currently in use.
|
protected |
Composition target textures currently pending release.
|
protected |
Owning domain.
|
protected |
Alpha color graphics format.
|
protected |
Opaque color graphics format.
|
protected |
Depth format for depth textures.
|
protected |
Depth format for renderbuffers.
|
protected |
Depth + stencil format for renderbuffers.
|
protected |
Stencil format for renderbuffers.
|
protected |
Current frame number used for freeing unused resources.
|
protected |
Parameters for reuse and pruning of unused render targets.