r.VolumetricRenderTarget.PreferAsyncCompute

r.VolumetricRenderTarget.PreferAsyncCompute

#Overview

name: r.VolumetricRenderTarget.PreferAsyncCompute

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.VolumetricRenderTarget.PreferAsyncCompute is to control whether async compute should be preferred for generating volumetric cloud render targets in Unreal Engine 5’s rendering system.

This setting variable is primarily used in the Renderer module of Unreal Engine, specifically in the volumetric rendering subsystem. It directly affects the performance and behavior of volumetric cloud rendering.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0, meaning async compute is not preferred by default.

The associated variable CVarVolumetricRenderTargetPreferAsyncCompute interacts directly with r.VolumetricRenderTarget.PreferAsyncCompute. They share the same value and purpose.

Developers must be aware that this variable only takes effect if the hardware supports efficient async compute. The IsVolumetricRenderTargetAsyncCompute() function checks both this variable and hardware support before deciding to use async compute.

Best practices when using this variable include:

  1. Only enable it (set to 1) if you’re certain that async compute will improve performance for volumetric cloud rendering on your target hardware.
  2. Test thoroughly on various hardware configurations, as the impact may vary.
  3. Consider exposing this as a user-configurable graphics option for players with different hardware capabilities.

Regarding the associated variable CVarVolumetricRenderTargetPreferAsyncCompute:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricRenderTarget.cpp:37

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarVolumetricRenderTargetPreferAsyncCompute(
	TEXT("r.VolumetricRenderTarget.PreferAsyncCompute"), 0,
	TEXT("Whether to prefer using async compute to generate volumetric cloud render targets."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<int32> CVarVolumetricRenderTargetReprojectionBoxConstraint(
	TEXT("r.VolumetricRenderTarget.ReprojectionBoxConstraint"), 0,
	TEXT("Whether reprojected data should be constrained to the new incoming cloud data neighborhod value."),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricRenderTarget.cpp:36

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<int32> CVarVolumetricRenderTargetPreferAsyncCompute(
	TEXT("r.VolumetricRenderTarget.PreferAsyncCompute"), 0,
	TEXT("Whether to prefer using async compute to generate volumetric cloud render targets."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<int32> CVarVolumetricRenderTargetReprojectionBoxConstraint(
	TEXT("r.VolumetricRenderTarget.ReprojectionBoxConstraint"), 0,

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricRenderTarget.cpp:78

Scope (from outer to inner):

file
function     bool IsVolumetricRenderTargetAsyncCompute

Source code excerpt:

	const bool bCloudComputePathDisabled = CVar && CVar->GetInt() > 1;

	return GSupportsEfficientAsyncCompute && CVarVolumetricRenderTargetPreferAsyncCompute.GetValueOnRenderThread() > 0 && !bCloudComputePathDisabled;
}

static bool ShouldViewComposeVolumetricRenderTarget(const FViewInfo& ViewInfo)
{
	return ShouldViewRenderVolumetricCloudRenderTarget(ViewInfo);
}