Expand description
Sample-range and work-item scheduling for indicatrix render lanes.
This crate is the scheduler a render coordinator runs: several backends (“lanes”:
a joined remote worker, the coordinator’s own CPU/GPU, anything implementing
WorkerLane) contribute disjoint absolute sample ranges to ONE image, and their
per-chunk radiance sums are merged into one buffer with an exact sample count.
It holds no networking, no GUI and no GPU code. It depends only on the protocol
crate (for indicatrix_net::SceneState) and glam, so it can be linked into the
worker binary as well as the desktop app.
§Why merging by plain addition is sound
A path sample is identified by (global_pixel_index, absolute_sample_index) and
nothing else, on every backend. Any set of backends tracing disjoint sample
ranges of the same scene at the same resolution therefore merges by per-pixel
addition, divided by the total count. Disjointness is the whole correctness
guarantee, and SampleCursor provides it by construction.
§Contents
SampleCursor: the atomic claim point handing out disjoint sample ranges.WorkerLane,ChunkResult,SampleRange: what a lane is and returns.RateModel,ChunkPolicy: per-lane throughput calibration and chunk sizing.LanePool: N lanes against one cursor for one image epoch, with failure reclaim, backoff, retirement, cancellation and events.Merger: the deterministic, chunk-start-ordered merge of chunk sums.CancelToken: a cloneable cancellation flag.
Structs§
- Cancel
Token - A cloneable cancellation flag. Every clone observes the same flag, so the owner of a job keeps one clone and hands others to the lanes working on it.
- Chunk
Policy - How chunks are sized for a
crate::LanePoolrun. - Chunk
Result - What one
WorkerLane::render_chunkcall produced. - Lane
Pool - See the module doc. Lanes and their rate models persist across runs, so a caller rendering many images of one scene (a tilt video, successive coordinator jobs) calibrates each lane once.
- Merger
- See the module doc.
- Merger
Mismatch LanePool::run_intowas handed aMergerbuilt for a different image or range.- Pool
Config - Failure handling and chunk sizing for a
LanePool. - Pool
Outcome - The result of
LanePool::run. - Rate
Model - One lane’s throughput estimate in samples per second. See the module doc.
- Sample
Cursor - See this module’s doc comment. Every method takes
&self, so one instance can be shared (by reference inside athread::scope, or behind anArc) across every lane’s own thread. - Sample
Range - A contiguous absolute sample range
[first_sample, first_sample + samples), named like the protocol’sRenderRequestfields.
Enums§
- Merge
Error - Why
Merger::addrefused a chunk. A refused chunk contributes nothing, so the count always matches the buffer. - Pool
Event - Something that happened during a
LanePoolrun.laneis the indexLanePool::add_lanereturned;LanePool::lane_namenames it. - Pool
Status - How a run ended.
Constants§
- DEFAULT_
MAX_ CHUNK_ SAMPLES - The worker’s hidden per-request cap: a chunk sent to a worker must never be larger, or the worker rejects the whole request.
Traits§
- Lane
Feed - A source of lanes that join a run in progress (see
LanePool::run_into_fed). - Parked
Budget - An external byte budget a
Mergercharges its parked (full-frame) buffers against. - Worker
Lane - One backend contributing samples to an image: a joined remote worker, a TLS
connection to a plain worker, or the local CPU/GPU. The
crate::LanePooldoes not care which.
Functions§
- marginal_
rate - Throughput in samples per second:
delta_samplestraced overelapsed.Nonewhen nothing was traced or the span is zero, so a degenerate measurement never reaches aRateModel.