r.Lumen.DiffuseIndirect.AsyncCompute
r.Lumen.DiffuseIndirect.AsyncCompute
#Overview
name: r.Lumen.DiffuseIndirect.AsyncCompute
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to run Lumen diffuse indirect passes on the compute pipe if possible.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.DiffuseIndirect.AsyncCompute is to control whether Lumen diffuse indirect passes should run on the compute pipe when possible. This setting is part of the Lumen global illumination system in Unreal Engine 5’s rendering pipeline.
This setting variable is primarily used by the Lumen subsystem within the Renderer module of Unreal Engine 5. It specifically affects the diffuse indirect lighting calculations in the Lumen global illumination system.
The value of this variable is set through a console variable (CVarLumenDiffuseIndirectAsyncCompute) in the LumenDiffuseIndirect.cpp file. It is initialized with a default value of 1, meaning async compute is enabled by default.
The associated variable CVarLumenDiffuseIndirectAsyncCompute directly interacts with this setting. It’s defined as a TAutoConsoleVariable, which allows runtime modification of the setting.
Developers should be aware that this variable affects performance and potentially visual quality. Enabling async compute (value of 1) can improve performance by offloading certain calculations to the GPU’s compute queue, but it may not be supported on all hardware.
Best practices when using this variable include:
- Testing on target hardware to ensure async compute is supported and beneficial.
- Monitoring performance metrics to verify the impact of enabling or disabling this feature.
- Considering the balance between performance gain and potential visual differences when async compute is used.
Regarding the associated variable CVarLumenDiffuseIndirectAsyncCompute:
This is the actual console variable that controls the r.Lumen.DiffuseIndirect.AsyncCompute setting. It’s an integer variable that can be set to 0 (disabled) or 1 (enabled). The variable is marked with ECVF_Scalability and ECVF_RenderThreadSafe flags, indicating it’s related to scalability settings and can be safely modified on the render thread.
The UseAsyncCompute function in the LumenDiffuseIndirect class uses this variable to determine whether to use async compute for diffuse indirect passes. It checks both the global Lumen async compute setting and this specific setting for diffuse indirect calculations.
Developers should use this console variable when they need to dynamically adjust the async compute behavior for Lumen diffuse indirect passes, either for debugging, performance optimization, or to accommodate different hardware capabilities.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenDiffuseIndirect.cpp:151
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarLumenDiffuseIndirectAsyncCompute(
TEXT("r.Lumen.DiffuseIndirect.AsyncCompute"),
1,
TEXT("Whether to run Lumen diffuse indirect passes on the compute pipe if possible."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenDiffuseIndirectApplySSAO = 0;
#Associated Variable and Callsites
This variable is associated with another variable named CVarLumenDiffuseIndirectAsyncCompute
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenDiffuseIndirect.cpp:150
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarLumenDiffuseIndirectAsyncCompute(
TEXT("r.Lumen.DiffuseIndirect.AsyncCompute"),
1,
TEXT("Whether to run Lumen diffuse indirect passes on the compute pipe if possible."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenDiffuseIndirect.cpp:187
Scope (from outer to inner):
file
function bool LumenDiffuseIndirect::UseAsyncCompute
Source code excerpt:
bool LumenDiffuseIndirect::UseAsyncCompute(const FViewFamilyInfo& ViewFamily)
{
return Lumen::UseAsyncCompute(ViewFamily) && CVarLumenDiffuseIndirectAsyncCompute.GetValueOnRenderThread() != 0;
}
bool Lumen::UseMeshSDFTracing(const FSceneViewFamily& ViewFamily)
{
return GLumenTraceMeshSDFs != 0
&& GLumenAllowTracingMeshSDFs != 0