r.IgnorePerformanceModeCheck

r.IgnorePerformanceModeCheck

#Overview

name: r.IgnorePerformanceModeCheck

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.IgnorePerformanceModeCheck is to bypass the performance mode check in Unreal Engine’s rendering system. This setting variable is primarily used to control whether the engine should consider performance mode restrictions when determining the appropriate feature level for rendering.

Based on the callsites provided, this variable is primarily used in the RHI (Rendering Hardware Interface) subsystem of Unreal Engine, specifically in the Windows-specific implementation. It’s also referenced in the GeForce NOW wrapper plugin.

The value of this variable is set in two ways:

  1. It’s initialized as a console variable with a default value of false in WindowsDynamicRHI.cpp.
  2. It can be dynamically set to true in the GeForceNOWWrapperModule when the module starts up.

The associated variable CVarIgnorePerformanceModeCheck interacts directly with r.IgnorePerformanceModeCheck. They share the same value and purpose.

Developers must be aware that:

  1. This variable can significantly impact the rendering feature level selection, potentially allowing higher feature levels on systems that would normally be restricted.
  2. It’s particularly relevant when developing for or testing on lower-spec systems or when integrating with cloud gaming services like GeForce NOW.

Best practices when using this variable include:

  1. Use it cautiously, as bypassing performance checks may lead to unexpected behavior or performance issues on certain hardware.
  2. Consider it primarily for testing or debugging purposes, rather than as a solution for performance issues in production builds.
  3. Be aware of its interaction with cloud gaming services and ensure it’s properly configured when developing for such platforms.

Regarding the associated variable CVarIgnorePerformanceModeCheck:

The purpose of CVarIgnorePerformanceModeCheck is identical to r.IgnorePerformanceModeCheck. It’s the actual console variable implementation that r.IgnorePerformanceModeCheck refers to.

This variable is used directly in the RHI subsystem, specifically in the Windows implementation of the dynamic RHI.

The value of CVarIgnorePerformanceModeCheck is set when it’s declared as a TAutoConsoleVariable with a default value of false. It can be modified at runtime through the console or programmatically.

CVarIgnorePerformanceModeCheck interacts directly with the feature level selection logic in the GetPreferredFeatureLevel function.

Developers should be aware that this variable is thread-safe (ECVF_RenderThreadSafe) and can be accessed from any thread.

Best practices for CVarIgnorePerformanceModeCheck are the same as for r.IgnorePerformanceModeCheck, as they are essentially the same variable. Developers should use the r.IgnorePerformanceModeCheck console command when they need to modify this setting, rather than directly manipulating CVarIgnorePerformanceModeCheck.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/Windows/WindowsDynamicRHI.cpp:82

Scope: file

Source code excerpt:


static TAutoConsoleVariable<bool> CVarIgnorePerformanceModeCheck(
	TEXT("r.IgnorePerformanceModeCheck"),
	false,
	TEXT("Ignore performance mode check"),
	ECVF_RenderThreadSafe
	);

static const TCHAR* ModuleNameFromWindowsRHI(EWindowsRHI InWindowsRHI)

#Loc: <Workspace>/Engine/Plugins/Runtime/Nvidia/GeForceNOWWrapper/Source/Private/GeForceNOWWrapperModule.cpp:38

Scope (from outer to inner):

file
class        class FGeForceNOWWrapperModule : public IGeForceNOWWrapperModule
function     virtual void StartupModule

Source code excerpt:

					CVar->Set(TEXT("0"));
				}
				if (IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.IgnorePerformanceModeCheck")))
				{
					CVar->Set(true);
				}
			}
		}
		else

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/Windows/WindowsDynamicRHI.cpp:81

Scope: file

Source code excerpt:

};

static TAutoConsoleVariable<bool> CVarIgnorePerformanceModeCheck(
	TEXT("r.IgnorePerformanceModeCheck"),
	false,
	TEXT("Ignore performance mode check"),
	ECVF_RenderThreadSafe
	);

#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/Windows/WindowsDynamicRHI.cpp:506

Scope (from outer to inner):

file
function     static TOptional<ERHIFeatureLevel::Type> GetPreferredFeatureLevel

Source code excerpt:

			// Force low-spec users into performance mode but respect their choice once they have set a preference
			bool bDefaultES31 = false;
			if (!bFoundPreference && !CVarIgnorePerformanceModeCheck.GetValueOnAnyThread())
			{
				bDefaultES31 = DefaultFeatureLevelES31();
			}

			if (bPreferFeatureLevelES31 || bDefaultES31)
			{