TargetedHardwareClass

TargetedHardwareClass

#Overview

name: TargetedHardwareClass

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 6 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of TargetedHardwareClass is to specify the class of hardware that the game is targeting. This setting is used to configure various aspects of the Unreal Engine to optimize performance and features for the intended hardware platform.

This setting variable is primarily used by the Hardware Targeting module in Unreal Engine 5. It is referenced in the following subsystems and modules:

  1. DetailCustomizations module
  2. GameProjectGeneration module
  3. HardwareTargeting module
  4. RendererSettings

The value of this variable is set in the UHardwareTargetingSettings class, which is part of the HardwareTargeting module. It can be modified through the editor interface or project settings.

TargetedHardwareClass interacts with other variables, particularly:

  1. DefaultGraphicsPerformance: Used in conjunction to determine specific rendering settings.
  2. AppliedTargetedHardwareClass: Stores the last successfully applied hardware class setting.

Developers should be aware that:

  1. Changes to this variable trigger the SettingChangedEvent.
  2. The setting affects various rendering and performance options throughout the engine.
  3. It’s used in combination with DefaultGraphicsPerformance to determine specific feature enablement.

Best practices when using this variable include:

  1. Set it early in the project development to ensure consistent optimization across the project.
  2. Regularly review and update it as the project’s target hardware evolves.
  3. Test the game on the targeted hardware class to ensure optimal performance.
  4. Consider the implications on render features and performance when changing this setting.
  5. Use it in conjunction with DefaultGraphicsPerformance for fine-tuned control over the game’s visual quality and performance.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:142, 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:294

Scope (from outer to inner):

file
function     void FHardwareTargetingSettingsDetails::CustomizeDetails

Source code excerpt:

	// Setup the hardware class combo
	{
		auto PropertyName = GET_MEMBER_NAME_CHECKED(UHardwareTargetingSettings, TargetedHardwareClass);
		DetailBuilder.HideProperty(PropertyName);

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

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

Scope (from outer to inner):

file
function     void GameProjectUtils::AddHardwareConfigValues

Source code excerpt:

				ConfigValues.Emplace(TEXT("DefaultEngine.ini"),
					TEXT("/Script/HardwareTargeting.HardwareTargetingSettings"),
					TEXT("TargetedHardwareClass"),
					TargetHardwareString,
					true /* ShouldReplaceExistingValue */);
			}
		}
	}

	if (InProjectInfo.DefaultGraphicsPerformance.IsSet())
	{
		UEnum* GraphicsPresetEnum = StaticEnum<EGraphicsPreset>();
		if (GraphicsPresetEnum != nullptr)

#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);

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

Scope (from outer to inner):

file
function     void FHardwareTargetingModule::ApplyHardwareTargetingSettings

Source code excerpt:

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

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

Scope (from outer to inner):

file
function     UHardwareTargetingSettings::UHardwareTargetingSettings

Source code excerpt:

UHardwareTargetingSettings::UHardwareTargetingSettings(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
	, 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:47

Scope (from outer to inner):

file
class        class UHardwareTargetingSettings : public UObject

Source code excerpt:

	/** Enum specifying which class of hardware this game is targeting */
	UPROPERTY(config, EditAnywhere, category=None)
	EHardwareClass TargetedHardwareClass;
	
	/** Enum that is set to TargetedHardwareClass when the settings have been successfully applied */
	UPROPERTY(config)
	EHardwareClass AppliedTargetedHardwareClass;

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