r.Mobile.Forward.EnableLocalLights

r.Mobile.Forward.EnableLocalLights

#Overview

name: r.Mobile.Forward.EnableLocalLights

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Mobile.Forward.EnableLocalLights is to control the usage of local lights in mobile forward rendering. This setting variable is part of Unreal Engine’s mobile rendering system, specifically for managing local lighting in forward rendering on mobile platforms.

This setting variable is primarily used by the rendering subsystem of Unreal Engine, particularly in the mobile rendering pipeline. Based on the callsites, it’s referenced in the Core and RenderCore modules.

The value of this variable is set through the console variable system. It’s defined as a TAutoConsoleVariable with an initial value of 1, meaning local lights are enabled by default.

The associated variable CVarMobileForwardEnableLocalLights interacts directly with r.Mobile.Forward.EnableLocalLights. They share the same value and purpose.

Developers must be aware that this variable has three possible values: 0: Local Lights Disabled 1: Local Lights Enabled (default) 2: Local Lights Buffer Enabled

This variable is marked as ECVF_ReadOnly and ECVF_RenderThreadSafe, meaning it can only be set at startup and is safe to read from the render thread.

Best practices when using this variable include:

  1. Consider performance implications when enabling local lights on mobile platforms.
  2. Use the appropriate setting based on the target mobile hardware capabilities.
  3. Be aware that changing this setting may require shader recompilation.

Regarding the associated variable CVarMobileForwardEnableLocalLights:

Developers should use this variable in conjunction with other mobile rendering settings to optimize performance and visual quality for their target mobile platforms.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/HAL/ConsoleManager.cpp:3573

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarMobileForwardEnableLocalLights(
	TEXT("r.Mobile.Forward.EnableLocalLights"),
	1,
	TEXT("0: Local Lights Disabled (default)\n"
		"1: Local Lights Enabled\n"
		"2: Local Lights Buffer Enabled\n"),
	ECVF_ReadOnly | ECVF_RenderThreadSafe);

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ReadOnlyCVARCache.cpp:39

Scope (from outer to inner):

file
function     int32 FReadOnlyCVARCache::MobileForwardLocalLightsIniValue

Source code excerpt:

int32 FReadOnlyCVARCache::MobileForwardLocalLightsIniValue(EShaderPlatform Platform)
{
	static FShaderPlatformCachedIniValue<int32> CVar(TEXT("r.Mobile.Forward.EnableLocalLights"));
	return CVar.Get(Platform);
}

bool FReadOnlyCVARCache::MobileDeferredShadingIniValue(EShaderPlatform Platform)
{
	static FShaderPlatformCachedIniValue<bool> MobileShadingPathIniValue(TEXT("r.Mobile.ShadingPath"));

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/HAL/ConsoleManager.cpp:3572

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarMobileForwardEnableLocalLights(
	TEXT("r.Mobile.Forward.EnableLocalLights"),
	1,
	TEXT("0: Local Lights Disabled (default)\n"
		"1: Local Lights Enabled\n"
		"2: Local Lights Buffer Enabled\n"),
	ECVF_ReadOnly | ECVF_RenderThreadSafe);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/EngineTypes.h:583

Scope: file

Source code excerpt:

/** 
 * Enumerates available MobileLocalLightSetting. 
 * @warning When this enum is updated please update CVarMobileForwardEnableLocalLights comments 
 */
UENUM()
enum EMobileLocalLightSetting : int
{
	LOCAL_LIGHTS_DISABLED UMETA(DisplayName = "Local Lights Disabled"),
	LOCAL_LIGHTS_ENABLED UMETA(DisplayName = "Local Lights Enabled"),
	LOCAL_LIGHTS_BUFFER UMETA(DisplayName = "Local Lights Buffer Enabled")
};