2016-01-07 08:17:16 -05:00
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
2014-03-14 14:13:41 -04:00
# include "Core.h"
# include "ImageCore.h"
# include "ModuleInterface.h"
# include "ModuleManager.h"
# include "TargetPlatform.h"
# include "TextureCompressorModule.h"
# include "PixelFormat.h"
# include "nvtt/nvtt.h"
# include "IConsoleManager.h"
DEFINE_LOG_CATEGORY_STATIC ( LogTextureFormatDXT , Log , All ) ;
/**
* Macro trickery for supported format names .
*/
# define ENUM_SUPPORTED_FORMATS(op) \
op ( DXT1 ) \
op ( DXT3 ) \
op ( DXT5 ) \
op ( AutoDXT ) \
op ( DXT5n ) \
op ( BC4 ) \
op ( BC5 )
# 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
/**
* NVTT output handler .
*/
struct FNVOutputHandler : public nvtt : : OutputHandler
{
explicit FNVOutputHandler ( uint8 * InBuffer , int32 InBufferSize )
: Buffer ( InBuffer )
, BufferEnd ( InBuffer + InBufferSize )
{
}
~ FNVOutputHandler ( )
{
}
virtual void beginImage ( int size , int width , int height , int depth , int face , int miplevel )
{
}
2014-10-01 14:45:23 -04:00
virtual bool writeData ( const void * data , int size )
2014-03-14 14:13:41 -04:00
{
check ( data ) ;
check ( Buffer + size < = BufferEnd ) ;
FMemory : : Memcpy ( Buffer , data , size ) ;
Buffer + = size ;
return true ;
}
2014-07-08 00:06:17 -04:00
virtual void endImage ( )
{
}
2014-03-14 14:13:41 -04:00
uint8 * Buffer ;
uint8 * BufferEnd ;
} ;
/**
* NVTT error handler .
*/
struct FNVErrorHandler : public nvtt : : ErrorHandler
{
FNVErrorHandler ( ) :
bSuccess ( true )
{ }
virtual void error ( nvtt : : Error e )
{
UE_LOG ( LogTextureFormatDXT , Warning , TEXT ( " nvtt::compress() failed with error '%s' " ) , ANSI_TO_TCHAR ( nvtt : : errorString ( e ) ) ) ;
bSuccess = false ;
}
bool bSuccess ;
} ;
/** Critical section to isolate construction of nvtt objects */
FCriticalSection GNVCompressionCriticalSection ;
/**
* All state objects needed for NVTT .
*/
class FNVTTCompressor
{
FNVOutputHandler OutputHandler ;
FNVErrorHandler ErrorHandler ;
nvtt : : InputOptions InputOptions ;
nvtt : : CompressionOptions CompressionOptions ;
nvtt : : OutputOptions OutputOptions ;
nvtt : : Compressor Compressor ;
public :
/** Initialization constructor. */
FNVTTCompressor (
const void * SourceData ,
EPixelFormat PixelFormat ,
int32 SizeX ,
int32 SizeY ,
bool bSRGB ,
bool bIsNormalMap ,
uint8 * OutBuffer ,
Copying //UE4/Orion-Staging (Orion Main @ CL-2792706 to //UE4/Main
==========================
MAJOR FEATURES + CHANGES
==========================
Change 2792706 on 2015/12/07 by Terence.Burns
Rebuild lightmaps automation changes
- Sync and Build binary files for execution
- Much improved error handling
- Email notification support added.
#Note - This should massively simplify the batch script we use to rebuild lightmaps.
#rb none
#Tests Run the RebuildLightmaps commandlet many times to ensure it runs and errors correctly.
Change 2791950 on 2015/12/05 by Matt.Kuhlenschmidt
Added settings to toggle on and off display of Ping and FPS values.
Server FPS will be disabled before ship
#rb none #test pc/ps4 golden path, pie
Change 2791827 on 2015/12/05 by Marcus.Wassmer
Fix texture memory leak. Fixes automation using too much memory.
#rb Brad.Angelcyk
#codereview bob.ferreira
#test automation runs, editor.
Change 2791313 on 2015/12/04 by Martin.Mittring
fixed PS4 compiling
#rb:Michael.Noland
#test:not
Change 2791014 on 2015/12/04 by Martin.Mittring
nicer cvar help for r.PS4ContinuousSubmits
#rb:Olaf.Piesche
#code_review:Marcus.Wassmer
#test:PC
Change 2791011 on 2015/12/04 by Martin.Mittring
fixed compile error when disabling ENABLE_TEXTURE_TRACKING
#rb:Olaf.Piesche
#test:run Paragon on PC
Change 2790848 on 2015/12/04 by Martin.Mittring
missing changes
nicer cvar help, optimized unneccessary referencecounting, removed redundant code
#rb:Olaf.Piesche
#test:PC Paragon
Change 2790840 on 2015/12/04 by Martin.Mittring
nicer cvar help, optimized unneccessary referencecounting, removed redundant code
#rb:Olaf.Piesche
#test:PC Paragon
Change 2791585 on 2015/12/04 by Michael.Noland
Rendering: Added a more actionable error message to a check() failure for a FStaticLightingMesh that has already been processed when building lighting in a map that contains HLOD
#rb None
#tests Built lighting in a map that was crashing at this check() and verified that the message indicated the problematic mesh
Change 2791244 on 2015/12/04 by Ryan.Brucks
Submitting all my Paragon Content before the new Agora Branch.
Change 2791240 on 2015/12/04 by Marcus.Wassmer
Bump to .061 patch and new pub tools to pass cert
#rb non
#test compile ps4
Change 2791132 on 2015/12/04 by ryan.brucks
RenderToTextureMacros: fixed issue with polygon index being +1 on accident
Change 2790747 on 2015/12/04 by Terence.Burns
Rebuild Lightmaps Automation Script - Adding the -unattended switch for build machines.
#rb None
#tests Run through the Rebuild Lightmaps UAT script process.
Change 2790589 on 2015/12/04 by Bart.Bressler
- Invite PS4 friend option for add party member button now works properly, also fixes crash. Fixes OR-10359.
#rb sam.zamani
#tests invited ps4 player using Invite PS4 Friend option, confirmed that player joined mcp party and ps4 session
Change 2790418 on 2015/12/04 by James.Golding
Roll back HLOD lightmap UV change, Oz reporting issues when building lighting, need more investigation
#rb none
#tests none
Change 2790333 on 2015/12/04 by James.Golding
Add fallback to FMeshUtilities::PropagatePaintedColorsToRawMesh when mesh has been reduced in engine and WedgeMap is missing
#rb martin.wilson
#codereview jurre.debaare
#tests Built HLOD meshes in the editor
Change 2790292 on 2015/12/04 by Olaf.Piesche
Free the new particle array at the beginning of the tick for each instance; that way, even if we're not rendering the array will be cleared and we don't keep injecting new particles that never get killed until rendering resumes
#rb marcus.wassmer
#tests Editor, PIE
Change 2790003 on 2015/12/04 by James.Golding
Fix possible crash in ALODActor::RemoveSubActor
#rb keith.judge
#codereview jurre.debaare
#tests Generated HLOD proxy in editor
Change 2789998 on 2015/12/04 by James.Golding
2015-12-08 09:25:02 -05:00
int32 BufferSize ,
bool bPreview = false )
2014-03-14 14:13:41 -04:00
: OutputHandler ( OutBuffer , BufferSize )
{
// CUDA acceleration currently disabled, needs more robust error handling
// With one core of a Xeon 3GHz CPU, compressing a 2048^2 normal map to DXT1 with NVTT 2.0.4 takes 7.49s.
// With the same settings but using CUDA and a Geforce 8800 GTX it takes 1.66s.
// To use CUDA, a CUDA 2.0 capable driver is required (178.08 or greater) and a Geforce 8 or higher.
const bool bUseCUDAAcceleration = false ;
// DXT1a support is currently not exposed.
const bool bSupportDXT1a = false ;
// Quality level is hardcoded to production quality for now.
Copying //UE4/Orion-Staging (Orion Main @ CL-2792706 to //UE4/Main
==========================
MAJOR FEATURES + CHANGES
==========================
Change 2792706 on 2015/12/07 by Terence.Burns
Rebuild lightmaps automation changes
- Sync and Build binary files for execution
- Much improved error handling
- Email notification support added.
#Note - This should massively simplify the batch script we use to rebuild lightmaps.
#rb none
#Tests Run the RebuildLightmaps commandlet many times to ensure it runs and errors correctly.
Change 2791950 on 2015/12/05 by Matt.Kuhlenschmidt
Added settings to toggle on and off display of Ping and FPS values.
Server FPS will be disabled before ship
#rb none #test pc/ps4 golden path, pie
Change 2791827 on 2015/12/05 by Marcus.Wassmer
Fix texture memory leak. Fixes automation using too much memory.
#rb Brad.Angelcyk
#codereview bob.ferreira
#test automation runs, editor.
Change 2791313 on 2015/12/04 by Martin.Mittring
fixed PS4 compiling
#rb:Michael.Noland
#test:not
Change 2791014 on 2015/12/04 by Martin.Mittring
nicer cvar help for r.PS4ContinuousSubmits
#rb:Olaf.Piesche
#code_review:Marcus.Wassmer
#test:PC
Change 2791011 on 2015/12/04 by Martin.Mittring
fixed compile error when disabling ENABLE_TEXTURE_TRACKING
#rb:Olaf.Piesche
#test:run Paragon on PC
Change 2790848 on 2015/12/04 by Martin.Mittring
missing changes
nicer cvar help, optimized unneccessary referencecounting, removed redundant code
#rb:Olaf.Piesche
#test:PC Paragon
Change 2790840 on 2015/12/04 by Martin.Mittring
nicer cvar help, optimized unneccessary referencecounting, removed redundant code
#rb:Olaf.Piesche
#test:PC Paragon
Change 2791585 on 2015/12/04 by Michael.Noland
Rendering: Added a more actionable error message to a check() failure for a FStaticLightingMesh that has already been processed when building lighting in a map that contains HLOD
#rb None
#tests Built lighting in a map that was crashing at this check() and verified that the message indicated the problematic mesh
Change 2791244 on 2015/12/04 by Ryan.Brucks
Submitting all my Paragon Content before the new Agora Branch.
Change 2791240 on 2015/12/04 by Marcus.Wassmer
Bump to .061 patch and new pub tools to pass cert
#rb non
#test compile ps4
Change 2791132 on 2015/12/04 by ryan.brucks
RenderToTextureMacros: fixed issue with polygon index being +1 on accident
Change 2790747 on 2015/12/04 by Terence.Burns
Rebuild Lightmaps Automation Script - Adding the -unattended switch for build machines.
#rb None
#tests Run through the Rebuild Lightmaps UAT script process.
Change 2790589 on 2015/12/04 by Bart.Bressler
- Invite PS4 friend option for add party member button now works properly, also fixes crash. Fixes OR-10359.
#rb sam.zamani
#tests invited ps4 player using Invite PS4 Friend option, confirmed that player joined mcp party and ps4 session
Change 2790418 on 2015/12/04 by James.Golding
Roll back HLOD lightmap UV change, Oz reporting issues when building lighting, need more investigation
#rb none
#tests none
Change 2790333 on 2015/12/04 by James.Golding
Add fallback to FMeshUtilities::PropagatePaintedColorsToRawMesh when mesh has been reduced in engine and WedgeMap is missing
#rb martin.wilson
#codereview jurre.debaare
#tests Built HLOD meshes in the editor
Change 2790292 on 2015/12/04 by Olaf.Piesche
Free the new particle array at the beginning of the tick for each instance; that way, even if we're not rendering the array will be cleared and we don't keep injecting new particles that never get killed until rendering resumes
#rb marcus.wassmer
#tests Editor, PIE
Change 2790003 on 2015/12/04 by James.Golding
Fix possible crash in ALODActor::RemoveSubActor
#rb keith.judge
#codereview jurre.debaare
#tests Generated HLOD proxy in editor
Change 2789998 on 2015/12/04 by James.Golding
2015-12-08 09:25:02 -05:00
const nvtt : : Quality QualityLevel = bPreview ? nvtt : : Quality_Fastest : nvtt : : Quality_Production ;
2014-03-14 14:13:41 -04:00
nvtt : : Format TextureFormat = nvtt : : Format_DXT1 ;
if ( PixelFormat = = PF_DXT1 )
{
TextureFormat = bSupportDXT1a ? nvtt : : Format_DXT1a : nvtt : : Format_DXT1 ;
}
else if ( PixelFormat = = PF_DXT3 )
{
TextureFormat = nvtt : : Format_DXT3 ;
}
else if ( PixelFormat = = PF_DXT5 & & bIsNormalMap )
{
TextureFormat = nvtt : : Format_DXT5n ;
}
else if ( PixelFormat = = PF_DXT5 )
{
TextureFormat = nvtt : : Format_DXT5 ;
}
else if ( PixelFormat = = PF_B8G8R8A8 )
{
TextureFormat = nvtt : : Format_RGBA ;
}
else if ( PixelFormat = = PF_BC4 )
{
TextureFormat = nvtt : : Format_BC4 ;
}
else if ( PixelFormat = = PF_BC5 )
{
TextureFormat = nvtt : : Format_BC5 ;
}
else
{
UE_LOG ( LogTextureFormatDXT , Fatal ,
TEXT ( " Unsupported EPixelFormat for compression: %u " ) ,
( uint32 ) PixelFormat
) ;
}
InputOptions . setTextureLayout ( nvtt : : TextureType_2D , SizeX , SizeY ) ;
// Not generating mips with NVTT, we will pass each mip in and compress it individually
InputOptions . setMipmapGeneration ( false , - 1 ) ;
verify ( InputOptions . setMipmapData ( SourceData , SizeX , SizeY ) ) ;
if ( bSRGB )
{
InputOptions . setGamma ( 2.2f , 2.2f ) ;
}
else
{
InputOptions . setGamma ( 1.0f , 1.0f ) ;
}
// Only used for mip and normal map generation
InputOptions . setWrapMode ( nvtt : : WrapMode_Mirror ) ;
InputOptions . setFormat ( nvtt : : InputFormat_BGRA_8UB ) ;
// Highest quality is 2x slower with only a small visual difference
// Might be worthwhile for normal maps though
CompressionOptions . setQuality ( QualityLevel ) ;
CompressionOptions . setFormat ( TextureFormat ) ;
if ( bIsNormalMap )
{
// For BC5 normal maps we don't care about the blue channel.
CompressionOptions . setColorWeights ( 1.0f , 1.0f , 0.0f ) ;
// Don't tell NVTT it's a normal map. It was producing noticeable artifacts during BC5 compression.
//InputOptions.setNormalMap(true);
}
else
{
CompressionOptions . setColorWeights ( 1 , 1 , 1 ) ;
}
Compressor . enableCudaAcceleration ( bUseCUDAAcceleration ) ;
//OutputHandler.ReserveMemory( Compressor.estimateSize(InputOptions, CompressionOptions) );
check ( OutputHandler . BufferEnd - OutputHandler . Buffer < = Compressor . estimateSize ( InputOptions , CompressionOptions ) ) ;
// We're not outputting a dds file so disable the header
OutputOptions . setOutputHeader ( false ) ;
OutputOptions . setOutputHandler ( & OutputHandler ) ;
OutputOptions . setErrorHandler ( & ErrorHandler ) ;
}
/** Run the compressor. */
bool Compress ( )
{
return Compressor . process ( InputOptions , CompressionOptions , OutputOptions ) & & ErrorHandler . bSuccess ;
}
} ;
/**
* Asynchronous NVTT worker .
*/
class FAsyncNVTTWorker : public FNonAbandonableTask
{
public :
/**
* Initializes the data and creates the async compression task .
*/
FAsyncNVTTWorker ( FNVTTCompressor * InCompressor )
: Compressor ( InCompressor )
{
check ( Compressor ) ;
}
/** Compresses the texture. */
void DoWork ( )
{
bCompressionResults = Compressor - > Compress ( ) ;
}
2015-02-16 03:16:32 -05:00
FORCEINLINE TStatId GetStatId ( ) const
2014-03-14 14:13:41 -04:00
{
2015-02-16 03:16:32 -05:00
RETURN_QUICK_DECLARE_CYCLE_STAT ( FAsyncNVTTWorker , STATGROUP_ThreadPoolAsyncTasks ) ;
2014-03-14 14:13:41 -04:00
}
/** Retrieve compression results. */
bool GetCompressionResults ( ) const { return bCompressionResults ; }
private :
/** The NVTT compressor. */
FNVTTCompressor * Compressor ;
/** true if compression was successful. */
bool bCompressionResults ;
} ;
typedef FAsyncTask < FAsyncNVTTWorker > FAsyncNVTTTask ;
namespace CompressionSettings
{
int32 BlocksPerBatch = 2048 ;
FAutoConsoleVariableRef BlocksPerBatch_CVar (
TEXT ( " Tex.AsyncDXTBlocksPerBatch " ) ,
BlocksPerBatch ,
TEXT ( " The number of blocks to compress in parallel for DXT compression. " )
) ;
}
/**
* Compresses an image using NVTT .
* @ param SourceData Source texture data to DXT compress , in BGRA 8 bit per channel unsigned format .
* @ param PixelFormat Texture format
* @ param SizeX Number of texels along the X - axis
* @ param SizeY Number of texels along the Y - axis
* @ param bSRGB Whether the texture is in SRGB space
* @ param bIsNormalMap Whether the texture is a normal map
* @ param OutCompressedData Compressed image data output by nvtt .
*/
static bool CompressImageUsingNVTT (
const void * SourceData ,
EPixelFormat PixelFormat ,
int32 SizeX ,
int32 SizeY ,
bool bSRGB ,
bool bIsNormalMap ,
Copying //UE4/Orion-Staging (Orion Main @ CL-2792706 to //UE4/Main
==========================
MAJOR FEATURES + CHANGES
==========================
Change 2792706 on 2015/12/07 by Terence.Burns
Rebuild lightmaps automation changes
- Sync and Build binary files for execution
- Much improved error handling
- Email notification support added.
#Note - This should massively simplify the batch script we use to rebuild lightmaps.
#rb none
#Tests Run the RebuildLightmaps commandlet many times to ensure it runs and errors correctly.
Change 2791950 on 2015/12/05 by Matt.Kuhlenschmidt
Added settings to toggle on and off display of Ping and FPS values.
Server FPS will be disabled before ship
#rb none #test pc/ps4 golden path, pie
Change 2791827 on 2015/12/05 by Marcus.Wassmer
Fix texture memory leak. Fixes automation using too much memory.
#rb Brad.Angelcyk
#codereview bob.ferreira
#test automation runs, editor.
Change 2791313 on 2015/12/04 by Martin.Mittring
fixed PS4 compiling
#rb:Michael.Noland
#test:not
Change 2791014 on 2015/12/04 by Martin.Mittring
nicer cvar help for r.PS4ContinuousSubmits
#rb:Olaf.Piesche
#code_review:Marcus.Wassmer
#test:PC
Change 2791011 on 2015/12/04 by Martin.Mittring
fixed compile error when disabling ENABLE_TEXTURE_TRACKING
#rb:Olaf.Piesche
#test:run Paragon on PC
Change 2790848 on 2015/12/04 by Martin.Mittring
missing changes
nicer cvar help, optimized unneccessary referencecounting, removed redundant code
#rb:Olaf.Piesche
#test:PC Paragon
Change 2790840 on 2015/12/04 by Martin.Mittring
nicer cvar help, optimized unneccessary referencecounting, removed redundant code
#rb:Olaf.Piesche
#test:PC Paragon
Change 2791585 on 2015/12/04 by Michael.Noland
Rendering: Added a more actionable error message to a check() failure for a FStaticLightingMesh that has already been processed when building lighting in a map that contains HLOD
#rb None
#tests Built lighting in a map that was crashing at this check() and verified that the message indicated the problematic mesh
Change 2791244 on 2015/12/04 by Ryan.Brucks
Submitting all my Paragon Content before the new Agora Branch.
Change 2791240 on 2015/12/04 by Marcus.Wassmer
Bump to .061 patch and new pub tools to pass cert
#rb non
#test compile ps4
Change 2791132 on 2015/12/04 by ryan.brucks
RenderToTextureMacros: fixed issue with polygon index being +1 on accident
Change 2790747 on 2015/12/04 by Terence.Burns
Rebuild Lightmaps Automation Script - Adding the -unattended switch for build machines.
#rb None
#tests Run through the Rebuild Lightmaps UAT script process.
Change 2790589 on 2015/12/04 by Bart.Bressler
- Invite PS4 friend option for add party member button now works properly, also fixes crash. Fixes OR-10359.
#rb sam.zamani
#tests invited ps4 player using Invite PS4 Friend option, confirmed that player joined mcp party and ps4 session
Change 2790418 on 2015/12/04 by James.Golding
Roll back HLOD lightmap UV change, Oz reporting issues when building lighting, need more investigation
#rb none
#tests none
Change 2790333 on 2015/12/04 by James.Golding
Add fallback to FMeshUtilities::PropagatePaintedColorsToRawMesh when mesh has been reduced in engine and WedgeMap is missing
#rb martin.wilson
#codereview jurre.debaare
#tests Built HLOD meshes in the editor
Change 2790292 on 2015/12/04 by Olaf.Piesche
Free the new particle array at the beginning of the tick for each instance; that way, even if we're not rendering the array will be cleared and we don't keep injecting new particles that never get killed until rendering resumes
#rb marcus.wassmer
#tests Editor, PIE
Change 2790003 on 2015/12/04 by James.Golding
Fix possible crash in ALODActor::RemoveSubActor
#rb keith.judge
#codereview jurre.debaare
#tests Generated HLOD proxy in editor
Change 2789998 on 2015/12/04 by James.Golding
2015-12-08 09:25:02 -05:00
bool bIsPreview ,
2014-03-14 14:13:41 -04:00
TArray < uint8 > & OutCompressedData
)
{
check ( PixelFormat = = PF_DXT1 | | PixelFormat = = PF_DXT3 | | PixelFormat = = PF_DXT5 | | PixelFormat = = PF_BC4 | | PixelFormat = = PF_BC5 ) ;
// Avoid dependency on GPixelFormats in RenderCore.
const int32 BlockSizeX = 4 ;
const int32 BlockSizeY = 4 ;
const int32 BlockBytes = ( PixelFormat = = PF_DXT1 | | PixelFormat = = PF_BC4 ) ? 8 : 16 ;
const int32 ImageBlocksX = FMath : : Max ( SizeX / BlockSizeX , 1 ) ;
const int32 ImageBlocksY = FMath : : Max ( SizeY / BlockSizeY , 1 ) ;
const int32 BlocksPerBatch = FMath : : Max < int32 > ( ImageBlocksX , FMath : : RoundUpToPowerOfTwo ( CompressionSettings : : BlocksPerBatch ) ) ;
const int32 RowsPerBatch = BlocksPerBatch / ImageBlocksX ;
const int32 NumBatches = ImageBlocksY / RowsPerBatch ;
// Allocate space to store compressed data.
OutCompressedData . Empty ( ImageBlocksX * ImageBlocksY * BlockBytes ) ;
OutCompressedData . AddUninitialized ( ImageBlocksX * ImageBlocksY * BlockBytes ) ;
if ( ImageBlocksX * ImageBlocksY < = BlocksPerBatch | |
BlocksPerBatch % ImageBlocksX ! = 0 | |
RowsPerBatch * NumBatches ! = ImageBlocksY )
{
FNVTTCompressor * Compressor = NULL ;
{
FScopeLock ScopeLock ( & GNVCompressionCriticalSection ) ;
Compressor = new FNVTTCompressor (
SourceData ,
PixelFormat ,
SizeX ,
SizeY ,
bSRGB ,
bIsNormalMap ,
2014-09-29 04:23:44 -04:00
OutCompressedData . GetData ( ) ,
Copying //UE4/Orion-Staging (Orion Main @ CL-2792706 to //UE4/Main
==========================
MAJOR FEATURES + CHANGES
==========================
Change 2792706 on 2015/12/07 by Terence.Burns
Rebuild lightmaps automation changes
- Sync and Build binary files for execution
- Much improved error handling
- Email notification support added.
#Note - This should massively simplify the batch script we use to rebuild lightmaps.
#rb none
#Tests Run the RebuildLightmaps commandlet many times to ensure it runs and errors correctly.
Change 2791950 on 2015/12/05 by Matt.Kuhlenschmidt
Added settings to toggle on and off display of Ping and FPS values.
Server FPS will be disabled before ship
#rb none #test pc/ps4 golden path, pie
Change 2791827 on 2015/12/05 by Marcus.Wassmer
Fix texture memory leak. Fixes automation using too much memory.
#rb Brad.Angelcyk
#codereview bob.ferreira
#test automation runs, editor.
Change 2791313 on 2015/12/04 by Martin.Mittring
fixed PS4 compiling
#rb:Michael.Noland
#test:not
Change 2791014 on 2015/12/04 by Martin.Mittring
nicer cvar help for r.PS4ContinuousSubmits
#rb:Olaf.Piesche
#code_review:Marcus.Wassmer
#test:PC
Change 2791011 on 2015/12/04 by Martin.Mittring
fixed compile error when disabling ENABLE_TEXTURE_TRACKING
#rb:Olaf.Piesche
#test:run Paragon on PC
Change 2790848 on 2015/12/04 by Martin.Mittring
missing changes
nicer cvar help, optimized unneccessary referencecounting, removed redundant code
#rb:Olaf.Piesche
#test:PC Paragon
Change 2790840 on 2015/12/04 by Martin.Mittring
nicer cvar help, optimized unneccessary referencecounting, removed redundant code
#rb:Olaf.Piesche
#test:PC Paragon
Change 2791585 on 2015/12/04 by Michael.Noland
Rendering: Added a more actionable error message to a check() failure for a FStaticLightingMesh that has already been processed when building lighting in a map that contains HLOD
#rb None
#tests Built lighting in a map that was crashing at this check() and verified that the message indicated the problematic mesh
Change 2791244 on 2015/12/04 by Ryan.Brucks
Submitting all my Paragon Content before the new Agora Branch.
Change 2791240 on 2015/12/04 by Marcus.Wassmer
Bump to .061 patch and new pub tools to pass cert
#rb non
#test compile ps4
Change 2791132 on 2015/12/04 by ryan.brucks
RenderToTextureMacros: fixed issue with polygon index being +1 on accident
Change 2790747 on 2015/12/04 by Terence.Burns
Rebuild Lightmaps Automation Script - Adding the -unattended switch for build machines.
#rb None
#tests Run through the Rebuild Lightmaps UAT script process.
Change 2790589 on 2015/12/04 by Bart.Bressler
- Invite PS4 friend option for add party member button now works properly, also fixes crash. Fixes OR-10359.
#rb sam.zamani
#tests invited ps4 player using Invite PS4 Friend option, confirmed that player joined mcp party and ps4 session
Change 2790418 on 2015/12/04 by James.Golding
Roll back HLOD lightmap UV change, Oz reporting issues when building lighting, need more investigation
#rb none
#tests none
Change 2790333 on 2015/12/04 by James.Golding
Add fallback to FMeshUtilities::PropagatePaintedColorsToRawMesh when mesh has been reduced in engine and WedgeMap is missing
#rb martin.wilson
#codereview jurre.debaare
#tests Built HLOD meshes in the editor
Change 2790292 on 2015/12/04 by Olaf.Piesche
Free the new particle array at the beginning of the tick for each instance; that way, even if we're not rendering the array will be cleared and we don't keep injecting new particles that never get killed until rendering resumes
#rb marcus.wassmer
#tests Editor, PIE
Change 2790003 on 2015/12/04 by James.Golding
Fix possible crash in ALODActor::RemoveSubActor
#rb keith.judge
#codereview jurre.debaare
#tests Generated HLOD proxy in editor
Change 2789998 on 2015/12/04 by James.Golding
2015-12-08 09:25:02 -05:00
OutCompressedData . Num ( ) ,
bIsPreview
2014-03-14 14:13:41 -04:00
) ;
}
bool bSuccess = Compressor - > Compress ( ) ;
{
FScopeLock ScopeLock ( & GNVCompressionCriticalSection ) ;
delete Compressor ;
Compressor = NULL ;
}
return bSuccess ;
}
int32 UncompressedStride = RowsPerBatch * BlockSizeY * SizeX * sizeof ( FColor ) ;
int32 CompressedStride = RowsPerBatch * ImageBlocksX * BlockBytes ;
// Create compressors for each batch.
TIndirectArray < FNVTTCompressor > Compressors ;
Compressors . Empty ( NumBatches ) ;
{
FScopeLock ScopeLock ( & GNVCompressionCriticalSection ) ;
const uint8 * Src = ( const uint8 * ) SourceData ;
2014-09-29 04:23:44 -04:00
uint8 * Dest = OutCompressedData . GetData ( ) ;
2014-03-14 14:13:41 -04:00
for ( int32 BatchIndex = 0 ; BatchIndex < NumBatches ; + + BatchIndex )
{
new ( Compressors ) FNVTTCompressor (
Src ,
PixelFormat ,
SizeX ,
RowsPerBatch * BlockSizeY ,
bSRGB ,
bIsNormalMap ,
Dest ,
CompressedStride
) ;
Src + = UncompressedStride ;
Dest + = CompressedStride ;
}
}
// Asynchronously compress each batch.
bool bSuccess = true ;
{
TIndirectArray < FAsyncNVTTTask > AsyncTasks ;
for ( int32 BatchIndex = 0 ; BatchIndex < NumBatches ; + + BatchIndex )
{
FAsyncNVTTTask * AsyncTask = new ( AsyncTasks ) FAsyncNVTTTask ( & Compressors [ BatchIndex ] ) ;
Copying //UE4/Orion-Staging (Orion Main @ CL-2792706 to //UE4/Main
==========================
MAJOR FEATURES + CHANGES
==========================
Change 2792706 on 2015/12/07 by Terence.Burns
Rebuild lightmaps automation changes
- Sync and Build binary files for execution
- Much improved error handling
- Email notification support added.
#Note - This should massively simplify the batch script we use to rebuild lightmaps.
#rb none
#Tests Run the RebuildLightmaps commandlet many times to ensure it runs and errors correctly.
Change 2791950 on 2015/12/05 by Matt.Kuhlenschmidt
Added settings to toggle on and off display of Ping and FPS values.
Server FPS will be disabled before ship
#rb none #test pc/ps4 golden path, pie
Change 2791827 on 2015/12/05 by Marcus.Wassmer
Fix texture memory leak. Fixes automation using too much memory.
#rb Brad.Angelcyk
#codereview bob.ferreira
#test automation runs, editor.
Change 2791313 on 2015/12/04 by Martin.Mittring
fixed PS4 compiling
#rb:Michael.Noland
#test:not
Change 2791014 on 2015/12/04 by Martin.Mittring
nicer cvar help for r.PS4ContinuousSubmits
#rb:Olaf.Piesche
#code_review:Marcus.Wassmer
#test:PC
Change 2791011 on 2015/12/04 by Martin.Mittring
fixed compile error when disabling ENABLE_TEXTURE_TRACKING
#rb:Olaf.Piesche
#test:run Paragon on PC
Change 2790848 on 2015/12/04 by Martin.Mittring
missing changes
nicer cvar help, optimized unneccessary referencecounting, removed redundant code
#rb:Olaf.Piesche
#test:PC Paragon
Change 2790840 on 2015/12/04 by Martin.Mittring
nicer cvar help, optimized unneccessary referencecounting, removed redundant code
#rb:Olaf.Piesche
#test:PC Paragon
Change 2791585 on 2015/12/04 by Michael.Noland
Rendering: Added a more actionable error message to a check() failure for a FStaticLightingMesh that has already been processed when building lighting in a map that contains HLOD
#rb None
#tests Built lighting in a map that was crashing at this check() and verified that the message indicated the problematic mesh
Change 2791244 on 2015/12/04 by Ryan.Brucks
Submitting all my Paragon Content before the new Agora Branch.
Change 2791240 on 2015/12/04 by Marcus.Wassmer
Bump to .061 patch and new pub tools to pass cert
#rb non
#test compile ps4
Change 2791132 on 2015/12/04 by ryan.brucks
RenderToTextureMacros: fixed issue with polygon index being +1 on accident
Change 2790747 on 2015/12/04 by Terence.Burns
Rebuild Lightmaps Automation Script - Adding the -unattended switch for build machines.
#rb None
#tests Run through the Rebuild Lightmaps UAT script process.
Change 2790589 on 2015/12/04 by Bart.Bressler
- Invite PS4 friend option for add party member button now works properly, also fixes crash. Fixes OR-10359.
#rb sam.zamani
#tests invited ps4 player using Invite PS4 Friend option, confirmed that player joined mcp party and ps4 session
Change 2790418 on 2015/12/04 by James.Golding
Roll back HLOD lightmap UV change, Oz reporting issues when building lighting, need more investigation
#rb none
#tests none
Change 2790333 on 2015/12/04 by James.Golding
Add fallback to FMeshUtilities::PropagatePaintedColorsToRawMesh when mesh has been reduced in engine and WedgeMap is missing
#rb martin.wilson
#codereview jurre.debaare
#tests Built HLOD meshes in the editor
Change 2790292 on 2015/12/04 by Olaf.Piesche
Free the new particle array at the beginning of the tick for each instance; that way, even if we're not rendering the array will be cleared and we don't keep injecting new particles that never get killed until rendering resumes
#rb marcus.wassmer
#tests Editor, PIE
Change 2790003 on 2015/12/04 by James.Golding
Fix possible crash in ALODActor::RemoveSubActor
#rb keith.judge
#codereview jurre.debaare
#tests Generated HLOD proxy in editor
Change 2789998 on 2015/12/04 by James.Golding
2015-12-08 09:25:02 -05:00
# if WITH_EDITOR
AsyncTask - > StartBackgroundTask ( GLargeThreadPool ) ;
# else
2014-03-14 14:13:41 -04:00
AsyncTask - > StartBackgroundTask ( ) ;
Copying //UE4/Orion-Staging (Orion Main @ CL-2792706 to //UE4/Main
==========================
MAJOR FEATURES + CHANGES
==========================
Change 2792706 on 2015/12/07 by Terence.Burns
Rebuild lightmaps automation changes
- Sync and Build binary files for execution
- Much improved error handling
- Email notification support added.
#Note - This should massively simplify the batch script we use to rebuild lightmaps.
#rb none
#Tests Run the RebuildLightmaps commandlet many times to ensure it runs and errors correctly.
Change 2791950 on 2015/12/05 by Matt.Kuhlenschmidt
Added settings to toggle on and off display of Ping and FPS values.
Server FPS will be disabled before ship
#rb none #test pc/ps4 golden path, pie
Change 2791827 on 2015/12/05 by Marcus.Wassmer
Fix texture memory leak. Fixes automation using too much memory.
#rb Brad.Angelcyk
#codereview bob.ferreira
#test automation runs, editor.
Change 2791313 on 2015/12/04 by Martin.Mittring
fixed PS4 compiling
#rb:Michael.Noland
#test:not
Change 2791014 on 2015/12/04 by Martin.Mittring
nicer cvar help for r.PS4ContinuousSubmits
#rb:Olaf.Piesche
#code_review:Marcus.Wassmer
#test:PC
Change 2791011 on 2015/12/04 by Martin.Mittring
fixed compile error when disabling ENABLE_TEXTURE_TRACKING
#rb:Olaf.Piesche
#test:run Paragon on PC
Change 2790848 on 2015/12/04 by Martin.Mittring
missing changes
nicer cvar help, optimized unneccessary referencecounting, removed redundant code
#rb:Olaf.Piesche
#test:PC Paragon
Change 2790840 on 2015/12/04 by Martin.Mittring
nicer cvar help, optimized unneccessary referencecounting, removed redundant code
#rb:Olaf.Piesche
#test:PC Paragon
Change 2791585 on 2015/12/04 by Michael.Noland
Rendering: Added a more actionable error message to a check() failure for a FStaticLightingMesh that has already been processed when building lighting in a map that contains HLOD
#rb None
#tests Built lighting in a map that was crashing at this check() and verified that the message indicated the problematic mesh
Change 2791244 on 2015/12/04 by Ryan.Brucks
Submitting all my Paragon Content before the new Agora Branch.
Change 2791240 on 2015/12/04 by Marcus.Wassmer
Bump to .061 patch and new pub tools to pass cert
#rb non
#test compile ps4
Change 2791132 on 2015/12/04 by ryan.brucks
RenderToTextureMacros: fixed issue with polygon index being +1 on accident
Change 2790747 on 2015/12/04 by Terence.Burns
Rebuild Lightmaps Automation Script - Adding the -unattended switch for build machines.
#rb None
#tests Run through the Rebuild Lightmaps UAT script process.
Change 2790589 on 2015/12/04 by Bart.Bressler
- Invite PS4 friend option for add party member button now works properly, also fixes crash. Fixes OR-10359.
#rb sam.zamani
#tests invited ps4 player using Invite PS4 Friend option, confirmed that player joined mcp party and ps4 session
Change 2790418 on 2015/12/04 by James.Golding
Roll back HLOD lightmap UV change, Oz reporting issues when building lighting, need more investigation
#rb none
#tests none
Change 2790333 on 2015/12/04 by James.Golding
Add fallback to FMeshUtilities::PropagatePaintedColorsToRawMesh when mesh has been reduced in engine and WedgeMap is missing
#rb martin.wilson
#codereview jurre.debaare
#tests Built HLOD meshes in the editor
Change 2790292 on 2015/12/04 by Olaf.Piesche
Free the new particle array at the beginning of the tick for each instance; that way, even if we're not rendering the array will be cleared and we don't keep injecting new particles that never get killed until rendering resumes
#rb marcus.wassmer
#tests Editor, PIE
Change 2790003 on 2015/12/04 by James.Golding
Fix possible crash in ALODActor::RemoveSubActor
#rb keith.judge
#codereview jurre.debaare
#tests Generated HLOD proxy in editor
Change 2789998 on 2015/12/04 by James.Golding
2015-12-08 09:25:02 -05:00
# endif
2014-03-14 14:13:41 -04:00
}
for ( int32 BatchIndex = 0 ; BatchIndex < NumBatches ; + + BatchIndex )
{
FAsyncNVTTTask & AsyncTask = AsyncTasks [ BatchIndex ] ;
AsyncTask . EnsureCompletion ( ) ;
bSuccess = bSuccess & & AsyncTask . GetTask ( ) . GetCompressionResults ( ) ;
}
}
// Release compressors
{
FScopeLock ScopeLock ( & GNVCompressionCriticalSection ) ;
Compressors . Empty ( ) ;
}
return bSuccess ;
}
/**
* DXT texture format handler .
*/
class FTextureFormatDXT : public ITextureFormat
{
2014-06-13 06:14:46 -04:00
virtual bool AllowParallelBuild ( ) const override
2014-03-14 14:13:41 -04:00
{
return true ;
}
2014-06-13 06:14:46 -04:00
virtual uint16 GetVersion ( FName Format ) const override
2014-03-14 14:13:41 -04:00
{
return 0 ;
}
2014-06-13 06:14:46 -04:00
virtual void GetSupportedFormats ( TArray < FName > & OutFormats ) const override
2014-03-14 14:13:41 -04:00
{
for ( int32 i = 0 ; i < ARRAY_COUNT ( GSupportedTextureFormatNames ) ; + + i )
{
OutFormats . Add ( GSupportedTextureFormatNames [ i ] ) ;
}
}
2014-04-23 20:04:50 -04:00
2014-06-13 06:14:46 -04:00
virtual FTextureFormatCompressorCaps GetFormatCapabilities ( ) const override
2014-04-23 20:04:50 -04:00
{
return FTextureFormatCompressorCaps ( ) ; // Default capabilities.
}
2014-03-14 14:13:41 -04:00
virtual bool CompressImage (
const FImage & InImage ,
const struct FTextureBuildSettings & BuildSettings ,
bool bImageHasAlphaChannel ,
FCompressedImage2D & OutCompressedImage
2014-06-13 06:14:46 -04:00
) const override
2014-03-14 14:13:41 -04:00
{
FImage Image ;
Gamma Correction - Changing the way all FColors are converted into FLinearColor by default. Previously all sRGB textures coming into the engine along with all other usage of FColor -> FLinearColor used a lookup table that assumed the final gamma correction would simply be pow(color, 1/DisplayGamma). However, that's not the case, we use the IEC 61966-2-1 standard on most platforms for both the scene renderer, as well as for gamma correction in Slate. In Slate you should now see an image matching Photoshop instead of being slightly darker in the lower ranges. However, because we don't want to invalidate all existing textures that users have authored, all existing UTextures have a UseLegacyGamma flag set to true, all new textures will be set to false. The flag is part of the DDC key calculation, but steps were taken so that when legacy is true, keys match existing keys to prevent universally invalidating all games DDCs just to make this change.
To summarize,
Old Pipeline: sRGB-Pow(2.2) -> Linear -> sRGB-IEC 61966
New Pipeline: sRGB-IEC 61966 -> Linear -> sRGB-IEC 61966
#codereview gil.gribb, nick.penwarden, martin.mittring
[CL 2571070 by Nick Darnell in Main branch]
2015-05-29 16:03:43 -04:00
InImage . CopyTo ( Image , ERawImageFormat : : BGRA8 , BuildSettings . GetGammaSpace ( ) ) ;
2014-03-14 14:13:41 -04:00
bool bIsNormalMap = false ;
EPixelFormat CompressedPixelFormat = PF_Unknown ;
if ( BuildSettings . TextureFormatName = = GTextureFormatNameDXT1 )
{
CompressedPixelFormat = PF_DXT1 ;
}
else if ( BuildSettings . TextureFormatName = = GTextureFormatNameDXT3 )
{
CompressedPixelFormat = PF_DXT3 ;
}
else if ( BuildSettings . TextureFormatName = = GTextureFormatNameDXT5 )
{
CompressedPixelFormat = PF_DXT5 ;
}
else if ( BuildSettings . TextureFormatName = = GTextureFormatNameAutoDXT )
{
CompressedPixelFormat = bImageHasAlphaChannel ? PF_DXT5 : PF_DXT1 ;
}
else if ( BuildSettings . TextureFormatName = = GTextureFormatNameDXT5n )
{
CompressedPixelFormat = PF_DXT5 ;
bIsNormalMap = true ;
}
else if ( BuildSettings . TextureFormatName = = GTextureFormatNameBC5 )
{
CompressedPixelFormat = PF_BC5 ;
bIsNormalMap = true ;
}
else if ( BuildSettings . TextureFormatName = = GTextureFormatNameBC4 )
{
CompressedPixelFormat = PF_BC4 ;
}
bool bCompressionSucceeded = true ;
int32 SliceSize = Image . SizeX * Image . SizeY ;
for ( int32 SliceIndex = 0 ; SliceIndex < Image . NumSlices & & bCompressionSucceeded ; + + SliceIndex )
{
TArray < uint8 > CompressedSliceData ;
bCompressionSucceeded = CompressImageUsingNVTT (
Image . AsBGRA8 ( ) + SliceIndex * SliceSize ,
CompressedPixelFormat ,
Image . SizeX ,
Image . SizeY ,
Gamma Correction - Changing the way all FColors are converted into FLinearColor by default. Previously all sRGB textures coming into the engine along with all other usage of FColor -> FLinearColor used a lookup table that assumed the final gamma correction would simply be pow(color, 1/DisplayGamma). However, that's not the case, we use the IEC 61966-2-1 standard on most platforms for both the scene renderer, as well as for gamma correction in Slate. In Slate you should now see an image matching Photoshop instead of being slightly darker in the lower ranges. However, because we don't want to invalidate all existing textures that users have authored, all existing UTextures have a UseLegacyGamma flag set to true, all new textures will be set to false. The flag is part of the DDC key calculation, but steps were taken so that when legacy is true, keys match existing keys to prevent universally invalidating all games DDCs just to make this change.
To summarize,
Old Pipeline: sRGB-Pow(2.2) -> Linear -> sRGB-IEC 61966
New Pipeline: sRGB-IEC 61966 -> Linear -> sRGB-IEC 61966
#codereview gil.gribb, nick.penwarden, martin.mittring
[CL 2571070 by Nick Darnell in Main branch]
2015-05-29 16:03:43 -04:00
Image . IsGammaCorrected ( ) ,
2014-03-14 14:13:41 -04:00
bIsNormalMap ,
Copying //UE4/Orion-Staging (Orion Main @ CL-2792706 to //UE4/Main
==========================
MAJOR FEATURES + CHANGES
==========================
Change 2792706 on 2015/12/07 by Terence.Burns
Rebuild lightmaps automation changes
- Sync and Build binary files for execution
- Much improved error handling
- Email notification support added.
#Note - This should massively simplify the batch script we use to rebuild lightmaps.
#rb none
#Tests Run the RebuildLightmaps commandlet many times to ensure it runs and errors correctly.
Change 2791950 on 2015/12/05 by Matt.Kuhlenschmidt
Added settings to toggle on and off display of Ping and FPS values.
Server FPS will be disabled before ship
#rb none #test pc/ps4 golden path, pie
Change 2791827 on 2015/12/05 by Marcus.Wassmer
Fix texture memory leak. Fixes automation using too much memory.
#rb Brad.Angelcyk
#codereview bob.ferreira
#test automation runs, editor.
Change 2791313 on 2015/12/04 by Martin.Mittring
fixed PS4 compiling
#rb:Michael.Noland
#test:not
Change 2791014 on 2015/12/04 by Martin.Mittring
nicer cvar help for r.PS4ContinuousSubmits
#rb:Olaf.Piesche
#code_review:Marcus.Wassmer
#test:PC
Change 2791011 on 2015/12/04 by Martin.Mittring
fixed compile error when disabling ENABLE_TEXTURE_TRACKING
#rb:Olaf.Piesche
#test:run Paragon on PC
Change 2790848 on 2015/12/04 by Martin.Mittring
missing changes
nicer cvar help, optimized unneccessary referencecounting, removed redundant code
#rb:Olaf.Piesche
#test:PC Paragon
Change 2790840 on 2015/12/04 by Martin.Mittring
nicer cvar help, optimized unneccessary referencecounting, removed redundant code
#rb:Olaf.Piesche
#test:PC Paragon
Change 2791585 on 2015/12/04 by Michael.Noland
Rendering: Added a more actionable error message to a check() failure for a FStaticLightingMesh that has already been processed when building lighting in a map that contains HLOD
#rb None
#tests Built lighting in a map that was crashing at this check() and verified that the message indicated the problematic mesh
Change 2791244 on 2015/12/04 by Ryan.Brucks
Submitting all my Paragon Content before the new Agora Branch.
Change 2791240 on 2015/12/04 by Marcus.Wassmer
Bump to .061 patch and new pub tools to pass cert
#rb non
#test compile ps4
Change 2791132 on 2015/12/04 by ryan.brucks
RenderToTextureMacros: fixed issue with polygon index being +1 on accident
Change 2790747 on 2015/12/04 by Terence.Burns
Rebuild Lightmaps Automation Script - Adding the -unattended switch for build machines.
#rb None
#tests Run through the Rebuild Lightmaps UAT script process.
Change 2790589 on 2015/12/04 by Bart.Bressler
- Invite PS4 friend option for add party member button now works properly, also fixes crash. Fixes OR-10359.
#rb sam.zamani
#tests invited ps4 player using Invite PS4 Friend option, confirmed that player joined mcp party and ps4 session
Change 2790418 on 2015/12/04 by James.Golding
Roll back HLOD lightmap UV change, Oz reporting issues when building lighting, need more investigation
#rb none
#tests none
Change 2790333 on 2015/12/04 by James.Golding
Add fallback to FMeshUtilities::PropagatePaintedColorsToRawMesh when mesh has been reduced in engine and WedgeMap is missing
#rb martin.wilson
#codereview jurre.debaare
#tests Built HLOD meshes in the editor
Change 2790292 on 2015/12/04 by Olaf.Piesche
Free the new particle array at the beginning of the tick for each instance; that way, even if we're not rendering the array will be cleared and we don't keep injecting new particles that never get killed until rendering resumes
#rb marcus.wassmer
#tests Editor, PIE
Change 2790003 on 2015/12/04 by James.Golding
Fix possible crash in ALODActor::RemoveSubActor
#rb keith.judge
#codereview jurre.debaare
#tests Generated HLOD proxy in editor
Change 2789998 on 2015/12/04 by James.Golding
2015-12-08 09:25:02 -05:00
false , // Daniel Lamb: Testing with this set to true didn't give large performance gain to lightmaps. Encoding of 140 lightmaps was 19.2seconds with preview 20.1 without preview. 11/30/2015
2014-03-14 14:13:41 -04:00
CompressedSliceData
) ;
OutCompressedImage . RawData . Append ( CompressedSliceData ) ;
}
if ( bCompressionSucceeded )
{
OutCompressedImage . SizeX = FMath : : Max ( Image . SizeX , 4 ) ;
OutCompressedImage . SizeY = FMath : : Max ( Image . SizeY , 4 ) ;
OutCompressedImage . PixelFormat = CompressedPixelFormat ;
}
return bCompressionSucceeded ;
}
} ;
/**
* Module for DXT texture compression .
*/
static ITextureFormat * Singleton = NULL ;
class FTextureFormatDXTModule : public ITextureFormatModule
{
public :
virtual ~ FTextureFormatDXTModule ( )
{
delete Singleton ;
Singleton = NULL ;
}
virtual ITextureFormat * GetTextureFormat ( )
{
if ( ! Singleton )
{
Singleton = new FTextureFormatDXT ( ) ;
}
return Singleton ;
}
} ;
IMPLEMENT_MODULE ( FTextureFormatDXTModule , TextureFormatDXT ) ;