diff --git a/src/nvimage/DirectDrawSurface.cpp b/src/nvimage/DirectDrawSurface.cpp index 2275b19..5f0b3ec 100644 --- a/src/nvimage/DirectDrawSurface.cpp +++ b/src/nvimage/DirectDrawSurface.cpp @@ -585,7 +585,7 @@ DDSHeader::DDSHeader() // Store version information on the reserved header attributes. 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.flags = 0; diff --git a/src/nvtt/BlockCompressor.cpp b/src/nvtt/BlockCompressor.cpp index ee350d4..d5bad30 100644 --- a/src/nvtt/BlockCompressor.cpp +++ b/src/nvtt/BlockCompressor.cpp @@ -276,145 +276,6 @@ void CompressorETC2_RGBM::compressBlock(Vector4 colors[16], float weights[16], c // 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) void D3DXCompressorDXT1::compress(InputFormat inputFormat, AlphaMode alphaMode, uint w, uint h, uint d, void * data, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) diff --git a/src/nvtt/BlockCompressor.h b/src/nvtt/BlockCompressor.h index 9187ebf..ad24c1b 100644 --- a/src/nvtt/BlockCompressor.h +++ b/src/nvtt/BlockCompressor.h @@ -79,25 +79,6 @@ namespace nv // 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) struct D3DXCompressorDXT1 : public CompressorInterface { diff --git a/src/nvtt/Context.cpp b/src/nvtt/Context.cpp index d459f88..3ee07ed 100644 --- a/src/nvtt/Context.cpp +++ b/src/nvtt/Context.cpp @@ -1043,22 +1043,12 @@ CompressorInterface * Compressor::Private::chooseCpuCompressor(const Compression } 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 (compressionOptions.externalCompressor == "d3dx") return new D3DXCompressorDXT1; else #endif -#if defined(HAVE_D3DX) +#if defined(HAVE_STB) if (compressionOptions.externalCompressor == "stb") return new StbCompressorDXT1; else #endif @@ -1094,11 +1084,6 @@ CompressorInterface * Compressor::Private::chooseCpuCompressor(const Compression } else if (compressionOptions.format == Format_DXT5) { -#if defined(HAVE_ATITC) - if (compressionOptions.externalCompressor == "ati") return new AtiCompressorDXT5; - else -#endif - if (compressionOptions.quality == Quality_Fastest) { return new FastCompressorDXT5; diff --git a/src/nvtt/tests/bc1enc.cpp b/src/nvtt/tests/bc1enc.cpp index da54601..5125784 100644 --- a/src/nvtt/tests/bc1enc.cpp +++ b/src/nvtt/tests/bc1enc.cpp @@ -21,8 +21,8 @@ #define ICETC_IMPLEMENTATION #include "nvtt/icetc.h" -#define GOOFYTC_IMPLEMENTATION -#include "../extern/goofy_tc.h" +//#define GOOFYTC_IMPLEMENTATION +//#include "../extern/goofy_tc.h" #include "../extern/rg_etc1_v104/rg_etc1.h" #include "../extern/rg_etc1_v104/rg_etc1.cpp"