wgpu/api/sampler.rs
1use crate::*;
2
3/// Handle to a sampler.
4///
5/// A `Sampler` object defines how a pipeline will sample from a [`TextureView`]. Samplers define
6/// image filters (including anisotropy) and address (wrapping) modes, among other things. See
7/// the documentation for [`SamplerDescriptor`] for more information.
8///
9/// It can be created with [`Device::create_sampler`].
10///
11/// Corresponds to [WebGPU `GPUSampler`](https://gpuweb.github.io/gpuweb/#sampler-interface).
12#[derive(Debug, Clone)]
13pub struct Sampler {
14 pub(crate) inner: dispatch::DispatchSampler,
15}
16#[cfg(send_sync)]
17static_assertions::assert_impl_all!(Sampler: Send, Sync);
18
19crate::cmp::impl_eq_ord_hash_proxy!(Sampler => .inner);
20
21/// Describes a [`Sampler`].
22///
23/// For use with [`Device::create_sampler`].
24///
25/// Corresponds to [WebGPU `GPUSamplerDescriptor`](
26/// https://gpuweb.github.io/gpuweb/#dictdef-gpusamplerdescriptor).
27pub type SamplerDescriptor<'a> = wgt::SamplerDescriptor<Label<'a>>;
28static_assertions::assert_impl_all!(SamplerDescriptor<'_>: Send, Sync);