2014-12-07 19:09:38 -05:00
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
2014-03-14 14:13:41 -04:00
/*=============================================================================
IOSTargetPlatform . cpp : Implements the FIOSTargetPlatform class .
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
# include "IOSTargetPlatformPrivatePCH.h"
2014-07-22 17:53:31 -04:00
# include "IProjectManager.h"
2014-03-14 14:13:41 -04:00
/* FIOSTargetPlatform structors
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
FIOSTargetPlatform : : FIOSTargetPlatform ( )
{
# if WITH_ENGINE
FConfigCacheIni : : LoadLocalIniFile ( EngineSettings , TEXT ( " Engine " ) , true , * PlatformName ( ) ) ;
2015-03-17 09:50:32 -04:00
TextureLODSettings = nullptr ; // TextureLODSettings are registered by the device profile.
2014-03-14 14:13:41 -04:00
StaticMeshLODSettings . Initialize ( EngineSettings ) ;
# endif // #if WITH_ENGINE
// Initialize Ticker for device discovery
TickDelegate = FTickerDelegate : : CreateRaw ( this , & FIOSTargetPlatform : : HandleTicker ) ;
2015-01-08 09:29:27 -05:00
TickDelegateHandle = FTicker : : GetCoreTicker ( ) . AddTicker ( TickDelegate , 10.0f ) ;
2014-07-30 15:36:36 -04:00
// initialize the connected device detector
DeviceHelper . OnDeviceConnected ( ) . AddRaw ( this , & FIOSTargetPlatform : : HandleDeviceConnected ) ;
DeviceHelper . OnDeviceDisconnected ( ) . AddRaw ( this , & FIOSTargetPlatform : : HandleDeviceDisconnected ) ;
DeviceHelper . Initialize ( ) ;
2014-03-14 14:13:41 -04:00
}
FIOSTargetPlatform : : ~ FIOSTargetPlatform ( )
{
2015-01-08 09:29:27 -05:00
FTicker : : GetCoreTicker ( ) . RemoveTicker ( TickDelegateHandle ) ;
2014-03-14 14:13:41 -04:00
}
/* ITargetPlatform interface
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2014-04-23 17:23:52 -04:00
void FIOSTargetPlatform : : EnableDeviceCheck ( bool OnOff )
{
FIOSDeviceHelper : : EnableDeviceCheck ( OnOff ) ;
}
2014-03-14 14:13:41 -04:00
void FIOSTargetPlatform : : GetAllDevices ( TArray < ITargetDevicePtr > & OutDevices ) const
{
OutDevices . Reset ( ) ;
for ( auto Iter = Devices . CreateConstIterator ( ) ; Iter ; + + Iter )
{
OutDevices . Add ( Iter . Value ( ) ) ;
}
}
ITargetDevicePtr FIOSTargetPlatform : : GetDefaultDevice ( ) const
{
if ( Devices . Num ( ) > 0 )
{
// first device is the default
auto Iter = Devices . CreateConstIterator ( ) ;
if ( Iter )
{
return Iter . Value ( ) ;
}
}
return NULL ;
}
ITargetDevicePtr FIOSTargetPlatform : : GetDevice ( const FTargetDeviceId & DeviceId )
{
return Devices . FindRef ( DeviceId ) ;
}
2014-09-18 08:10:29 -04:00
bool FIOSTargetPlatform : : IsSdkInstalled ( bool bProjectHasCode , FString & OutTutorialPath ) const
2014-04-02 18:09:23 -04:00
{
bool biOSSDKInstalled = true ; // @todo How do we check that the iOS SDK is installed when building from Windows? Is that even possible?
# if PLATFORM_MAC
2014-09-18 08:11:47 -04:00
OutTutorialPath = FString ( " Shared/Tutorials/InstallingXCodeTutorial " ) ;
2014-04-02 18:09:23 -04:00
biOSSDKInstalled = IFileManager : : Get ( ) . DirectoryExists ( TEXT ( " /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform " ) ) ;
2014-07-22 17:53:31 -04:00
# else
{
HKEY hKey ;
LRESULT lRes = RegOpenKeyEx ( HKEY_LOCAL_MACHINE , TEXT ( " SOFTWARE \\ Wow6432Node \\ Apple Inc. \\ Apple Mobile Device Support \\ Shared " ) , 0 , KEY_READ , & hKey ) ;
TCHAR dllPath [ 256 ] ;
unsigned long pathSize = 256 ;
if ( lRes ! = ERROR_SUCCESS | | RegQueryValueEx ( hKey , TEXT ( " iTunesMobileDeviceDLL " ) , 0 , NULL , ( BYTE * ) dllPath , & pathSize ) ! = ERROR_SUCCESS | | IFileManager : : Get ( ) . FileSize ( * FString ( dllPath ) ) = = INDEX_NONE )
{
2015-02-02 17:06:34 -05:00
if ( RegQueryValueEx ( hKey , TEXT ( " MobileDeviceDLL " ) , 0 , NULL , ( BYTE * ) dllPath , & pathSize ) ! = ERROR_SUCCESS | | IFileManager : : Get ( ) . FileSize ( * FString ( dllPath ) ) = = INDEX_NONE )
{
OutTutorialPath = FString ( " /Engine/Tutorial/Mobile/InstallingiTunesTutorial.InstallingiTunesTutorial " ) ;
biOSSDKInstalled = false ;
}
2014-07-22 17:53:31 -04:00
}
}
2014-04-02 18:09:23 -04:00
# endif
return biOSSDKInstalled ;
}
2014-08-22 17:36:22 -04:00
static FString OutputMessage ;
static void OnOutput ( FString Message )
{
OutputMessage + = Message ;
2014-09-30 13:53:36 -04:00
UE_LOG ( LogTemp , Display , TEXT ( " %s \n " ) , * Message ) ;
2014-08-22 17:36:22 -04:00
}
2014-10-10 20:54:09 -04:00
int32 FIOSTargetPlatform : : CheckRequirements ( const FString & ProjectPath , bool bProjectHasCode , FString & OutTutorialPath ) const
2014-07-22 17:53:31 -04:00
{
2014-10-10 20:49:06 -04:00
int32 bReadyToBuild = ETargetPlatformReadyStatus : : Ready ; // @todo How do we check that the iOS SDK is installed when building from Windows? Is that even possible?
2014-09-18 08:10:29 -04:00
if ( ! IsSdkInstalled ( bProjectHasCode , OutTutorialPath ) )
2014-07-22 17:53:31 -04:00
{
bReadyToBuild | = ETargetPlatformReadyStatus : : SDKNotFound ;
}
# if PLATFORM_MAC
2014-09-18 08:10:29 -04:00
OutTutorialPath = FString ( " /Engine/Tutorial/Installation/InstallingXCodeTutorial.InstallingXCodeTutorial " ) ;
2014-09-30 13:53:36 -04:00
// shell to certtool
2014-07-22 17:53:31 -04:00
# else
if ( bProjectHasCode & & FRocketSupport : : IsRocket ( ) )
{
2014-09-18 08:10:29 -04:00
OutTutorialPath = FString ( " /Engine/Tutorial/Mobile/iOSonPCRestrictions.iOSonPCRestrictions " ) ;
2014-07-22 17:53:31 -04:00
bReadyToBuild | = ETargetPlatformReadyStatus : : CodeUnsupported ;
}
if ( FRocketSupport : : IsRocket ( ) & & IProjectManager : : Get ( ) . IsNonDefaultPluginEnabled ( ) )
{
2014-09-18 08:10:29 -04:00
OutTutorialPath = FString ( " /Engine/Tutorial/Mobile/iOSonPCValidPlugins.iOSonPCValidPlugins " ) ;
2014-07-22 17:53:31 -04:00
bReadyToBuild | = ETargetPlatformReadyStatus : : PluginsUnsupported ;
}
2014-09-30 13:53:36 -04:00
# endif
2014-07-22 17:53:31 -04:00
// shell to IPP and get the status of the provision and cert
2015-03-02 15:51:39 -05:00
FString BundleIdentifier ;
GConfig - > GetString ( TEXT ( " /Script/IOSRuntimeSettings.IOSRuntimeSettings " ) , TEXT ( " BundleIdentifier " ) , BundleIdentifier , GEngineIni ) ;
BundleIdentifier = BundleIdentifier . Replace ( TEXT ( " [PROJECT_NAME] " ) , FApp : : GetGameName ( ) ) ;
2014-09-30 13:53:36 -04:00
# if PLATFORM_MAC
FString CmdExe = TEXT ( " /bin/sh " ) ;
FString ScriptPath = FPaths : : ConvertRelativePathToFull ( FPaths : : EngineDir ( ) / TEXT ( " Build/BatchFiles/Mac/RunMono.sh " ) ) ;
FString IPPPath = FPaths : : ConvertRelativePathToFull ( FPaths : : EngineDir ( ) / TEXT ( " Binaries/DotNet/IOS/IPhonePackager.exe " ) ) ;
2015-03-02 15:51:39 -05:00
FString CommandLine = FString : : Printf ( TEXT ( " \" %s \" \" %s \" Validate Engine -project \" %s \" -bundlename \" %s \" " ) , * ScriptPath , * IPPPath , * ProjectPath , * ( BundleIdentifier ) ) ;
2014-09-30 13:53:36 -04:00
# else
2014-07-22 17:53:31 -04:00
FString CmdExe = FPaths : : ConvertRelativePathToFull ( FPaths : : EngineDir ( ) / TEXT ( " Binaries/DotNet/IOS/IPhonePackager.exe " ) ) ;
2015-03-02 15:51:39 -05:00
FString CommandLine = FString : : Printf ( TEXT ( " Validate Engine -project \" %s \" -bundlename \" %s \" " ) , * ProjectPath , * ( BundleIdentifier ) ) ;
2014-09-30 13:53:36 -04:00
# endif
2014-07-31 13:31:22 -04:00
TSharedPtr < FMonitoredProcess > IPPProcess = MakeShareable ( new FMonitoredProcess ( CmdExe , CommandLine , true ) ) ;
2014-08-22 17:36:22 -04:00
OutputMessage = TEXT ( " " ) ;
IPPProcess - > OnOutput ( ) . BindStatic ( & OnOutput ) ;
2014-07-22 17:53:31 -04:00
IPPProcess - > Launch ( ) ;
while ( IPPProcess - > IsRunning ( ) )
{
FPlatformProcess : : Sleep ( 0.01f ) ;
}
int RetCode = IPPProcess - > GetReturnCode ( ) ;
2014-09-30 13:53:36 -04:00
UE_LOG ( LogTemp , Display , TEXT ( " %s " ) , * OutputMessage ) ;
2014-07-22 17:53:31 -04:00
if ( RetCode = = 14 )
{
2014-09-18 08:10:29 -04:00
OutTutorialPath = FString ( " /Engine/Tutorial/Mobile/CreatingInfoPlist.CreatingInfoPlist " ) ;
2014-07-22 17:53:31 -04:00
bReadyToBuild | = ETargetPlatformReadyStatus : : ManifestNotFound ;
}
else if ( RetCode = = 13 )
{
2014-09-18 08:10:29 -04:00
OutTutorialPath = FString ( " /Engine/Tutorial/Mobile/CreatingSigningCertAndProvisionTutorial.CreatingSigningCertAndProvisionTutorial " ) ;
2014-07-22 17:53:31 -04:00
bReadyToBuild | = ETargetPlatformReadyStatus : : SigningKeyNotFound ;
bReadyToBuild | = ETargetPlatformReadyStatus : : ProvisionNotFound ;
}
else if ( RetCode = = 12 )
{
2014-09-18 08:10:29 -04:00
OutTutorialPath = FString ( " /Engine/Tutorial/Mobile/CreatingSigningCertAndProvisionTutorial.CreatingSigningCertAndProvisionTutorial " ) ;
2014-07-22 17:53:31 -04:00
bReadyToBuild | = ETargetPlatformReadyStatus : : SigningKeyNotFound ;
}
else if ( RetCode = = 11 )
{
2014-09-18 08:10:29 -04:00
OutTutorialPath = FString ( " /Engine/Tutorial/Mobile/CreatingSigningCertAndProvisionTutorial.CreatingSigningCertAndProvisionTutorial " ) ;
2014-07-22 17:53:31 -04:00
bReadyToBuild | = ETargetPlatformReadyStatus : : ProvisionNotFound ;
}
2014-09-30 13:53:36 -04:00
2014-07-22 17:53:31 -04:00
return bReadyToBuild ;
}
2014-03-14 14:13:41 -04:00
/* FIOSTargetPlatform implementation
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void FIOSTargetPlatform : : PingNetworkDevices ( )
{
2015-03-16 10:05:21 -04:00
// disabled for now because we find IOS devices from the USB, this is a relic from ULD, but it may be needed in the future
/* if (!MessageEndpoint.IsValid())
2014-03-14 14:13:41 -04:00
{
MessageEndpoint = FMessageEndpoint : : Builder ( " FIOSTargetPlatform " )
. Handling < FIOSLaunchDaemonPong > ( this , & FIOSTargetPlatform : : HandlePongMessage ) ;
}
if ( MessageEndpoint . IsValid ( ) )
{
MessageEndpoint - > Publish ( new FIOSLaunchDaemonPing ( ) , EMessageScope : : Network ) ;
}
// remove disconnected & timed out devices
FDateTime Now = FDateTime : : UtcNow ( ) ;
for ( auto DeviceIt = Devices . CreateIterator ( ) ; DeviceIt ; + + DeviceIt )
{
FIOSTargetDevicePtr Device = DeviceIt - > Value ;
if ( Now > Device - > LastPinged + FTimespan : : FromSeconds ( 60.0 ) )
{
DeviceIt . RemoveCurrent ( ) ;
DeviceLostEvent . Broadcast ( Device . ToSharedRef ( ) ) ;
}
2015-03-16 10:05:21 -04:00
} */
2014-03-14 14:13:41 -04:00
}
/* FIOSTargetPlatform callbacks
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void FIOSTargetPlatform : : HandlePongMessage ( const FIOSLaunchDaemonPong & Message , const IMessageContextRef & Context )
{
FTargetDeviceId DeviceId ;
FTargetDeviceId : : Parse ( Message . DeviceID , DeviceId ) ;
FIOSTargetDevicePtr & Device = Devices . FindOrAdd ( DeviceId ) ;
if ( ! Device . IsValid ( ) )
{
Device = MakeShareable ( new FIOSTargetDevice ( * this ) ) ;
Device - > SetFeature ( ETargetDeviceFeatures : : Reboot , Message . bCanReboot ) ;
Device - > SetFeature ( ETargetDeviceFeatures : : PowerOn , Message . bCanPowerOn ) ;
Device - > SetFeature ( ETargetDeviceFeatures : : PowerOff , Message . bCanPowerOff ) ;
Device - > SetDeviceId ( DeviceId ) ;
Device - > SetDeviceName ( Message . DeviceName ) ;
Device - > SetDeviceType ( Message . DeviceType ) ;
Device - > SetDeviceEndpoint ( Context - > GetSender ( ) ) ;
Device - > SetIsSimulated ( Message . DeviceID . Contains ( TEXT ( " Simulator " ) ) ) ;
DeviceDiscoveredEvent . Broadcast ( Device . ToSharedRef ( ) ) ;
}
Device - > LastPinged = FDateTime : : UtcNow ( ) ;
}
void FIOSTargetPlatform : : HandleDeviceConnected ( const FIOSLaunchDaemonPong & Message )
{
FTargetDeviceId DeviceId ;
FTargetDeviceId : : Parse ( Message . DeviceID , DeviceId ) ;
2014-07-30 15:36:36 -04:00
2014-03-14 14:13:41 -04:00
FIOSTargetDevicePtr & Device = Devices . FindOrAdd ( DeviceId ) ;
2014-07-30 15:36:36 -04:00
2014-03-14 14:13:41 -04:00
if ( ! Device . IsValid ( ) )
{
Device = MakeShareable ( new FIOSTargetDevice ( * this ) ) ;
2014-07-30 15:36:36 -04:00
2014-03-14 14:13:41 -04:00
Device - > SetFeature ( ETargetDeviceFeatures : : Reboot , Message . bCanReboot ) ;
Device - > SetFeature ( ETargetDeviceFeatures : : PowerOn , Message . bCanPowerOn ) ;
Device - > SetFeature ( ETargetDeviceFeatures : : PowerOff , Message . bCanPowerOff ) ;
Device - > SetDeviceId ( DeviceId ) ;
Device - > SetDeviceName ( Message . DeviceName ) ;
Device - > SetDeviceType ( Message . DeviceType ) ;
Device - > SetIsSimulated ( Message . DeviceID . Contains ( TEXT ( " Simulator " ) ) ) ;
2014-07-30 15:36:36 -04:00
2014-03-14 14:13:41 -04:00
DeviceDiscoveredEvent . Broadcast ( Device . ToSharedRef ( ) ) ;
}
2014-07-30 15:36:36 -04:00
2014-03-14 14:13:41 -04:00
// Add a very long time period to prevent the devices from getting disconnected due to a lack of pong messages
Device - > LastPinged = FDateTime : : UtcNow ( ) + FTimespan ( 100 , 0 , 0 , 0 , 0 ) ;
}
void FIOSTargetPlatform : : HandleDeviceDisconnected ( const FIOSLaunchDaemonPong & Message )
{
FTargetDeviceId DeviceId ;
FTargetDeviceId : : Parse ( Message . DeviceID , DeviceId ) ;
2014-07-30 15:36:36 -04:00
2014-03-14 14:13:41 -04:00
FIOSTargetDevicePtr & Device = Devices . FindOrAdd ( DeviceId ) ;
2014-07-30 15:36:36 -04:00
2014-03-14 14:13:41 -04:00
if ( Device . IsValid ( ) )
{
2014-07-30 15:36:36 -04:00
DeviceLostEvent . Broadcast ( Device . ToSharedRef ( ) ) ;
Devices . Remove ( DeviceId ) ;
2014-03-14 14:13:41 -04:00
}
}
bool FIOSTargetPlatform : : HandleTicker ( float DeltaTime )
{
PingNetworkDevices ( ) ;
return true ;
}
/* ITargetPlatform interface
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2014-11-24 17:39:14 -05:00
static bool SupportsES2 ( )
{
// default to supporting ES2
bool bSupportsOpenGLES2 = true ;
GConfig - > GetBool ( TEXT ( " /Script/IOSRuntimeSettings.IOSRuntimeSettings " ) , TEXT ( " bSupportsOpenGLES2 " ) , bSupportsOpenGLES2 , GEngineIni ) ;
return bSupportsOpenGLES2 ;
}
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 ;
}
2014-12-04 10:35:50 -05:00
static bool CookPVRTC ( )
{
// default to using PVRTC
bool bCookPVRTCTextures = true ;
GConfig - > GetBool ( TEXT ( " /Script/IOSRuntimeSettings.IOSRuntimeSettings " ) , TEXT ( " bCookPVRTCTextures " ) , bCookPVRTCTextures , GEngineIni ) ;
return bCookPVRTCTextures ;
}
static bool CookASTC ( )
{
// default to not using ASTC
bool bCookASTCTextures = true ;
GConfig - > GetBool ( TEXT ( " /Script/IOSRuntimeSettings.IOSRuntimeSettings " ) , TEXT ( " bCookASTCTextures " ) , bCookASTCTextures , GEngineIni ) ;
return bCookASTCTextures ;
}
2015-03-13 18:16:26 -04:00
bool FIOSTargetPlatform : : SupportsFeature ( ETargetPlatformFeatures Feature ) const
{
switch ( Feature )
{
case ETargetPlatformFeatures : : Packaging :
return true ;
case ETargetPlatformFeatures : : LowQualityLightmaps :
return SupportsES2 ( ) | | SupportsMetal ( ) ;
case ETargetPlatformFeatures : : HighQualityLightmaps :
return SupportsMetalMRT ( ) ;
default :
break ;
}
return TTargetPlatformBase < FIOSPlatformProperties > : : SupportsFeature ( Feature ) ;
}
# if WITH_ENGINE
2014-12-04 10:35:50 -05:00
2014-05-09 08:51:44 -04:00
void FIOSTargetPlatform : : GetAllPossibleShaderFormats ( TArray < FName > & OutFormats ) const
2014-03-14 14:13:41 -04:00
{
static FName NAME_OPENGL_ES2_IOS ( TEXT ( " GLSL_ES2_IOS " ) ) ;
2014-06-17 18:27:26 -04:00
static FName NAME_SF_METAL ( TEXT ( " SF_METAL " ) ) ;
2014-10-09 11:27:07 -04:00
static FName NAME_SF_METAL_MRT ( TEXT ( " SF_METAL_MRT " ) ) ;
2014-06-24 18:38:35 -04:00
2014-11-24 17:39:14 -05:00
if ( SupportsES2 ( ) )
2014-07-08 10:53:56 -04:00
{
OutFormats . AddUnique ( NAME_OPENGL_ES2_IOS ) ;
}
2014-11-24 17:39:14 -05:00
if ( SupportsMetal ( ) )
2014-06-24 18:38:35 -04:00
{
OutFormats . AddUnique ( NAME_SF_METAL ) ;
2014-11-24 17:39:14 -05:00
}
if ( SupportsMetalMRT ( ) )
{
OutFormats . AddUnique ( NAME_SF_METAL_MRT ) ;
2014-06-24 18:38:35 -04:00
}
2014-03-14 14:13:41 -04:00
}
2014-05-09 08:51:44 -04:00
void FIOSTargetPlatform : : GetAllTargetedShaderFormats ( TArray < FName > & OutFormats ) const
{
GetAllPossibleShaderFormats ( OutFormats ) ;
}
2014-03-14 14:13:41 -04:00
void FIOSTargetPlatform : : GetTextureFormats ( const UTexture * Texture , TArray < FName > & OutFormats ) const
{
check ( Texture ) ;
2014-12-04 10:35:50 -05:00
// we remap some of the defaults (with PVRTC and ASTC formats)
static FName FormatRemap [ ] =
2014-11-24 17:39:14 -05:00
{
2014-12-04 10:35:50 -05:00
// original PVRTC ASTC
FName ( TEXT ( " DXT1 " ) ) , FName ( TEXT ( " PVRTC2 " ) ) , FName ( TEXT ( " ASTC_RGB " ) ) ,
FName ( TEXT ( " DXT5 " ) ) , FName ( TEXT ( " PVRTC4 " ) ) , FName ( TEXT ( " ASTC_RGBA " ) ) ,
FName ( TEXT ( " DXT5n " ) ) , FName ( TEXT ( " PVRTCN " ) ) , FName ( TEXT ( " ASTC_NormalAG " ) ) ,
FName ( TEXT ( " BC5 " ) ) , FName ( TEXT ( " PVRTCN " ) ) , FName ( TEXT ( " ASTC_NormalRG " ) ) ,
FName ( TEXT ( " AutoDXT " ) ) , FName ( TEXT ( " AutoPVRTC " ) ) , FName ( TEXT ( " ASTC_RGBAuto " ) ) ,
2014-11-24 17:39:14 -05:00
} ;
2014-03-14 14:13:41 -04:00
FName TextureFormatName = NAME_None ;
2014-11-24 17:39:14 -05:00
// forward rendering only needs one channel for shadow maps
if ( Texture - > LODGroup = = TEXTUREGROUP_Shadowmap & & ! SupportsMetalMRT ( ) )
2014-03-14 14:13:41 -04:00
{
2014-11-24 17:39:14 -05:00
TextureFormatName = FName ( TEXT ( " G8 " ) ) ;
}
// if we didn't assign anything specially, then use the defaults
if ( TextureFormatName = = NAME_None )
{
2015-02-17 09:57:44 -05:00
TextureFormatName = GetDefaultTextureFormatName ( Texture , EngineSettings , false ) ;
2014-11-24 17:39:14 -05:00
}
// perform any remapping away from defaults
2014-12-04 10:35:50 -05:00
bool bFoundRemap = false ;
bool bIncludePVRTC = CookPVRTC ( ) ;
bool bIncludeASTC = CookASTC ( ) ;
for ( int32 RemapIndex = 0 ; RemapIndex < ARRAY_COUNT ( FormatRemap ) ; RemapIndex + = 3 )
2014-11-24 17:39:14 -05:00
{
if ( TextureFormatName = = FormatRemap [ RemapIndex ] )
2014-03-14 14:13:41 -04:00
{
2014-12-04 10:35:50 -05:00
// we found a remapping
bFoundRemap = true ;
// include the formats we want (use ASTC first so that it is preferred at runtime if they both exist and it's supported)
if ( bIncludeASTC )
{
OutFormats . AddUnique ( FormatRemap [ RemapIndex + 2 ] ) ;
}
if ( bIncludePVRTC )
{
OutFormats . AddUnique ( FormatRemap [ RemapIndex + 1 ] ) ;
}
2014-03-14 14:13:41 -04:00
}
}
2014-12-04 10:35:50 -05:00
// if we didn't already remap above, add it now
if ( ! bFoundRemap )
{
OutFormats . Add ( TextureFormatName ) ;
}
2014-03-14 14:13:41 -04:00
}
2015-03-17 09:50:32 -04:00
const UTextureLODSettings & FIOSTargetPlatform : : GetTextureLODSettings ( ) const
2014-03-14 14:13:41 -04:00
{
2015-03-17 09:50:32 -04:00
return * TextureLODSettings ;
2014-03-14 14:13:41 -04:00
}
2014-10-03 14:56:20 -04:00
FName FIOSTargetPlatform : : GetWaveFormat ( const class USoundWave * Wave ) const
2014-03-14 14:13:41 -04:00
{
static FName NAME_ADPCM ( TEXT ( " ADPCM " ) ) ;
return NAME_ADPCM ;
}
# endif // WITH_ENGINE
2015-03-13 15:49:11 -04:00