Skip to main content
Prisma::Graphic::RenderGraph is a frame graph system for declaring GPU passes and their resource dependencies at a high level. Instead of manually managing resource barriers and execution order, you describe each pass’s reads and writes through an RGBuilder, then call Compile() to resolve the dependency graph and Execute() to record and submit the commands. The render graph is currently in active development — the core API is stable, but automatic aliasing and async-compute scheduling are not yet implemented.
The RenderGraph is marked in progress in the engine roadmap. It exists alongside the current ScriptableRenderPipeline implementation, which uses explicit ForwardPipeline and DeferredPipeline passes. The graph API documented here is production-ready for use within those pipelines; full standalone graph execution is under development.

Resource description

RGResourceDesc

Describes a GPU resource to be created and managed by the graph.
RGResourceDesc::Type
required
The resource category: Texture2D, Buffer, or RenderTarget.
uint32_t
Width in pixels (textures and render targets only).
uint32_t
Height in pixels (textures and render targets only).
RGResourceDesc::Format
Pixel format of the resource. RGBA8 for standard colour, RGBA16F for HDR, D32F for depth.

RGResourceDesc::Texture2D (factory)

Convenience factory that fills in type = Type::Texture2D automatically.

RGResourceHandle

An opaque, strongly-typed handle to a resource tracked by the graph. Obtain handles from RGBuilder::CreateTexture(). Pass them to RGBuilder::Read() and RGBuilder::Write() to declare pass dependencies. Always check IsValid() before using a handle.

Pass builder

RGBuilder

Each pass receives an RGBuilder during its setup lambda. Use it to declare resource creation and access patterns — the graph uses this information to infer execution order and schedule barriers.

RGBuilder::CreateTexture

Registers a new transient texture with the graph and returns its handle. The resource is not allocated on the GPU until Compile() is called.
const RGResourceDesc&
required
Describes the texture dimensions and format.
const std::string&
required
Debug name for the resource, visible in GPU frame capture tools such as RenderDoc and PIX.

RGBuilder::Read

Declares that the current pass reads from the resource identified by handle. The graph uses this to insert a read barrier before the pass executes.
RGResourceHandle
required
A valid handle returned by a previous CreateTexture() call on this or an earlier pass.

RGBuilder::Write

Declares that the current pass writes to the resource identified by handle. The graph uses this to insert a write barrier and to establish that this pass must execute before any pass that reads the same resource.
RGResourceHandle
required
A valid handle returned by CreateTexture().

RenderGraph

Constructor

IRenderDevice*
required
The render device used to allocate GPU resources at compile time. Obtain from RenderSystem::GetDevice().

RenderGraph::AddPass

Registers a render pass. The setup lambda runs immediately during AddPass() to declare resources and produce PassData. The execute lambda is stored and called later during Execute().
const std::string&
required
Unique name for this pass. Used in GPU capture tools and error messages.
SetupFunc&&
required
A callable with signature void(RGBuilder& builder, PassData& data). Declare all resource reads and writes here. Do not issue GPU commands.
ExecuteFunc&&
required
A callable with signature void(const PassData& data, RGContext& ctx). Issue GPU commands through ctx.GetCmd(). Called during Execute() in dependency-resolved order.

RenderGraph::Compile

Analyses the declared pass graph, resolves execution order by dependency topological sort, allocates transient GPU resources, and schedules the required resource barriers. Call once after all passes have been registered, before Execute().
Do not call AddPass() after Compile(). Build the full pass list first, then compile and execute.

RenderGraph::Execute

Runs all passes in the compiled order, inserting resource barriers as determined by Compile(). Each pass’s execute lambda is called with the appropriate RGContext wrapping the provided command context.
RenderCommandContext*
required
The command context to record into. Obtain from the current frame’s command list via IRenderDevice.

Execution context

RGContext

Passed to each pass’s execute lambda. Call GetCmd() to access the underlying command context for issuing draw calls, dispatches, and copy operations.

Relationship to built-in pipelines

The current forward and deferred pipelines are implemented as explicit pass classes rather than RenderGraph nodes:
These will be migrated to RenderGraph passes in a future release. New custom pipelines are encouraged to adopt the RenderGraph API now so that automatic barrier scheduling and resource aliasing can be enabled as the system matures.

Full two-pass example