mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-25 02:30:15 -06:00
New L3 crate `lightcraft-gpu`: a wgpu device (Metal/Vulkan/DX12; none on wasm32), WGSL kernels compiled once, buffer/dispatch/readback helpers, and a renderer that runs the per-pixel stage (tone map, highlights/shadows, clarity/texture/sharpen, dehaze, local mask terms, OkLCh colour ops, grading, vignette, gamut map, sRGB encode, curves, grain) on the device. Earlier stages still run on the CPU and are uploaded (per-stage hybrid). Stage results are cached per view next to the CPU StageCache (new `StageCache::extension`). The CPU pipeline stays the oracle and shares its resolved parameters with the kernels: `finish::FinishParams` / `mask_terms`, `pipeline::plan` (stage-cache keys), `local::plane_sigmas` / `nr_params` / `wb_matrix_for`, exact LUTs and OkLab matrices exported for the shader prelude. Equivalence tests (skip without an adapter): mean |d| < 0.5 LSB, max <= 3 LSB; measured max 1 LSB on Apple M4 Pro. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>