r.LimitRenderingFeatures

r.LimitRenderingFeatures

#Overview

name: r.LimitRenderingFeatures

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.LimitRenderingFeatures is to quickly reduce render features to increase render performance. It serves as a convenient way to alter multiple show flags and console variables in the game simultaneously.

This setting variable is primarily used by the rendering system in Unreal Engine. Based on the callsites, it’s referenced in the Core, Engine, and Renderer modules, indicating its broad impact on the rendering pipeline.

The value of this variable is set through a console command, as it’s defined as a TAutoConsoleVariable. It can be changed at runtime, allowing for dynamic adjustment of rendering features.

r.LimitRenderingFeatures interacts with several other rendering-related variables and show flags. It’s used to conditionally disable various rendering features based on its value.

Developers must be aware that:

  1. This variable is marked as a cheat command (ECVF_Cheat), meaning it’s typically only available in development builds.
  2. It’s render thread safe (ECVF_RenderThreadSafe), allowing it to be safely accessed from the render thread.
  3. The higher the value, the more features are disabled, potentially significantly altering the game’s visual quality.

Best practices when using this variable include:

  1. Use it primarily for performance testing and debugging, not as a permanent solution for performance issues.
  2. Be cautious when modifying it in shipping builds, as it can dramatically alter the game’s appearance.
  3. Document the specific features affected at different values to ensure consistent use across the development team.
  4. Consider creating presets or specific values that correspond to different quality levels for easier management.

#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:3439

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarLimitRenderingFeatures(
	TEXT("r.LimitRenderingFeatures"),
	0,
	TEXT("Allows to quickly reduce render feature to increase render performance.\n"
		 "This is just a quick way to alter multiple show flags and console variables in the game\n"
		 "Disabled more feature the higher the number\n"
		 " <=0:off, order is defined in code (can be documented here when we settled on an order)"),
	ECVF_Cheat | ECVF_RenderThreadSafe);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShowFlags.cpp:628

Scope (from outer to inner):

file
function     void EngineShowFlagOverride

Source code excerpt:

#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
	{
		static const auto ICVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.LimitRenderingFeatures"));
		if (ICVar)
		{
			 int32 Value = ICVar->GetValueOnGameThread();

#define DISABLE_ENGINE_SHOWFLAG(Name) if(Value-- >  0) EngineShowFlags.Set##Name(false);
			 DISABLE_ENGINE_SHOWFLAG(AntiAliasing)

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadowRendering.cpp:255

Scope (from outer to inner):

file
function     uint32 GetShadowQuality

Source code excerpt:


#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
	static const auto ICVarLimit = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.LimitRenderingFeatures"));
	if(ICVarLimit)
	{
		int32 Limit = ICVarLimit->GetValueOnRenderThread();

		if(Limit > 2)
		{