Table of Contents

Class FrameGraphTemplates

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

Ready-made multi-pass shapes built on FrameGraphBuilder. Reach for one of these before hand-rolling a custom ConfigureRenderGraph override — they cover the common cases (scene → post-process → UI, an off-screen texture feeding a scene pass) with the resource/dependency wiring already correct.

public static class FrameGraphTemplates
Inheritance
FrameGraphTemplates
Inherited Members

Methods

AddClearPass(FrameGraphBuilder, string, Color)

Adds a clear-only pass with no drawing of its own — for a game whose only render-graph need is "paint the background," with no custom draw logic and no multi-pass graph. For anything that also draws, use Game.AddDefaultRenderGraphPass(builder, gameTime, clearColor: ...) instead, which folds the clear into the same pass that calls Game.Draw and draws registered IDrawables, rather than adding a second pass just for the clear.

public static FrameGraphPassHandle AddClearPass(this FrameGraphBuilder builder, string name, Color clearColor)

Parameters

builder FrameGraphBuilder
name string
clearColor Color

Returns

FrameGraphPassHandle

AddOffscreenPass(FrameGraphBuilder, string, FrameGraphResourceDescriptor, Action<FrameGraphPassContext, IRenderTarget>, Color?, Action<FrameGraphPassBuilder>)

Adds a pass that draws into a texture of its own, made for this frame and cleared to clearColor (transparent by default) before record draws into it. Returns the pass, for a later pass to DependsOn(FrameGraphPassHandle), and the texture, for it to Reads(FrameGraphResourceHandle): a mask, a lightmap, a minimap, anything drawn first and used later in the frame.

public static OffscreenPassHandles AddOffscreenPass(this FrameGraphBuilder builder, string name, FrameGraphResourceDescriptor descriptor, Action<FrameGraphPassContext, IRenderTarget> record, Color? clearColor = null, Action<FrameGraphBuilder.FrameGraphPassBuilder> configurePass = null)

Parameters

builder FrameGraphBuilder
name string
descriptor FrameGraphResourceDescriptor
record Action<FrameGraphPassContext, IRenderTarget>
clearColor Color?
configurePass Action<FrameGraphBuilder.FrameGraphPassBuilder>

Returns

OffscreenPassHandles

AddScenePostProcessUiPipeline(FrameGraphBuilder, string, FrameGraphResourceDescriptor, Action<FrameGraphPassContext, IRenderTarget>, Action<FrameGraphPassContext, IRenderTarget>, Action<FrameGraphPassContext>, Color?, Action<FrameGraphPassBuilder>, Action<FrameGraphPassBuilder>, Action<FrameGraphPassBuilder>)

Adds a three-pass scene → post-process → UI pipeline: the scene pass renders into a transient sceneColorDescriptor-shaped target (cleared to sceneClearColor), the post-process pass reads that target back, and the UI pass runs last with no forced dependency on the scene target itself (only on the post-process pass finishing). Use this instead of a custom ConfigureRenderGraph override when you need this exact shape; the configure*Pass callbacks are an escape hatch for the rare tweak (an extra Reads(FrameGraphResourceHandle)/DependsOn(FrameGraphPassHandle)) that doesn't warrant hand-rolling the whole pipeline.

public static PostProcessPipelineHandles AddScenePostProcessUiPipeline(this FrameGraphBuilder builder, string pipelineName, FrameGraphResourceDescriptor sceneColorDescriptor, Action<FrameGraphPassContext, IRenderTarget> recordScene, Action<FrameGraphPassContext, IRenderTarget> recordPostProcess, Action<FrameGraphPassContext> recordUi, Color? sceneClearColor = null, Action<FrameGraphBuilder.FrameGraphPassBuilder> configureScenePass = null, Action<FrameGraphBuilder.FrameGraphPassBuilder> configurePostProcessPass = null, Action<FrameGraphBuilder.FrameGraphPassBuilder> configureUiPass = null)

Parameters

builder FrameGraphBuilder
pipelineName string
sceneColorDescriptor FrameGraphResourceDescriptor
recordScene Action<FrameGraphPassContext, IRenderTarget>
recordPostProcess Action<FrameGraphPassContext, IRenderTarget>
recordUi Action<FrameGraphPassContext>
sceneClearColor Color?
configureScenePass Action<FrameGraphBuilder.FrameGraphPassBuilder>
configurePostProcessPass Action<FrameGraphBuilder.FrameGraphPassBuilder>
configureUiPass Action<FrameGraphBuilder.FrameGraphPassBuilder>

Returns

PostProcessPipelineHandles