Files
matt begoghina f7700fa398 Return Android devices with Turnkey, and Editor Platforms menu update
The goal of this update is to have valid Android devices not showing with a Warning in the Platforms menu.

To allow this, the AndroidPlatformSDK now return the list of connected devices and their SDK Versions.
The change in TurnkeySupportModule ensures we are stripping the cook flavor from the DeviceId which would fail to verify the SDK.

Regarding the Editor `Platforms` menu, the code was adjusted to have devices listed outside of a submenu when `Platform->SupportsFeature(ETargetPlatformFeatures::ShowAsPlatformGroup)` returns false.
Another addition was a new `ETargetPlatformFeatures::ShowAggregateDevice` to allow platforms to not list the aggregate device (ex: `All_Android_on...`)

#review-36072549
#jira UE-223262
#rb adam.kinge, Chris.Babcock, Josh.Adams

[CL 37262963 by matt begoghina in 5.5 branch]
2024-10-18 09:28:09 -04:00

181 lines
5.8 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
/*=============================================================================
IOSTargetPlatformSettings.cpp: Implements the FIOSTargetPlatformSettings class.
=============================================================================*/
#include "IOSTargetPlatformSettings.h"
#include "HAL/FileManager.h"
#include "HAL/IConsoleManager.h"
#include "Misc/Paths.h"
#include "Misc/App.h"
#if WITH_ENGINE
#include "Engine/Texture.h"
#include "TextureResource.h"
#endif
/* FIOSTargetPlatformSettings structors
*****************************************************************************/
FIOSTargetPlatformSettings::FIOSTargetPlatformSettings(bool bInIsTVOS, bool bInIsVisionOS)
// override the ini name up in the base classes, which will go into the FTargetPlatformInfo
: TTargetPlatformSettingsBase(nullptr, bInIsVisionOS ? TEXT("VisionOS") : nullptr)
, bIsTVOS(bInIsTVOS)
, bIsVisionOS(bInIsVisionOS)
, MobileShadingPath(0)
, bDistanceField(false)
, bMobileForwardEnableClusteredReflections(false)
, bMobileVirtualTextures(false)
{
#if WITH_ENGINE
TextureLODSettings = nullptr; // TextureLODSettings are registered by the device profile.
StaticMeshLODSettings.Initialize(this);
GetConfigSystem()->GetBool(TEXT("/Script/Engine.RendererSettings"), TEXT("r.DistanceFields"), bDistanceField, GEngineIni);
GetConfigSystem()->GetInt(TEXT("/Script/Engine.RendererSettings"), TEXT("r.Mobile.ShadingPath"), MobileShadingPath, GEngineIni);
GetConfigSystem()->GetBool(TEXT("/Script/Engine.RendererSettings"), TEXT("r.Mobile.Forward.EnableClusteredReflections"), bMobileForwardEnableClusteredReflections, GEngineIni);
GetConfigSystem()->GetBool(TEXT("/Script/Engine.RendererSettings"), TEXT("r.Mobile.VirtualTextures"), bMobileVirtualTextures, GEngineIni);
#endif // #if WITH_ENGINE
}
FIOSTargetPlatformSettings::~FIOSTargetPlatformSettings()
{
}
/* ITargetPlatform interface
*****************************************************************************/
static bool SupportsMetal()
{
// default to NOT supporting metal
bool bSupportsMetal = false;
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportsMetal"), bSupportsMetal, GEngineIni);
return bSupportsMetal;
}
static bool SupportsMetalMRT()
{
// 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;
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportAppleA8"), bSupportAppleA8, GEngineIni);
return bSupportAppleA8;
}
bool FIOSTargetPlatformSettings::SupportsFeature( ETargetPlatformFeatures Feature ) const
{
switch (Feature)
{
case ETargetPlatformFeatures::Packaging:
case ETargetPlatformFeatures::DeviceOutputLog:
return true;
case ETargetPlatformFeatures::MobileRendering:
case ETargetPlatformFeatures::LowQualityLightmaps:
return SupportsMetal();
case ETargetPlatformFeatures::DeferredRendering:
case ETargetPlatformFeatures::HighQualityLightmaps:
return SupportsMetalMRT();
case ETargetPlatformFeatures::VirtualTextureStreaming:
// TODO: should it check r.VirtualTextures for SM5 renderer?
return bMobileVirtualTextures;
case ETargetPlatformFeatures::DistanceFieldAO:
return UsesDistanceFields();
case ETargetPlatformFeatures::NormalmapLAEncodingMode:
{
static IConsoleVariable* CompressorCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("cook.ASTCTextureCompressor"));
const bool bUsesARMCompressor = (CompressorCVar ? (CompressorCVar->GetInt() != 0) : false);
return bUsesARMCompressor;
}
case ETargetPlatformFeatures::SupportsMultipleConnectionTypes:
return true;
default:
break;
}
return TTargetPlatformSettingsBase<FIOSPlatformProperties>::SupportsFeature(Feature);
}
void FIOSTargetPlatformSettings::GetAllPossibleShaderFormats( TArray<FName>& OutFormats ) const
{
static FName NAME_SF_METAL(TEXT("SF_METAL"));
static FName NAME_SF_METAL_SIM(TEXT("SF_METAL_SIM"));
static FName NAME_SF_METAL_MRT(TEXT("SF_METAL_MRT"));
static FName NAME_SF_METAL_TVOS(TEXT("SF_METAL_TVOS"));
static FName NAME_SF_METAL_MRT_TVOS(TEXT("SF_METAL_MRT_TVOS"));
if (bIsTVOS)
{
if (SupportsMetalMRT())
{
OutFormats.AddUnique(NAME_SF_METAL_MRT_TVOS);
}
// because we are currently using IOS settings, we will always use metal, even if Metal isn't listed as being supported
// however, if MetalMRT is specific and Metal is set to false, then we will just use MetalMRT
if (SupportsMetal() || !SupportsMetalMRT())
{
OutFormats.AddUnique(NAME_SF_METAL_TVOS);
}
}
else
{
if (SupportsMetal())
{
OutFormats.AddUnique(NAME_SF_METAL);
bool bEnableSimulatorSupport = false;
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bEnableSimulatorSupport"), bEnableSimulatorSupport, GEngineIni);
if (bEnableSimulatorSupport)
{
OutFormats.AddUnique(NAME_SF_METAL_SIM);
}
}
if (SupportsMetalMRT())
{
OutFormats.AddUnique(NAME_SF_METAL_MRT);
}
}
}
void FIOSTargetPlatformSettings::GetAllTargetedShaderFormats( TArray<FName>& OutFormats ) const
{
GetAllPossibleShaderFormats(OutFormats);
}
#if WITH_ENGINE
void FIOSTargetPlatformSettings::GetReflectionCaptureFormats( TArray<FName>& OutFormats ) const
{
const bool bMobileDeferredShading = (MobileShadingPath == 1);
if (SupportsMetalMRT() || bMobileDeferredShading || bMobileForwardEnableClusteredReflections)
{
OutFormats.Add(FName(TEXT("FullHDR")));
}
OutFormats.Add(FName(TEXT("EncodedHDR")));
}
const UTextureLODSettings& FIOSTargetPlatformSettings::GetTextureLODSettings() const
{
return *TextureLODSettings;
}
#endif // WITH_ENGINE