DefaultGraphicsPerformance

DefaultGraphicsPerformance

#Overview

name: DefaultGraphicsPerformance

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 10 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of DefaultGraphicsPerformance is to specify the default graphics preset for a game project in Unreal Engine 5. This setting is part of the hardware targeting system, which helps developers optimize their games for different hardware configurations.

This setting variable is primarily used by the Hardware Targeting module and the Game Project Generation system in Unreal Engine 5. It’s also referenced in the Detail Customizations module for UI purposes.

The value of this variable is typically set during project creation or when modifying project settings. It can be set through the project creation dialog (SProjectDialog) or by modifying the project configuration files.

DefaultGraphicsPerformance interacts with other variables, particularly TargetedHardwareClass. Together, these variables determine the initial graphics and performance settings for the project.

Developers should be aware that this variable affects various rendering and performance settings throughout the engine. Changing this value can have wide-reaching effects on how the game performs on different hardware.

Best practices when using this variable include:

  1. Choose an appropriate preset based on your target audience and hardware requirements.
  2. Consider the implications of your choice on mobile vs. desktop platforms.
  3. Use this setting in conjunction with TargetedHardwareClass for a comprehensive hardware targeting strategy.
  4. Be prepared to fine-tune individual settings after setting this preset, as it provides a starting point rather than a final configuration.
  5. Test your game on various hardware configurations to ensure the chosen preset provides a good balance between performance and visual quality.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:144, section: [/Script/HardwareTargeting.HardwareTargetingSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/DetailCustomizations/Private/HardwareTargetingSettingsDetails.cpp:315

Scope (from outer to inner):

file
function     void FHardwareTargetingSettingsDetails::CustomizeDetails

Source code excerpt:

	// Setup the graphics preset combo
	{
		auto PropertyName = GET_MEMBER_NAME_CHECKED(UHardwareTargetingSettings, DefaultGraphicsPerformance);
		DetailBuilder.HideProperty(PropertyName);

		TSharedRef<IPropertyHandle> Property = DetailBuilder.GetProperty(PropertyName);
		auto SetPropertyValue = [](EGraphicsPreset NewValue, TSharedRef<IPropertyHandle> InProperty){
			InProperty->SetValue(uint8(NewValue));
		};

#Loc: <Workspace>/Engine/Source/Editor/GameProjectGeneration/Private/GameProjectUtils.cpp:880

Scope (from outer to inner):

file
function     bool GameProjectUtils::CreateProject

Source code excerpt:

		}

		if (InProjectInfo.DefaultGraphicsPerformance.IsSet())
		{
			UEnum* GraphicsPresetEnum = StaticEnum<EGraphicsPreset>();
			if (GraphicsPresetEnum != nullptr)
			{
				EventAttributes.Add(FAnalyticsEventAttribute(TEXT("GraphicsPreset"), GraphicsPresetEnum->GetNameStringByValue(static_cast<int32>(InProjectInfo.DefaultGraphicsPerformance.GetValue()))));
			}
		}

		EventAttributes.Add(FAnalyticsEventAttribute(TEXT("StarterContent"), InProjectInfo.bCopyStarterContent ? TEXT("Yes") : TEXT("No")));

		FEngineAnalytics::GetProvider().RecordEvent(TEXT("Editor.NewProject.ProjectCreated"), EventAttributes);

#Loc: <Workspace>/Engine/Source/Editor/GameProjectGeneration/Private/GameProjectUtils.cpp:2064

Scope (from outer to inner):

file
function     void GameProjectUtils::AddHardwareConfigValues

Source code excerpt:

	}

	if (InProjectInfo.DefaultGraphicsPerformance.IsSet())
	{
		UEnum* GraphicsPresetEnum = StaticEnum<EGraphicsPreset>();
		if (GraphicsPresetEnum != nullptr)
		{
			FString GraphicsPresetString;
			GraphicsPresetEnum->GetValueAsString(InProjectInfo.DefaultGraphicsPerformance.GetValue(), /*out*/ GraphicsPresetString);

			if (!GraphicsPresetString.IsEmpty())
			{
				ConfigValues.Emplace(TEXT("DefaultEngine.ini"),
					TEXT("/Script/HardwareTargeting.HardwareTargetingSettings"),
					TEXT("DefaultGraphicsPerformance"),
					GraphicsPresetString,
					true /* ShouldReplaceExistingValue */);
			}
		}
	}

	// Don't override these settings for templates
	if (InProjectInfo.TemplateFile.IsEmpty())
	{
		// New projects always have DX12 by default on Windows

#Loc: <Workspace>/Engine/Source/Editor/GameProjectGeneration/Private/SProjectDialog.cpp:1678

Scope (from outer to inner):

file
function     FProjectInformation SProjectDialog::CreateProjectInfo

Source code excerpt:

		if (!HiddenSettings.Contains(ETemplateSetting::GraphicsPreset))
		{
			ProjectInfo.DefaultGraphicsPerformance = SelectedGraphicsPreset;
		}

		if (!HiddenSettings.Contains(ETemplateSetting::XR))
		{
			ProjectInfo.bEnableXR = bEnableXR;
		}

#Loc: <Workspace>/Engine/Source/Editor/GameProjectGeneration/Private/Tests/GameProjectAutomationTests.cpp:143

Scope (from outer to inner):

file
namespace    GameProjectAutomationUtils
function     static void CreateProjectSet

Source code excerpt:

						ProjectInfo.TemplateFile = ProjectFile;
						ProjectInfo.TargetedHardware = InTargetedHardware;
						ProjectInfo.DefaultGraphicsPerformance = InGraphicPreset;
						TArray<FString> CreatedFiles;
						OutMatchedProjects++;

						// Finally try to create the project					
						if (!GameProjectUtils::CreateProject(ProjectInfo, FailReason, FailLog, &CreatedFiles))
						{

#Loc: <Workspace>/Engine/Source/Editor/GameProjectGeneration/Public/GameProjectUtils.h:50

Scope: file

Source code excerpt:


	TOptional<EHardwareClass> TargetedHardware;
	TOptional<EGraphicsPreset> DefaultGraphicsPerformance;

	/** The name of the feature pack to use as starter content. Must be located under FeaturePacks\. */
	FString StarterContent;
};

DECLARE_DELEGATE_RetVal_OneParam(bool, FProjectDescriptorModifier, FProjectDescriptor&);

#Loc: <Workspace>/Engine/Source/Editor/HardwareTargeting/Private/HardwareTargetingModule.cpp:230

Scope (from outer to inner):

file
function     void FHardwareTargetingModule::GatherSettings

Source code excerpt:



	const bool bLowEndMobile = (Settings->TargetedHardwareClass == EHardwareClass::Mobile) && (Settings->DefaultGraphicsPerformance == EGraphicsPreset::Scalable);
	const bool bAnyMobile = (Settings->TargetedHardwareClass == EHardwareClass::Mobile);
	const bool bHighEndMobile = (Settings->TargetedHardwareClass == EHardwareClass::Mobile) && (Settings->DefaultGraphicsPerformance == EGraphicsPreset::Maximum);
	const bool bAnyPC = (Settings->TargetedHardwareClass == EHardwareClass::Desktop);
	const bool bHighEndPC = (Settings->TargetedHardwareClass == EHardwareClass::Desktop) && (Settings->DefaultGraphicsPerformance == EGraphicsPreset::Maximum);
	const bool bAnyScalable = Settings->DefaultGraphicsPerformance == EGraphicsPreset::Scalable;

	{
		// Bloom works and isn't terribly expensive on anything beyond low-end
		UE_META_SETTING_ENTRY(Builder, URendererSettings, bDefaultFeatureBloom, !bLowEndMobile);

		// Separate translucency

#Loc: <Workspace>/Engine/Source/Editor/HardwareTargeting/Private/HardwareTargetingModule.cpp:287

Scope (from outer to inner):

file
function     void FHardwareTargetingModule::ApplyHardwareTargetingSettings

Source code excerpt:

		{
			Settings->AppliedTargetedHardwareClass = Settings->TargetedHardwareClass;
			Settings->AppliedDefaultGraphicsPerformance = Settings->DefaultGraphicsPerformance;
			Settings->TryUpdateDefaultConfigFile();
		}
	}
}

