r.Lumen.AsyncCompute

r.Lumen.AsyncCompute

#Overview

name: r.Lumen.AsyncCompute

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.Lumen.AsyncCompute is to control whether Lumen, Unreal Engine’s global illumination system, should use asynchronous compute if supported by the hardware. This setting is primarily used in the rendering system, specifically for the Lumen global illumination feature.

This setting variable is primarily used in the Lumen subsystem of Unreal Engine’s rendering module. It’s referenced in the Lumen.cpp file, which is part of the Renderer private implementation.

The value of this variable is set through a console variable (CVarLumenAsyncCompute) with a default value of 1 (enabled). It can be changed at runtime through console commands or programmatically.

The associated variable CVarLumenAsyncCompute directly interacts with r.Lumen.AsyncCompute. They share the same value and purpose.

Developers must be aware that this variable’s effect depends on hardware support for efficient asynchronous compute. The UseAsyncCompute function checks both this variable and hardware support before enabling async compute for Lumen.

Best practices when using this variable include:

  1. Consider performance implications on different hardware configurations.
  2. Test thoroughly on target platforms to ensure optimal performance.
  3. Be aware that when using hardware ray tracing, async compute is only used with inline ray tracing.

Regarding the associated variable CVarLumenAsyncCompute:

The purpose of CVarLumenAsyncCompute is identical to r.Lumen.AsyncCompute. It’s the actual console variable implementation that controls the async compute setting for Lumen.

This variable is used directly in the Lumen subsystem of the rendering module. It’s checked in the UseAsyncCompute function to determine whether to enable async compute for Lumen operations.

The value is set when the console variable is initialized, with a default value of 1. It can be modified at runtime through console commands.

CVarLumenAsyncCompute interacts directly with the r.Lumen.AsyncCompute setting and is used in conjunction with hardware support checks to determine the final async compute state.

Developers should be aware that this variable is marked with ECVF_Scalability and ECVF_RenderThreadSafe flags, indicating it affects performance scaling and is safe to modify from the render thread.

Best practices include using the GetValueOnRenderThread() method when accessing this variable from render thread code to ensure thread-safe access.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/Lumen.cpp:18

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarLumenAsyncCompute(
	TEXT("r.Lumen.AsyncCompute"),
	1,
	TEXT("Whether Lumen should use async compute if supported."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarLumenThreadGroupSize32(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/Lumen.cpp:17

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarLumenAsyncCompute(
	TEXT("r.Lumen.AsyncCompute"),
	1,
	TEXT("Whether Lumen should use async compute if supported."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/Lumen.cpp:39

Scope (from outer to inner):

file
function     bool Lumen::UseAsyncCompute

Source code excerpt:

{
	bool bUseAsync = GSupportsEfficientAsyncCompute
		&& CVarLumenAsyncCompute.GetValueOnRenderThread() != 0;
		
	if (Lumen::UseHardwareRayTracing(ViewFamily))
	{
		// Async for Lumen HWRT path can only be used by inline ray tracing
		bUseAsync &= CVarLumenAsyncCompute.GetValueOnRenderThread() != 0 && Lumen::UseHardwareInlineRayTracing(ViewFamily);
	}

	return bUseAsync;
}

bool Lumen::UseThreadGroupSize32()