Skip to main content

indicatrix_web_core/
lib.rs

1//! The compute side of the indicatrix browser app, with no DOM and no Slint in it.
2//!
3//! Everything here except [`host`] builds and is tested natively, so the logic a Web
4//! Worker runs is checked by `cargo test -p indicatrix-web-core` rather than only in a
5//! browser.
6//!
7//! - [`protocol`]: the messages between the page and its Workers ([`protocol::ToWorker`],
8//!   [`protocol::FromWorker`]), postcard-encoded into a transferred `ArrayBuffer`, and
9//!   the [`protocol::PROTOCOL_VERSION`] checked on `Init`.
10//! - [`scene`]: [`scene::SceneSpec`], the plain-data description of a render scene, and
11//!   [`scene::OwnedScene`], which builds exactly the scene the desktop builds for the
12//!   same settings and lends out a `FrameScene`.
13//! - [`render`]: the per-chunk CPU trace ([`render::handle_trace_chunk`]), the full-frame
14//!   [`render::Accumulator`] and the [`render::ChunkPlanner`] that sizes chunks.
15//! - [`solve`]: [`solve::handle_solve`], the solve worker's job: a native-TOML design in,
16//!   the solved masts, planes, status and warnings out.
17//! - [`solve_error`]: [`solve_error::SolveError`], the typed reason a solve-role job
18//!   produced no answer (superseded, cancelled, failed).
19//! - [`display`]: pixels from an accumulation -- the live tone map, the settled
20//!   denoise, the PNG export and its file name -- each the desktop's own call.
21//! - [`settings`]: the persisted render settings and session payload, and
22//!   [`settings::scene_spec`], which turns them into a [`scene::SceneSpec`] with the
23//!   desktop's conversions.
24//! - [`custom_material`]: the Design settings dialog's custom-material fields turned into
25//!   a `GemMaterial` and the snapshot a design file stores for it.
26//! - [`design_meta`]: the `.isdd` file's descriptive `[meta]` table as the page
27//!   keeps and stamps it (ISO-8601 UTC time, UUID v4 from caller-supplied bytes).
28//! - [`gpu_admission`]: the pure half of the GPU admission gate -- scene eligibility, the
29//!   per-adapter record and key, the self-check scene.
30//! - [`gpu_startup`]: the GPU start-up test's pure half -- what to do at page load, the
31//!   progress of a run, and the sentence that says what the app renders with.
32//! - [`gpu_ledger`]: the pool's book of full passes posted to the GPU Worker.
33//! - [`guide`]: the guided walkthrough's tab-session state (open, step, collapsed,
34//!   where the floating panel was dragged to).
35//! - [`hdr`]: the browser's HDR limits and the render-worker count rule for a map.
36//! - [`input`]: the size limits checked on a picked or dropped file before it is read.
37//! - [`open_route`]: what the Open picker offers and the design file's name (which loader
38//!   a file goes to is `indicatrix_editor::files::InputFileKind::classify`).
39//! - [`rows`]: the tier table's row ids, the driven-angle refusal, the schedule notes and
40//!   the history labels (pure helpers of the page's editor).
41//! - [`new_design`]: the New Design dialog's template path without the window.
42//! - [`storage_keys`]: the `indicatrix.<name>.v<n>` storage key builders.
43//! - [`tab_state`]: the design name and unsaved flag, which belong to one tab
44//!   (`sessionStorage`) rather than to the shared settings.
45//! - [`worker`]: [`worker::WorkerHandler`], the whole message-handling state machine a
46//!   Worker runs; the `indicatrix-web-compute` crate only moves bytes in and out of it.
47//! - [`host`] (wasm32 only): the page-side pool, [`host::WorkerPool`] with its
48//!   [`host::RenderPool`] and [`host::SolveClient`].
49
50pub mod custom_material;
51pub mod design_meta;
52pub mod display;
53pub mod gpu_admission;
54pub mod gpu_ledger;
55pub mod gpu_startup;
56pub mod guide;
57pub mod hdr;
58#[cfg(target_arch = "wasm32")]
59pub mod host;
60pub mod input;
61pub mod new_design;
62pub mod open_route;
63pub mod protocol;
64pub mod render;
65pub mod rows;
66pub mod scene;
67pub mod settings;
68pub mod solve;
69pub mod solve_error;
70pub mod storage_keys;
71pub mod tab_state;
72pub mod worker;
73
74/// Where the host finds the Worker script: the loader shim Trunk writes next to the
75/// app for `apps/indicatrix-web/index.html`'s `data-type="worker"` link.
76///
77/// Trunk names worker outputs after the Cargo package, never with a content hash
78/// (`trunk` 0.21's `hashed_wasm_base` skips hashing for `data-type="worker"`), and
79/// `data-loader-shim` adds `<name>_loader.js`, a classic-worker script that runs
80/// `importScripts("./indicatrix-web-compute.js")` and then instantiates
81/// `./indicatrix-web-compute_bg.wasm`. The URL is relative, so it resolves against the
82/// page and keeps working when the app is served from a sub-path.
83pub const WORKER_LOADER_URL: &str = "./indicatrix-web-compute_loader.js";
84
85/// Where the host finds the GPU Worker script: the loader shim Trunk writes next to the
86/// app for `apps/indicatrix-web/index.html`'s `data-type="worker"` link for `indicatrix-web-gpu`.
87pub const GPU_WORKER_LOADER_URL: &str = "./indicatrix-web-gpu_loader.js";