UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::Landscape::FRDGBuilderRecorder Class Referencefinal

#include <LandscapeUtils.h>

Classes

struct  FRDGExternalTextureAccessFinal
 

Public Types

enum class  EState { Immediate , Recording }
 
using FRDGRecorderRDGCommand = TFunction< void(FRDGBuilder &)>
 
using FRDGRecorderRenderCommand = TFunction< void(FRHICommandListImmediate &)>
 

Public Member Functions

 FRDGBuilderRecorder ()=default
 
LANDSCAPE_API ~FRDGBuilderRecorder ()
 
EState GetState () const
 
bool IsRecording () const
 
LANDSCAPE_API void StartRecording ()
 
LANDSCAPE_API void StopRecording ()
 
LANDSCAPE_API void StopRecordingAndFlush (FRDGEventName &&EventName)
 
LANDSCAPE_API void Flush (FRDGEventName &&EventName)
 
LANDSCAPE_API void EnqueueRDGCommand (FRDGRecorderRDGCommand InRDGCommand, TConstArrayView< FRDGExternalTextureAccessFinal > InRDGExternalTextureAccessFinalList={})
 
LANDSCAPE_API void EnqueueRenderCommand (FRDGRecorderRenderCommand InRenderCommand)
 
LANDSCAPE_API bool IsEmpty () const
 
LANDSCAPE_API void Clear ()
 

Detailed Description

