UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
RenderGraphPrivate.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Misc/ScopeExit.h"
9#include "RHI.h"
11
13
14#define RDG_DUMP_GRAPH_PRODUCERS 1
15#define RDG_DUMP_GRAPH_RESOURCES 2
16#define RDG_DUMP_GRAPH_TRACKS 3
17
18#define RDG_ASYNC_COMPUTE_DISABLED 0
19#define RDG_ASYNC_COMPUTE_ENABLED 1
20#define RDG_ASYNC_COMPUTE_FORCE_ENABLED 2
21
22#ifndef RDG_ENABLE_PARALLEL_TASKS
23#define RDG_ENABLE_PARALLEL_TASKS 1
24#endif
25
26#define RDG_RECURSION_COUNTER_SCOPE(Counter) Counter++; ON_SCOPE_EXIT { Counter--; }
27
28#if RDG_ENABLE_DEBUG
38extern bool GRDGAllowRHIAccess;
39extern bool GRDGAllowRHIAccessAsync;
40
42{
43public:
45 {
47 GRDGAllowRHIAccess = true;
48 }
49
51 {
53 GRDGAllowRHIAccess = false;
54 }
55};
56
57#define RDG_ALLOW_RHI_ACCESS_SCOPE() FRDGAllowRHIAccessScope RDGAllowRHIAccessScopeRAII;
58
59// Colors for texture / buffer clobbering.
62float GetClobberDepth();
64
65bool IsDebugAllowedForGraph(const TCHAR* GraphName);
66bool IsDebugAllowedForPass(const TCHAR* PassName);
67bool IsDebugAllowedForResource(const TCHAR* ResourceName);
68
69void EmitRDGWarning(const FString& WarningMessage);
70
71#else // !RDG_ENABLE_DEBUG
72
81
82#define RDG_ALLOW_RHI_ACCESS_SCOPE()
83
84#endif
85
93
94#if RDG_ENABLE_PARALLEL_TASKS
95
105
106#else
107
109const int32 GRDGParallelSetup = 0;
110const int32 GRDGParallelCompile = 0;
111const int32 GRDGParallelExecute = 0;
115const int32 GRDGAsyncSetupQueue = 0;
116
117#endif
118
119#if CSV_PROFILER_STATS
121#else
123#endif
124
126
127#define RDG_STATS STATS || COUNTERSTRACE_ENABLED
128
129#if RDG_STATS
145#endif
146
165
183
191
193
195{
196#if RDG_ENABLE_DEBUG
197 switch (Pipelines)
198 {
200 return TEXT("Epilogue (For Graphics)");
202 return TEXT("Epilogue (For AsyncCompute)");
204 return TEXT("Epilogue (For All)");
205 }
206#endif
207 return TEXT("");
208}
209
210inline bool SkipUAVBarrier(FRDGViewHandle PreviousHandle, FRDGViewHandle NextHandle)
211{
212 // Barrier if previous / next don't have a matching valid skip-barrier UAV handle.
213 if (GRDGOverlapUAVs != 0 && NextHandle.IsValid() && PreviousHandle == NextHandle)
214 {
215 return true;
216 }
217
218 return false;
219}
220
222{
223 return GRDGImmediateMode != 0;
224}
225
230
232{
233 // Render pass merging and async compute are mutually exclusive since they are mutually dependent on each other (i.e. we can't
234 // merge render passes that involve async compute fences, since transitions would be relocated to the ends of the merged region).
236}
237
238extern bool IsParallelExecuteEnabled(EShaderPlatform ShaderPlatform);
239extern bool IsParallelSetupEnabled(EShaderPlatform ShaderPlatform);
241
246
247template <typename ResourceRegistryType, typename FunctionType>
249{
250#if RDG_ENABLE_DEBUG
252 {
253 for (auto Handle = Registry.Begin(); Handle != Registry.End(); ++Handle)
254 {
255 auto* Resource = Registry[Handle];
256
257 if (IsExtendedLifetimeResource(Resource))
258 {
259 Function(Resource);
260 }
261 }
262 }
263#endif
264}
#define FORCEINLINE
Definition AndroidPlatform.h:140
#define check(expr)
Definition AssertionMacros.h:314
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
#define DECLARE_CYCLE_STAT_EXTERN(CounterName, StatId, GroupId, API)
Definition Stats.h:679
#define DECLARE_DWORD_COUNTER_STAT_EXTERN(CounterName, StatId, GroupId, API)
Definition Stats.h:682
#define DECLARE_FLOAT_COUNTER_STAT_EXTERN(CounterName, StatId, GroupId, API)
Definition Stats.h:681
#define DECLARE_MEMORY_STAT_EXTERN(CounterName, StatId, GroupId, API)
Definition Stats.h:687
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define TRACE_DECLARE_INT_COUNTER_EXTERN(CounterName)
Definition CountersTrace.h:448
#define TRACE_DECLARE_FLOAT_COUNTER_EXTERN(CounterName)
Definition CountersTrace.h:452
#define TRACE_DECLARE_MEMORY_COUNTER_EXTERN(CounterName)
Definition CountersTrace.h:456
#define CSV_DECLARE_CATEGORY_EXTERN(CategoryName)
Definition CsvProfiler.h:79
bool RHIHasTiledGPU(const FStaticShaderPlatform Platform)
Definition DataDrivenShaderPlatformInfo.h:1067
#define DEFINE_LOG_CATEGORY_STATIC(CategoryName, DefaultVerbosity, CompileTimeVerbosity)
Definition LogMacros.h:380
FRHIGlobals GRHIGlobals
Definition RHIGlobals.cpp:6
#define GSupportsEfficientAsyncCompute
Definition RHIGlobals.h:812
#define GRHISupportsSeparateDepthStencilCopyAccess
Definition RHIGlobals.h:834
#define GTriggerGPUProfile
Definition RHIGlobals.h:844
ERHIPipeline
Definition RHIPipeline.h:13
EShaderPlatform
Definition RHIShaderPlatform.h:11
int32 GRDGTransientExtractedResources
Definition RenderGraphPrivate.cpp:258
const int32 GRDGClobberResources
Definition RenderGraphPrivate.h:73
int32 GRDGMergeRenderPasses
Definition RenderGraphPrivate.cpp:240
const int32 GRDGTransitionLog
Definition RenderGraphPrivate.h:78
int32 GRDGAsyncCompute
Definition RenderGraphPrivate.cpp:211
int32 GRDGParallelSetup
Definition RenderGraphPrivate.cpp:297
bool IsParallelSetupEnabled(EShaderPlatform ShaderPlatform)
Definition RenderGraphPrivate.cpp:635
int32 GRDGParallelSetupTaskPriorityBias
Definition RenderGraphPrivate.cpp:321
int32 GRDGAsyncSetupQueue
Definition RenderGraphPrivate.cpp:313
int32 GRDGParallelCompile
Definition RenderGraphPrivate.cpp:305
FORCEINLINE bool IsAsyncComputeSupported(EShaderPlatform ShaderPlatform)
Definition RenderGraphPrivate.h:231
void EnumerateExtendedLifetimeResources(ResourceRegistryType &Registry, FunctionType Function)
Definition RenderGraphPrivate.h:248
FORCEINLINE bool IsRenderPassMergeEnabled(EShaderPlatform ShaderPlatform)
Definition RenderGraphPrivate.h:226
FORCEINLINE bool IsImmediateMode()
Definition RenderGraphPrivate.h:221
bool SkipUAVBarrier(FRDGViewHandle PreviousHandle, FRDGViewHandle NextHandle)
Definition RenderGraphPrivate.h:210
int32 GRDGParallelExecute
Definition RenderGraphPrivate.cpp:327
int32 GRDGParallelExecutePassTaskModeThreshold
Definition RenderGraphPrivate.cpp:363
const int32 GRDGDebugExtendResourceLifetimes
Definition RenderGraphPrivate.h:76
const int32 GRDGVerboseCSVStats
Definition RenderGraphPrivate.h:122
int32 GRDGTransientAllocator
Definition RenderGraphPrivate.cpp:249
const int32 GRDGDebugFlushGPU
Definition RenderGraphPrivate.h:75
int32 GRDGParallelExecutePassMin
Definition RenderGraphPrivate.cpp:351
const TCHAR * GetEpilogueBarriersToBeginDebugName(ERHIPipeline Pipelines)
Definition RenderGraphPrivate.h:194
int32 GRDGCullPasses
Definition RenderGraphPrivate.cpp:231
const int32 GRDGDebugDisableTransientResources
Definition RenderGraphPrivate.h:77
bool IsParallelExecuteEnabled(EShaderPlatform ShaderPlatform)
Definition RenderGraphPrivate.cpp:616
int32 GRDGParallelDestruction
Definition RenderGraphPrivate.cpp:289
int32 GRDGAsyncComputeTransientAliasing
Definition RenderGraphPrivate.cpp:267
bool IsExtendedLifetimeResource(FRDGViewableResource *Resource)
Definition RenderGraphPrivate.cpp:701
const int32 GRDGImmediateMode
Definition RenderGraphPrivate.h:79
int32 GRDGParallelExecutePassMax
Definition RenderGraphPrivate.cpp:357
bool IsAsyncComputeTransientAliasingEnabled()
Definition RenderGraphPrivate.h:242
const int32 GRDGOverlapUAVs
Definition RenderGraphPrivate.h:80
const int32 GRDGValidation
Definition RenderGraphPrivate.h:74
int32 GRDGTransientIndirectArgBuffers
RDG_ENABLE_PARALLEL_TASKS.
Definition RenderGraphPrivate.cpp:417
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
static const bool IsValid(const FStaticShaderPlatform Platform)
Definition DataDrivenShaderPlatformInfo.h:879
Definition RenderGraphResources.h:291
bool IsValid() const
Definition RenderGraphDefinitions.h:361
Definition Color.h:48
bool SupportsAsyncComputeTransientAliasing
Definition RHIGlobals.h:261