Returns descriptive info about the virtual resource identified by id,
or null when the id is unknown.
Designate the swapchain (or a caller-supplied render texture) as the graph's backbuffer. The returned handle is what the final pass writes to. Call once per graph build, before compile().
Optionaldesc: Partial<TextureDesc>Designate the canvas depth texture (or a caller-supplied depth texture) as the graph's backbuffer depth attachment.
Optionaldesc: Partial<TextureDesc>Constrain the backbuffer-writing pass to a sub-rectangle (viewport +
scissor) and choose whether it clears the whole backbuffer first. See
_outputViewport. Pass null (default) for the full backbuffer.
Returns the previously registered backbuffer handle, if any.
Register a persistent texture, identified by stable string key. Returns
a handle the same way as a created texture — read/write declarations
follow the same rules.
Import a caller-owned GPUTexture into the graph as a virtual resource. Useful for textures whose lifetime is managed elsewhere (asset loaders, external libraries). The graph never destroys imported textures.
Append a pass to the graph. The setup callback runs synchronously and uses the supplied PassBuilder to declare reads/writes/creates and register an execute callback.
Compile the declared graph: validate references, cull passes that don't reach the backbuffer, topologically sort the survivors, and bind each surviving virtual resource to a physical GPU object.
Execute the compiled graph: record one command buffer, run each pass's execute callback inside the appropriate encoder, then release transient resources back to the pool. Returns once the command buffer is submitted.
RenderGraph: declares passes, compiles a dependency graph from their read/write declarations, and executes them in topological order against pooled physical resources.
Lifecycle (per frame):
RenderGraph(ctx, cache).addPass(name, type, setup)for each pass; the setup callback uses the PassBuilder to declare reads/writes and register an execute callback.setBackbuffer(...)once with the swapchain target.compile()produces a CompiledGraph (validate, cull, sort, bind).execute(compiled)records and submits a single command buffer.The PhysicalResourceCache is owned externally and survives across frames so transient resources are pooled and persistent resources persist.