cx.notify() — schedule redrawcx.notify(). GPUI queues a redraw for the affected window. Multiple notifies within the same event coalesce into one frame.Workspace::render(window, cx) which recursively calls child views' render(). Each view returns an element tree — plain Rust data structures implementing the Element / RenderOnce traits. No drawing happens yet.Bounds for every element. The layout algorithm runs entirely on the CPU in one pass over the tree.paint(bounds, scene, cx) is called in tree order. Elements push draw commands (quads, glyphs, underlines, paths) into the Scene. EditorElement::paint() is the heaviest step — see below.Scene is handed to gpui_wgpu, which sorts draw commands by layer/depth, batches them into WebGPU render passes, and submits to the platform GPU (Metal on macOS, Vulkan on Linux, DX12 on Windows).element.rs:9786 implements the Element trait for the editor. Its paint() method is called once per frame with the editor's computed bounds.
It begins by taking a DisplaySnapshot — an immutable copy of all buffer, display-map, and diagnostic state — then works line by line through the visible rows:
Primitives are added to the scene in paint order (back to front). The WGPU layer re-sorts by z-order and merges adjacent primitives of the same type into batched draw calls, minimising GPU state changes.
All rendering goes through gpui_wgpu, which abstracts over platform-specific GPU APIs:
MonochromeSprite primitive is just a UV rectangle pointing into this atlas — no per-frame font rasterization unless the atlas overflows or the DPI changes.