Kanzi 4.0.0-beta2
kanzi::SamplerCache Class Reference

Cache for sampler objects. More...

#include <kanzi/core.ui/graphics/sampler_cache.hpp>

Public Types

using storage_type
 Storage type.
 

Public Member Functions

gfx::SamplerHandleGuard get (const Sampler::CreateInfo &createInfo, string_view name)
 Gets or creates a sampler based on given settings.
 
void invalidate ()
 Invalidates the cache and releases all kanzi graphics handles.
 
SamplerCacheoperator= (const SamplerCache &)=delete
 Deleted copy operator.
 
SamplerCacheoperator= (SamplerCache &&)=delete
 Deleted move operator.
 
 SamplerCache ()=default
 Default constructor.
 
 SamplerCache (const SamplerCache &)=delete
 Deleted copy constructor.
 
 SamplerCache (SamplerCache &&)=delete
 Deleted move constructor.
 

Protected Attributes

storage_type m_samplers
 Sampler storage.
 

Detailed Description

Cache for sampler objects.

Intended for caching variations of samplers made from default texture samplers and reducing number of of total samplers created.

Since
Kanzi 4.0.0

Member Typedef Documentation

◆ storage_type

Constructor & Destructor Documentation

◆ SamplerCache() [1/3]

kanzi::SamplerCache::SamplerCache ( )
explicitdefault

Default constructor.

◆ SamplerCache() [2/3]

kanzi::SamplerCache::SamplerCache ( const SamplerCache & )
delete

Deleted copy constructor.

◆ SamplerCache() [3/3]

kanzi::SamplerCache::SamplerCache ( SamplerCache && )
delete

Deleted move constructor.

Member Function Documentation

◆ operator=() [1/2]

SamplerCache & kanzi::SamplerCache::operator= ( const SamplerCache & )
delete

Deleted copy operator.

◆ operator=() [2/2]

SamplerCache & kanzi::SamplerCache::operator= ( SamplerCache && )
delete

Deleted move operator.

◆ get()

gfx::SamplerHandleGuard kanzi::SamplerCache::get ( const Sampler::CreateInfo & createInfo,
string_view name )

Gets or creates a sampler based on given settings.

Sampler::CreateInfo is a packed structure, so the comparison is quite fast. This function can be called during rendering to acquire an alternative sampler without worrying about performance.

Parameters
createInfoSampler create info.
nameName to use for the sampler if it has to be generated.
Returns
The Kanzi graphics Sampler handle.

◆ invalidate()

void kanzi::SamplerCache::invalidate ( )

Invalidates the cache and releases all kanzi graphics handles.

Member Data Documentation

◆ m_samplers

storage_type kanzi::SamplerCache::m_samplers
protected

Sampler storage.


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