bSupportsMetalMRT
bSupportsMetalMRT
#Overview
name: bSupportsMetalMRT
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 15
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of bSupportsMetalMRT is to enable or disable support for Metal Multiple Render Targets (MRT) in Unreal Engine’s iOS rendering system. This setting is specifically related to the Metal graphics API used on iOS devices.
This variable is primarily used by the iOS-specific subsystems of Unreal Engine, particularly the rendering and platform-specific modules. The main modules that rely on this setting are:
- IOSRuntimeSettings
- IOSPlatformEditor
- IOSTargetPlatform
- MetalRHI (Metal Rendering Hardware Interface)
- ApplicationCore (iOS-specific parts)
- WebBrowser (iOS-specific parts)
The value of this variable is set in the project’s configuration file (usually DefaultEngine.ini) under the [/Script/IOSRuntimeSettings.IOSRuntimeSettings] section. It can be modified through the Unreal Engine editor’s project settings for iOS.
This variable often interacts with other Metal-related settings, particularly bSupportsMetal. They are often checked together to determine the appropriate rendering capabilities for the iOS device.
Developers should be aware of the following when using this variable:
- It requires iOS 10+ and an A10 processor or newer to function.
- Enabling this setting may increase the app’s hardware requirements and potentially exclude older devices.
- It’s used in conjunction with other Metal settings to determine the appropriate shader platform and feature level.
Best practices when using this variable include:
- Only enable it if your target audience has devices that support Metal MRT (A10 processor or newer).
- Ensure that at least one Metal API is supported (either bSupportsMetal or bSupportsMetalMRT should be true).
- Test your app thoroughly on various iOS devices when changing this setting, as it can significantly impact rendering performance and compatibility.
- Consider providing fallback rendering paths for devices that don’t support Metal MRT.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:2986, section: [/Script/IOSRuntimeSettings.IOSRuntimeSettings]
- INI Section:
/Script/IOSRuntimeSettings.IOSRuntimeSettings
- Raw value:
False
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Developer/IOS/IOSPlatformEditor/Private/IOSTargetSettingsCustomization.cpp:811
Scope: file
Source code excerpt:
SETUP_PLIST_PROP(bSupportsMetal, RenderCategory);
MRTPropertyHandle = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UIOSRuntimeSettings, bSupportsMetalMRT));
MRTPropertyHandle->SetOnPropertyValueChanged(OnEnableMetalMRT);
RenderCategory.AddProperty(MRTPropertyHandle);
SETUP_SOURCEONLY_PROP(bEnableRemoteNotificationsSupport, OnlineCategory)
// SETUP_SOURCEONLY_PROP(bAutomaticSigning, ProvisionCategory)
#Loc: <Workspace>/Engine/Source/Developer/IOS/IOSTargetPlatform/Private/IOSTargetPlatform.cpp:453
Scope (from outer to inner):
file
function static bool SupportsMetalMRT
Source code excerpt:
{
// default to NOT supporting metal MRT
bool bSupportsMetalMRT = false;
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportsMetalMRT"), bSupportsMetalMRT, GEngineIni);
return bSupportsMetalMRT;
}
static bool SupportsA8Devices()
{
// default to NOT supporting A8 devices
bool bSupportAppleA8 = false;
#Loc: <Workspace>/Engine/Source/Editor/PIEPreviewDeviceProfileSelector/Private/PIEPreviewDevice.cpp:252
Scope (from outer to inner):
file
function ERHIFeatureLevel::Type FPIEPreviewDevice::GetPreviewDeviceFeatureLevel
Source code excerpt:
bool bProjectBuiltForMetal = false, bProjectBuiltForMRTMetal = false;
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportsMetal"), bProjectBuiltForMetal, GEngineIni);
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportsMetalMRT"), bProjectBuiltForMRTMetal, GEngineIni);
const bool bDeviceSupportsMetal = DeviceSpecs->IOSProperties.MetalRHIState.MaxTextureDimensions > 0;
// not supporting preview for MRT metal
check(!bProjectBuiltForMRTMetal);
#Loc: <Workspace>/Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRHI.cpp:66
Scope (from outer to inner):
file
function static void ValidateTargetedRHIFeatureLevelExists
Source code excerpt:
else if (Platform == SP_METAL_MRT || Platform == SP_METAL_MRT_TVOS)
{
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportsMetalMRT"), bSupportsShaderPlatform, GEngineIni);
}
#endif
if (!bSupportsShaderPlatform && !WITH_EDITOR)
{
FFormatNamedArguments Args;
#Loc: <Workspace>/Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRHI.cpp:257
Scope: file
Source code excerpt:
bool bProjectSupportsMRTs = false;
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportsMetalMRT"), bProjectSupportsMRTs, GEngineIni);
bool const bRequestedMetalMRT = ((RequestedFeatureLevel >= ERHIFeatureLevel::SM5) || (!bRequestedFeatureLevel && FParse::Param(FCommandLine::Get(),TEXT("metalmrt"))));
// Only allow SM5 MRT on A9 or above devices
if (bProjectSupportsMRTs && bRequestedMetalMRT && !bIsA8FeatureSet)
{
#Loc: <Workspace>/Engine/Source/Runtime/Apple/MetalRHI/Private/MetalViewport.cpp:668
Scope (from outer to inner):
file
function void FMetalViewport::PresentImmersive
Source code excerpt:
static bool bCheckedConfig = false;
if (bCheckedConfig == false) {
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportsMetalMRT"), bUseRealDepth, GEngineIni);
bCheckedConfig = true;
}
TRefCountPtr<FMetalSurface> Texture = bUseRealDepth ? MyLastCompleteDepth : MyLastCompleteFrame;
//HACK END
check(IsValidRef(Texture));
#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Private/IOS/IOSView.cpp:124
Scope: file
Source code excerpt:
// make sure the project setting has enabled Metal support (per-project user settings in the editor)
bool bSupportsMetal = false;
bool bSupportsMetalMRT = false;
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportsMetal"), bSupportsMetal, GEngineIni);
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportsMetalMRT"), bSupportsMetalMRT, GEngineIni);
bool bTriedToInit = false;
// the check for the function pointer itself is to determine if the Metal framework exists, before calling it
if ((bSupportsMetal || bSupportsMetalMRT) && MTLCreateSystemDefaultDevice != NULL)
{
SCOPED_BOOT_TIMING("CreateMetalDevice");
// if the device is unable to run with Metal (pre-A7), this will return nullptr
GMetalDevice = (__bridge MTL::Device*)MTLCreateSystemDefaultDevice();
// just tracking for printout below
#Loc: <Workspace>/Engine/Source/Runtime/IOS/IOSRuntimeSettings/Classes/IOSRuntimeSettings.h:205
Scope (from outer to inner):
file
class class UIOSRuntimeSettings : public UObject
Source code excerpt:
// Whether or not to compile iOS Metal shaders for the desktop renderer (requires iOS 10+ and an A10 processor)
UPROPERTY(GlobalConfig, EditAnywhere, Category = Rendering, meta = (DisplayName = "Metal Desktop Renderer"))
bool bSupportsMetalMRT;
// Should the app be compatible for high refresh rate (iPhone only)
UPROPERTY(GlobalConfig, EditAnywhere, Category = Rendering, meta = (DisplayName = "Enable ProMotion 120Hz on supported iPhone devices"))
bool bSupportHighRefreshRates;
/** Whether to enable LOD streaming for landscape visual meshes. Requires Metal support. */
#Loc: <Workspace>/Engine/Source/Runtime/IOS/IOSRuntimeSettings/Private/IOSRuntimeSettings.cpp:58
Scope (from outer to inner):
file
function UIOSRuntimeSettings::UIOSRuntimeSettings
Source code excerpt:
bEnableBackgroundFetch = false;
bSupportsMetal = true;
bSupportsMetalMRT = false;
bSupportHighRefreshRates = false;
bDisableHTTPS = false;
bSupportsBackgroundAudio = false;
}
void UIOSRuntimeSettings::PostReloadConfig(class FProperty* PropertyThatWasLoaded)
#Loc: <Workspace>/Engine/Source/Runtime/IOS/IOSRuntimeSettings/Private/IOSRuntimeSettings.cpp:88
Scope (from outer to inner):
file
function void UIOSRuntimeSettings::PostEditChangeProperty
Source code excerpt:
// Ensure that at least one API is supported
if (!bSupportsMetal && !bSupportsMetalMRT)
{
bSupportsMetal = true;
UpdateSinglePropertyInConfigFile(GetClass()->FindPropertyByName(GET_MEMBER_NAME_CHECKED(UIOSRuntimeSettings, bSupportsMetal)), GetDefaultConfigFilename());
}
// If iOS Simulator setting changed, need to rerun GPF to force xcconfig files to updated the supported platforms
#Loc: <Workspace>/Engine/Source/Runtime/IOS/IOSRuntimeSettings/Private/IOSRuntimeSettings.cpp:173
Scope (from outer to inner):
file
function void UIOSRuntimeSettings::PostInitProperties
Source code excerpt:
UpdateSinglePropertyInConfigFile(GetClass()->FindPropertyByName(GET_MEMBER_NAME_CHECKED(UIOSRuntimeSettings, MinimumiOSVersion)), GetDefaultConfigFilename());
}
if (!bSupportsMetal && !bSupportsMetalMRT)
{
bSupportsMetal = true;
UpdateSinglePropertyInConfigFile(GetClass()->FindPropertyByName(GET_MEMBER_NAME_CHECKED(UIOSRuntimeSettings, bSupportsMetal)), GetDefaultConfigFilename());
}
}
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/Apple/Platform/IOS/IOSPlatformDynamicRHI.h:42
Scope (from outer to inner):
file
namespace UE
namespace FIOSPlatformDynamicRHI
function bool ShouldSupportMetalMRT
Source code excerpt:
FORCEINLINE bool ShouldSupportMetalMRT()
{
bool bSupportsMetalMRT = false;
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportsMetalMRT"), bSupportsMetalMRT, GEngineIni);
return (bSupportsMetalMRT || FParse::Param(FCommandLine::Get(), TEXT("metalmrt"))) && !ShouldPreferFeatureLevelES31();
}
void AddTargetedShaderFormats(TArray<FString>& TargetedShaderFormats)
{
if (ShouldSupportMetalMRT())
{
#Loc: <Workspace>/Engine/Source/Runtime/WebBrowser/Private/IOS/IOSPlatformWebBrowser.cpp:35
Scope (from outer to inner):
file
function void Construct
Source code excerpt:
void Construct(const FArguments& Args)
{
bool bSupportsMetalMRT = false;
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportsMetalMRT"), bSupportsMetalMRT, GEngineIni);
bool bSupportsMetal = false;
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportsMetal"), bSupportsMetal, GEngineIni);
// At this point we MUST be a Metal renderer.
check(bSupportsMetal);
WebViewWrapper = [IOSWebViewWrapper alloc];
[WebViewWrapper create : TSharedPtr<SIOSWebBrowserWidget>(this) useTransparency : Args._UseTransparency supportsMetal : bSupportsMetal supportsMetalMRT : bSupportsMetalMRT];
WebBrowserWindowPtr = Args._WebBrowserWindow;
IsIOS3DBrowser = false;
#if !PLATFORM_TVOS
TextureSamplePool = new FWebBrowserTextureSamplePool();
#Loc: <Workspace>/Engine/Source/Runtime/WebBrowser/Private/IOS/IOSPlatformWebBrowser.cpp:465
Scope: file
Source code excerpt:
bVideoTextureValid = false;
bSupportsMetal = InSupportsMetal;
bSupportsMetalMRT = InSupportsMetalMRT;
#if !PLATFORM_TVOS
dispatch_async(dispatch_get_main_queue(), ^
{
WebViewContainer = [[UIView alloc]initWithFrame:CGRectMake(1, 1, 100, 100)];
[self.WebViewContainer setOpaque : NO];
#Loc: <Workspace>/Engine/Source/Runtime/WebBrowser/Private/IOS/IOSPlatformWebBrowser.h:38
Scope: file
Source code excerpt:
bool bVideoTextureValid;
bool bSupportsMetal;
bool bSupportsMetalMRT;
}
#if !PLATFORM_TVOS
@property(strong) WKWebView* WebView;
@property(strong) UIView* WebViewContainer;
#endif
@property(copy) NSURL* NextURL;