166 lines
4.7 KiB
C++
166 lines
4.7 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
/*=============================================================================
|
|
LinuxTargetPlatform.h: Declares the TLinuxTargetPlatformSettings class.
|
|
=============================================================================*/
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Common/TargetPlatformSettingsBase.h"
|
|
#if WITH_ENGINE
|
|
#include "StaticMeshResources.h"
|
|
#endif // WITH_ENGINE
|
|
#include "Linux/LinuxPlatformProperties.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "TLinuxTargetPlatformSettings"
|
|
|
|
class UTextureLODSettings;
|
|
|
|
/**
|
|
* Template for Linux target platforms settings
|
|
*/
|
|
template<typename TProperties>
|
|
class TLinuxTargetPlatformSettings
|
|
: public TTargetPlatformSettingsBase<TProperties>
|
|
{
|
|
public:
|
|
|
|
typedef TTargetPlatformSettingsBase<TProperties> TSuper;
|
|
|
|
/**
|
|
* Default constructor.
|
|
*/
|
|
TLinuxTargetPlatformSettings( )
|
|
|
|
{
|
|
#if WITH_ENGINE
|
|
TextureLODSettings = nullptr;
|
|
StaticMeshLODSettings.Initialize(this);
|
|
|
|
// Get the Target RHIs for this platform, we do not always want all those that are supported.
|
|
TArray<FName> TargetedShaderFormats;
|
|
TLinuxTargetPlatformSettings::GetAllTargetedShaderFormats(TargetedShaderFormats);
|
|
|
|
// If we are targeting ES 2.0/3.1, we also must cook encoded HDR reflection captures
|
|
static FName NAME_SF_VULKAN_ES31(TEXT("SF_VULKAN_ES31"));
|
|
static FName NAME_OPENGL_150_ES3_1(TEXT("GLSL_150_ES31"));
|
|
bRequiresEncodedHDRReflectionCaptures = TargetedShaderFormats.Contains(NAME_SF_VULKAN_ES31)
|
|
|| TargetedShaderFormats.Contains(NAME_OPENGL_150_ES3_1);
|
|
#endif // WITH_ENGINE
|
|
}
|
|
|
|
|
|
public:
|
|
|
|
//~ Begin ITargetPlatform Interface
|
|
|
|
virtual bool SupportsFeature(ETargetPlatformFeatures Feature) const override
|
|
{
|
|
if (Feature == ETargetPlatformFeatures::UserCredentials || Feature == ETargetPlatformFeatures::Packaging)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
if (Feature == ETargetPlatformFeatures::CanCookPackages)
|
|
{
|
|
return TProperties::HasEditorOnlyData();
|
|
}
|
|
|
|
return TSuper::SupportsFeature(Feature);
|
|
}
|
|
|
|
virtual void GetAllPossibleShaderFormats( TArray<FName>& OutFormats ) const override
|
|
{
|
|
if (!TProperties::IsServerOnly())
|
|
{
|
|
static FName NAME_VULKAN_SM5(TEXT("SF_VULKAN_SM5"));
|
|
static FName NAME_VULKAN_SM6(TEXT("SF_VULKAN_SM6"));
|
|
static FName NAME_VULKAN_ES31(TEXT("SF_VULKAN_ES31"));
|
|
|
|
OutFormats.AddUnique(NAME_VULKAN_SM5);
|
|
OutFormats.AddUnique(NAME_VULKAN_SM6);
|
|
OutFormats.AddUnique(NAME_VULKAN_ES31);
|
|
}
|
|
}
|
|
|
|
virtual void GetAllTargetedShaderFormats( TArray<FName>& OutFormats ) const override
|
|
{
|
|
// Get the Target RHIs for this platform, we do not always want all those that are supported. (reload in case user changed in the editor)
|
|
TArray<FString>TargetedShaderFormats;
|
|
GConfig->GetArray(TEXT("/Script/LinuxTargetPlatform.LinuxTargetSettings"), TEXT("TargetedRHIs"), TargetedShaderFormats, GEngineIni);
|
|
|
|
// Gather the list of Target RHIs and filter out any that may be invalid.
|
|
TArray<FName> 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 void GetReflectionCaptureFormats(TArray<FName>& OutFormats) const override
|
|
{
|
|
if (bRequiresEncodedHDRReflectionCaptures)
|
|
{
|
|
OutFormats.Add(FName(TEXT("EncodedHDR")));
|
|
}
|
|
|
|
OutFormats.Add(FName(TEXT("FullHDR")));
|
|
}
|
|
|
|
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
|
|
|
|
virtual bool ShouldStripNaniteFallbackMeshes() const override
|
|
{
|
|
bool bGenerateNaniteFallbackMeshes = true;
|
|
GConfig->GetBool(TEXT("/Script/LinuxTargetPlatform.LinuxTargetSettings"), TEXT("bGenerateNaniteFallbackMeshes"), bGenerateNaniteFallbackMeshes, GEngineIni);
|
|
|
|
return !bGenerateNaniteFallbackMeshes;
|
|
}
|
|
|
|
//~ End ITargetPlatform Interface
|
|
|
|
protected:
|
|
|
|
|
|
#if WITH_ENGINE
|
|
// Holds the texture LOD settings.
|
|
const UTextureLODSettings* TextureLODSettings;
|
|
|
|
// Holds static mesh LOD settings.
|
|
FStaticMeshLODSettings StaticMeshLODSettings;
|
|
|
|
// True if the project requires encoded HDR reflection captures
|
|
bool bRequiresEncodedHDRReflectionCaptures;
|
|
#endif // WITH_ENGINE
|
|
};
|
|
|
|
#undef LOCTEXT_NAMESPACE
|