FRDGBuilder

Use the render graph builder to build up a graph of passes and then call [Execute()](API\Runtime\RenderCore\FRDGBuilder\Execute\1) to process them.

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

FRDGAllocatorScope

FRDGBuilder

References

Module

RenderCore

Header

/Engine/Source/Runtime/RenderCore/Public/RenderGraphBuilder.h

Include

#include "RenderGraphBuilder.h"

Syntax

class FRDGBuilder : private FRDGAllocatorScope

Remarks

Use the render graph builder to build up a graph of passes and then call Execute() to process them. Resource barriers and lifetimes are derived from RDG parameters in the pass parameter struct provided to each AddPass call. The resulting graph is compiled, culled, and executed in Execute(). The builder should be created on the stack and executed prior to destruction.

Variables

Name Description

Public variable

FRDGBlackboard

 

Blackboard

The blackboard used to hold common data tied to the graph lifetime.

Public variable

FRHICommandList...

 

RHICmdList

The RHI command list used for the render graph.

Constructors

Name Description

Public function

FRDGBuilder

(
    const FRDGBuilder&
)

Public function

FRDGBuilder

(
    FRHICommandListImmediate& RHICmdLi...,
    FRDGEventName Name,
    ERDGBuilderFlags Flags
)

Destructors

Name Description

Public function

~FRDGBuilder()

Functions

Name Description

Public function

void

 

AddDispatchHint()

A hint to the builder to flush work to the RHI thread after the last queued pass on the execution timeline.

Public function

FRDGPassRef

 

AddPass

(
    FRDGEventName&& Name,
    const FShaderParametersMetadata...,
    const void* ParameterStruct,
    ERDGPassFlags Flags,
    ExecuteLambdaType&& ExecuteLambda
)

Adds a lambda pass to the graph with a runtime-generated parameter struct.

Public function

FRDGPassRef

 

AddPass

(
    FRDGEventName&& Name,
    ERDGPassFlags Flags,
    ExecuteLambdaType&& ExecuteLambda
)

Adds a lambda pass to the graph without any parameters.

Public function

FRDGPassRef

 

AddPass

(
    FRDGEventName&& Name,
    const ParameterStructType* Par...,
    ERDGPassFlags Flags,
    ExecuteLambdaType&& ExecuteLambda
)

Adds a lambda pass to the graph with an accompanied pass parameter struct.

Public function

void *

 

Alloc

(
    uint64 SizeInBytes,
    uint32 AlignInBytes
)

Allocates raw memory using an allocator tied to the lifetime of the graph.

Public function

ObjectType &...

 

AllocObject

(
    TArgs&&... Args
)

Allocates a C++ object using an allocator tied to the lifetime of the graph.

Public function

ParameterStr...

 

AllocParameters()

Allocates a parameter struct with a lifetime tied to graph execution.

Public function

PODType *...

 

AllocPOD()

Allocates POD memory using an allocator tied to the lifetime of the graph.

Public function

PODType *...

 

AllocPODArray

(
    uint32 Count
)

Allocates POD memory using an allocator tied to the lifetime of the graph.

Public function

void

 

BeginEventScope

(
    FRDGEventName&& Name
)

Manually begins a new GPU event scope.

Public function Static

FString

 

BeginResourceDump

(
    const TArray< FString >& Args
)

Public function

const TRefCo...

 

ConvertToExternalBuffer

(
    FRDGBufferRef Buffer
)

Public function

const TRefCo...

 

ConvertToExternalTexture

(
    FRDGTextureRef Texture
)

For graph-created resources, this forces immediate allocation of the underlying pooled resource, effectively promoting it to an external resource.

Public function

FRDGBufferRe...

 

CreateBuffer

(
    const FRDGBufferDesc& Desc,
    const TCHAR* Name,
    FRDGBufferNumElementsCallback&& Nu...,
    ERDGBufferFlags Flags
)

A variant of CreateBuffer where users supply NumElements through a callback.

Public function

FRDGBufferRe...

 

CreateBuffer

(
    const FRDGBufferDesc& Desc,
    const TCHAR* Name,
    ERDGBufferFlags Flags
)

Create graph tracked buffer from a descriptor.

Public function

FRDGBufferSR...

 

CreateSRV

(
    FRDGBufferRef Buffer,
    EPixelFormat Format
)

Public function

FRDGBufferSR...

 

