Expand description
P7.4 — GPU colour-projection / gamut batch kernel + CPU oracle. P7.4 — GPU colour-projection / gamut batch kernel + CPU oracle.
The GPU kernel processes batches of EMF payloads [α, μ, σ] through
the full colour pipeline (SPD → XYZ → linear sRGB → gamut map →
display sRGB) in parallel. This module provides:
- CPU oracle: the reference implementation for correctness checks.
- GPU kernel spec: the WGSL shader source and buffer layout specification for the GPU implementation.
- Differential check: compares CPU vs GPU output for a given batch.
§Buffer layout (GPU)
Bind group 0:
- storage buffer: EMF input [f32×3 × N] (α, μ, σ per element)
- storage buffer: RGB output [u8×3 × N] (r, g, b per element)
- uniform buffer: params { sample_count: u32 }§Determinism
The CPU oracle is fully deterministic. The GPU kernel must produce bit-identical output to the CPU oracle for the same input (within f32 rounding tolerance).
Structs§
- GpuBuffer
Layout - Buffer layout specification for the GPU kernel.
Constants§
- DIFF_
TOLERANCE_ U8 - Tolerance for CPU vs GPU differential comparison. f32 rounding in the GPU kernel may produce ±1 LSB differences in the 8-bit output.
- GPU_
COLOUR_ KERNEL_ WGSL - WGSL shader source for the GPU colour-projection batch kernel.
Functions§
- cpu_
batch_ emf_ to_ display_ gamut_ mapped - CPU oracle: process a batch of EMF payloads through the full colour pipeline and produce gamut-mapped 8-bit display RGB.
- cpu_
batch_ emf_ to_ xyz - CPU oracle: process a batch of EMF payloads and produce XYZ values.
- diff_
cpu_ gpu - Compare CPU oracle output with GPU output.