r.MeshDrawCommands.ParallelPassSetup
r.MeshDrawCommands.ParallelPassSetup
#Overview
name: r.MeshDrawCommands.ParallelPassSetup
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to setup mesh draw command pass in parallel.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.MeshDrawCommands.ParallelPassSetup is to control whether the mesh draw command pass setup is executed in parallel. This setting variable is used in the rendering system of Unreal Engine 5.
The Unreal Engine subsystem that relies on this setting variable is the rendering system, specifically the mesh draw command processing module. This can be inferred from the file location (MeshDrawCommands.cpp) and the context of the code where it’s used.
The value of this variable is set through a console variable (CVarMeshDrawCommandsParallelPassSetup) with a default value of 1, meaning parallel setup is enabled by default.
The associated variable CVarMeshDrawCommandsParallelPassSetup interacts directly with r.MeshDrawCommands.ParallelPassSetup. They share the same value and purpose.
Developers must be aware that this variable affects the performance of mesh draw command processing. When enabled (set to 1), it allows for parallel execution of the mesh draw command pass setup, which can potentially improve performance on multi-core systems.
Best practices when using this variable include:
- Leave it enabled (set to 1) for most scenarios, as it’s the default and likely optimized setting.
- If experiencing rendering issues or unexpected behavior, temporarily disabling it (set to 0) might help isolate the problem.
- Consider performance testing with this setting enabled and disabled to determine the optimal configuration for your specific project.
Regarding the associated variable CVarMeshDrawCommandsParallelPassSetup:
The purpose of CVarMeshDrawCommandsParallelPassSetup is to provide a programmatic way to access and modify the r.MeshDrawCommands.ParallelPassSetup setting within the C++ code.
This console variable is defined in the rendering system and is used to control the parallel execution of mesh draw command pass setup.
The value of this variable is set when the console variable is initialized, with a default value of 1.
It interacts directly with the r.MeshDrawCommands.ParallelPassSetup setting, effectively controlling the same behavior.
Developers should be aware that changes to this console variable will affect the rendering performance, particularly in scenes with complex geometry.
Best practices for using CVarMeshDrawCommandsParallelPassSetup include:
- Use GetValueOnRenderThread() to safely access its value in render thread code.
- Consider exposing this setting in your game’s graphics options if you want to give users control over this aspect of rendering performance.
- When modifying this value at runtime, ensure it’s done in a thread-safe manner, preferably on the render thread.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MeshDrawCommands.cpp:17
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarMeshDrawCommandsParallelPassSetup(
TEXT("r.MeshDrawCommands.ParallelPassSetup"),
1,
TEXT("Whether to setup mesh draw command pass in parallel."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarMobileMeshSortingMethod(
TEXT("r.Mobile.MeshSortingMethod"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarMeshDrawCommandsParallelPassSetup
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MeshDrawCommands.cpp:16
Scope: file
Source code excerpt:
TGlobalResource<FPrimitiveIdVertexBufferPool> GPrimitiveIdVertexBufferPool;
static TAutoConsoleVariable<int32> CVarMeshDrawCommandsParallelPassSetup(
TEXT("r.MeshDrawCommands.ParallelPassSetup"),
1,
TEXT("Whether to setup mesh draw command pass in parallel."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarMobileMeshSortingMethod(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MeshDrawCommands.cpp:1425
Scope (from outer to inner):
file
function void FParallelMeshDrawCommandPass::DispatchPassSetup
Source code excerpt:
const bool bExecuteInParallel = FApp::ShouldUseThreadingForPerformance()
&& CVarMeshDrawCommandsParallelPassSetup.GetValueOnRenderThread() > 0
&& GIsThreadedRendering; // Rendering thread is required to safely use rendering resources in parallel.
if (bExecuteInParallel)
{
if (IsOnDemandShaderCreationEnabled())
{