MayaFlux 0.3.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ get_or_create_sampler()

vk::Sampler MayaFlux::Portal::Graphics::TextureLoom::get_or_create_sampler ( const SamplerConfig config)

Get or create a sampler with the given configuration.

Parameters
configSampler configuration
Returns
Vulkan sampler handle (cached)

Samplers are cached - identical configs return same sampler. Managed by TextureLoom, destroyed on shutdown.

Definition at line 374 of file TextureLoom.cpp.

375{
376 if (!is_initialized()) {
378 "TextureLoom not initialized");
379 return nullptr;
380 }
381
382 size_t hash = hash_sampler_config(config);
383 auto it = m_sampler_cache.find(hash);
384 if (it != m_sampler_cache.end()) {
385 return it->second;
386 }
387
388 vk::Sampler sampler = create_sampler(config);
389 m_sampler_cache[hash] = sampler;
390 return sampler;
391}
#define MF_ERROR(comp, ctx,...)
vk::Sampler create_sampler(const SamplerConfig &config)
static size_t hash_sampler_config(const SamplerConfig &config)
std::unordered_map< size_t, vk::Sampler > m_sampler_cache
bool is_initialized() const
Check if manager is initialized.
@ ImageProcessing
Image processing tasks (filters, transformations)
@ Portal
High-level user-facing API layer.

References create_sampler(), hash_sampler_config(), MayaFlux::Journal::ImageProcessing, is_initialized(), m_sampler_cache, MF_ERROR, and MayaFlux::Journal::Portal.

Referenced by get_default_sampler(), and get_nearest_sampler().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: