r.GPUScene.ParallelUpdate

r.GPUScene.ParallelUpdate

#Overview

name: r.GPUScene.ParallelUpdate

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

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.GPUScene.ParallelUpdate is to control whether the GPU scene update process should be executed in parallel. This setting is part of Unreal Engine’s rendering system, specifically related to the GPU scene management.

The Unreal Engine subsystem that relies on this setting variable is the Renderer module, as evidenced by its usage in the GPUScene.cpp file within the Renderer/Private directory.

The value of this variable is set through the console variable system (CVarGPUSceneParallelUpdate). It is initialized with a default value of 0, meaning parallel updates are disabled by default.

This variable interacts with the FApp::ShouldUseThreadingForPerformance() function to determine whether parallel execution should be used. It’s used in conjunction with the Nanite system, as seen in the code where bNaniteEnabled is checked alongside this setting.

Developers must be aware that enabling this feature (by setting it to a non-zero value) may impact performance and should be tested thoroughly in their specific use case. It’s also important to note that this setting is render thread safe (ECVF_RenderThreadSafe).

Best practices when using this variable include:

  1. Profiling the application with and without parallel updates to determine the optimal setting for your specific game or application.
  2. Considering the target hardware capabilities, as parallel execution may not be beneficial on all systems.
  3. Testing thoroughly for any rendering artifacts or inconsistencies that may arise from parallel updates.

Regarding the associated variable CVarGPUSceneParallelUpdate:

The purpose of CVarGPUSceneParallelUpdate is to provide a programmatic interface to the r.GPUScene.ParallelUpdate console variable. It allows C++ code to read and potentially modify the setting at runtime.

This variable is part of the Unreal Engine’s console variable system, which is used throughout the engine for configuration and debugging purposes.

The value of this variable is set when the engine initializes its console variables, but it can be changed at runtime through console commands or programmatically.

CVarGPUSceneParallelUpdate interacts directly with the r.GPUScene.ParallelUpdate console variable, effectively serving as its C++ representation.

Developers should be aware that changes to this variable will immediately affect the behavior of the GPU scene update process. It’s important to use the GetValueOnRenderThread() method when accessing this variable from the render thread to ensure thread-safe access.

Best practices for using CVarGPUSceneParallelUpdate include:

  1. Always access the value using GetValueOnRenderThread() when on the render thread.
  2. Consider exposing this setting in your game’s graphics options if you want to give users control over this feature.
  3. Use this variable for any runtime checks or modifications to the parallel update behavior, rather than directly accessing the console variable string.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:126, section: [/Script/Engine.RendererSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GPUScene.cpp:73

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarGPUSceneParallelUpdate(
	TEXT("r.GPUScene.ParallelUpdate"),
	0,
	TEXT(""),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarGPUSceneDebugMode(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GPUScene.cpp:72

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarGPUSceneParallelUpdate(
	TEXT("r.GPUScene.ParallelUpdate"),
	0,
	TEXT(""),
	ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GPUScene.cpp:1053

Scope (from outer to inner):

file
function     void FGPUScene::UploadGeneral

Source code excerpt:

	}

	const bool bExecuteInParallel = CVarGPUSceneParallelUpdate.GetValueOnRenderThread() != 0 && FApp::ShouldUseThreadingForPerformance();
	const bool bNaniteEnabled = DoesPlatformSupportNanite(GMaxRHIShaderPlatform);

	SCOPED_NAMED_EVENT(UpdateGPUScene, FColor::Green);

	RDG_GPU_MASK_SCOPE(GraphBuilder, FRHIGPUMask::All());
	RDG_EVENT_SCOPE(GraphBuilder, "UpdateGPUScene NumPrimitiveDataUploads %u", NumPrimitiveDataUploads);