Generated rather than stored, unlitShaderSource's rule: the shared half is
written once and the text is a pure function of the flags, so the pipeline
cache keys on the descriptor. The fragment stage is the GL lit stage's
arithmetic in its order — normalize under the zero-length guard, base colour
times the optional sample, the directional term, then the punctual loop
added to the pre-existing expression — so a variant that samples nothing
under a scene with no punctual lights computes exactly what the GL program
computes with its switches at their initial values.
shadow (WP-R1.7) swaps the light block for wgpu-shadow.ts's widened
twin, splices shadowFactor, and multiplies the directional product before
it joins the lighting sum — GL's useShadow branch, as a variant; the
module header carries the argument. With it false — the default — the
fragment arithmetic is the WP-R1.5 expression; the vertex stage reads
draw.normalMatrix rather than the per-vertex cofactor that packet used.
The lit WGSL module for one variant triple.
Generated rather than stored,
unlitShaderSource's rule: the shared half is written once and the text is a pure function of the flags, so the pipeline cache keys on the descriptor. The fragment stage is the GL lit stage's arithmetic in its order — normalize under the zero-length guard, base colour times the optional sample, the directional term, then the punctual loop added to the pre-existing expression — so a variant that samples nothing under a scene with no punctual lights computes exactly what the GL program computes with its switches at their initial values.shadow(WP-R1.7) swaps the light block forwgpu-shadow.ts's widened twin, splicesshadowFactor, and multiplies the directional product before it joins the lighting sum — GL'suseShadowbranch, as a variant; the module header carries the argument. With it false — the default — the fragment arithmetic is the WP-R1.5 expression; the vertex stage readsdraw.normalMatrixrather than the per-vertex cofactor that packet used.