Blend-variant program / pipeline warm-up, for both renderers.
Headless Chromium often runs WebGL through SwiftShader, whose shader/program
link step is synchronous and can monopolize the main thread for seconds.
Luxar's Layers panel lets users switch blending modes at runtime, and some
mode transitions flip shader defines (max, volumetric, gsplat normal,
mesh opaque cutout). Without a warm-up pass, the first click onto each
variant pays that synchronous link cost on the interaction path.
WebGPU pays the same kind of cost per render PIPELINE, and there the blend
state is part of the pipeline: every mode is its own variant (the TSL
wrappers also rebuild their node graph across the peak/sum boundary). So a
WebGPU manager (pipelineVariants) keys variants by mode and compiles with
three's compileAsync, which builds the same cached pipelines a later
render uses.
This manager pre-compiles every DISTINCT blend-variant program a live visual
material can reach, then draws one tiny primitive for non-transmissive
WebGL variants with an ordinary render target so first-use draw state is
primed too. Canvas and XR variants are link-warmed only. One variant runs per
post-frame idle opportunity so visible rendering and input get a turn before
every link. Browsers without idle callbacks use a conservative 50 ms delay.
The warmed programs stay pinned by keeper materials until the source
material is replaced or disposed.
Blend-variant program / pipeline warm-up, for both renderers.
Headless Chromium often runs WebGL through SwiftShader, whose shader/program link step is synchronous and can monopolize the main thread for seconds. Luxar's Layers panel lets users switch blending modes at runtime, and some mode transitions flip shader defines (
max,volumetric, gsplatnormal, meshopaquecutout). Without a warm-up pass, the first click onto each variant pays that synchronous link cost on the interaction path.WebGPU pays the same kind of cost per render PIPELINE, and there the blend state is part of the pipeline: every mode is its own variant (the TSL wrappers also rebuild their node graph across the peak/sum boundary). So a WebGPU manager (
pipelineVariants) keys variants by mode and compiles with three'scompileAsync, which builds the same cached pipelines a later render uses.This manager pre-compiles every DISTINCT blend-variant program a live visual material can reach, then draws one tiny primitive for non-transmissive WebGL variants with an ordinary render target so first-use draw state is primed too. Canvas and XR variants are link-warmed only. One variant runs per post-frame idle opportunity so visible rendering and input get a turn before every link. Browsers without idle callbacks use a conservative 50 ms delay. The warmed programs stay pinned by keeper materials until the source material is replaced or disposed.