MayaFlux 0.1.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 359 of file TextureLoom.cpp.

360{
361 if (!is_initialized()) {
363 "TextureLoom not initialized");
364 return nullptr;
365 }
366
367 size_t hash = hash_sampler_config(config);
368 auto it = m_sampler_cache.find(hash);
369 if (it != m_sampler_cache.end()) {
370 return it->second;
371 }
372
373 vk::Sampler sampler = create_sampler(config);
374 m_sampler_cache[hash] = sampler;
375 return sampler;
376}
#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: