From ed0a2a4f07d951320f184cc363d8999aa9b2af4d Mon Sep 17 00:00:00 2001 From: radialmonster Date: Wed, 7 Oct 2026 20:33:48 -0400 Subject: [PATCH] GPU tests: drop the edge-pixel tolerance; the coverage mask makes edges match #207 let up to two edge pixels differ because the GPU's f32 framing could fall on the other side of the lens-warp boundary. 'GPU: decide warped-geometry edges with a CPU coverage mask' (this PR) makes the GPU use the CPU's f64 decision, so every case is back within the plain MAX_LSB check (embedded lens + perspective: max 1 LSB, was 91 before the mask). Co-Authored-By: Claude Opus 5.5 --- crates/gpu/tests/equivalence.rs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/crates/gpu/tests/equivalence.rs b/crates/gpu/tests/equivalence.rs index 2c1e70e6..c16b46cb 100644 --- a/crates/gpu/tests/equivalence.rs +++ b/crates/gpu/tests/equivalence.rs @@ -73,23 +73,7 @@ fn check(name: &str, src: &Arc, info: &SourceInfo, s: &DevelopSettings, let gpu = lightcraft_gpu::render(src, info, s, req, None).expect("gpu render"); let (mean, max, over) = diff(&cpu, &gpu.image); eprintln!("{name:<28} {}x{} mean {mean:.4} max {max} >1: {:.4}%", cpu.width, cpu.height, over * 100.0); - // A pixel on the very edge of the picture can fall either side of the sampling boundary (the - // lens warp with a shifted red plane lands exactly outside it): the CPU and a GPU's rounding - // may then disagree on one edge pixel. Tolerate a couple of those, nothing in the interior. - let (w, h) = (cpu.width, cpu.height); - let strays: Vec<(usize, usize)> = cpu - .data - .iter() - .zip(&gpu.image.data) - .enumerate() - .filter(|(_, (p, q))| (0..3).any(|c| p[c].abs_diff(q[c]) > MAX_LSB)) - .map(|(i, _)| (i % w, i / w)) - .collect(); - let on_the_edge = |&(x, y): &(usize, usize)| x == 0 || y == 0 || x + 1 == w || y + 1 == h; - assert!( - mean < MEAN_LSB && (max <= MAX_LSB || (strays.len() <= 2 && strays.iter().all(on_the_edge))), - "{name}: mean {mean:.4} LSB, max {max} LSB, pixels over {MAX_LSB}: {strays:?}" - ); + assert!(mean < MEAN_LSB && max <= MAX_LSB, "{name}: mean {mean:.4} LSB, max {max} LSB"); (mean, max) }