Skip to main content

indicatrix_worker/
lib.rs

1//! `indicatrix-worker`: a library server for a `indicatrix`-backed gemstone design catalogue,
2//! with optional render capacity on top.
3//!
4//! **Default role: library server.** Running `serve` with no extra features accepts
5//! `indicatrix-net`'s read-only design-library protocol (see [`serve::library`]) over
6//! mutual TLS -- listing/searching designs, fetching one in full, fetching an
7//! attachment's bytes. This is the default, not an add-on: a future Slint mobile client
8//! talks to exactly this protocol and never has a renderer compiled in.
9//!
10//! **`worker` feature (off by default): render capacity.** Gates `RenderRequest`
11//! handling, `stream_emit`, `render_core`, `render_cmd`, the `render` subcommand, and
12//! `Backend` advertisement in `WELCOME` -- see `Cargo.toml` for exactly what that turns
13//! on, and [`serve`]'s module docs for how one connection dispatches between the library
14//! and render protocols once both are compiled in.
15//!
16//! - `render` (only meaningful with `worker` on): trace a scene straight to a PNG, no
17//!   networking. See [`render_cmd::run`].
18//! - `serve`: the coordinator. Serves the library protocol to
19//!   viewers (always); under `worker` also accepts `join`ing workers on a separate
20//!   worker port ([`coordinator`]) and, with `--render`, renders `RenderRequest`s with
21//!   its own CPU/GPU. **`serve` no longer renders by default.** See [`serve::run`].
22//! - `join` (`worker`): dial a coordinator's worker port and serve its render requests
23//!   over that outbound connection. See [`join::run`].
24//!
25//! # GPU
26//!
27//! An optional `gpu` feature (off by default, implies `worker`) routes tracing through
28//! `indicatrix`'s GPU megakernel instead of `optics::raytracer::trace_spectral_ray`.
29//! Verified end to end against a real adapter -- see
30//! `crates/indicatrix/examples/gpu_equivalence_harness.rs`.
31//!
32//! [`indicatrix::renderer::gpu_backend::GpuBackend`] is the decline/fallback wrapper both
33//! this crate and `apps/indicatrix-cut` drive. It lives in `indicatrix`, not here, since
34//! a duplicated copy of a correctness policy (the HDR-environment decline) can drift
35//! into silently rendering the wrong image.
36
37// Trait-solver resource limit, not a lint: under `--features gpu`, proving the
38// `thread::spawn` closure in `serve::run`'s accept loop is `Send` requires recursing
39// through `wgpu`'s internal types deeper than the default limit allows. Unconditional
40// (not `cfg_attr`-gated to `gpu`) since a single crate-wide limit is simpler than
41// tracking which feature combination needs it, and it's a no-op when `wgpu` isn't
42// pulled in. Do not remove: the overflow reproduces on every `--features gpu` build.
43#![recursion_limit = "256"]
44
45#[cfg(feature = "worker")]
46pub mod assets;
47pub mod cli;
48#[cfg(feature = "worker")]
49pub mod coordinator;
50pub mod enroll;
51pub mod enroll_client;
52#[cfg(feature = "worker")]
53pub mod jobs;
54#[cfg(feature = "worker")]
55pub mod join;
56pub mod pki;
57#[cfg(feature = "worker")]
58pub mod png_out;
59#[cfg(feature = "worker")]
60pub mod render_cmd;
61#[cfg(feature = "worker")]
62pub mod render_core;
63pub mod serve;
64#[cfg(feature = "worker")]
65mod stream_emit;
66#[cfg(feature = "worker")]
67pub mod validate;