Skip to main content

Crate facett_graphview

Crate facett_graphview 

Source
Expand description

facett-graphview — a domain-agnostic, scalable 2D graph render engine, vello-backed, that runtime-selects its backend by hardware: vello (GPU/wgpu compute) when a usable GPU exists, vello_cpu (multithreaded SIMD) as the no-GPU fallback. The eventual single home for every graph surface — nornir’s arch/dep/release dashboards, korp, graph-DB browsing — aiming to beat Graphviz on interactivity + scale.

§The shared API (a future drop-in for nornir’s draw_graph)

The model — GraphModel (nodes id/label/pos/fill/stroke + edges from/to/color/dashed/label) and the caller-supplied Decorations overlay (per-node ring/badge + emphasis edges) — mirrors nornir’s src/viz/graph_render.rs SHARED API exactly, so that egui routine can swap its painter for this engine without changing its callers. Decorations stay caller-supplied and domain-agnostic: facett never learns what a “release gate” is.

§Backends (vello is NOT GPU-only)

Backend {GpuVello, CpuVello}; decide turns a GpuProbe into a pick (probe → choose, mirroring nornir’s embedder runtime-select). The CPU path (cpu::render) is the proven reference — vello_cpu already ships transitively inside epaint 0.34, so it always builds here. The GPU path is a real, version-aligned seam (vello 0.9 ↔ wgpu 29 ↔ egui-wgpu 0.34), wired behind the gpu cargo feature; see [gpu].

§Render entry point

render_to_rgba dispatches on the chosen Backend and returns straight RGBA8 pixels (PNG / egui-texture ready). Today both backends route through the CPU rasterizer (the GPU readback path is the #17 follow-up); the dispatch seam is in place.

§What is STUBBED (documented, not built — see .nornir/design.md)

LOD / viewport-culling, clustering / aggregation, edge-bundling, streaming layout, and the data-source adapters (nornir dep graph / FalkorDB / pipeline). Clear TODOs live at each seam.

Re-exports§

pub use backend::Backend;
pub use backend::GpuProbe;
pub use backend::decide;
pub use cpu::Rendered;
pub use cpu::render as render_cpu;
pub use model::BOX_H;
pub use model::BOX_W;
pub use model::Camera;
pub use model::Color;
pub use model::Decorations;
pub use model::GraphEdge;
pub use model::GraphModel;
pub use model::GraphNode;
pub use model::NodeDecoration;
pub use model::Pos;

Modules§

backend
Runtime backend selection — mirrors nornir’s embedder probe→pick pattern (probe the hardware, then choose). vello is not GPU-only: the same scene rasterizes on the GPU (vello on wgpu) when a usable adapter exists, and on the CPU (vello_cpu, multithreaded SIMD) when it doesn’t. The caller probes once and renders through whichever Backend decide returns.
cpu
The CPU rasterizer (vello_cpu) — the reference render path. Builds a vello_cpu scene from a GraphModel + Decorations under a Camera and rasterizes it to a straight-RGBA8 pixel buffer (ready for a PNG or an egui texture). vello_cpu is multithreaded-SIMD software rendering: the proof that “vello” is not GPU-only.
model
The domain-agnostic graph model — the same shape nornir’s src/viz/graph_render.rs::draw_graph accepts, so this engine is a future drop-in for that egui routine. Nodes are laid out in world space by the caller (each domain owns its own layout/columns); edges reference nodes by id. Decorations is the caller-supplied overlay — facett mustn’t know what a “release gate” is, so rings/badges/emphasis-edges are opaque here.

Functions§

render_to_rgba
Render model (decorated, under camera) to a w × h straight-RGBA8 frame, dispatching on the runtime-chosen backend. The one call a host makes after decide.