GPU parity tests: give the one-step tolerance f32 slack (#1852)

Two results exactly one 8-bit step apart can land a few f32 ulps past 1/255 after premultiplying
and subtracting (NVIDIA, Hue/Saturation in adjustment_layers); allow 4 epsilon of slack. Fixes #1848.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Sir StarchandClaude Opus 5.5 authored and GitHub committed 2026-10-09 11:51:36 -04:00
1 parent ff1d933cb8
commit 9bd935498b
1 file changed
+4 -1
+4 -1
View File
@@ -7,7 +7,10 @@ use photocraft_doc::{Adjustment, Document, Fill, GradientStyle, Layer, LayerCont
use photocraft_geom::{Rect, Size};
use photocraft_gpu::{Compositor, render_to_vec};
const TOL: f32 = 1.0 / 255.0;
/// One 8-bit step, plus a few f32 ulps: two results exactly one step apart can differ by a hair
/// more than `1.0 / 255.0` after premultiplying and subtracting (NVIDIA's shader arithmetic
/// lands on that side at the Hue/Saturation pixel in `adjustment_layers`).
const TOL: f32 = 1.0 / 255.0 + 4.0 * f32::EPSILON;
/// Concurrent wgpu instances in one process segfault on some drivers (RADV), so the GPU tests
/// take this lock and hold it until their device is dropped.