Skip to main content

filter_sampler

Function filter_sampler 

Source
pub fn filter_sampler(device: &Device) -> Sampler
Expand description

The engine’s one sampler, which the blur kernels read their source page through.

Bilinear, and that is the whole reason it exists: every other engine pipeline reads its textures with textureLoad at integer coordinates, while the blur kernels sample at fractional offsets so a decimation costs four samples instead of sixteen and a convolution tap one instead of two (see crate::filters::blur’s bilinear kernel).

Clamped rather than bordered on every axis: wgpu’s transparent-black border address mode needs an adapter feature this tier never requests. The address mode is not what makes a tap past the region transparent, and could not be — a filter layer’s region sits at its page’s own origin, so on the near side a clamp replicates the region’s own edge texel instead of leaving the texture at all. Every kernel therefore bounds its own taps against the source region (sample_region_bilinear in shaders/filters_blur.wgsl, drop_shadow_load_checked in shaders/filters_drop_shadow.wgsl), which is what makes this sampler’s behaviour outside that region unobservable rather than merely harmless. No mip chain, because a pooled page has exactly one level.