Lysa  0.0
Lysa 3D Engine
Samplers Class Reference

Detailed Description

Manages a small, shared collection of GPU sampler objects.

  • Provide a fixed-size pool of samplers that materials/shaders can reuse.
  • Create and track descriptor layout and descriptor set for binding samplers.
  • Expose an update mechanism to (re)write descriptors when the set changes.

Notes:

  • This class is typically owned by the Resources container and is not instantiated directly by users.
  • Thread-safety: methods that mutate internal state should be guarded by the internal mutex; read-only getters are safe after initialization.

Classes

struct  SamplerInfo
 

Public Member Functions

uint32 addSampler (vireo::Filter minFilter, vireo::Filter maxFilter, vireo::AddressMode samplerAddressModeU, vireo::AddressMode samplerAddressModeV, float minLod=0.0f, float maxLod=vireo::Sampler::LOD_CLAMP_NONE, bool anisotropyEnable=true, vireo::MipMapMode mipMapMode=vireo::MipMapMode::LINEAR, vireo::CompareOp compareOp=vireo::CompareOp::NEVER)
 
bool isUpdated () const
 
void update ()
 
const auto & getDescriptorLayout () const
 
const auto & getDescriptorSet () const
 

Static Public Attributes

static constexpr auto MAX_SAMPLERS {20}
 
static constexpr uint32 SET_SAMPLERS {1}
 

Member Function Documentation

uint32 addSampler ( vireo::Filter  minFilter,
vireo::Filter  maxFilter,
vireo::AddressMode  samplerAddressModeU,
vireo::AddressMode  samplerAddressModeV,
float  minLod = 0.0f,
float  maxLod = vireo::Sampler::LOD_CLAMP_NONE,
bool  anisotropyEnable = true,
vireo::MipMapMode  mipMapMode = vireo::MipMapMode::LINEAR,
vireo::CompareOp  compareOp = vireo::CompareOp::NEVER 
)

Adds a sampler to the pool, creating it if an equivalent one does not already exist, and returns its index for binding.

Parameters
minFilterMinification filter.
maxFilterMagnification filter.
samplerAddressModeUAddress mode for U (S) coordinate.
samplerAddressModeVAddress mode for V (T) coordinate.
minLodMinimum LOD to sample (default 0.0f).
maxLodMaximum LOD to sample; use Sampler::LOD_CLAMP_NONE to disable clamping.
anisotropyEnableEnable anisotropic filtering when available.
mipMapModeMip sampling mode (default LINEAR).
compareOpOptional compare op for depth/shadow lookups.
Returns
Index into the samplers set suitable for descriptor binding.
const auto& getDescriptorLayout ( ) const
inline

Returns the descriptor layout used for the samplers set.

const auto& getDescriptorSet ( ) const
inline

Returns the descriptor set that binds the samplers to shaders.

bool isUpdated ( ) const
inline

Returns true if the samplers descriptor set needs to be updated.

void update ( )

Writes pending sampler bindings to the descriptor set if needed.

Friends And Related Function Documentation

friend class Resources
friend

Member Data Documentation

constexpr auto MAX_SAMPLERS {20}
staticconstexpr

Maximum number of sampler objects managed by this pool.

constexpr uint32 SET_SAMPLERS {1}
staticconstexpr

Descriptor set index used by pipelines to bind the samplers set.