Files
UnrealEngineUWP/Engine/Source/Developer/TargetPlatform/Public/Common/TargetPlatformBase.h
mickael gilabert d8e082633e Added Distance field shadow / AO support on Switch
Don't compile distance field shader permutations if bUseDistanceFields is unset or false
Added UAV output to pixel shader
Clear Tiny UAV uses command buffer ClearBuffer command instead of allocating a temp buffer and copying it to UAV

anthony.bills
#rnx

#ROBOMERGE-OWNER: ryan.vance
#ROBOMERGE-AUTHOR: mickael.gilabert
#ROBOMERGE-SOURCE: CL 6077502 via CL 6077551 via CL 6080478 via CL 6080627
#ROBOMERGE-BOT: DEVVR (Main -> Dev-VR)

[CL 6084211 by mickael gilabert in Dev-VR branch]
2019-04-24 17:06:06 -04:00

299 lines
7.5 KiB
C++

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Interfaces/ITargetPlatform.h"
#include "PlatformInfo.h"
/**
* Base class for target platforms.
*/
class FTargetPlatformBase
: public ITargetPlatform
{
public:
// ITargetPlatform interface
virtual bool AddDevice( const FString& DeviceName, bool bDefault ) override
{
return false;
}
virtual FText DisplayName() const override
{
return PlatformInfo->DisplayName;
}
virtual const PlatformInfo::FPlatformInfo& GetPlatformInfo() const override
{
return *PlatformInfo;
}
TARGETPLATFORM_API virtual bool UsesForwardShading() const override;
TARGETPLATFORM_API virtual bool UsesDBuffer() const override;
TARGETPLATFORM_API virtual bool UsesBasePassVelocity() const override;
TARGETPLATFORM_API virtual bool UsesSelectiveBasePassOutputs() const override;
TARGETPLATFORM_API virtual bool UsesDistanceFields() const override;
#if WITH_ENGINE
virtual void GetReflectionCaptureFormats( TArray<FName>& OutFormats ) const override
{
OutFormats.Add(FName(TEXT("FullHDR")));
}
virtual FName GetVirtualTextureLayerFormat(
int32 SourceFormat,
bool bAllowCompression, bool bNoAlpha,
bool bSupportDX11TextureFormats, int32 Settings) const override
{
return FName();
}
#endif //WITH_ENGINE
virtual bool PackageBuild( const FString& InPackgeDirectory ) override
{
return true;
}
virtual bool CanSupportXGEShaderCompile() const override
{
return true;
}
virtual bool IsSdkInstalled(bool bProjectHasCode, FString& OutDocumentationPath) const override
{
return true;
}
virtual int32 CheckRequirements(const FString& ProjectPath, bool bProjectHasCode, FString& OutTutorialPath, FString& OutDocumentationPath, FText& CustomizedLogMessage) const override
{
int32 bReadyToBuild = ETargetPlatformReadyStatus::Ready; // @todo How do we check that the iOS SDK is installed when building from Windows? Is that even possible?
if (!IsSdkInstalled(bProjectHasCode, OutTutorialPath))
{
bReadyToBuild |= ETargetPlatformReadyStatus::SDKNotFound;
}
return bReadyToBuild;
}
virtual bool SupportsVariants() const override
{
return false;
}
virtual FText GetVariantDisplayName() const override
{
return FText();
}
virtual FText GetVariantTitle() const override
{
return FText();
}
virtual float GetVariantPriority() const override
{
return IsClientOnly() ? 0.0f : 0.2f;
}
virtual bool SendLowerCaseFilePaths() const override
{
return false;
}
virtual void GetBuildProjectSettingKeys(FString& OutSection, TArray<FString>& InBoolKeys, TArray<FString>& InIntKeys, TArray<FString>& InStringKeys) const override
{
// do nothing in the base class
}
virtual void RefreshSettings() override
{
}
virtual int32 GetPlatformOrdinal() const override
{
return PlatformOrdinal;
}
TARGETPLATFORM_API virtual TSharedPtr<IDeviceManagerCustomPlatformWidgetCreator> GetCustomWidgetCreator() const override;
protected:
FTargetPlatformBase(const PlatformInfo::FPlatformInfo *const InPlatformInfo)
: PlatformInfo(InPlatformInfo)
{
check(PlatformInfo);
PlatformOrdinal = AssignPlatformOrdinal(*this);
}
/** Information about this platform */
const PlatformInfo::FPlatformInfo *PlatformInfo;
int32 PlatformOrdinal;
};
/**
* Template for target platforms.
*
* @param TPlatformProperties Type of platform properties.
*/
template<typename TPlatformProperties>
class TTargetPlatformBase
: public FTargetPlatformBase
{
public:
/** Default constructor. */
TTargetPlatformBase()
: FTargetPlatformBase( PlatformInfo::FindPlatformInfo(TPlatformProperties::PlatformName()) )
{
// HasEditorOnlyData and RequiresCookedData are mutually exclusive.
check(TPlatformProperties::HasEditorOnlyData() != TPlatformProperties::RequiresCookedData());
}
public:
// ITargetPlatform interface
virtual bool HasEditorOnlyData() const override
{
return TPlatformProperties::HasEditorOnlyData();
}
virtual bool IsLittleEndian() const override
{
return TPlatformProperties::IsLittleEndian();
}
virtual bool IsServerOnly() const override
{
return TPlatformProperties::IsServerOnly();
}
virtual bool IsClientOnly() const override
{
return TPlatformProperties::IsClientOnly();
}
virtual FString PlatformName() const override
{
return FString(TPlatformProperties::PlatformName());
}
virtual FString IniPlatformName() const override
{
return FString(TPlatformProperties::IniPlatformName());
}
virtual bool RequiresCookedData() const override
{
return TPlatformProperties::RequiresCookedData();
}
virtual bool HasSecurePackageFormat() const override
{
return TPlatformProperties::HasSecurePackageFormat();
}
virtual bool RequiresUserCredentials() const override
{
return TPlatformProperties::RequiresUserCredentials();
}
virtual bool SupportsBuildTarget( EBuildTargets::Type BuildTarget ) const override
{
return TPlatformProperties::SupportsBuildTarget(BuildTarget);
}
virtual bool SupportsAutoSDK() const override
{
return TPlatformProperties::SupportsAutoSDK();
}
virtual bool SupportsFeature( ETargetPlatformFeatures Feature ) const override
{
switch (Feature)
{
case ETargetPlatformFeatures::AudioStreaming:
return TPlatformProperties::SupportsAudioStreaming();
case ETargetPlatformFeatures::DistanceFieldShadows:
return TPlatformProperties::SupportsDistanceFieldShadows();
case ETargetPlatformFeatures::DistanceFieldAO:
return TPlatformProperties::SupportsDistanceFieldAO();
case ETargetPlatformFeatures::GrayscaleSRGB:
return TPlatformProperties::SupportsGrayscaleSRGB();
case ETargetPlatformFeatures::HighQualityLightmaps:
return TPlatformProperties::SupportsHighQualityLightmaps();
case ETargetPlatformFeatures::LowQualityLightmaps:
return TPlatformProperties::SupportsLowQualityLightmaps();
case ETargetPlatformFeatures::MultipleGameInstances:
return TPlatformProperties::SupportsMultipleGameInstances();
case ETargetPlatformFeatures::Packaging:
return false;
case ETargetPlatformFeatures::Tessellation:
return TPlatformProperties::SupportsTessellation();
case ETargetPlatformFeatures::TextureStreaming:
return TPlatformProperties::SupportsTextureStreaming();
case ETargetPlatformFeatures::MeshLODStreaming:
return TPlatformProperties::SupportsMeshLODStreaming();
case ETargetPlatformFeatures::MemoryMappedFiles:
return TPlatformProperties::SupportsMemoryMappedFiles();
case ETargetPlatformFeatures::MemoryMappedAudio:
return TPlatformProperties::SupportsMemoryMappedAudio();
case ETargetPlatformFeatures::MemoryMappedAnimation:
return TPlatformProperties::SupportsMemoryMappedAnimation();
case ETargetPlatformFeatures::SdkConnectDisconnect:
case ETargetPlatformFeatures::UserCredentials:
break;
case ETargetPlatformFeatures::MobileRendering:
return false;
case ETargetPlatformFeatures::DeferredRendering:
return true;
case ETargetPlatformFeatures::ShouldSplitPaksIntoSmallerSizes :
return false;
case ETargetPlatformFeatures::HalfFloatVertexFormat:
return true;
}
return false;
}
virtual FName GetZlibReplacementFormat() const override
{
return TPlatformProperties::GetZlibReplacementFormat() != nullptr ? FName(TPlatformProperties::GetZlibReplacementFormat()) : NAME_Zlib;
}
virtual int32 GetMemoryMappingAlignment() const override
{
return TPlatformProperties::GetMemoryMappingAlignment();
}
#if WITH_ENGINE
virtual FName GetPhysicsFormat( class UBodySetup* Body ) const override
{
return FName(TPlatformProperties::GetPhysicsFormat());
}
#endif // WITH_ENGINE
};