r.PathTracing.AdjustMultiGPUPasses
r.PathTracing.AdjustMultiGPUPasses
#Overview
name: r.PathTracing.AdjustMultiGPUPasses
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Run extra passes per frame when multiple GPUs are active, to improve perf scaling as GPUs are added (default = true)\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.PathTracing.AdjustMultiGPUPasses is to control the behavior of path tracing in multi-GPU configurations within Unreal Engine’s rendering system. Specifically, it determines whether extra passes should be run per frame when multiple GPUs are active to improve performance scaling as more GPUs are added.
This setting variable is primarily used in the path tracing subsystem of Unreal Engine’s renderer module. Based on the callsites, it’s clear that this variable is only relevant when multi-GPU support is enabled (WITH_MGPU is defined).
The value of this variable is set through a console variable (CVarPathTracingAdjustMultiGPUPasses) with a default value of true. It can be changed at runtime through console commands or programmatically.
The associated variable CVarPathTracingAdjustMultiGPUPasses directly interacts with r.PathTracing.AdjustMultiGPUPasses. They share the same value and purpose.
Developers must be aware that:
- This variable only has an effect in multi-GPU configurations.
- Enabling this feature (which is the default) may increase the number of passes per frame, potentially affecting performance and image quality.
- The variable is render thread safe, meaning it can be safely accessed and modified from the render thread.
Best practices when using this variable include:
- Only modify it if you’re experiencing issues with path tracing performance in multi-GPU setups.
- Monitor performance metrics when changing this value to ensure it’s having the desired effect.
- Consider the trade-off between performance scaling and the increased number of passes per frame.
Regarding the associated variable CVarPathTracingAdjustMultiGPUPasses:
The purpose of CVarPathTracingAdjustMultiGPUPasses is to provide a runtime-configurable way to control the r.PathTracing.AdjustMultiGPUPasses setting. It’s a console variable that directly corresponds to the engine setting.
This variable is used in the renderer module, specifically in the path tracing implementation. It’s checked in the render thread to determine how many passes should be performed per frame in multi-GPU configurations.
The value is set when the console variable is created, with a default of true. It can be changed through console commands or programmatically using Unreal Engine’s console variable system.
Developers should be aware that:
- This variable is only relevant in multi-GPU configurations.
- Changes to this variable will take effect on the render thread.
- The variable is marked as render thread safe (ECVF_RenderThreadSafe).
Best practices for using CVarPathTracingAdjustMultiGPUPasses include:
- Use the console variable system to modify this value for testing and debugging.
- Consider exposing this setting in your game’s graphics options if you want to give users control over multi-GPU path tracing behavior.
- When accessing this variable in code, always do so from the render thread or use appropriate thread-safe methods provided by Unreal Engine.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:235
Scope: file
Source code excerpt:
TAutoConsoleVariable<bool> CVarPathTracingAdjustMultiGPUPasses(
TEXT("r.PathTracing.AdjustMultiGPUPasses"),
true,
TEXT("Run extra passes per frame when multiple GPUs are active, to improve perf scaling as GPUs are added (default = true)\n"),
ECVF_RenderThreadSafe
);
#endif // WITH_MGPU
#Associated Variable and Callsites
This variable is associated with another variable named CVarPathTracingAdjustMultiGPUPasses
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:234
Scope: file
Source code excerpt:
);
TAutoConsoleVariable<bool> CVarPathTracingAdjustMultiGPUPasses(
TEXT("r.PathTracing.AdjustMultiGPUPasses"),
true,
TEXT("Run extra passes per frame when multiple GPUs are active, to improve perf scaling as GPUs are added (default = true)\n"),
ECVF_RenderThreadSafe
);
#endif // WITH_MGPU
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:2731
Scope: file
Source code excerpt:
// (given that each GPU processes a fraction of the pixels), but get the job done in fewer frames.
#if WITH_MGPU
const int32 FramePassCount = !View.bIsOfflineRender && CVarPathTracingAdjustMultiGPUPasses.GetValueOnRenderThread() ? NumGPUs : 1;
#else
const int32 FramePassCount = 1;
#endif
bool bNeedsMoreRays = false;
bool bNeedsTextureExtract = false;