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) }