CreateSRV

(
    const FRDGBufferSRVDesc& Desc
)

Create graph tracked SRV for a buffer from a descriptor.

Public function

FRDGTextureS...

 

CreateSRV

(
    const FRDGTextureSRVDesc& Desc
)

Create graph tracked SRV for a texture from a descriptor.

Public function

FRDGTextureR...

 

CreateTexture

(
    const FRDGTextureDesc& Desc,
    const TCHAR* Name,
    ERDGTextureFlags Flags
)

Create graph tracked texture from a descriptor.

Public function

FRDGTextureU...

 

CreateUAV

(
    FRDGTextureRef Texture,
    ERDGUnorderedAccessViewFlags Flags
)

Public function

FRDGBufferUA...

 

CreateUAV

(
    FRDGBufferRef Buffer,
    EPixelFormat Format,
    ERDGUnorderedAccessViewFlags Flags
)

Public function

FRDGBufferUA...

 

CreateUAV

(
    const FRDGBufferUAVDesc& Desc,
    ERDGUnorderedAccessViewFlags Flags
)

Create graph tracked UAV for a buffer from a descriptor.

Public function

FRDGTextureU...

 

CreateUAV

(
    const FRDGTextureUAVDesc& Desc,
    ERDGUnorderedAccessViewFlags Flags
)

Create graph tracked UAV for a texture from a descriptor.

Public function

TRDGUniformB...

 

CreateUniformBuffer

(
    const ParameterStructType* Par...
)

Creates a graph tracked uniform buffer which can be attached to passes.

Public function

void

 

Drain()

Drains the RDG queue early.

Public function Static

void

 

DumpDraw

(
    const FRDGEventName& DrawEventName
)

Public function

void

 

EndEventScope()

Manually ends the current GPU event scope.

Public function Static

void

 

EndResourceDump()

Public function

void

 

Execute()

Executes the queued passes, managing setting of render targets (RHI RenderPasses), resource transitions and queued texture extraction.

Public function

void

 

FinalizeBufferAccess

(
    FRDGBufferRef Buffer,
    ERHIAccess Access
)

Public function

void

 

FinalizeBufferAccess

(
    FRDGBufferAccessArray&& InBuffers
)

Public function

void

 

FinalizeResourceAccess

(
    FRDGTextureAccessArray&& Textures,
    FRDGBufferAccessArray&& Buffers
)

Finalizes the access of multiple resources so that they are immutable for the remainder of the graph.

Public function

void

 

FinalizeTextureAccess

(
    FRDGTextureRef Texture,
    ERHIAccess Access
)

Public function

void

 

FinalizeTextureAccess

(
    FRDGTextureAccessArray&& InTexture...
)

Public function Const

FRDGTextureR...

 

FindExternalTexture

(
    IPooledRenderTarget* ExternalP...,
    ERenderTargetTexture Texture
)

Finds an RDG texture associated with the external texture, or returns null if none is found.

Public function Const

FRDGTextureR...

 

FindExternalTexture

(
    FRHITexture* Texture
)

Finds an RDG texture associated with the external texture, or returns null if none is found.

Public function Const

const TRefCo...

 

GetPooledBuffer

(
    FRDGBufferRef Buffer
)

Public function Const

const TRefCo...

 

GetPooledTexture

(
    FRDGTextureRef Texture
)

Performs an immediate query for the underlying pooled resource.

Public function Static

bool

 

IsDrainEnabled()

Whether RDG will actually perform a drain when Drain() is called.

Public function Static

bool

 

IsDumpingDraws()

Public function Static

bool

 

IsDumpingFrame()

Public function Static

bool

 

IsImmediateMode()

Whether RDG is running in immediate mode.

Public function

void

 

QueueBufferExtraction

(
    FRDGBufferRef Buffer,
    TRefCountPtr< FRDGPooledBuffer >&#...,
    ERHIAccess AccessFinal
)

Queues a pooled buffer extraction to happen at the end of graph execution.

Public function

void

 

QueueBufferExtraction

(
    FRDGBufferRef Buffer,
    TRefCountPtr< FRDGPooledBuffer >&#...
)

Queues a pooled buffer extraction to happen at the end of graph execution.

Public function

void

 

QueueBufferUpload

(
    FRDGBufferRef Buffer,
    TArrayView< ElementType, int32 > Co...,
    FRDGBufferInitialDataFreeCallback&...
)

