pub struct SamplerDescriptor {
pub filter: FilterMode,
pub mipmap_filter: MipmapFilter,
pub address_mode_u: AddressMode,
pub address_mode_v: AddressMode,
pub address_mode_w: AddressMode,
pub compare: Option<CompareFunction>,
}Expand description
A strongly-typed sampler descriptor for create_sampler.
Replaces the historical GpuSamplerDescriptor, which spelled the
filter and address modes as six independent &'static str fields plus
a compare: bool. The new layout keeps the same information but as
three orthogonal decisions — how to interpolate, how to blend mip
levels, how to wrap — so the combinations the old fields allowed but
the renderer could not express (a Nearest magnification filter with a
Linear minification filter, a comparison other than the hardcoded
one) are now expressible, and an invalid value is a compile error
rather than a silently rejected createSampler call.
Fields§
§filter: FilterModeHow texels are interpolated within one mip level. Applied to both the magnification and the minification filter.
mipmap_filter: MipmapFilterHow results from adjacent mip levels are blended together.
address_mode_u: AddressModeWhat sampling does with U coordinates outside [0, 1].
address_mode_v: AddressModeWhat sampling does with V coordinates outside [0, 1].
address_mode_w: AddressModeWhat sampling does with W coordinates outside [0, 1]. Only
meaningful for 3D textures.
compare: Option<CompareFunction>The depth comparison to apply, or None for a plain filtering
sampler that performs no comparison. Strictly more expressive than
the old compare: bool, which could only mean “compare with the
single hardcoded comparison”.
Implementations§
Source§impl SamplerDescriptor
Named constructors for the pipeline state structs.
impl SamplerDescriptor
Named constructors for the pipeline state structs.
Sourcepub fn nearest_clamp() -> Self
pub fn nearest_clamp() -> Self
The cheapest sampler: nearest filtering on every axis with clamp-to-edge addressing and no comparison.
§Returns
Self- The assembled sampler descriptor.