authoravatarclover caruso<git@paperclover.net>2026-12-01 03:54:49-08:00
committeravatarclover caruso<git@paperclover.net>2026-12-01 05:21:12-08:00
log448a673c23c6d2c5e6bc7c1b4751faa5761cd5d8
treea5970d0aa913c33d0309ea23d5859b11854e3599
parentff950de2d8df46a71fe6ad45cbb5b20c133047e2
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

Add wasm32 WebGPU browser build (crates/web) with pure-Rust expressions and virtual media

- model: mlua is native-only; wasm32 gets a pure-Rust Lua-subset evaluator (math/trig, iif/and/or, node refs, Point/Text) checked against mlua in a parity test - engine: cpal/symphonia native-only, audio/export/RAM prefetcher compiled out on wasm32, unused theme dep dropped, MediaCache::insert_virtual_bytes shadows the filesystem for stills and sequences (matched by trailing path components) - web: standalone crate, canvas present pass, transport, node picker, flow graph, .comp / folder drop, built-in demo.comp, build.sh Assisted-by: claude-sonnet-5.5

16 files changed, 4470 insertions(+), 301 deletions(-)

Cargo.lock+1-1
......@@ -1021,7 +1021,7 @@ dependencies = [
10211021 "pollster",
10221022 "rustybuzz",
10231023 "symphonia",
1024 "theme",
1024 "web-time",
10251025 "wgpu",
10261026 "zeno",
10271027]
crates/engine/Cargo.toml+7-3
......@@ -10,7 +10,6 @@ path = "src/bin/render_check.rs"
1010
1111[dependencies]
1212bytemuck.workspace = true
13cpal = "0.15"
1413exr = "1.74"
1514fontdb.workspace = true
1615image.workspace = true
......@@ -18,10 +17,15 @@ model.workspace = true
1817png.workspace = true
1918pollster.workspace = true
2019rustybuzz.workspace = true
21symphonia = { version = "0.5", default-features = false, features = ["wav", "mp3", "flac", "ogg", "aac", "isomp4", "pcm"] }
22theme.workspace = true
2320wgpu.workspace = true
2421zeno.workspace = true
2522
23[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
24cpal = "0.15"
25symphonia = { version = "0.5", default-features = false, features = ["wav", "mp3", "flac", "ogg", "aac", "isomp4", "pcm"] }
26
27[target.'cfg(target_arch = "wasm32")'.dependencies]
28web-time = "1"
29
2630[target.'cfg(target_os = "macos")'.build-dependencies]
2731cc = "1"
crates/engine/src/lib.rs+7-3
......@@ -1,8 +1,10 @@
1#[cfg(not(target_arch = "wasm32"))]
12pub mod audio;
23pub mod cache;
34pub mod cryptomatte;
45pub mod custom_shader;
56pub mod eval;
7#[cfg(not(target_arch = "wasm32"))]
68pub mod export;
79pub mod media;
810pub mod optflow;
......@@ -12,14 +14,16 @@ pub mod ram_cache;
1214pub mod scene3d;
1315pub mod text_engine;
1416
17#[cfg(not(target_arch = "wasm32"))]
1518pub use audio::{AudioPlayer, AudioTrack};
1619pub use cache::{
1720 CacheMode, CachedTexture, DEFAULT_VRAM_BUDGET_MB, EvalStats, GpuCache, NodeCache, TexturePool,
1821 TexturePoolKey, TexturePoolStats,
1922};
2023pub use eval::{DisplaySettings, Engine, create_texture};
24#[cfg(not(target_arch = "wasm32"))]
2125pub use export::{ExportOptions, ExportProgress, ExportSummary, export_saver_png_sequence, select_saver};
2226pub use profile::{FrameProfile, NodeProfileEntry};
23pub use ram_cache::{
24 DEFAULT_RAM_CACHE_MB, PrefetchJob, RamFrame, RamFrameCache, RamFrameKey, RamPrefetcher,
25};
27pub use ram_cache::{DEFAULT_RAM_CACHE_MB, RamFrame, RamFrameCache, RamFrameKey};
28#[cfg(not(target_arch = "wasm32"))]
29pub use ram_cache::{PrefetchJob, RamPrefetcher};
crates/engine/src/media.rs+104-4
......@@ -18,7 +18,7 @@ use model::{ClipSpec, ClsEntry, PolyPoint};
1818use std::collections::HashMap;
1919use std::path::{Path, PathBuf};
2020use std::process::Command;
21use std::sync::Arc;
21use std::sync::{Arc, RwLock};
2222
2323#[derive(Clone)]
2424pub struct DecodedImage {
......@@ -50,6 +50,50 @@ impl DecodedImage {
5050
5151const MAX_VIDEO_DECODERS: usize = 12;
5252
53struct VirtualFile {
54 parts: Vec<String>,
55 bytes: Arc<[u8]>,
56}
57
58/// In-memory files that shadow the filesystem for still and sequence loading, since `wasm32` has no `std::fs`.
59static VIRTUAL_FILES: RwLock<Vec<VirtualFile>> = RwLock::new(Vec::new());
60
61fn path_parts(path: &Path) -> Vec<String> {
62 path.to_string_lossy()
63 .split(['/', '\\'])
64 .filter(|p| !p.is_empty() && *p != ".")
65 .map(str::to_owned)
66 .collect()
67}
68
69/// Bytes of the virtual file sharing the longest run of trailing path components with `path`, so a
70/// comp's absolute `Loader` path still finds a file registered under a dropped folder's relative path.
71fn virtual_bytes(path: &Path) -> Option<Arc<[u8]>> {
72 let files = VIRTUAL_FILES.read().ok()?;
73 if files.is_empty() {
74 return None;
75 }
76 let want = path_parts(path);
77 let shared = |f: &VirtualFile| f.parts.iter().rev().zip(want.iter().rev()).take_while(|(a, b)| a == b).count();
78 files
79 .iter()
80 .map(|f| (shared(f), f))
81 .filter(|(n, _)| *n > 0)
82 .max_by_key(|(n, _)| *n)
83 .map(|(_, f)| Arc::clone(&f.bytes))
84}
85
86fn path_exists(path: &Path) -> bool {
87 virtual_bytes(path).is_some() || path.exists()
88}
89
90fn open_image(path: &Path) -> Option<image::DynamicImage> {
91 match virtual_bytes(path) {
92 Some(bytes) => image::load_from_memory(&bytes).ok(),
93 None => image::open(path).ok(),
94 }
95}
96
5397#[derive(Clone, Debug, PartialEq, Eq, Hash)]
5498struct ImageCacheKey {
5599 path: PathBuf,
......@@ -84,6 +128,23 @@ impl MediaCache {
84128 }
85129 }
86130
131 /// Registers `bytes` as the file at `path` for every `MediaCache` in the process.
132 pub fn insert_virtual_bytes(path: impl AsRef<Path>, bytes: impl Into<Arc<[u8]>>) {
133 let parts = path_parts(path.as_ref());
134 let bytes = bytes.into();
135 let Ok(mut files) = VIRTUAL_FILES.write() else { return };
136 match files.iter_mut().find(|f| f.parts == parts) {
137 Some(existing) => existing.bytes = bytes,
138 None => files.push(VirtualFile { parts, bytes }),
139 }
140 }
141
142 pub fn clear_virtual_bytes() {
143 if let Ok(mut files) = VIRTUAL_FILES.write() {
144 files.clear();
145 }
146 }
147
87148 pub fn clear(&mut self) {
88149 self.images.clear();
89150 self.lru.clear();
......@@ -271,7 +332,7 @@ impl MediaCache {
271332 false,
272333 )?
273334 } else {
274 let dyn_img = image::open(&resolved).ok()?;
335 let dyn_img = open_image(&resolved)?;
275336 let rgba_img = dyn_img.to_rgba8();
276337 let size = [rgba_img.width(), rgba_img.height()];
277338 let mut raw = rgba_img.into_raw();
......@@ -301,7 +362,7 @@ pub fn resolve_clip_path(clip: &ClipSpec, frame: i64) -> Option<PathBuf> {
301362 let digits = &stem[digit_start..];
302363 let is_seq = len > 1 && (clip.start_frame >= 0 || !digits.is_empty());
303364 if !is_seq || digits.is_empty() {
304 return base.exists().then(|| base.to_path_buf());
365 return path_exists(base).then(|| base.to_path_buf());
305366 }
306367
307368 let seq_start = if clip.start_frame >= 0 { clip.start_frame } else { 0 };
......@@ -329,7 +390,7 @@ pub fn resolve_clip_path(clip: &ClipSpec, frame: i64) -> Option<PathBuf> {
329390 format!("{prefix}{idx:0width$}.{ext}")
330391 };
331392 let candidate = base.with_file_name(new_name);
332 candidate.exists().then_some(candidate)
393 path_exists(&candidate).then_some(candidate)
333394}
334395#[cfg(test)]
335396mod tests {
......@@ -855,4 +916,43 @@ mod tests {
855916
856917 let _ = std::fs::remove_dir_all(&dir);
857918 }
919
920 #[test]
921 fn virtual_bytes_load_a_sequence_by_trailing_path() {
922 let png = |rgba: [u8; 4]| {
923 let mut out = std::io::Cursor::new(Vec::new());
924 image::RgbaImage::from_pixel(2, 1, image::Rgba(rgba))
925 .write_to(&mut out, image::ImageFormat::Png)
926 .unwrap();
927 out.into_inner()
928 };
929 MediaCache::insert_virtual_bytes("vf_proj\\vf_seq.0001.png", png([255, 0, 0, 255]));
930 MediaCache::insert_virtual_bytes("./vf_proj/vf_seq.0002.png", png([0, 255, 0, 255]));
931 let clip = ClipSpec {
932 filename: "/not/on/disk/vf_proj/vf_seq.0001.png".to_owned(),
933 alternate_filename: None,
934 start_frame: 1,
935 length: Some(2),
936 trim_in: 0,
937 trim_out: 1,
938 global_start: 0,
939 global_end: 1,
940 extend_first: 0,
941 extend_last: 0,
942 loop_clip: false,
943 reverse: false,
944 };
945 let mut cache = MediaCache::new(64);
946 let (_, _, f0, from_disk) = cache.load_clip(&clip, 0, false, [None; 4]).unwrap();
947 let (_, _, f1, _) = cache.load_clip(&clip, 1, false, [None; 4]).unwrap();
948 assert!(from_disk);
949 assert_eq!((f0.size, &f0.rgba[..4]), ([2, 1], &[255, 0, 0, 255][..]));
950 assert_eq!(&f1.rgba[..4], &[0, 255, 0, 255]);
951
952 MediaCache::insert_virtual_bytes("vf_proj/vf_seq.0002.png", png([0, 0, 255, 255]));
953 let (_, _, f1, _) = MediaCache::new(64).load_clip(&clip, 1, false, [None; 4]).unwrap();
954 assert_eq!(&f1.rgba[..4], &[0, 0, 255, 255]);
955 assert!(path_exists(Path::new("elsewhere/vf_seq.0002.png")));
956 assert!(!path_exists(Path::new("vf_proj/vf_seq.0003.png")));
957 }
858958}
crates/engine/src/ram_cache.rs+18-4
......@@ -7,11 +7,19 @@
77//! - `RamPrefetcher` runs lookahead evaluation on a background thread with an atomic generation
88//! counter so scrubbing or editing cancels stale pre-fetch work immediately.
99
10#[cfg(not(target_arch = "wasm32"))]
1011use crate::eval::Engine;
11use model::{Comp, NodeId};
12#[cfg(not(target_arch = "wasm32"))]
13use model::Comp;
14use model::NodeId;
1215use std::collections::HashMap;
13use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
14use std::sync::{Arc, Condvar, Mutex};
16#[cfg(not(target_arch = "wasm32"))]
17use std::sync::atomic::AtomicBool;
18use std::sync::atomic::{AtomicU64, Ordering};
19use std::sync::{Arc, Mutex};
20#[cfg(not(target_arch = "wasm32"))]
21use std::sync::Condvar;
22#[cfg(not(target_arch = "wasm32"))]
1523use std::thread::{self, JoinHandle};
1624
1725/// Default RAM frame cache ceiling (1 GiB ≈ 130 full-res 1080p frames or ~520 half-res frames).
......@@ -109,6 +117,7 @@ impl RamFrameCache {
109117 self.cache_epoch.load(Ordering::Acquire)
110118 }
111119
120 #[cfg(not(target_arch = "wasm32"))]
112121 pub(crate) fn epoch_arc(&self) -> Arc<AtomicU64> {
113122 Arc::clone(&self.cache_epoch)
114123 }
......@@ -268,6 +277,7 @@ impl RamFrameCache {
268277}
269278
270279/// Parameters for a background lookahead pre-fetch window.
280#[cfg(not(target_arch = "wasm32"))]
271281#[derive(Clone)]
272282pub struct PrefetchJob {
273283 pub comp: Comp,
......@@ -280,6 +290,7 @@ pub struct PrefetchJob {
280290 pub use_proxy_clips: bool,
281291}
282292
293#[cfg(not(target_arch = "wasm32"))]
283294struct WorkerSlot {
284295 job: Option<(u64, PrefetchJob)>,
285296 shutdown: bool,
......@@ -290,6 +301,7 @@ struct WorkerSlot {
290301///
291302/// Calling `request_lookahead` or `cancel` immediately increments an atomic generation
292303/// counter so any in-flight lookahead loop aborts before evaluating another frame.
304#[cfg(not(target_arch = "wasm32"))]
293305pub struct RamPrefetcher {
294306 cache: RamFrameCache,
295307 cache_epoch: Arc<AtomicU64>,
......@@ -304,6 +316,7 @@ pub struct RamPrefetcher {
304316 worker: Option<JoinHandle<()>>,
305317}
306318
319#[cfg(not(target_arch = "wasm32"))]
307320impl RamPrefetcher {
308321 pub fn new(cache: RamFrameCache, worker_vram_budget_mb: u64) -> Self {
309322 Self::init(None, cache, worker_vram_budget_mb.max(128), 512)
......@@ -544,6 +557,7 @@ impl RamPrefetcher {
544557 }
545558}
546559
560#[cfg(not(target_arch = "wasm32"))]
547561impl Drop for RamPrefetcher {
548562 fn drop(&mut self) {
549563 self.generation.fetch_add(1, Ordering::AcqRel);
......@@ -574,7 +588,7 @@ impl Drop for RamPrefetcher {
574588 }
575589}
576590
577#[cfg(test)]
591#[cfg(all(test, not(target_arch = "wasm32")))]
578592mod tests {
579593 use super::*;
580594 use std::time::{Duration, Instant};
crates/model/Cargo.toml+1-1
......@@ -4,5 +4,5 @@ edition.workspace = true
44version.workspace = true
55publish.workspace = true
66
7[dependencies]
7[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
88mlua.workspace = true
crates/model/src/expr.rs+945-285
......@@ -1,19 +1,8 @@
1//! Fusion SimpleExpression evaluator backed by `mlua` (Lua 5.4).
1//! Fusion SimpleExpression evaluation: `mlua` (Lua 5.4) natively, a pure-Rust subset on `wasm32`.
22//!
33//! Supports Fusion globals (`time`, `iif`, `Point`, `Text`, `sin`/`cos`/`floor`/`ceil`/etc.)
44//! and `NodeName.ParamName` lookups without requiring full Fusion runtime scripting.
55
6use mlua::{HookTriggers, Lua, LuaOptions, MultiValue, StdLib, Value, VmState};
7use std::collections::HashMap;
8use std::sync::Arc;
9use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
10
11/// VM instructions one expression evaluation may execute before it is aborted.
12const INSTRUCTION_BUDGET: u64 = 50_000;
13/// Hook granularity; the budget is enforced in steps of this many instructions.
14const HOOK_STEP: u32 = 1000;
15const MEMORY_LIMIT: usize = 16 * 1024 * 1024;
16
176/// An input readable from an expression. Text inputs surface as `{ Value = "..." }` tables that
187/// also stringify, matching Fusion's `Node.StyledText.Value`.
198#[derive(Clone, Debug, PartialEq)]
......@@ -22,316 +11,987 @@ pub enum ExprValue {
2211 Text(String),
2312}
2413
25/// Expressions come from `.comp` files, so the VM is sandboxed: no `os`/`io`/`debug`/`package`,
26/// no code loading, and bounded instructions and memory per evaluation.
27pub struct ExprEngine {
28 lua: Lua,
29 instructions_used: Arc<AtomicU64>,
30 /// Latched once the budget is exceeded so every later hook call also errors.
31 aborted: Arc<AtomicBool>,
32}
14#[cfg(not(target_arch = "wasm32"))]
15mod lua {
16 use super::ExprValue;
17 use mlua::{HookTriggers, Lua, LuaOptions, MultiValue, StdLib, Value, VmState};
18 use std::collections::HashMap;
19 use std::sync::Arc;
20 use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
3321
34impl Default for ExprEngine {
35 fn default() -> Self {
36 Self::new()
22 /// VM instructions one expression evaluation may execute before it is aborted.
23 const INSTRUCTION_BUDGET: u64 = 50_000;
24 /// Hook granularity; the budget is enforced in steps of this many instructions.
25 const HOOK_STEP: u32 = 1000;
26 const MEMORY_LIMIT: usize = 16 * 1024 * 1024;
27
28 /// Expressions come from `.comp` files, so the VM is sandboxed: no `os`/`io`/`debug`/`package`,
29 /// no code loading, and bounded instructions and memory per evaluation.
30 pub struct ExprEngine {
31 lua: Lua,
32 instructions_used: Arc<AtomicU64>,
33 /// Latched once the budget is exceeded so every later hook call also errors.
34 aborted: Arc<AtomicBool>,
3735 }
38}
3936
40impl ExprEngine {
41 pub fn new() -> Self {
42 let lua = Lua::new_with(StdLib::MATH | StdLib::STRING | StdLib::TABLE, LuaOptions::default())
43 .expect("safe Lua stdlib subset loads");
44 // Install Fusion SimpleExpression standard library into global scope.
45 let init = r#"
46 abs = math.abs
47 acos = math.acos
48 asin = math.asin
49 atan = math.atan
50 atan2 = math.atan
51 ceil = math.ceil
52 cos = math.cos
53 cosh = function(x) return (math.exp(x) + math.exp(-x)) * 0.5 end
54 deg = math.deg
55 exp = math.exp
56 floor = math.floor
57 fmod = math.fmod
58 log = math.log
59 log10 = function(x) return math.log(x, 10) end
60 max = math.max
61 min = math.min
62 mod = math.fmod
63 pi = math.pi
64 pow = function(a, b) return a ^ b end
65 rad = math.rad
66 sin = math.sin
67 sinh = function(x) return (math.exp(x) - math.exp(-x)) * 0.5 end
68 sqrt = math.sqrt
69 tan = math.tan
70 tanh = function(x) local e = math.exp(2*x); return (e - 1) / (e + 1) end
71 iif = function(cond, a, b) if cond and cond ~= 0 then return a else return b end end
72 Point = function(x, y) return { X = x or 0, Y = y or 0, [1] = x or 0, [2] = y or 0 } end
73 Text = function(s) return tostring(s or "") end
74 clamp = function(x, lo, hi) if x < lo then return lo elseif x > hi then return hi else return x end end
75 mix = function(a, b, t) return a + (b - a) * t end
76 "#;
77 let _ = lua.load(init).exec();
78
79 let globals = lua.globals();
80 // Stdlib tables become write-protected proxies so no evaluation can alter them for the next.
81 let read_only = lua
82 .create_function(|_, _: MultiValue| -> mlua::Result<()> {
83 Err(mlua::Error::runtime("attempt to modify a read-only table"))
84 })
85 .expect("function creates");
86 for name in ["math", "string", "table"] {
87 let real: mlua::Table = globals.get(name).expect("stdlib table exists");
88 let proxy = lua.create_table().expect("table creates");
89 let mt = lua.create_table().expect("table creates");
90 mt.set("__index", real).expect("table sets");
91 mt.set("__newindex", read_only.clone()).expect("table sets");
92 proxy.set_metatable(Some(mt));
93 globals.set(name, proxy).expect("global sets");
94 }
95 // `pcall`/`xpcall` would swallow the budget error; the rest reach shared tables or metatables.
96 for name in [
97 "dofile", "loadfile", "load", "require", "collectgarbage", "os", "io", "debug", "package",
98 "pcall", "xpcall", "rawget", "rawset", "rawequal", "getmetatable", "setmetatable", "_G",
99 ] {
100 let _ = globals.set(name, Value::Nil);
101 }
102
103 let instructions_used = Arc::new(AtomicU64::new(0));
104 let aborted = Arc::new(AtomicBool::new(false));
105 let counter = Arc::clone(&instructions_used);
106 let latch = Arc::clone(&aborted);
107 lua.set_hook(HookTriggers::new().every_nth_instruction(HOOK_STEP), move |_, _| {
108 if latch.load(Ordering::Relaxed)
109 || counter.fetch_add(u64::from(HOOK_STEP), Ordering::Relaxed) >= INSTRUCTION_BUDGET
110 {
111 latch.store(true, Ordering::Relaxed);
112 Err(mlua::Error::runtime("expression instruction budget exceeded"))
37 impl Default for ExprEngine {
38 fn default() -> Self {
39 Self::new()
40 }
41 }
42
43 impl ExprEngine {
44 pub fn new() -> Self {
45 let lua = Lua::new_with(StdLib::MATH | StdLib::STRING | StdLib::TABLE, LuaOptions::default())
46 .expect("safe Lua stdlib subset loads");
47 // Install Fusion SimpleExpression standard library into global scope.
48 let init = r#"
49 abs = math.abs
50 acos = math.acos
51 asin = math.asin
52 atan = math.atan
53 atan2 = math.atan
54 ceil = math.ceil
55 cos = math.cos
56 cosh = function(x) return (math.exp(x) + math.exp(-x)) * 0.5 end
57 deg = math.deg
58 exp = math.exp
59 floor = math.floor
60 fmod = math.fmod
61 log = math.log
62 log10 = function(x) return math.log(x, 10) end
63 max = math.max
64 min = math.min
65 mod = math.fmod
66 pi = math.pi
67 pow = function(a, b) return a ^ b end
68 rad = math.rad
69 sin = math.sin
70 sinh = function(x) return (math.exp(x) - math.exp(-x)) * 0.5 end
71 sqrt = math.sqrt
72 tan = math.tan
73 tanh = function(x) local e = math.exp(2*x); return (e - 1) / (e + 1) end
74 iif = function(cond, a, b) if cond and cond ~= 0 then return a else return b end end
75 Point = function(x, y) return { X = x or 0, Y = y or 0, [1] = x or 0, [2] = y or 0 } end
76 Text = function(s) return tostring(s or "") end
77 clamp = function(x, lo, hi) if x < lo then return lo elseif x > hi then return hi else return x end end
78 mix = function(a, b, t) return a + (b - a) * t end
79 "#;
80 let _ = lua.load(init).exec();
81
82 let globals = lua.globals();
83 // Stdlib tables become write-protected proxies so no evaluation can alter them for the next.
84 let read_only = lua
85 .create_function(|_, _: MultiValue| -> mlua::Result<()> {
86 Err(mlua::Error::runtime("attempt to modify a read-only table"))
87 })
88 .expect("function creates");
89 for name in ["math", "string", "table"] {
90 let real: mlua::Table = globals.get(name).expect("stdlib table exists");
91 let proxy = lua.create_table().expect("table creates");
92 let mt = lua.create_table().expect("table creates");
93 mt.set("__index", real).expect("table sets");
94 mt.set("__newindex", read_only.clone()).expect("table sets");
95 proxy.set_metatable(Some(mt));
96 globals.set(name, proxy).expect("global sets");
97 }
98 // `pcall`/`xpcall` would swallow the budget error; the rest reach shared tables or metatables.
99 for name in [
100 "dofile", "loadfile", "load", "require", "collectgarbage", "os", "io", "debug", "package",
101 "pcall", "xpcall", "rawget", "rawset", "rawequal", "getmetatable", "setmetatable", "_G",
102 ] {
103 let _ = globals.set(name, Value::Nil);
104 }
105
106 let instructions_used = Arc::new(AtomicU64::new(0));
107 let aborted = Arc::new(AtomicBool::new(false));
108 let counter = Arc::clone(&instructions_used);
109 let latch = Arc::clone(&aborted);
110 lua.set_hook(HookTriggers::new().every_nth_instruction(HOOK_STEP), move |_, _| {
111 if latch.load(Ordering::Relaxed)
112 || counter.fetch_add(u64::from(HOOK_STEP), Ordering::Relaxed) >= INSTRUCTION_BUDGET
113 {
114 latch.store(true, Ordering::Relaxed);
115 Err(mlua::Error::runtime("expression instruction budget exceeded"))
116 } else {
117 Ok(VmState::Continue)
118 }
119 });
120 lua.set_memory_limit(MEMORY_LIMIT).expect("memory limit applies");
121
122 Self { lua, instructions_used, aborted }
123 }
124
125 /// Evaluates `expr` in a fresh environment with a fresh instruction budget.
126 fn run(
127 &self,
128 expr: &str,
129 time: f64,
130 self_params: &HashMap<String, f64>,
131 self_points: &HashMap<String, [f64; 2]>,
132 env_nodes: &HashMap<String, HashMap<String, ExprValue>>,
133 ) -> Option<Value> {
134 let env = self.build_env(time, self_params, self_points, env_nodes).ok()?;
135 self.instructions_used.store(0, Ordering::Relaxed);
136 self.aborted.store(false, Ordering::Relaxed);
137 self.lua.load(&Self::expr_chunk(expr)).set_environment(env).eval().ok()
138 }
139
140 fn expr_chunk(expr: &str) -> String {
141 let trimmed = expr.trim_start();
142 if let Some(body) = trimmed.strip_prefix(':') {
143 body.to_owned()
113144 } else {
114 Ok(VmState::Continue)
145 format!("return ({expr})")
115146 }
116 });
117 lua.set_memory_limit(MEMORY_LIMIT).expect("memory limit applies");
147 }
118148
119 Self { lua, instructions_used, aborted }
120 }
149 /// Evaluates a Fusion SimpleExpression returning a number.
150 /// `env_nodes` provides `node_name -> (param_name -> value)` and `self_params` provides
151 /// unqualified parameter names on the current node.
152 pub fn eval_number(
153 &self,
154 expr: &str,
155 time: f64,
156 self_params: &HashMap<String, f64>,
157 self_points: &HashMap<String, [f64; 2]>,
158 env_nodes: &HashMap<String, HashMap<String, ExprValue>>,
159 ) -> Option<f64> {
160 let val = self.run(expr, time, self_params, self_points, env_nodes)?;
161 match val {
162 Value::Number(n) => Some(n),
163 Value::Integer(i) => Some(i as f64),
164 Value::Boolean(b) => Some(if b { 1.0 } else { 0.0 }),
165 Value::String(s) => s.to_str().ok()?.trim().parse::<f64>().ok(),
166 _ => None,
167 }
168 }
121169
122 /// Evaluates `expr` in a fresh environment with a fresh instruction budget.
123 fn run(
124 &self,
125 expr: &str,
126 time: f64,
127 self_params: &HashMap<String, f64>,
128 self_points: &HashMap<String, [f64; 2]>,
129 env_nodes: &HashMap<String, HashMap<String, ExprValue>>,
130 ) -> Option<Value> {
131 let env = self.build_env(time, self_params, self_points, env_nodes).ok()?;
132 self.instructions_used.store(0, Ordering::Relaxed);
133 self.aborted.store(false, Ordering::Relaxed);
134 self.lua.load(&Self::expr_chunk(expr)).set_environment(env).eval().ok()
135 }
170 /// Evaluates a Fusion SimpleExpression returning a 2D point `[x, y]`.
171 pub fn eval_point(
172 &self,
173 expr: &str,
174 time: f64,
175 self_params: &HashMap<String, f64>,
176 self_points: &HashMap<String, [f64; 2]>,
177 env_nodes: &HashMap<String, HashMap<String, ExprValue>>,
178 ) -> Option<[f64; 2]> {
179 let val = self.run(expr, time, self_params, self_points, env_nodes)?;
180 if let Value::Table(t) = val {
181 let x = t.get::<f64>("X").or_else(|_| t.get::<f64>(1)).ok()?;
182 let y = t.get::<f64>("Y").or_else(|_| t.get::<f64>(2)).ok()?;
183 return Some([x, y]);
184 }
185 None
186 }
136187
137 fn expr_chunk(expr: &str) -> String {
138 let trimmed = expr.trim_start();
139 if let Some(body) = trimmed.strip_prefix(':') {
140 body.to_owned()
141 } else {
142 format!("return ({expr})")
188 /// Evaluates a Fusion SimpleExpression returning a string.
189 pub fn eval_string(
190 &self,
191 expr: &str,
192 time: f64,
193 self_params: &HashMap<String, f64>,
194 self_points: &HashMap<String, [f64; 2]>,
195 env_nodes: &HashMap<String, HashMap<String, ExprValue>>,
196 ) -> Option<String> {
197 let val = self.run(expr, time, self_params, self_points, env_nodes)?;
198 match val {
199 Value::String(s) => Some(s.to_str().ok()?.to_owned()),
200 Value::Number(n) => Some(format!("{n}")),
201 Value::Integer(i) => Some(format!("{i}")),
202 Value::Table(t) => t.get::<String>("Value").ok(),
203 _ => None,
204 }
205 }
206
207 fn build_env(
208 &self,
209 time: f64,
210 self_params: &HashMap<String, f64>,
211 self_points: &HashMap<String, [f64; 2]>,
212 env_nodes: &HashMap<String, HashMap<String, ExprValue>>,
213 ) -> mlua::Result<mlua::Table> {
214 let env = self.lua.create_table()?;
215 let mt = self.lua.create_table()?;
216 mt.set("__index", self.lua.globals())?;
217 env.set_metatable(Some(mt));
218 env.set("time", time)?;
219 env.set("comp", self.lua.create_table()?)?;
220 for (k, v) in self_params {
221 env.set(k.as_str(), *v)?;
222 }
223 for (k, p) in self_points {
224 let pt = self.lua.create_table()?;
225 pt.set("X", p[0])?;
226 pt.set("Y", p[1])?;
227 pt.set(1, p[0])?;
228 pt.set(2, p[1])?;
229 env.set(k.as_str(), pt)?;
230 }
231 // Missing node fields default to 0 so expressions don't nil-crash.
232 let zero_mt = self.lua.create_table()?;
233 zero_mt.set("__index", self.lua.create_function(|_, _args: MultiValue| Ok(0.0_f64))?)?;
234 let text_mt = self.lua.create_table()?;
235 text_mt.set("__tostring", self.lua.create_function(|_, this: mlua::Table| this.get::<String>("Value"))?)?;
236 for (node_name, params) in env_nodes {
237 let nt = self.lua.create_table()?;
238 for (pk, pv) in params {
239 match pv {
240 ExprValue::Number(n) => nt.set(pk.as_str(), *n)?,
241 ExprValue::Text(s) => {
242 let text = self.lua.create_table()?;
243 text.set("Value", s.as_str())?;
244 text.set_metatable(Some(text_mt.clone()));
245 nt.set(pk.as_str(), text)?;
246 }
247 }
248 }
249 nt.set_metatable(Some(zero_mt.clone()));
250 env.set(node_name.as_str(), nt)?;
251 }
252 Ok(env)
143253 }
144254 }
145255
146 /// Evaluates a Fusion SimpleExpression returning a number.
147 /// `env_nodes` provides `node_name -> (param_name -> value)` and `self_params` provides
148 /// unqualified parameter names on the current node.
149 pub fn eval_number(
150 &self,
151 expr: &str,
152 time: f64,
153 self_params: &HashMap<String, f64>,
154 self_points: &HashMap<String, [f64; 2]>,
155 env_nodes: &HashMap<String, HashMap<String, ExprValue>>,
156 ) -> Option<f64> {
157 let val = self.run(expr, time, self_params, self_points, env_nodes)?;
158 match val {
159 Value::Number(n) => Some(n),
160 Value::Integer(i) => Some(i as f64),
161 Value::Boolean(b) => Some(if b { 1.0 } else { 0.0 }),
162 Value::String(s) => s.to_str().ok()?.trim().parse::<f64>().ok(),
163 _ => None,
256 #[cfg(test)]
257 mod tests {
258 use super::*;
259
260 fn num(expr: &str) -> Option<f64> {
261 let e = HashMap::new();
262 ExprEngine::new().eval_number(expr, 2.0, &HashMap::new(), &HashMap::new(), &e)
263 }
264
265 #[test]
266 fn fusion_expressions_still_evaluate() {
267 let v = num("time * 2 + math.sin(0.5)").unwrap();
268 assert!((v - (4.0 + 0.5_f64.sin())).abs() < 1e-12);
269 assert_eq!(num("clamp(5, 0, 1)"), Some(1.0));
270 assert_eq!(num(":local a = 3; return a * time"), Some(6.0));
271 }
272
273 #[test]
274 fn os_io_and_loaders_are_unavailable() {
275 let marker = std::env::temp_dir().join("fission_expr_sandbox_marker");
276 let _ = std::fs::remove_file(&marker);
277 let cmd = format!("os.execute('touch {}')", marker.display());
278 assert_eq!(num(&format!(":{cmd}; return 1")), None);
279 assert!(!marker.exists());
280 for src in [
281 "io.open('/etc/passwd')",
282 "require('os')",
283 "load('return 1')()",
284 "dofile('/etc/passwd')",
285 "debug.getinfo(1)",
286 "package.loaded",
287 "collectgarbage('count')",
288 ] {
289 assert_eq!(num(src), None, "{src}");
290 }
291 }
292
293 #[test]
294 fn runaway_loops_and_allocations_error_out() {
295 let engine = ExprEngine::new();
296 let e = HashMap::new();
297 let eval = |src: &str| engine.eval_number(src, 0.0, &HashMap::new(), &HashMap::new(), &e);
298 assert_eq!(eval(":while true do end"), None);
299 assert_eq!(eval(":local s = 'x'; while true do s = s .. s end"), None);
300 assert_eq!(eval("string.rep('x', 1e9) and 1"), None);
301 // Budget resets per evaluation, so the engine stays usable.
302 assert_eq!(eval("1 + 1"), Some(2.0));
303 }
304
305 #[test]
306 fn pcall_cannot_swallow_the_budget() {
307 let engine = ExprEngine::new();
308 let e = HashMap::new();
309 let eval = |src: &str| engine.eval_number(src, 0.0, &HashMap::new(), &HashMap::new(), &e);
310 let start = std::time::Instant::now();
311 assert_eq!(eval(":while true do pcall(function() while true do end end) end"), None);
312 assert_eq!(eval(":while true do xpcall(function() while true do end end, print) end"), None);
313 assert!(start.elapsed() < std::time::Duration::from_millis(50), "{:?}", start.elapsed());
314 assert_eq!(eval("1 + 1"), Some(2.0));
315 }
316
317 #[test]
318 fn evaluations_cannot_mutate_shared_state() {
319 let engine = ExprEngine::new();
320 let e = HashMap::new();
321 let eval = |src: &str| engine.eval_number(src, 0.0, &HashMap::new(), &HashMap::new(), &e);
322 for src in [
323 ":math.floor = function() return 42 end; return 1",
324 ":string.upper = function() return 42 end; return 1",
325 ":table.insert = nil; return 1",
326 ":_G.leak = 1; return 1",
327 ":getmetatable('').__index.upper = nil; return 1",
328 ":setmetatable(math, nil); return 1",
329 ] {
330 assert_eq!(eval(src), None, "{src}");
331 }
332 assert_eq!(eval(":floor = function() return 42 end; return floor(1.5)"), Some(42.0));
333 assert_eq!(eval("floor(1.5)"), Some(1.0));
334 assert_eq!(eval("math.floor(1.5)"), Some(1.0));
335 assert_eq!(eval("leak"), None);
336 let upper = engine.eval_string("('a'):upper()", 0.0, &HashMap::new(), &HashMap::new(), &e);
337 assert_eq!(upper.as_deref(), Some("A"));
338 assert_eq!(eval("string.len('abc') + select('#', table.unpack({1, 2}))"), Some(5.0));
164339 }
165340 }
341}
166342
167 /// Evaluates a Fusion SimpleExpression returning a 2D point `[x, y]`.
168 pub fn eval_point(
169 &self,
170 expr: &str,
171 time: f64,
172 self_params: &HashMap<String, f64>,
173 self_points: &HashMap<String, [f64; 2]>,
174 env_nodes: &HashMap<String, HashMap<String, ExprValue>>,
175 ) -> Option<[f64; 2]> {
176 let val = self.run(expr, time, self_params, self_points, env_nodes)?;
177 if let Value::Table(t) = val {
178 let x = t.get::<f64>("X").or_else(|_| t.get::<f64>(1)).ok()?;
179 let y = t.get::<f64>("Y").or_else(|_| t.get::<f64>(2)).ok()?;
180 return Some([x, y]);
181 }
182 None
343#[cfg(not(target_arch = "wasm32"))]
344pub use lua::ExprEngine;
345#[cfg(target_arch = "wasm32")]
346pub use pure::ExprEngine;
347
348/// Lua-subset evaluator for targets without a C toolchain: literals, `+ - * / // % ^ ..`,
349/// comparisons, `and`/`or`/`not`, calls, `a.b` / `a[b]`, the Fusion globals and `math.*`.
350/// Statement bodies (`:local x = ...`) and method calls are unsupported and evaluate to `None`.
351#[cfg(any(target_arch = "wasm32", test))]
352mod pure {
353 use super::ExprValue;
354 use std::collections::HashMap;
355
356 const MAX_DEPTH: usize = 64;
357 const MATH_FNS: &[&str] = &[
358 "abs", "acos", "asin", "atan", "ceil", "cos", "deg", "exp", "floor", "fmod", "log", "max", "min", "rad",
359 "sin", "sqrt", "tan",
360 ];
361 const GLOBAL_FNS: &[&str] = &[
362 "atan2", "clamp", "cosh", "iif", "log10", "mix", "mod", "pow", "Point", "sinh", "tanh", "Text",
363 "tonumber", "tostring",
364 ];
365
366 #[derive(Clone, Debug, PartialEq)]
367 enum Tok {
368 Num(f64),
369 Str(String),
370 Name(String),
371 Op(&'static str),
183372 }
184373
185 /// Evaluates a Fusion SimpleExpression returning a string.
186 pub fn eval_string(
187 &self,
188 expr: &str,
189 time: f64,
190 self_params: &HashMap<String, f64>,
191 self_points: &HashMap<String, [f64; 2]>,
192 env_nodes: &HashMap<String, HashMap<String, ExprValue>>,
193 ) -> Option<String> {
194 let val = self.run(expr, time, self_params, self_points, env_nodes)?;
195 match val {
196 Value::String(s) => Some(s.to_str().ok()?.to_owned()),
197 Value::Number(n) => Some(format!("{n}")),
198 Value::Integer(i) => Some(format!("{i}")),
199 Value::Table(t) => t.get::<String>("Value").ok(),
200 _ => None,
374 fn lex(src: &str) -> Option<Vec<Tok>> {
375 const OPS: &[&str] = &[
376 "..", "==", "~=", "<=", ">=", "//", "+", "-", "*", "/", "%", "^", "<", ">", "(", ")", "[", "]", ",", ".",
377 ];
378 let chars: Vec<char> = src.chars().collect();
379 let mut toks = Vec::new();
380 let mut i = 0;
381 while i < chars.len() {
382 let c = chars[i];
383 if c.is_whitespace() {
384 i += 1;
385 } else if c.is_ascii_digit() || (c == '.' && chars.get(i + 1).is_some_and(char::is_ascii_digit)) {
386 let start = i;
387 if c == '0' && matches!(chars.get(i + 1), Some('x' | 'X')) {
388 i += 2;
389 while chars.get(i).is_some_and(char::is_ascii_hexdigit) {
390 i += 1;
391 }
392 let digits: String = chars[start + 2..i].iter().collect();
393 toks.push(Tok::Num(u64::from_str_radix(&digits, 16).ok()? as f64));
394 continue;
395 }
396 while chars.get(i).is_some_and(char::is_ascii_digit) {
397 i += 1;
398 }
399 if chars.get(i) == Some(&'.') && chars.get(i + 1) != Some(&'.') {
400 i += 1;
401 while chars.get(i).is_some_and(char::is_ascii_digit) {
402 i += 1;
403 }
404 }
405 if matches!(chars.get(i), Some('e' | 'E')) {
406 i += 1;
407 if matches!(chars.get(i), Some('+' | '-')) {
408 i += 1;
409 }
410 while chars.get(i).is_some_and(char::is_ascii_digit) {
411 i += 1;
412 }
413 }
414 toks.push(Tok::Num(chars[start..i].iter().collect::<String>().parse().ok()?));
415 } else if c.is_alphabetic() || c == '_' {
416 let start = i;
417 while chars.get(i).is_some_and(|c| c.is_alphanumeric() || *c == '_') {
418 i += 1;
419 }
420 toks.push(Tok::Name(chars[start..i].iter().collect()));
421 } else if c == '"' || c == '\'' {
422 let mut s = String::new();
423 i += 1;
424 loop {
425 match *chars.get(i)? {
426 q if q == c => break,
427 '\\' => {
428 i += 1;
429 s.push(match *chars.get(i)? {
430 'n' => '\n',
431 't' => '\t',
432 other => other,
433 });
434 }
435 other => s.push(other),
436 }
437 i += 1;
438 }
439 i += 1;
440 toks.push(Tok::Str(s));
441 } else {
442 let rest: String = chars[i..chars.len().min(i + 2)].iter().collect();
443 let op = OPS.iter().find(|op| rest.starts_with(**op))?;
444 i += op.len();
445 toks.push(Tok::Op(op));
446 }
201447 }
448 Some(toks)
202449 }
203450
204 fn build_env(
205 &self,
206 time: f64,
207 self_params: &HashMap<String, f64>,
208 self_points: &HashMap<String, [f64; 2]>,
209 env_nodes: &HashMap<String, HashMap<String, ExprValue>>,
210 ) -> mlua::Result<mlua::Table> {
211 let env = self.lua.create_table()?;
212 let mt = self.lua.create_table()?;
213 mt.set("__index", self.lua.globals())?;
214 env.set_metatable(Some(mt));
215 env.set("time", time)?;
216 env.set("comp", self.lua.create_table()?)?;
217 for (k, v) in self_params {
218 env.set(k.as_str(), *v)?;
219 }
220 for (k, p) in self_points {
221 let pt = self.lua.create_table()?;
222 pt.set("X", p[0])?;
223 pt.set("Y", p[1])?;
224 pt.set(1, p[0])?;
225 pt.set(2, p[1])?;
226 env.set(k.as_str(), pt)?;
227 }
228 // Missing node fields default to 0 so expressions don't nil-crash.
229 let zero_mt = self.lua.create_table()?;
230 zero_mt.set("__index", self.lua.create_function(|_, _args: MultiValue| Ok(0.0_f64))?)?;
231 let text_mt = self.lua.create_table()?;
232 text_mt.set("__tostring", self.lua.create_function(|_, this: mlua::Table| this.get::<String>("Value"))?)?;
233 for (node_name, params) in env_nodes {
234 let nt = self.lua.create_table()?;
235 for (pk, pv) in params {
236 match pv {
237 ExprValue::Number(n) => nt.set(pk.as_str(), *n)?,
238 ExprValue::Text(s) => {
239 let text = self.lua.create_table()?;
240 text.set("Value", s.as_str())?;
241 text.set_metatable(Some(text_mt.clone()));
242 nt.set(pk.as_str(), text)?;
451 #[derive(Debug)]
452 enum Ast {
453 Nil,
454 Bool(bool),
455 Num(f64),
456 Str(String),
457 Name(String),
458 Index(Box<Ast>, Box<Ast>),
459 Call(Box<Ast>, Vec<Ast>),
460 Neg(Box<Ast>),
461 Not(Box<Ast>),
462 Bin(&'static str, Box<Ast>, Box<Ast>),
463 }
464
465 struct Parser {
466 toks: Vec<Tok>,
467 pos: usize,
468 depth: usize,
469 }
470
471 impl Parser {
472 fn peek(&self) -> Option<&Tok> {
473 self.toks.get(self.pos)
474 }
475
476 fn eat_op(&mut self, op: &str) -> bool {
477 let hit = matches!(self.peek(), Some(Tok::Op(o)) if *o == op);
478 self.pos += usize::from(hit);
479 hit
480 }
481
482 fn binary_op(&self) -> Option<(&'static str, u8, u8)> {
483 let op = match self.peek()? {
484 Tok::Op(op) => *op,
485 Tok::Name(n) if n == "and" => "and",
486 Tok::Name(n) if n == "or" => "or",
487 _ => return None,
488 };
489 // Lua precedence, lowest first; `..` and `^` are right associative.
490 let (left, right) = match op {
491 "or" => (1, 2),
492 "and" => (3, 4),
493 "<" | ">" | "<=" | ">=" | "==" | "~=" => (5, 6),
494 ".." => (9, 8),
495 "+" | "-" => (10, 11),
496 "*" | "/" | "//" | "%" => (12, 13),
497 "^" => (16, 15),
498 _ => return None,
499 };
500 Some((op, left, right))
501 }
502
503 fn expr(&mut self, min_bp: u8) -> Option<Ast> {
504 self.depth += 1;
505 let ast = if self.depth > MAX_DEPTH { None } else { self.binary(min_bp) };
506 self.depth -= 1;
507 ast
508 }
509
510 fn binary(&mut self, min_bp: u8) -> Option<Ast> {
511 let mut lhs = self.unary()?;
512 while let Some((op, left, right)) = self.binary_op() {
513 if left < min_bp {
514 break;
515 }
516 self.pos += 1;
517 let rhs = self.expr(right)?;
518 lhs = Ast::Bin(op, Box::new(lhs), Box::new(rhs));
519 }
520 Some(lhs)
521 }
522
523 fn unary(&mut self) -> Option<Ast> {
524 if self.eat_op("-") {
525 return Some(Ast::Neg(Box::new(self.expr(14)?)));
526 }
527 if matches!(self.peek(), Some(Tok::Name(n)) if n == "not") {
528 self.pos += 1;
529 return Some(Ast::Not(Box::new(self.expr(14)?)));
530 }
531 self.postfix()
532 }
533
534 fn postfix(&mut self) -> Option<Ast> {
535 let mut node = match self.toks.get(self.pos)?.clone() {
536 Tok::Num(n) => Ast::Num(n),
537 Tok::Str(s) => Ast::Str(s),
538 Tok::Name(n) => match n.as_str() {
539 "nil" => Ast::Nil,
540 "true" => Ast::Bool(true),
541 "false" => Ast::Bool(false),
542 "and" | "or" | "not" => return None,
543 _ => Ast::Name(n),
544 },
545 Tok::Op("(") => {
546 self.pos += 1;
547 let inner = self.expr(0)?;
548 if !matches!(self.peek(), Some(Tok::Op(")"))) {
549 return None;
550 }
551 inner
552 }
553 Tok::Op(_) => return None,
554 };
555 self.pos += 1;
556 loop {
557 if self.eat_op(".") {
558 let Some(Tok::Name(key)) = self.peek().cloned() else { return None };
559 self.pos += 1;
560 node = Ast::Index(Box::new(node), Box::new(Ast::Str(key)));
561 } else if self.eat_op("[") {
562 let key = self.expr(0)?;
563 if !self.eat_op("]") {
564 return None;
565 }
566 node = Ast::Index(Box::new(node), Box::new(key));
567 } else if self.eat_op("(") {
568 let mut args = Vec::new();
569 if !self.eat_op(")") {
570 loop {
571 args.push(self.expr(0)?);
572 if self.eat_op(")") {
573 break;
574 }
575 if !self.eat_op(",") {
576 return None;
577 }
578 }
243579 }
580 node = Ast::Call(Box::new(node), args);
581 } else {
582 return Some(node);
244583 }
245584 }
246 nt.set_metatable(Some(zero_mt.clone()));
247 env.set(node_name.as_str(), nt)?;
248585 }
249 Ok(env)
250586 }
251}
252587
253#[cfg(test)]
254mod tests {
255 use super::*;
588 #[derive(Clone, Debug, PartialEq)]
589 enum Val<'a> {
590 Nil,
591 Bool(bool),
592 Num(f64),
593 Str(String),
594 Point([f64; 2]),
595 /// `{ Value = "..." }` that also stringifies.
596 Text(String),
597 Node(&'a HashMap<String, ExprValue>),
598 Math,
599 Func(&'static str),
600 }
601
602 impl Val<'_> {
603 fn truthy(&self) -> bool {
604 !matches!(self, Val::Nil | Val::Bool(false))
605 }
256606
257 fn num(expr: &str) -> Option<f64> {
258 let e = HashMap::new();
259 ExprEngine::new().eval_number(expr, 2.0, &HashMap::new(), &HashMap::new(), &e)
607 /// Lua's arithmetic coercion: numbers and numeric strings.
608 fn num(&self) -> Option<f64> {
609 match self {
610 Val::Num(n) => Some(*n),
611 Val::Str(s) => s.trim().parse().ok(),
612 _ => None,
613 }
614 }
615
616 fn text(&self) -> Option<String> {
617 match self {
618 Val::Num(n) => Some(format!("{n}")),
619 Val::Str(s) | Val::Text(s) => Some(s.clone()),
620 _ => None,
621 }
622 }
260623 }
261624
262 #[test]
263 fn fusion_expressions_still_evaluate() {
264 let v = num("time * 2 + math.sin(0.5)").unwrap();
265 assert!((v - (4.0 + 0.5_f64.sin())).abs() < 1e-12);
266 assert_eq!(num("clamp(5, 0, 1)"), Some(1.0));
267 assert_eq!(num(":local a = 3; return a * time"), Some(6.0));
625 struct Scope<'a> {
626 time: f64,
627 params: &'a HashMap<String, f64>,
628 points: &'a HashMap<String, [f64; 2]>,
629 nodes: &'a HashMap<String, HashMap<String, ExprValue>>,
268630 }
269631
270 #[test]
271 fn os_io_and_loaders_are_unavailable() {
272 let marker = std::env::temp_dir().join("fission_expr_sandbox_marker");
273 let _ = std::fs::remove_file(&marker);
274 let cmd = format!("os.execute('touch {}')", marker.display());
275 assert_eq!(num(&format!(":{cmd}; return 1")), None);
276 assert!(!marker.exists());
277 for src in [
278 "io.open('/etc/passwd')",
279 "require('os')",
280 "load('return 1')()",
281 "dofile('/etc/passwd')",
282 "debug.getinfo(1)",
283 "package.loaded",
284 "collectgarbage('count')",
285 ] {
286 assert_eq!(num(src), None, "{src}");
632 impl<'a> Scope<'a> {
633 /// Nodes shadow points shadow params shadow `time` shadow the stdlib, as in the Lua env.
634 fn name(&self, name: &str) -> Val<'a> {
635 if let Some(node) = self.nodes.get(name) {
636 Val::Node(node)
637 } else if let Some(p) = self.points.get(name) {
638 Val::Point(*p)
639 } else if let Some(n) = self.params.get(name) {
640 Val::Num(*n)
641 } else if name == "time" {
642 Val::Num(self.time)
643 } else if name == "pi" {
644 Val::Num(std::f64::consts::PI)
645 } else if name == "math" {
646 Val::Math
647 } else if let Some(f) = MATH_FNS.iter().chain(GLOBAL_FNS).find(|f| **f == name) {
648 Val::Func(f)
649 } else {
650 Val::Nil
651 }
652 }
653
654 fn eval(&self, ast: &Ast) -> Option<Val<'a>> {
655 Some(match ast {
656 Ast::Nil => Val::Nil,
657 Ast::Bool(b) => Val::Bool(*b),
658 Ast::Num(n) => Val::Num(*n),
659 Ast::Str(s) => Val::Str(s.clone()),
660 Ast::Name(n) => self.name(n),
661 Ast::Neg(a) => Val::Num(-self.eval(a)?.num()?),
662 Ast::Not(a) => Val::Bool(!self.eval(a)?.truthy()),
663 Ast::Index(base, key) => index(self.eval(base)?, self.eval(key)?)?,
664 Ast::Call(callee, args) => {
665 let Val::Func(name) = self.eval(callee)? else { return None };
666 let args = args.iter().map(|a| self.eval(a)).collect::<Option<Vec<_>>>()?;
667 call(name, &args)?
668 }
669 Ast::Bin("and", a, b) => {
670 let a = self.eval(a)?;
671 if a.truthy() { self.eval(b)? } else { a }
672 }
673 Ast::Bin("or", a, b) => {
674 let a = self.eval(a)?;
675 if a.truthy() { a } else { self.eval(b)? }
676 }
677 Ast::Bin(op, a, b) => binary(op, self.eval(a)?, self.eval(b)?)?,
678 })
287679 }
288680 }
289681
290 #[test]
291 fn runaway_loops_and_allocations_error_out() {
292 let engine = ExprEngine::new();
293 let e = HashMap::new();
294 let eval = |src: &str| engine.eval_number(src, 0.0, &HashMap::new(), &HashMap::new(), &e);
295 assert_eq!(eval(":while true do end"), None);
296 assert_eq!(eval(":local s = 'x'; while true do s = s .. s end"), None);
297 assert_eq!(eval("string.rep('x', 1e9) and 1"), None);
298 // Budget resets per evaluation, so the engine stays usable.
299 assert_eq!(eval("1 + 1"), Some(2.0));
682 fn index<'a>(base: Val<'a>, key: Val<'a>) -> Option<Val<'a>> {
683 Some(match (base, key) {
684 (Val::Node(fields), key) => match key {
685 Val::Str(k) => match fields.get(&k) {
686 Some(ExprValue::Number(n)) => Val::Num(*n),
687 Some(ExprValue::Text(s)) => Val::Text(s.clone()),
688 None => Val::Num(0.0),
689 },
690 _ => Val::Num(0.0),
691 },
692 (Val::Text(s), Val::Str(k)) if k == "Value" => Val::Str(s),
693 (Val::Text(_), _) => Val::Nil,
694 (Val::Point(p), Val::Str(k)) if k == "X" => Val::Num(p[0]),
695 (Val::Point(p), Val::Str(k)) if k == "Y" => Val::Num(p[1]),
696 (Val::Point(p), Val::Num(1.0)) => Val::Num(p[0]),
697 (Val::Point(p), Val::Num(2.0)) => Val::Num(p[1]),
698 (Val::Point(_), _) => Val::Nil,
699 (Val::Math, Val::Str(k)) => match k.as_str() {
700 "pi" => Val::Num(std::f64::consts::PI),
701 "huge" => Val::Num(f64::INFINITY),
702 _ => MATH_FNS.iter().find(|f| **f == k).map_or(Val::Nil, |f| Val::Func(f)),
703 },
704 _ => return None,
705 })
300706 }
301707
302 #[test]
303 fn pcall_cannot_swallow_the_budget() {
304 let engine = ExprEngine::new();
305 let e = HashMap::new();
306 let eval = |src: &str| engine.eval_number(src, 0.0, &HashMap::new(), &HashMap::new(), &e);
307 let start = std::time::Instant::now();
308 assert_eq!(eval(":while true do pcall(function() while true do end end) end"), None);
309 assert_eq!(eval(":while true do xpcall(function() while true do end end, print) end"), None);
310 assert!(start.elapsed() < std::time::Duration::from_millis(50), "{:?}", start.elapsed());
311 assert_eq!(eval("1 + 1"), Some(2.0));
708 fn binary<'a>(op: &str, a: Val<'a>, b: Val<'a>) -> Option<Val<'a>> {
709 use std::cmp::Ordering;
710 let ordering = |a: &Val, b: &Val| match (a, b) {
711 (Val::Num(a), Val::Num(b)) => a.partial_cmp(b).map(Some),
712 (Val::Str(a), Val::Str(b)) => Some(Some(a.cmp(b))),
713 _ => None,
714 };
715 Some(match op {
716 "==" => Val::Bool(a == b),
717 "~=" => Val::Bool(a != b),
718 "<" => Val::Bool(ordering(&a, &b)?.is_some_and(|o| o == Ordering::Less)),
719 "<=" => Val::Bool(ordering(&a, &b)?.is_some_and(|o| o != Ordering::Greater)),
720 ">" => Val::Bool(ordering(&a, &b)?.is_some_and(|o| o == Ordering::Greater)),
721 ">=" => Val::Bool(ordering(&a, &b)?.is_some_and(|o| o != Ordering::Less)),
722 ".." => Val::Str(a.text()? + &b.text()?),
723 _ => {
724 let (a, b) = (a.num()?, b.num()?);
725 Val::Num(match op {
726 "+" => a + b,
727 "-" => a - b,
728 "*" => a * b,
729 "/" => a / b,
730 "//" => (a / b).floor(),
731 "%" => a - (a / b).floor() * b,
732 "^" => a.powf(b),
733 _ => return None,
734 })
735 }
736 })
312737 }
313738
739 fn call<'a>(name: &str, args: &[Val<'a>]) -> Option<Val<'a>> {
740 let arg = |i: usize| args.get(i).and_then(Val::num);
741 let unary: Option<fn(f64) -> f64> = match name {
742 "abs" => Some(f64::abs),
743 "acos" => Some(f64::acos),
744 "asin" => Some(f64::asin),
745 "ceil" => Some(f64::ceil),
746 "cos" => Some(f64::cos),
747 "cosh" => Some(f64::cosh),
748 "deg" => Some(f64::to_degrees),
749 "exp" => Some(f64::exp),
750 "floor" => Some(f64::floor),
751 "log10" => Some(f64::log10),
752 "rad" => Some(f64::to_radians),
753 "sin" => Some(f64::sin),
754 "sinh" => Some(f64::sinh),
755 "sqrt" => Some(f64::sqrt),
756 "tan" => Some(f64::tan),
757 "tanh" => Some(f64::tanh),
758 _ => None,
759 };
760 if let Some(f) = unary {
761 return Some(Val::Num(f(arg(0)?)));
762 }
763 Some(match name {
764 "atan" | "atan2" => Val::Num(match arg(1) {
765 Some(x) => arg(0)?.atan2(x),
766 None => arg(0)?.atan(),
767 }),
768 "fmod" | "mod" => Val::Num(arg(0)? % arg(1)?),
769 "pow" => Val::Num(arg(0)?.powf(arg(1)?)),
770 "log" => Val::Num(match arg(1) {
771 Some(2.0) => arg(0)?.log2(),
772 Some(10.0) => arg(0)?.log10(),
773 Some(base) => arg(0)?.ln() / base.ln(),
774 None => arg(0)?.ln(),
775 }),
776 "max" | "min" => {
777 let mut nums = (0..args.len()).map(arg);
778 let first = nums.next()??;
779 let pick = if name == "max" { f64::max } else { f64::min };
780 Val::Num(nums.try_fold(first, |acc, n| n.map(|n| pick(acc, n)))?)
781 }
782 "iif" => {
783 let cond = args.first()?;
784 let pass = cond.truthy() && cond.num() != Some(0.0);
785 args.get(if pass { 1 } else { 2 }).cloned().unwrap_or(Val::Nil)
786 }
787 "clamp" => {
788 let (x, lo, hi) = (arg(0)?, arg(1)?, arg(2)?);
789 Val::Num(if x < lo { lo } else if x > hi { hi } else { x })
790 }
791 "mix" => Val::Num(arg(0)? + (arg(1)? - arg(0)?) * arg(2)?),
792 "Point" => Val::Point([arg(0).unwrap_or(0.0), arg(1).unwrap_or(0.0)]),
793 "Text" | "tostring" => Val::Str(args.first().map_or(Some(String::new()), Val::text)?),
794 "tonumber" => args.first()?.num().map_or(Val::Nil, Val::Num),
795 _ => return None,
796 })
797 }
798
799 #[derive(Default)]
800 pub struct ExprEngine;
801
802 impl ExprEngine {
803 pub fn new() -> Self {
804 Self
805 }
806
807 fn run<R>(
808 &self,
809 expr: &str,
810 time: f64,
811 self_params: &HashMap<String, f64>,
812 self_points: &HashMap<String, [f64; 2]>,
813 env_nodes: &HashMap<String, HashMap<String, ExprValue>>,
814 read: impl FnOnce(Val) -> Option<R>,
815 ) -> Option<R> {
816 let body = match expr.trim_start().strip_prefix(':') {
817 Some(stmt) => stmt.trim_start().strip_prefix("return ")?,
818 None => expr,
819 };
820 let mut parser = Parser { toks: lex(body)?, pos: 0, depth: 0 };
821 let ast = parser.expr(0)?;
822 if parser.pos != parser.toks.len() {
823 return None;
824 }
825 let scope = Scope { time, params: self_params, points: self_points, nodes: env_nodes };
826 read(scope.eval(&ast)?)
827 }
828
829 pub fn eval_number(
830 &self,
831 expr: &str,
832 time: f64,
833 self_params: &HashMap<String, f64>,
834 self_points: &HashMap<String, [f64; 2]>,
835 env_nodes: &HashMap<String, HashMap<String, ExprValue>>,
836 ) -> Option<f64> {
837 self.run(expr, time, self_params, self_points, env_nodes, |v| match v {
838 Val::Bool(b) => Some(f64::from(b)),
839 other => other.num(),
840 })
841 }
842
843 pub fn eval_point(
844 &self,
845 expr: &str,
846 time: f64,
847 self_params: &HashMap<String, f64>,
848 self_points: &HashMap<String, [f64; 2]>,
849 env_nodes: &HashMap<String, HashMap<String, ExprValue>>,
850 ) -> Option<[f64; 2]> {
851 self.run(expr, time, self_params, self_points, env_nodes, |v| match v {
852 Val::Point(p) => Some(p),
853 _ => None,
854 })
855 }
856
857 pub fn eval_string(
858 &self,
859 expr: &str,
860 time: f64,
861 self_params: &HashMap<String, f64>,
862 self_points: &HashMap<String, [f64; 2]>,
863 env_nodes: &HashMap<String, HashMap<String, ExprValue>>,
864 ) -> Option<String> {
865 self.run(expr, time, self_params, self_points, env_nodes, |v| v.text())
866 }
867 }
868
869 #[cfg(test)]
870 mod tests {
871 use super::*;
872
873 fn nodes() -> HashMap<String, HashMap<String, ExprValue>> {
874 HashMap::from([(
875 "Ctl".to_owned(),
876 HashMap::from([
877 ("Size".to_owned(), ExprValue::Number(0.25)),
878 ("StyledText".to_owned(), ExprValue::Text("hi".to_owned())),
879 ]),
880 )])
881 }
882
883 fn num(expr: &str, time: f64) -> Option<f64> {
884 let params = HashMap::from([("Width".to_owned(), 8.0)]);
885 let points = HashMap::from([("Center".to_owned(), [0.5, 0.25])]);
886 ExprEngine::new().eval_number(expr, time, &params, &points, &nodes())
887 }
888
889 #[test]
890 fn falling_comp_expressions() {
891 assert_eq!(num("floor(time/3)*3", 7.0), Some(6.0));
892 assert_eq!(num("floor(time/2)/4", 9.0), Some(1.0));
893 assert_eq!(num("floor(time/5)*42", 11.0), Some(84.0));
894 assert_eq!(num("math.floor(time / 5) * 42", 11.0), Some(84.0));
895 }
896
897 #[test]
898 fn precedence_and_associativity() {
899 assert_eq!(num("-2^2", 0.0), Some(-4.0));
900 assert_eq!(num("2^3^2", 0.0), Some(512.0));
901 assert_eq!(num("2^-1", 0.0), Some(0.5));
902 assert_eq!(num("1 + 2 * 3 - 4 / 2", 0.0), Some(5.0));
903 assert_eq!(num("-7 % 3", 0.0), Some(2.0));
904 assert_eq!(num("7 // 2", 0.0), Some(3.0));
905 assert_eq!(num("1 .. 2 + 1", 0.0), Some(13.0));
906 }
907
908 #[test]
909 fn logic_and_ternaries() {
910 assert_eq!(num("iif(time > 1, 10, 20)", 2.0), Some(10.0));
911 assert_eq!(num("iif(0, 10, 20)", 2.0), Some(20.0));
912 assert_eq!(num("time > 1 and 5 or 6", 0.0), Some(6.0));
913 assert_eq!(num("nil or 3", 0.0), Some(3.0));
914 assert_eq!(num("not (1 == 1)", 0.0), Some(0.0));
915 assert_eq!(num("clamp(5, 0, 1) + min(3, 2, 9) + max(1, 4)", 0.0), Some(7.0));
916 assert_eq!(num("mix(10, 20, 0.5)", 0.0), Some(15.0));
917 }
918
919 #[test]
920 fn scope_lookups() {
921 assert_eq!(num("Width * 2", 0.0), Some(16.0));
922 assert_eq!(num("Center.X + Center[2]", 0.0), Some(0.75));
923 assert_eq!(num("Ctl.Size", 0.0), Some(0.25));
924 assert_eq!(num("Ctl.Missing", 0.0), Some(0.0));
925 assert_eq!(num("Nope.Size", 0.0), None);
926 assert_eq!(num("sin(pi / 2) + atan(1, 1) * 0", 0.0), Some(1.0));
927 }
928
929 #[test]
930 fn points_and_strings() {
931 let e = ExprEngine::new();
932 let (p, q, n) = (HashMap::new(), HashMap::new(), nodes());
933 assert_eq!(e.eval_point("Point(time, 0.5)", 2.0, &p, &q, &n), Some([2.0, 0.5]));
934 assert_eq!(e.eval_string("Ctl.StyledText.Value .. '!'", 0.0, &p, &q, &n).as_deref(), Some("hi!"));
935 assert_eq!(e.eval_string("Ctl.StyledText", 0.0, &p, &q, &n).as_deref(), Some("hi"));
936 assert_eq!(e.eval_string("Text('f' .. time)", 3.0, &p, &q, &n).as_deref(), Some("f3"));
937 assert_eq!(e.eval_string("time", 2.5, &p, &q, &n).as_deref(), Some("2.5"));
938 }
939
940 #[test]
941 fn unsupported_and_malformed_input_is_none() {
942 for src in ["", "1 +", "(1", "1 2", "foo(1)", "'a':upper()", ":local a = 1; return a", "1 @ 2", "'abc", "{}"] {
943 assert_eq!(num(src, 0.0), None, "{src:?}");
944 }
945 assert_eq!(num(":return time * 2", 2.0), Some(4.0));
946 assert_eq!(num(&"(".repeat(200), 0.0), None);
947 }
948 }
949}
950
951#[cfg(test)]
952mod parity {
953 use super::{ExprEngine, ExprValue, pure};
954 use std::collections::HashMap;
955
314956 #[test]
315 fn evaluations_cannot_mutate_shared_state() {
316 let engine = ExprEngine::new();
317 let e = HashMap::new();
318 let eval = |src: &str| engine.eval_number(src, 0.0, &HashMap::new(), &HashMap::new(), &e);
319 for src in [
320 ":math.floor = function() return 42 end; return 1",
321 ":string.upper = function() return 42 end; return 1",
322 ":table.insert = nil; return 1",
323 ":_G.leak = 1; return 1",
324 ":getmetatable('').__index.upper = nil; return 1",
325 ":setmetatable(math, nil); return 1",
326 ] {
327 assert_eq!(eval(src), None, "{src}");
328 }
329 assert_eq!(eval(":floor = function() return 42 end; return floor(1.5)"), Some(42.0));
330 assert_eq!(eval("floor(1.5)"), Some(1.0));
331 assert_eq!(eval("math.floor(1.5)"), Some(1.0));
332 assert_eq!(eval("leak"), None);
333 let upper = engine.eval_string("('a'):upper()", 0.0, &HashMap::new(), &HashMap::new(), &e);
334 assert_eq!(upper.as_deref(), Some("A"));
335 assert_eq!(eval("string.len('abc') + select('#', table.unpack({1, 2}))"), Some(5.0));
957 fn pure_matches_lua_on_shared_subset() {
958 let params = HashMap::from([("Width".to_owned(), 8.0)]);
959 let points = HashMap::from([("Center".to_owned(), [0.5, 0.25])]);
960 let nodes = HashMap::from([(
961 "Ctl".to_owned(),
962 HashMap::from([("Size".to_owned(), ExprValue::Number(0.25))]),
963 )]);
964 let (lua, pure) = (ExprEngine::new(), pure::ExprEngine::new());
965 for time in [0.0, 2.5, 7.0, 11.0] {
966 for src in [
967 "floor(time/3)*3",
968 "floor(time/2)/4",
969 "floor(time/5)*42",
970 "time * 2 + math.sin(0.5)",
971 "-2^2",
972 "2^3^2",
973 "-7 % 3",
974 "7 // 2",
975 "iif(time > 3, 10, 20)",
976 "time > 3 and 5 or 6",
977 "clamp(time, 1, 4) + mix(1, 3, 0.5)",
978 "Width / 3 + Center.X + Center[2] + Ctl.Size + Ctl.Missing",
979 "atan(1, 2) + atan2(1, 2) + log(8, 2) + log10(100) + fmod(-7, 3) + pow(2, 0.5)",
980 "max(1, time, 3) + min(time, 9) + abs(-time) + ceil(time) + sqrt(time)",
981 "cosh(time) + sinh(time) + tanh(time) + deg(1) + rad(90)",
982 "time ~= 2.5",
983 "'10' + 1",
984 "Nope.Size",
985 "1 +",
986 ] {
987 let args = (src, time, &params, &points, &nodes);
988 let l = lua.eval_number(args.0, args.1, args.2, args.3, args.4);
989 let p = pure.eval_number(args.0, args.1, args.2, args.3, args.4);
990 match (l, p) {
991 (Some(l), Some(p)) => assert!((l - p).abs() < 1e-9 || (l.is_nan() && p.is_nan()), "{src} @ {time}: {l} vs {p}"),
992 _ => assert_eq!(l, p, "{src} @ {time}"),
993 }
994 }
995 }
336996 }
337997}
crates/web/.gitignore created+2
......@@ -0,0 +1,2 @@
1/target
2/dist
crates/web/Cargo.lock created+2605
......@@ -0,0 +1,2605 @@
1# This file is automatically @generated by Cargo.
2# It is not intended for manual editing.
3version = 4
4
5[[package]]
6name = "adler2"
7version = "2.0.1"
8source = "registry+https://github.com/rust-lang/crates.io-index"
9checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
10
11[[package]]
12name = "aho-corasick"
13version = "1.1.5"
14source = "registry+https://github.com/rust-lang/crates.io-index"
15checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba"
16dependencies = [
17 "memchr",
18]
19
20[[package]]
21name = "allocator-api2"
22version = "0.2.22"
23source = "registry+https://github.com/rust-lang/crates.io-index"
24checksum = "57b212daf2e827b1ccdd778b7eb48ba433e58cb0e4f27b43cd6b7a608425a014"
25
26[[package]]
27name = "alsa"
28version = "0.9.1"
29source = "registry+https://github.com/rust-lang/crates.io-index"
30checksum = "ed7572b7ba83a31e20d1b48970ee402d2e3e0537dcfe0a3ff4d6eb7508617d43"
31dependencies = [
32 "alsa-sys",
33 "bitflags 2.13.2",
34 "cfg-if",
35 "libc",
36]
37
38[[package]]
39name = "alsa-sys"
40version = "0.3.1"
41source = "registry+https://github.com/rust-lang/crates.io-index"
42checksum = "db8fee663d06c4e303404ef5f40488a53e062f89ba8bfed81f42325aafad1527"
43dependencies = [
44 "libc",
45 "pkg-config",
46]
47
48[[package]]
49name = "android_system_properties"
50version = "0.1.6"
51source = "registry+https://github.com/rust-lang/crates.io-index"
52checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc"
53dependencies = [
54 "libc",
55]
56
57[[package]]
58name = "arrayvec"
59version = "0.7.9"
60source = "registry+https://github.com/rust-lang/crates.io-index"
61checksum = "47a64a0fd06e123e9e3cf3ad01432af17dcab8185e8023edcf184fe696f9675d"
62
63[[package]]
64name = "ash"
65version = "0.38.0+1.3.281"
66source = "registry+https://github.com/rust-lang/crates.io-index"
67checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f"
68dependencies = [
69 "libloading",
70]
71
72[[package]]
73name = "autocfg"
74version = "1.5.1"
75source = "registry+https://github.com/rust-lang/crates.io-index"
76checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
77
78[[package]]
79name = "bindgen"
80version = "0.72.1"
81source = "registry+https://github.com/rust-lang/crates.io-index"
82checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
83dependencies = [
84 "bitflags 2.13.2",
85 "cexpr",
86 "clang-sys",
87 "itertools",
88 "proc-macro2",
89 "quote",
90 "regex",
91 "rustc-hash 2.1.3",
92 "shlex 1.3.0",
93 "syn 2.0.119",
94]
95
96[[package]]
97name = "bit-set"
98version = "0.10.0"
99source = "registry+https://github.com/rust-lang/crates.io-index"
100checksum = "09ec2f926cc3060f09db9ebc5b52823d85268d24bb917e472c0c4bea35780a7d"
101dependencies = [
102 "bit-vec",
103]
104
105[[package]]
106name = "bit-vec"
107version = "0.9.1"
108source = "registry+https://github.com/rust-lang/crates.io-index"
109checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51"
110
111[[package]]
112name = "bit_field"
113version = "0.10.4"
114source = "registry+https://github.com/rust-lang/crates.io-index"
115checksum = "cb2907cc03d08cdb1c6724ad0670ce67c4a71e1c45a6d7635224011714cfc4b1"
116
117[[package]]
118name = "bitflags"
119version = "1.3.2"
120source = "registry+https://github.com/rust-lang/crates.io-index"
121checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
122
123[[package]]
124name = "bitflags"
125version = "2.13.2"
126source = "registry+https://github.com/rust-lang/crates.io-index"
127checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
128
129[[package]]
130name = "block2"
131version = "0.6.2"
132source = "registry+https://github.com/rust-lang/crates.io-index"
133checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5"
134dependencies = [
135 "objc2",
136]
137
138[[package]]
139name = "bstr"
140version = "1.14.0"
141source = "registry+https://github.com/rust-lang/crates.io-index"
142checksum = "a680398c10c7bc0488067c4612226ea905a85f607134b69f3068d505d58c4214"
143dependencies = [
144 "memchr",
145 "serde_core",
146]
147
148[[package]]
149name = "bumpalo"
150version = "3.20.4"
151source = "registry+https://github.com/rust-lang/crates.io-index"
152checksum = "87a0cf66fd1eb2fb7b822cb78370d82303750809bc6ba855f3f58e517d3238db"
153
154[[package]]
155name = "bytemuck"
156version = "1.25.2"
157source = "registry+https://github.com/rust-lang/crates.io-index"
158checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797"
159dependencies = [
160 "bytemuck_derive",
161]
162
163[[package]]
164name = "bytemuck_derive"
165version = "1.12.1"
166source = "registry+https://github.com/rust-lang/crates.io-index"
167checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c"
168dependencies = [
169 "proc-macro2",
170 "quote",
171 "syn 3.0.10",
172]
173
174[[package]]
175name = "byteorder-lite"
176version = "0.1.0"
177source = "registry+https://github.com/rust-lang/crates.io-index"
178checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
179
180[[package]]
181name = "bytes"
182version = "1.12.2"
183source = "registry+https://github.com/rust-lang/crates.io-index"
184checksum = "776dfebd015e2d8732c684a2c71003674ccb49457b539b9e82151ba38e96dd7c"
185
186[[package]]
187name = "cc"
188version = "1.12.0"
189source = "registry+https://github.com/rust-lang/crates.io-index"
190checksum = "95e45cf2980b2d467be49a9ed942c9179b701063a7ca3d037de7ee9bd67f8d66"
191dependencies = [
192 "find-msvc-tools",
193 "jobserver",
194 "libc",
195 "shlex 2.0.1",
196]
197
198[[package]]
199name = "cesu8"
200version = "1.1.0"
201source = "registry+https://github.com/rust-lang/crates.io-index"
202checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
203
204[[package]]
205name = "cexpr"
206version = "0.6.0"
207source = "registry+https://github.com/rust-lang/crates.io-index"
208checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
209dependencies = [
210 "nom",
211]
212
213[[package]]
214name = "cfg-if"
215version = "1.0.5"
216source = "registry+https://github.com/rust-lang/crates.io-index"
217checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
218
219[[package]]
220name = "cfg_aliases"
221version = "0.2.2"
222source = "registry+https://github.com/rust-lang/crates.io-index"
223checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527"
224
225[[package]]
226name = "clang-sys"
227version = "1.9.1"
228source = "registry+https://github.com/rust-lang/crates.io-index"
229checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a"
230dependencies = [
231 "glob",
232 "libc",
233 "libloading",
234]
235
236[[package]]
237name = "codespan-reporting"
238version = "0.13.1"
239source = "registry+https://github.com/rust-lang/crates.io-index"
240checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681"
241dependencies = [
242 "serde",
243 "termcolor",
244 "unicode-width",
245]
246
247[[package]]
248name = "combine"
249version = "4.6.9"
250source = "registry+https://github.com/rust-lang/crates.io-index"
251checksum = "4356eba6976435498d05a311ee9fc486da3bc81c200d3f0d7dd9703b41913f92"
252dependencies = [
253 "bytes",
254 "memchr",
255]
256
257[[package]]
258name = "console_error_panic_hook"
259version = "0.1.7"
260source = "registry+https://github.com/rust-lang/crates.io-index"
261checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc"
262dependencies = [
263 "cfg-if",
264 "wasm-bindgen",
265]
266
267[[package]]
268name = "core-foundation-sys"
269version = "0.8.7"
270source = "registry+https://github.com/rust-lang/crates.io-index"
271checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
272
273[[package]]
274name = "core_detect"
275version = "1.0.0"
276source = "registry+https://github.com/rust-lang/crates.io-index"
277checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48"
278
279[[package]]
280name = "core_maths"
281version = "0.1.1"
282source = "registry+https://github.com/rust-lang/crates.io-index"
283checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30"
284dependencies = [
285 "libm",
286]
287
288[[package]]
289name = "coreaudio-rs"
290version = "0.11.3"
291source = "registry+https://github.com/rust-lang/crates.io-index"
292checksum = "321077172d79c662f64f5071a03120748d5bb652f5231570141be24cfcd2bace"
293dependencies = [
294 "bitflags 1.3.2",
295 "core-foundation-sys",
296 "coreaudio-sys",
297]
298
299[[package]]
300name = "coreaudio-sys"
301version = "0.2.18"
302source = "registry+https://github.com/rust-lang/crates.io-index"
303checksum = "b9b4739a805a62757a83e5654fa3faabec0442666b263bb2287d5a8185bfd953"
304dependencies = [
305 "bindgen",
306]
307
308[[package]]
309name = "cpal"
310version = "0.15.3"
311source = "registry+https://github.com/rust-lang/crates.io-index"
312checksum = "873dab07c8f743075e57f524c583985fbaf745602acbe916a01539364369a779"
313dependencies = [
314 "alsa",
315 "core-foundation-sys",
316 "coreaudio-rs",
317 "dasp_sample",
318 "jni",
319 "js-sys",
320 "libc",
321 "mach2",
322 "ndk",
323 "ndk-context",
324 "oboe",
325 "wasm-bindgen",
326 "wasm-bindgen-futures",
327 "web-sys",
328 "windows 0.54.0",
329]
330
331[[package]]
332name = "crc32fast"
333version = "1.5.6"
334source = "registry+https://github.com/rust-lang/crates.io-index"
335checksum = "fd9ae8fcb3ea71b0b26338b4ffb13006bb175de8fd07921089a906ce7e5e6945"
336dependencies = [
337 "cfg-if",
338]
339
340[[package]]
341name = "crossbeam-deque"
342version = "0.8.8"
343source = "registry+https://github.com/rust-lang/crates.io-index"
344checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a"
345dependencies = [
346 "crossbeam-epoch",
347 "crossbeam-utils",
348]
349
350[[package]]
351name = "crossbeam-epoch"
352version = "0.9.21"
353source = "registry+https://github.com/rust-lang/crates.io-index"
354checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d"
355dependencies = [
356 "crossbeam-utils",
357]
358
359[[package]]
360name = "crossbeam-utils"
361version = "0.8.23"
362source = "registry+https://github.com/rust-lang/crates.io-index"
363checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6"
364
365[[package]]
366name = "crunchy"
367version = "0.2.4"
368source = "registry+https://github.com/rust-lang/crates.io-index"
369checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
370
371[[package]]
372name = "dasp_sample"
373version = "0.11.0"
374source = "registry+https://github.com/rust-lang/crates.io-index"
375checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f"
376
377[[package]]
378name = "dispatch2"
379version = "0.3.1"
380source = "registry+https://github.com/rust-lang/crates.io-index"
381checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38"
382dependencies = [
383 "bitflags 2.13.2",
384 "objc2",
385]
386
387[[package]]
388name = "dlib"
389version = "0.5.3"
390source = "registry+https://github.com/rust-lang/crates.io-index"
391checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a"
392dependencies = [
393 "libloading",
394]
395
396[[package]]
397name = "document-features"
398version = "0.2.12"
399source = "registry+https://github.com/rust-lang/crates.io-index"
400checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61"
401dependencies = [
402 "litrs",
403]
404
405[[package]]
406name = "either"
407version = "1.19.0"
408source = "registry+https://github.com/rust-lang/crates.io-index"
409checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
410
411[[package]]
412name = "encoding_rs"
413version = "0.8.44"
414source = "registry+https://github.com/rust-lang/crates.io-index"
415checksum = "89253175e704ab869b04f9db224d38630e0211a53841a79181deae0889e169f5"
416dependencies = [
417 "cfg-if",
418 "core_detect",
419 "multiversion_no_op",
420 "rustversion",
421 "scopeguard",
422 "simdutf8",
423]
424
425[[package]]
426name = "engine"
427version = "0.1.0"
428dependencies = [
429 "bytemuck",
430 "cc",
431 "cpal",
432 "exr",
433 "fontdb",
434 "image",
435 "model",
436 "png",
437 "pollster",
438 "rustybuzz",
439 "symphonia",
440 "web-time",
441 "wgpu",
442 "zeno",
443]
444
445[[package]]
446name = "env_home"
447version = "0.1.0"
448source = "registry+https://github.com/rust-lang/crates.io-index"
449checksum = "c7f84e12ccf0a7ddc17a6c41c93326024c42920d7ee630d04950e6926645c0fe"
450
451[[package]]
452name = "equivalent"
453version = "1.0.3"
454source = "registry+https://github.com/rust-lang/crates.io-index"
455checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"
456
457[[package]]
458name = "errno"
459version = "0.3.15"
460source = "registry+https://github.com/rust-lang/crates.io-index"
461checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776"
462dependencies = [
463 "libc",
464 "windows-sys 0.61.2",
465]
466
467[[package]]
468name = "exr"
469version = "1.74.3"
470source = "registry+https://github.com/rust-lang/crates.io-index"
471checksum = "cb29d0be702adf92c645d9b2f93472906ba83d400e59f98adb3770ce5c18c2f6"
472dependencies = [
473 "bit_field",
474 "half",
475 "lebe",
476 "miniz_oxide 0.8.9",
477 "multiversion",
478 "rayon-core",
479 "smallvec",
480 "zune-inflate",
481]
482
483[[package]]
484name = "extended"
485version = "0.1.0"
486source = "registry+https://github.com/rust-lang/crates.io-index"
487checksum = "af9673d8203fcb076b19dfd17e38b3d4ae9f44959416ea532ce72415a6020365"
488
489[[package]]
490name = "fax"
491version = "0.2.7"
492source = "registry+https://github.com/rust-lang/crates.io-index"
493checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a"
494
495[[package]]
496name = "fdeflate"
497version = "0.3.7"
498source = "registry+https://github.com/rust-lang/crates.io-index"
499checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c"
500dependencies = [
501 "simd-adler32",
502]
503
504[[package]]
505name = "find-msvc-tools"
506version = "0.1.16"
507source = "registry+https://github.com/rust-lang/crates.io-index"
508checksum = "3e44f110d1777dc6559a51e7d45083945ded4f1bf3305494350f693b6d20b9c8"
509
510[[package]]
511name = "fission-web"
512version = "0.1.0"
513dependencies = [
514 "console_error_panic_hook",
515 "engine",
516 "js-sys",
517 "model",
518 "serde_json",
519 "wasm-bindgen",
520 "wasm-bindgen-futures",
521 "web-sys",
522 "wgpu",
523]
524
525[[package]]
526name = "flate2"
527version = "1.1.11"
528source = "registry+https://github.com/rust-lang/crates.io-index"
529checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4"
530dependencies = [
531 "crc32fast",
532 "miniz_oxide 0.9.1",
533 "zlib-rs",
534]
535
536[[package]]
537name = "foldhash"
538version = "0.2.0"
539source = "registry+https://github.com/rust-lang/crates.io-index"
540checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
541
542[[package]]
543name = "fontdb"
544version = "0.23.0"
545source = "registry+https://github.com/rust-lang/crates.io-index"
546checksum = "457e789b3d1202543297a350643cf459f836cade38934e7a4cf6a39e7cde2905"
547dependencies = [
548 "log",
549 "memmap2",
550 "slotmap",
551 "tinyvec",
552 "ttf-parser",
553]
554
555[[package]]
556name = "futures-core"
557version = "0.3.34"
558source = "registry+https://github.com/rust-lang/crates.io-index"
559checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"
560
561[[package]]
562name = "futures-task"
563version = "0.3.34"
564source = "registry+https://github.com/rust-lang/crates.io-index"
565checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd"
566
567[[package]]
568name = "futures-util"
569version = "0.3.34"
570source = "registry+https://github.com/rust-lang/crates.io-index"
571checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc"
572dependencies = [
573 "futures-core",
574 "futures-task",
575 "pin-project-lite",
576 "slab",
577]
578
579[[package]]
580name = "getrandom"
581version = "0.4.3"
582source = "registry+https://github.com/rust-lang/crates.io-index"
583checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
584dependencies = [
585 "cfg-if",
586 "libc",
587 "r-efi",
588]
589
590[[package]]
591name = "gl_generator"
592version = "0.14.0"
593source = "registry+https://github.com/rust-lang/crates.io-index"
594checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d"
595dependencies = [
596 "khronos_api",
597 "log",
598 "xml-rs",
599]
600
601[[package]]
602name = "glob"
603version = "0.3.4"
604source = "registry+https://github.com/rust-lang/crates.io-index"
605checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b"
606
607[[package]]
608name = "glow"
609version = "0.17.0"
610source = "registry+https://github.com/rust-lang/crates.io-index"
611checksum = "29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5"
612dependencies = [
613 "js-sys",
614 "slotmap",
615 "wasm-bindgen",
616 "web-sys",
617]
618
619[[package]]
620name = "glutin_wgl_sys"
621version = "0.6.1"
622source = "registry+https://github.com/rust-lang/crates.io-index"
623checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e"
624dependencies = [
625 "gl_generator",
626]
627
628[[package]]
629name = "gpu-allocator"
630version = "0.28.0"
631source = "registry+https://github.com/rust-lang/crates.io-index"
632checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795"
633dependencies = [
634 "ash",
635 "hashbrown 0.16.1",
636 "log",
637 "presser",
638 "thiserror 2.0.21",
639 "windows 0.62.2",
640]
641
642[[package]]
643name = "half"
644version = "2.7.1"
645source = "registry+https://github.com/rust-lang/crates.io-index"
646checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b"
647dependencies = [
648 "cfg-if",
649 "crunchy",
650 "num-traits",
651 "zerocopy",
652]
653
654[[package]]
655name = "hashbrown"
656version = "0.16.1"
657source = "registry+https://github.com/rust-lang/crates.io-index"
658checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
659dependencies = [
660 "allocator-api2",
661 "equivalent",
662 "foldhash",
663]
664
665[[package]]
666name = "hashbrown"
667version = "0.17.2"
668source = "registry+https://github.com/rust-lang/crates.io-index"
669checksum = "735eaa21a6a5ffb2e84362faaeb90c05ba8e19797ca30428478cb6ea3a4921bc"
670dependencies = [
671 "foldhash",
672]
673
674[[package]]
675name = "image"
676version = "0.25.10"
677source = "registry+https://github.com/rust-lang/crates.io-index"
678checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104"
679dependencies = [
680 "bytemuck",
681 "byteorder-lite",
682 "exr",
683 "image-webp",
684 "moxcms",
685 "num-traits",
686 "png",
687 "tiff",
688 "zune-core",
689 "zune-jpeg",
690]
691
692[[package]]
693name = "image-webp"
694version = "0.2.4"
695source = "registry+https://github.com/rust-lang/crates.io-index"
696checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3"
697dependencies = [
698 "byteorder-lite",
699 "quick-error",
700]
701
702[[package]]
703name = "indexmap"
704version = "2.14.2"
705source = "registry+https://github.com/rust-lang/crates.io-index"
706checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855"
707dependencies = [
708 "equivalent",
709 "hashbrown 0.17.2",
710]
711
712[[package]]
713name = "itertools"
714version = "0.13.0"
715source = "registry+https://github.com/rust-lang/crates.io-index"
716checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
717dependencies = [
718 "either",
719]
720
721[[package]]
722name = "itoa"
723version = "1.0.19"
724source = "registry+https://github.com/rust-lang/crates.io-index"
725checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4"
726
727[[package]]
728name = "jni"
729version = "0.21.1"
730source = "registry+https://github.com/rust-lang/crates.io-index"
731checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97"
732dependencies = [
733 "cesu8",
734 "cfg-if",
735 "combine",
736 "jni-sys 0.3.1",
737 "log",
738 "thiserror 1.0.69",
739 "walkdir",
740 "windows-sys 0.45.0",
741]
742
743[[package]]
744name = "jni-sys"
745version = "0.3.1"
746source = "registry+https://github.com/rust-lang/crates.io-index"
747checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258"
748dependencies = [
749 "jni-sys 0.4.1",
750]
751
752[[package]]
753name = "jni-sys"
754version = "0.4.1"
755source = "registry+https://github.com/rust-lang/crates.io-index"
756checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2"
757dependencies = [
758 "jni-sys-macros",
759]
760
761[[package]]
762name = "jni-sys-macros"
763version = "0.4.1"
764source = "registry+https://github.com/rust-lang/crates.io-index"
765checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264"
766dependencies = [
767 "quote",
768 "syn 2.0.119",
769]
770
771[[package]]
772name = "jobserver"
773version = "0.1.35"
774source = "registry+https://github.com/rust-lang/crates.io-index"
775checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3"
776dependencies = [
777 "getrandom",
778 "libc",
779]
780
781[[package]]
782name = "js-sys"
783version = "0.3.105"
784source = "registry+https://github.com/rust-lang/crates.io-index"
785checksum = "ce57d20d1ea864ce2ac172ab472d409214f4fd359f0b2a2775abdf522e2af99e"
786dependencies = [
787 "cfg-if",
788 "futures-util",
789 "wasm-bindgen",
790]
791
792[[package]]
793name = "khronos-egl"
794version = "6.0.0"
795source = "registry+https://github.com/rust-lang/crates.io-index"
796checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76"
797dependencies = [
798 "libc",
799 "libloading",
800 "pkg-config",
801]
802
803[[package]]
804name = "khronos_api"
805version = "3.1.0"
806source = "registry+https://github.com/rust-lang/crates.io-index"
807checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
808
809[[package]]
810name = "lazy_static"
811version = "1.5.1"
812source = "registry+https://github.com/rust-lang/crates.io-index"
813checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb"
814
815[[package]]
816name = "lebe"
817version = "0.5.3"
818source = "registry+https://github.com/rust-lang/crates.io-index"
819checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8"
820
821[[package]]
822name = "libc"
823version = "0.2.191"
824source = "registry+https://github.com/rust-lang/crates.io-index"
825checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
826
827[[package]]
828name = "libloading"
829version = "0.8.9"
830source = "registry+https://github.com/rust-lang/crates.io-index"
831checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
832dependencies = [
833 "cfg-if",
834 "windows-link",
835]
836
837[[package]]
838name = "libm"
839version = "0.2.16"
840source = "registry+https://github.com/rust-lang/crates.io-index"
841checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
842
843[[package]]
844name = "linux-raw-sys"
845version = "0.12.1"
846source = "registry+https://github.com/rust-lang/crates.io-index"
847checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
848
849[[package]]
850name = "litrs"
851version = "1.1.0"
852source = "registry+https://github.com/rust-lang/crates.io-index"
853checksum = "02b614978e47ce529faee66579f2b2fe19c94aa96d910a6a9a8043b2b02d8175"
854
855[[package]]
856name = "lock_api"
857version = "0.4.14"
858source = "registry+https://github.com/rust-lang/crates.io-index"
859checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
860dependencies = [
861 "scopeguard",
862]
863
864[[package]]
865name = "log"
866version = "0.4.35"
867source = "registry+https://github.com/rust-lang/crates.io-index"
868checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c"
869
870[[package]]
871name = "lua-src"
872version = "547.0.0"
873source = "registry+https://github.com/rust-lang/crates.io-index"
874checksum = "1edaf29e3517b49b8b746701e5648ccb5785cde1c119062cbabbc5d5cd115e42"
875dependencies = [
876 "cc",
877]
878
879[[package]]
880name = "luajit-src"
881version = "210.5.12+a4f56a4"
882source = "registry+https://github.com/rust-lang/crates.io-index"
883checksum = "b3a8e7962a5368d5f264d045a5a255e90f9aa3fc1941ae15a8d2940d42cac671"
884dependencies = [
885 "cc",
886 "which",
887]
888
889[[package]]
890name = "mach2"
891version = "0.4.3"
892source = "registry+https://github.com/rust-lang/crates.io-index"
893checksum = "d640282b302c0bb0a2a8e0233ead9035e3bed871f0b7e81fe4a1ec829765db44"
894dependencies = [
895 "libc",
896]
897
898[[package]]
899name = "memchr"
900version = "2.8.3"
901source = "registry+https://github.com/rust-lang/crates.io-index"
902checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
903
904[[package]]
905name = "memmap2"
906version = "0.9.12"
907source = "registry+https://github.com/rust-lang/crates.io-index"
908checksum = "6b0ca1155a9ecc25aa12e8313a119f32edf0255fea2f44839c4ac0a12b2ac157"
909dependencies = [
910 "libc",
911]
912
913[[package]]
914name = "minimal-lexical"
915version = "0.2.1"
916source = "registry+https://github.com/rust-lang/crates.io-index"
917checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
918
919[[package]]
920name = "miniz_oxide"
921version = "0.8.9"
922source = "registry+https://github.com/rust-lang/crates.io-index"
923checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
924dependencies = [
925 "adler2",
926 "simd-adler32",
927]
928
929[[package]]
930name = "miniz_oxide"
931version = "0.9.1"
932source = "registry+https://github.com/rust-lang/crates.io-index"
933checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c"
934dependencies = [
935 "adler2",
936 "simd-adler32",
937]
938
939[[package]]
940name = "mlua"
941version = "0.10.5"
942source = "registry+https://github.com/rust-lang/crates.io-index"
943checksum = "c1f5f8fbebc7db5f671671134b9321c4b9aa9adeafccfd9a8c020ae45c6a35d0"
944dependencies = [
945 "bstr",
946 "either",
947 "mlua-sys",
948 "num-traits",
949 "parking_lot",
950 "rustc-hash 2.1.3",
951 "rustversion",
952]
953
954[[package]]
955name = "mlua-sys"
956version = "0.6.8"
957source = "registry+https://github.com/rust-lang/crates.io-index"
958checksum = "380c1f7e2099cafcf40e51d3a9f20a346977587aa4d012eae1f043149a728a93"
959dependencies = [
960 "cc",
961 "cfg-if",
962 "lua-src",
963 "luajit-src",
964 "pkg-config",
965]
966
967[[package]]
968name = "model"
969version = "0.1.0"
970dependencies = [
971 "mlua",
972]
973
974[[package]]
975name = "moxcms"
976version = "0.8.1"
977source = "registry+https://github.com/rust-lang/crates.io-index"
978checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b"
979dependencies = [
980 "num-traits",
981 "pxfm",
982]
983
984[[package]]
985name = "multiversion"
986version = "0.8.1"
987source = "registry+https://github.com/rust-lang/crates.io-index"
988checksum = "eb8a68be21d0755f83bfe47e79b896cc732687cf1903f0e50585e8d6ecc53076"
989dependencies = [
990 "multiversion-macros",
991 "target-features",
992]
993
994[[package]]
995name = "multiversion-macros"
996version = "0.8.1"
997source = "registry+https://github.com/rust-lang/crates.io-index"
998checksum = "a05e0c3c3e4edaa21d87c645852ed0b0c3663752bcc6ec43353bd6189dce35e1"
999dependencies = [
1000 "proc-macro2",
1001 "quote",
1002 "syn 2.0.119",
1003 "target-features",
1004]
1005
1006[[package]]
1007name = "multiversion_no_op"
1008version = "1.0.0"
1009source = "registry+https://github.com/rust-lang/crates.io-index"
1010checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d"
1011
1012[[package]]
1013name = "naga"
1014version = "30.0.2"
1015source = "registry+https://github.com/rust-lang/crates.io-index"
1016checksum = "fd0dd362bf26c0ffdd143df6da66a25d287e196eff482f117771010b207ad163"
1017dependencies = [
1018 "arrayvec",
1019 "bit-set",
1020 "bitflags 2.13.2",
1021 "cfg-if",
1022 "cfg_aliases",
1023 "codespan-reporting",
1024 "half",
1025 "hashbrown 0.17.2",
1026 "indexmap",
1027 "libm",
1028 "log",
1029 "naga-types",
1030 "num-traits",
1031 "once_cell",
1032 "rustc-hash 1.1.0",
1033 "spirv",
1034 "thiserror 2.0.21",
1035 "unicode-ident",
1036]
1037
1038[[package]]
1039name = "naga-types"
1040version = "30.0.2"
1041source = "registry+https://github.com/rust-lang/crates.io-index"
1042checksum = "14474170feb673cfb18b3565111a9869797cc1d290fb9ec969c53f5e1e231c6d"
1043dependencies = [
1044 "hashbrown 0.17.2",
1045 "indexmap",
1046 "rustc-hash 1.1.0",
1047 "thiserror 2.0.21",
1048]
1049
1050[[package]]
1051name = "ndk"
1052version = "0.8.0"
1053source = "registry+https://github.com/rust-lang/crates.io-index"
1054checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7"
1055dependencies = [
1056 "bitflags 2.13.2",
1057 "jni-sys 0.3.1",
1058 "log",
1059 "ndk-sys 0.5.0+25.2.9519653",
1060 "num_enum",
1061 "thiserror 1.0.69",
1062]
1063
1064[[package]]
1065name = "ndk-context"
1066version = "0.1.1"
1067source = "registry+https://github.com/rust-lang/crates.io-index"
1068checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b"
1069
1070[[package]]
1071name = "ndk-sys"
1072version = "0.5.0+25.2.9519653"
1073source = "registry+https://github.com/rust-lang/crates.io-index"
1074checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691"
1075dependencies = [
1076 "jni-sys 0.3.1",
1077]
1078
1079[[package]]
1080name = "ndk-sys"
1081version = "0.6.0+11769913"
1082source = "registry+https://github.com/rust-lang/crates.io-index"
1083checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873"
1084dependencies = [
1085 "jni-sys 0.3.1",
1086]
1087
1088[[package]]
1089name = "nom"
1090version = "7.1.3"
1091source = "registry+https://github.com/rust-lang/crates.io-index"
1092checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
1093dependencies = [
1094 "memchr",
1095 "minimal-lexical",
1096]
1097
1098[[package]]
1099name = "num-derive"
1100version = "0.4.2"
1101source = "registry+https://github.com/rust-lang/crates.io-index"
1102checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
1103dependencies = [
1104 "proc-macro2",
1105 "quote",
1106 "syn 2.0.119",
1107]
1108
1109[[package]]
1110name = "num-traits"
1111version = "0.2.19"
1112source = "registry+https://github.com/rust-lang/crates.io-index"
1113checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
1114dependencies = [
1115 "autocfg",
1116 "libm",
1117]
1118
1119[[package]]
1120name = "num_enum"
1121version = "0.7.6"
1122source = "registry+https://github.com/rust-lang/crates.io-index"
1123checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26"
1124dependencies = [
1125 "num_enum_derive",
1126 "rustversion",
1127]
1128
1129[[package]]
1130name = "num_enum_derive"
1131version = "0.7.6"
1132source = "registry+https://github.com/rust-lang/crates.io-index"
1133checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8"
1134dependencies = [
1135 "proc-macro-crate",
1136 "proc-macro2",
1137 "quote",
1138 "syn 2.0.119",
1139]
1140
1141[[package]]
1142name = "objc2"
1143version = "0.6.5"
1144source = "registry+https://github.com/rust-lang/crates.io-index"
1145checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8"
1146dependencies = [
1147 "objc2-encode",
1148]
1149
1150[[package]]
1151name = "objc2-core-foundation"
1152version = "0.3.2"
1153source = "registry+https://github.com/rust-lang/crates.io-index"
1154checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536"
1155dependencies = [
1156 "bitflags 2.13.2",
1157 "dispatch2",
1158 "objc2",
1159]
1160
1161[[package]]
1162name = "objc2-core-graphics"
1163version = "0.3.2"
1164source = "registry+https://github.com/rust-lang/crates.io-index"
1165checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807"
1166dependencies = [
1167 "dispatch2",
1168 "objc2",
1169 "objc2-core-foundation",
1170 "objc2-io-surface",
1171]
1172
1173[[package]]
1174name = "objc2-encode"
1175version = "4.1.0"
1176source = "registry+https://github.com/rust-lang/crates.io-index"
1177checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"
1178
1179[[package]]
1180name = "objc2-foundation"
1181version = "0.3.2"
1182source = "registry+https://github.com/rust-lang/crates.io-index"
1183checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272"
1184dependencies = [
1185 "bitflags 2.13.2",
1186 "objc2",
1187 "objc2-core-foundation",
1188]
1189
1190[[package]]
1191name = "objc2-io-surface"
1192version = "0.3.2"
1193source = "registry+https://github.com/rust-lang/crates.io-index"
1194checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d"
1195dependencies = [
1196 "bitflags 2.13.2",
1197 "objc2",
1198 "objc2-core-foundation",
1199]
1200
1201[[package]]
1202name = "objc2-metal"
1203version = "0.3.2"
1204source = "registry+https://github.com/rust-lang/crates.io-index"
1205checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794"
1206dependencies = [
1207 "bitflags 2.13.2",
1208 "block2",
1209 "objc2",
1210 "objc2-foundation",
1211]
1212
1213[[package]]
1214name = "objc2-quartz-core"
1215version = "0.3.2"
1216source = "registry+https://github.com/rust-lang/crates.io-index"
1217checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f"
1218dependencies = [
1219 "bitflags 2.13.2",
1220 "objc2",
1221 "objc2-core-foundation",
1222 "objc2-core-graphics",
1223 "objc2-foundation",
1224 "objc2-metal",
1225]
1226
1227[[package]]
1228name = "oboe"
1229version = "0.6.1"
1230source = "registry+https://github.com/rust-lang/crates.io-index"
1231checksum = "e8b61bebd49e5d43f5f8cc7ee2891c16e0f41ec7954d36bcb6c14c5e0de867fb"
1232dependencies = [
1233 "jni",
1234 "ndk",
1235 "ndk-context",
1236 "num-derive",
1237 "num-traits",
1238 "oboe-sys",
1239]
1240
1241[[package]]
1242name = "oboe-sys"
1243version = "0.6.1"
1244source = "registry+https://github.com/rust-lang/crates.io-index"
1245checksum = "6c8bb09a4a2b1d668170cfe0a7d5bc103f8999fb316c98099b6a9939c9f2e79d"
1246dependencies = [
1247 "cc",
1248]
1249
1250[[package]]
1251name = "once_cell"
1252version = "1.21.4"
1253source = "registry+https://github.com/rust-lang/crates.io-index"
1254checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
1255
1256[[package]]
1257name = "ordered-float"
1258version = "5.5.1"
1259source = "registry+https://github.com/rust-lang/crates.io-index"
1260checksum = "7f59006ce1e204c30956638535b74d317bca99477b9356dfaec54c37f6f600ab"
1261dependencies = [
1262 "num-traits",
1263]
1264
1265[[package]]
1266name = "parking_lot"
1267version = "0.12.5"
1268source = "registry+https://github.com/rust-lang/crates.io-index"
1269checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
1270dependencies = [
1271 "lock_api",
1272 "parking_lot_core",
1273]
1274
1275[[package]]
1276name = "parking_lot_core"
1277version = "0.9.12"
1278source = "registry+https://github.com/rust-lang/crates.io-index"
1279checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
1280dependencies = [
1281 "cfg-if",
1282 "libc",
1283 "redox_syscall",
1284 "smallvec",
1285 "windows-link",
1286]
1287
1288[[package]]
1289name = "pin-project-lite"
1290version = "0.2.18"
1291source = "registry+https://github.com/rust-lang/crates.io-index"
1292checksum = "c938015719552d665fd0553b90d96cd7ff58e83e4c061ca99e6bb78865a72752"
1293
1294[[package]]
1295name = "pkg-config"
1296version = "0.3.34"
1297source = "registry+https://github.com/rust-lang/crates.io-index"
1298checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548"
1299
1300[[package]]
1301name = "png"
1302version = "0.18.1"
1303source = "registry+https://github.com/rust-lang/crates.io-index"
1304checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61"
1305dependencies = [
1306 "bitflags 2.13.2",
1307 "crc32fast",
1308 "fdeflate",
1309 "flate2",
1310 "miniz_oxide 0.8.9",
1311]
1312
1313[[package]]
1314name = "pollster"
1315version = "0.4.0"
1316source = "registry+https://github.com/rust-lang/crates.io-index"
1317checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3"
1318
1319[[package]]
1320name = "portable-atomic"
1321version = "1.15.0"
1322source = "registry+https://github.com/rust-lang/crates.io-index"
1323checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
1324
1325[[package]]
1326name = "portable-atomic-util"
1327version = "0.2.8"
1328source = "registry+https://github.com/rust-lang/crates.io-index"
1329checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715"
1330dependencies = [
1331 "portable-atomic",
1332]
1333
1334[[package]]
1335name = "presser"
1336version = "0.3.1"
1337source = "registry+https://github.com/rust-lang/crates.io-index"
1338checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa"
1339
1340[[package]]
1341name = "proc-macro-crate"
1342version = "3.5.0"
1343source = "registry+https://github.com/rust-lang/crates.io-index"
1344checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f"
1345dependencies = [
1346 "toml_edit",
1347]
1348
1349[[package]]
1350name = "proc-macro2"
1351version = "1.0.107"
1352source = "registry+https://github.com/rust-lang/crates.io-index"
1353checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
1354dependencies = [
1355 "unicode-ident",
1356]
1357
1358[[package]]
1359name = "profiling"
1360version = "1.0.18"
1361source = "registry+https://github.com/rust-lang/crates.io-index"
1362checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5"
1363
1364[[package]]
1365name = "pxfm"
1366version = "0.1.30"
1367source = "registry+https://github.com/rust-lang/crates.io-index"
1368checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea"
1369
1370[[package]]
1371name = "quick-error"
1372version = "2.0.1"
1373source = "registry+https://github.com/rust-lang/crates.io-index"
1374checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
1375
1376[[package]]
1377name = "quote"
1378version = "1.0.47"
1379source = "registry+https://github.com/rust-lang/crates.io-index"
1380checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
1381dependencies = [
1382 "proc-macro2",
1383]
1384
1385[[package]]
1386name = "r-efi"
1387version = "6.0.0"
1388source = "registry+https://github.com/rust-lang/crates.io-index"
1389checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
1390
1391[[package]]
1392name = "range-alloc"
1393version = "0.1.5"
1394source = "registry+https://github.com/rust-lang/crates.io-index"
1395checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08"
1396
1397[[package]]
1398name = "raw-window-handle"
1399version = "0.6.2"
1400source = "registry+https://github.com/rust-lang/crates.io-index"
1401checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"
1402
1403[[package]]
1404name = "raw-window-metal"
1405version = "1.1.0"
1406source = "registry+https://github.com/rust-lang/crates.io-index"
1407checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135"
1408dependencies = [
1409 "objc2",
1410 "objc2-core-foundation",
1411 "objc2-foundation",
1412 "objc2-quartz-core",
1413]
1414
1415[[package]]
1416name = "rayon-core"
1417version = "1.13.0"
1418source = "registry+https://github.com/rust-lang/crates.io-index"
1419checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
1420dependencies = [
1421 "crossbeam-deque",
1422 "crossbeam-utils",
1423]
1424
1425[[package]]
1426name = "redox_syscall"
1427version = "0.5.18"
1428source = "registry+https://github.com/rust-lang/crates.io-index"
1429checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
1430dependencies = [
1431 "bitflags 2.13.2",
1432]
1433
1434[[package]]
1435name = "regex"
1436version = "1.13.2"
1437source = "registry+https://github.com/rust-lang/crates.io-index"
1438checksum = "9807af0e638c12e753aa1b4e601791bf2a8f71274023c8bbeec12fc149950857"
1439dependencies = [
1440 "aho-corasick",
1441 "memchr",
1442 "regex-automata",
1443 "regex-syntax",
1444]
1445
1446[[package]]
1447name = "regex-automata"
1448version = "0.4.19"
1449source = "registry+https://github.com/rust-lang/crates.io-index"
1450checksum = "41d60ef07df457506a0a1a2073112eb4aae5733dbd2813c3da77d1b0fd441158"
1451dependencies = [
1452 "aho-corasick",
1453 "memchr",
1454 "regex-syntax",
1455]
1456
1457[[package]]
1458name = "regex-syntax"
1459version = "0.8.12"
1460source = "registry+https://github.com/rust-lang/crates.io-index"
1461checksum = "d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6"
1462
1463[[package]]
1464name = "renderdoc-sys"
1465version = "1.1.0"
1466source = "registry+https://github.com/rust-lang/crates.io-index"
1467checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832"
1468
1469[[package]]
1470name = "rustc-hash"
1471version = "1.1.0"
1472source = "registry+https://github.com/rust-lang/crates.io-index"
1473checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
1474
1475[[package]]
1476name = "rustc-hash"
1477version = "2.1.3"
1478source = "registry+https://github.com/rust-lang/crates.io-index"
1479checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
1480
1481[[package]]
1482name = "rustix"
1483version = "1.1.6"
1484source = "registry+https://github.com/rust-lang/crates.io-index"
1485checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa"
1486dependencies = [
1487 "bitflags 2.13.2",
1488 "errno",
1489 "libc",
1490 "linux-raw-sys",
1491 "windows-sys 0.61.2",
1492]
1493
1494[[package]]
1495name = "rustversion"
1496version = "1.0.23"
1497source = "registry+https://github.com/rust-lang/crates.io-index"
1498checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
1499
1500[[package]]
1501name = "rustybuzz"
1502version = "0.20.1"
1503source = "registry+https://github.com/rust-lang/crates.io-index"
1504checksum = "fd3c7c96f8a08ee34eff8857b11b49b07d71d1c3f4e88f8a88d4c9e9f90b1702"
1505dependencies = [
1506 "bitflags 2.13.2",
1507 "bytemuck",
1508 "core_maths",
1509 "log",
1510 "smallvec",
1511 "ttf-parser",
1512 "unicode-bidi-mirroring",
1513 "unicode-ccc",
1514 "unicode-properties",
1515 "unicode-script",
1516]
1517
1518[[package]]
1519name = "same-file"
1520version = "1.0.6"
1521source = "registry+https://github.com/rust-lang/crates.io-index"
1522checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
1523dependencies = [
1524 "winapi-util",
1525]
1526
1527[[package]]
1528name = "scopeguard"
1529version = "1.2.0"
1530source = "registry+https://github.com/rust-lang/crates.io-index"
1531checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
1532
1533[[package]]
1534name = "serde"
1535version = "1.0.229"
1536source = "registry+https://github.com/rust-lang/crates.io-index"
1537checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
1538dependencies = [
1539 "serde_core",
1540 "serde_derive",
1541]
1542
1543[[package]]
1544name = "serde_core"
1545version = "1.0.229"
1546source = "registry+https://github.com/rust-lang/crates.io-index"
1547checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
1548dependencies = [
1549 "serde_derive",
1550]
1551
1552[[package]]
1553name = "serde_derive"
1554version = "1.0.229"
1555source = "registry+https://github.com/rust-lang/crates.io-index"
1556checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
1557dependencies = [
1558 "proc-macro2",
1559 "quote",
1560 "syn 3.0.10",
1561]
1562
1563[[package]]
1564name = "serde_json"
1565version = "1.0.154"
1566source = "registry+https://github.com/rust-lang/crates.io-index"
1567checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
1568dependencies = [
1569 "itoa",
1570 "memchr",
1571 "serde",
1572 "serde_core",
1573 "zmij",
1574]
1575
1576[[package]]
1577name = "shlex"
1578version = "1.3.0"
1579source = "registry+https://github.com/rust-lang/crates.io-index"
1580checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
1581
1582[[package]]
1583name = "shlex"
1584version = "2.0.1"
1585source = "registry+https://github.com/rust-lang/crates.io-index"
1586checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
1587
1588[[package]]
1589name = "simd-adler32"
1590version = "0.3.10"
1591source = "registry+https://github.com/rust-lang/crates.io-index"
1592checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea"
1593
1594[[package]]
1595name = "simdutf8"
1596version = "0.1.5"
1597source = "registry+https://github.com/rust-lang/crates.io-index"
1598checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
1599
1600[[package]]
1601name = "slab"
1602version = "0.4.12"
1603source = "registry+https://github.com/rust-lang/crates.io-index"
1604checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
1605
1606[[package]]
1607name = "slotmap"
1608version = "1.1.1"
1609source = "registry+https://github.com/rust-lang/crates.io-index"
1610checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038"
1611dependencies = [
1612 "version_check",
1613]
1614
1615[[package]]
1616name = "smallvec"
1617version = "1.16.6"
1618source = "registry+https://github.com/rust-lang/crates.io-index"
1619checksum = "3244542535d5de959d90ec55d1b5ff0fd2bb7b1310223907d5f11932847f7b59"
1620
1621[[package]]
1622name = "spirv"
1623version = "0.4.0+sdk-1.4.341.0"
1624source = "registry+https://github.com/rust-lang/crates.io-index"
1625checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f"
1626dependencies = [
1627 "bitflags 2.13.2",
1628]
1629
1630[[package]]
1631name = "static_assertions"
1632version = "1.1.0"
1633source = "registry+https://github.com/rust-lang/crates.io-index"
1634checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
1635
1636[[package]]
1637name = "symphonia"
1638version = "0.5.5"
1639source = "registry+https://github.com/rust-lang/crates.io-index"
1640checksum = "5773a4c030a19d9bfaa090f49746ff35c75dfddfa700df7a5939d5e076a57039"
1641dependencies = [
1642 "lazy_static",
1643 "symphonia-bundle-flac",
1644 "symphonia-bundle-mp3",
1645 "symphonia-codec-aac",
1646 "symphonia-codec-pcm",
1647 "symphonia-core",
1648 "symphonia-format-isomp4",
1649 "symphonia-format-ogg",
1650 "symphonia-format-riff",
1651 "symphonia-metadata",
1652]
1653
1654[[package]]
1655name = "symphonia-bundle-flac"
1656version = "0.5.5"
1657source = "registry+https://github.com/rust-lang/crates.io-index"
1658checksum = "c91565e180aea25d9b80a910c546802526ffd0072d0b8974e3ebe59b686c9976"
1659dependencies = [
1660 "log",
1661 "symphonia-core",
1662 "symphonia-metadata",
1663 "symphonia-utils-xiph",
1664]
1665
1666[[package]]
1667name = "symphonia-bundle-mp3"
1668version = "0.5.5"
1669source = "registry+https://github.com/rust-lang/crates.io-index"
1670checksum = "4872dd6bb56bf5eac799e3e957aa1981086c3e613b27e0ac23b176054f7c57ed"
1671dependencies = [
1672 "lazy_static",
1673 "log",
1674 "symphonia-core",
1675 "symphonia-metadata",
1676]
1677
1678[[package]]
1679name = "symphonia-codec-aac"
1680version = "0.5.5"
1681source = "registry+https://github.com/rust-lang/crates.io-index"
1682checksum = "4c263845aa86881416849c1729a54c7f55164f8b96111dba59de46849e73a790"
1683dependencies = [
1684 "lazy_static",
1685 "log",
1686 "symphonia-core",
1687]
1688
1689[[package]]
1690name = "symphonia-codec-pcm"
1691version = "0.5.5"
1692source = "registry+https://github.com/rust-lang/crates.io-index"
1693checksum = "4e89d716c01541ad3ebe7c91ce4c8d38a7cf266a3f7b2f090b108fb0cb031d95"
1694dependencies = [
1695 "log",
1696 "symphonia-core",
1697]
1698
1699[[package]]
1700name = "symphonia-core"
1701version = "0.5.5"
1702source = "registry+https://github.com/rust-lang/crates.io-index"
1703checksum = "ea00cc4f79b7f6bb7ff87eddc065a1066f3a43fe1875979056672c9ef948c2af"
1704dependencies = [
1705 "arrayvec",
1706 "bitflags 1.3.2",
1707 "bytemuck",
1708 "lazy_static",
1709 "log",
1710]
1711
1712[[package]]
1713name = "symphonia-format-isomp4"
1714version = "0.5.5"
1715source = "registry+https://github.com/rust-lang/crates.io-index"
1716checksum = "243739585d11f81daf8dac8d9f3d18cc7898f6c09a259675fc364b382c30e0a5"
1717dependencies = [
1718 "encoding_rs",
1719 "log",
1720 "symphonia-core",
1721 "symphonia-metadata",
1722 "symphonia-utils-xiph",
1723]
1724
1725[[package]]
1726name = "symphonia-format-ogg"
1727version = "0.5.5"
1728source = "registry+https://github.com/rust-lang/crates.io-index"
1729checksum = "2b4955c67c1ed3aa8ae8428d04ca8397fbef6a19b2b051e73b5da8b1435639cb"
1730dependencies = [
1731 "log",
1732 "symphonia-core",
1733 "symphonia-metadata",
1734 "symphonia-utils-xiph",
1735]
1736
1737[[package]]
1738name = "symphonia-format-riff"
1739version = "0.5.5"
1740source = "registry+https://github.com/rust-lang/crates.io-index"
1741checksum = "c2d7c3df0e7d94efb68401d81906eae73c02b40d5ec1a141962c592d0f11a96f"
1742dependencies = [
1743 "extended",
1744 "log",
1745 "symphonia-core",
1746 "symphonia-metadata",
1747]
1748
1749[[package]]
1750name = "symphonia-metadata"
1751version = "0.5.5"
1752source = "registry+https://github.com/rust-lang/crates.io-index"
1753checksum = "36306ff42b9ffe6e5afc99d49e121e0bd62fe79b9db7b9681d48e29fa19e6b16"
1754dependencies = [
1755 "encoding_rs",
1756 "lazy_static",
1757 "log",
1758 "symphonia-core",
1759]
1760
1761[[package]]
1762name = "symphonia-utils-xiph"
1763version = "0.5.5"
1764source = "registry+https://github.com/rust-lang/crates.io-index"
1765checksum = "ee27c85ab799a338446b68eec77abf42e1a6f1bb490656e121c6e27bfbab9f16"
1766dependencies = [
1767 "symphonia-core",
1768 "symphonia-metadata",
1769]
1770
1771[[package]]
1772name = "syn"
1773version = "2.0.119"
1774source = "registry+https://github.com/rust-lang/crates.io-index"
1775checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
1776dependencies = [
1777 "proc-macro2",
1778 "quote",
1779 "unicode-ident",
1780]
1781
1782[[package]]
1783name = "syn"
1784version = "3.0.10"
1785source = "registry+https://github.com/rust-lang/crates.io-index"
1786checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79"
1787dependencies = [
1788 "proc-macro2",
1789 "quote",
1790 "unicode-ident",
1791]
1792
1793[[package]]
1794name = "target-features"
1795version = "0.1.6"
1796source = "registry+https://github.com/rust-lang/crates.io-index"
1797checksum = "c1bbb9f3c5c463a01705937a24fdabc5047929ac764b2d5b9cf681c1f5041ed5"
1798
1799[[package]]
1800name = "termcolor"
1801version = "1.4.1"
1802source = "registry+https://github.com/rust-lang/crates.io-index"
1803checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
1804dependencies = [
1805 "winapi-util",
1806]
1807
1808[[package]]
1809name = "thiserror"
1810version = "1.0.69"
1811source = "registry+https://github.com/rust-lang/crates.io-index"
1812checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
1813dependencies = [
1814 "thiserror-impl 1.0.69",
1815]
1816
1817[[package]]
1818name = "thiserror"
1819version = "2.0.21"
1820source = "registry+https://github.com/rust-lang/crates.io-index"
1821checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e"
1822dependencies = [
1823 "thiserror-impl 2.0.21",
1824]
1825
1826[[package]]
1827name = "thiserror-impl"
1828version = "1.0.69"
1829source = "registry+https://github.com/rust-lang/crates.io-index"
1830checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
1831dependencies = [
1832 "proc-macro2",
1833 "quote",
1834 "syn 2.0.119",
1835]
1836
1837[[package]]
1838name = "thiserror-impl"
1839version = "2.0.21"
1840source = "registry+https://github.com/rust-lang/crates.io-index"
1841checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524"
1842dependencies = [
1843 "proc-macro2",
1844 "quote",
1845 "syn 3.0.10",
1846]
1847
1848[[package]]
1849name = "tiff"
1850version = "0.11.3"
1851source = "registry+https://github.com/rust-lang/crates.io-index"
1852checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52"
1853dependencies = [
1854 "fax",
1855 "flate2",
1856 "half",
1857 "quick-error",
1858 "weezl",
1859 "zune-jpeg",
1860]
1861
1862[[package]]
1863name = "tinyvec"
1864version = "1.13.3"
1865source = "registry+https://github.com/rust-lang/crates.io-index"
1866checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee"
1867
1868[[package]]
1869name = "toml_datetime"
1870version = "1.1.3+spec-1.1.0"
1871source = "registry+https://github.com/rust-lang/crates.io-index"
1872checksum = "173f25c883cd2176a2d8212155638c0a60d484a9d84546d270866f40f56b6e49"
1873dependencies = [
1874 "serde_core",
1875]
1876
1877[[package]]
1878name = "toml_edit"
1879version = "0.25.21+spec-1.1.0"
1880source = "registry+https://github.com/rust-lang/crates.io-index"
1881checksum = "88497dab46de5bf343ec66b05c251e48c6213f3e9170c70a70a823f7abe886a4"
1882dependencies = [
1883 "indexmap",
1884 "toml_datetime",
1885 "toml_parser",
1886 "winnow",
1887]
1888
1889[[package]]
1890name = "toml_parser"
1891version = "1.1.7+spec-1.1.0"
1892source = "registry+https://github.com/rust-lang/crates.io-index"
1893checksum = "0bb28d6e049a9766c3bd91a8326e6179f5b132dec87906bb97018ef7a2f3431a"
1894dependencies = [
1895 "winnow",
1896]
1897
1898[[package]]
1899name = "ttf-parser"
1900version = "0.25.1"
1901source = "registry+https://github.com/rust-lang/crates.io-index"
1902checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"
1903dependencies = [
1904 "core_maths",
1905]
1906
1907[[package]]
1908name = "unicode-bidi-mirroring"
1909version = "0.4.0"
1910source = "registry+https://github.com/rust-lang/crates.io-index"
1911checksum = "5dfa6e8c60bb66d49db113e0125ee8711b7647b5579dc7f5f19c42357ed039fe"
1912
1913[[package]]
1914name = "unicode-ccc"
1915version = "0.4.0"
1916source = "registry+https://github.com/rust-lang/crates.io-index"
1917checksum = "ce61d488bcdc9bc8b5d1772c404828b17fc481c0a582b5581e95fb233aef503e"
1918
1919[[package]]
1920name = "unicode-ident"
1921version = "1.0.27"
1922source = "registry+https://github.com/rust-lang/crates.io-index"
1923checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
1924
1925[[package]]
1926name = "unicode-properties"
1927version = "0.1.5"
1928source = "registry+https://github.com/rust-lang/crates.io-index"
1929checksum = "993ad287eb20e8ba755312801cfe1413e0f25d604075863acaddca10b04c1833"
1930
1931[[package]]
1932name = "unicode-script"
1933version = "0.5.9"
1934source = "registry+https://github.com/rust-lang/crates.io-index"
1935checksum = "aa04c955db05429d464c74d495c1ee677e1866e783a4c3747f9c0cef7756cabf"
1936
1937[[package]]
1938name = "unicode-width"
1939version = "0.2.3"
1940source = "registry+https://github.com/rust-lang/crates.io-index"
1941checksum = "ca718471876992059f251e33aafc334346ada08042b7661dd1fe313a9bced557"
1942
1943[[package]]
1944name = "version_check"
1945version = "0.9.5"
1946source = "registry+https://github.com/rust-lang/crates.io-index"
1947checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
1948
1949[[package]]
1950name = "walkdir"
1951version = "2.5.1"
1952source = "registry+https://github.com/rust-lang/crates.io-index"
1953checksum = "b42e295b7452c4604982280d8586001fcad9b8b201cac67bca9771e7a7475403"
1954dependencies = [
1955 "same-file",
1956 "winapi-util",
1957]
1958
1959[[package]]
1960name = "wasm-bindgen"
1961version = "0.2.128"
1962source = "registry+https://github.com/rust-lang/crates.io-index"
1963checksum = "aecb87a33d3b0c5e3b7aa46336eaf486cffafbd281b195e4c8b80d50df2351bf"
1964dependencies = [
1965 "cfg-if",
1966 "once_cell",
1967 "rustversion",
1968 "wasm-bindgen-macro",
1969 "wasm-bindgen-shared",
1970]
1971
1972[[package]]
1973name = "wasm-bindgen-futures"
1974version = "0.4.78"
1975source = "registry+https://github.com/rust-lang/crates.io-index"
1976checksum = "6ef4c5d3d2cdf5c54f4231181768f5510842e350db025faf1f7163b1030ed928"
1977dependencies = [
1978 "js-sys",
1979 "wasm-bindgen",
1980]
1981
1982[[package]]
1983name = "wasm-bindgen-macro"
1984version = "0.2.128"
1985source = "registry+https://github.com/rust-lang/crates.io-index"
1986checksum = "a690d511e3c1a8b3a55e33511e3c2c00c78415cd23650f32b808627f5696b9ed"
1987dependencies = [
1988 "quote",
1989 "wasm-bindgen-macro-support",
1990]
1991
1992[[package]]
1993name = "wasm-bindgen-macro-support"
1994version = "0.2.128"
1995source = "registry+https://github.com/rust-lang/crates.io-index"
1996checksum = "411e4887f0071ef2d2164a9d5fdf2d20efbef78fccd3a78b0c10a1dc5295e48a"
1997dependencies = [
1998 "bumpalo",
1999 "proc-macro2",
2000 "quote",
2001 "syn 3.0.10",
2002 "wasm-bindgen-shared",
2003]
2004
2005[[package]]
2006name = "wasm-bindgen-shared"
2007version = "0.2.128"
2008source = "registry+https://github.com/rust-lang/crates.io-index"
2009checksum = "81941cd78d0c92026c33e5e01312845a4cb1e9af3407f9134b100dd03144103e"
2010dependencies = [
2011 "unicode-ident",
2012]
2013
2014[[package]]
2015name = "wayland-sys"
2016version = "0.31.11"
2017source = "registry+https://github.com/rust-lang/crates.io-index"
2018checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be"
2019dependencies = [
2020 "dlib",
2021 "log",
2022 "once_cell",
2023 "pkg-config",
2024]
2025
2026[[package]]
2027name = "web-sys"
2028version = "0.3.105"
2029source = "registry+https://github.com/rust-lang/crates.io-index"
2030checksum = "9fbddc4a036f00ec4f18c83445bd3115cb306a91da554919a099d9222fe4a7f8"
2031dependencies = [
2032 "js-sys",
2033 "wasm-bindgen",
2034]
2035
2036[[package]]
2037name = "web-time"
2038version = "1.1.0"
2039source = "registry+https://github.com/rust-lang/crates.io-index"
2040checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"
2041dependencies = [
2042 "js-sys",
2043 "wasm-bindgen",
2044]
2045
2046[[package]]
2047name = "weezl"
2048version = "0.1.12"
2049source = "registry+https://github.com/rust-lang/crates.io-index"
2050checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88"
2051
2052[[package]]
2053name = "wgpu"
2054version = "30.0.2"
2055source = "registry+https://github.com/rust-lang/crates.io-index"
2056checksum = "146fc3d654250e6207921a66c87534c621bc886c70df83dcf466c1d66813810e"
2057dependencies = [
2058 "arrayvec",
2059 "bitflags 2.13.2",
2060 "bytemuck",
2061 "cfg-if",
2062 "cfg_aliases",
2063 "document-features",
2064 "hashbrown 0.17.2",
2065 "js-sys",
2066 "log",
2067 "naga",
2068 "parking_lot",
2069 "portable-atomic",
2070 "profiling",
2071 "raw-window-handle",
2072 "smallvec",
2073 "static_assertions",
2074 "wasm-bindgen",
2075 "wasm-bindgen-futures",
2076 "web-sys",
2077 "wgpu-core",
2078 "wgpu-hal",
2079 "wgpu-types",
2080]
2081
2082[[package]]
2083name = "wgpu-core"
2084version = "30.0.2"
2085source = "registry+https://github.com/rust-lang/crates.io-index"
2086checksum = "ad661da2ee99f208c30090b585284b2ab5b8bf2358ddf2d2215592808ec62f1a"
2087dependencies = [
2088 "arrayvec",
2089 "bit-set",
2090 "bit-vec",
2091 "bitflags 2.13.2",
2092 "bytemuck",
2093 "cfg_aliases",
2094 "document-features",
2095 "hashbrown 0.17.2",
2096 "indexmap",
2097 "log",
2098 "naga",
2099 "naga-types",
2100 "once_cell",
2101 "parking_lot",
2102 "portable-atomic",
2103 "profiling",
2104 "raw-window-handle",
2105 "rustc-hash 1.1.0",
2106 "smallvec",
2107 "thiserror 2.0.21",
2108 "wgpu-core-deps-apple",
2109 "wgpu-core-deps-emscripten",
2110 "wgpu-core-deps-windows-linux-android",
2111 "wgpu-hal",
2112 "wgpu-naga-bridge",
2113 "wgpu-types",
2114]
2115
2116[[package]]
2117name = "wgpu-core-deps-apple"
2118version = "30.0.2"
2119source = "registry+https://github.com/rust-lang/crates.io-index"
2120checksum = "7d3f2f24aee039ffe9ef527300daf6b7428c58edeefdaa1700f4fa0fd754df16"
2121dependencies = [
2122 "wgpu-hal",
2123]
2124
2125[[package]]
2126name = "wgpu-core-deps-emscripten"
2127version = "30.0.2"
2128source = "registry+https://github.com/rust-lang/crates.io-index"
2129checksum = "55ccf093bd215ae9dc4f96df293e675513ac1f2569f8293a2911cc34ca3505d1"
2130dependencies = [
2131 "wgpu-hal",
2132]
2133
2134[[package]]
2135name = "wgpu-core-deps-windows-linux-android"
2136version = "30.0.2"
2137source = "registry+https://github.com/rust-lang/crates.io-index"
2138checksum = "1331b08fa2362c5d454eccc4448e6e4f01eccfea569a00e310adbfc4415f2bdc"
2139dependencies = [
2140 "wgpu-hal",
2141]
2142
2143[[package]]
2144name = "wgpu-hal"
2145version = "30.0.2"
2146source = "registry+https://github.com/rust-lang/crates.io-index"
2147checksum = "a57452fe453658e141aafdb09de1028afa498805fab518238ddf372a518813ff"
2148dependencies = [
2149 "android_system_properties",
2150 "arrayvec",
2151 "ash",
2152 "bit-set",
2153 "bitflags 2.13.2",
2154 "block2",
2155 "bytemuck",
2156 "cfg-if",
2157 "cfg_aliases",
2158 "glow",
2159 "glutin_wgl_sys",
2160 "gpu-allocator",
2161 "hashbrown 0.17.2",
2162 "js-sys",
2163 "khronos-egl",
2164 "libc",
2165 "libloading",
2166 "log",
2167 "naga",
2168 "naga-types",
2169 "ndk-sys 0.6.0+11769913",
2170 "objc2",
2171 "objc2-core-foundation",
2172 "objc2-core-graphics",
2173 "objc2-foundation",
2174 "objc2-metal",
2175 "objc2-quartz-core",
2176 "once_cell",
2177 "ordered-float",
2178 "parking_lot",
2179 "portable-atomic",
2180 "portable-atomic-util",
2181 "profiling",
2182 "range-alloc",
2183 "raw-window-handle",
2184 "raw-window-metal",
2185 "renderdoc-sys",
2186 "smallvec",
2187 "static_assertions",
2188 "thiserror 2.0.21",
2189 "wasm-bindgen",
2190 "wayland-sys",
2191 "web-sys",
2192 "wgpu-naga-bridge",
2193 "wgpu-types",
2194 "windows 0.62.2",
2195 "windows-core 0.62.2",
2196 "windows-result 0.4.1",
2197]
2198
2199[[package]]
2200name = "wgpu-naga-bridge"
2201version = "30.0.2"
2202source = "registry+https://github.com/rust-lang/crates.io-index"
2203checksum = "44a62ead68aad7cd40ac9e2cd2b8ec64f32dfbad2765f429b9fb74b8b735869f"
2204dependencies = [
2205 "naga",
2206 "wgpu-types",
2207]
2208
2209[[package]]
2210name = "wgpu-types"
2211version = "30.0.2"
2212source = "registry+https://github.com/rust-lang/crates.io-index"
2213checksum = "a9f6ee0bd50f5ab79fb8c25e3f33afb27126f034af4ba5909c7a0967058659e6"
2214dependencies = [
2215 "bitflags 2.13.2",
2216 "bytemuck",
2217 "js-sys",
2218 "log",
2219 "naga-types",
2220 "raw-window-handle",
2221 "static_assertions",
2222 "web-sys",
2223]
2224
2225[[package]]
2226name = "which"
2227version = "7.0.3"
2228source = "registry+https://github.com/rust-lang/crates.io-index"
2229checksum = "24d643ce3fd3e5b54854602a080f34fb10ab75e0b813ee32d00ca2b44fa74762"
2230dependencies = [
2231 "either",
2232 "env_home",
2233 "rustix",
2234 "winsafe",
2235]
2236
2237[[package]]
2238name = "winapi-util"
2239version = "0.1.11"
2240source = "registry+https://github.com/rust-lang/crates.io-index"
2241checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
2242dependencies = [
2243 "windows-sys 0.61.2",
2244]
2245
2246[[package]]
2247name = "windows"
2248version = "0.54.0"
2249source = "registry+https://github.com/rust-lang/crates.io-index"
2250checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49"
2251dependencies = [
2252 "windows-core 0.54.0",
2253 "windows-targets 0.52.6",
2254]
2255
2256[[package]]
2257name = "windows"
2258version = "0.62.2"
2259source = "registry+https://github.com/rust-lang/crates.io-index"
2260checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"
2261dependencies = [
2262 "windows-collections",
2263 "windows-core 0.62.2",
2264 "windows-future",
2265 "windows-numerics",
2266]
2267
2268[[package]]
2269name = "windows-collections"
2270version = "0.3.2"
2271source = "registry+https://github.com/rust-lang/crates.io-index"
2272checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"
2273dependencies = [
2274 "windows-core 0.62.2",
2275]
2276
2277[[package]]
2278name = "windows-core"
2279version = "0.54.0"
2280source = "registry+https://github.com/rust-lang/crates.io-index"
2281checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65"
2282dependencies = [
2283 "windows-result 0.1.2",
2284 "windows-targets 0.52.6",
2285]
2286
2287[[package]]
2288name = "windows-core"
2289version = "0.62.2"
2290source = "registry+https://github.com/rust-lang/crates.io-index"
2291checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
2292dependencies = [
2293 "windows-implement",
2294 "windows-interface",
2295 "windows-link",
2296 "windows-result 0.4.1",
2297 "windows-strings",
2298]
2299
2300[[package]]
2301name = "windows-future"
2302version = "0.3.2"
2303source = "registry+https://github.com/rust-lang/crates.io-index"
2304checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"
2305dependencies = [
2306 "windows-core 0.62.2",
2307 "windows-link",
2308 "windows-threading",
2309]
2310
2311[[package]]
2312name = "windows-implement"
2313version = "0.60.2"
2314source = "registry+https://github.com/rust-lang/crates.io-index"
2315checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
2316dependencies = [
2317 "proc-macro2",
2318 "quote",
2319 "syn 2.0.119",
2320]
2321
2322[[package]]
2323name = "windows-interface"
2324version = "0.59.3"
2325source = "registry+https://github.com/rust-lang/crates.io-index"
2326checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
2327dependencies = [
2328 "proc-macro2",
2329 "quote",
2330 "syn 2.0.119",
2331]
2332
2333[[package]]
2334name = "windows-link"
2335version = "0.2.1"
2336source = "registry+https://github.com/rust-lang/crates.io-index"
2337checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
2338
2339[[package]]
2340name = "windows-numerics"
2341version = "0.3.1"
2342source = "registry+https://github.com/rust-lang/crates.io-index"
2343checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"
2344dependencies = [
2345 "windows-core 0.62.2",
2346 "windows-link",
2347]
2348
2349[[package]]
2350name = "windows-result"
2351version = "0.1.2"
2352source = "registry+https://github.com/rust-lang/crates.io-index"
2353checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8"
2354dependencies = [
2355 "windows-targets 0.52.6",
2356]
2357
2358[[package]]
2359name = "windows-result"
2360version = "0.4.1"
2361source = "registry+https://github.com/rust-lang/crates.io-index"
2362checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
2363dependencies = [
2364 "windows-link",
2365]
2366
2367[[package]]
2368name = "windows-strings"
2369version = "0.5.1"
2370source = "registry+https://github.com/rust-lang/crates.io-index"
2371checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
2372dependencies = [
2373 "windows-link",
2374]
2375
2376[[package]]
2377name = "windows-sys"
2378version = "0.45.0"
2379source = "registry+https://github.com/rust-lang/crates.io-index"
2380checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
2381dependencies = [
2382 "windows-targets 0.42.2",
2383]
2384
2385[[package]]
2386name = "windows-sys"
2387version = "0.61.2"
2388source = "registry+https://github.com/rust-lang/crates.io-index"
2389checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
2390dependencies = [
2391 "windows-link",
2392]
2393
2394[[package]]
2395name = "windows-targets"
2396version = "0.42.2"
2397source = "registry+https://github.com/rust-lang/crates.io-index"
2398checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
2399dependencies = [
2400 "windows_aarch64_gnullvm 0.42.2",
2401 "windows_aarch64_msvc 0.42.2",
2402 "windows_i686_gnu 0.42.2",
2403 "windows_i686_msvc 0.42.2",
2404 "windows_x86_64_gnu 0.42.2",
2405 "windows_x86_64_gnullvm 0.42.2",
2406 "windows_x86_64_msvc 0.42.2",
2407]
2408
2409[[package]]
2410name = "windows-targets"
2411version = "0.52.6"
2412source = "registry+https://github.com/rust-lang/crates.io-index"
2413checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
2414dependencies = [
2415 "windows_aarch64_gnullvm 0.52.6",
2416 "windows_aarch64_msvc 0.52.6",
2417 "windows_i686_gnu 0.52.6",
2418 "windows_i686_gnullvm",
2419 "windows_i686_msvc 0.52.6",
2420 "windows_x86_64_gnu 0.52.6",
2421 "windows_x86_64_gnullvm 0.52.6",
2422 "windows_x86_64_msvc 0.52.6",
2423]
2424
2425[[package]]
2426name = "windows-threading"
2427version = "0.2.1"
2428source = "registry+https://github.com/rust-lang/crates.io-index"
2429checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"
2430dependencies = [
2431 "windows-link",
2432]
2433
2434[[package]]
2435name = "windows_aarch64_gnullvm"
2436version = "0.42.2"
2437source = "registry+https://github.com/rust-lang/crates.io-index"
2438checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
2439
2440[[package]]
2441name = "windows_aarch64_gnullvm"
2442version = "0.52.6"
2443source = "registry+https://github.com/rust-lang/crates.io-index"
2444checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
2445
2446[[package]]
2447name = "windows_aarch64_msvc"
2448version = "0.42.2"
2449source = "registry+https://github.com/rust-lang/crates.io-index"
2450checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
2451
2452[[package]]
2453name = "windows_aarch64_msvc"
2454version = "0.52.6"
2455source = "registry+https://github.com/rust-lang/crates.io-index"
2456checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
2457
2458[[package]]
2459name = "windows_i686_gnu"
2460version = "0.42.2"
2461source = "registry+https://github.com/rust-lang/crates.io-index"
2462checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
2463
2464[[package]]
2465name = "windows_i686_gnu"
2466version = "0.52.6"
2467source = "registry+https://github.com/rust-lang/crates.io-index"
2468checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
2469
2470[[package]]
2471name = "windows_i686_gnullvm"
2472version = "0.52.6"
2473source = "registry+https://github.com/rust-lang/crates.io-index"
2474checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
2475
2476[[package]]
2477name = "windows_i686_msvc"
2478version = "0.42.2"
2479source = "registry+https://github.com/rust-lang/crates.io-index"
2480checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
2481
2482[[package]]
2483name = "windows_i686_msvc"
2484version = "0.52.6"
2485source = "registry+https://github.com/rust-lang/crates.io-index"
2486checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
2487
2488[[package]]
2489name = "windows_x86_64_gnu"
2490version = "0.42.2"
2491source = "registry+https://github.com/rust-lang/crates.io-index"
2492checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
2493
2494[[package]]
2495name = "windows_x86_64_gnu"
2496version = "0.52.6"
2497source = "registry+https://github.com/rust-lang/crates.io-index"
2498checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
2499
2500[[package]]
2501name = "windows_x86_64_gnullvm"
2502version = "0.42.2"
2503source = "registry+https://github.com/rust-lang/crates.io-index"
2504checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
2505
2506[[package]]
2507name = "windows_x86_64_gnullvm"
2508version = "0.52.6"
2509source = "registry+https://github.com/rust-lang/crates.io-index"
2510checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
2511
2512[[package]]
2513name = "windows_x86_64_msvc"
2514version = "0.42.2"
2515source = "registry+https://github.com/rust-lang/crates.io-index"
2516checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
2517
2518[[package]]
2519name = "windows_x86_64_msvc"
2520version = "0.52.6"
2521source = "registry+https://github.com/rust-lang/crates.io-index"
2522checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
2523
2524[[package]]
2525name = "winnow"
2526version = "1.0.5"
2527source = "registry+https://github.com/rust-lang/crates.io-index"
2528checksum = "8c3b93199df0ab874cdf0c6a94f0a0dc3423fe41f1cafb62b8bd7b1deb277aef"
2529dependencies = [
2530 "memchr",
2531]
2532
2533[[package]]
2534name = "winsafe"
2535version = "0.0.19"
2536source = "registry+https://github.com/rust-lang/crates.io-index"
2537checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904"
2538
2539[[package]]
2540name = "xml-rs"
2541version = "0.8.29"
2542source = "registry+https://github.com/rust-lang/crates.io-index"
2543checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7"
2544
2545[[package]]
2546name = "zeno"
2547version = "0.3.3"
2548source = "registry+https://github.com/rust-lang/crates.io-index"
2549checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524"
2550
2551[[package]]
2552name = "zerocopy"
2553version = "0.8.66"
2554source = "registry+https://github.com/rust-lang/crates.io-index"
2555checksum = "cba8a86aee14fc8cc6c208af60854b3d4ab7185a9a369a12c648faa2716ff42a"
2556dependencies = [
2557 "zerocopy-derive",
2558]
2559
2560[[package]]
2561name = "zerocopy-derive"
2562version = "0.8.66"
2563source = "registry+https://github.com/rust-lang/crates.io-index"
2564checksum = "f89bca3b96ceb3cfcb4572790402f977442270d252b9a8504ebc258760c55f94"
2565dependencies = [
2566 "proc-macro2",
2567 "quote",
2568 "syn 2.0.119",
2569]
2570
2571[[package]]
2572name = "zlib-rs"
2573version = "0.6.9"
2574source = "registry+https://github.com/rust-lang/crates.io-index"
2575checksum = "aa76918995d776d9dd34d371030be228d021137449771493d56e29f77e4148ac"
2576
2577[[package]]
2578name = "zmij"
2579version = "1.0.23"
2580source = "registry+https://github.com/rust-lang/crates.io-index"
2581checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
2582
2583[[package]]
2584name = "zune-core"
2585version = "0.5.4"
2586source = "registry+https://github.com/rust-lang/crates.io-index"
2587checksum = "c1a65ee146f41cb456b005bc898af3ab1495ded4ee61ac3637103f40ccacac18"
2588
2589[[package]]
2590name = "zune-inflate"
2591version = "0.2.54"
2592source = "registry+https://github.com/rust-lang/crates.io-index"
2593checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02"
2594dependencies = [
2595 "simd-adler32",
2596]
2597
2598[[package]]
2599name = "zune-jpeg"
2600version = "0.5.15"
2601source = "registry+https://github.com/rust-lang/crates.io-index"
2602checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296"
2603dependencies = [
2604 "zune-core",
2605]
crates/web/Cargo.toml created+27
......@@ -0,0 +1,27 @@
1[package]
2name = "fission-web"
3version = "0.1.0"
4edition = "2024"
5publish = false
6
7# Standalone workspace: the native workspace never builds this crate.
8[workspace]
9
10[lib]
11crate-type = ["cdylib"]
12
13[dependencies]
14engine = { path = "../engine" }
15model = { path = "../model" }
16console_error_panic_hook = "0.1"
17js-sys = "0.3"
18serde_json = "1"
19wasm-bindgen = "=0.2.128"
20wasm-bindgen-futures = "0.4"
21web-sys = { version = "0.3", features = ["HtmlCanvasElement"] }
22wgpu = "30.0.1"
23
24[profile.release]
25opt-level = "s"
26lto = true
27codegen-units = 1
crates/web/README.md created+44
......@@ -0,0 +1,44 @@
1# Fission on the web
2
3Evaluates Fusion `.comp` files with the native `engine` on WebGPU and presents the chosen node to a canvas.
4Standalone crate (`[workspace]` in its own manifest): the native workspace never builds it.
5
6## Build
7
8```sh
9rustup target add wasm32-unknown-unknown
10cargo install wasm-bindgen-cli --version 0.2.128 # must match the `=0.2.128` pin in Cargo.toml
11crates/web/build.sh # -> crates/web/dist/{index.html,pkg/}
12python3 -m http.server -d crates/web/dist 8080 # any static host works
13```
14
15`OUT=/tmp/fission-web-dist PROFILE=release crates/web/build.sh` redirects the output. Needs a browser with WebGPU.
16
17## Use
18
19- **Demo** loads the built-in `demo.comp` (3D simplex `FastNoise`, `Displace`, `TextPlus`, `Merge`, `Glow`, `ColorCorrector`, animated splines and expressions).
20- **Open .comp…**, **Open folder…** or drop a `.comp` / project folder on the page. Images in the folder are registered
21 with `MediaCache::insert_virtual_bytes`; a `Loader` path (even `C:\shots\plate.0001.png`) resolves to the file sharing
22 the longest run of trailing path components. Missing media is listed under the node list.
23- Transport: Play/Pause (Space), scrubber, ←/→ step. The dropdown, the Flow graph and the node list all pick the viewed node.
24
25## Native vs. wasm differences
26
27| Area | wasm32 |
28| --- | --- |
29| Expressions | pure-Rust Lua-subset evaluator (`model::expr`); no statement bodies or method calls |
30| Audio, export, RAM prefetch thread | compiled out |
31| Video loaders | unavailable (no ffmpeg / AVFoundation) |
32| EXR, fonts | not from virtual files / no system fonts (see below) |
33
34## Needs changes outside this crate's claim
35
36The browser cannot render until these land; each is verified by building a patched scratch copy and running it in Chrome (WebGPU, Metal).
37
381. **`std::time::Instant::now()` panics on `wasm32-unknown-unknown`.** `engine/src/eval/mod.rs:11` and `eval/dispatch.rs:4`
39 `use std::time::Instant;` must become `use web_time::Instant;` (`web-time` is already a wasm32 dependency of `engine`;
40 gate it with `cfg(target_arch = "wasm32")` or add it for all targets, where it re-exports `std`).
412. **No fonts**: `text_engine::database()` only loads system fonts, so `TextPlus` renders empty in the browser.
42 It needs a hook to register font bytes (`fontdb::Database::load_font_data`).
433. **EXR from virtual files**: `media/exr.rs::decode_exr_rgba` opens a `File`; it needs a bytes entry point.
444. `eval/io.rs::probe_clip_dims` still reads dimensions from the filesystem for missing media (cosmetic).
crates/web/build.sh created+13
......@@ -0,0 +1,13 @@
1#!/usr/bin/env bash
2# Builds the browser app into crates/web/dist (override with OUT=...), ready to serve statically.
3# needs: rustup target add wasm32-unknown-unknown; wasm-bindgen-cli 0.2.128 (cargo install wasm-bindgen-cli --version 0.2.128)
4set -euo pipefail
5cd "$(dirname "$0")"
6out="${OUT:-dist}"
7profile="${PROFILE:-release}"
8
9cargo build --target wasm32-unknown-unknown --profile "$profile"
10rm -rf "$out" && mkdir -p "$out"
11wasm-bindgen --target web --no-typescript --out-dir "$out/pkg" "target/wasm32-unknown-unknown/$profile/fission_web.wasm"
12cp index.html "$out/"
13echo "built $out/ -- serve with: python3 -m http.server -d $out 8080"
crates/web/demo.comp created+127
......@@ -0,0 +1,127 @@
1Composition {
2 CurrentTime = 0,
3 RenderRange = { 0, 149 },
4 GlobalRange = { 0, 149 },
5 Tools = ordered() {
6 NoiseSeethe = BezierSpline {
7 SplineColor = { Red = 90, Green = 200, Blue = 255 },
8 KeyFrames = {
9 [0] = { 0, Flags = { Linear = true } },
10 [149] = { 14, Flags = { Linear = true } },
11 },
12 },
13 WarpAmount = BezierSpline {
14 SplineColor = { Red = 255, Green = 120, Blue = 60 },
15 KeyFrames = {
16 [0] = { 0, RH = { 25, 0.1 } },
17 [75] = { 0.3, LH = { 50, 0.2 }, RH = { 100, 0.2 } },
18 [149] = { 0, LH = { 125, 0.1 } },
19 },
20 },
21 GlowSize = BezierSpline {
22 SplineColor = { Red = 255, Green = 220, Blue = 120 },
23 KeyFrames = {
24 [0] = { 2, Flags = { Linear = true } },
25 [75] = { 12, Flags = { Linear = true } },
26 [149] = { 2, Flags = { Linear = true } },
27 },
28 },
29 Noise = FastNoise {
30 Inputs = {
31 Width = Input { Value = 960, },
32 Height = Input { Value = 540, },
33 Detail = Input { Value = 4, },
34 XScale = Input { Value = 3, },
35 YScale = Input { Value = 3, },
36 Seethe = Input { SourceOp = "NoiseSeethe", Source = "Value", },
37 Color1Red = Input { Value = 0, },
38 Color1Green = Input { Value = 0.04, },
39 Color1Blue = Input { Value = 0.22, },
40 Color1Alpha = Input { Value = 1, },
41 Color2Red = Input { Value = 0.1, },
42 Color2Green = Input { Value = 0.9, },
43 Color2Blue = Input { Value = 1, },
44 Color2Alpha = Input { Value = 1, },
45 },
46 ViewInfo = OperatorInfo { Pos = { 0, 0 } },
47 },
48 Warm = FastNoise {
49 Inputs = {
50 Width = Input { Value = 960, },
51 Height = Input { Value = 540, },
52 Detail = Input { Value = 3, },
53 XScale = Input { Value = 1.6, },
54 YScale = Input { Value = 1.6, },
55 Seethe = Input { Value = 3, Expression = "time * 0.15 + floor(time / 5) * 2", },
56 Color1Red = Input { Value = 0.3, },
57 Color1Green = Input { Value = 0.02, },
58 Color1Blue = Input { Value = 0.12, },
59 Color1Alpha = Input { Value = 1, },
60 Color2Red = Input { Value = 1, },
61 Color2Green = Input { Value = 0.62, },
62 Color2Blue = Input { Value = 0.2, },
63 Color2Alpha = Input { Value = 1, },
64 },
65 ViewInfo = OperatorInfo { Pos = { 0, 80 } },
66 },
67 Warp = Displace {
68 Inputs = {
69 Type = Input { Value = 1, },
70 XRefraction = Input { SourceOp = "WarpAmount", Source = "Value", },
71 YRefraction = Input { SourceOp = "WarpAmount", Source = "Value", },
72 Input = Input { SourceOp = "Warm", Source = "Output", },
73 Foreground = Input { SourceOp = "Noise", Source = "Output", },
74 },
75 ViewInfo = OperatorInfo { Pos = { 150, 40 } },
76 },
77 Title = TextPlus {
78 Inputs = {
79 Width = Input { Value = 960, },
80 Height = Input { Value = 540, },
81 StyledText = Input { Value = "FISSION", },
82 Font = Input { Value = "Helvetica Neue", },
83 Style = Input { Value = "Bold", },
84 Size = Input { Value = 0.2, Expression = "0.2 + 0.015 * sin(time * 0.15)", },
85 Center = Input { Value = { 0.5, 0.5 }, },
86 },
87 ViewInfo = OperatorInfo { Pos = { 150, 120 } },
88 },
89 Mix = Merge {
90 Inputs = {
91 Background = Input { SourceOp = "Noise", Source = "Output", },
92 Foreground = Input { SourceOp = "Warp", Source = "Output", },
93 Blend = Input { Value = 0.6, },
94 },
95 ViewInfo = OperatorInfo { Pos = { 300, 0 } },
96 },
97 Merge1 = Merge {
98 Inputs = {
99 Background = Input { SourceOp = "Mix", Source = "Output", },
100 Foreground = Input { SourceOp = "Title", Source = "Output", },
101 },
102 ViewInfo = OperatorInfo { Pos = { 300, 80 } },
103 },
104 Glow1 = Glow {
105 Inputs = {
106 Input = Input { SourceOp = "Merge1", Source = "Output", },
107 XGlowSize = Input { SourceOp = "GlowSize", Source = "Value", },
108 Glow = Input { Value = 0.4, },
109 },
110 ViewInfo = OperatorInfo { Pos = { 450, 80 } },
111 },
112 Grade = ColorCorrector {
113 Inputs = {
114 Input = Input { SourceOp = "Glow1", Source = "Output", },
115 WheelSaturation1 = Input { Value = 1.7, },
116 MasterRGBGain = Input { Value = 1, },
117 MasterRGBGamma = Input { Value = 1.1, },
118 },
119 ViewInfo = OperatorInfo { Pos = { 600, 80 } },
120 },
121 },
122 Prefs = {
123 Comp = {
124 FrameFormat = { Width = 960, Height = 540, Rate = 30, },
125 },
126 },
127}
crates/web/index.html created+288
......@@ -0,0 +1,288 @@
1<!doctype html>
2<html lang="en">
3<head>
4<meta charset="utf-8">
5<meta name="viewport" content="width=device-width, initial-scale=1">
6<title>Fission</title>
7<style>
8 :root { color-scheme: dark; --bg: #141416; --panel: #1c1c20; --line: #2c2c33; --fg: #e6e6ea; --dim: #8b8b96; --accent: #7aa2ff; --warn: #ffb454; --bad: #ff6b6b; }
9 * { box-sizing: border-box; }
10 body { margin: 0; height: 100vh; display: grid; grid-template: "bar bar" auto "stage side" 1fr / 1fr 340px; background: var(--bg); color: var(--fg); font: 13px/1.4 system-ui, sans-serif; }
11 button, select { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; }
12 button:hover:not(:disabled) { border-color: var(--accent); cursor: pointer; }
13 button:disabled { opacity: .45; }
14 header { grid-area: bar; display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); }
15 header h1 { font-size: 14px; margin: 0 8px 0 0; letter-spacing: .08em; }
16 #status { margin-left: auto; color: var(--dim); font-variant-numeric: tabular-nums; }
17 #banner { grid-column: 1 / -1; display: none; padding: 10px 14px; background: #3a1d1d; color: #ffd0d0; border-bottom: 1px solid #6a2c2c; }
18 main { grid-area: stage; display: flex; flex-direction: column; min-height: 0; padding: 12px; gap: 10px; }
19 #stage { flex: 1; min-height: 0; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: 8px; position: relative; overflow: hidden; }
20 #stage.drop { border-color: var(--accent); background: #1a2036; }
21 canvas { max-width: 100%; max-height: 100%; background: #000; }
22 #hint { position: absolute; color: var(--dim); pointer-events: none; text-align: center; }
23 #transport { display: flex; gap: 10px; align-items: center; }
24 #scrub { flex: 1; accent-color: var(--accent); }
25 #frame { min-width: 110px; font-variant-numeric: tabular-nums; }
26 aside { grid-area: side; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
27 aside h2 { margin: 0; padding: 8px 12px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
28 #flow { width: 100%; height: 240px; background: var(--panel); border-block: 1px solid var(--line); }
29 #flow .edge { fill: none; stroke-width: 1.5; opacity: .8; }
30 #flow g.node { cursor: pointer; }
31 #flow rect { fill: #262630; stroke: var(--line); }
32 #flow g.node:hover rect { stroke: var(--accent); }
33 #flow g.sel rect { stroke: var(--accent); stroke-width: 2; }
34 #flow g.bypassed rect { stroke-dasharray: 3 2; opacity: .6; }
35 #flow text { fill: var(--fg); font-size: 10px; pointer-events: none; }
36 #nodes { flex: 1; overflow: auto; margin: 0; padding: 0; list-style: none; }
37 #nodes li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
38 #nodes li:hover { background: var(--panel); }
39 #nodes li.sel { background: #212a44; }
40 #nodes .kind { color: var(--dim); }
41 #nodes .missing { color: var(--bad); }
42 #notes { padding: 8px 12px; color: var(--warn); font-size: 12px; border-top: 1px solid var(--line); }
43 #notes:empty { display: none; }
44 input[type=file] { display: none; }
45</style>
46</head>
47<body>
48<header>
49 <h1>FISSION</h1>
50 <button id="demo">Demo</button>
51 <button id="open-comp">Open .comp…</button>
52 <button id="open-folder">Open folder…</button>
53 <select id="comps" hidden title="Compositions in the folder"></select>
54 <span id="status"></span>
55</header>
56<div id="banner" role="alert"></div>
57<main>
58 <div id="stage">
59 <canvas id="canvas" width="960" height="540"></canvas>
60 <div id="hint">Drop a <b>.comp</b> or a project folder here</div>
61 </div>
62 <div id="transport">
63 <button id="play" disabled>Play</button>
64 <input id="scrub" type="range" min="0" max="0" value="0" step="1" disabled>
65 <span id="frame">–</span>
66 <select id="node" disabled title="Node to view"></select>
67 </div>
68</main>
69<aside>
70 <h2>Flow</h2>
71 <svg id="flow" viewBox="0 0 340 240" role="img" aria-label="Flow graph"></svg>
72 <h2>Nodes</h2>
73 <ul id="nodes"></ul>
74 <div id="notes"></div>
75</aside>
76<input id="file-comp" type="file" accept=".comp,.setting,.txt,image/*" multiple>
77<input id="file-folder" type="file" webkitdirectory multiple>
78<script type="module">
79import init, { Fission } from './pkg/fission_web.js';
80
81const $ = (id) => document.getElementById(id);
82const MEDIA_EXT = /\.(png|jpe?g|tiff?|webp|bmp|gif|exr|tga)$/i;
83const MAX_FILE_BYTES = 256 * 1024 * 1024;
84const PORT_COLOR = { Background: '#e6b450', Input: '#e6b450', Foreground: '#6fcf97', EffectMask: '#7aa2ff' };
85
86const fail = (message) => { $('banner').textContent = message; $('banner').style.display = 'block'; };
87
88let app = null;
89let info = null;
90let sources = new Map();
91let frame = 0, playing = false, playStart = 0, playOrigin = 0, lastDrawn = null;
92let dirty = true, fps = 0, lastTick = 0, evalMs = 0, broken = false;
93
94async function boot() {
95 if (!navigator.gpu) {
96 fail('This browser has no WebGPU. Use a current Chrome, Edge or Safari, or enable WebGPU in Firefox.');
97 return;
98 }
99 try {
100 await init();
101 app = await Fission.create($('canvas'));
102 } catch (e) {
103 fail(`Could not start the renderer: ${e.message ?? e}`);
104 return;
105 }
106 loadComp('Demo', Fission.demo_comp());
107 requestAnimationFrame(tick);
108}
109
110function loadComp(name, text) {
111 if (broken) return;
112 try {
113 info = JSON.parse(app.load_comp(text, name));
114 } catch (e) {
115 fail(`${name}: ${e.message ?? e}`);
116 return;
117 }
118 $('banner').style.display = 'none';
119 $('hint').hidden = true;
120 const [start, end] = info.range;
121 frame = start; playing = false; lastDrawn = null; dirty = true;
122 $('scrub').min = start; $('scrub').max = end; $('scrub').value = start;
123 for (const id of ['play', 'scrub', 'node']) $(id).disabled = false;
124 $('play').textContent = 'Play';
125 $('node').replaceChildren(...info.nodes.map((n) => new Option(`${n.name} (${n.kind})`, n.id)));
126 $('node').value = info.target ?? info.nodes[0]?.id;
127 refreshGraph();
128}
129
130function refreshGraph() {
131 info = JSON.parse(app.describe());
132 drawFlow();
133 const ul = $('nodes');
134 ul.replaceChildren(...info.nodes.map((n) => {
135 const li = document.createElement('li');
136 li.dataset.id = n.id;
137 li.classList.toggle('sel', n.id === info.target);
138 const miss = n.clips.filter((c) => !c.found).length;
139 li.innerHTML = `<span>${esc(n.name)}${miss ? ` <span class="missing">${miss} missing</span>` : ''}</span><span class="kind">${esc(n.kind)}</span>`;
140 li.onclick = () => selectNode(n.id);
141 return li;
142 }));
143 const missing = info.nodes.flatMap((n) => n.clips.filter((c) => !c.found).map((c) => c.file.split(/[\\/]/).pop()));
144 $('notes').textContent = missing.length ? `Missing media: ${[...new Set(missing)].join(', ')}. Drop the project folder to supply it.` : '';
145}
146
147function selectNode(id) {
148 app.set_node(id);
149 info.target = id;
150 $('node').value = id;
151 dirty = true;
152 for (const li of $('nodes').children) li.classList.toggle('sel', Number(li.dataset.id) === id);
153 drawFlow();
154}
155
156function drawFlow() {
157 const svg = $('flow');
158 const [W, H, PAD, BW, BH] = [340, 240, 14, 56, 20];
159 const xs = info.nodes.map((n) => n.pos[0]), ys = info.nodes.map((n) => n.pos[1]);
160 const [x0, y0] = [Math.min(...xs), Math.min(...ys)];
161 const sx = (W - 2 * PAD - BW) / (Math.max(...xs) - x0 || 1), sy = (H - 2 * PAD - BH) / (Math.max(...ys) - y0 || 1);
162 const at = new Map(info.nodes.map((n) => [n.name, [PAD + (n.pos[0] - x0) * Math.min(sx, 1.2), PAD + (n.pos[1] - y0) * Math.min(sy, 1.2)]]));
163 let out = '';
164 for (const n of info.nodes) for (const [port, src] of n.from) {
165 const a = at.get(src), b = at.get(n.name);
166 if (!a || !b) continue;
167 const [ax, ay, bx, by] = [a[0] + BW, a[1] + BH / 2, b[0], b[1] + BH / 2];
168 const mx = (ax + bx) / 2;
169 out += `<path class="edge" stroke="${PORT_COLOR[port] ?? '#8b8b96'}" d="M${ax},${ay} C${mx},${ay} ${mx},${by} ${bx},${by}"/>`;
170 }
171 for (const n of info.nodes) {
172 const [x, y] = at.get(n.name);
173 const cls = ['node', n.id === info.target ? 'sel' : '', n.bypassed ? 'bypassed' : ''].join(' ');
174 out += `<g class="${cls}" data-id="${n.id}"><rect x="${x}" y="${y}" width="${BW}" height="${BH}" rx="4"/><text x="${x + 5}" y="${y + 13}">${esc(n.name.slice(0, 11))}</text></g>`;
175 }
176 svg.innerHTML = out;
177 svg.querySelectorAll('g.node').forEach((g) => { g.onclick = () => selectNode(Number(g.dataset.id)); });
178}
179
180const esc = (s) => s.replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' })[c]);
181
182function tick(now) {
183 requestAnimationFrame(tick);
184 if (!info || broken) return;
185 const [start, end] = info.range;
186 if (playing) {
187 const len = end - start + 1;
188 frame = start + (playOrigin - start + Math.floor(((now - playStart) / 1000) * info.fps)) % len;
189 $('scrub').value = frame;
190 }
191 if (dirty || frame !== lastDrawn) {
192 try {
193 evalMs = app.render(frame);
194 } catch (e) {
195 broken = true;
196 fail(`Render failed: ${e.message ?? e}. Reload the page; details are in the console.`);
197 return;
198 }
199 if (lastTick) fps += ((1000 / (now - lastTick)) - fps) * 0.15;
200 lastTick = now;
201 lastDrawn = frame; dirty = false;
202 const bad = app.unsupported();
203 $('notes').dataset.unsupported = bad.join(', ');
204 } else if (!playing) {
205 lastTick = 0;
206 }
207 const unsupported = $('notes').dataset.unsupported;
208 $('frame').textContent = `f ${frame} / ${end}`;
209 $('status').textContent = `${info.name} · ${info.width}×${info.height} · ${info.fps} fps · ${playing ? fps.toFixed(0) + ' fps · ' : ''}${evalMs.toFixed(1)} ms cpu${unsupported ? ' · unsupported: ' + unsupported : ''}`;
210}
211
212function setPlaying(on) {
213 playing = on;
214 $('play').textContent = on ? 'Pause' : 'Play';
215 playStart = performance.now(); playOrigin = frame; lastTick = 0;
216}
217
218$('play').onclick = () => setPlaying(!playing);
219$('scrub').oninput = (e) => { frame = Number(e.target.value); if (playing) setPlaying(true); dirty = true; };
220$('node').onchange = (e) => selectNode(Number(e.target.value));
221$('demo').onclick = () => { app.clear_files(); sources.clear(); $('comps').hidden = true; loadComp('Demo', Fission.demo_comp()); };
222$('open-comp').onclick = () => $('file-comp').click();
223$('open-folder').onclick = () => $('file-folder').click();
224$('comps').onchange = (e) => { const f = sources.get(e.target.value); if (f) f.text().then((t) => loadComp(e.target.value.replace(/\.comp$/i, ''), t)); };
225addEventListener('keydown', (e) => {
226 if (e.target.matches('select, input[type=range]') || !info) return;
227 if (e.code === 'Space') { e.preventDefault(); setPlaying(!playing); }
228 else if (e.code === 'ArrowLeft' || e.code === 'ArrowRight') {
229 const [start, end] = info.range;
230 frame = Math.min(end, Math.max(start, frame + (e.code === 'ArrowRight' ? 1 : -1)));
231 $('scrub').value = frame; if (playing) setPlaying(false); dirty = true;
232 }
233});
234
235$('file-comp').onchange = (e) => ingest([...e.target.files].map((file) => ({ path: file.name, file })));
236$('file-folder').onchange = (e) => ingest([...e.target.files].map((file) => ({ path: file.webkitRelativePath || file.name, file })));
237
238const stage = $('stage');
239addEventListener('dragover', (e) => { e.preventDefault(); stage.classList.add('drop'); });
240addEventListener('dragleave', (e) => { if (!e.relatedTarget) stage.classList.remove('drop'); });
241addEventListener('drop', async (e) => {
242 e.preventDefault();
243 stage.classList.remove('drop');
244 const entries = [...e.dataTransfer.items].map((i) => i.webkitGetAsEntry?.()).filter(Boolean);
245 ingest(await walk(entries));
246});
247
248async function walk(entries) {
249 const out = [];
250 const visit = async (entry) => {
251 if (entry.isFile) {
252 out.push({ path: entry.fullPath.replace(/^\//, ''), file: await new Promise((ok, no) => entry.file(ok, no)) });
253 } else if (entry.isDirectory) {
254 const reader = entry.createReader();
255 for (let batch; (batch = await new Promise((ok, no) => reader.readEntries(ok, no))).length;) {
256 await Promise.all(batch.map(visit));
257 }
258 }
259 };
260 await Promise.all(entries.map(visit));
261 return out;
262}
263
264async function ingest(files) {
265 if (!app) return;
266 const comps = files.filter(({ path }) => /\.comp$/i.test(path));
267 if (comps.length) { app.clear_files(); sources.clear(); }
268 for (const { path, file } of files) {
269 if (!MEDIA_EXT.test(path) || file.size > MAX_FILE_BYTES) continue;
270 app.add_file(path, new Uint8Array(await file.arrayBuffer()));
271 }
272 if (comps.length) {
273 comps.sort((a, b) => a.path.localeCompare(b.path));
274 for (const { path, file } of comps) sources.set(path, file);
275 $('comps').replaceChildren(...comps.map(({ path }) => new Option(path, path)));
276 $('comps').hidden = comps.length < 2;
277 const first = comps[0];
278 loadComp(first.path.replace(/\.comp$/i, ''), await first.file.text());
279 } else if (info) {
280 refreshGraph();
281 dirty = true;
282 }
283}
284
285boot();
286</script>
287</body>
288</html>
crates/web/src/lib.rs created+263
......@@ -0,0 +1,263 @@
1//! Browser entry point: evaluates a Fusion `.comp` with the native engine on WebGPU and presents
2//! the chosen node to a `<canvas>`. All UI lives in `index.html`.
3#![cfg(target_arch = "wasm32")]
4
5use engine::media::MediaCache;
6use engine::{DisplaySettings, Engine};
7use model::{Comp, NodeId};
8use serde_json::json;
9use std::collections::HashSet;
10use wasm_bindgen::prelude::*;
11
12const DEMO_COMP: &str = include_str!("../demo.comp");
13
14struct Viewer {
15 texture: wgpu::Texture,
16 bind_group: wgpu::BindGroup,
17}
18
19#[wasm_bindgen]
20pub struct Fission {
21 engine: Engine,
22 surface: wgpu::Surface<'static>,
23 surface_format: wgpu::TextureFormat,
24 present: wgpu::RenderPipeline,
25 sampler: wgpu::Sampler,
26 viewer: Option<Viewer>,
27 comp: Option<Comp>,
28 target: Option<NodeId>,
29 unsupported: Vec<String>,
30}
31
32fn js_err(e: impl std::fmt::Display) -> JsError {
33 JsError::new(&e.to_string())
34}
35
36#[wasm_bindgen]
37impl Fission {
38 /// Fails with a readable message when the browser has no WebGPU adapter.
39 pub async fn create(canvas: web_sys::HtmlCanvasElement) -> Result<Fission, JsError> {
40 console_error_panic_hook::set_once();
41 let instance = wgpu::Instance::new(wgpu::InstanceDescriptor::new_without_display_handle());
42 let surface = instance.create_surface(wgpu::SurfaceTarget::Canvas(canvas)).map_err(js_err)?;
43 let adapter = instance
44 .request_adapter(&wgpu::RequestAdapterOptions {
45 compatible_surface: Some(&surface),
46 ..Default::default()
47 })
48 .await
49 .map_err(|e| JsError::new(&format!("No WebGPU adapter: {e}")))?;
50 let mut features = wgpu::Features::empty();
51 if adapter.features().contains(wgpu::Features::FLOAT32_FILTERABLE) {
52 features |= wgpu::Features::FLOAT32_FILTERABLE;
53 }
54 let (device, queue) = adapter
55 .request_device(&wgpu::DeviceDescriptor {
56 required_features: features,
57 required_limits: adapter.limits(),
58 ..Default::default()
59 })
60 .await
61 .map_err(js_err)?;
62
63 let surface_format = surface
64 .get_capabilities(&adapter)
65 .formats
66 .into_iter()
67 .find(|f| !f.is_srgb())
68 .unwrap_or(wgpu::TextureFormat::Bgra8Unorm);
69 let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor {
70 label: Some("present"),
71 source: wgpu::ShaderSource::Wgsl(include_str!("present.wgsl").into()),
72 });
73 let present = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
74 label: Some("present"),
75 layout: None,
76 vertex: wgpu::VertexState {
77 module: &shader,
78 entry_point: Some("vertex"),
79 compilation_options: Default::default(),
80 buffers: &[],
81 },
82 fragment: Some(wgpu::FragmentState {
83 module: &shader,
84 entry_point: Some("fragment"),
85 compilation_options: Default::default(),
86 targets: &[Some(surface_format.into())],
87 }),
88 primitive: Default::default(),
89 depth_stencil: None,
90 multisample: Default::default(),
91 multiview_mask: None,
92 cache: None,
93 });
94 let sampler = device.create_sampler(&wgpu::SamplerDescriptor {
95 mag_filter: wgpu::FilterMode::Linear,
96 min_filter: wgpu::FilterMode::Linear,
97 ..Default::default()
98 });
99
100 Ok(Fission {
101 engine: Engine::new(device, queue),
102 surface,
103 surface_format,
104 present,
105 sampler,
106 viewer: None,
107 comp: None,
108 target: None,
109 unsupported: Vec::new(),
110 })
111 }
112
113 pub fn demo_comp() -> String {
114 DEMO_COMP.to_owned()
115 }
116
117 /// Registers a project file (a dropped folder's relative path) that `Loader` clips resolve against.
118 pub fn add_file(&mut self, path: &str, bytes: &[u8]) {
119 MediaCache::insert_virtual_bytes(path, bytes);
120 self.engine.bust_all_caches();
121 }
122
123 pub fn clear_files(&mut self) {
124 MediaCache::clear_virtual_bytes();
125 self.engine.bust_all_caches();
126 }
127
128 /// Parses `text`, selects its default output and returns [`Self::describe`].
129 pub fn load_comp(&mut self, text: &str, name: &str) -> Result<String, JsError> {
130 let mut comp = Comp::from_fusion_str(text).map_err(js_err)?;
131 comp.name = name.to_owned();
132 self.target = comp.default_output_node();
133 self.comp = Some(comp);
134 self.engine.bust_all_caches();
135 self.describe()
136 }
137
138 /// JSON: comp format, frame range, node graph and whether each `Loader` clip resolves.
139 pub fn describe(&self) -> Result<String, JsError> {
140 let comp = self.comp.as_ref().ok_or_else(|| JsError::new("no comp loaded"))?;
141 let names: HashSet<String> = comp.node_by_name.keys().cloned().collect();
142 let nodes: Vec<_> = comp
143 .nodes
144 .iter()
145 .filter(|n| !n.internal)
146 .map(|n| {
147 let from: Vec<_> = n.image_connections(&names).into_iter().map(|(port, src, _)| json!([port, src])).collect();
148 let clips: Vec<_> = n
149 .clips
150 .iter()
151 .map(|c| json!({ "file": c.filename, "found": engine::media::resolve_clip_path(c, c.global_start).is_some() }))
152 .collect();
153 json!({ "id": n.id.0, "name": n.name, "kind": n.kind, "pos": n.pos, "bypassed": n.bypassed, "from": from, "clips": clips })
154 })
155 .collect();
156 Ok(json!({
157 "name": comp.name,
158 "width": comp.width,
159 "height": comp.height,
160 "fps": comp.fps,
161 "range": comp.render_range,
162 "target": self.target.map(|t| t.0),
163 "nodes": nodes,
164 })
165 .to_string())
166 }
167
168 pub fn set_node(&mut self, id: usize) -> Result<(), JsError> {
169 let comp = self.comp.as_ref().ok_or_else(|| JsError::new("no comp loaded"))?;
170 if id >= comp.nodes.len() {
171 return Err(JsError::new("no such node"));
172 }
173 self.target = Some(NodeId(id));
174 Ok(())
175 }
176
177 /// Evaluates the selected node at `frame` into the canvas and returns the CPU-side milliseconds.
178 pub fn render(&mut self, frame: f64) -> Result<f64, JsError> {
179 let (comp, target) = self.comp.as_ref().zip(self.target).ok_or_else(|| JsError::new("no comp loaded"))?;
180 // Cached by the engine, so `render_into_viewer` below reuses it; the size can change with media or time.
181 let (tex, _) = self.engine.evaluate(comp, target, frame);
182 if self.viewer.as_ref().is_none_or(|v| [v.texture.width(), v.texture.height()] != tex.canvas_size) {
183 self.viewer = Some(make_viewer(self.engine.device(), &self.surface, self.surface_format, &self.present, &self.sampler, tex.canvas_size));
184 }
185 let viewer = self.viewer.as_ref().expect("viewer sized above");
186 let stats = self.engine.render_into_viewer(comp, target, frame, &viewer.texture, DisplaySettings::default());
187 self.unsupported = stats.unsupported_nodes;
188
189 let frame_tex = match self.surface.get_current_texture() {
190 wgpu::CurrentSurfaceTexture::Success(t) | wgpu::CurrentSurfaceTexture::Suboptimal(t) => t,
191 _ => return Ok(stats.eval_ms),
192 };
193 let device = self.engine.device();
194 let mut encoder = device.create_command_encoder(&Default::default());
195 let view = frame_tex.texture.create_view(&Default::default());
196 {
197 let mut pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
198 color_attachments: &[Some(wgpu::RenderPassColorAttachment {
199 view: &view,
200 depth_slice: None,
201 resolve_target: None,
202 ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::BLACK), store: wgpu::StoreOp::Store },
203 })],
204 ..Default::default()
205 });
206 pass.set_pipeline(&self.present);
207 pass.set_bind_group(0, &viewer.bind_group, &[]);
208 pass.draw(0..3, 0..1);
209 }
210 self.engine.queue().submit(Some(encoder.finish()));
211 self.engine.queue().present(frame_tex);
212 Ok(stats.eval_ms)
213 }
214
215 /// Kinds the last rendered frame could not evaluate.
216 pub fn unsupported(&self) -> Vec<String> {
217 self.unsupported.clone()
218 }
219}
220
221/// Sizes the canvas and the intermediate viewer texture to the node's logical output.
222fn make_viewer(
223 device: &wgpu::Device,
224 surface: &wgpu::Surface<'static>,
225 format: wgpu::TextureFormat,
226 present: &wgpu::RenderPipeline,
227 sampler: &wgpu::Sampler,
228 [width, height]: [u32; 2],
229) -> Viewer {
230 surface.configure(
231 device,
232 &wgpu::SurfaceConfiguration {
233 usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
234 format,
235 color_space: wgpu::SurfaceColorSpace::Auto,
236 width,
237 height,
238 present_mode: wgpu::PresentMode::AutoVsync,
239 desired_maximum_frame_latency: 2,
240 alpha_mode: wgpu::CompositeAlphaMode::Opaque,
241 view_formats: vec![],
242 },
243 );
244 let texture = device.create_texture(&wgpu::TextureDescriptor {
245 label: Some("viewer"),
246 size: wgpu::Extent3d { width, height, depth_or_array_layers: 1 },
247 mip_level_count: 1,
248 sample_count: 1,
249 dimension: wgpu::TextureDimension::D2,
250 format: wgpu::TextureFormat::Rgba8Unorm,
251 usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::STORAGE_BINDING,
252 view_formats: &[],
253 });
254 let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
255 label: Some("present"),
256 layout: &present.get_bind_group_layout(0),
257 entries: &[
258 wgpu::BindGroupEntry { binding: 0, resource: wgpu::BindingResource::TextureView(&texture.create_view(&Default::default())) },
259 wgpu::BindGroupEntry { binding: 1, resource: wgpu::BindingResource::Sampler(sampler) },
260 ],
261 });
262 Viewer { texture, bind_group }
263}
crates/web/src/present.wgsl created+18
......@@ -0,0 +1,18 @@
1@group(0) @binding(0) var frame: texture_2d<f32>;
2@group(0) @binding(1) var frame_sampler: sampler;
3
4struct Vertex {
5 @builtin(position) position: vec4<f32>,
6 @location(0) uv: vec2<f32>,
7}
8
9@vertex
10fn vertex(@builtin(vertex_index) index: u32) -> Vertex {
11 let corner = vec2<f32>(f32((index << 1u) & 2u), f32(index & 2u));
12 return Vertex(vec4<f32>(corner * 2.0 - 1.0, 0.0, 1.0), vec2<f32>(corner.x, 1.0 - corner.y));
13}
14
15@fragment
16fn fragment(v: Vertex) -> @location(0) vec4<f32> {
17 return textureSample(frame, frame_sampler, v.uv);
18}