Skip to main content

Crate filtrate

Crate filtrate 

Source
Expand description

GPU filter library built on top of filtrate-core abstractions.

filtrate hosts the built-in filter implementations and their WGSL shaders, and (in upcoming phases) the GPU runtime that compiles a Filter graph into a wgpu pipeline. It is designed to be usable outside of WaterUI for any wgpu-based image, video, or render-target workflow.

§Layout

  • filters: built-in filter structs (Brightness, Blur, …). Each filter implements Filter from filtrate-core and references one or more WGSL shader files under src/shaders/.
  • shaders/ (not a Rust module): WGSL fragments and full-shader files compiled into the binary via include_str! from individual filter modules.

§Example

use filtrate::filters::{Blur, Brightness};
use filtrate::{Filter, FilterExt};

let chain = Blur(5.0_f32).then(Brightness(0.1_f32));

§WebGL support

The optional webgl feature enables wgpu’s WebGL2 backend for wasm targets (wasm32-unknown-unknown). WebGL2 has no compute shaders or storage textures, so spatial filter stages compile to a fragment translation of the same shader body there, selected automatically from the device limits — see runtime::SpatialExecution. The feature is a compile error on non-wasm targets.

Re-exports§

pub use effect::Effect;
pub use effect::EffectContext;
pub use effect::EffectFrameClock;
pub use effect::EffectFrameTiming;
pub use effect::EffectInput;
pub use effect::EffectOutput;
pub use effect::EffectRedrawCallback;
pub use effect::EffectRenderError;
pub use effect::EffectRenderResult;
pub use effect::EffectSetupError;
pub use effect::EffectSetupResult;
pub use runtime::FilterAdapter;
pub use runtime::HdrPolicy;

Modules§

effect
GPU-aware runtime trait for filter effects.
filters
Filter implementations.
multi_input
Multi-input GPU filters built for modern GPUs.
runtime
Generic GPU runtime for compiling a typed Filter graph into an Effect.

Structs§

AnimatedTarget
Carries a new target value plus optional animation interpolator from a watcher callback into the runtime.
AnimationTrack
Single-channel f32 animation timeline.
Chain
A chain of two filters.
WatchGuard
Opaque guard returned by FilterParam::watch_animated that keeps a subscription alive. Dropping the guard cancels the subscription.
WgslModuleCache
Memoizes runtime-compiled WGSL modules for one device.

Constants§

MAX_FILTER_PARAMS
Maximum number of f32 parameters a single fused filter pipeline can carry.
MAX_FILTER_PARAM_VEC4S
Number of vec4<f32> slots required to hold MAX_FILTER_PARAMS floats.

Traits§

Filter
A GPU filter that processes textures.
FilterExt
Extension trait for chaining filters.
FilterParam
A scalar f32 parameter that can be sampled during initialization and observed for animated changes.
Interpolator
Interpolator drives a smooth transition between two f32 values over time.
ParamArray
Trait for parameter arrays that can write their values to a buffer.
SignalVisitor
Sink for crate::Filter::visit_signals traversal.
StageCollector
Sink for atomic stages emitted by crate::Filter::collect_stages.

Type Aliases§

AnimatedCallback
Boxed callback type passed to FilterParam::watch_animated.

Derive Macros§

Filter
Procedural derive that generates a Filter implementation for a tuple struct. See filtrate-derive for the supported #[filter(...)] shapes. Derives a complete Filter implementation from a #[filter(...)] attribute; see the crate docs for the supported shapes.