r.LandscapeUseAsyncTasksForLODComputation

r.LandscapeUseAsyncTasksForLODComputation

#Overview

name: r.LandscapeUseAsyncTasksForLODComputation

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.LandscapeUseAsyncTasksForLODComputation is to control whether async tasks are used for computing per-landscape component LOD (Level of Detail) biases in Unreal Engine’s landscape rendering system.

This setting variable is primarily used by the Landscape module in Unreal Engine’s rendering system. Based on the callsites, it’s clear that this variable is utilized in the LandscapeRender.cpp file, which is part of the Landscape runtime module.

The value of this variable is set to 1 by default, as seen in the source code: int32 GLandscapeUseAsyncTasksForLODComputation = 1;. However, it can be modified at runtime through the console variable system, as it’s registered as an FAutoConsoleVariableRef.

The associated variable GLandscapeUseAsyncTasksForLODComputation directly interacts with r.LandscapeUseAsyncTasksForLODComputation. They share the same value, with GLandscapeUseAsyncTasksForLODComputation being the actual variable used in the code logic.

Developers should be aware that this variable affects the performance and behavior of landscape LOD computations. When enabled (set to 1), it allows for asynchronous computation of LOD biases, which can potentially improve performance by offloading this work to separate tasks.

Best practices when using this variable include:

  1. Keeping it enabled (default value of 1) for most scenarios, as it likely improves performance.
  2. Testing the impact of disabling it (setting to 0) in specific scenarios where you might suspect issues related to LOD computation or if you need synchronous behavior for debugging purposes.
  3. Considering the interaction with threaded rendering, as seen in the code: GIsThreadedRendering && GLandscapeUseAsyncTasksForLODComputation.

Regarding the associated variable GLandscapeUseAsyncTasksForLODComputation:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:167

Scope: file

Source code excerpt:

int32 GLandscapeUseAsyncTasksForLODComputation = 1;
FAutoConsoleVariableRef CVarLandscapeUseAsyncTasksForLODComputation(
	TEXT("r.LandscapeUseAsyncTasksForLODComputation"),
	GLandscapeUseAsyncTasksForLODComputation,
	TEXT("Use async tasks for computing per-landscape component LOD biases."), 
	ECVF_RenderThreadSafe
);

int32 GDisableLandscapeNaniteGI = 1;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:165

Scope: file

Source code excerpt:

);

int32 GLandscapeUseAsyncTasksForLODComputation = 1;
FAutoConsoleVariableRef CVarLandscapeUseAsyncTasksForLODComputation(
	TEXT("r.LandscapeUseAsyncTasksForLODComputation"),
	GLandscapeUseAsyncTasksForLODComputation,
	TEXT("Use async tasks for computing per-landscape component LOD biases."), 
	ECVF_RenderThreadSafe
);

int32 GDisableLandscapeNaniteGI = 1;
static FAutoConsoleVariableRef CVarDisableLandscapeNaniteGI(

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:1185

Scope (from outer to inner):

file
function     void FLandscapeSceneViewExtension::PreRenderView_RenderThread

Source code excerpt:

			}

		}, GIsThreadedRendering && GLandscapeUseAsyncTasksForLODComputation);
	}
}

void FLandscapeSceneViewExtension::PreInitViews_RenderThread(FRDGBuilder& GraphBuilder)
{
	TRACE_CPUPROFILER_EVENT_SCOPE(FLandscapeSceneViewExtension::PreInitViews_RenderThread);