r.DiffuseIndirectForceCopyPass
r.DiffuseIndirectForceCopyPass
#Overview
name: r.DiffuseIndirectForceCopyPass
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Forces use of copy pass instead of dual source blend. (for debugging)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.DiffuseIndirectForceCopyPass is to control the rendering technique used for diffuse indirect lighting in Unreal Engine 5. Specifically, it forces the use of a copy pass instead of dual-source blending for debugging purposes.
This setting variable is primarily used in the rendering system of Unreal Engine 5. Based on the callsites, it is utilized in the IndirectLightRendering module, which is part of the Renderer subsystem.
The value of this variable is set through a console variable (CVarDiffuseIndirectForceCopyPass) in the Unreal Engine’s configuration system. It is defined as a boolean value, defaulting to false.
The associated variable CVarDiffuseIndirectForceCopyPass interacts directly with r.DiffuseIndirectForceCopyPass. They share the same value and purpose.
Developers must be aware that:
- This variable is intended for debugging purposes.
- Enabling this variable may impact rendering performance, as it forces a potentially less efficient rendering technique.
- It’s a render thread safe variable, meaning it can be changed at runtime without causing thread safety issues.
Best practices when using this variable include:
- Use it only for debugging indirect lighting issues.
- Be cautious about enabling it in production builds, as it may negatively impact performance.
- When enabled, thoroughly test the visual output to ensure it doesn’t introduce unexpected artifacts.
Regarding the associated variable CVarDiffuseIndirectForceCopyPass:
- Its purpose is identical to r.DiffuseIndirectForceCopyPass.
- It’s used in the same Renderer subsystem, specifically in the IndirectLightRendering module.
- The value is set when the console variable is initialized.
- It interacts directly with r.DiffuseIndirectForceCopyPass, effectively controlling the same functionality.
- Developers should be aware that this is the actual variable used in the C++ code to control the behavior.
- Best practices remain the same as for r.DiffuseIndirectForceCopyPass.
In the provided code, we can see that CVarDiffuseIndirectForceCopyPass is used in combination with RHISupportsDualSourceBlending to determine whether to enable the copy pass. This suggests that the variable provides a way to override the default behavior even on platforms that support dual-source blending.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/IndirectLightRendering.cpp:95
Scope: file
Source code excerpt:
static TAutoConsoleVariable<bool> CVarDiffuseIndirectForceCopyPass(
TEXT("r.DiffuseIndirectForceCopyPass"), false,
TEXT("Forces use of copy pass instead of dual source blend. (for debugging)"),
ECVF_RenderThreadSafe);
DECLARE_GPU_STAT_NAMED(ReflectionEnvironment, TEXT("Reflection Environment"));
DECLARE_GPU_STAT_NAMED(RayTracingReflections, TEXT("Ray Tracing Reflections"));
DECLARE_GPU_STAT(SkyLightDiffuse);
#Associated Variable and Callsites
This variable is associated with another variable named CVarDiffuseIndirectForceCopyPass
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/IndirectLightRendering.cpp:94
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<bool> CVarDiffuseIndirectForceCopyPass(
TEXT("r.DiffuseIndirectForceCopyPass"), false,
TEXT("Forces use of copy pass instead of dual source blend. (for debugging)"),
ECVF_RenderThreadSafe);
DECLARE_GPU_STAT_NAMED(ReflectionEnvironment, TEXT("Reflection Environment"));
DECLARE_GPU_STAT_NAMED(RayTracingReflections, TEXT("Ray Tracing Reflections"));
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/IndirectLightRendering.cpp:1236
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::RenderDiffuseIndirectAndAmbientOcclusion
Source code excerpt:
}
bool bEnableCopyPass = (!RHISupportsDualSourceBlending(ShaderPlatform) || CVarDiffuseIndirectForceCopyPass.GetValueOnRenderThread())
&& DenoiserOutputs.Textures[0];
FRDGTextureRef SceneColorCopyTexture;
if (bEnableCopyPass)
{