2D Graph scene in Rust
summary
Built a proof‑of‑concept 2D GPU scene graph in Rust called scenegraph‑rs that targets WebGPU, implements rectangle and image nodes, composition, transforms and click events, and renders text by rasterizing to a texture on the CPU. The demo shows clickable buttons moving (works), pipelines and vertex/index buffers are created once and reused, and color changes update only uniforms. Major costs: fighting the borrow checker, using Rc/RefCell and id‑based graphs, single‑threaded design, and WebGPU spec instability.
AI-written summary · about
chapters (6)
- 0:00Start
- 4:30The scenario • High performance GUI with smooth animations etc. • Possibly a low-powered embedded platform . Traditionally performance == C/C++ . But, C/C++ != safety convenience • Rust: "Fast, Reliable, Productive, Pick Three"
- 24:43Modern toolkits . Mostly still use imperative drawing • GPU acceleration is carefully added • Rarely GPU optimized from the ground up • Qt Quick 2 is a notable exception
- 28:14Scene Graph GUI composed of components . Components composed of nodes • Nodes backed by GPU primitives • The GPU can directly draw these nodes • i.e. no fancy tricks !!
- 43:11The problem . We write nodes directly against the GPU... . Which API do we use? • Qt Quick 2 used OpenGL (originally, now also RHI) • OpenGL used to work everywhere • OpenGL is dying, fast... • Vulkan, Metal and DX12 are the future . So we write nodes 3 times ?
- 45:22WebGPU to the rescue! . Basically Vulkan for the Web . But not just for the web... . Also tries to be the new OpenGL • Common higher level API that maps to Vulkan/Metal/DX12 • Reference implementation in Rust : • WARNING: not stable yet...








