From 0627dd0e4b0c88e15bd2ce40e056033ecd8684b4 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 15:07:00 +0000 Subject: [PATCH 01/16] Use shared ZIP codec for dotLottie imports --- Cargo.lock | 90 +++++++++++++++++--------- Cargo.toml | 42 ++++++------- crates/lottie/src/import.rs | 8 +-- crates/lottie/src/tests.rs | 18 ++++++ crates/lottie/src/zip.rs | 122 +----------------------------------- 5 files changed, 107 insertions(+), 173 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e6450c078..8e4ae1211 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1092,26 +1092,26 @@ dependencies = [ [[package]] name = "craft-aep" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" [[package]] name = "craft-audio" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef)", "thiserror 2.0.21", ] [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" [[package]] name = "craft-dpx" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "thiserror 2.0.21", ] @@ -1119,7 +1119,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "serde", "serde_json", @@ -1129,12 +1129,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" [[package]] name = "craft-exr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "serde_json", ] @@ -1142,17 +1142,17 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "fixed_decimal", "icu_decimal", @@ -1175,8 +1175,9 @@ dependencies = [ [[package]] name = "craft-lottie" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ + "craft-zip", "serde_json", "thiserror 2.0.21", ] @@ -1184,7 +1185,7 @@ dependencies = [ [[package]] name = "craft-media" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "thiserror 2.0.21", ] @@ -1200,7 +1201,7 @@ dependencies = [ [[package]] name = "craft-mesh" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "miniz_oxide 0.9.1", "serde_json", @@ -1209,7 +1210,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "hayro-syntax", "thiserror 2.0.21", @@ -1218,7 +1219,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "encoding_rs", "flate2", @@ -1229,7 +1230,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "dispatch2", "egui", @@ -1240,19 +1241,21 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "craft-xml", "flate2", "kurbo", "roxmltree", "thiserror 2.0.21", + "vectorcraft-geom", + "vectorcraft-pathops", ] [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "craft-fonts-build", "craft-i18n", @@ -1273,7 +1276,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "chrono", "dunce", @@ -1300,9 +1303,9 @@ dependencies = [ [[package]] name = "craft-video" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef)", "rayon", "thiserror 2.0.21", ] @@ -1310,7 +1313,7 @@ dependencies = [ [[package]] name = "craft-webp" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "thiserror 2.0.21", ] @@ -1318,12 +1321,22 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "quick-xml 0.41.0", "thiserror 2.0.21", ] +[[package]] +name = "craft-zip" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +dependencies = [ + "flate2", + "thiserror 2.0.21", + "zip 9.1.3", +] + [[package]] name = "crc32fast" version = "1.5.2" @@ -1683,7 +1696,7 @@ name = "effectcraft-export" version = "0.24.1" dependencies = [ "craft-audio", - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef)", "craft-video", "effectcraft-color", "effectcraft-effects", @@ -1852,7 +1865,7 @@ dependencies = [ "craft-dpx", "craft-exr", "craft-gif", - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef)", "craft-webp", "effectcraft-color", "effectcraft-effects", @@ -3422,7 +3435,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "hayro-ccitt", ] @@ -3436,7 +3449,7 @@ checksum = "c75ab947623ef4ccaa7acf0579edf7cbb5a73838e3839a7be73335e522f433a1" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" dependencies = [ "hayro-jbig2", "hayro-jpeg2000", @@ -6683,6 +6696,27 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "vectorcraft-geom" +version = "0.18.0" +source = "git+https://github.com/storytold/vectorcraft.git?rev=6b3a6b8788ebcb420d69449199cbdf323888d27e#6b3a6b8788ebcb420d69449199cbdf323888d27e" +dependencies = [ + "kurbo", + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "vectorcraft-pathops" +version = "0.18.0" +source = "git+https://github.com/storytold/vectorcraft.git?rev=6b3a6b8788ebcb420d69449199cbdf323888d27e#6b3a6b8788ebcb420d69449199cbdf323888d27e" +dependencies = [ + "kurbo", + "linesweeper", + "thiserror 2.0.21", + "vectorcraft-geom", +] + [[package]] name = "vello_common" version = "0.2.0" diff --git a/Cargo.toml b/Cargo.toml index 1b80048f2..4deece869 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,22 +11,22 @@ rust-version = "1.95" repository = "https://github.com/storytold/effectcraft" [workspace.dependencies] -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", version = "=0.1.0", default-features = false, features = ["read"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-quit = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-ecproj-format = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-dpx = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-eps = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-exr = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-gif = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-psd = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-svg = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-webp = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-lottie = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } -craft-mesh = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", default-features = false, features = ["stl", "obj", "gltf", "fbx"] } -craft-aep = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", version = "=0.1.0", default-features = false, features = ["read"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-quit = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-ecproj-format = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-dpx = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-eps = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-exr = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-gif = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-psd = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-svg = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-webp = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-lottie = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-mesh = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", default-features = false, features = ["stl", "obj", "gltf", "fbx"] } +craft-aep = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } # craft-update: app-specific pretend versions apply to startup and manual checks. -craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "47107f660191de2f0b425569506f4daa4faadac9", features = ["egui"] } +craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", features = ["egui"] } # internal effectcraft-time = { path = "crates/time" } effectcraft-geom = { path = "crates/geom" } @@ -90,9 +90,9 @@ same-file = "1.0" tempfile = "3.27" # codecs + containers shared by the Craft apps (crates/media, crates/export); keep all three on one rev. -craft-media = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", default-features = false, features = ["isobmff", "matroska"] } -craft-audio = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", default-features = false, features = ["aac-decode", "aac-encode", "opus-decode"] } -craft-video = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", features = ["h264-encode", "prores", "hevc-encode", "vp9-encode", "av1", "threads"] } +craft-media = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", default-features = false, features = ["isobmff", "matroska"] } +craft-audio = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", default-features = false, features = ["aac-decode", "aac-encode", "opus-decode"] } +craft-video = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", features = ["h264-encode", "prores", "hevc-encode", "vp9-encode", "av1", "threads"] } # footage decoding: FilmCraft's pure-Rust crates, pinned to a revision (plan/adr/0001). # Only `crates/media`, `crates/export` and `crates/interchange` may depend on these. @@ -122,7 +122,7 @@ half = "2.7" # ui # Shared frontend components; keep this dependency above the engine boundary. # Shared UI and the complete egui family select reviewed immutable commits below. -craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", features = ["serde"] } +craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", features = ["serde"] } # `default_fonts` and `monochrome_emoji_fonts` are explicit: the app's `FontDefinitions::default()` # and its `✔`/`▣` chrome glyphs need both, and kittest's own dev-dependencies do not propagate. egui = { version = "0.37", default-features = false, features = ["default_fonts", "monochrome_emoji_fonts"] } @@ -231,8 +231,8 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", version = "=0.7.2" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", version = "=0.3.0" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", version = "=0.7.2" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", version = "=0.3.0" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } emath = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } epaint = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } diff --git a/crates/lottie/src/import.rs b/crates/lottie/src/import.rs index 6534727dc..22dd8ad21 100644 --- a/crates/lottie/src/import.rs +++ b/crates/lottie/src/import.rs @@ -41,7 +41,7 @@ pub struct ImportResult { pub warnings: Vec, } -/// The Lottie document inside raw bytes (plain JSON, or a stored dotLottie archive), read into +/// The Lottie document inside raw bytes (plain JSON, or a dotLottie archive), read into /// `craft-lottie`'s model within its default limits. fn document(bytes: &[u8]) -> Result { let read = |b: &[u8]| { @@ -51,12 +51,12 @@ fn document(bytes: &[u8]) -> Result { }) }; if bytes.starts_with(b"PK") { - let entries = crate::zip::read_stored(bytes); + let entries = crate::zip::read_entries(bytes).map_err(|e| LottieError::Parse(format!("dotLottie ZIP: {e}")))?; let anim = entries .iter() .find(|(n, _)| n.starts_with("animations/") && n.ends_with(".json")) .or_else(|| entries.iter().find(|(n, _)| n.ends_with(".json") && n != "manifest.json")) - .ok_or_else(|| LottieError::Parse("dotLottie archive without an uncompressed animation".into()))?; + .ok_or_else(|| LottieError::Parse("dotLottie archive without a JSON animation".into()))?; return read(&anim.1); } read(bytes) @@ -102,7 +102,7 @@ fn external_image(stored: &str, base_dir: &str) -> Result { } } -/// Import a Lottie document (JSON or a stored `.lottie` archive) into `project` as a new +/// Import a Lottie document (JSON or a `.lottie` archive) into `project` as a new /// composition. `store` saves embedded images and returns the file path to use; /// `base_dir` resolves external image references. pub fn import( diff --git a/crates/lottie/src/tests.rs b/crates/lottie/src/tests.rs index 35c52026d..cf8543fdf 100644 --- a/crates/lottie/src/tests.rs +++ b/crates/lottie/src/tests.rs @@ -799,6 +799,24 @@ fn dotlottie_archive_roundtrip() { assert_eq!(q.comp(imp.comp).unwrap().layers.len(), 1); } +#[test] +fn deflated_dotlottie_archive_imports() { + let (mut p, cid) = setup(); + let l = solid_layer(&mut p, cid, [0.0, 1.0, 0.0], 40, 40); + push(&mut p, cid, l); + let res = export_comp(&p, cid, &ExportOptions::default(), &no_read).unwrap(); + let manifest = serde_json::to_vec(&serde_json::json!({"version":"1","animations":[{"id":"main"}]})).unwrap(); + let animation = serde_json::to_vec(&res.json).unwrap(); + let zip = craft_lottie::zip::try_store_with_compression( + &[("manifest.json".into(), manifest), ("animations/main.json".into(), animation)], + craft_lottie::zip::Compression::Deflated, + ) + .unwrap(); + let mut q = Project::default(); + let imp = import(&mut q, &zip, "compressed", "", &mut |_| None).unwrap(); + assert_eq!(q.comp(imp.comp).unwrap().layers.len(), 1); +} + // ---------------------------------------------------------------- hand-written fixtures fn fixture(name: &str) -> (Project, ItemId, Vec) { diff --git a/crates/lottie/src/zip.rs b/crates/lottie/src/zip.rs index 2a11dfa25..b47e7cab2 100644 --- a/crates/lottie/src/zip.rs +++ b/crates/lottie/src/zip.rs @@ -1,121 +1,3 @@ -//! A minimal ZIP writer (stored entries, PKWARE APPNOTE 6.3 local headers + central directory) -//! for `.lottie` (dotLottie) archives. +//! Shared stored-entry ZIP functions used by dotLottie imports and exports. -fn crc32(data: &[u8]) -> u32 { - let mut crc = 0xFFFF_FFFFu32; - for &b in data { - crc ^= b as u32; - for _ in 0..8 { - crc = if crc & 1 != 0 { (crc >> 1) ^ 0xEDB8_8320 } else { crc >> 1 }; - } - } - !crc -} - -/// Build a ZIP archive with the given (name, bytes) entries, uncompressed. -pub fn store(entries: &[(String, Vec)]) -> Vec { - let mut out = Vec::new(); - let mut central = Vec::new(); - let put16 = |v: &mut Vec, x: u16| v.extend_from_slice(&x.to_le_bytes()); - let put32 = |v: &mut Vec, x: u32| v.extend_from_slice(&x.to_le_bytes()); - for (name, data) in entries { - let offset = out.len() as u32; - let crc = crc32(data); - let n = name.as_bytes(); - // Local file header. - put32(&mut out, 0x0403_4b50); - put16(&mut out, 20); // version needed - put16(&mut out, 0x0800); // flags: UTF-8 names - put16(&mut out, 0); // stored - put16(&mut out, 0); // time - put16(&mut out, 0x21); // date (1980-01-01) - put32(&mut out, crc); - put32(&mut out, data.len() as u32); - put32(&mut out, data.len() as u32); - put16(&mut out, n.len() as u16); - put16(&mut out, 0); - out.extend_from_slice(n); - out.extend_from_slice(data); - // Central directory record. - put32(&mut central, 0x0201_4b50); - put16(&mut central, 20); // made by - put16(&mut central, 20); - put16(&mut central, 0x0800); - put16(&mut central, 0); - put16(&mut central, 0); - put16(&mut central, 0x21); - put32(&mut central, crc); - put32(&mut central, data.len() as u32); - put32(&mut central, data.len() as u32); - put16(&mut central, n.len() as u16); - put16(&mut central, 0); // extra - put16(&mut central, 0); // comment - put16(&mut central, 0); // disk - put16(&mut central, 0); // internal attrs - put32(&mut central, 0); // external attrs - put32(&mut central, offset); - central.extend_from_slice(n); - } - let cd_offset = out.len() as u32; - let cd_len = central.len() as u32; - out.extend_from_slice(¢ral); - put32(&mut out, 0x0605_4b50); - put16(&mut out, 0); - put16(&mut out, 0); - put16(&mut out, entries.len() as u16); - put16(&mut out, entries.len() as u16); - put32(&mut out, cd_len); - put32(&mut out, cd_offset); - put16(&mut out, 0); - out -} - -/// Whether an entry name is a relative path inside the archive: not absolute (`/…`, `\…`), no -/// drive (`C:…`) and no `..` component. -fn is_relative_name(name: &str) -> bool { - let drive = name.as_bytes().get(1) == Some(&b':'); - !name.starts_with(['/', '\\']) && !drive && !name.split(['/', '\\']).any(|c| c == "..") -} - -/// Read the stored (uncompressed) entries of a ZIP archive written by [`store`] or any other -/// writer that did not compress. Compressed entries and entries whose names are not relative -/// paths inside the archive are skipped. -pub fn read_stored(data: &[u8]) -> Vec<(String, Vec)> { - let mut out = vec![]; - let mut i = 0usize; - let u16_at = |p: usize| data.get(p..p + 2).map(|b| u16::from_le_bytes([b[0], b[1]]) as usize); - let u32_at = |p: usize| data.get(p..p + 4).map(|b| u32::from_le_bytes([b[0], b[1], b[2], b[3]]) as usize); - while u32_at(i) == Some(0x0403_4b50) { - let (Some(method), Some(size), Some(nlen), Some(xlen)) = (u16_at(i + 8), u32_at(i + 18), u16_at(i + 26), u16_at(i + 28)) else { break }; - let name_start = i + 30; - let body = name_start + nlen + xlen; - let (Some(name), Some(bytes)) = (data.get(name_start..name_start + nlen), data.get(body..body + size)) else { break }; - let name = String::from_utf8_lossy(name).to_string(); - if method == 0 && is_relative_name(&name) { - out.push((name, bytes.to_vec())); - } - i = body + size; - } - out -} - -#[cfg(test)] -mod tests { - #[test] - fn crc_and_roundtrip() { - assert_eq!(super::crc32(b"123456789"), 0xCBF4_3926); - let z = super::store(&[("a.json".into(), b"{}".to_vec()), ("b/c.txt".into(), b"hello".to_vec())]); - let back = super::read_stored(&z); - assert_eq!(back.len(), 2); - assert_eq!(back[1].0, "b/c.txt"); - assert_eq!(back[1].1, b"hello"); - } - - #[test] - fn entries_outside_the_archive_root_are_skipped() { - let names = ["../up.txt", "a/../../up.txt", "/abs/x", "\\abs\\x", "C:\\x", "c:x", "a\\..\\x", "ok/x.txt", "ok/..x"]; - let z = super::store(&names.iter().map(|n| (n.to_string(), b"x".to_vec())).collect::>()); - let back: Vec = super::read_stored(&z).into_iter().map(|(n, _)| n).collect(); - assert_eq!(back, ["ok/x.txt", "ok/..x"]); - } -} +pub use craft_lottie::zip::{Limits, read_entries, read_entries_with_limits, read_stored, store, try_store, try_store_with_compression}; From e48c1c7c98df52a62a382e146eeb0369b34d70d3 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 15:51:49 +0000 Subject: [PATCH 02/16] chore: pin shared libraries to merged dotlottie --- Cargo.lock | 58 +++++++++++++++++++++++++++--------------------------- Cargo.toml | 42 +++++++++++++++++++-------------------- 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8e4ae1211..a44dcc111 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1092,26 +1092,26 @@ dependencies = [ [[package]] name = "craft-aep" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" [[package]] name = "craft-audio" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90)", "thiserror 2.0.21", ] [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" [[package]] name = "craft-dpx" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "thiserror 2.0.21", ] @@ -1119,7 +1119,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "serde", "serde_json", @@ -1129,12 +1129,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" [[package]] name = "craft-exr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "serde_json", ] @@ -1142,17 +1142,17 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "fixed_decimal", "icu_decimal", @@ -1175,7 +1175,7 @@ dependencies = [ [[package]] name = "craft-lottie" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "craft-zip", "serde_json", @@ -1185,7 +1185,7 @@ dependencies = [ [[package]] name = "craft-media" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "thiserror 2.0.21", ] @@ -1201,7 +1201,7 @@ dependencies = [ [[package]] name = "craft-mesh" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "miniz_oxide 0.9.1", "serde_json", @@ -1210,7 +1210,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "hayro-syntax", "thiserror 2.0.21", @@ -1219,7 +1219,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "encoding_rs", "flate2", @@ -1230,7 +1230,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "dispatch2", "egui", @@ -1241,7 +1241,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "craft-xml", "flate2", @@ -1255,7 +1255,7 @@ dependencies = [ [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "craft-fonts-build", "craft-i18n", @@ -1276,7 +1276,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "chrono", "dunce", @@ -1303,9 +1303,9 @@ dependencies = [ [[package]] name = "craft-video" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90)", "rayon", "thiserror 2.0.21", ] @@ -1313,7 +1313,7 @@ dependencies = [ [[package]] name = "craft-webp" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "thiserror 2.0.21", ] @@ -1321,7 +1321,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "quick-xml 0.41.0", "thiserror 2.0.21", @@ -1330,7 +1330,7 @@ dependencies = [ [[package]] name = "craft-zip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "flate2", "thiserror 2.0.21", @@ -1696,7 +1696,7 @@ name = "effectcraft-export" version = "0.24.1" dependencies = [ "craft-audio", - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90)", "craft-video", "effectcraft-color", "effectcraft-effects", @@ -1865,7 +1865,7 @@ dependencies = [ "craft-dpx", "craft-exr", "craft-gif", - "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef)", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90)", "craft-webp", "effectcraft-color", "effectcraft-effects", @@ -3435,7 +3435,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "hayro-ccitt", ] @@ -3449,7 +3449,7 @@ checksum = "c75ab947623ef4ccaa7acf0579edf7cbb5a73838e3839a7be73335e522f433a1" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=b7b9f8eb7c016cef2680cb65230eb7273723a7ef#b7b9f8eb7c016cef2680cb65230eb7273723a7ef" +source = "git+https://github.com/storytold/craft-libs?rev=3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90#3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" dependencies = [ "hayro-jbig2", "hayro-jpeg2000", diff --git a/Cargo.toml b/Cargo.toml index 4deece869..71da0b27f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,22 +11,22 @@ rust-version = "1.95" repository = "https://github.com/storytold/effectcraft" [workspace.dependencies] -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", version = "=0.1.0", default-features = false, features = ["read"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-quit = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-ecproj-format = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-dpx = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-eps = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-exr = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-gif = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-psd = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-svg = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-webp = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-lottie = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } -craft-mesh = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", default-features = false, features = ["stl", "obj", "gltf", "fbx"] } -craft-aep = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90", version = "=0.1.0", default-features = false, features = ["read"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-quit = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-ecproj-format = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-dpx = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-eps = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-exr = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-gif = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-psd = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-svg = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-webp = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-lottie = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } +craft-mesh = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90", default-features = false, features = ["stl", "obj", "gltf", "fbx"] } +craft-aep = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90" } # craft-update: app-specific pretend versions apply to startup and manual checks. -craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", features = ["egui"] } +craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90", features = ["egui"] } # internal effectcraft-time = { path = "crates/time" } effectcraft-geom = { path = "crates/geom" } @@ -90,9 +90,9 @@ same-file = "1.0" tempfile = "3.27" # codecs + containers shared by the Craft apps (crates/media, crates/export); keep all three on one rev. -craft-media = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", default-features = false, features = ["isobmff", "matroska"] } -craft-audio = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", default-features = false, features = ["aac-decode", "aac-encode", "opus-decode"] } -craft-video = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", features = ["h264-encode", "prores", "hevc-encode", "vp9-encode", "av1", "threads"] } +craft-media = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90", default-features = false, features = ["isobmff", "matroska"] } +craft-audio = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90", default-features = false, features = ["aac-decode", "aac-encode", "opus-decode"] } +craft-video = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90", features = ["h264-encode", "prores", "hevc-encode", "vp9-encode", "av1", "threads"] } # footage decoding: FilmCraft's pure-Rust crates, pinned to a revision (plan/adr/0001). # Only `crates/media`, `crates/export` and `crates/interchange` may depend on these. @@ -122,7 +122,7 @@ half = "2.7" # ui # Shared frontend components; keep this dependency above the engine boundary. # Shared UI and the complete egui family select reviewed immutable commits below. -craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", features = ["serde"] } +craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90", features = ["serde"] } # `default_fonts` and `monochrome_emoji_fonts` are explicit: the app's `FontDefinitions::default()` # and its `✔`/`▣` chrome glyphs need both, and kittest's own dev-dependencies do not propagate. egui = { version = "0.37", default-features = false, features = ["default_fonts", "monochrome_emoji_fonts"] } @@ -231,8 +231,8 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", version = "=0.7.2" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "b7b9f8eb7c016cef2680cb65230eb7273723a7ef", version = "=0.3.0" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90", version = "=0.7.2" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90", version = "=0.3.0" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } emath = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } epaint = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } From 9c94c11856fbcd5c2ff87995119563c148ce5519 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 16:25:01 +0000 Subject: [PATCH 03/16] fix ci: track merged craft pdf revision --- xtask/src/pdf_deps.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xtask/src/pdf_deps.rs b/xtask/src/pdf_deps.rs index a4ed9d6dd..ca376bf5d 100644 --- a/xtask/src/pdf_deps.rs +++ b/xtask/src/pdf_deps.rs @@ -5,7 +5,7 @@ use std::process::Command; use serde_json::Value; -const REV: &str = "47107f660191de2f0b425569506f4daa4faadac9"; +const REV: &str = "3c59a2aa520bc3b7eb17a5e1d4632dea98d7ae90"; const PACKAGES: &[(&str, &str)] = &[("craft-pdf", "0.1.0"), ("hayro-syntax", "0.7.2"), ("hayro-jbig2", "0.3.0")]; pub fn run(root: &Path) -> Result<(), String> { From b68249c47b37b048b9de90aeb21a8acea50579da Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 17:18:13 +0000 Subject: [PATCH 04/16] test(lottie): cover archive without animation --- crates/lottie/src/tests.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/lottie/src/tests.rs b/crates/lottie/src/tests.rs index cf8543fdf..19f8a4c32 100644 --- a/crates/lottie/src/tests.rs +++ b/crates/lottie/src/tests.rs @@ -12,7 +12,7 @@ use effectcraft_render::render_frame; use effectcraft_time::{FrameRate, Tick}; use serde_json::{Value as Json, json}; -use crate::{ExportOptions, export_comp, import}; +use crate::{ExportOptions, LottieError, export_comp, import}; fn s(x: f64) -> Tick { Tick::from_seconds_f64(x) @@ -799,6 +799,14 @@ fn dotlottie_archive_roundtrip() { assert_eq!(q.comp(imp.comp).unwrap().layers.len(), 1); } +#[test] +fn dotlottie_archive_without_animation_is_rejected() { + let zip = craft_lottie::zip::try_store(&[("manifest.json".into(), b"{}".to_vec())]).unwrap(); + let mut project = Project::default(); + let err = import(&mut project, &zip, "empty archive", "", &mut |_| None).unwrap_err(); + assert!(matches!(err, LottieError::Parse(message) if message.contains("without a JSON animation"))); +} + #[test] fn deflated_dotlottie_archive_imports() { let (mut p, cid) = setup(); From e8b188fdb002860737923ab8e915993ec4fced90 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 17:45:15 +0000 Subject: [PATCH 05/16] fix(gpu): sort selective color channels on llvmpipe --- crates/gpu/src/shaders/fx_color.wgsl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/crates/gpu/src/shaders/fx_color.wgsl b/crates/gpu/src/shaders/fx_color.wgsl index f616a2d9d..8d95ee166 100644 --- a/crates/gpu/src/shaders/fx_color.wgsl +++ b/crates/gpu/src/shaders/fx_color.wgsl @@ -75,8 +75,9 @@ fn fxc_colorama_phase(c: vec3, a: f32, mode: u32) -> f32 { // Selective Color range weights (color2::sc_weights). fn fxc_sc_weights(c0: vec3) -> array { let c = clamp(c0, vec3(0.0), vec3(1.0)); - // Stable descending sort of the channel indices. - var idx = vec3(0u, 1u, 2u); + // Stable descending sort of the channel indices. Use an array because llvmpipe does not + // preserve dynamically indexed writes to vector components here. + var idx = array(0u, 1u, 2u); for (var i = 1u; i < 3u; i++) { var j = i; while (j > 0u && c[idx[j]] > c[idx[j - 1u]]) { @@ -86,14 +87,14 @@ fn fxc_sc_weights(c0: vec3) -> array { j--; } } - let mx = c[idx.x]; - let md = c[idx.y]; - let mn = c[idx.z]; + let mx = c[idx[0]]; + let md = c[idx[1]]; + let mn = c[idx[2]]; var w = array(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); var prim = array(0u, 2u, 4u); var sec = array(3u, 5u, 1u); - w[prim[idx.x]] = mx - md; - w[sec[idx.z]] = md - mn; + w[prim[idx[0]]] = mx - md; + w[sec[idx[2]]] = md - mn; w[6] = max((mn - 0.5) * 2.0, 0.0); w[8] = max((0.5 - mx) * 2.0, 0.0); w[7] = clamp(1.0 - (abs(mx - 0.5) + abs(mn - 0.5)), 0.0, 1.0); From f9ffd91a3b947f52a2d71b6254942d11aa06e924 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 20:01:08 +0000 Subject: [PATCH 06/16] Run EffectCraft coverage tests in one shard --- .github/workflows/sonarcloud.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 8f1aa5ad5..7d193b610 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -20,5 +20,8 @@ jobs: uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@main with: timeout-minutes: 120 + # GPU tests share a process-local lock; separate coverage shards create independent + # software Vulkan devices, bypassing that lock and potentially contending on llvmpipe. + shards: 1 fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83 secrets: inherit From dd3c6e968da0920d36f2e5bb5aa35b30076c754c Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 14 Nov 2026 20:00:53 +0000 Subject: [PATCH 07/16] test(ui): serialize GPU picker integration --- crates/ui-egui/tests/it/ui_crypto_pick.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/ui-egui/tests/it/ui_crypto_pick.rs b/crates/ui-egui/tests/it/ui_crypto_pick.rs index 03e49ca18..d863e73f7 100644 --- a/crates/ui-egui/tests/it/ui_crypto_pick.rs +++ b/crates/ui-egui/tests/it/ui_crypto_pick.rs @@ -632,6 +632,7 @@ fn clicks_wait_for_the_probe_and_edits_popups_dialogs_and_comp_switches_end_or_b /// each Resolution. Skips without a GPU adapter. #[test] fn picks_on_the_gpu_viewer() { + let _gpu = crate::gpu_test::lock(); let Some(probe) = effectcraft_gpu::Gpu::headless() else { eprintln!("no GPU adapter: skipping"); return; From 4e8cd4638b22221cfda8626e09804b9de16ffbb7 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 00:34:59 +0000 Subject: [PATCH 08/16] ci: serialize one-shard Sonar coverage tests --- .github/workflows/sonarcloud.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 7d193b610..1bc7c9f8b 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -17,11 +17,12 @@ concurrency: jobs: sonarcloud: # Track shared CI improvements on main. - uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@main + uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@72d2fbfb3dd1bf27e1bdc7107be72c70749c6876 with: timeout-minutes: 120 # GPU tests share a process-local lock; separate coverage shards create independent # software Vulkan devices, bypassing that lock and potentially contending on llvmpipe. shards: 1 + rust-test-threads: "1" fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83 secrets: inherit From df79630f6f2e00d099c07def39b0230cb759e328 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 01:36:12 +0000 Subject: [PATCH 09/16] ci: use merged test thread limit for Sonar coverage --- .github/workflows/sonarcloud.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 1bc7c9f8b..6adc57765 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -17,7 +17,7 @@ concurrency: jobs: sonarcloud: # Track shared CI improvements on main. - uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@72d2fbfb3dd1bf27e1bdc7107be72c70749c6876 + uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@main with: timeout-minutes: 120 # GPU tests share a process-local lock; separate coverage shards create independent From 26fa70007a470cd6ac93f1bdfdc773e8226bb424 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 09:21:33 +0000 Subject: [PATCH 10/16] fix(gpu): serialize readback mapping cleanup --- crates/gpu/src/context.rs | 44 ++++++++++---- crates/gpu/src/readback.rs | 120 +++++++++++++++++++++++++++++++++++++ 2 files changed, 151 insertions(+), 13 deletions(-) diff --git a/crates/gpu/src/context.rs b/crates/gpu/src/context.rs index d074fe213..cce00bc7f 100644 --- a/crates/gpu/src/context.rs +++ b/crates/gpu/src/context.rs @@ -1207,17 +1207,25 @@ impl GpuContext { if !ticket.active() { return; } + let mapping = Arc::new(crate::readback::Mapping::new()); let b = buffer.clone(); + let callback_mapping = Arc::clone(&mapping); buffer.map_async(wgpu::MapMode::Read, .., move |r| { - if !ticket.active() { - b.unmap(); + if let Err(e) = r { + callback_mapping.failed(); + ticket.complete(Err(format!("GPU buffer mapping: {e}"))); return; } - let result = r.map_err(|e| format!("GPU buffer mapping: {e}")).and_then(|_| { - let view = b.get_mapped_range(..).map_err(|e| format!("GPU mapped range: {e}"))?; - crate::readback::packed(&view, row, stride, height) - }); - b.unmap(); + if !callback_mapping.mapped() { + return; + } + if !ticket.active() { + callback_mapping.unmap(|| b.unmap()); + return; + } + let result = + b.get_mapped_range(..).map_err(|e| format!("GPU mapped range: {e}")).and_then(|view| crate::readback::packed(&view, row, stride, height)); + callback_mapping.unmap(|| b.unmap()); ticket.complete(result); }); } @@ -1264,20 +1272,30 @@ impl GpuContext { if !ticket.active() { return Err("GPU readback cancelled".into()); } + let mapping = Arc::new(crate::readback::Mapping::new()); let b = buffer.clone(); + let callback_mapping = Arc::clone(&mapping); buffer.map_async(wgpu::MapMode::Read, .., move |r| { + if let Err(e) = r { + callback_mapping.failed(); + ticket.complete(Err(format!("GPU buffer mapping: {e}"))); + return; + } + if !callback_mapping.mapped() { + return; + } // Timed out or cancelled: nobody reads the mapping. if !ticket.active() { - b.unmap(); + callback_mapping.unmap(|| b.unmap()); return; } // Mapped: the waiting thread reads the rows and unmaps (an empty vector = mapped). - ticket.complete(r.map(|_| Vec::new()).map_err(|e| format!("GPU buffer mapping: {e}"))); + ticket.complete(Ok(Vec::new())); }); - // On any failure, unmap (harmless when not mapped; cancels a pending map) so a mapped - // buffer can never be handed out again. + // A timeout can cancel a pending map while its callback is being dispatched. The shared + // guard makes sure the callback and waiter cannot both unmap the same buffer. let fail = |e: String| { - buffer.unmap(); + mapping.unmap(|| buffer.unmap()); e }; self.wait_mapped(&rx, submission).map_err(fail)?.map_err(fail)?; @@ -1285,7 +1303,7 @@ impl GpuContext { let view = buffer.get_mapped_range(..).map_err(|e| format!("GPU mapped range: {e}")); view.and_then(|view| read(&view)) }; - buffer.unmap(); + mapping.unmap(|| buffer.unmap()); result } diff --git a/crates/gpu/src/readback.rs b/crates/gpu/src/readback.rs index 290ae08de..51d941640 100644 --- a/crates/gpu/src/readback.rs +++ b/crates/gpu/src/readback.rs @@ -4,6 +4,7 @@ use std::collections::BTreeMap; #[cfg(not(target_arch = "wasm32"))] use std::sync::Condvar; +use std::sync::atomic::{AtomicU8, Ordering}; use std::sync::{Arc, Mutex, Weak}; use std::time::Duration; @@ -92,6 +93,48 @@ pub(crate) struct Ticket { id: u64, } +/// Tracks one GPU buffer mapping shared by the callback and its waiter. A timeout can race a +/// late callback, so the buffer must be unmapped exactly once. A failed map is never unmapped. +pub(crate) struct Mapping(AtomicU8); + +impl Mapping { + const PENDING: u8 = 0; + const MAPPED: u8 = 1; + const FAILED: u8 = 2; + const FINISHED: u8 = 3; + + pub(crate) fn new() -> Self { + Self(AtomicU8::new(Self::PENDING)) + } + + /// Claim a successful map callback. False means a timeout already cancelled the map. + pub(crate) fn mapped(&self) -> bool { + self.0.compare_exchange(Self::PENDING, Self::MAPPED, Ordering::AcqRel, Ordering::Acquire).is_ok() + } + + /// Record a failed map so the waiter will not unmap a buffer that was never mapped. + pub(crate) fn failed(&self) { + let _ = self.0.compare_exchange(Self::PENDING, Self::FAILED, Ordering::AcqRel, Ordering::Acquire); + } + + /// Unmap once if mapping is pending (cancel it) or mapped (release it). + pub(crate) fn unmap(&self, unmap: impl FnOnce()) { + let mut unmap = Some(unmap); + loop { + let state = self.0.load(Ordering::Acquire); + if state != Self::PENDING && state != Self::MAPPED { + return; + } + if self.0.compare_exchange(state, Self::FINISHED, Ordering::AcqRel, Ordering::Acquire).is_ok() { + if let Some(unmap) = unmap.take() { + unmap(); + } + return; + } + } + } +} + /// User callbacks run outside locks and are isolated one at a time. On panic=abort /// (including the usual wasm build), Rust panics cannot be caught: the host must /// avoid panicking callbacks. This branch does not claim abort-mode recovery. @@ -402,6 +445,83 @@ mod tests { use super::*; use std::sync::atomic::{AtomicUsize, Ordering}; + #[test] + fn timeout_racing_late_map_callback_unmaps_once() { + let mapping = Arc::new(Mapping::new()); + let unmap_calls = Arc::new(AtomicUsize::new(0)); + let barrier = Arc::new(std::sync::Barrier::new(3)); + + let timeout_mapping = Arc::clone(&mapping); + let timeout_calls = Arc::clone(&unmap_calls); + let timeout_barrier = Arc::clone(&barrier); + let timeout = std::thread::spawn(move || { + timeout_barrier.wait(); + timeout_mapping.unmap(|| { + timeout_calls.fetch_add(1, Ordering::SeqCst); + }); + }); + + let callback_mapping = Arc::clone(&mapping); + let callback_calls = Arc::clone(&unmap_calls); + let callback_barrier = Arc::clone(&barrier); + let callback = std::thread::spawn(move || { + callback_barrier.wait(); + if callback_mapping.mapped() { + callback_mapping.unmap(|| { + callback_calls.fetch_add(1, Ordering::SeqCst); + }); + } + }); + + barrier.wait(); + timeout.join().unwrap(); + callback.join().unwrap(); + assert_eq!(unmap_calls.load(Ordering::SeqCst), 1); + } + + #[test] + fn timeout_before_map_callback_cancels_late_map() { + let mapping = Mapping::new(); + let unmap_calls = AtomicUsize::new(0); + + mapping.unmap(|| { + unmap_calls.fetch_add(1, Ordering::SeqCst); + }); + assert!(!mapping.mapped()); + mapping.unmap(|| { + unmap_calls.fetch_add(1, Ordering::SeqCst); + }); + + assert_eq!(unmap_calls.load(Ordering::SeqCst), 1); + } + + #[test] + fn mapped_callback_and_timeout_release_once() { + let mapping = Mapping::new(); + let unmap_calls = AtomicUsize::new(0); + assert!(mapping.mapped()); + + mapping.unmap(|| { + unmap_calls.fetch_add(1, Ordering::SeqCst); + }); + mapping.unmap(|| { + unmap_calls.fetch_add(1, Ordering::SeqCst); + }); + + assert_eq!(unmap_calls.load(Ordering::SeqCst), 1); + } + + #[test] + fn failed_map_is_not_unmapped() { + let mapping = Mapping::new(); + let unmap_calls = AtomicUsize::new(0); + mapping.failed(); + mapping.unmap(|| { + unmap_calls.fetch_add(1, Ordering::SeqCst); + }); + assert_eq!(unmap_calls.load(Ordering::SeqCst), 0); + } + #[test] fn early_rejection_reports_no_pixels_exactly_once() { let calls = Arc::new(AtomicUsize::new(0)); From ac1c1d9202ac8cb53ab7410e4060b7740431cd9d Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 13:19:05 -0500 Subject: [PATCH 11/16] encoding: reuse shared Base64 writers across four consumers --- Cargo.lock | 19 +++++++++++++++++++ Cargo.toml | 1 + crates/aep/Cargo.toml | 1 + crates/aep/src/export/icc.rs | 14 +------------- crates/automation/Cargo.toml | 1 + crates/automation/src/base64.rs | 23 +++++++++++++---------- crates/track/Cargo.toml | 1 + crates/track/src/roto/rle.rs | 13 +------------ crates/ui-egui/Cargo.toml | 1 + crates/ui-egui/src/control.rs | 14 +------------- 10 files changed, 40 insertions(+), 48 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7af09affa..4f94415c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1103,6 +1103,11 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "craft-codepage" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" + [[package]] name = "craft-doc" version = "0.1.0" @@ -1220,6 +1225,16 @@ dependencies = [ "serde_json", ] +[[package]] +name = "craft-mime" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +dependencies = [ + "chrono", + "craft-codepage", + "encoding_rs", +] + [[package]] name = "craft-pcraft-format" version = "0.1.0" @@ -1604,6 +1619,7 @@ name = "effectcraft-aep" version = "0.24.1" dependencies = [ "craft-aep", + "craft-mime", "effectcraft-color", "effectcraft-effects", "effectcraft-keyframe", @@ -1619,6 +1635,7 @@ dependencies = [ name = "effectcraft-automation" version = "0.24.1" dependencies = [ + "craft-mime", "effectcraft-engine", "effectcraft-host", "effectcraft-model", @@ -2116,6 +2133,7 @@ dependencies = [ name = "effectcraft-track" version = "0.24.1" dependencies = [ + "craft-mime", "effectcraft-raster", "effectcraft-segment", "rayon", @@ -2130,6 +2148,7 @@ version = "0.24.1" dependencies = [ "bytemuck", "chrono", + "craft-mime", "craft-quit", "craft-ui", "craft-update", diff --git a/Cargo.toml b/Cargo.toml index ae0fd3d09..292069b97 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ rust-version = "1.95" repository = "https://github.com/storytold/effectcraft" [workspace.dependencies] +craft-mime = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", version = "=0.1.0", default-features = false, features = ["read"] } craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } craft-quit = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } diff --git a/crates/aep/Cargo.toml b/crates/aep/Cargo.toml index 0523edb9b..1189df8dc 100644 --- a/crates/aep/Cargo.toml +++ b/crates/aep/Cargo.toml @@ -10,6 +10,7 @@ rust-version.workspace = true workspace = true [dependencies] +craft-mime = { workspace = true } craft-aep = { workspace = true } effectcraft-time = { workspace = true } effectcraft-color = { workspace = true } diff --git a/crates/aep/src/export/icc.rs b/crates/aep/src/export/icc.rs index ae6db7893..04a900d00 100644 --- a/crates/aep/src/export/icc.rs +++ b/crates/aep/src/export/icc.rs @@ -224,19 +224,7 @@ pub(crate) fn profile_json(icc: &[u8], name: &str) -> String { /// Standard base64 with padding. pub(crate) fn base64(data: &[u8]) -> String { - const T: &[u8; 64] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - let mut out = String::with_capacity(data.len().div_ceil(3) * 4); - for c in data.chunks(3) { - let n = (u32::from(c[0]) << 16) | (u32::from(c.get(1).copied().unwrap_or(0)) << 8) | u32::from(c.get(2).copied().unwrap_or(0)); - for (i, shift) in [18u32, 12, 6, 0].iter().enumerate() { - if i <= c.len() { - out.push(char::from(T[((n >> shift) & 63) as usize])); - } else { - out.push('='); - } - } - } - out + craft_mime::base64::STANDARD.encode(data) } #[cfg(test)] diff --git a/crates/automation/Cargo.toml b/crates/automation/Cargo.toml index e0caf3218..23cff63c8 100644 --- a/crates/automation/Cargo.toml +++ b/crates/automation/Cargo.toml @@ -10,6 +10,7 @@ rust-version.workspace = true workspace = true [dependencies] +craft-mime = { workspace = true } effectcraft-engine = { workspace = true } serde_json = { workspace = true } thiserror = { workspace = true } diff --git a/crates/automation/src/base64.rs b/crates/automation/src/base64.rs index 90002c600..21dd66d7e 100644 --- a/crates/automation/src/base64.rs +++ b/crates/automation/src/base64.rs @@ -1,16 +1,7 @@ //! Standard base64 (RFC 4648 §4, padded): MCP image content and the control channel's inline PNGs. -const A: &[u8; 64] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - pub fn encode(data: &[u8]) -> String { - let mut s = String::with_capacity(data.len().div_ceil(3) * 4); - for c in data.chunks(3) { - let n = (c[0] as u32) << 16 | (*c.get(1).unwrap_or(&0) as u32) << 8 | *c.get(2).unwrap_or(&0) as u32; - for i in 0..4 { - s.push(if i <= c.len() { A[(n >> (18 - 6 * i) & 63) as usize] as char } else { '=' }); - } - } - s + craft_mime::base64::STANDARD.encode(data) } /// Decode, ignoring ASCII whitespace; `None` on any other invalid input. @@ -48,6 +39,18 @@ pub fn decode(s: &str) -> Option> { #[cfg(test)] mod tests { + #[test] + fn shared_encoder_round_trips_every_byte_and_remainder() { + let all: Vec = (0..=255).cycle().take(513).collect(); + for length in 0..=all.len() { + let input = &all[..length]; + let encoded = super::encode(input); + assert_eq!(encoded.len(), length.div_ceil(3) * 4); + assert_eq!(super::decode(&encoded).as_deref(), Some(input)); + assert_eq!(encoded.bytes().rev().take_while(|b| *b == b'=').count(), (3 - length % 3) % 3); + } + } + #[test] fn rfc4648_vectors() { for (i, o) in [("", ""), ("f", "Zg=="), ("fo", "Zm8="), ("foo", "Zm9v"), ("foob", "Zm9vYg=="), ("fooba", "Zm9vYmE="), ("foobar", "Zm9vYmFy")] { diff --git a/crates/track/Cargo.toml b/crates/track/Cargo.toml index cd9daae36..f374a81f8 100644 --- a/crates/track/Cargo.toml +++ b/crates/track/Cargo.toml @@ -10,6 +10,7 @@ rust-version.workspace = true workspace = true [dependencies] +craft-mime = { workspace = true } effectcraft-raster = { workspace = true } effectcraft-segment = { workspace = true } rayon = { workspace = true } diff --git a/crates/track/src/roto/rle.rs b/crates/track/src/roto/rle.rs index 914bcad83..4a4152d82 100644 --- a/crates/track/src/roto/rle.rs +++ b/crates/track/src/roto/rle.rs @@ -1,19 +1,8 @@ //! Compact text encodings of mattes for project storage: run-length coding (LEB128 varints) //! wrapped in standard base64 (RFC 4648 §4). -const B64: &[u8; 64] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - pub fn base64_encode(data: &[u8]) -> String { - let mut out = String::with_capacity(data.len().div_ceil(3) * 4); - for c in data.chunks(3) { - let b = [c[0], *c.get(1).unwrap_or(&0), *c.get(2).unwrap_or(&0)]; - let n = (b[0] as u32) << 16 | (b[1] as u32) << 8 | b[2] as u32; - out.push(B64[(n >> 18) as usize & 63] as char); - out.push(B64[(n >> 12) as usize & 63] as char); - out.push(if c.len() > 1 { B64[(n >> 6) as usize & 63] as char } else { '=' }); - out.push(if c.len() > 2 { B64[n as usize & 63] as char } else { '=' }); - } - out + craft_mime::base64::STANDARD.encode(data) } pub fn base64_decode(s: &str) -> Option> { diff --git a/crates/ui-egui/Cargo.toml b/crates/ui-egui/Cargo.toml index 3c5862594..81f2023c4 100644 --- a/crates/ui-egui/Cargo.toml +++ b/crates/ui-egui/Cargo.toml @@ -10,6 +10,7 @@ rust-version.workspace = true workspace = true [dependencies] +craft-mime = { workspace = true } craft-ui = { workspace = true } craft-quit = { workspace = true, features = ["egui"] } effectcraft-time = { workspace = true } diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rs index 9f86c7ace..b1717d55e 100644 --- a/crates/ui-egui/src/control.rs +++ b/crates/ui-egui/src/control.rs @@ -803,19 +803,7 @@ fn render_frame(app: &EffectcraftApp, p: &Value) -> Outcome { /// Standard base64 (RFC 4648, padded). pub fn base64(data: &[u8]) -> String { - const A: &[u8; 64] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - let mut s = String::with_capacity(data.len().div_ceil(3) * 4); - for c in data.chunks(3) { - let n = (c[0] as u32) << 16 | (*c.get(1).unwrap_or(&0) as u32) << 8 | *c.get(2).unwrap_or(&0) as u32; - for i in 0..4 { - if i <= c.len() { - s.push(A[(n >> (18 - 6 * i) & 63) as usize] as char); - } else { - s.push('='); - } - } - } - s + craft_mime::base64::STANDARD.encode(data) } /// Builds the `ui.inspect` reply: window size and pixels per point, fps, UI state with the From 3b4f35eba40dda453fe0a980fa8ab63b0f29c1bb Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 22:13:24 -0500 Subject: [PATCH 12/16] Keep dotLottie cutover separate from coverage PR 3654 --- .github/workflows/sonarcloud.yml | 4 ---- crates/ui-egui/tests/it/ui_crypto_pick.rs | 1 - 2 files changed, 5 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 6adc57765..8f1aa5ad5 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -20,9 +20,5 @@ jobs: uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@main with: timeout-minutes: 120 - # GPU tests share a process-local lock; separate coverage shards create independent - # software Vulkan devices, bypassing that lock and potentially contending on llvmpipe. - shards: 1 - rust-test-threads: "1" fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83 secrets: inherit diff --git a/crates/ui-egui/tests/it/ui_crypto_pick.rs b/crates/ui-egui/tests/it/ui_crypto_pick.rs index c9ed63ef3..5aa923698 100644 --- a/crates/ui-egui/tests/it/ui_crypto_pick.rs +++ b/crates/ui-egui/tests/it/ui_crypto_pick.rs @@ -635,7 +635,6 @@ fn clicks_wait_for_the_probe_and_edits_popups_dialogs_and_comp_switches_end_or_b /// each Resolution. Skips without a GPU adapter. #[test] fn picks_on_the_gpu_viewer() { - let _gpu = crate::gpu_test::lock(); let Some(probe) = effectcraft_gpu::Gpu::headless() else { eprintln!("no GPU adapter: skipping"); return; From 5a7b4e903f586f84ece9b7babe5448544f74f5e4 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 23:03:51 -0500 Subject: [PATCH 13/16] test(gpu): isolate inverse LUT and profile readbacks --- crates/gpu/src/tests/fx_lut.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/gpu/src/tests/fx_lut.rs b/crates/gpu/src/tests/fx_lut.rs index b74e90f09..f4bac9f7d 100644 --- a/crates/gpu/src/tests/fx_lut.rs +++ b/crates/gpu/src/tests/fx_lut.rs @@ -97,6 +97,21 @@ fn apply_color_lut() { effect_case("ec.utility.applylut", &[("lut", s("/nonexistent/grade.cube"))]); } +// Keep this separate so Nextest runs the inverse lookup in a fresh process/device, +// without the preceding 3D LUT submissions in `ocio_file_transform`. The combined +// test stays intact to cover ordering and shared-device state as well. +#[test] +fn inverse_1d_lut_on_a_fresh_device_matches_cpu() { + effect_direct("ec.color.ociofile", &[("file", s(&cube_1d())), ("direction", e(1))], false); +} + +// Isolate the first profile conversion that failed in hosted llvmpipe coverage. +// This retains the same oracle and tolerance as the broader profile test. +#[test] +fn profile_conversion_on_a_fresh_device_matches_cpu() { + effect_direct("ec.utility.colorprofileconverter", &[("inputProfile", e(1)), ("outputProfile", e(3)), ("intent", e(0))], false); +} + #[test] fn ocio_file_transform() { for interp in 1..4 { From 3678cc9bec4e09f91482d9738f79b4c22c2a28d0 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 23:25:31 -0500 Subject: [PATCH 14/16] fix(gpu): bound inverse LUT search and write transfer components explicitly --- crates/gpu/src/shaders/fx_lut.wgsl | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/crates/gpu/src/shaders/fx_lut.wgsl b/crates/gpu/src/shaders/fx_lut.wgsl index 87966df7d..96f325642 100644 --- a/crates/gpu/src/shaders/fx_lut.wgsl +++ b/crates/gpu/src/shaders/fx_lut.wgsl @@ -176,12 +176,16 @@ fn fxl_inv_1d(o: u32, i: u32, y: f32) -> f32 { // partition_point over the table's values. var lo = 0u; var hi = n; - while (lo < hi) { - let mid = (lo + hi) / 2u; - if (data[b1 + mid * 3u + i] < y) { - lo = mid + 1u; - } else { - hi = mid; + // A u32 interval needs at most 32 halvings. A fixed trip count avoids + // a divergent data-dependent loop on software Vulkan without changing lookup. + for (var step = 0u; step < 32u; step++) { + if (lo < hi) { + let mid = lo + (hi - lo) / 2u; + if (data[b1 + mid * 3u + i] < y) { + lo = mid + 1u; + } else { + hi = mid; + } } } let k = clamp(lo, 1u, n - 1u); @@ -444,12 +448,11 @@ fn fxl_run(c0: vec3) -> vec3 { case 1u, 2u: { let tf = u32(data[pc + 1u]); let g = data[pc + 2u]; - for (var i = 0u; i < 3u; i++) { - if (op == 1u) { - c[i] = fxl_decode(tf, g, c[i]); - } else { - c[i] = fxl_encode(tf, g, c[i]); - } + // Explicit components avoid llvmpipe's dynamically indexed vector writes. + if (op == 1u) { + c = vec3(fxl_decode(tf, g, c.x), fxl_decode(tf, g, c.y), fxl_decode(tf, g, c.z)); + } else { + c = vec3(fxl_encode(tf, g, c.x), fxl_encode(tf, g, c.y), fxl_encode(tf, g, c.z)); } pc += 3u; } From f0a5783a821c4fe4d438c3758b2fb4a762ef4254 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 23:56:13 -0500 Subject: [PATCH 15/16] fix(gpu): preserve CSP shaper channels on software Vulkan --- crates/gpu/src/shaders/fx_lut.wgsl | 37 +++++++++++++++++++----------- crates/gpu/src/tests/fx_lut.rs | 14 +++++++++++ 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/crates/gpu/src/shaders/fx_lut.wgsl b/crates/gpu/src/shaders/fx_lut.wgsl index 96f325642..f9081f834 100644 --- a/crates/gpu/src/shaders/fx_lut.wgsl +++ b/crates/gpu/src/shaders/fx_lut.wgsl @@ -130,12 +130,15 @@ fn fxl_shape(at: u32, n: u32, x: f32, flip: bool) -> f32 { // partition_point(|p| p.x < x). var lo = 0u; var hi = n; - while (lo < hi) { - let mid = (lo + hi) / 2u; - if (data[at + mid * 2u + kx] < x) { - lo = mid + 1u; - } else { - hi = mid; + // Bound the partition search as for inverse 1D LUTs below. + for (var step = 0u; step < 32u; step++) { + if (lo < hi) { + let mid = lo + (hi - lo) / 2u; + if (data[at + mid * 2u + kx] < x) { + lo = mid + 1u; + } else { + hi = mid; + } } } let i = clamp(lo, 1u, n - 1u); @@ -156,13 +159,22 @@ fn fxl_shaper_at(s: u32, k: u32) -> vec2 { return vec2(at, u32(data[s + k])); } +// Evaluate independent shaper channels without dynamically writing vector lanes. +fn fxl_shaper_apply(sh: u32, c: vec3, flip: bool) -> vec3 { + let r = fxl_shaper_at(sh, 0u); + let g = fxl_shaper_at(sh, 1u); + let b = fxl_shaper_at(sh, 2u); + return vec3( + fxl_shape(r.x, r.y, c.x, flip), + fxl_shape(g.x, g.y, c.y, flip), + fxl_shape(b.x, b.y, c.z, flip) + ); +} + fn fxl_file_fwd(o: u32, sh: i32, c0: vec3, interp: u32) -> vec3 { var c = c0; if (sh >= 0) { - for (var k = 0u; k < 3u; k++) { - let a = fxl_shaper_at(u32(sh), k); - c[k] = fxl_shape(a.x, a.y, c[k], false); - } + c = fxl_shaper_apply(u32(sh), c, false); } return fxl_lut_apply(o, c, interp); } @@ -209,10 +221,7 @@ fn fxl_file(o: u32, sh: i32, c: vec3, interp: u32, inverse: bool) -> vec3(fxl_inv_1d(o, 0u, c.x), fxl_inv_1d(o, 1u, c.y), fxl_inv_1d(o, 2u, c.z)); } if (sh >= 0) { - for (var k = 0u; k < 3u; k++) { - let a = fxl_shaper_at(u32(sh), k); - x[k] = fxl_shape(a.x, a.y, x[k], true); - } + x = fxl_shaper_apply(u32(sh), x, true); } return x; } diff --git a/crates/gpu/src/tests/fx_lut.rs b/crates/gpu/src/tests/fx_lut.rs index f4bac9f7d..acac88835 100644 --- a/crates/gpu/src/tests/fx_lut.rs +++ b/crates/gpu/src/tests/fx_lut.rs @@ -112,6 +112,20 @@ fn profile_conversion_on_a_fresh_device_matches_cpu() { effect_direct("ec.utility.colorprofileconverter", &[("inputProfile", e(1)), ("outputProfile", e(3)), ("intent", e(0))], false); } +// Unequal CSP channel point counts exercise shaper offsets on a fresh device. +#[test] +fn csp_shaper_on_a_fresh_device_matches_cpu() { + effect_direct("ec.color.ociofile", &[("file", s(&csp())), ("interpolation", e(1))], false); + effect_direct("ec.color.ociofile", &[("file", s(&csp())), ("direction", e(1))], false); +} + +// A 1D CSP takes the direct inverse-shaper path (flip=true), unlike a 3D CSP. +#[test] +fn inverse_1d_csp_shaper_on_a_fresh_device_matches_cpu() { + let lut = "CSPLUTV100\n1D\n3\n0 0.5 1\n0 0.3 1\n2\n0 1\n0 1\n4\n0 0.2 0.6 1\n0 0.4 0.7 1\n2\n0 0 0\n1 1 1\n"; + effect_direct("ec.color.ociofile", &[("file", s(lut)), ("direction", e(1))], false); +} + #[test] fn ocio_file_transform() { for interp in 1..4 { From 218b94224abdbf73b5fc2eca0c6069b82f28b90a Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 14 Nov 2026 20:00:53 +0000 Subject: [PATCH 16/16] test(ui): serialize GPU picker integration --- crates/ui-egui/tests/it/ui_crypto_pick.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/ui-egui/tests/it/ui_crypto_pick.rs b/crates/ui-egui/tests/it/ui_crypto_pick.rs index 5aa923698..c9ed63ef3 100644 --- a/crates/ui-egui/tests/it/ui_crypto_pick.rs +++ b/crates/ui-egui/tests/it/ui_crypto_pick.rs @@ -635,6 +635,7 @@ fn clicks_wait_for_the_probe_and_edits_popups_dialogs_and_comp_switches_end_or_b /// each Resolution. Skips without a GPU adapter. #[test] fn picks_on_the_gpu_viewer() { + let _gpu = crate::gpu_test::lock(); let Some(probe) = effectcraft_gpu::Gpu::headless() else { eprintln!("no GPU adapter: skipping"); return;