This struct is usually meant to be allocated on the game thread (where there's no FRDGBuilder, which is Render Thread-only) and allows to queue successive operations (lambdas) onto a single render command, sharing the same FRDGBuilder. This allows to sequence a list of RDG passes from the game thread and makes it possible to interleave render thread operations (in a single render command) with game thread-initiated render commands. Here's an extensive use case :

FRDGBuilderRecorder Recorder;

// Start recording commands to a single graph builder : Recorder.StartRecording();

Recorder.EnqueueRDGCommand([](FRDGBuilder* GraphBuilder) { GraphBuilder->AddPass(); }); // Append a Pass_A ENQUEUE_RENDER_COMMAND(...) // Push Render_Command_A (immediately) Recorder.EnqueueRDGCommand([](FRDGBuilder* GraphBuilder) { GraphBuilder->AddPass(); }, { { SomeTexture, ERHIAccess::RTV } }); // Append a Pass_B and inform of the final state of a given texture to prevent the RDG from auto-transitioning to SRVMask at the end Recorder.EnqueueRenderCommand([](FRHICommandListImmediate& InRHICmdList) mutable { [...]; }); // Append a Render_Command_B to the graph builder Recorder.EnqueueRDGCommand([](FRDGBuilder* GraphBuilder) { GraphBuilder->AddPass(); }, { { }SomeTexture, ERHIAccess::CopySrc } }); // Append a Pass_C and inform of the final state of a given texture to prevent the RDG from auto-transitioning to SRVMask at the end

// Stop recording and issue a render command with all that's been recorded so far Recorder.StopRecordingAndFlush(RDG_EVENT_NAME("Pass ABC"));

// Enqueue some game-thread render commands (e.g. BP render) either directly or via the recorder in immediate mode : ENQUEUE_RENDER_COMMAND(...) // Render_Command_C Recorder.EnqueueRDGCommand([](FRDGBuilder* GraphBuilder) { GraphBuilder->AddPass(); }, { { SomeTexture, ERHIAccess::CopyDst } }); // Append a Pass_D and inform of the final state of a given texture to prevent the RDG from auto-transitioning to SRVMask at the end Recorder.EnqueueRenderCommand([RHIOperation](FRHICommandListImmediate& InRHICmdList) mutable { [...]; }); // Append a Render_Command_D

// Start recording commands again to a new single graph builder : Recorder.StartRecording(); Recorder.EnqueueRDGCommand([](FRDGBuilder* GraphBuilder) { GraphBuilder->AddPass(); }); // Append a Pass_E

// Stop recording and issue a render command with all that's been recorded so far Recorder.StopRecordingAndFlush(RDG_EVENT_NAME("Pass E"));

--> Will yield the following sequence on the render thread:

  • Render_Command_A
  • Render Command "Pass ABC" +- (RDGBuilder_0) +- RDGBuilder_0.Pass_A +- RDGBuilder_0.Pass_B +- RDGBuilder_0.LambdaPass (Render_Command_B) +- RDGBuilder_0.Pass_C +- RDGBuilder_0.SetTextureAccessFinal(OutputTexture, ERHIAccess::CopySrc); // Only the final state recorded for a given texture is set +- RDGBuilder_0.Execute
  • Render_Command_C
  • Render Command +- (RDGBuilder_1) +- RDGBuilder_1.Pass_D +- RDGBuilder_1.SetTextureAccessFinal(OutputTexture, ERHIAccess::CopyDst); +- RDGBuilder_1.Execute
  • Render_Command_D
  • Render Command "Pass E" +- (RDGBuilder_2) +- RDGBuilder_2.Pass_E +- RDGBuilder_2.Execute

Member Typedef Documentation

◆ FRDGRecorderRDGCommand

◆ FRDGRecorderRenderCommand

Member Enumeration Documentation

◆ EState

Enumerator
Immediate 
Recording 

Constructor & Destructor Documentation

◆ FRDGBuilderRecorder()

UE::Landscape::FRDGBuilderRecorder::FRDGBuilderRecorder ( )
default

◆ ~FRDGBuilderRecorder()

UE::Landscape::FRDGBuilderRecorder::~FRDGBuilderRecorder ( )

Member Function Documentation

◆ Clear()

void UE::Landscape::FRDGBuilderRecorder::Clear ( )

Cancels all recorder operations. This must be used if the FRDGEventRenderRecorder is "cancelled" (i.e. its sequence of operations is not flushed to a render command). Otherwise, there will be an assert in ~FRDGBuilderRecorder().

◆ EnqueueRDGCommand()

void UE::Landscape::FRDGBuilderRecorder::EnqueueRDGCommand ( FRDGRecorderRDGCommand  InRDGCommand,
TConstArrayView< FRDGExternalTextureAccessFinal InRDGExternalTextureAccessFinalList = {} 
)

Records a FRDGRecorderRDGCommand to execute when registering passes to the single FRDGBuilder when in Recording mode or pushes it immediately to the render thread when in Immediate mode

Parameters
InRDGCommandLambda to execute on the render thread
InRDGTextureAccessFinalList(optional) : list of external texture with the RHIAccess they should have when executing the FRDGBuilder. This is to prevent the RDG from auto-transitioning to SRVMask at the end

◆ EnqueueRenderCommand()

void UE::Landscape::FRDGBuilderRecorder::EnqueueRenderCommand ( FRDGRecorderRenderCommand  InRenderCommand)

Records a FRDGRecorderRenderCommand to execute when registering passes to the single FRDGBuilder when in Recording mode or pushes it immediately to the render thread when in Immediate mode

Parameters
InRenderCommandLambda to execute on the render thread

◆ Flush()

void UE::Landscape::FRDGBuilderRecorder::Flush ( FRDGEventName &&  EventName)

Flushes any pending command to the render thread

Parameters
EventNameRDG event name to use on the render command's FRDGBuilder

◆ GetState()

EState UE::Landscape::FRDGBuilderRecorder::GetState ( ) const
inline

◆ IsEmpty()

bool UE::Landscape::FRDGBuilderRecorder::IsEmpty ( ) const
Returns
true if there's no command currently recorded

◆ IsRecording()

bool UE::Landscape::FRDGBuilderRecorder::IsRecording ( ) const
inline

◆ StartRecording()

void UE::Landscape::FRDGBuilderRecorder::StartRecording ( )

Starts recording commands

◆ StopRecording()

void UE::Landscape::FRDGBuilderRecorder::StopRecording ( )

Stops recording commands. A call to Flush is needed to ensure any pending command is flushed to the render thread (use StopRecordingAndFlush to do both)

◆ StopRecordingAndFlush()

void UE::Landscape::FRDGBuilderRecorder::StopRecordingAndFlush ( FRDGEventName &&  EventName)

Stops recording commands and flushes them to the render thread. Expects the recorder to be in Recording mode and changes it to Immediate mode.

Parameters
EventNameRDG event name to use on the render command's FRDGBuilder

The documentation for this class was generated from the following files: