Renderer
Convert a retained scene snapshot into bounded GPU work and preserve resources until every consumer has finished.
Hera's renderer consumes a retained scene snapshot and turns it into GPU work on the server's dedicated render worker. The snapshot gives it a toolkit-independent description of the frame, whether the application used Hera Kit, React Native, or another client. On a display backend, the renderer also follows that frame through presentation so the server can distinguish submission from actual visibility.
Scene Evaluation and Ordering
Scene planning begins by traversing the retained hierarchy and carrying each node's inherited transforms, clips, opacity, and z-order into the calculation. From that traversal, the renderer produces a draw plan and shader tables for rectangles, images, paths, and glyph runs. A stable ordering preserves the intended paint sequence when content has equal z-order.
Before recording commands, the planner removes work that it can prove unnecessary. Coverage alone is not enough to make that decision: a primitive hidden behind another object may still supply pixels to a backdrop effect or filtered group. Culling must preserve those dependencies so that skipping a draw cannot change the composition.
Repaint Planning
The renderer determines repaint work by comparing the planned content with the history of the particular target image it acquired. Swapchain images can contain different earlier frames, so each image needs its own history. Comparing every target with only the most recently displayed frame could leave stale pixels in a less recently used image.
Effects can make the required input region larger than the output that changed. A blur samples neighboring pixels, while a backdrop effect reads content painted earlier in the scene. Repaint planning retains those inputs even for a small visible update, as described in damage and effects.
Work Admission and Resource Limits
The renderer builds and admits a complete graph before preparing glyph uploads or expanding per-frame instance and descriptor storage. Optional retained-run caching and split-damage plans can fall back to an ordinary plan when they exceed the work budget.
After admission, the renderer uploads tables and glyphs, prepares descriptors, compiles resource hazards and transient images, and records command buffers. The Vulkan backend owns queue submission and completion tracking.
GPU Completion and Display Visibility
Resource reuse follows the frame's progress through several milestones. Successful queue submission allows the server to acknowledge the covered commits; GPU completion later allows command resources to retire. Display activation establishes that the scene became visible, but its scanout image remains in use until the display moves to a successor. These separate consumers determine when each resource can safely be reused.
The renderer retains compiled work until its command slot completes, and retains scanout images until the display no longer owns them. See presentation and render graph internals.
Source Reference
The following files in the Hera checkout define the behavior described on this page.
crates/renderer/src/worker/mod.rscrates/renderer/src/vulkan/scene/README.mdcrates/renderer/src/runtime/vulkan.rscrates/renderer/src/vulkan/backend.rs