Skip to main content

sampler

Macro sampler 

Source
macro_rules! sampler {
    { $struct:ident as $filtering:ident } => { ... };
    { $struct:ident as $filtering:ident {
        $( $field:ident : $value:expr ),* $(,)?
    } } => { ... };
}
Expand description

Define a sampler.

The only mandatory thing you have to set is the wgpu::SamplerBindingType for its binding. You can also change the wgpu::SamplerDescriptor properties if you want, the fields you omit will just be the default… or just omit the whole section if you really don’t care.

sampler! { DontCare as Filtering }
sampler! { DidntAsk as Filtering {
    address_mode_u: wgpu::AddressMode::Repeat,
    mag_filter: wgpu::FilterMode::Nearest,
} }

let sampler: DidntAsk = context.new_sampler();