You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
========================== MAJOR FEATURES + CHANGES ========================== Change 2719147 on 2015/10/07 by Mark.Satterthwaite Allow the shader cache to perform some precompilation synchronously on load before falling back to asynchronous compilation to balance load times against total time spent precompiling. Added a stat to the group that reports how long the precompile has been running until it completes so it is easier to track. Change 2719182 on 2015/10/07 by Mark.Satterthwaite Refactor the ShaderCache's internal data structures and change the way we handle recording whether a particular predraw state has been submitted to try and make it more efficient. Change 2719185 on 2015/10/07 by Mark.Satterthwaite Merging CL #2717701: Try and fix random crashes on Mac when manipulating bound-shader-states caused by ShaderCache potentially providing a bogus shader state pointer on exit from predraw. Change 2719434 on 2015/10/07 by Mark.Satterthwaite Make sure that Mac ensures reports have a source context and a sane callstack when sent to the crash-reports server. Change 2724764 on 2015/10/12 by Josh.Adams [Initial AppleTV support] Merging //depot/YakBranch/... to //UE4/Dev-Platform/... Change 2726266 on 2015/10/13 by Lee.Clark PS4 - Calc reserve size required for DMA copy when using unsafe command buffers Change 2726401 on 2015/10/13 by Mark.Satterthwaite Merging CL #2716418: Fix UE-15228 'Crash Report Client doesn't restart into project editor on Mac' by reporting the original command line supplied by LaunchMac, not the modified one that strips the project name. The CRC can then relaunch as expected. #jira UE-15228 Change 2726421 on 2015/10/13 by Lee.Clark PS4 - Don't try to clear invalid targets Change 2727040 on 2015/10/13 by Michael.Trepka Merging CL 2724777 - Fixed splash screen rendering for images with DPI different than 72 Change 2729783 on 2015/10/15 by Keith.Judge Fix huge memory leak in Test/Shipping configurations, caused because I am a numpty. Change 2729847 on 2015/10/15 by Mark.Satterthwaite Merging CL #2729846: On OS X unconstrain windows from the dimension of the parent display when in Windowed mode - it is OK for them to be larger in this case. They do need to be repositioned if on the Primary display so that they don't creep under the menu bar and become unmovable/unclosable and Fullscreen windows still need to be constrained to a single display. We can now take screenshots of windows that are larger than the display & not get grey bars beyond the cutoff. #jira UE-21992 Change 2729865 on 2015/10/15 by Keith.Judge Fast semantics - Finish up resource transitions, adding resource decompression where appropriate and using non-fast clears where we can't determine the resource transition. Change 2729897 on 2015/10/15 by Keith.Judge Fast Semantics - Make sure all GetData() calls are made safe with GPU fences. Change 2729972 on 2015/10/15 by Keith.Judge Removed the last vestiges of ID3D11DeviceContext/ID3D11DeviceContext1 from the Xbox RHI. Everything now uses ID3D11DeviceContextX directly. This should be marginally quicker as it stops a double call to ClearState(). Change 2731503 on 2015/10/16 by Keith.Judge Added _XDK_VERSION to the DDC key for textures, which should solve the issue of the tiling mode changing in August XDK (and future changes Microsoft may inflict). Change 2731596 on 2015/10/16 by Keith.Judge Fast Semantics - Add deferred resource deletion queue to make deleted resources be actually deleted a number of frames later so that the GPU is definitely finished with them. Hooked up the temporary SRVs for dynamic VBs as a first step. Change 2731928 on 2015/10/16 by Michael.Trepka PR #1659: Mac/Build.sh handles additional arguments (Contributed by judgeaxl) Change 2731934 on 2015/10/16 by Michael.Trepka PR #1618: added clang 3.7.0 -Wshift-negative-value ignore in JpegImageWrapper.cpp (Contributed by bsekura) Change 2732018 on 2015/10/16 by Mark.Satterthwaite Emit a shader code cache for each platforms requested shader formats, this is separate to the targeted formats as not all can or need to be cached. - The implementation extends the ShaderCache's hooks in FShaderResource's serialisation function to capture the required shaders. - Each target platform has its own list of cached shader formats, analogous to the list of targeted RHIs. Presently only the Mac implements this. - Code cached shaders are now compressed (for size) to reduce the overhead associated with keeping all the shader code around - this works esp. well for text-based formats like GLSL. Change 2732365 on 2015/10/16 by Josh.Adams - Packaging a TVOS .ipa now works (still haven't tried any of the Editor integration like Launch On) Change 2733170 on 2015/10/18 by Terence.Burns Fix for Android IAP query not returning entire inventory. Change 2733174 on 2015/10/18 by Terence.Burns Fix Movie player issue where wait for movie to finish isnt being respected. Seems a stray bUserCanceled event flag was causing this not to be observed. Added some verbose logging to apple movie player. Change 2733488 on 2015/10/19 by Mark.Satterthwaite Added the ability to merge the .ushadercache files used by the ShaderCache to store shader & draw state information. - Fixed a bug that would cause invalid shader membership and draw state information to be logged. - Added a separate command-line tool to merge shader cache files, currently Mac-only but in theory should work on other platforms too. Change 2735226 on 2015/10/20 by Mark.Satterthwaite Fix temporal AA rendering on GL/Mac OS X - you can't rely on EyeAdaptation values unless SM5 is available so only perform that code on SM5 & we must correctly clamp saturate(NaN) to 0 as the current hlslcc won't do that for us (& is required by the HLSL spec). The latter used to be clamped in the AA_ALPHA && AA_VELOCITY_WEIGHTING code block that was removed recently. #jira UE-21214 #jira UE-19913 Change 2736722 on 2015/10/21 by Daniel.Lamb Improved performance of cooking stats system. Change 2737172 on 2015/10/21 by Daniel.Lamb Improved cooking stats performance for ddc stats.
360 lines
10 KiB
C++
360 lines
10 KiB
C++
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
|
|
|
/*=============================================================================
|
|
HTML5TargetPlatform.cpp: Implements the FHTML5TargetPlatform class.
|
|
=============================================================================*/
|
|
|
|
#include "HTML5TargetPlatformPrivatePCH.h"
|
|
|
|
#if WITH_ENGINE
|
|
#include "DeviceProfiles/DeviceProfile.h"
|
|
#endif
|
|
|
|
DEFINE_LOG_CATEGORY_STATIC(LogHTML5TargetPlatform, Log, All);
|
|
|
|
|
|
/* Static initialization
|
|
*****************************************************************************/
|
|
|
|
FCriticalSection FHTML5TargetPlatform::DevicesCriticalSection;
|
|
|
|
/* FHTML5TargetPlatform structors
|
|
*****************************************************************************/
|
|
|
|
FHTML5TargetPlatform::FHTML5TargetPlatform( )
|
|
{
|
|
RefreshHTML5Setup();
|
|
#if WITH_ENGINE
|
|
// load up texture settings from the config file
|
|
HTML5LODSettings = nullptr;
|
|
StaticMeshLODSettings.Initialize(HTML5EngineSettings);
|
|
#endif
|
|
}
|
|
|
|
|
|
/* ITargetPlatform interface
|
|
*****************************************************************************/
|
|
|
|
void FHTML5TargetPlatform::GetAllDevices( TArray<ITargetDevicePtr>& OutDevices ) const
|
|
{
|
|
FScopeLock Lock( &DevicesCriticalSection );
|
|
|
|
OutDevices.Reset();
|
|
|
|
for( auto Iter = Devices.CreateConstIterator(); Iter; ++Iter )
|
|
{
|
|
OutDevices.Add( Iter.Value() );
|
|
}
|
|
}
|
|
|
|
|
|
ECompressionFlags FHTML5TargetPlatform::GetBaseCompressionMethod( ) const
|
|
{
|
|
return COMPRESS_ZLIB;
|
|
}
|
|
|
|
|
|
ITargetDevicePtr FHTML5TargetPlatform::GetDefaultDevice( ) const
|
|
{
|
|
FScopeLock Lock( &DevicesCriticalSection );
|
|
|
|
return Devices.FindRef( DefaultDeviceName );
|
|
}
|
|
|
|
|
|
ITargetDevicePtr FHTML5TargetPlatform::GetDevice( const FTargetDeviceId& DeviceId )
|
|
{
|
|
if( DeviceId.GetPlatformName() == this->PlatformName() )
|
|
{
|
|
FScopeLock Lock( &DevicesCriticalSection );
|
|
for( auto MapIt = Devices.CreateIterator(); MapIt; ++MapIt )
|
|
{
|
|
FHTML5TargetDevicePtr& Device = MapIt->Value;
|
|
if( Device->GetName() == DeviceId.GetDeviceName() )
|
|
{
|
|
return Device;
|
|
}
|
|
}
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
bool FHTML5TargetPlatform::IsSdkInstalled(bool bProjectHasCode, FString& OutDocumentationPath) const
|
|
{
|
|
#if PLATFORM_WINDOWS
|
|
FString SDKPath = FPaths::EngineDir() / TEXT("Source") / TEXT("ThirdParty") / TEXT("HTML5") / TEXT("emsdk") / TEXT("Win64");
|
|
#elif PLATFORM_MAC
|
|
FString SDKPath = FPaths::EngineDir() / TEXT("Source") / TEXT("ThirdParty") / TEXT("HTML5") / TEXT("emsdk") / TEXT("Mac");
|
|
#elif PLATFORM_LINUX
|
|
FString SDKPath = FPaths::EngineDir() / TEXT("Source") / TEXT("ThirdParty") / TEXT("HTML5") / TEXT("emsdk") / TEXT("Linux");
|
|
#else
|
|
return;
|
|
#endif
|
|
|
|
FString SDKDirectory = FPaths::ConvertRelativePathToFull(SDKPath);
|
|
|
|
if (IFileManager::Get().DirectoryExists(*SDKDirectory))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
|
|
bool FHTML5TargetPlatform::IsRunningPlatform( ) const
|
|
{
|
|
return false; // but this will never be called because this platform doesn't run the target platform framework
|
|
}
|
|
|
|
|
|
#if WITH_ENGINE
|
|
|
|
static FName NAME_GLSL_ES2_WEBGL(TEXT("GLSL_ES2_WEBGL"));
|
|
|
|
void FHTML5TargetPlatform::GetAllPossibleShaderFormats( TArray<FName>& OutFormats ) const
|
|
{
|
|
OutFormats.AddUnique(NAME_GLSL_ES2_WEBGL);
|
|
}
|
|
|
|
|
|
void FHTML5TargetPlatform::GetAllTargetedShaderFormats( TArray<FName>& OutFormats ) const
|
|
{
|
|
GetAllPossibleShaderFormats(OutFormats);
|
|
}
|
|
|
|
|
|
const class FStaticMeshLODSettings& FHTML5TargetPlatform::GetStaticMeshLODSettings( ) const
|
|
{
|
|
return StaticMeshLODSettings;
|
|
}
|
|
|
|
|
|
void FHTML5TargetPlatform::GetTextureFormats( const UTexture* Texture, TArray<FName>& OutFormats ) const
|
|
{
|
|
FName TextureFormatName = NAME_None;
|
|
|
|
#if WITH_EDITOR
|
|
// Supported texture format names.
|
|
static FName NameDXT1(TEXT("DXT1"));
|
|
static FName NameDXT3(TEXT("DXT3"));
|
|
static FName NameDXT5(TEXT("DXT5"));
|
|
static FName NameDXT5n(TEXT("DXT5n"));
|
|
static FName NameAutoDXT(TEXT("AutoDXT"));
|
|
static FName NameBGRA8(TEXT("BGRA8"));
|
|
static FName NameG8(TEXT("G8"));
|
|
static FName NameRGBA16F(TEXT("RGBA16F"));
|
|
static FName NameRGBA8(TEXT("RGBA8"));
|
|
|
|
bool bNoCompression = Texture->CompressionNone // Code wants the texture uncompressed.
|
|
|| (HasEditorOnlyData() && Texture->DeferCompression) // The user wishes to defer compression, this is ok for the Editor only.
|
|
|| (Texture->CompressionSettings == TC_EditorIcon)
|
|
|| (Texture->LODGroup == TEXTUREGROUP_ColorLookupTable) // Textures in certain LOD groups should remain uncompressed.
|
|
|| (Texture->LODGroup == TEXTUREGROUP_Bokeh)
|
|
|| (Texture->LODGroup == TEXTUREGROUP_IESLightProfile)
|
|
|| (Texture->Source.GetSizeX() < 4) // Don't compress textures smaller than the DXT block size.
|
|
|| (Texture->Source.GetSizeY() < 4)
|
|
|| (Texture->Source.GetSizeX() % 4 != 0)
|
|
|| (Texture->Source.GetSizeY() % 4 != 0);
|
|
|
|
|
|
ETextureSourceFormat SourceFormat = Texture->Source.GetFormat();
|
|
|
|
// Determine the pixel format of the (un/)compressed texture
|
|
if (bNoCompression)
|
|
{
|
|
if (Texture->HasHDRSource())
|
|
{
|
|
TextureFormatName = NameBGRA8;
|
|
}
|
|
else if (SourceFormat == TSF_G8 || Texture->CompressionSettings == TC_Grayscale)
|
|
{
|
|
TextureFormatName = NameG8;
|
|
}
|
|
else if (Texture->LODGroup == TEXTUREGROUP_Shadowmap)
|
|
{
|
|
TextureFormatName = NameG8;
|
|
}
|
|
else
|
|
{
|
|
TextureFormatName = NameRGBA8;
|
|
}
|
|
}
|
|
else if (Texture->CompressionSettings == TC_HDR
|
|
|| Texture->CompressionSettings == TC_HDR_Compressed)
|
|
{
|
|
TextureFormatName = NameRGBA16F;
|
|
}
|
|
else if (Texture->CompressionSettings == TC_Normalmap)
|
|
{
|
|
TextureFormatName = NameDXT5;
|
|
}
|
|
else if (Texture->CompressionSettings == TC_Displacementmap)
|
|
{
|
|
TextureFormatName = NameG8;
|
|
}
|
|
else if (Texture->CompressionSettings == TC_VectorDisplacementmap)
|
|
{
|
|
TextureFormatName = NameRGBA8;
|
|
}
|
|
else if (Texture->CompressionSettings == TC_Grayscale)
|
|
{
|
|
TextureFormatName = NameG8;
|
|
}
|
|
else if( Texture->CompressionSettings == TC_Alpha)
|
|
{
|
|
TextureFormatName = NameDXT5;
|
|
}
|
|
else if (Texture->CompressionSettings == TC_DistanceFieldFont)
|
|
{
|
|
TextureFormatName = NameG8;
|
|
}
|
|
else if (Texture->CompressionNoAlpha)
|
|
{
|
|
TextureFormatName = NameDXT1;
|
|
}
|
|
else if (Texture->bDitherMipMapAlpha)
|
|
{
|
|
TextureFormatName = NameDXT5;
|
|
}
|
|
else
|
|
{
|
|
TextureFormatName = NameAutoDXT;
|
|
}
|
|
|
|
// Some PC GPUs don't support sRGB read from G8 textures (e.g. AMD DX10 cards on ShaderModel3.0)
|
|
// This solution requires 4x more memory but a lot of PC HW emulate the format anyway
|
|
if ((TextureFormatName == NameG8) && Texture->SRGB && !SupportsFeature(ETargetPlatformFeatures::GrayscaleSRGB))
|
|
{
|
|
TextureFormatName = NameBGRA8;
|
|
}
|
|
#endif
|
|
|
|
OutFormats.Add( TextureFormatName);
|
|
}
|
|
|
|
|
|
const UTextureLODSettings& FHTML5TargetPlatform::GetTextureLODSettings() const
|
|
{
|
|
return *HTML5LODSettings;
|
|
}
|
|
|
|
|
|
FName FHTML5TargetPlatform::GetWaveFormat( const USoundWave* Wave ) const
|
|
{
|
|
static FName NAME_OGG(TEXT("OGG"));
|
|
return NAME_OGG;
|
|
}
|
|
|
|
#endif // WITH_ENGINE
|
|
|
|
void FHTML5TargetPlatform::RefreshHTML5Setup()
|
|
{
|
|
FString Temp;
|
|
if (!FHTML5TargetPlatform::IsSdkInstalled(true, Temp))
|
|
{
|
|
// nothing to do.
|
|
return;
|
|
}
|
|
|
|
// update available devices
|
|
TArray<FString> DeviceMaps;
|
|
GConfig->GetArray( TEXT("/Script/HTML5PlatformEditor.HTML5SDKSettings"), TEXT("DeviceMap"), DeviceMaps, GEngineIni );
|
|
if ( ! DeviceMaps.Num() )
|
|
{
|
|
// nuke everything
|
|
FScopeLock Lock( &DevicesCriticalSection );
|
|
for (auto Iter = Devices.CreateIterator(); Iter; ++Iter)
|
|
{
|
|
// UE_LOG(LogHTML5TargetPlatform, Log, TEXT("HTML5SDKSettings: count before NUKE %d"), Devices.Num());
|
|
FHTML5TargetDevicePtr Device = Iter->Value;
|
|
Iter.RemoveCurrent();
|
|
DeviceLostEvent.Broadcast(Device.ToSharedRef());
|
|
}
|
|
DefaultDeviceName.Empty();
|
|
}
|
|
else
|
|
{
|
|
// add or update
|
|
// UE_LOG(LogHTML5TargetPlatform, Log, TEXT("HTML5SDKSettings: count before ADD/UPDATNG %d"), Devices.Num());
|
|
for (auto It : DeviceMaps)
|
|
{
|
|
// UE_LOG(LogHTML5TargetPlatform, Log, TEXT("HTML5SDKSettings: parsing %s"),*It);
|
|
FString DeviceName = "";
|
|
if( FParse::Value( *It, TEXT( "DeviceName=" ), DeviceName ) )
|
|
{
|
|
FString DevicePath = "";
|
|
if( FParse::Value( *DeviceName, TEXT( "DevicePath=" ), DevicePath ) )
|
|
{
|
|
DevicePath.RemoveFromEnd(TEXT("))"));
|
|
FString FilePath = "";
|
|
if( FParse::Value( *DevicePath, TEXT( "FilePath=" ), FilePath ) )
|
|
{
|
|
if (FPlatformFileManager::Get().GetPlatformFile().FileExists(*DevicePath) ||
|
|
FPlatformFileManager::Get().GetPlatformFile().DirectoryExists(*DevicePath))
|
|
{
|
|
FScopeLock Lock( &DevicesCriticalSection );
|
|
FHTML5TargetDevicePtr& Device = Devices.FindOrAdd( DeviceName );
|
|
|
|
if( Device.IsValid() )
|
|
{
|
|
// UE_LOG(LogHTML5TargetPlatform, Log, TEXT("HTML5SDKSettings: UPDATING %s"),*It);
|
|
DeviceLostEvent.Broadcast(Device.ToSharedRef());
|
|
}
|
|
else
|
|
{
|
|
// UE_LOG(LogHTML5TargetPlatform, Log, TEXT("HTML5SDKSettings: ADDING %s"),*It);
|
|
}
|
|
Device = MakeShareable( new FHTML5TargetDevice( *this, DeviceName, DevicePath ) );
|
|
DeviceDiscoveredEvent.Broadcast( Device.ToSharedRef() );
|
|
if ( DefaultDeviceName.IsEmpty() )
|
|
{
|
|
DefaultDeviceName = DeviceName;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
struct FBrowserLocation
|
|
{
|
|
FString Name;
|
|
FString Path;
|
|
} PossibleLocations[] =
|
|
{
|
|
#if PLATFORM_WINDOWS
|
|
{ TEXT("Nightly(64bit)"), TEXT("C:/Program Files/Nightly/firefox.exe") },
|
|
{ TEXT("Nightly"), TEXT("C:/Program Files (x86)/Nightly/firefox.exe") },
|
|
{ TEXT("Firefox"), TEXT("C:/Program Files (x86)/Mozilla Firefox/firefox.exe") },
|
|
// { TEXT("Chrome"), TEXT("C:/Program Files (x86)/Google/Chrome/Application/chrome.exe") },
|
|
#elif PLATFORM_MAC
|
|
{ TEXT("Safari"), TEXT("/Applications/Safari.app") },
|
|
{ TEXT("Firefox"), TEXT("/Applications/Firefox.app") },
|
|
{ TEXT("Chrome"), TEXT("/Applications/Google Chrome.app") },
|
|
#elif PLATFORM_LINUX
|
|
{ TEXT("Firefox"), TEXT("/usr/bin/firefox") },
|
|
#else
|
|
{ TEXT("Firefox"), TEXT("") },
|
|
#endif
|
|
};
|
|
|
|
// Add default devices..
|
|
for (const auto& Loc : PossibleLocations)
|
|
{
|
|
if (FPlatformFileManager::Get().GetPlatformFile().FileExists(*Loc.Path) || FPlatformFileManager::Get().GetPlatformFile().DirectoryExists(*Loc.Path))
|
|
{
|
|
FScopeLock Lock( &DevicesCriticalSection );
|
|
|
|
FHTML5TargetDevicePtr& Device = Devices.FindOrAdd( *Loc.Name );
|
|
|
|
if( !Device.IsValid() )
|
|
{
|
|
Device = MakeShareable( new FHTML5TargetDevice( *this, *Loc.Name, *Loc.Path ) );
|
|
DeviceDiscoveredEvent.Broadcast(Device.ToSharedRef());
|
|
}
|
|
}
|
|
}
|
|
}
|