diff --git a/crates/ui-egui/tests/it/gpu_tests/adjust_preview_gpu.rs b/crates/ui-egui/tests/it/gpu_tests/adjust_preview_gpu.rs index e50213f8c3..43790c4a40 100644 --- a/crates/ui-egui/tests/it/gpu_tests/adjust_preview_gpu.rs +++ b/crates/ui-egui/tests/it/gpu_tests/adjust_preview_gpu.rs @@ -194,6 +194,12 @@ fn preview_layer_composites_on_the_gpu_like_the_command() { for selection in [false, true] { let (doc, target) = document(mode, depth, selection); for (kind_index, kind) in photocraft_ui_egui::adjust_editors::KINDS.into_iter().enumerate() { + // Keep every shader at every mode and depth, sampling both mask + // paths. The CPU test preview_composite_matches_the_destructive_command + // already compares all combinations; the full GPU sweep keeps them too. + if !full_sweep && selection != (kind_index + depth_index).is_multiple_of(2) { + continue; + } let params = sample(kind); let preview = match preview_document(&doc, target, kind, ¶ms) { Ok(p) => p, @@ -210,28 +216,18 @@ fn preview_layer_composites_on_the_gpu_like_the_command() { // The GPU holds 16- and 32-bit layers as half floats: Threshold and Posterize // may flip a few pixels sitting right at a step (1 % allowed). let skip = if matches!(kind, "threshold" | "posterize") && depth != SampleType::U8 { (b.width() * b.height()) as usize / 100 } else { 0 }; - // The selection is a mask on the same preview layer and does not change - // the adjustment shader. Keep every shader at every mode and depth, with - // both mask paths represented there. The full sweep crosses the mask - // axis with every shader on the GPU. - let check_gpu = full_sweep || selection == (kind_index + depth_index).is_multiple_of(2); + let on_gpu = render_to_vec(&mut comp, &device, &queue, &preview, b).unwrap_or_else(|e| panic!("{what}: {e:?}")); let on_cpu = photocraft_compose::render(&preview, b).into_px(); + let d = max_diff(&on_gpu, &on_cpu, skip); + assert!(d <= tol_gpu, "{what}: GPU vs CPU {:.2}/255", d * 255.0); let mut s = photocraft_engine::Session::new(); s.add_document(doc.clone(), None); s.select_layer(target).unwrap(); s.execute(&format!("image.adjustments.{kind}"), params).unwrap(); let cmd = photocraft_compose::render(&s.active().unwrap().doc, b).into_px(); - if check_gpu { - let on_gpu = render_to_vec(&mut comp, &device, &queue, &preview, b).unwrap_or_else(|e| panic!("{what}: {e:?}")); - let d = max_diff(&on_gpu, &on_cpu, skip); - assert!(d <= tol_gpu, "{what}: GPU vs CPU {:.2}/255", d * 255.0); - let d = max_diff(&on_gpu, &cmd, skip); - worst = worst.max(d); - assert!(d <= tol_cmd, "{what}: GPU preview vs command {:.2}/255", d * 255.0); - } else { - let d = max_diff(&on_cpu, &cmd, skip); - assert!(d <= tol_cmd, "{what}: CPU preview vs command {:.2}/255", d * 255.0); - } + let d = max_diff(&on_gpu, &cmd, skip); + worst = worst.max(d); + assert!(d <= tol_cmd, "{what}: GPU preview vs command {:.2}/255", d * 255.0); } } }