executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
render-graphExpert render graph architecture — command lists and queues, resource lifecycle, passes, barriers, synchronization and GPU-driven rendering for real-time engines.
Independent GitHub snapshot · Automated classification · Original documentation governs
A modern renderer records a graph of dependencies between passes each frame, allocates transient resources, orders passes topologically, and emits command lists. Skill covers the scheduling, allocation, synchronization and GPU-driven patterns that make it fast and safe on Vulkan/DX12/Metal.
Declare → Resolve → Record.
// 1. Record phase: passes declare their resources + what they access.
graph.AddPass<Shadows>([&](RenderPassBuilder& b){
input(b, "depth", attDepth);
output(b, "shadowMap", attColor, usageDepthStencil);
setExecLambdaShadows(b); // recorded later
});
// 2. Resolve phase: pick graph decides ordering (topological by edge),
// assigns transient memory, decides barriers between passes.
// 3. Execute phase: for pass in order: emit barriers + record commands from lambdas.
Passes are declared one frame in advance (or same-frame with deferred record), and the graph replays a cached schedule for the common case.
| Raw | RenderGraph | |
|---|---|---|
| Barriers | manual | derived from edges |
| Transient alloc | manual rings | graph-managed |
| Reuse across frames | hand | implicit |
| Multi-thread record | DIY | supported |
| Debug attach labels | DIY | automatic per-pass |
struct ResourceID { uint32 index; Generation gen; }; // opaque, non-nullable
int graph.CreateTexture(width, height, format, Usage::RenderTarget);
// Where the graph sees a texture created + destroyed within the frame → transient:
// it aliases memory with other transients (offline vsr-rpt).
A transient attachment lives through exactly the passes that read/write it; the allocator proves it's safe to alias at different points of the graph (the "frame-scoped arena").
The resource must stay alive while in-flight frames still reference it. Render graph handles: each texture carries a reference that jumps when a pass reads it; the free happens after the frame that last used it completes (see resource-lifecycle.md).
Reordering goals: maximize temporal locality (attach reuse), minimize barrier count and transitions (see barriers.md).
Edges define transitions:
read (PresentableTarget) → SHADER_READ
write (depth) → DEPTH_WRITE (after previous prevent)
The graph inserts the minimal set of barriers between passes. It also merges: a transition needed by N passes emitted once, not per-pass.
{ pass A writes tex } → barrier (UNDEFINED→GENERAL/write) → pass B reads tex → barrier (GENERAL→READ)
Layout transitions (Vulkan) / ResourceState changes (DX12) are emitted in the execute phase. Async compute inserts queue-fence split automatically (ownership transfer) — records extra slides by design (see sync.md).
GPU-driven calls: culling happens on GPU (see gpu-driven-rendering.md). The render graph awards:
DrawArgs in the indirect index.Graph treats these indirect draws just like regular passes — no extra edges, no barriers hand-written.
> bar.| Metric | Target |
|---|---|
| Graph resolve time | < 0.2 ms silent |
| Barrier count per frame | minimized; no duplicates |
| Command-list count | ≤ queues; coalesced |
| Transient memory aliased | ~2x vs dedicated |
| Record threads | all cores available to frontend |
Watch: cratering if frontend record is single-threaded or the resolve does full recursion each frame.
--validate-sync shows the barrier dump; assert: every resource has a defined initial state; no pass reads a resource not yet written (undefined → #error).BeginLabel/EndLabel).--capture-frame): include the resolved schedule + all barriers, useful for NVIDIA Nsight / PIX.references/command-lists-and-queues.md — record lists, queues, dedup, multi-thread recordreferences/passes-and-attachments.md — pass definition, attachments, transient aliasing, framebuffer reusereferences/resource-lifecycle.md — lifetimes, in-flight frames, free after last use, refcountingreferences/barriers-and-transitions.md — layout/state transitions, merges, accidental syncreferences/synchronization-and-fencing.md — semaphores, fences, async queue ownership, GPU sync modelreferences/gpu-driven-rendering.md — indirect args, visibility buffers, GPU culling passes, perf tailoring