From 6fff6629f9a5565fc12019ee99619785fb24300f Mon Sep 17 00:00:00 2001 From: p0rps <134095787+fjamesprice@users.noreply.github.com> Date: Mon, 23 Nov 2026 00:20:24 -0500 Subject: [PATCH] build: move craft-develop to craft-libs main b2d2a1e9 (craft-libs#3101) (#16485) * build: move craft-develop to craft-libs main b2d2a1e9 (craft-libs#3101) craft-develop and craft-develop-model move from 33be356 to b2d2a1e9, which includes craft-libs#3101 (Detail's resolved parameters) and four sensor commits (white-balanced demosaic with a clip mask; existing signatures unchanged). Cargo.lock changes only craft-libs git sources. per_pixel() no longer refuses Detail: it returns the stages with `detail` set. RAW Develop's GPU pass has no Detail stage yet (#6916), so the dialog now goes through gpu_stages(), which keeps a sharpened or noise-reduced frame on the CPU. A device-free test covers it on hosted CI; the GPU test adds Detail-only cases; the gpu crate's test follows the new per_pixel contract. * style(camera-raw): rustfmt gpu_stages' signature --------- Co-authored-by: fjamesprice --- Cargo.lock | 52 ++++++++++---------- Cargo.toml | 4 +- crates/gpu/tests/it/camera_raw.rs | 4 +- crates/ui-egui/src/dialogs/camera_raw_gpu.rs | 46 +++++++++++++++-- 4 files changed, 74 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ff52f61b56..5ca28b1043 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1504,7 +1504,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=33be35625e252cc4f06aa375b3b428521faea37d#33be35625e252cc4f06aa375b3b428521faea37d" +source = "git+https://github.com/storytold/craft-libs?rev=8d436f486a2e890930ffdf10b602935feb492c97#8d436f486a2e890930ffdf10b602935feb492c97" dependencies = [ "md-5", "rayon", @@ -1513,7 +1513,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=8d436f486a2e890930ffdf10b602935feb492c97#8d436f486a2e890930ffdf10b602935feb492c97" +source = "git+https://github.com/storytold/craft-libs?rev=b2d2a1e948c43d95aa769d4f0a06fe6b869edc39#b2d2a1e948c43d95aa769d4f0a06fe6b869edc39" dependencies = [ "md-5", "rayon", @@ -1527,7 +1527,7 @@ source = "git+https://github.com/storytold/craft-libs?rev=8d436f486a2e890930ffdf [[package]] name = "craft-color" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=33be35625e252cc4f06aa375b3b428521faea37d#33be35625e252cc4f06aa375b3b428521faea37d" +source = "git+https://github.com/storytold/craft-libs?rev=b2d2a1e948c43d95aa769d4f0a06fe6b869edc39#b2d2a1e948c43d95aa769d4f0a06fe6b869edc39" dependencies = [ "serde", ] @@ -1535,9 +1535,9 @@ dependencies = [ [[package]] name = "craft-color-transform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=33be35625e252cc4f06aa375b3b428521faea37d#33be35625e252cc4f06aa375b3b428521faea37d" +source = "git+https://github.com/storytold/craft-libs?rev=b2d2a1e948c43d95aa769d4f0a06fe6b869edc39#b2d2a1e948c43d95aa769d4f0a06fe6b869edc39" dependencies = [ - "craft-cms 0.1.0 (git+https://github.com/storytold/craft-libs?rev=33be35625e252cc4f06aa375b3b428521faea37d)", + "craft-cms 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b2d2a1e948c43d95aa769d4f0a06fe6b869edc39)", "craft-color", "serde", ] @@ -1590,7 +1590,7 @@ dependencies = [ [[package]] name = "craft-crw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=33be35625e252cc4f06aa375b3b428521faea37d#33be35625e252cc4f06aa375b3b428521faea37d" +source = "git+https://github.com/storytold/craft-libs?rev=8d436f486a2e890930ffdf10b602935feb492c97#8d436f486a2e890930ffdf10b602935feb492c97" dependencies = [ "thiserror 2.0.21", ] @@ -1598,7 +1598,7 @@ dependencies = [ [[package]] name = "craft-crw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=8d436f486a2e890930ffdf10b602935feb492c97#8d436f486a2e890930ffdf10b602935feb492c97" +source = "git+https://github.com/storytold/craft-libs?rev=b2d2a1e948c43d95aa769d4f0a06fe6b869edc39#b2d2a1e948c43d95aa769d4f0a06fe6b869edc39" dependencies = [ "thiserror 2.0.21", ] @@ -1614,13 +1614,13 @@ dependencies = [ [[package]] name = "craft-develop" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=33be35625e252cc4f06aa375b3b428521faea37d#33be35625e252cc4f06aa375b3b428521faea37d" +source = "git+https://github.com/storytold/craft-libs?rev=b2d2a1e948c43d95aa769d4f0a06fe6b869edc39#b2d2a1e948c43d95aa769d4f0a06fe6b869edc39" dependencies = [ "craft-color", "craft-color-transform", "craft-develop-model", "craft-geom", - "craft-raw 0.1.0 (git+https://github.com/storytold/craft-libs?rev=33be35625e252cc4f06aa375b3b428521faea37d)", + "craft-raw 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b2d2a1e948c43d95aa769d4f0a06fe6b869edc39)", "rayon", "serde", "serde_json", @@ -1629,10 +1629,10 @@ dependencies = [ [[package]] name = "craft-develop-model" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=33be35625e252cc4f06aa375b3b428521faea37d#33be35625e252cc4f06aa375b3b428521faea37d" +source = "git+https://github.com/storytold/craft-libs?rev=b2d2a1e948c43d95aa769d4f0a06fe6b869edc39#b2d2a1e948c43d95aa769d4f0a06fe6b869edc39" dependencies = [ "craft-geom", - "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=33be35625e252cc4f06aa375b3b428521faea37d)", + "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b2d2a1e948c43d95aa769d4f0a06fe6b869edc39)", "miniz_oxide 0.9.1", "serde", "serde_json", @@ -1787,7 +1787,7 @@ source = "git+https://github.com/storytold/craft-libs?rev=8d436f486a2e890930ffdf [[package]] name = "craft-geom" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=33be35625e252cc4f06aa375b3b428521faea37d#33be35625e252cc4f06aa375b3b428521faea37d" +source = "git+https://github.com/storytold/craft-libs?rev=b2d2a1e948c43d95aa769d4f0a06fe6b869edc39#b2d2a1e948c43d95aa769d4f0a06fe6b869edc39" dependencies = [ "serde", ] @@ -1971,11 +1971,11 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=33be35625e252cc4f06aa375b3b428521faea37d#33be35625e252cc4f06aa375b3b428521faea37d" +source = "git+https://github.com/storytold/craft-libs?rev=8d436f486a2e890930ffdf10b602935feb492c97#8d436f486a2e890930ffdf10b602935feb492c97" dependencies = [ "brotli-decompressor 6.3.2", "chrono", - "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=33be35625e252cc4f06aa375b3b428521faea37d)", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=8d436f486a2e890930ffdf10b602935feb492c97)", "quick-xml 0.41.0", "serde", ] @@ -1983,11 +1983,11 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=8d436f486a2e890930ffdf10b602935feb492c97#8d436f486a2e890930ffdf10b602935feb492c97" +source = "git+https://github.com/storytold/craft-libs?rev=b2d2a1e948c43d95aa769d4f0a06fe6b869edc39#b2d2a1e948c43d95aa769d4f0a06fe6b869edc39" dependencies = [ "brotli-decompressor 6.3.2", "chrono", - "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=8d436f486a2e890930ffdf10b602935feb492c97)", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b2d2a1e948c43d95aa769d4f0a06fe6b869edc39)", "quick-xml 0.41.0", "serde", ] @@ -2151,12 +2151,12 @@ dependencies = [ [[package]] name = "craft-raw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=33be35625e252cc4f06aa375b3b428521faea37d#33be35625e252cc4f06aa375b3b428521faea37d" +source = "git+https://github.com/storytold/craft-libs?rev=8d436f486a2e890930ffdf10b602935feb492c97#8d436f486a2e890930ffdf10b602935feb492c97" dependencies = [ "chrono", - "craft-crw 0.1.0 (git+https://github.com/storytold/craft-libs?rev=33be35625e252cc4f06aa375b3b428521faea37d)", - "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=33be35625e252cc4f06aa375b3b428521faea37d)", - "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=33be35625e252cc4f06aa375b3b428521faea37d)", + "craft-crw 0.1.0 (git+https://github.com/storytold/craft-libs?rev=8d436f486a2e890930ffdf10b602935feb492c97)", + "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=8d436f486a2e890930ffdf10b602935feb492c97)", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=8d436f486a2e890930ffdf10b602935feb492c97)", "jxl-oxide", "miniz_oxide 0.9.1", "rayon", @@ -2169,12 +2169,12 @@ dependencies = [ [[package]] name = "craft-raw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=8d436f486a2e890930ffdf10b602935feb492c97#8d436f486a2e890930ffdf10b602935feb492c97" +source = "git+https://github.com/storytold/craft-libs?rev=b2d2a1e948c43d95aa769d4f0a06fe6b869edc39#b2d2a1e948c43d95aa769d4f0a06fe6b869edc39" dependencies = [ "chrono", - "craft-crw 0.1.0 (git+https://github.com/storytold/craft-libs?rev=8d436f486a2e890930ffdf10b602935feb492c97)", - "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=8d436f486a2e890930ffdf10b602935feb492c97)", - "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=8d436f486a2e890930ffdf10b602935feb492c97)", + "craft-crw 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b2d2a1e948c43d95aa769d4f0a06fe6b869edc39)", + "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b2d2a1e948c43d95aa769d4f0a06fe6b869edc39)", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b2d2a1e948c43d95aa769d4f0a06fe6b869edc39)", "jxl-oxide", "miniz_oxide 0.9.1", "rayon", @@ -2319,7 +2319,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=33be35625e252cc4f06aa375b3b428521faea37d#33be35625e252cc4f06aa375b3b428521faea37d" +source = "git+https://github.com/storytold/craft-libs?rev=8d436f486a2e890930ffdf10b602935feb492c97#8d436f486a2e890930ffdf10b602935feb492c97" dependencies = [ "serde", "thiserror 2.0.21", @@ -2328,7 +2328,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=8d436f486a2e890930ffdf10b602935feb492c97#8d436f486a2e890930ffdf10b602935feb492c97" +source = "git+https://github.com/storytold/craft-libs?rev=b2d2a1e948c43d95aa769d4f0a06fe6b869edc39#b2d2a1e948c43d95aa769d4f0a06fe6b869edc39" dependencies = [ "serde", "thiserror 2.0.21", diff --git a/Cargo.toml b/Cargo.toml index cb57b52896..7ee2e303e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,8 +68,8 @@ craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "8d436f486 # Camera-field EXIF reader/writer, shared prerequisite craft-libs#1563. craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "8d436f486a2e890930ffdf10b602935feb492c97" } craft-crs = { git = "https://github.com/storytold/craft-libs", rev = "8d436f486a2e890930ffdf10b602935feb492c97" } -craft-develop = { git = "https://github.com/storytold/craft-libs", rev = "33be35625e252cc4f06aa375b3b428521faea37d" } -craft-develop-model = { git = "https://github.com/storytold/craft-libs", rev = "33be35625e252cc4f06aa375b3b428521faea37d" } +craft-develop = { git = "https://github.com/storytold/craft-libs", rev = "b2d2a1e948c43d95aa769d4f0a06fe6b869edc39" } +craft-develop-model = { git = "https://github.com/storytold/craft-libs", rev = "b2d2a1e948c43d95aa769d4f0a06fe6b869edc39" } # Interface translations: lookup, fallback, CLDR plurals and language names over the craft-i18n # catalogs that `crates/ui-egui/build.rs` embeds from `CRAFT_I18N_DIR` (storytold/craft-i18n, at # the commit in `craft-i18n.rev`). Already in the tree through craft. diff --git a/crates/gpu/tests/it/camera_raw.rs b/crates/gpu/tests/it/camera_raw.rs index 7d5904fd29..ab06123581 100644 --- a/crates/gpu/tests/it/camera_raw.rs +++ b/crates/gpu/tests/it/camera_raw.rs @@ -373,8 +373,10 @@ fn identity_leaves_pixels_alone_and_detail_has_no_pass() { let stages = per_pixel(&p, 64, 32, false, None).unwrap(); let out = g.dev.develop(&g.device, &g.queue, None, &src, Some(1), [64, 32], &stages).unwrap(); assert_eq!(out, src, "the CPU develop returns early, unclipped"); + // The stages hand Detail over (craft-libs#3101), but the pass has no Detail stage yet, so the + // dialog keeps these on the CPU (`camera_raw_gpu::gpu_stages` in photocraft-ui-egui). for set in [cr! { sharpen_amount: 10.0}, cr! { noise_luminance: 10.0, clarity: 20.0}, cr! { noise_color: 10.0, dehaze: 20.0}] { - assert!(spatial(&set) && per_pixel(&set, 64, 32, false, Some((0.0, 1.0))).is_none(), "{set:?}"); + assert!(spatial(&set) && per_pixel(&set, 64, 32, false, Some((0.0, 1.0))).is_some_and(|s| s.detail.is_some()), "{set:?}"); } // Whites and Blacks need the image's points, unless a spatial stage's passes measure them. assert!(per_pixel(&cr! { whites: 10.0}, 64, 32, false, None).is_none()); diff --git a/crates/ui-egui/src/dialogs/camera_raw_gpu.rs b/crates/ui-egui/src/dialogs/camera_raw_gpu.rs index f39ca5cd6a..8013d4eb11 100644 --- a/crates/ui-egui/src/dialogs/camera_raw_gpu.rs +++ b/crates/ui-egui/src/dialogs/camera_raw_gpu.rs @@ -149,7 +149,7 @@ impl CameraRawGpu { let Some(Some(pass)) = self.pass.get() else { return None }; let points = self.points(px, key, w, h, p, inputs); // PLAN: assumed `per_pixel(p, inputs, w, h, float, points)` (dialogs-w50 owns the algo signature) - let stages = photocraft_algo::camera_raw::per_pixel(p, inputs, w, h, float, points)?; + let stages = gpu_stages(p, inputs, w, h, float, points)?; let size = [u32::try_from(w).ok()?, u32::try_from(h).ok()?]; let mut pass = pass.0.lock().unwrap_or_else(std::sync::PoisonError::into_inner); match pass.develop(&self.device, &self.queue, Some(&self.health), px, key, size, &stages) { @@ -185,6 +185,22 @@ impl CameraRawGpu { } } +/// The stages the GPU pass runs for `p`, or `None` when the CPU must develop. Besides what +/// [`per_pixel`](photocraft_algo::camera_raw::per_pixel) refuses, that is Detail: `per_pixel` +/// hands it over as a stage since craft-libs#3101, but the pass has none yet (#6916), so a +/// sharpened or noise-reduced frame would come back without it. +#[cfg(not(target_arch = "wasm32"))] +fn gpu_stages( + p: &CameraRaw, + inputs: &DevelopInputs, + w: usize, + h: usize, + float: bool, + points: Option<(f32, f32)>, +) -> Option { + photocraft_algo::camera_raw::per_pixel(p, inputs, w, h, float, points).filter(|stages| stages.detail.is_none()) +} + #[cfg(test)] mod gpu_tests { use super::*; @@ -334,8 +350,14 @@ mod gpu_tests { let worst = worst_difference(&gpu, &cpu); assert!(worst <= TOL, "{depth}-bit, {spatial:?}: off by {worst}"); } - // Detail develops the whole frame on the CPU. - for detail in [cr!(toned.clone() => sharpen_amount: 40.0), cr!(per_pixel.clone() => noise_luminance: 30.0, dehaze: 20.0)] { + // Detail develops the whole frame on the CPU, alone or after another stage. + for detail in [ + cr!(toned.clone() => sharpen_amount: 40.0), + cr!(per_pixel.clone() => noise_luminance: 30.0, dehaze: 20.0), + cr!(exposure: 0.4, sharpen_amount: 40.0), + cr!(exposure: 0.4, noise_luminance: 30.0), + cr!(exposure: 0.4, noise_color: 25.0), + ] { let (backend, shown, cpu) = developed(&app, detail); assert_eq!((backend, shown == cpu), ("cpu", true), "{depth}-bit"); } @@ -346,6 +368,24 @@ mod gpu_tests { } } + #[test] + fn detail_keeps_the_cpu_develop_without_a_device() { + // Runs without a GPU, so hosted CI checks it too: `per_pixel` now hands Detail over as a + // stage (craft-libs#3101), and the pass must not run a frame without it. + let inputs = DevelopInputs::default(); + assert!(gpu_stages(&cr!(exposure: 0.4), &inputs, 64, 48, false, None).is_some(), "per-pixel settings reach the GPU"); + for detail in [ + cr!(exposure: 0.4, sharpen_amount: 40.0), + cr!(exposure: 0.4, noise_luminance: 30.0), + cr!(exposure: 0.4, noise_color: 25.0), + cr!(shadows: 40.0, sharpen_amount: 40.0), + ] { + let stages = photocraft_algo::camera_raw::per_pixel(&detail, &inputs, 64, 48, false, None); + assert!(stages.is_some_and(|s| s.detail.is_some()), "per_pixel hands Detail over: {detail:?}"); + assert!(gpu_stages(&detail, &inputs, 64, 48, false, None).is_none(), "the CPU develops Detail: {detail:?}"); + } + } + #[test] fn neutral_settings_skip_the_gpu_round_trip() { let _gpu = photocraft_testkit::gpu_lock();