pub enum SamplerKind {
LinearRepeat,
LinearClamp,
LinearClampNoMip,
Nearest,
NearestClampBorder,
CompareLess,
}Expand description
A named, pre-built sampler configuration. Every variant is built once at
startup and shared via GlobalSamplers — look one up with
GlobalSamplers::get(kind) rather than creating your own wgpu::Sampler.
Variants§
LinearRepeat
Linear filtering, tiling (Repeat) address mode, mipmapped.
LinearClamp
Linear filtering, edge-clamped, mipmapped.
LinearClampNoMip
Linear filtering, edge-clamped, no mipmapping (lod_min/max_clamp = 0).
Nearest
Nearest-neighbor filtering, wgpu’s default (repeat) address mode.
NearestClampBorder
Nearest-neighbor filtering, clamped to a border color. On web this
falls back to edge-clamping instead (see descriptor’s
docs) since WebGPU has no border-color support.
CompareLess
Linear filtering, edge-clamped, with CompareFunction::Less — for
shadow-map textureSampleCompare.
Implementations§
Source§impl SamplerKind
impl SamplerKind
Sourcepub fn descriptor(&self) -> SamplerDescriptor<'static>
pub fn descriptor(&self) -> SamplerDescriptor<'static>
The wgpu::SamplerDescriptor this kind builds.
NearestClampBorder is the one variant that isn’t identical across
platforms: WebGPU doesn’t support ClampToBorder/a border color at
all, so on wasm32 this silently downgrades to ClampToEdge (no
border color) instead — sampling outside [0, 1] UV will read edge
texels on web instead of the border color you’d get natively. If
your material depends on the border being visually distinct from the
edge, this is a real cross-platform behavior difference to account
for, not just an implementation detail.
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync 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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more