MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Portal::Graphics::SamplerForge Class Reference

Creates and caches Vulkan samplers (Singleton) More...

#include <SamplerForge.hpp>

+ Collaboration diagram for MayaFlux::Portal::Graphics::SamplerForge:

Public Member Functions

 SamplerForge (const SamplerForge &)=delete
 
SamplerForgeoperator= (const SamplerForge &)=delete
 
 SamplerForge (SamplerForge &&)=delete
 
SamplerForgeoperator= (SamplerForge &&)=delete
 
bool initialize (const std::shared_ptr< Core::VulkanBackend > &backend)
 Initialize with backend reference.
 
void shutdown ()
 Shutdown and cleanup all samplers.
 
bool is_initialized () const
 Check if factory is initialized.
 
vk::Sampler get_or_create (const SamplerConfig &config)
 Get or create a sampler with the given configuration.
 
vk::Sampler get_default_linear ()
 Get a default linear sampler.
 
vk::Sampler get_default_nearest ()
 Get a default nearest sampler.
 
vk::Sampler get_anisotropic (float max_anisotropy=16.0F)
 Get an anisotropic sampler (high quality)
 
void destroy_sampler (vk::Sampler sampler)
 Destroy a specific sampler.
 
size_t get_sampler_count () const
 Get number of cached samplers.
 

Static Public Member Functions

static SamplerForgeinstance ()
 

Private Member Functions

 SamplerForge ()=default
 
 ~SamplerForge ()
 
vk::Sampler create_sampler (const SamplerConfig &config)
 

Static Private Member Functions

static size_t hash_config (const SamplerConfig &config)
 
static vk::Filter to_vk_filter (FilterMode mode)
 
static vk::SamplerAddressMode to_vk_address_mode (AddressMode mode)
 

Private Attributes

std::shared_ptr< Core::VulkanBackendm_backend
 
std::unordered_map< size_t, vk::Sampler > m_sampler_cache
 

Static Private Attributes

static bool s_initialized = false
 

Detailed Description

Creates and caches Vulkan samplers (Singleton)

Samplers control how textures are filtered and addressed when sampled in shaders. This factory caches samplers based on configuration to avoid creating duplicates.

Lifecycle:

  • Initialize with backend reference
  • Create samplers via get_or_create()
  • Samplers are cached and reused
  • Cleanup destroys all samplers

Thread-safe after initialization.

Definition at line 30 of file SamplerForge.hpp.


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