// Copyright Epic Games, Inc. All Rights Reserved. /*============================================================================= GenericMacTargetPlatform.h: Declares the TGenericMacTargetPlatformSettings class template. =============================================================================*/ #pragma once #include "CoreMinimal.h" #include "Common/TargetPlatformSettingsBase.h" #include "Mac/MacPlatformProperties.h" #if WITH_ENGINE #include "TextureResource.h" #include "StaticMeshResources.h" #endif // WITH_ENGINE #define LOCTEXT_NAMESPACE "TGenericMacTargetPlatformSettings" /** * Template for Mac target platforms settings */ template class TGenericMacTargetPlatformSettings : public TTargetPlatformSettingsBase > { public: typedef FMacPlatformProperties TProperties; typedef TTargetPlatformSettingsBase TSuper; /** * Default constructor. */ TGenericMacTargetPlatformSettings( ) { #if WITH_ENGINE TextureLODSettings = nullptr; StaticMeshLODSettings.Initialize(this); #endif } public: //~ Begin ITargetPlatform Interface virtual bool SupportsFeature( ETargetPlatformFeatures Feature ) const override { // we currently do not have a build target for MacServer if (Feature == ETargetPlatformFeatures::Packaging) { return (HAS_EDITOR_DATA || !IS_DEDICATED_SERVER); } if (Feature == ETargetPlatformFeatures::CanCookPackages) { return HAS_EDITOR_DATA; } return TSuper::SupportsFeature(Feature); } virtual void GetAllPossibleShaderFormats( TArray& OutFormats ) const override { // no shaders needed for dedicated server target if (!IS_DEDICATED_SERVER) { static FName NAME_SF_METAL_SM5(TEXT("SF_METAL_SM5")); OutFormats.AddUnique(NAME_SF_METAL_SM5); static FName NAME_SF_METAL_SM6(TEXT("SF_METAL_SM6")); OutFormats.AddUnique(NAME_SF_METAL_SM6); static FName NAME_SF_METAL_ES3_1(TEXT("SF_METAL_ES3_1")); OutFormats.AddUnique(NAME_SF_METAL_ES3_1); } } virtual void GetAllTargetedShaderFormats(TArray& OutFormats) const override { // Get the Target RHIs for this platform, we do not always want all those that are supported. TArrayTargetedShaderFormats; GConfig->GetArray(TEXT("/Script/MacTargetPlatform.MacTargetSettings"), TEXT("TargetedRHIs"), TargetedShaderFormats, GEngineIni); // Gather the list of Target RHIs and filter out any that may be invalid. TArray PossibleShaderFormats; GetAllPossibleShaderFormats(PossibleShaderFormats); for (int32 ShaderFormatIdx = TargetedShaderFormats.Num() - 1; ShaderFormatIdx >= 0; ShaderFormatIdx--) { FString ShaderFormat = TargetedShaderFormats[ShaderFormatIdx]; if (PossibleShaderFormats.Contains(FName(*ShaderFormat)) == false) { TargetedShaderFormats.RemoveAt(ShaderFormatIdx); } } for(const FString& ShaderFormat : TargetedShaderFormats) { OutFormats.AddUnique(FName(*ShaderFormat)); } } #if WITH_ENGINE virtual const class FStaticMeshLODSettings& GetStaticMeshLODSettings( ) const override { return StaticMeshLODSettings; } virtual const UTextureLODSettings& GetTextureLODSettings() const override { return *TextureLODSettings; } virtual void RegisterTextureLODSettings(const UTextureLODSettings* InTextureLODSettings) override { TextureLODSettings = InTextureLODSettings; } #endif //WITH_ENGINE static FORCEINLINE bool SupportsRayTracing() { return true; } virtual bool UsesRayTracing() const override { bool bEnableRayTracing = false; GConfig->GetBool(TEXT("/Script/MacTargetPlatform.MacTargetSettings"), TEXT("bEnableRayTracing"), bEnableRayTracing, GEngineIni); return bEnableRayTracing; } //~ End ITargetPlatform Interface private: #if WITH_ENGINE // Holds the texture LOD settings. const UTextureLODSettings* TextureLODSettings; // Holds the static mesh LOD settings. FStaticMeshLODSettings StaticMeshLODSettings; #endif // WITH_ENGINE }; #undef LOCTEXT_NAMESPACE