mirror of
https://github.com/storytold/filmcraft.git
synced 2026-10-14 19:26:59 -04:00
All 27 blend modes now composite on the GPU instead of sending the whole frame to the CPU. - render::plan: PlanLayer carries its Blend; plan_frame no longer falls back to a CPU frame for non-Normal modes. Media, graphic clips, multicam angles and CPU-rendered layer images (standard effects) keep their clip's mode; inside a transition the mode is Normal, as in the CPU reference. execute_cpu composites with each layer's mode. - gpu: Normal keeps the single fixed-function pass. Dissolve also uses fixed-function "over": the CPU's 64-bit pixel hash is reproduced in WGSL on u32 pairs (pattern bit-exact). The other 25 modes copy the accumulator region under the layer's quad into a backdrop texture and composite in fs_blend with the CPU math (sRGB-encoded straight colour, W3C formulas, back to linear, same premultiplied mix and clamping). - Tests: per-mode GPU-vs-CPU parity (gpu crate: overlapping transformed layers, partial opacity/alpha, empty/partial backdrop; golden: every mode through plan_frame incl. an effect layer, blended clips in a cross dissolve), exact-value edge cases (black/white, Divide by 0, Dodge/Burn at 0 and 1, zero alpha) within 4.9e-4, Dissolve pattern exact, off-output layers, quad bounds. - Bench: new stack3-blend playback scenario (V2 Screen, V3 Overlay); CPU ms/frame 151-214 -> 86-89, Full 19/173 and 138/54 -> 191/1, 192/0. - Docs: architecture §5, gpu crate docs, testing, performance. Co-Authored-By: Claude Opus 5.5 <[email protected]>