r.RHICmdMinDrawsPerParallelCmdList

r.RHICmdMinDrawsPerParallelCmdList

#Overview

name: r.RHICmdMinDrawsPerParallelCmdList

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.RHICmdMinDrawsPerParallelCmdList is to control the minimum number of draw calls required to trigger parallel command list execution in the rendering system of Unreal Engine 5.

This setting variable is primarily used by the Renderer module of Unreal Engine, specifically in the scene rendering subsystem. It helps optimize the rendering process by determining when to use parallel command lists for draw calls.

The value of this variable is set as a console variable using TAutoConsoleVariable, with a default value of 64. It can be modified at runtime through the console or configuration files.

The associated variable CVarRHICmdMinDrawsPerParallelCmdList directly interacts with r.RHICmdMinDrawsPerParallelCmdList, as they share the same value and purpose.

Developers must be aware that this variable affects the parallelization of draw calls. If the total number of draws is less than the specified value, no parallel work will be done. This optimization may not always be possible or correct in all scenarios.

Best practices when using this variable include:

  1. Monitoring performance impact when adjusting the value.
  2. Considering the trade-off between parallelization overhead and potential performance gains.
  3. Testing thoroughly with different scene complexities to find the optimal value for your specific use case.

Regarding the associated variable CVarRHICmdMinDrawsPerParallelCmdList:

Its purpose is identical to r.RHICmdMinDrawsPerParallelCmdList, serving as the C++ variable that stores and provides access to the console variable’s value.

This variable is used within the FParallelCommandListSet constructor to initialize the MinDrawsPerCommandList member, which determines the minimum number of draws required for parallel command list execution.

Developers should be aware that this variable is accessed using GetValueOnRenderThread(), ensuring thread-safe access to its value during rendering operations.

Best practices for using CVarRHICmdMinDrawsPerParallelCmdList include:

  1. Accessing it only from the render thread to avoid potential race conditions.
  2. Considering caching its value if used frequently to reduce overhead from repeated calls to GetValueOnRenderThread().
  3. Being cautious when modifying its value at runtime, as it may impact rendering performance and behavior.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:353

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarRHICmdMinDrawsPerParallelCmdList(
	TEXT("r.RHICmdMinDrawsPerParallelCmdList"),
	64,
	TEXT("The minimum number of draws per cmdlist. If the total number of draws is less than this, then no parallel work will be done at all. This can't always be honored or done correctly."));

static TAutoConsoleVariable<int32> CVarWideCustomResolve(
	TEXT("r.WideCustomResolve"),
	0,

#Associated Variable and Callsites

This variable is associated with another variable named CVarRHICmdMinDrawsPerParallelCmdList. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:352

Scope: file

Source code excerpt:

	TEXT("Minimum number of parallel translate command lists to submit. If there are fewer than this number, they just run on the RHI thread and immediate context."));

static TAutoConsoleVariable<int32> CVarRHICmdMinDrawsPerParallelCmdList(
	TEXT("r.RHICmdMinDrawsPerParallelCmdList"),
	64,
	TEXT("The minimum number of draws per cmdlist. If the total number of draws is less than this, then no parallel work will be done at all. This can't always be honored or done correctly."));

static TAutoConsoleVariable<int32> CVarWideCustomResolve(
	TEXT("r.WideCustomResolve"),

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:756

Scope (from outer to inner):

file
function     FParallelCommandListSet::FParallelCommandListSet

Source code excerpt:

{
	Width = CVarRHICmdWidth.GetValueOnRenderThread();
	MinDrawsPerCommandList = CVarRHICmdMinDrawsPerParallelCmdList.GetValueOnRenderThread();
	QueuedCommandLists.Reserve(Width * 8);
	check(!GOutstandingParallelCommandListSet);
	GOutstandingParallelCommandListSet = this;
}

FRHICommandList* FParallelCommandListSet::AllocCommandList()