Skip to main content

Module blend_pipeline

Module blend_pipeline 

Source
Expand description

BlendPipelineMap — pre-built RenderPipeline per standard blend mode.

Each of wisp’s 6 pipelines (sprite, quad, triangle, mesh, text, graphics) takes the same shader/vertex/bind-group setup and varies only in the wgpu::BlendState. Rather than building one pipeline per mode by hand (× 6 pipelines × 8 native modes = 48 pipeline construction sites), this helper accepts a builder closure that takes a BlendState and returns a RenderPipeline. We pre-build one pipeline per native BlendMode at construction time.

Advanced modes (Tier C — Overlay, ColorBurn, …) aren’t represented in the map — they require the offscreen filter pipeline. When a caller asks for an advanced mode via BlendPipelineMap::get, we fall back to Normal. This fallback is INTENTIONAL when Renderer::render_stage renders an advanced-blend subtree into a foreground RT — the leaf’s pure colors land in the foreground, then the parent’s advanced blend is applied via apply_advanced_blend. No warning is emitted because auto-dispatch makes it correct by default.

Structs§

BlendPipelineMap 🔒
Map from a BlendMode to its pre-built RenderPipeline.