TSharedRef<SWidget> FHardwareTargetingModule::MakeHardwareClassTargetCombo(FOnHardwareClassChanged OnChanged, TAttribute<EHardwareClass> SelectedEnum)

#Loc: <Workspace>/Engine/Source/Editor/HardwareTargeting/Private/HardwareTargetingSettings.cpp:7

Scope (from outer to inner):

file
function     UHardwareTargetingSettings::UHardwareTargetingSettings

Source code excerpt:

	, TargetedHardwareClass(EHardwareClass::Unspecified)
	, AppliedTargetedHardwareClass(EHardwareClass::Unspecified)
	, DefaultGraphicsPerformance(EGraphicsPreset::Unspecified)
	, AppliedDefaultGraphicsPerformance(EGraphicsPreset::Unspecified)
{ }


bool UHardwareTargetingSettings::HasPendingChanges() const
{
	if (TargetedHardwareClass == EHardwareClass::Unspecified || DefaultGraphicsPerformance == EGraphicsPreset::Unspecified)
	{
		return false;
	}

	return AppliedTargetedHardwareClass != TargetedHardwareClass || AppliedDefaultGraphicsPerformance != DefaultGraphicsPerformance;
}


void UHardwareTargetingSettings::PostEditChangeProperty( struct FPropertyChangedEvent& PropertyChangedEvent )
{
	SettingChangedEvent.Broadcast();

#Loc: <Workspace>/Engine/Source/Editor/HardwareTargeting/Public/HardwareTargetingSettings.h:55

Scope (from outer to inner):

file
class        class UHardwareTargetingSettings : public UObject

Source code excerpt:

	/** Enum specifying a graphics preset to use for this game */
	UPROPERTY(config, EditAnywhere, category=None)
	EGraphicsPreset DefaultGraphicsPerformance;

	/** Enum that is set to DefaultGraphicsPerformance when the settings have been successfully applied */
	UPROPERTY(config)
	EGraphicsPreset AppliedDefaultGraphicsPerformance;

	/** Check if these settings have any pending changes that require action */
	bool HasPendingChanges() const;