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::probe_from_env;
pub use cpu::Rendered;
pub use cpu::render as render_cpu;
pub use l0::render_to_rgba_l0;
pub use l0::lower as lower_to_l0;
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 — re-pointed to the L0 kernel (facett_core::render::backend) as of CONS-CORE Phase C. The policy (probe the hardware, then choose) now lives once in facett-core so the map skins and this graph engine decide identically; graphview re-exports the types here for back-compat, so every existing facett_graphview::{Backend, GpuProbe, decide} import (the benches, the example, nornir’s draw_graph) keeps resolving with zero source change.
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.
l0
The L0 kernel adoption (CONS-CORE Phase C, step 1) — route a graph’s nodes and straight edges through the shared facett_core::render Canvas seam instead of graphview’s bespoke vello_cpu scene.
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.

Structs§

GpuProbe
What a hardware probe found. The caller fills this (e.g. from a wgpu adapter enumeration, an env override, or a forced-CPU test flag); the policy — turning a probe into a pick — lives in decide so every surface decides identically.

Enums§

Backend
The chosen rasterizer.

Functions§

decide
THE picker: turn a GpuProbe into a Backend. GPU when usable and not forced off and the wgpu feature is compiled in; CPU otherwise. Keeping this pure (probe in, enum out) makes the policy trivially testable.
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.