Public function

void

 

QueueBufferUpload

(
    FRDGBufferRef Buffer,
    TArrayView< ElementType, int32 > Co...,
    ERDGInitialDataFlags InitialDataFla...
)

Public function

void

 

QueueBufferUpload

Queues a buffer upload operation prior to execution.

Public function

void

 

QueueBufferUpload

(
    FRDGBufferRef Buffer,
    const void* InitialData,
    uint64 InitialDataSize,
    ERDGInitialDataFlags InitialDataFla...
)

Queues a buffer upload operation prior to execution.

Public function

void

 

QueueBufferUpload

(
    FRDGBufferRef Buffer,
    const void* InitialData,
    uint64 InitialDataSize,
    FRDGBufferInitialDataFreeCallback&...
)

Queues a buffer upload operation prior to execution.

Public function

void

 

QueueBufferUpload

A variant where InitialData and InitialDataSize are supplied through callbacks.

Public function

void

 

QueueTextureExtraction

(
    FRDGTextureRef Texture,
    TRefCountPtr< IPooledRenderTarget >...,
    ERDGResourceExtractionFlags Flags
)

Queues a pooled render target extraction to happen at the end of graph execution.

Public function

void

 

QueueTextureExtraction

(
    FRDGTextureRef Texture,
    TRefCountPtr< IPooledRenderTarget >...,
    ERHIAccess AccessFinal,
    ERDGResourceExtractionFlags Flags
)

Queues a pooled render target extraction to happen at the end of graph execution.

Public function

FRDGBufferRe...

 

RegisterExternalBuffer

(
    const TRefCountPtr< FRDGPooledBuffe...,
    ERDGBufferFlags Flags
)

Register a external buffer to be tracked by the render graph.

Public function

FRDGBufferRe...

 

RegisterExternalBuffer

(
    const TRefCountPtr< FRDGPooledBuffe...,
    const TCHAR* NameIfNotRegister...,
    ERDGBufferFlags Flags
)

Register an external buffer with a custom name.

Public function

FRDGBufferRe...

 

RegisterExternalBuffer

(
    const TRefCountPtr< FRDGPooledBuffe...,
    ERDGBufferFlags Flags,
    ERHIAccess AccessFinal
)

Register a external buffer to be tracked by the render graph.

Public function

FRDGTextureR...

 

RegisterExternalTexture

(
    const TRefCountPtr< IPooledRenderTa...,
    const TCHAR* NameIfNotRegister...,
    ERenderTargetTexture RenderTargetTe...,
    ERDGTextureFlags Flags
)

Register an external texture with a custom name.

Public function

FRDGTextureR...

 

RegisterExternalTexture

(
    const TRefCountPtr< IPooledRenderTa...,
    ERenderTargetTexture Texture,
    ERDGTextureFlags Flags
)

Registers a external pooled render target texture to be tracked by the render graph.

Public function

void

 

RemoveUnusedBufferWarning

(
    FRDGBufferRef Buffer
)

Public function

void

 

RemoveUnusedTextureWarning

(
    FRDGTextureRef Texture
)

Flag a resource that is produced by a pass but never used or extracted to not emit an 'unused' warning.

Public function

void

 

SetBufferAccessFinal

(
    FRDGBufferRef Buffer,
    ERHIAccess Access
)

(External | Extracted only) Sets the access to transition to after execution at the end of the graph.

Public function

void

 

SetCommandListStat

(
    TStatId StatId
)

Sets the current command list stat for all subsequent passes.

Public function

void

 

SetFlushResourcesRHI()

Tells the builder to delete unused RHI resources.

Public function

void

 

SetTextureAccessFinal

(
    FRDGTextureRef Texture,
    ERHIAccess Access
)

(External | Extracted only) Sets the access to transition to after execution at the end of the graph.

Public function Static

void

 

TickPoolElements()

Per-frame update of the render graph resource pool.

Enums

Name

Description

Private enum

EExecuteMode

Constants

Deprecated Functions

Name Description

Public function

void

 

PreallocateBuffer

(
    FRDGBufferRef Buffer
)

PreallocateBuffer has been renamed to ConvertToExternalBuffer

Public function

void

 

PreallocateTexture

(
    FRDGTextureRef Texture
)

PreallocateTexture has been renamed to ConvertToExternalTexture