r.Nanite.ParallelBasePassBuild
r.Nanite.ParallelBasePassBuild
#Overview
name: r.Nanite.ParallelBasePassBuild
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Nanite.ParallelBasePassBuild is to control parallel execution of the base pass build process in Unreal Engine 5’s Nanite system. This setting is primarily used in the rendering system, specifically for Nanite’s material shading and base pass rendering.
The Unreal Engine subsystem that relies on this setting variable is the Renderer module, particularly the Nanite rendering subsystem. This can be seen from the file paths of the callsites, which are all within the Renderer/Private/Nanite directory.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1, which means parallel base pass build is enabled by default.
This variable interacts with the associated variable CVarParallelBasePassBuild, which shares the same value. They are used interchangeably in the code.
Developers must be aware that this variable affects the parallelization of the base pass build process. When enabled (set to non-zero), it allows for parallel dispatch of shading commands, which can improve performance on systems that support parallel algorithms.
Best practices when using this variable include:
- Leaving it enabled (default value of 1) for better performance on supported systems.
- Disabling it (setting to 0) if encountering rendering artifacts or inconsistencies that might be related to parallel execution.
- Profiling the application with both enabled and disabled states to determine the optimal setting for specific hardware configurations.
Regarding the associated variable CVarParallelBasePassBuild:
The purpose of CVarParallelBasePassBuild is the same as r.Nanite.ParallelBasePassBuild. It’s an internal representation of the console variable used within the C++ code.
This variable is used in the Nanite materials and shading systems. It’s checked in the code to determine whether to use parallel dispatch for certain rendering operations.
The value of this variable is set through the console variable system, just like r.Nanite.ParallelBasePassBuild.
It interacts directly with r.Nanite.ParallelBasePassBuild, as they represent the same setting.
Developers should be aware that this variable is used in conditional statements to enable or disable parallel execution of certain rendering tasks. It’s particularly important in the context of on-demand shader creation and parallel mesh draw command passes.
Best practices for using CVarParallelBasePassBuild include:
- Considering it in conjunction with other performance-related settings when optimizing rendering performance.
- Testing the impact of enabling/disabling this setting on different hardware configurations.
- Being cautious when modifying its value at runtime, as it could impact rendering consistency if changed during critical rendering operations.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteShading.cpp:40
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarParallelBasePassBuild(
TEXT("r.Nanite.ParallelBasePassBuild"),
1,
TEXT(""),
ECVF_RenderThreadSafe
);
static int32 GNaniteBarrierTest = 1;
#Associated Variable and Callsites
This variable is associated with another variable named CVarParallelBasePassBuild
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteMaterials.cpp:31
Scope: file
Source code excerpt:
#include "InstanceDataSceneProxy.h"
extern TAutoConsoleVariable<int32> CVarParallelBasePassBuild;
static TAutoConsoleVariable<int32> CVarNaniteMultipleSceneViewsInOnePass(
TEXT("r.Nanite.MultipleSceneViewsInOnePass"),
1,
TEXT("Supports rendering multiple views (FSceneView) whenever possible. Currently only ISR stereo rendering is supported."),
ECVF_RenderThreadSafe
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteMaterials.cpp:488
Scope: file
Source code excerpt:
TShaderMapRef<FNaniteIndirectMaterialVS> NaniteVertexShader(View.ShaderMap);
const bool bParallelDispatch = GRHICommandList.UseParallelAlgorithms() && CVarParallelBasePassBuild.GetValueOnRenderThread() != 0 && FParallelMeshDrawCommandPass::IsOnDemandShaderCreationEnabled();
if (bParallelDispatch)
{
static const TCHAR* const PassNames[] =
{
TEXT("EmitGBufferParallel"),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteShading.cpp:39
Scope: file
Source code excerpt:
#endif
TAutoConsoleVariable<int32> CVarParallelBasePassBuild(
TEXT("r.Nanite.ParallelBasePassBuild"),
1,
TEXT(""),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteShading.cpp:1341
Scope (from outer to inner):
file
function void DispatchBasePass
Source code excerpt:
};
const bool bParallelDispatch = !bBundleShading && GRHICommandList.UseParallelAlgorithms() && CVarParallelBasePassBuild.GetValueOnRenderThread() != 0 &&
FParallelMeshDrawCommandPass::IsOnDemandShaderCreationEnabled();
if (bParallelDispatch)
{
GraphBuilder.AddPass(
RDG_EVENT_NAME("ShadeGBufferCS"),
ShadingPassParameters,