pub enum SamplerKind {
LinearRepeat,
LinearClamp,
LinearClampNoMip,
Nearest,
NearestClampBorder,
CompareLess,
}Variants§
LinearRepeat
LinearClamp
LinearClampNoMip
Like LinearClamp, but clamped to mip 0 only (lod_min_clamp/
lod_max_clamp both 0.0). Use this when you need to force sampling
the base level regardless of how many mips the texture actually
has — e.g. an environment-map capture pass where blending across
mips would introduce blur you don’t want in the baked result.
Nearest
NearestClampBorder
Nearest-filtered (min/mag), clamped to an opaque white border rather
than the edge texel — matches the classic GL texture-array setup:
GL_NEAREST + GL_CLAMP_TO_BORDER + a {1,1,1,1} border color.
Useful for a texture_2d_array where sampling past a layer’s edge
should read as “nothing here” (white) instead of edge bleed.
CompareLess
A comparison sampler (sampler_comparison in WGSL, sampled via
textureSampleCompare) using CompareFunction::Less — the
standard shadow-map test (“is this fragment’s depth less than the
depth stored at this texel”). Linear-filtered, clamped to edge.
Must be paired with BindingKind::ComparisonSampler/
BindingEntry::comparison_sampler
in the layout — a regular Sampler binding won’t accept a
comparison sampler, and vice versa.
Implementations§
Source§impl SamplerKind
impl SamplerKind
Sourcepub fn descriptor(&self) -> SamplerDescriptor<'static>
pub fn descriptor(&self) -> SamplerDescriptor<'static>
Pure conversion to a wgpu descriptor. You still call
device.create_sampler(&kind.descriptor()) yourself, in your own
LazyResource::construct — this only fixes the handful of
address-mode/filter combinations so you don’t re-derive them.
Trait Implementations§
Source§impl Clone for SamplerKind
impl Clone for SamplerKind
Source§fn clone(&self) -> SamplerKind
fn clone(&self) -> SamplerKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SamplerKind
impl Eq for SamplerKind
Source§impl Hash for SamplerKind
impl Hash for SamplerKind
Source§impl PartialEq for SamplerKind
impl PartialEq for SamplerKind
impl StructuralPartialEq for SamplerKind
Auto Trait Implementations§
impl Freeze for SamplerKind
impl RefUnwindSafe for SamplerKind
impl Send for SamplerKind
impl Sync for SamplerKind
impl Unpin for SamplerKind
impl UnsafeUnpin for SamplerKind
impl UnwindSafe for SamplerKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Component for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.