r.TemporalAA.Mobile.UseCompute

r.TemporalAA.Mobile.UseCompute

#Overview

name: r.TemporalAA.Mobile.UseCompute

The value of this variable can be defined or overridden in .ini config files. 2 .ini config files 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.TemporalAA.Mobile.UseCompute is to control whether the mobile version of Temporal Anti-Aliasing (TAA) uses a compute shader or a pixel shader for its implementation. This setting is specifically for the rendering system, focusing on the post-processing stage of the graphics pipeline.

This setting variable is primarily used in the Renderer module of Unreal Engine, specifically within the post-processing subsystem that handles Temporal Anti-Aliasing. Based on the callsites, it’s clear that this variable is used in the TemporalAA.cpp file, which is responsible for implementing the Temporal Anti-Aliasing feature.

The value of this variable is set through a console variable (CVarTemporalAAMobileUseCompute) with a default value of 1. This means that by default, the mobile TAA implementation uses a compute shader.

The associated variable CVarTemporalAAMobileUseCompute directly interacts with r.TemporalAA.Mobile.UseCompute. They share the same value and purpose.

Developers must be aware that:

  1. This setting only affects mobile platforms.
  2. Changing this value can impact performance and visual quality on mobile devices.
  3. The choice between compute and pixel shader can affect bandwidth usage, which is particularly important for tiled GPUs commonly found in mobile devices.

Best practices when using this variable include:

  1. Testing both options (0 and 1) on target mobile devices to determine which provides the best balance of performance and visual quality.
  2. Considering the target hardware capabilities when deciding which option to use.
  3. Being aware that using a compute shader (value 1) might not be supported or optimal on all mobile devices.

Regarding the associated variable CVarTemporalAAMobileUseCompute:

When working with this variable, developers should consider the trade-offs between using compute shaders (potentially better performance on some devices) and pixel shaders (potentially better bandwidth usage on tiled GPUs). The choice may vary depending on the specific mobile hardware targeted by the application.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/Android/AndroidEngine.ini:95, section: [/Script/Engine.RendererSettings]

Location: <Workspace>/Engine/Config/IOS/BaseIOSEngine.ini:13, 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/PostProcess/TemporalAA.cpp:80

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


TAutoConsoleVariable<int32> CVarTemporalAAMobileUseCompute(
	TEXT("r.TemporalAA.Mobile.UseCompute"),
	1,
	TEXT(" 0: Uses pixel shader to save bandwidth with FBC on tiled gpu;\n")
	TEXT(" 1: Uses compute shader (default);\n"),
	ECVF_RenderThreadSafe);

#if WITH_MGPU

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalAA.cpp:79

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

	ECVF_ReadOnly);

TAutoConsoleVariable<int32> CVarTemporalAAMobileUseCompute(
	TEXT("r.TemporalAA.Mobile.UseCompute"),
	1,
	TEXT(" 0: Uses pixel shader to save bandwidth with FBC on tiled gpu;\n")
	TEXT(" 1: Uses compute shader (default);\n"),
	ECVF_RenderThreadSafe);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalAA.cpp:531

Scope (from outer to inner):

file
function     bool DoesTemporalAAUseComputeShader

Source code excerpt:

bool DoesTemporalAAUseComputeShader(EShaderPlatform Platform)
{
	return !IsMobilePlatform(Platform) || CVarTemporalAAMobileUseCompute.GetValueOnAnyThread() > 0;
}

FIntPoint FTAAPassParameters::GetOutputExtent() const
{
	check(Validate());
	check(SceneColorInput);