Remove support for some external compressors.
This commit is contained in:
@ -585,7 +585,7 @@ DDSHeader::DDSHeader()
|
|||||||
|
|
||||||
// Store version information on the reserved header attributes.
|
// Store version information on the reserved header attributes.
|
||||||
this->reserved[9] = FOURCC_NVTT;
|
this->reserved[9] = FOURCC_NVTT;
|
||||||
this->reserved[10] = (2 << 16) | (1 << 8) | (0); // major.minor.revision
|
this->reserved[10] = (2 << 16) | (1 << 8) | (1); // major.minor.revision
|
||||||
|
|
||||||
this->pf.size = 32;
|
this->pf.size = 32;
|
||||||
this->pf.flags = 0;
|
this->pf.flags = 0;
|
||||||
|
@ -276,145 +276,6 @@ void CompressorETC2_RGBM::compressBlock(Vector4 colors[16], float weights[16], c
|
|||||||
|
|
||||||
// External compressors.
|
// External compressors.
|
||||||
|
|
||||||
#if defined(HAVE_ATITC)
|
|
||||||
|
|
||||||
typedef int BOOL;
|
|
||||||
typedef _W64 unsigned long ULONG_PTR;
|
|
||||||
typedef ULONG_PTR DWORD_PTR;
|
|
||||||
#include "atitc/ATI_Compress.h"
|
|
||||||
|
|
||||||
void AtiCompressorDXT1::compress(InputFormat inputFormat, AlphaMode alphaMode, uint w, uint h, uint d, void * data, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)
|
|
||||||
{
|
|
||||||
nvDebugCheck(d == 1);
|
|
||||||
|
|
||||||
// Init source texture
|
|
||||||
ATI_TC_Texture srcTexture;
|
|
||||||
srcTexture.dwSize = sizeof(srcTexture);
|
|
||||||
srcTexture.dwWidth = w;
|
|
||||||
srcTexture.dwHeight = h;
|
|
||||||
if (inputFormat == InputFormat_BGRA_8UB)
|
|
||||||
{
|
|
||||||
srcTexture.dwPitch = w * 4;
|
|
||||||
srcTexture.format = ATI_TC_FORMAT_ARGB_8888;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// @@ Floating point input is not swizzled.
|
|
||||||
srcTexture.dwPitch = w * 16;
|
|
||||||
srcTexture.format = ATI_TC_FORMAT_ARGB_32F;
|
|
||||||
}
|
|
||||||
srcTexture.dwDataSize = ATI_TC_CalculateBufferSize(&srcTexture);
|
|
||||||
srcTexture.pData = (ATI_TC_BYTE*) data;
|
|
||||||
|
|
||||||
// Init dest texture
|
|
||||||
ATI_TC_Texture destTexture;
|
|
||||||
destTexture.dwSize = sizeof(destTexture);
|
|
||||||
destTexture.dwWidth = w;
|
|
||||||
destTexture.dwHeight = h;
|
|
||||||
destTexture.dwPitch = 0;
|
|
||||||
destTexture.format = ATI_TC_FORMAT_DXT1;
|
|
||||||
destTexture.dwDataSize = ATI_TC_CalculateBufferSize(&destTexture);
|
|
||||||
destTexture.pData = (ATI_TC_BYTE*) mem::malloc(destTexture.dwDataSize);
|
|
||||||
|
|
||||||
ATI_TC_CompressOptions options;
|
|
||||||
options.dwSize = sizeof(options);
|
|
||||||
options.bUseChannelWeighting = false;
|
|
||||||
options.bUseAdaptiveWeighting = false;
|
|
||||||
options.bDXT1UseAlpha = false;
|
|
||||||
options.nCompressionSpeed = ATI_TC_Speed_Normal;
|
|
||||||
options.bDisableMultiThreading = false;
|
|
||||||
//options.bDisableMultiThreading = true;
|
|
||||||
|
|
||||||
// Compress
|
|
||||||
ATI_TC_ConvertTexture(&srcTexture, &destTexture, &options, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
if (outputOptions.outputHandler != NULL) {
|
|
||||||
outputOptions.outputHandler->writeData(destTexture.pData, destTexture.dwDataSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
mem::free(destTexture.pData);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AtiCompressorDXT5::compress(InputFormat inputFormat, AlphaMode alphaMode, uint w, uint h, uint d, void * data, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)
|
|
||||||
{
|
|
||||||
nvDebugCheck(d == 1);
|
|
||||||
|
|
||||||
// Init source texture
|
|
||||||
ATI_TC_Texture srcTexture;
|
|
||||||
srcTexture.dwSize = sizeof(srcTexture);
|
|
||||||
srcTexture.dwWidth = w;
|
|
||||||
srcTexture.dwHeight = h;
|
|
||||||
if (inputFormat == InputFormat_BGRA_8UB)
|
|
||||||
{
|
|
||||||
srcTexture.dwPitch = w * 4;
|
|
||||||
srcTexture.format = ATI_TC_FORMAT_ARGB_8888;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
srcTexture.dwPitch = w * 16;
|
|
||||||
srcTexture.format = ATI_TC_FORMAT_ARGB_32F;
|
|
||||||
}
|
|
||||||
srcTexture.dwDataSize = ATI_TC_CalculateBufferSize(&srcTexture);
|
|
||||||
srcTexture.pData = (ATI_TC_BYTE*) data;
|
|
||||||
|
|
||||||
// Init dest texture
|
|
||||||
ATI_TC_Texture destTexture;
|
|
||||||
destTexture.dwSize = sizeof(destTexture);
|
|
||||||
destTexture.dwWidth = w;
|
|
||||||
destTexture.dwHeight = h;
|
|
||||||
destTexture.dwPitch = 0;
|
|
||||||
destTexture.format = ATI_TC_FORMAT_DXT5;
|
|
||||||
destTexture.dwDataSize = ATI_TC_CalculateBufferSize(&destTexture);
|
|
||||||
destTexture.pData = (ATI_TC_BYTE*) mem::malloc(destTexture.dwDataSize);
|
|
||||||
|
|
||||||
// Compress
|
|
||||||
ATI_TC_ConvertTexture(&srcTexture, &destTexture, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
if (outputOptions.outputHandler != NULL) {
|
|
||||||
outputOptions.outputHandler->writeData(destTexture.pData, destTexture.dwDataSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
mem::free(destTexture.pData);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // defined(HAVE_ATITC)
|
|
||||||
|
|
||||||
#if defined(HAVE_SQUISH)
|
|
||||||
|
|
||||||
//#include "squish/squish.h"
|
|
||||||
#include "squish-1.10/squish.h"
|
|
||||||
|
|
||||||
void SquishCompressorDXT1::compress(InputFormat inputFormat, AlphaMode alphaMode, uint w, uint h, uint d, void * data, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)
|
|
||||||
{
|
|
||||||
nvDebugCheck(d == 1);
|
|
||||||
nvDebugCheck(false);
|
|
||||||
|
|
||||||
#pragma message(NV_FILE_LINE "TODO: Convert input to fixed point ABGR format instead of ARGB")
|
|
||||||
/*
|
|
||||||
Image img(*image);
|
|
||||||
int count = img.width() * img.height();
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
Color32 c = img.pixel(i);
|
|
||||||
img.pixel(i) = Color32(c.b, c.g, c.r, c.a);
|
|
||||||
}
|
|
||||||
|
|
||||||
int size = squish::GetStorageRequirements(img.width(), img.height(), squish::kDxt1);
|
|
||||||
void * blocks = mem::malloc(size);
|
|
||||||
|
|
||||||
squish::CompressImage((const squish::u8 *)img.pixels(), img.width(), img.height(), blocks, squish::kDxt1 | squish::kColourClusterFit);
|
|
||||||
|
|
||||||
if (outputOptions.outputHandler != NULL) {
|
|
||||||
outputOptions.outputHandler->writeData(blocks, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
mem::free(blocks);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // defined(HAVE_SQUISH)
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(HAVE_D3DX)
|
#if defined(HAVE_D3DX)
|
||||||
|
|
||||||
void D3DXCompressorDXT1::compress(InputFormat inputFormat, AlphaMode alphaMode, uint w, uint h, uint d, void * data, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)
|
void D3DXCompressorDXT1::compress(InputFormat inputFormat, AlphaMode alphaMode, uint w, uint h, uint d, void * data, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions)
|
||||||
|
@ -79,25 +79,6 @@ namespace nv
|
|||||||
|
|
||||||
|
|
||||||
// External compressors.
|
// External compressors.
|
||||||
#if defined(HAVE_ATITC)
|
|
||||||
struct AtiCompressorDXT1 : public CompressorInterface
|
|
||||||
{
|
|
||||||
virtual void compress(nvtt::InputFormat inputFormat, nvtt::AlphaMode alphaMode, uint w, uint h, uint d, void * data, const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct AtiCompressorDXT5 : public CompressorInterface
|
|
||||||
{
|
|
||||||
virtual void compress(nvtt::InputFormat inputFormat, nvtt::AlphaMode alphaMode, uint w, uint h, uint d, void * data, const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(HAVE_SQUISH)
|
|
||||||
struct SquishCompressorDXT1 : public CompressorInterface
|
|
||||||
{
|
|
||||||
virtual void compress(nvtt::InputFormat inputFormat, nvtt::AlphaMode alphaMode, uint w, uint h, uint d, void * data, const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(HAVE_D3DX)
|
#if defined(HAVE_D3DX)
|
||||||
struct D3DXCompressorDXT1 : public CompressorInterface
|
struct D3DXCompressorDXT1 : public CompressorInterface
|
||||||
{
|
{
|
||||||
|
@ -1043,22 +1043,12 @@ CompressorInterface * Compressor::Private::chooseCpuCompressor(const Compression
|
|||||||
}
|
}
|
||||||
else if (compressionOptions.format == Format_DXT1)
|
else if (compressionOptions.format == Format_DXT1)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_ATITC)
|
|
||||||
if (compressionOptions.externalCompressor == "ati") return new AtiCompressorDXT1;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(HAVE_SQUISH)
|
|
||||||
if (compressionOptions.externalCompressor == "squish") return new SquishCompressorDXT1;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(HAVE_D3DX)
|
#if defined(HAVE_D3DX)
|
||||||
if (compressionOptions.externalCompressor == "d3dx") return new D3DXCompressorDXT1;
|
if (compressionOptions.externalCompressor == "d3dx") return new D3DXCompressorDXT1;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_D3DX)
|
#if defined(HAVE_STB)
|
||||||
if (compressionOptions.externalCompressor == "stb") return new StbCompressorDXT1;
|
if (compressionOptions.externalCompressor == "stb") return new StbCompressorDXT1;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@ -1094,11 +1084,6 @@ CompressorInterface * Compressor::Private::chooseCpuCompressor(const Compression
|
|||||||
}
|
}
|
||||||
else if (compressionOptions.format == Format_DXT5)
|
else if (compressionOptions.format == Format_DXT5)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_ATITC)
|
|
||||||
if (compressionOptions.externalCompressor == "ati") return new AtiCompressorDXT5;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (compressionOptions.quality == Quality_Fastest)
|
if (compressionOptions.quality == Quality_Fastest)
|
||||||
{
|
{
|
||||||
return new FastCompressorDXT5;
|
return new FastCompressorDXT5;
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
#define ICETC_IMPLEMENTATION
|
#define ICETC_IMPLEMENTATION
|
||||||
#include "nvtt/icetc.h"
|
#include "nvtt/icetc.h"
|
||||||
|
|
||||||
#define GOOFYTC_IMPLEMENTATION
|
//#define GOOFYTC_IMPLEMENTATION
|
||||||
#include "../extern/goofy_tc.h"
|
//#include "../extern/goofy_tc.h"
|
||||||
|
|
||||||
#include "../extern/rg_etc1_v104/rg_etc1.h"
|
#include "../extern/rg_etc1_v104/rg_etc1.h"
|
||||||
#include "../extern/rg_etc1_v104/rg_etc1.cpp"
|
#include "../extern/rg_etc1_v104/rg_etc1.cpp"
|
||||||
|
Reference in New Issue
Block a user