v130 · graphics
WebGPU: Dual source blending
Functionality added to the WebGPU spec after its first shipment in a browser.
concepts
-
Dual-source blending probe
Feature-detect the GPU adapter for
dual-source-blending, build a minimal pipeline with the newsrc1blend factors, and report what the engine ships. -
Subpixel text shader
The canonical use case — LCD subpixel-AA text. Side-by-side: monochrome AA (grey edges) vs simulated dual-source subpixel AA (crisp edges with per-channel coverage), plus the WGSL that drives the GPU pipeline.
-
Blend equation studio
Five distinct use cases (subpixel text, premultiplied compositing, custom RGB-mask effects, two-pass lighting, color-channel correction). Each emits the WGSL fragment outputs, the WebGPU blend-state JSON, the resolved equation, and side-by-side visual previews (dst only / single-source / dual-source).
-
Alpha masking
Pick foreground/background colours and a mask pattern (radial, checkerboard, diagonal, ring). Side-by-side: dual-source blend with per-pixel mask vs standard uniform alpha — showing why one draw call with
src1replaces a two-pass mask pipeline.
why it shipped
The “dual-source-blending” GPU feature adds additional blend factors and the WGSL @blend_src attribute to allow a fragment shader to blend two color outputs into a single output buffer.