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 <noreply@anthropic.com>
This commit is contained in:
parent
e716ede8e4
commit
ed0a2a4f07
|
|
@ -73,23 +73,7 @@ fn check(name: &str, src: &Arc<Rgb32f>, 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)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue