Table of Contents

Class FrameGraphBuilder.FrameGraphPassBuilder

Namespace
BSGameLib.Game.Rendering
Assembly
BSGameLib.Game.dll

Fluent configuration for a single pass, returned by AddPass(string). Renders(RenderPassDescriptor), Reads(FrameGraphResourceHandle), Writes(FrameGraphResourceHandle), Releases(FrameGraphResourceHandle), and DependsOn(FrameGraphPassHandle) are all optional and chainable in any order — call whichever ones apply to your pass, skip the rest. Execute(Action<FrameGraphPassContext>) is the one call every pass needs, and the only one that hands back a usable FrameGraphPassHandle (e.g. to pass to another pass's DependsOn(FrameGraphPassHandle), or to Game.AddDefaultRenderGraphPass's dependsOn parameter) — so it belongs last in the chain.

public sealed class FrameGraphBuilder.FrameGraphPassBuilder
Inheritance
FrameGraphBuilder.FrameGraphPassBuilder
Inherited Members

Properties

Handle

This pass's handle. Available immediately (you don't need to call Execute(Action<FrameGraphPassContext>) first) in case you need to reference it while still configuring the same pass, but most callers get the handle from Execute(Action<FrameGraphPassContext>)'s return value instead.

public FrameGraphPassHandle Handle { get; }

Property Value

FrameGraphPassHandle

Methods

DependsOn(FrameGraphPassHandle)

Forces this pass to run after handle, independent of any resource reads/writes. Optional — only needed when two passes must be ordered for a reason the graph can't see from resource usage alone (e.g. this pass doesn't touch any of the other pass's resources but still needs to run after it).

public FrameGraphBuilder.FrameGraphPassBuilder DependsOn(FrameGraphPassHandle handle)

Parameters

handle FrameGraphPassHandle

Returns

FrameGraphBuilder.FrameGraphPassBuilder

Execute(Action<FrameGraphPassContext>)

Sets what this pass actually does and finishes configuring it. Required — every pass needs exactly one Execute call, or Build() throws InvalidOperationException rather than silently dropping the pass. This is also the only method on this builder that returns a FrameGraphPassHandle instead of the builder itself, so it reads naturally as the last call in the chain: nothing downstream (another pass's DependsOn(FrameGraphPassHandle), Game.AddDefaultRenderGraphPass's dependsOn) can reference this pass until you've called it.

public FrameGraphPassHandle Execute(Action<FrameGraphPassContext> execute)

Parameters

execute Action<FrameGraphPassContext>

Returns

FrameGraphPassHandle

Reads(FrameGraphResourceHandle)

Declares that this pass reads a resource created via CreateTransient(string, FrameGraphResourceDescriptor)/ImportResource(string, FrameGraphResourceDescriptor). Optional — only needed when this pass's ordering relative to whichever pass wrote that resource matters and you want the graph to infer it automatically instead of (or in addition to) an explicit DependsOn(FrameGraphPassHandle).

public FrameGraphBuilder.FrameGraphPassBuilder Reads(FrameGraphResourceHandle handle)

Parameters

handle FrameGraphResourceHandle

Returns

FrameGraphBuilder.FrameGraphPassBuilder

Releases(FrameGraphResourceHandle)

Forces a transient resource to be released after this pass specifically, instead of the default (release after its last read/write in graph order). Optional, and rare — only needed to shrink a resource's lifetime earlier than the graph would infer on its own. The resource must already be declared as a Reads(FrameGraphResourceHandle)/Writes(FrameGraphResourceHandle) of this same pass.

public FrameGraphBuilder.FrameGraphPassBuilder Releases(FrameGraphResourceHandle handle)

Parameters

handle FrameGraphResourceHandle

Returns

FrameGraphBuilder.FrameGraphPassBuilder

Renders(RenderPassDescriptor)

Sets what this pass renders into and how it's cleared — render target, viewport, color/depth clear, and RenderPassTag all live on RenderPassDescriptor, set together via its object initializer. Optional: a pass with no Renders call gets an all-defaults descriptor (no clear, back buffer, None) — fine for passes that only do bookkeeping (e.g. Reads(FrameGraphResourceHandle)/Writes(FrameGraphResourceHandle) declarations with no drawing), wrong for anything that expects a clean/cleared target. Calling this again replaces the whole descriptor rather than merging fields — there's deliberately no separate "set just the tag" method, so there's nothing to accidentally overwrite by calling things in the wrong order.

public FrameGraphBuilder.FrameGraphPassBuilder Renders(RenderPassDescriptor descriptor)

Parameters

descriptor RenderPassDescriptor

Returns

FrameGraphBuilder.FrameGraphPassBuilder

Renders(Func<FrameGraphPassContext, RenderPassDescriptor>)

Same as Renders(RenderPassDescriptor), but the descriptor is computed at execute time from a FrameGraphPassContext — use this when the render target is a transient resource (CreateTransient(string, FrameGraphResourceDescriptor)) whose actual IRenderTarget isn't known until the graph resolves it (ctx.GetRenderTarget(handle)), not a plain fixed target you already have.

public FrameGraphBuilder.FrameGraphPassBuilder Renders(Func<FrameGraphPassContext, RenderPassDescriptor> descriptorFactory)

Parameters

descriptorFactory Func<FrameGraphPassContext, RenderPassDescriptor>

Returns

FrameGraphBuilder.FrameGraphPassBuilder

Writes(FrameGraphResourceHandle)

Declares that this pass writes a resource created via CreateTransient(string, FrameGraphResourceDescriptor)/ImportResource(string, FrameGraphResourceDescriptor). Optional, same reasoning as Reads(FrameGraphResourceHandle) — also what makes a Renders(Func<FrameGraphPassContext, RenderPassDescriptor>) render target resolvable at execute time.

public FrameGraphBuilder.FrameGraphPassBuilder Writes(FrameGraphResourceHandle handle)

Parameters

handle FrameGraphResourceHandle

Returns

FrameGraphBuilder.FrameGraphPassBuilder