r.MaxQualityMode

r.MaxQualityMode

#Overview

name: r.MaxQualityMode

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.MaxQualityMode is to override certain system settings to the highest quality regardless of performance impact. This setting is primarily used in the rendering system of Unreal Engine 5.

Based on the Callsites section, this variable is part of the Engine module, specifically within the SystemSettings component. It’s defined in the Engine/Source/Runtime/Engine/Private/SystemSettings.cpp file.

The value of this variable is set through a console variable (CVar) named CVarUseMaxQualityMode. It’s initialized with a default value of 0, which means the max quality mode is disabled by default.

The associated variable CVarUseMaxQualityMode interacts directly with r.MaxQualityMode. They share the same value and purpose.

Developers must be aware that enabling this variable (setting it to 1) will override certain system settings to their highest quality, which may significantly impact performance. This should be used cautiously, especially for performance-sensitive applications or on lower-end hardware.

Best practices when using this variable include:

  1. Use it primarily for testing or showcasing purposes where performance is not a concern.
  2. Be cautious about enabling it in shipping builds, as it may cause performance issues on some systems.
  3. Consider providing user options to toggle this setting if you decide to expose it in your game or application.
  4. Always test thoroughly with this setting both enabled and disabled to understand its impact on your specific project.

Regarding the associated variable CVarUseMaxQualityMode:

This is a TAutoConsoleVariable that directly controls the r.MaxQualityMode setting. It’s defined with the following properties:

The variable is used in the FSystemSettings::ApplyOverrides function to determine if the max quality mode should be applied. If CVarUseMaxQualityMode is not 0, or if the command line parameter “MAXQUALITYMODE” is present, the system will apply the highest quality settings.

Developers should note that this variable can be set through console commands, allowing for runtime toggling of the max quality mode. This can be useful for debugging or creating in-game quality adjustment features.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SystemSettings.cpp:13

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarUseMaxQualityMode(
	TEXT("r.MaxQualityMode"),
	0,
	TEXT("If set to 1, override certain system settings to highest quality regardless of performance impact"),
	ECVF_RenderThreadSafe);

/*-----------------------------------------------------------------------------
	FSystemSettings

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SystemSettings.cpp:12

Scope: file

Source code excerpt:

DEFINE_LOG_CATEGORY_STATIC(LogSystemSettings, Log, All);

static TAutoConsoleVariable<int32> CVarUseMaxQualityMode(
	TEXT("r.MaxQualityMode"),
	0,
	TEXT("If set to 1, override certain system settings to highest quality regardless of performance impact"),
	ECVF_RenderThreadSafe);

/*-----------------------------------------------------------------------------

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SystemSettings.cpp:266

Scope (from outer to inner):

file
function     void FSystemSettings::ApplyOverrides

Source code excerpt:

	if (FPlatformProperties::SupportsWindowedMode())
	{
		if (CVarUseMaxQualityMode.GetValueOnGameThread() != 0)
		{
			SetBy = (EConsoleVariableFlags)(CVarUseMaxQualityMode.AsVariable()->GetFlags() & ECVF_SetByMask);
		}

		if (FParse::Param(FCommandLine::Get(),TEXT("MAXQUALITYMODE")))
		{
			SetBy = ECVF_SetByCommandline;
		}