r.RHICmdFlushRenderThreadTasksShadowPass
r.RHICmdFlushRenderThreadTasksShadowPass
#Overview
name: r.RHICmdFlushRenderThreadTasksShadowPass
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Wait for completion of parallel render thread tasks at the end of each shadow pass. A more granular version of r.RHICmdFlushRenderThreadTasks. If either r.RHICmdFlushRenderThreadTasks or r.RHICmdFlushRenderThreadTasksShadowPass is > 0 we will flush.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.RHICmdFlushRenderThreadTasksShadowPass is to control the flushing of parallel render thread tasks at the end of each shadow pass in Unreal Engine’s rendering system.
This setting variable is primarily used in the rendering subsystem of Unreal Engine, specifically in the shadow depth rendering module. It’s referenced in the ShadowDepthRendering.cpp file, which is part of the Renderer module.
The value of this variable is set through a console variable (CVarRHICmdFlushRenderThreadTasksShadowPass) with a default value of 0. It can be changed at runtime through console commands or programmatically.
This variable interacts with another console variable, CVarRHICmdFlushRenderThreadTasks. The engine checks both variables to determine if flushing should occur. If either of these variables is set to a value greater than 0, the engine will flush the render thread tasks.
Developers must be aware that enabling this feature (by setting the value > 0) can impact performance. It forces the engine to wait for the completion of parallel render thread tasks at the end of each shadow pass, which can introduce synchronization overhead.
Best practices when using this variable include:
- Leave it at the default value (0) unless specific rendering issues related to shadow passes are encountered.
- Use it in conjunction with profiling tools to understand its impact on performance.
- Consider it as a debugging tool rather than a permanent solution for rendering issues.
Regarding the associated variable CVarRHICmdFlushRenderThreadTasksShadowPass:
This is the actual console variable that controls the behavior described above. It’s defined using TAutoConsoleVariable, which allows it to be changed at runtime.
The purpose of this variable is the same as r.RHICmdFlushRenderThreadTasksShadowPass - they are essentially two ways to refer to the same setting.
This variable is used in the IsShadowDepthPassWaitForTasksEnabled() function, which checks both this variable and CVarRHICmdFlushRenderThreadTasks to determine if task flushing should occur.
Developers should be aware that changing this variable will immediately affect the rendering behavior, potentially impacting performance. It’s important to use it judiciously and monitor its effects when enabled.
Best practices for using this variable are the same as those mentioned for r.RHICmdFlushRenderThreadTasksShadowPass. Additionally, developers should remember that this variable provides more granular control compared to the general CVarRHICmdFlushRenderThreadTasks, allowing for specific optimization or debugging of shadow passes.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadowDepthRendering.cpp:736
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarRHICmdFlushRenderThreadTasksShadowPass(
TEXT("r.RHICmdFlushRenderThreadTasksShadowPass"),
0,
TEXT("Wait for completion of parallel render thread tasks at the end of each shadow pass. A more granular version of r.RHICmdFlushRenderThreadTasks. If either r.RHICmdFlushRenderThreadTasks or r.RHICmdFlushRenderThreadTasksShadowPass is > 0 we will flush."));
DECLARE_CYCLE_STAT(TEXT("Shadow"), STAT_CLP_Shadow, STATGROUP_ParallelCommandListMarkers);
class FShadowParallelCommandListSet final : public FParallelCommandListSet
#Associated Variable and Callsites
This variable is associated with another variable named CVarRHICmdFlushRenderThreadTasksShadowPass
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadowDepthRendering.cpp:735
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarRHICmdFlushRenderThreadTasksShadowPass(
TEXT("r.RHICmdFlushRenderThreadTasksShadowPass"),
0,
TEXT("Wait for completion of parallel render thread tasks at the end of each shadow pass. A more granular version of r.RHICmdFlushRenderThreadTasks. If either r.RHICmdFlushRenderThreadTasks or r.RHICmdFlushRenderThreadTasksShadowPass is > 0 we will flush."));
DECLARE_CYCLE_STAT(TEXT("Shadow"), STAT_CLP_Shadow, STATGROUP_ParallelCommandListMarkers);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadowDepthRendering.cpp:1059
Scope (from outer to inner):
file
function static bool IsShadowDepthPassWaitForTasksEnabled
Source code excerpt:
static bool IsShadowDepthPassWaitForTasksEnabled()
{
return CVarRHICmdFlushRenderThreadTasksShadowPass.GetValueOnRenderThread() > 0 || CVarRHICmdFlushRenderThreadTasks.GetValueOnRenderThread() > 0;
}
BEGIN_SHADER_PARAMETER_STRUCT(FShadowDepthPassParameters, )
SHADER_PARAMETER_STRUCT_REF(FViewUniformShaderParameters, View)
SHADER_PARAMETER_RDG_UNIFORM_BUFFER(FMobileShadowDepthPassUniformParameters, MobilePassUniformBuffer)
SHADER_PARAMETER_RDG_UNIFORM_BUFFER(FShadowDepthPassUniformParameters, DeferredPassUniformBuffer)