render-graph
Use when the user asks about a render graph, frame graph, transient resource aliasing, automatic barriers, async compute, GPU-driven rendering or command list…
от j4flmao★ 47 звёзд на GitHub
Установить render-graph в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Render Graph — Deep Engineering Guide
Purpose
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.
Agent Protocol
Trigger
"render graph", "frame graph", "transient resources", "barriers", "async compute", "GPU-driven rendering", "command lists".
Input Context
- Graphics API(s) (Vulkan, D3D12, Metal)
- Pass list and resolution/format needs
- Profiler/validation data
Output Artifact
Graph design and C++ code. No file unless requested.
Response Format
Passes: {ordered list with reads/writes}
Resources: {transient vs imported, aliasing}
Sync: {barriers generated}
Code: {snippet}
1. The Core Idea
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. Compile phase: the graph culls unused passes, orders them topologically,
// 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.
2. Why Not Direct Recording (Raw VK/DX12)
- Raw submission requires manual barrier planning per pass → bugs (missing sync = corruption).
- Raw resource lifetimes are error-prone (use-after-free of transient attachments).
- Single-threaded record is a bottleneck: render graph enables frontend/backend split — multiple CPUs record pass lambdas in parallel.
| 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 |
3. The Pass & Resource Model
3.1 Pass Types
- Graphics pass (VS/PS from PSO, draw commands).
- Compute pass (dispatches).
- Copy pass (blit, upload).
- Async compute (with ownership / queue transfer, see §7).
3.2 Resource Handles & Transiency
struct ResourceID { uint32 index; Generation gen; }; // opaque, non-nullable
TextureHandle h = graph.CreateTexture({width, height, format, Usage::RenderTarget});
// A texture created and last used within the frame is transient:
// its memory can alias other transients whose lifetimes do not overlap.
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").
3.3 Reference Counting Applies to the GPU Lifetime, Not CPU
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).
4. Scheduling Passes
- Topological order by edges (writer → reader); passes whose outputs nobody reads are culled.
- Pass merging: adjacent raster passes with compatible attachments can become one render pass / subpasses so tile-based GPUs keep data on-chip.
- Caching: when the declared graph is identical to last frame's, reuse the compiled schedule and barrier plan.
- Compute/shadow passes that don't write the final target placed off the main thread (frontend).
Reordering goals: maximize temporal locality (attach reuse), minimize barrier count and transitions (see barriers.md).
5. Barriers: Graph-Derived, Not Hand-Edited
Edges define transitions:
read (PresentableTarget) → SHADER_READ
write (depth) → DEPTH_WRITE (after the previous reader finishes)
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 adds cross-queue semaphores and, for exclusive-sharing resources, queue-family ownership transfers (see synchronization-and-fencing.md).
6. Rendering Pattern: GPU-Driven
Culling happens on the GPU (see gpu-driven-rendering.md):
- a compute pass culls instances/meshlets and writes indirect draw arguments + a draw count;
- raster passes consume them with
vkCmdDrawIndexedIndirectCount/ExecuteIndirect; - the graph tracks the argument buffer like any other resource (compute write → indirect-argument read barrier).
Graph treats the
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/barriers-and-transitions.md
- references/command-lists-and-queues.md
- references/gpu-driven-rendering.md
- references/passes-and-attachments.md
- references/resource-lifecycle.md
- references/synchronization-and-fencing.md
FAQ
Что делает скилл render-graph?
Use when the user asks about a render graph, frame graph, transient resource aliasing, automatic barriers, async compute, GPU-driven rendering or command list recording. Produces render graph design with pass and resource lifetimes. Not for raw Vulkan API usage (use vulkan).
Как установить скилл render-graph?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл render-graph запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…