Skip to content

Class RenderGraph

Namespace: Apogee.Rendering.Graph
Assembly: Apogee.Rendering.dll

One frame's rendering as a graph. Passes declare how they use images and buffers; culls the passes nothing depends on, shares memory between transients whose lifetimes do not overlap, and works out the barriers; runs the rest in the order they were added, each in a labelled, timed section. Build a new graph every frame: it is cheap, and the transients come from a that lives across frames.

public sealed class RenderGraph

Inheritance

object ← RenderGraph

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Remarks

Images are tracked per mip level and array layer: a pass that declares a uses (and the graph transitions) just that part, so one pass can read a mip another is writing, and a mip chain or a cube map can be built a level or a face at a time. Transients may have several mips and layers, and are not multisampled.

Constructors

RenderGraph(GraphicsDevice, TransientPool)

A graph that can be compiled and executed.

public RenderGraph(GraphicsDevice device, TransientPool pool)

Parameters

device GraphicsDevice

pool TransientPool

RenderGraph()

A graph that can only be compiled: for tools, and for testing the planner without a GPU.

public RenderGraph()

Properties

Plan

The compiled plan, once or ran.

public GraphPlan? Plan { get; }

Property Value

GraphPlan?

Methods

AddPass(string, PassType, Action<PassBuilder>)

Adds a pass. setup runs now and declares the pass's resources and its execute callback; the callback runs during , in the order passes were added.

public void AddPass(string name, PassType type, Action<PassBuilder> setup)

Parameters

name string

type PassType

setup Action<PassBuilder>

Compile()

Works out which passes run, what is allocated and where the barriers go. Throws for an inconsistent graph.

public GraphPlan Compile()

Returns

GraphPlan

CreateBuffer(string, ulong, BufferUsage)

public BufferHandle CreateBuffer(string name, ulong size, BufferUsage usage)

Parameters

name string

size ulong

usage BufferUsage

Returns

BufferHandle

CreateImage(string, in ImageDescription)

An image the graph allocates and frees: its contents exist only inside the frame.

public ImageHandle CreateImage(string name, in ImageDescription description)

Parameters

name string

description ImageDescription

Returns

ImageHandle

Execute(Frame)

Records the graph into the frame's command buffer.

public void Execute(Frame frame)

Parameters

frame Frame

ImportBackbuffer(in Backbuffer)

The window's image: it starts undefined, ends ready to present, and is an output, so what draws into it always runs.

public ImageHandle ImportBackbuffer(in Backbuffer backbuffer)

Parameters

backbuffer Backbuffer

Returns

ImageHandle

ImportBuffer(string, GpuBuffer, BufferState, BufferState, bool)

public BufferHandle ImportBuffer(string name, GpuBuffer buffer, BufferState initial, BufferState final, bool output = false)

Parameters

name string

buffer GpuBuffer

initial BufferState

final BufferState

output bool

Returns

BufferHandle

ImportImage(string, GpuImage, ImageState, ImageState, bool, uint)

An image that exists outside the graph. It is in initial when the graph starts and is left in final. With output the passes that write it always run.

public ImageHandle ImportImage(string name, GpuImage image, ImageState initial, ImageState final, bool output = false, uint sampledIndex = 0)

Parameters

name string

image GpuImage

initial ImageState

final ImageState

output bool

sampledIndex uint

The image's bindless index, if the passes read it by index.

Returns

ImageHandle