Files
UnrealEngineUWP/Engine/Source/Developer/TextureFormatASTC/Private/TextureFormatASTC.cpp

421 lines
15 KiB
C++
Raw Normal View History

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
#include "Core.h"
#include "CoreMisc.h"
#include "ImageCore.h"
#include "ImageWrapper.h"
#include "ModuleInterface.h"
#include "ModuleManager.h"
#include "TargetPlatform.h"
#include "TextureCompressorModule.h"
#include "PixelFormat.h"
#include "GenericPlatformProcess.h"
// increment this if you change anything that will affect compression in this file, including FORCED_NORMAL_MAP_COMPRESSION_SIZE_VALUE
Copying //UE4/Dev-Mobile to //UE4/Dev-Main (Source: //UE4/Dev-Mobile @ 3010693) #lockdown nick.penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 2958982 on 2016/04/28 by Dmitriy.Dyomin Set owner name for RHI texture, for easier debugging Change 2976446 on 2016/05/12 by Niklas.Smedberg Fixed Device Profile CVars so they work even if a DLL with the cvar definition is loaded afterwards. (And they now also go through the common code path for CVars.) Change 2983781 on 2016/05/19 by Steve.Cano Check in PlayUsingLauncher if the device we're launching to is authorized by the computer. Could not get to this information about Devices so added an IsAuthorized interface to ITargetDevice that is overriden in the AndroidTargetDevice. Also make sure to referesh the authorized state as needed for Android device detection. Finally, changed the name of the authorized variable to be more readable (true == authorized instead of true == unauthorized) #jira UE-21121 #ue4 #android Change 2994202 on 2016/05/31 by Allan.Bentham Prevent clear transulcency volume null deref crash. Change test for allocated deferred render targets by testing against an exclusively deferred target (instead of potentially shared shadow depth surface) probable fix for UE-22073 Change 2995613 on 2016/05/31 by Dmitriy.Dyomin Added: Option to force full precision in a material UEMOB-109 Change 2997960 on 2016/06/02 by Gareth.Martin Refactored Landscape serialization to allow cooking both the data used for normal rendering and mobile rendering into the same package #jira UE-31474 Change 2997988 on 2016/06/02 by Gareth.Martin Files missing from CL 2997960 #jira UE-31474 Change 2999222 on 2016/06/03 by Jack.Porter Fix up ETargetPlatformFeatures::ForwardRendering and ETargetPlatformFeatures::DeferredRendering for iOS to support the Metal MRT deferred renderer Change 2999229 on 2016/06/03 by Jack.Porter Rename ETargetPlatformFeatures::ForwardRendering to TargetPlatformFeatures::MobileRendering Change 3003540 on 2016/06/07 by Jack.Porter Merging //UE4/Dev-Main to Dev-Mobile (//UE4/Dev-Mobile) Change 3003779 on 2016/06/07 by Dmitriy.Dyomin Fixed: Criss-crossed sublevels cause NavMesh errors #jira UE-27157 Change 3004535 on 2016/06/07 by Steve.Cano Adding the OnControllerConnectionChange delegate message when a controller is connected on Android. Also added additional future broadcast statement when disconnect support is added for Android. #jira UE-25697 #ue4 #android Change 3005205 on 2016/06/07 by Niklas.Smedberg Bumped ASTC format version to invalidate bad server DDC Change 3005347 on 2016/06/08 by Dmitriy.Dyomin Added a way to cache OpenGL program binaries on the disk. Disabled by default. Can be enabled only on Android platform (r.UseProgramBinaryCache=1) #jira UEMOB-108 Change 3005524 on 2016/06/08 by Dmitriy.Dyomin Fixed iOS build broken by CL# 3005347 Change 3005528 on 2016/06/08 by Jack.Porter Changed hardcoded checkboxes from quality level overrides dialog to use the general property details code. Now magically supports any uproperty types such as enums or integers added to FMaterialQualityOverrides. Change 3005607 on 2016/06/08 by Dmitriy.Dyomin Fixed: Occasional crash on using Launch on Android device when device is being disconnected Change 3006705 on 2016/06/08 by Chris.Babcock Fix virtual joystick to return -1 to 1 ranges for thumbsticks #jira UE-31799 #ue4 #android #ios Change 3006960 on 2016/06/08 by Jack.Porter Merging //UE4/Dev-Main to Dev-Mobile (//UE4/Dev-Mobile) Change 3007050 on 2016/06/09 by Jack.Porter FAutomationWorkerModule::ReportTestComplete() needs to send analytics first as the message endpoint will free the memory resulting in a crash Change 3007129 on 2016/06/09 by Dmitriy.Dyomin Fixed: Black edges seen on flames in Sun Temple #jira UE-31712 Change 3010686 on 2016/06/13 by Dmitriy.Dyomin Fixed: Android Monolithic warnings for glGetProgramBinaryOES and glProgramBinaryOES #jira UE-31933 [CL 3011074 by Jack Porter in Main branch]
2016-06-13 12:20:22 -04:00
#define BASE_FORMAT_VERSION 35
#define MAX_QUALITY_BY_SIZE 4
#define MAX_QUALITY_BY_SPEED 3
#define FORCED_NORMAL_MAP_COMPRESSION_SIZE_VALUE 4
DEFINE_LOG_CATEGORY_STATIC(LogTextureFormatASTC, Log, All);
/**
* Macro trickery for supported format names.
*/
#define ENUM_SUPPORTED_FORMATS(op) \
op(ASTC_RGB) \
op(ASTC_RGBA) \
op(ASTC_RGBAuto) \
op(ASTC_NormalAG) \
op(ASTC_NormalRG)
#define DECL_FORMAT_NAME(FormatName) static FName GTextureFormatName##FormatName = FName(TEXT(#FormatName));
ENUM_SUPPORTED_FORMATS(DECL_FORMAT_NAME);
#undef DECL_FORMAT_NAME
#define DECL_FORMAT_NAME_ENTRY(FormatName) GTextureFormatName##FormatName ,
static FName GSupportedTextureFormatNames[] =
{
ENUM_SUPPORTED_FORMATS(DECL_FORMAT_NAME_ENTRY)
};
#undef DECL_FORMAT_NAME_ENTRY
#undef ENUM_SUPPORTED_FORMATS
// ASTC file header format
#if PLATFORM_SUPPORTS_PRAGMA_PACK
#pragma pack(push, 4)
#endif
#define ASTC_MAGIC_CONSTANT 0x5CA1AB13
struct FASTCHeader
{
uint32 Magic;
uint8 BlockSizeX;
uint8 BlockSizeY;
uint8 BlockSizeZ;
uint8 TexelCountX[3];
uint8 TexelCountY[3];
uint8 TexelCountZ[3];
};
#if PLATFORM_SUPPORTS_PRAGMA_PACK
#pragma pack(pop)
#endif
IImageWrapperModule& ImageWrapperModule = FModuleManager::LoadModuleChecked<IImageWrapperModule>(FName("ImageWrapper"));
static int32 GetDefaultCompressionBySizeValue()
{
// start at default quality, then lookup in .ini file
int32 CompressionModeValue = 0;
GConfig->GetInt(TEXT("/Script/UnrealEd.CookerSettings"), TEXT("DefaultASTCQualityBySize"), CompressionModeValue, GEngineIni);
FParse::Value(FCommandLine::Get(), TEXT("-astcqualitybysize="), CompressionModeValue);
CompressionModeValue = FMath::Min<uint32>(CompressionModeValue, MAX_QUALITY_BY_SIZE);
return CompressionModeValue;
}
static int32 GetDefaultCompressionBySpeedValue()
{
// start at default quality, then lookup in .ini file
int32 CompressionModeValue = 0;
GConfig->GetInt(TEXT("/Script/UnrealEd.CookerSettings"), TEXT("DefaultASTCQualityBySpeed"), CompressionModeValue, GEngineIni);
FParse::Value(FCommandLine::Get(), TEXT("-astcqualitybyspeed="), CompressionModeValue);
CompressionModeValue = FMath::Min<uint32>(CompressionModeValue, MAX_QUALITY_BY_SPEED);
return CompressionModeValue;
}
static FString GetQualityString(int32 OverrideSizeValue=-1, int32 OverrideSpeedValue=-1)
{
// convert to a string
FString CompressionMode;
switch (OverrideSizeValue >= 0 ? OverrideSizeValue : GetDefaultCompressionBySizeValue())
{
case 0: CompressionMode = TEXT("12x12"); break;
case 1: CompressionMode = TEXT("10x10"); break;
case 2: CompressionMode = TEXT("8x8"); break;
case 3: CompressionMode = TEXT("6x6"); break;
case 4: CompressionMode = TEXT("4x4"); break;
default: UE_LOG(LogTemp, Fatal, TEXT("ASTC size quality higher than expected"));
}
switch (OverrideSpeedValue >= 0 ? OverrideSpeedValue : GetDefaultCompressionBySpeedValue())
{
case 0: CompressionMode += TEXT(" -veryfast"); break;
case 1: CompressionMode += TEXT(" -fast"); break;
case 2: CompressionMode += TEXT(" -medium"); break;
case 3: CompressionMode += TEXT(" -thorough"); break;
default: UE_LOG(LogTemp, Fatal, TEXT("ASTC speed quality higher than expected"));
}
return CompressionMode;
}
static EPixelFormat GetQualityFormat(int32 OverrideSizeValue=-1)
{
// convert to a string
EPixelFormat Format = PF_Unknown;
switch (OverrideSizeValue >= 0 ? OverrideSizeValue : GetDefaultCompressionBySizeValue())
{
case 0: Format = PF_ASTC_12x12; break;
case 1: Format = PF_ASTC_10x10; break;
case 2: Format = PF_ASTC_8x8; break;
case 3: Format = PF_ASTC_6x6; break;
case 4: Format = PF_ASTC_4x4; break;
default: UE_LOG(LogTemp, Fatal, TEXT("Max quality higher than expected"));
}
return Format;
}
static uint16 GetQualityVersion()
{
// top 3 bits for size compression value, and next 3 for speed
return (GetDefaultCompressionBySizeValue() << 13) | (GetDefaultCompressionBySpeedValue() << 10);
}
static bool CompressSliceToASTC(
const void* SourceData,
int32 SizeX,
int32 SizeY,
FString CompressionParameters,
TArray<uint8>& OutCompressedData
)
{
// Always Y-invert the image prior to compression for proper orientation post-compression
TArray<uint8> LineBuffer;
LineBuffer.AddUninitialized(16384 * 4);
uint32 LineSize = SizeX * 4;
for (int32 LineIndex = 0; LineIndex < (SizeY / 2); LineIndex++)
{
uint8* LineData0 = ((uint8*)SourceData) + (LineSize * LineIndex);
uint8* LineData1 = ((uint8*)SourceData) + (LineSize * (SizeY - LineIndex - 1));
FMemory::Memcpy(LineBuffer.GetData(), LineData0, LineSize);
FMemory::Memcpy(LineData0, LineData1, LineSize);
FMemory::Memcpy(LineData1, LineBuffer.GetData(), LineSize);
}
// Compress and retrieve the PNG data to write out to disk
IImageWrapperPtr ImageWrapper = ImageWrapperModule.CreateImageWrapper(EImageFormat::PNG);
ImageWrapper->SetRaw(SourceData, SizeX * SizeY * 4, SizeX, SizeY, ERGBFormat::RGBA, 8);
const TArray<uint8>& FileData = ImageWrapper->GetCompressed();
int32 FileDataSize = FileData.Num();
FGuid Guid;
FPlatformMisc::CreateGuid(Guid);
FString InputFilePath = FString::Printf(TEXT("Cache/%08x-%08x-%08x-%08x-RGBToASTCIn.png"), Guid.A, Guid.B, Guid.C, Guid.D);
FString OutputFilePath = FString::Printf(TEXT("Cache/%08x-%08x-%08x-%08x-RGBToASTCOut.astc"), Guid.A, Guid.B, Guid.C, Guid.D);
InputFilePath = FPaths::GameIntermediateDir() + InputFilePath;
OutputFilePath = FPaths::GameIntermediateDir() + OutputFilePath;
FArchive* PNGFile = NULL;
while (!PNGFile)
{
PNGFile = IFileManager::Get().CreateFileWriter(*InputFilePath); // Occasionally returns NULL due to error code ERROR_SHARING_VIOLATION
FPlatformProcess::Sleep(0.01f); // ... no choice but to wait for the file to become free to access
}
PNGFile->Serialize((void*)&FileData[0], FileDataSize);
delete PNGFile;
// Compress PNG file to ASTC (using the reference astcenc.exe from ARM)
FString Params = FString::Printf(TEXT("-c \"%s\" \"%s\" %s"),
*InputFilePath,
*OutputFilePath,
*CompressionParameters
);
Copying //UE4/Dev-Platform to Dev-Main (//UE4/Dev-Main) (Source: //UE4/Dev-Platform @ 3061622) #rb none #lockdown nick.penwarden Change 3046743 on 2016/07/12 by Mark.Satterthwaite Revert Metal workaround for AtmosphericFog rendering on Intel & AMD from 2897082 and instead change the MetalBackend to emit a precise::sqrt(max(0.0, value)) instruction instead of sqrt(value) to avoid the NaN from -ve values. This may still be technically incorrect versus D3D, but it matches the existing OpenGL appearance. #rb ben.woodhouse #jira UE-33028 Change 3046820 on 2016/07/12 by Peter.Sauerbrei PR#2594 - fix for analog input, courtesy of CleanCut #rb daniel.lamb Change 3046826 on 2016/07/12 by Peter.Sauerbrei PR#2561 - addition of code to limit architecture in required caps for IOS, courtesy of derekvanvliet #rb daniel.lamb Change 3046835 on 2016/07/12 by Peter.Sauerbrei PR#2559 - Increase the stack size on IOS and Mac, courtesy of derekvanvliet PR#2552 - Addition for Apple ReplayKit Framework, courtesy of JoshuaKaiser #rb daniel.lamb Change 3046838 on 2016/07/12 by Peter.Sauerbrei PR#2548 - Adding Log information when an unsupported audio type is used, courtesy of derekvanvliet #rb daniel.lamb Change 3046854 on 2016/07/12 by Peter.Sauerbrei PR#2547 - fix for unrecognize selector crash on iOS, couretesy of derekvanvliet PR#2384 - prevent crashes when initializing push notifications on IOS 7, courtesy of alk3ovation #rb daniel.lamb Change 3046858 on 2016/07/12 by Peter.Sauerbrei PR#2475, #1868 - fix for mapping of iOS device name, courtesy of wingedrobin, derekvanvliet PR#2567 - fix name of IPhoneSE in names array, courtesy of rohanliston #rb daniel.lamb Change 3046862 on 2016/07/12 by Peter.Sauerbrei fix for type in tooltip #jira UE-27123 #rb daniel.lamb Change 3046919 on 2016/07/12 by Daniel.Lamb Stop texture derived data from loading it's bulk data when the linker is destoryed. #rb Peter.Sauerbrei Change 3046922 on 2016/07/12 by Daniel.Lamb Updated the default cooker gc settings so that it can have more resources. Added support for cooker markup package and objects as (new flag) disregard for gc if it's still in use by the cooker. Changed the way reentry data is stored in the cooker. Cook only editor content flag in project settings now works again. #rb Josh.Adams #test cook Paragon Change 3046924 on 2016/07/12 by Daniel.Lamb Added support for encrypting ini files. Added new project setting in the editor and setting in ufe. Also added ForDistribution flag to ufe. #rb Peter.Sauerbrei Change 3046936 on 2016/07/12 by Mark.Satterthwaite Fix compute shader TLV clear for async. compute on Mac. #rb chris.babcock Change 3047207 on 2016/07/12 by Mark.Satterthwaite It is illegal to use a reference to an element within a TMap to initialise a new value that is to be added to the TMap as it causes heap-use-after-free. #rb chris.babcock Change 3047208 on 2016/07/12 by Mark.Satterthwaite When removing a vertex don't attempt to copy from one element beyond the end of the array to fill the last element - that's a heap-buffer-overflow and is unnecessary because that element will no longer be used. #rb chris.babcock Change 3047209 on 2016/07/12 by Mark.Satterthwaite Don't attempt to update Metal class counts if the MetalRHI is uninitalised - it will attempt to double-free the TMap. #rb chris.babcock Change 3047641 on 2016/07/13 by Lee.Clark PS4 - Improve SDK Version checking messages #rb none Change 3047663 on 2016/07/13 by Keith.Judge Orion - Various minor PS4-only things activated for XB1. #rb none Change 3047664 on 2016/07/13 by Keith.Judge XB1 - Fix analysis warning of shadowing a member variable. #rb none Change 3047784 on 2016/07/13 by Keith.Judge Xbox One - Memory and perf saving in query handling. Store 8 queries per allocation, rather than 1 so we're making the maximum use of the 256byte allocation granularity. #rb None Change 3047834 on 2016/07/13 by Keith.Judge XB1 - Release underlying memory of 3D textures when destroying them. Oops! #rb none Change 3048190 on 2016/07/13 by Josh.Adams - Now leave around the ASTC encoder input file on error, for reproing outside of the engine #rb none Change 3048256 on 2016/07/13 by Daniel.Lamb Removed warning about missing file when using cook on the fly. #rb Peter.Sauerbrei Change 3048409 on 2016/07/13 by Daniel.Lamb Improved output for saving packages in unattended builds. #rb Jonathan.Fitzpatrick Change 3048763 on 2016/07/13 by Peter.Sauerbrei switch AppleTV to tvOS in the editor #jira UE-30532 #rb michael.trepka Change 3049608 on 2016/07/14 by Keith.Judge XB1 - Optimize vertex/index buffer dynamic memory usage. #rb none Change 3049609 on 2016/07/14 by Keith.Judge Xbox One CPU Perf - Add _RenderThread versions of Lock/Unlock Texture 2D to stop more RHI thread stalls. #rb None Change 3049610 on 2016/07/14 by Keith.Judge Xbox One - Reduce latency of deferred deletions to two frames. #rb None Change 3049730 on 2016/07/14 by Keith.Judge Xbox One - Disable _RenderThread versions of Lock/Unlock Texture 2D for now as they're causing hangs. #rb None Change 3049732 on 2016/07/14 by Keith.Judge Xbox One - Add critical section to the query slot incrementing code as this wa causing a hang after running for a while as it can be done on any of the parallel rendering threads (not just the RHI thread. Also remove optimization pragmas accidentally left in. #rb none Change 3049791 on 2016/07/14 by Keith.Judge Xbox One - Made the occlusion query multithreading even more robust. Can play for ages now in a large level without a crash. #rb None Change 3049968 on 2016/07/14 by Jeremiah.Waldron Adding AndroidDisableThreadedRendering CVar and device profiles for 4 specific devices that need to have threaded rendering disabled on them due to swap buffer issues. Leaving previous checks in FAndroidMisc::AllowRenderThread as they are, but any new devices that need threaded rendering disabled should use the CVar #jira UE-24954, UE-27685, UE-20067 #rb chris.babcock Change 3050428 on 2016/07/14 by Jeremiah.Waldron Fix for application window being terminated if an AlertDialog is showing onPause Repro'd and fix tested on Samsung Galaxy Note 3 #android #jira UE-32998 #rb chris.babcock Change 3050642 on 2016/07/14 by Peter.Sauerbrei fix for invalid generated plist #rb daniel.lamb Change 3050718 on 2016/07/14 by Josh.Adams Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform) #rb none Change 3051327 on 2016/07/15 by Keith.Judge Xbox One - Save memory when locking 2D textures by only allocating a linear copy of the mip/array slice we're locking, rather than the entire mip chain. I'll do the same for 3D textures next. #rb None Change 3051346 on 2016/07/15 by Keith.Judge Xbox One - Same memory savings for UpdateTexture2D/3D. Only allocate for the mip/slice that we're updating, not the entire texture. #rb None. Change 3051530 on 2016/07/15 by Nick.Shin github: minor typo fixes #jira UE-32129 - GitHub 2513 : Update default output of HTML5 packaging #rb none Change 3053631 on 2016/07/18 by Mark.Satterthwaite Don't attempt to bind a 2D texture to the FOnePassPointShadowProjectionShaderParameters because it just won't work on Metal - instead bind the black-cube. This fixes validation errors that prevent running projects under the debugger. #codereview daniel.wright #rb josh.adams #jira UE-33350 Change 3053816 on 2016/07/18 by Mark.Satterthwaite Fixes for iOS Metal: - Depth-clip mode was erroneously exported on iOS SDK 9, it wasn't ever actually available. - Stencil texture views are only required on Mac. - State cache shouldn't suggest a render target change is required if the current state is clear and the new state is load/don't care as this breaks iOS rendering with MSAA. - Instead the debug submissions should just directly invoke submit and switch to rendering so that its SetRenderTarget call always succeeds. #rb michael.trepka Change 3053818 on 2016/07/18 by Mark.Satterthwaite Explicit casts for Metal precise::sqrt required for iOS to work with ffast-math workaround. #rb michael.trepka Change 3054426 on 2016/07/18 by Dmitry.Rekman Fix case-sensitive compilation problems (UE-33420). #codereview Olaf.Piesche #rb none Change 3054434 on 2016/07/18 by Mark.Satterthwaite Silence delete-non-virtual-dtor warnings on iOS as we do on Mac. #rb none Change 3054719 on 2016/07/18 by Jeremiah.Waldron Adding ShowHiddenAlertDialog JNI function to be called from native code after the render thread is resumed after pausing. Tested locally on Galaxy Note 3. Tested on LG G4 by nick.shin. Tested on Galaxy S6 by chris.babcock #jira UE-32998 #android #rb chris.babcock Change 3054742 on 2016/07/18 by Josh.Adams Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform) #rb none Change 3054850 on 2016/07/18 by Dmitry.Rekman Replace Fatal->Error so messagebox can be shown (UE-22818). - Incorporates PR #1714 by zaps166. #rb none #tests Tried to create an invalid context, made sure messagebox is popping up. Change 3055317 on 2016/07/19 by Lee.Clark PS4 - Fix render target memory allocation #jira UE-32988 #rb Marcus.Wassmer Change 3055682 on 2016/07/19 by Brent.Pease + Fix Debug builds by removing force inline attribute only on debug builds to prevent a warning that is treated as an error #rb michael.trepka Change 3056065 on 2016/07/19 by Josh.Adams Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform) #rb none Change 3056256 on 2016/07/19 by Chris.Babcock Add optional log spew filtering callback to Run #jira UE-33468 #ue4 #android #rb Ben.Marsh #codereview Jack.Porter Change 3056727 on 2016/07/19 by Chris.Babcock Added addition scope (plus.login) to Google Play Games builder #jira UE-33480 #ue4 #android #rb none #codereview ryan.gerleve Change 3056811 on 2016/07/19 by Jeff.Campeau Xbox One now accepts client configs. #rb none Change 3057152 on 2016/07/20 by Dmitry.Rekman Linux: use libc++ instead of libstdc++. - Needed to solve problems with third-party C++ libraries (e.g. WebRTC). - Bundled libc++ 3.8.1 (TPS cleared). - Turned off ICU compilation (needs recompile against libc++). - Some libraries (e.g. FBX sdk) still need libstdc++, so in practice it is going to be a mix. #rb none #tests Built and ran a number of Linux targets. Change 3057362 on 2016/07/20 by Keith.Judge XB1 - Fix busted merge from yesterday #rb None Change 3057647 on 2016/07/20 by Josh.Adams Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform) #rb none Change 3057655 on 2016/07/20 by Daniel.Lamb Added test cooking flag. #rb Peter.Sauerbrei #test Cook paragon. Change 3058779 on 2016/07/20 by Dmitry.Rekman Fix crash on cooker exit (UE-33583). - Global/static tickable objects could outlive the collection and trigger asserts when removing themselves from it. #rb Josh.Adams #codereview Josh.Adams, Jamie.Dale #tests Compiled and ran Linux editor. #lockdown Josh.Adams Change 3058835 on 2016/07/20 by Chris.Babcock Enable GooglePlay and GameCenter plugins by default #jira UE-33605 #ue4 #android #ios #rb mark.satterthwaite #codereview Peter.Sauerbrei #lockdown Josh.Adams Change 3058847 on 2016/07/20 by Chris.Babcock Fix Android device rule for AlcatelPixi3 #jira UE-33606 #ue4 #android #rb none #codereview Jeremiah.Walron #lockdown Josh.Adams Change 3059693 on 2016/07/21 by Josh.Adams Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform) #rb none #lockdown nick.penwarden Change 3060139 on 2016/07/21 by Chris.Babcock Fix proguard entry for Android mediaplayer tracks #jira UE-33644 #ue4 #android #rb Josh.Adams #lockdown Josh.Adams Change 3061151 on 2016/07/22 by Niklas.Smedberg Fast ASTC texture compression, using ISPC. #jira UE-32308 #rb chris.babcock #lockdown josh.adams Change 3061428 on 2016/07/22 by Peter.Sauerbrei Back out changelist 3061151 as it wasn't approved for submission #rb none #lockdown josh.adams Change 3061436 on 2016/07/22 by Lee.Clark PS4 - Back out render target mem allocation changes and put in a temp hack #jira UE-33657 #codereview Marcus.Wassmer #lockdown josh.adams #rb none [CL 3061637 by Josh Adams in Main branch]
2016-07-22 11:36:47 -04:00
UE_LOG(LogTextureFormatASTC, Display, TEXT("Compressing to ASTC (options = '%s')..."), *CompressionParameters);
// Start Compressor
#if PLATFORM_MAC
FString CompressorPath(FPaths::EngineDir() + TEXT("Binaries/ThirdParty/ARM/Mac/astcenc"));
#elif PLATFORM_LINUX
FString CompressorPath(FPaths::EngineDir() + TEXT("Binaries/ThirdParty/ARM/Linux32/astcenc"));
#elif PLATFORM_WINDOWS
FString CompressorPath(FPaths::EngineDir() + TEXT("Binaries/ThirdParty/ARM/Win32/astcenc.exe"));
#else
#error Unsupported platform
#endif
FProcHandle Proc = FPlatformProcess::CreateProc(*CompressorPath, *Params, true, false, false, NULL, -1, NULL, NULL);
// Failed to start the compressor process
if (!Proc.IsValid())
{
UE_LOG(LogTextureFormatASTC, Error, TEXT("Failed to start astcenc for compressing images (%s)"), *CompressorPath);
return false;
}
// Wait for the process to complete
int ReturnCode;
while (!FPlatformProcess::GetProcReturnCode(Proc, &ReturnCode))
{
FPlatformProcess::Sleep(0.01f);
}
// Did it work?
bool bConversionWasSuccessful = (ReturnCode == 0);
// Open compressed file and put the data in OutCompressedImage
if (bConversionWasSuccessful)
{
// Get raw file data
TArray<uint8> ASTCData;
FFileHelper::LoadFileToArray(ASTCData, *OutputFilePath);
// Process it
FASTCHeader* Header = (FASTCHeader*)ASTCData.GetData();
// Fiddle with the texel count data to get the right value
uint32 TexelCountX =
(Header->TexelCountX[0] << 0) +
(Header->TexelCountX[1] << 8) +
(Header->TexelCountX[2] << 16);
uint32 TexelCountY =
(Header->TexelCountY[0] << 0) +
(Header->TexelCountY[1] << 8) +
(Header->TexelCountY[2] << 16);
uint32 TexelCountZ =
(Header->TexelCountZ[0] << 0) +
(Header->TexelCountZ[1] << 8) +
(Header->TexelCountZ[2] << 16);
// UE_LOG(LogTextureFormatASTC, Display, TEXT(" Compressed Texture Header:"));
// UE_LOG(LogTextureFormatASTC, Display, TEXT(" Magic: %x"), Header->Magic);
// UE_LOG(LogTextureFormatASTC, Display, TEXT(" BlockSizeX: %u"), Header->BlockSizeX);
// UE_LOG(LogTextureFormatASTC, Display, TEXT(" BlockSizeY: %u"), Header->BlockSizeY);
// UE_LOG(LogTextureFormatASTC, Display, TEXT(" BlockSizeZ: %u"), Header->BlockSizeZ);
// UE_LOG(LogTextureFormatASTC, Display, TEXT(" TexelCountX: %u"), TexelCountX);
// UE_LOG(LogTextureFormatASTC, Display, TEXT(" TexelCountY: %u"), TexelCountY);
// UE_LOG(LogTextureFormatASTC, Display, TEXT(" TexelCountZ: %u"), TexelCountZ);
// Calculate size of this mip in blocks
uint32 MipSizeX = (TexelCountX + Header->BlockSizeX - 1) / Header->BlockSizeX;
uint32 MipSizeY = (TexelCountY + Header->BlockSizeY - 1) / Header->BlockSizeY;
// A block is always 16 bytes
uint32 MipSize = MipSizeX * MipSizeY * 16;
// Copy the compressed data
OutCompressedData.Empty(MipSize);
OutCompressedData.AddUninitialized(MipSize);
void* MipData = OutCompressedData.GetData();
// Calculate the offset to get to the mip data
check(sizeof(FASTCHeader) == 16);
check(ASTCData.Num() == (sizeof(FASTCHeader) + MipSize));
FMemory::Memcpy(MipData, ASTCData.GetData() + sizeof(FASTCHeader), MipSize);
Copying //UE4/Dev-Platform to Dev-Main (//UE4/Dev-Main) (Source: //UE4/Dev-Platform @ 3061622) #rb none #lockdown nick.penwarden Change 3046743 on 2016/07/12 by Mark.Satterthwaite Revert Metal workaround for AtmosphericFog rendering on Intel & AMD from 2897082 and instead change the MetalBackend to emit a precise::sqrt(max(0.0, value)) instruction instead of sqrt(value) to avoid the NaN from -ve values. This may still be technically incorrect versus D3D, but it matches the existing OpenGL appearance. #rb ben.woodhouse #jira UE-33028 Change 3046820 on 2016/07/12 by Peter.Sauerbrei PR#2594 - fix for analog input, courtesy of CleanCut #rb daniel.lamb Change 3046826 on 2016/07/12 by Peter.Sauerbrei PR#2561 - addition of code to limit architecture in required caps for IOS, courtesy of derekvanvliet #rb daniel.lamb Change 3046835 on 2016/07/12 by Peter.Sauerbrei PR#2559 - Increase the stack size on IOS and Mac, courtesy of derekvanvliet PR#2552 - Addition for Apple ReplayKit Framework, courtesy of JoshuaKaiser #rb daniel.lamb Change 3046838 on 2016/07/12 by Peter.Sauerbrei PR#2548 - Adding Log information when an unsupported audio type is used, courtesy of derekvanvliet #rb daniel.lamb Change 3046854 on 2016/07/12 by Peter.Sauerbrei PR#2547 - fix for unrecognize selector crash on iOS, couretesy of derekvanvliet PR#2384 - prevent crashes when initializing push notifications on IOS 7, courtesy of alk3ovation #rb daniel.lamb Change 3046858 on 2016/07/12 by Peter.Sauerbrei PR#2475, #1868 - fix for mapping of iOS device name, courtesy of wingedrobin, derekvanvliet PR#2567 - fix name of IPhoneSE in names array, courtesy of rohanliston #rb daniel.lamb Change 3046862 on 2016/07/12 by Peter.Sauerbrei fix for type in tooltip #jira UE-27123 #rb daniel.lamb Change 3046919 on 2016/07/12 by Daniel.Lamb Stop texture derived data from loading it's bulk data when the linker is destoryed. #rb Peter.Sauerbrei Change 3046922 on 2016/07/12 by Daniel.Lamb Updated the default cooker gc settings so that it can have more resources. Added support for cooker markup package and objects as (new flag) disregard for gc if it's still in use by the cooker. Changed the way reentry data is stored in the cooker. Cook only editor content flag in project settings now works again. #rb Josh.Adams #test cook Paragon Change 3046924 on 2016/07/12 by Daniel.Lamb Added support for encrypting ini files. Added new project setting in the editor and setting in ufe. Also added ForDistribution flag to ufe. #rb Peter.Sauerbrei Change 3046936 on 2016/07/12 by Mark.Satterthwaite Fix compute shader TLV clear for async. compute on Mac. #rb chris.babcock Change 3047207 on 2016/07/12 by Mark.Satterthwaite It is illegal to use a reference to an element within a TMap to initialise a new value that is to be added to the TMap as it causes heap-use-after-free. #rb chris.babcock Change 3047208 on 2016/07/12 by Mark.Satterthwaite When removing a vertex don't attempt to copy from one element beyond the end of the array to fill the last element - that's a heap-buffer-overflow and is unnecessary because that element will no longer be used. #rb chris.babcock Change 3047209 on 2016/07/12 by Mark.Satterthwaite Don't attempt to update Metal class counts if the MetalRHI is uninitalised - it will attempt to double-free the TMap. #rb chris.babcock Change 3047641 on 2016/07/13 by Lee.Clark PS4 - Improve SDK Version checking messages #rb none Change 3047663 on 2016/07/13 by Keith.Judge Orion - Various minor PS4-only things activated for XB1. #rb none Change 3047664 on 2016/07/13 by Keith.Judge XB1 - Fix analysis warning of shadowing a member variable. #rb none Change 3047784 on 2016/07/13 by Keith.Judge Xbox One - Memory and perf saving in query handling. Store 8 queries per allocation, rather than 1 so we're making the maximum use of the 256byte allocation granularity. #rb None Change 3047834 on 2016/07/13 by Keith.Judge XB1 - Release underlying memory of 3D textures when destroying them. Oops! #rb none Change 3048190 on 2016/07/13 by Josh.Adams - Now leave around the ASTC encoder input file on error, for reproing outside of the engine #rb none Change 3048256 on 2016/07/13 by Daniel.Lamb Removed warning about missing file when using cook on the fly. #rb Peter.Sauerbrei Change 3048409 on 2016/07/13 by Daniel.Lamb Improved output for saving packages in unattended builds. #rb Jonathan.Fitzpatrick Change 3048763 on 2016/07/13 by Peter.Sauerbrei switch AppleTV to tvOS in the editor #jira UE-30532 #rb michael.trepka Change 3049608 on 2016/07/14 by Keith.Judge XB1 - Optimize vertex/index buffer dynamic memory usage. #rb none Change 3049609 on 2016/07/14 by Keith.Judge Xbox One CPU Perf - Add _RenderThread versions of Lock/Unlock Texture 2D to stop more RHI thread stalls. #rb None Change 3049610 on 2016/07/14 by Keith.Judge Xbox One - Reduce latency of deferred deletions to two frames. #rb None Change 3049730 on 2016/07/14 by Keith.Judge Xbox One - Disable _RenderThread versions of Lock/Unlock Texture 2D for now as they're causing hangs. #rb None Change 3049732 on 2016/07/14 by Keith.Judge Xbox One - Add critical section to the query slot incrementing code as this wa causing a hang after running for a while as it can be done on any of the parallel rendering threads (not just the RHI thread. Also remove optimization pragmas accidentally left in. #rb none Change 3049791 on 2016/07/14 by Keith.Judge Xbox One - Made the occlusion query multithreading even more robust. Can play for ages now in a large level without a crash. #rb None Change 3049968 on 2016/07/14 by Jeremiah.Waldron Adding AndroidDisableThreadedRendering CVar and device profiles for 4 specific devices that need to have threaded rendering disabled on them due to swap buffer issues. Leaving previous checks in FAndroidMisc::AllowRenderThread as they are, but any new devices that need threaded rendering disabled should use the CVar #jira UE-24954, UE-27685, UE-20067 #rb chris.babcock Change 3050428 on 2016/07/14 by Jeremiah.Waldron Fix for application window being terminated if an AlertDialog is showing onPause Repro'd and fix tested on Samsung Galaxy Note 3 #android #jira UE-32998 #rb chris.babcock Change 3050642 on 2016/07/14 by Peter.Sauerbrei fix for invalid generated plist #rb daniel.lamb Change 3050718 on 2016/07/14 by Josh.Adams Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform) #rb none Change 3051327 on 2016/07/15 by Keith.Judge Xbox One - Save memory when locking 2D textures by only allocating a linear copy of the mip/array slice we're locking, rather than the entire mip chain. I'll do the same for 3D textures next. #rb None Change 3051346 on 2016/07/15 by Keith.Judge Xbox One - Same memory savings for UpdateTexture2D/3D. Only allocate for the mip/slice that we're updating, not the entire texture. #rb None. Change 3051530 on 2016/07/15 by Nick.Shin github: minor typo fixes #jira UE-32129 - GitHub 2513 : Update default output of HTML5 packaging #rb none Change 3053631 on 2016/07/18 by Mark.Satterthwaite Don't attempt to bind a 2D texture to the FOnePassPointShadowProjectionShaderParameters because it just won't work on Metal - instead bind the black-cube. This fixes validation errors that prevent running projects under the debugger. #codereview daniel.wright #rb josh.adams #jira UE-33350 Change 3053816 on 2016/07/18 by Mark.Satterthwaite Fixes for iOS Metal: - Depth-clip mode was erroneously exported on iOS SDK 9, it wasn't ever actually available. - Stencil texture views are only required on Mac. - State cache shouldn't suggest a render target change is required if the current state is clear and the new state is load/don't care as this breaks iOS rendering with MSAA. - Instead the debug submissions should just directly invoke submit and switch to rendering so that its SetRenderTarget call always succeeds. #rb michael.trepka Change 3053818 on 2016/07/18 by Mark.Satterthwaite Explicit casts for Metal precise::sqrt required for iOS to work with ffast-math workaround. #rb michael.trepka Change 3054426 on 2016/07/18 by Dmitry.Rekman Fix case-sensitive compilation problems (UE-33420). #codereview Olaf.Piesche #rb none Change 3054434 on 2016/07/18 by Mark.Satterthwaite Silence delete-non-virtual-dtor warnings on iOS as we do on Mac. #rb none Change 3054719 on 2016/07/18 by Jeremiah.Waldron Adding ShowHiddenAlertDialog JNI function to be called from native code after the render thread is resumed after pausing. Tested locally on Galaxy Note 3. Tested on LG G4 by nick.shin. Tested on Galaxy S6 by chris.babcock #jira UE-32998 #android #rb chris.babcock Change 3054742 on 2016/07/18 by Josh.Adams Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform) #rb none Change 3054850 on 2016/07/18 by Dmitry.Rekman Replace Fatal->Error so messagebox can be shown (UE-22818). - Incorporates PR #1714 by zaps166. #rb none #tests Tried to create an invalid context, made sure messagebox is popping up. Change 3055317 on 2016/07/19 by Lee.Clark PS4 - Fix render target memory allocation #jira UE-32988 #rb Marcus.Wassmer Change 3055682 on 2016/07/19 by Brent.Pease + Fix Debug builds by removing force inline attribute only on debug builds to prevent a warning that is treated as an error #rb michael.trepka Change 3056065 on 2016/07/19 by Josh.Adams Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform) #rb none Change 3056256 on 2016/07/19 by Chris.Babcock Add optional log spew filtering callback to Run #jira UE-33468 #ue4 #android #rb Ben.Marsh #codereview Jack.Porter Change 3056727 on 2016/07/19 by Chris.Babcock Added addition scope (plus.login) to Google Play Games builder #jira UE-33480 #ue4 #android #rb none #codereview ryan.gerleve Change 3056811 on 2016/07/19 by Jeff.Campeau Xbox One now accepts client configs. #rb none Change 3057152 on 2016/07/20 by Dmitry.Rekman Linux: use libc++ instead of libstdc++. - Needed to solve problems with third-party C++ libraries (e.g. WebRTC). - Bundled libc++ 3.8.1 (TPS cleared). - Turned off ICU compilation (needs recompile against libc++). - Some libraries (e.g. FBX sdk) still need libstdc++, so in practice it is going to be a mix. #rb none #tests Built and ran a number of Linux targets. Change 3057362 on 2016/07/20 by Keith.Judge XB1 - Fix busted merge from yesterday #rb None Change 3057647 on 2016/07/20 by Josh.Adams Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform) #rb none Change 3057655 on 2016/07/20 by Daniel.Lamb Added test cooking flag. #rb Peter.Sauerbrei #test Cook paragon. Change 3058779 on 2016/07/20 by Dmitry.Rekman Fix crash on cooker exit (UE-33583). - Global/static tickable objects could outlive the collection and trigger asserts when removing themselves from it. #rb Josh.Adams #codereview Josh.Adams, Jamie.Dale #tests Compiled and ran Linux editor. #lockdown Josh.Adams Change 3058835 on 2016/07/20 by Chris.Babcock Enable GooglePlay and GameCenter plugins by default #jira UE-33605 #ue4 #android #ios #rb mark.satterthwaite #codereview Peter.Sauerbrei #lockdown Josh.Adams Change 3058847 on 2016/07/20 by Chris.Babcock Fix Android device rule for AlcatelPixi3 #jira UE-33606 #ue4 #android #rb none #codereview Jeremiah.Walron #lockdown Josh.Adams Change 3059693 on 2016/07/21 by Josh.Adams Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform) #rb none #lockdown nick.penwarden Change 3060139 on 2016/07/21 by Chris.Babcock Fix proguard entry for Android mediaplayer tracks #jira UE-33644 #ue4 #android #rb Josh.Adams #lockdown Josh.Adams Change 3061151 on 2016/07/22 by Niklas.Smedberg Fast ASTC texture compression, using ISPC. #jira UE-32308 #rb chris.babcock #lockdown josh.adams Change 3061428 on 2016/07/22 by Peter.Sauerbrei Back out changelist 3061151 as it wasn't approved for submission #rb none #lockdown josh.adams Change 3061436 on 2016/07/22 by Lee.Clark PS4 - Back out render target mem allocation changes and put in a temp hack #jira UE-33657 #codereview Marcus.Wassmer #lockdown josh.adams #rb none [CL 3061637 by Josh Adams in Main branch]
2016-07-22 11:36:47 -04:00
// Delete intermediate files
IFileManager::Get().Delete(*InputFilePath);
IFileManager::Get().Delete(*OutputFilePath);
}
else
{
Copying //UE4/Dev-Platform to Dev-Main (//UE4/Dev-Main) (Source: //UE4/Dev-Platform @ 3061622) #rb none #lockdown nick.penwarden Change 3046743 on 2016/07/12 by Mark.Satterthwaite Revert Metal workaround for AtmosphericFog rendering on Intel & AMD from 2897082 and instead change the MetalBackend to emit a precise::sqrt(max(0.0, value)) instruction instead of sqrt(value) to avoid the NaN from -ve values. This may still be technically incorrect versus D3D, but it matches the existing OpenGL appearance. #rb ben.woodhouse #jira UE-33028 Change 3046820 on 2016/07/12 by Peter.Sauerbrei PR#2594 - fix for analog input, courtesy of CleanCut #rb daniel.lamb Change 3046826 on 2016/07/12 by Peter.Sauerbrei PR#2561 - addition of code to limit architecture in required caps for IOS, courtesy of derekvanvliet #rb daniel.lamb Change 3046835 on 2016/07/12 by Peter.Sauerbrei PR#2559 - Increase the stack size on IOS and Mac, courtesy of derekvanvliet PR#2552 - Addition for Apple ReplayKit Framework, courtesy of JoshuaKaiser #rb daniel.lamb Change 3046838 on 2016/07/12 by Peter.Sauerbrei PR#2548 - Adding Log information when an unsupported audio type is used, courtesy of derekvanvliet #rb daniel.lamb Change 3046854 on 2016/07/12 by Peter.Sauerbrei PR#2547 - fix for unrecognize selector crash on iOS, couretesy of derekvanvliet PR#2384 - prevent crashes when initializing push notifications on IOS 7, courtesy of alk3ovation #rb daniel.lamb Change 3046858 on 2016/07/12 by Peter.Sauerbrei PR#2475, #1868 - fix for mapping of iOS device name, courtesy of wingedrobin, derekvanvliet PR#2567 - fix name of IPhoneSE in names array, courtesy of rohanliston #rb daniel.lamb Change 3046862 on 2016/07/12 by Peter.Sauerbrei fix for type in tooltip #jira UE-27123 #rb daniel.lamb Change 3046919 on 2016/07/12 by Daniel.Lamb Stop texture derived data from loading it's bulk data when the linker is destoryed. #rb Peter.Sauerbrei Change 3046922 on 2016/07/12 by Daniel.Lamb Updated the default cooker gc settings so that it can have more resources. Added support for cooker markup package and objects as (new flag) disregard for gc if it's still in use by the cooker. Changed the way reentry data is stored in the cooker. Cook only editor content flag in project settings now works again. #rb Josh.Adams #test cook Paragon Change 3046924 on 2016/07/12 by Daniel.Lamb Added support for encrypting ini files. Added new project setting in the editor and setting in ufe. Also added ForDistribution flag to ufe. #rb Peter.Sauerbrei Change 3046936 on 2016/07/12 by Mark.Satterthwaite Fix compute shader TLV clear for async. compute on Mac. #rb chris.babcock Change 3047207 on 2016/07/12 by Mark.Satterthwaite It is illegal to use a reference to an element within a TMap to initialise a new value that is to be added to the TMap as it causes heap-use-after-free. #rb chris.babcock Change 3047208 on 2016/07/12 by Mark.Satterthwaite When removing a vertex don't attempt to copy from one element beyond the end of the array to fill the last element - that's a heap-buffer-overflow and is unnecessary because that element will no longer be used. #rb chris.babcock Change 3047209 on 2016/07/12 by Mark.Satterthwaite Don't attempt to update Metal class counts if the MetalRHI is uninitalised - it will attempt to double-free the TMap. #rb chris.babcock Change 3047641 on 2016/07/13 by Lee.Clark PS4 - Improve SDK Version checking messages #rb none Change 3047663 on 2016/07/13 by Keith.Judge Orion - Various minor PS4-only things activated for XB1. #rb none Change 3047664 on 2016/07/13 by Keith.Judge XB1 - Fix analysis warning of shadowing a member variable. #rb none Change 3047784 on 2016/07/13 by Keith.Judge Xbox One - Memory and perf saving in query handling. Store 8 queries per allocation, rather than 1 so we're making the maximum use of the 256byte allocation granularity. #rb None Change 3047834 on 2016/07/13 by Keith.Judge XB1 - Release underlying memory of 3D textures when destroying them. Oops! #rb none Change 3048190 on 2016/07/13 by Josh.Adams - Now leave around the ASTC encoder input file on error, for reproing outside of the engine #rb none Change 3048256 on 2016/07/13 by Daniel.Lamb Removed warning about missing file when using cook on the fly. #rb Peter.Sauerbrei Change 3048409 on 2016/07/13 by Daniel.Lamb Improved output for saving packages in unattended builds. #rb Jonathan.Fitzpatrick Change 3048763 on 2016/07/13 by Peter.Sauerbrei switch AppleTV to tvOS in the editor #jira UE-30532 #rb michael.trepka Change 3049608 on 2016/07/14 by Keith.Judge XB1 - Optimize vertex/index buffer dynamic memory usage. #rb none Change 3049609 on 2016/07/14 by Keith.Judge Xbox One CPU Perf - Add _RenderThread versions of Lock/Unlock Texture 2D to stop more RHI thread stalls. #rb None Change 3049610 on 2016/07/14 by Keith.Judge Xbox One - Reduce latency of deferred deletions to two frames. #rb None Change 3049730 on 2016/07/14 by Keith.Judge Xbox One - Disable _RenderThread versions of Lock/Unlock Texture 2D for now as they're causing hangs. #rb None Change 3049732 on 2016/07/14 by Keith.Judge Xbox One - Add critical section to the query slot incrementing code as this wa causing a hang after running for a while as it can be done on any of the parallel rendering threads (not just the RHI thread. Also remove optimization pragmas accidentally left in. #rb none Change 3049791 on 2016/07/14 by Keith.Judge Xbox One - Made the occlusion query multithreading even more robust. Can play for ages now in a large level without a crash. #rb None Change 3049968 on 2016/07/14 by Jeremiah.Waldron Adding AndroidDisableThreadedRendering CVar and device profiles for 4 specific devices that need to have threaded rendering disabled on them due to swap buffer issues. Leaving previous checks in FAndroidMisc::AllowRenderThread as they are, but any new devices that need threaded rendering disabled should use the CVar #jira UE-24954, UE-27685, UE-20067 #rb chris.babcock Change 3050428 on 2016/07/14 by Jeremiah.Waldron Fix for application window being terminated if an AlertDialog is showing onPause Repro'd and fix tested on Samsung Galaxy Note 3 #android #jira UE-32998 #rb chris.babcock Change 3050642 on 2016/07/14 by Peter.Sauerbrei fix for invalid generated plist #rb daniel.lamb Change 3050718 on 2016/07/14 by Josh.Adams Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform) #rb none Change 3051327 on 2016/07/15 by Keith.Judge Xbox One - Save memory when locking 2D textures by only allocating a linear copy of the mip/array slice we're locking, rather than the entire mip chain. I'll do the same for 3D textures next. #rb None Change 3051346 on 2016/07/15 by Keith.Judge Xbox One - Same memory savings for UpdateTexture2D/3D. Only allocate for the mip/slice that we're updating, not the entire texture. #rb None. Change 3051530 on 2016/07/15 by Nick.Shin github: minor typo fixes #jira UE-32129 - GitHub 2513 : Update default output of HTML5 packaging #rb none Change 3053631 on 2016/07/18 by Mark.Satterthwaite Don't attempt to bind a 2D texture to the FOnePassPointShadowProjectionShaderParameters because it just won't work on Metal - instead bind the black-cube. This fixes validation errors that prevent running projects under the debugger. #codereview daniel.wright #rb josh.adams #jira UE-33350 Change 3053816 on 2016/07/18 by Mark.Satterthwaite Fixes for iOS Metal: - Depth-clip mode was erroneously exported on iOS SDK 9, it wasn't ever actually available. - Stencil texture views are only required on Mac. - State cache shouldn't suggest a render target change is required if the current state is clear and the new state is load/don't care as this breaks iOS rendering with MSAA. - Instead the debug submissions should just directly invoke submit and switch to rendering so that its SetRenderTarget call always succeeds. #rb michael.trepka Change 3053818 on 2016/07/18 by Mark.Satterthwaite Explicit casts for Metal precise::sqrt required for iOS to work with ffast-math workaround. #rb michael.trepka Change 3054426 on 2016/07/18 by Dmitry.Rekman Fix case-sensitive compilation problems (UE-33420). #codereview Olaf.Piesche #rb none Change 3054434 on 2016/07/18 by Mark.Satterthwaite Silence delete-non-virtual-dtor warnings on iOS as we do on Mac. #rb none Change 3054719 on 2016/07/18 by Jeremiah.Waldron Adding ShowHiddenAlertDialog JNI function to be called from native code after the render thread is resumed after pausing. Tested locally on Galaxy Note 3. Tested on LG G4 by nick.shin. Tested on Galaxy S6 by chris.babcock #jira UE-32998 #android #rb chris.babcock Change 3054742 on 2016/07/18 by Josh.Adams Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform) #rb none Change 3054850 on 2016/07/18 by Dmitry.Rekman Replace Fatal->Error so messagebox can be shown (UE-22818). - Incorporates PR #1714 by zaps166. #rb none #tests Tried to create an invalid context, made sure messagebox is popping up. Change 3055317 on 2016/07/19 by Lee.Clark PS4 - Fix render target memory allocation #jira UE-32988 #rb Marcus.Wassmer Change 3055682 on 2016/07/19 by Brent.Pease + Fix Debug builds by removing force inline attribute only on debug builds to prevent a warning that is treated as an error #rb michael.trepka Change 3056065 on 2016/07/19 by Josh.Adams Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform) #rb none Change 3056256 on 2016/07/19 by Chris.Babcock Add optional log spew filtering callback to Run #jira UE-33468 #ue4 #android #rb Ben.Marsh #codereview Jack.Porter Change 3056727 on 2016/07/19 by Chris.Babcock Added addition scope (plus.login) to Google Play Games builder #jira UE-33480 #ue4 #android #rb none #codereview ryan.gerleve Change 3056811 on 2016/07/19 by Jeff.Campeau Xbox One now accepts client configs. #rb none Change 3057152 on 2016/07/20 by Dmitry.Rekman Linux: use libc++ instead of libstdc++. - Needed to solve problems with third-party C++ libraries (e.g. WebRTC). - Bundled libc++ 3.8.1 (TPS cleared). - Turned off ICU compilation (needs recompile against libc++). - Some libraries (e.g. FBX sdk) still need libstdc++, so in practice it is going to be a mix. #rb none #tests Built and ran a number of Linux targets. Change 3057362 on 2016/07/20 by Keith.Judge XB1 - Fix busted merge from yesterday #rb None Change 3057647 on 2016/07/20 by Josh.Adams Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform) #rb none Change 3057655 on 2016/07/20 by Daniel.Lamb Added test cooking flag. #rb Peter.Sauerbrei #test Cook paragon. Change 3058779 on 2016/07/20 by Dmitry.Rekman Fix crash on cooker exit (UE-33583). - Global/static tickable objects could outlive the collection and trigger asserts when removing themselves from it. #rb Josh.Adams #codereview Josh.Adams, Jamie.Dale #tests Compiled and ran Linux editor. #lockdown Josh.Adams Change 3058835 on 2016/07/20 by Chris.Babcock Enable GooglePlay and GameCenter plugins by default #jira UE-33605 #ue4 #android #ios #rb mark.satterthwaite #codereview Peter.Sauerbrei #lockdown Josh.Adams Change 3058847 on 2016/07/20 by Chris.Babcock Fix Android device rule for AlcatelPixi3 #jira UE-33606 #ue4 #android #rb none #codereview Jeremiah.Walron #lockdown Josh.Adams Change 3059693 on 2016/07/21 by Josh.Adams Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform) #rb none #lockdown nick.penwarden Change 3060139 on 2016/07/21 by Chris.Babcock Fix proguard entry for Android mediaplayer tracks #jira UE-33644 #ue4 #android #rb Josh.Adams #lockdown Josh.Adams Change 3061151 on 2016/07/22 by Niklas.Smedberg Fast ASTC texture compression, using ISPC. #jira UE-32308 #rb chris.babcock #lockdown josh.adams Change 3061428 on 2016/07/22 by Peter.Sauerbrei Back out changelist 3061151 as it wasn't approved for submission #rb none #lockdown josh.adams Change 3061436 on 2016/07/22 by Lee.Clark PS4 - Back out render target mem allocation changes and put in a temp hack #jira UE-33657 #codereview Marcus.Wassmer #lockdown josh.adams #rb none [CL 3061637 by Josh Adams in Main branch]
2016-07-22 11:36:47 -04:00
UE_LOG(LogTextureFormatASTC, Error, TEXT("ASTC encoder failed with return code %d, mip size (%d, %d). Leaving '%s' for testing."), ReturnCode, SizeX, SizeY, *InputFilePath);
// IFileManager::Get().Delete(*InputFilePath);
// IFileManager::Get().Delete(*OutputFilePath);
return false;
}
// Delete intermediate files
IFileManager::Get().Delete(*InputFilePath);
IFileManager::Get().Delete(*OutputFilePath);
return true;
}
/**
* ASTC texture format handler.
*/
class FTextureFormatASTC : public ITextureFormat
{
virtual bool AllowParallelBuild() const override
{
return true;
}
virtual uint16 GetVersion(FName Format) const override
{
return GetQualityVersion() + BASE_FORMAT_VERSION;
}
// // Since we want to have per texture [group] compression settings, we need to have the key based on the texture
// virtual FString GetDerivedDataKeyString(const class UTexture& Texture) const override
// {
// const int32 LODBias = UDeviceProfileManager::Get().GetActiveProfile()->GetTextureLODSettings()->CalculateLODBias(Texture.Source.GetSizeX(), Texture.Source.GetSizeY(), Texture.LODGroup, Texture.LODBias, Texture.NumCinematicMipLevels, Texture.MipGenSettings);
// check(LODBias >= 0);
// return FString::Printf(TEXT("%02u%d_"), (uint32)LODBias, CVarVirtualTextureReducedMemoryEnabled->GetValueOnGameThread());
// }
virtual FTextureFormatCompressorCaps GetFormatCapabilities() const override
{
FTextureFormatCompressorCaps RetCaps;
// use defaults
return RetCaps;
}
virtual void GetSupportedFormats(TArray<FName>& OutFormats) const override
{
for (int32 i = 0; i < ARRAY_COUNT(GSupportedTextureFormatNames); ++i)
{
OutFormats.Add(GSupportedTextureFormatNames[i]);
}
}
virtual bool CompressImage(
const FImage& InImage,
const struct FTextureBuildSettings& BuildSettings,
bool bImageHasAlphaChannel,
FCompressedImage2D& OutCompressedImage
) const override
{
// Get Raw Image Data from passed in FImage
FImage Image;
InImage.CopyTo(Image, ERawImageFormat::BGRA8, BuildSettings.GetGammaSpace());
// Determine the compressed pixel format and compression parameters
EPixelFormat CompressedPixelFormat = PF_Unknown;
FString CompressionParameters = TEXT("");
if (BuildSettings.TextureFormatName == GTextureFormatNameASTC_RGB ||
((BuildSettings.TextureFormatName == GTextureFormatNameASTC_RGBAuto) && !bImageHasAlphaChannel))
{
CompressedPixelFormat = GetQualityFormat();
CompressionParameters = FString::Printf(TEXT("%s %s -esw bgra -ch 1 1 1 0"), *GetQualityString(), /*BuildSettings.bSRGB ? TEXT("-srgb") :*/ TEXT("") );
}
else if (BuildSettings.TextureFormatName == GTextureFormatNameASTC_RGBA ||
((BuildSettings.TextureFormatName == GTextureFormatNameASTC_RGBAuto) && bImageHasAlphaChannel))
{
CompressedPixelFormat = GetQualityFormat();
Copying //UE4/Dev-Mobile to Dev-Main (//UE4/Dev-Main) @2911599 #lockdown nick.penwarden ========================== MAJOR FEATURES + CHANGES ========================== Change 2854295 on 2016/02/03 by Gareth.Martin@gareth.martin Added support for Landscape grass to use the landscape's light/shadow maps (original github pull request #1798 by Frugality) Change 2875167 on 2016/02/21 by Rolando.Caloca@Home_DM DM - glslang Change 2875650 on 2016/02/22 by Rolando.Caloca@rolando.caloca_T3903_DM DM - Common RHI changes Change 2876429 on 2016/02/22 by Rolando.Caloca@rolando.caloca_T3903_DM DM - Initial rhi check-in. Tappy & SunTemple working on PC. #codereview Jack.Porter, Chris.Babcock, Josh.Adams Change 2876665 on 2016/02/22 by Rolando.Caloca@rolando.caloca_T3903_DM DM - Split Immediate command list off RHI Change 2881242 on 2016/02/25 by Jack.Porter@Jack.Porter_UE4_Stream changes to exclude LPV shaders from Vulkan (reapplied with edit instead of integrate records) Change 2881356 on 2016/02/25 by Jack.Porter@Jack.Porter_UE4_Stream Static shadowing + dynamic-object CSM Change 2881359 on 2016/02/25 by Jack.Porter@Jack.Porter_UE4_Stream Mobile GPU particles Change 2881360 on 2016/02/25 by Jack.Porter@Jack.Porter_UE4_Stream Planar reflections very WIP Change 2881363 on 2016/02/25 by Jack.Porter@Jack.Porter_UE4_Stream Separate Translucency very WIP Change 2881365 on 2016/02/25 by Jack.Porter@Jack.Porter_UE4_Stream ProtoStar engine changes Change 2881371 on 2016/02/25 by Jack.Porter@Jack.Porter_UE4_Stream HACK for Max Texture Samplers hardcoded to 8 on ES2 Should be cleaned up better with UE-24419. Change 2884295 on 2016/02/26 by Rolando.Caloca@rolando.caloca_T3903_DM DM - Integrate pipeline cache Change 2887043 on 2016/02/29 by Rolando.Caloca@Home_DM DM - Initial CCT support Change 2887572 on 2016/03/01 by Rolando.Caloca@rolando.caloca_T3903_DM DM - Empty bound shader states cache - Only used currently on Vulkan Change 2889114 on 2016/03/01 by Rolando.Caloca@Home_DM DM - Added GRHINeedsExtraDeletionLatency from 4.11 Change 2889115 on 2016/03/01 by Rolando.Caloca@Home_DM DM - Remove batched elements quads (was not been used at least since UE3!) Change 2895373 on 2016/03/04 by Rolando.Caloca@rolando.caloca_T3903_DM DM - Fence mgr (disabled) Change 2898926 on 2016/03/08 by Rolando.Caloca@rolando.caloca_T3903_DM DM - Resource management (disabled) Change 2899937 on 2016/03/08 by Rolando.Caloca@rolando.caloca_T3903_DM DM - Expand number of stencil op bits Change 2901132 on 2016/03/09 by Rolando.Caloca@rolando.caloca_T3903_DM DM - Add support for more MaxSimultaneousRenderTargets Change 2903074 on 2016/03/10 by Rolando.Caloca@rolando.caloca_T3903_DM DM - Support for 3d staging textures Change 2903211 on 2016/03/10 by Jack.Porter@Jack.Porter_UE4_Stream Vulkan RHI stub for new SharedResourceView RHI call Change 2904014 on 2016/03/10 by Rolando.Caloca@rolando.caloca_T3903_DM DM - SM4 preq Change 2905389 on 2016/03/11 by Jack.Porter@Jack.Porter_UE4_Stream Android Vulkan support initial checkin Change 2908458 on 2016/03/14 by Allan.Bentham@Dev-Mobile Reinstate vertex fog, fixes UE-28166 Change 2910294 on 2016/03/15 by Rolando.Caloca@rolando.caloca_T3903_DM DM - Use fence manager Change 2910801 on 2016/03/15 by Rolando.Caloca@rolando.caloca_T3903_DM DM - Descriptor pool [CL 2912606 by Peter Sauerbrei in Main branch]
2016-03-16 21:16:51 -04:00
CompressionParameters = FString::Printf(TEXT("%s %s -esw bgra -ch 1 1 1 1"), *GetQualityString(), /*BuildSettings.bSRGB ? TEXT("-srgb") :*/ TEXT("") );
}
else if (BuildSettings.TextureFormatName == GTextureFormatNameASTC_NormalAG)
{
CompressedPixelFormat = GetQualityFormat(FORCED_NORMAL_MAP_COMPRESSION_SIZE_VALUE);
CompressionParameters = FString::Printf(TEXT("%s -esw 0g0b -ch 0 1 0 1 -oplimit 1000 -mincorrel 0.99 -dblimit 60 -b 2.5 -v 3 1 1 0 50 0 -va 1 1 0 50"), *GetQualityString(FORCED_NORMAL_MAP_COMPRESSION_SIZE_VALUE, -1));
}
else if (BuildSettings.TextureFormatName == GTextureFormatNameASTC_NormalRG)
{
CompressedPixelFormat = GetQualityFormat(FORCED_NORMAL_MAP_COMPRESSION_SIZE_VALUE);
CompressionParameters = FString::Printf(TEXT("%s -esw bg00 -ch 1 1 0 0 -oplimit 1000 -mincorrel 0.99 -dblimit 60 -b 2.5 -v 3 1 1 0 50 0 -va 1 1 0 50"), *GetQualityString(FORCED_NORMAL_MAP_COMPRESSION_SIZE_VALUE, -1));
}
// Compress the image, slice by slice
bool bCompressionSucceeded = true;
int32 SliceSizeInTexels = Image.SizeX * Image.SizeY;
for (int32 SliceIndex = 0; SliceIndex < Image.NumSlices && bCompressionSucceeded; ++SliceIndex)
{
TArray<uint8> CompressedSliceData;
bCompressionSucceeded = CompressSliceToASTC(
Image.AsBGRA8() + (SliceIndex * SliceSizeInTexels),
Image.SizeX,
Image.SizeY,
CompressionParameters,
CompressedSliceData
);
OutCompressedImage.RawData.Append(CompressedSliceData);
}
if (bCompressionSucceeded)
{
OutCompressedImage.SizeX = Image.SizeX;
OutCompressedImage.SizeY = Image.SizeY;
OutCompressedImage.PixelFormat = CompressedPixelFormat;
}
return bCompressionSucceeded;
}
};
/**
* Module for ASTC texture compression.
*/
static ITextureFormat* Singleton = NULL;
class FTextureFormatASTCModule : public ITextureFormatModule
{
public:
virtual ~FTextureFormatASTCModule()
{
delete Singleton;
Singleton = NULL;
}
virtual ITextureFormat* GetTextureFormat()
{
if (!Singleton)
{
Singleton = new FTextureFormatASTC();
}
return Singleton;
}
};
IMPLEMENT_MODULE(FTextureFormatASTCModule, TextureFormatASTC);