ultrafast_ops/lib.rs
1//! ultrafast's op vocabulary on the CPU: the op registry, which maps document
2//! ops onto the Slang op library and packs their params ([`ops`]), the
3//! built-in components ([`builtins`]), and the machine-readable schema of
4//! every op with the document check built on it ([`schema`]).
5//!
6//! The renderer (ultrafast-render) compiles documents with these and re-exports
7//! the modules at their old paths; tools that only need the vocabulary or a
8//! document's problems, such as a composer that turns another tool's data
9//! into documents, use them without a GPU.
10
11// As in the renderer this code grew in: indexed loops over parallel arrays
12// (the homography solve) are the clearest form here.
13#![allow(clippy::needless_range_loop)]
14
15pub mod batch;
16pub mod builtins;
17pub mod json_schema;
18pub mod ops;
19pub mod schema;
20pub mod templates;
21
22use ultrafast_graph::NodeId;
23
24/// Why a node's op could not be resolved, wired or packed (ultrafast-render
25/// reports each as the `RenderError` variant of the same name).
26#[derive(Debug, thiserror::Error)]
27pub enum OpsError {
28 #[error("node `{node}` has unknown op `{op}`")]
29 UnknownOp { node: NodeId, op: String },
30 #[error("node `{node}` is missing required input `{port}`")]
31 MissingPort { node: NodeId, port: String },
32 #[error("node `{node}` param `{param}`: {reason}")]
33 BadParam {
34 node: NodeId,
35 param: String,
36 reason: String,
37 },
38}