2007-05-17 00:11:38 +00:00
|
|
|
// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
|
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person
|
|
|
|
// obtaining a copy of this software and associated documentation
|
|
|
|
// files (the "Software"), to deal in the Software without
|
|
|
|
// restriction, including without limitation the rights to use,
|
|
|
|
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
// copies of the Software, and to permit persons to whom the
|
|
|
|
// Software is furnished to do so, subject to the following
|
|
|
|
// conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be
|
|
|
|
// included in all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
|
|
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
|
|
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
|
|
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
// OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
2010-03-16 22:37:25 +00:00
|
|
|
#ifndef NV_TT_COMPRESSORDXT_H
|
|
|
|
#define NV_TT_COMPRESSORDXT_H
|
2007-05-17 00:11:38 +00:00
|
|
|
|
2010-03-16 22:37:25 +00:00
|
|
|
#include <nvcore/nvcore.h>
|
2007-05-17 00:11:38 +00:00
|
|
|
#include "nvtt.h"
|
2010-03-16 22:37:25 +00:00
|
|
|
#include "Compressor.h"
|
2007-05-17 00:11:38 +00:00
|
|
|
|
|
|
|
namespace nv
|
|
|
|
{
|
2009-10-21 07:48:27 +00:00
|
|
|
struct ColorBlock;
|
2007-05-17 00:11:38 +00:00
|
|
|
|
2009-10-21 07:48:27 +00:00
|
|
|
struct FixedBlockCompressor : public CompressorInterface
|
|
|
|
{
|
2010-03-16 22:37:25 +00:00
|
|
|
virtual void compress(nvtt::InputFormat inputFormat, nvtt::AlphaMode alphaMode, uint w, uint h, const void * data, const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
|
2009-10-21 07:48:27 +00:00
|
|
|
|
|
|
|
virtual void compressBlock(ColorBlock & rgba, nvtt::AlphaMode alphaMode, const nvtt::CompressionOptions::Private & compressionOptions, void * output) = 0;
|
|
|
|
virtual uint blockSize() const = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Fast CPU compressors.
|
|
|
|
struct FastCompressorDXT1 : public FixedBlockCompressor
|
|
|
|
{
|
|
|
|
virtual void compressBlock(ColorBlock & rgba, nvtt::AlphaMode alphaMode, const nvtt::CompressionOptions::Private & compressionOptions, void * output);
|
|
|
|
virtual uint blockSize() const { return 8; }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FastCompressorDXT1a : public FixedBlockCompressor
|
|
|
|
{
|
|
|
|
virtual void compressBlock(ColorBlock & rgba, nvtt::AlphaMode alphaMode, const nvtt::CompressionOptions::Private & compressionOptions, void * output);
|
|
|
|
virtual uint blockSize() const { return 8; }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FastCompressorDXT3 : public FixedBlockCompressor
|
|
|
|
{
|
|
|
|
virtual void compressBlock(ColorBlock & rgba, nvtt::AlphaMode alphaMode, const nvtt::CompressionOptions::Private & compressionOptions, void * output);
|
|
|
|
virtual uint blockSize() const { return 16; }
|
|
|
|
};
|
2009-07-06 09:04:29 +00:00
|
|
|
|
2009-10-21 07:48:27 +00:00
|
|
|
struct FastCompressorDXT5 : public FixedBlockCompressor
|
|
|
|
{
|
|
|
|
virtual void compressBlock(ColorBlock & rgba, nvtt::AlphaMode alphaMode, const nvtt::CompressionOptions::Private & compressionOptions, void * output);
|
|
|
|
virtual uint blockSize() const { return 16; }
|
|
|
|
};
|
2009-07-06 09:04:29 +00:00
|
|
|
|
2009-10-21 07:48:27 +00:00
|
|
|
struct FastCompressorDXT5n : public FixedBlockCompressor
|
|
|
|
{
|
|
|
|
virtual void compressBlock(ColorBlock & rgba, nvtt::AlphaMode alphaMode, const nvtt::CompressionOptions::Private & compressionOptions, void * output);
|
|
|
|
virtual uint blockSize() const { return 16; }
|
|
|
|
};
|
2008-05-06 23:55:19 +00:00
|
|
|
|
2009-10-21 07:48:27 +00:00
|
|
|
struct FastCompressorBC4 : public FixedBlockCompressor
|
|
|
|
{
|
|
|
|
virtual void compressBlock(ColorBlock & rgba, nvtt::AlphaMode alphaMode, const nvtt::CompressionOptions::Private & compressionOptions, void * output);
|
|
|
|
virtual uint blockSize() const { return 8; }
|
2009-07-06 09:04:29 +00:00
|
|
|
};
|
2008-05-06 23:55:19 +00:00
|
|
|
|
2009-10-21 07:48:27 +00:00
|
|
|
struct FastCompressorBC5 : public FixedBlockCompressor
|
2008-05-06 23:55:19 +00:00
|
|
|
{
|
2009-10-21 07:48:27 +00:00
|
|
|
virtual void compressBlock(ColorBlock & rgba, nvtt::AlphaMode alphaMode, const nvtt::CompressionOptions::Private & compressionOptions, void * output);
|
|
|
|
virtual uint blockSize() const { return 16; }
|
|
|
|
};
|
2008-05-06 23:55:19 +00:00
|
|
|
|
|
|
|
|
2009-10-21 07:48:27 +00:00
|
|
|
// Normal CPU compressors.
|
|
|
|
struct NormalCompressorDXT1 : public FixedBlockCompressor
|
|
|
|
{
|
|
|
|
virtual void compressBlock(ColorBlock & rgba, nvtt::AlphaMode alphaMode, const nvtt::CompressionOptions::Private & compressionOptions, void * output);
|
|
|
|
virtual uint blockSize() const { return 8; }
|
|
|
|
};
|
2008-05-06 23:55:19 +00:00
|
|
|
|
2009-10-21 07:48:27 +00:00
|
|
|
struct NormalCompressorDXT1a : public FixedBlockCompressor
|
|
|
|
{
|
|
|
|
virtual void compressBlock(ColorBlock & rgba, nvtt::AlphaMode alphaMode, const nvtt::CompressionOptions::Private & compressionOptions, void * output);
|
|
|
|
virtual uint blockSize() const { return 8; }
|
2008-05-06 23:55:19 +00:00
|
|
|
};
|
2007-05-17 00:11:38 +00:00
|
|
|
|
2009-10-21 07:48:27 +00:00
|
|
|
struct NormalCompressorDXT3 : public FixedBlockCompressor
|
|
|
|
{
|
|
|
|
virtual void compressBlock(ColorBlock & rgba, nvtt::AlphaMode alphaMode, const nvtt::CompressionOptions::Private & compressionOptions, void * output);
|
|
|
|
virtual uint blockSize() const { return 16; }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct NormalCompressorDXT5 : public FixedBlockCompressor
|
|
|
|
{
|
|
|
|
virtual void compressBlock(ColorBlock & rgba, nvtt::AlphaMode alphaMode, const nvtt::CompressionOptions::Private & compressionOptions, void * output);
|
|
|
|
virtual uint blockSize() const { return 16; }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct NormalCompressorDXT5n : public FixedBlockCompressor
|
|
|
|
{
|
|
|
|
virtual void compressBlock(ColorBlock & rgba, nvtt::AlphaMode alphaMode, const nvtt::CompressionOptions::Private & compressionOptions, void * output);
|
|
|
|
virtual uint blockSize() const { return 16; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Production CPU compressors.
|
|
|
|
struct ProductionCompressorBC4 : public FixedBlockCompressor
|
|
|
|
{
|
|
|
|
virtual void compressBlock(ColorBlock & rgba, nvtt::AlphaMode alphaMode, const nvtt::CompressionOptions::Private & compressionOptions, void * output);
|
|
|
|
virtual uint blockSize() const { return 8; }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ProductionCompressorBC5 : public FixedBlockCompressor
|
|
|
|
{
|
|
|
|
virtual void compressBlock(ColorBlock & rgba, nvtt::AlphaMode alphaMode, const nvtt::CompressionOptions::Private & compressionOptions, void * output);
|
|
|
|
virtual uint blockSize() const { return 16; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-05-17 00:11:38 +00:00
|
|
|
// External compressors.
|
|
|
|
#if defined(HAVE_S3QUANT)
|
2009-10-21 07:48:27 +00:00
|
|
|
struct S3CompressorDXT1 : public CompressorInterface
|
|
|
|
{
|
|
|
|
virtual void compress(nvtt::InputFormat inputFormat, nvtt::AlphaMode alphaMode, uint w, uint h, void * data, const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
|
|
|
|
};
|
2007-05-17 00:11:38 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(HAVE_ATITC)
|
2009-10-21 07:48:27 +00:00
|
|
|
struct AtiCompressorDXT1 : public CompressorInterface
|
|
|
|
{
|
|
|
|
virtual void compress(nvtt::InputFormat inputFormat, nvtt::AlphaMode alphaMode, uint w, uint h, 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, void * data, const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
|
|
|
|
};
|
2007-05-17 00:11:38 +00:00
|
|
|
#endif
|
|
|
|
|
2008-11-23 08:59:56 +00:00
|
|
|
#if defined(HAVE_SQUISH)
|
2009-10-21 07:48:27 +00:00
|
|
|
struct SquishCompressorDXT1 : public CompressorInterface
|
|
|
|
{
|
|
|
|
virtual void compress(nvtt::InputFormat inputFormat, nvtt::AlphaMode alphaMode, uint w, uint h, void * data, const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
|
|
|
|
};
|
2008-11-23 08:59:56 +00:00
|
|
|
#endif
|
|
|
|
|
2009-07-06 09:04:29 +00:00
|
|
|
#if defined(HAVE_D3DX)
|
2009-10-21 07:48:27 +00:00
|
|
|
struct D3DXCompressorDXT1 : public CompressorInterface
|
|
|
|
{
|
|
|
|
virtual void compress(nvtt::InputFormat inputFormat, nvtt::AlphaMode alphaMode, uint w, uint h, void * data, const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions);
|
|
|
|
};
|
2009-07-06 09:04:29 +00:00
|
|
|
#endif
|
|
|
|
|
2009-10-21 07:48:27 +00:00
|
|
|
#if defined(HAVE_STB)
|
|
|
|
struct StbCompressorDXT1 : public FixedBlockCompressor
|
|
|
|
{
|
|
|
|
virtual void compressBlock(ColorBlock & rgba, nvtt::AlphaMode alphaMode, const nvtt::CompressionOptions::Private & compressionOptions, void * output);
|
|
|
|
virtual uint blockSize() const { return 8; }
|
|
|
|
};
|
2009-07-06 09:04:29 +00:00
|
|
|
#endif
|
|
|
|
|
2007-05-17 00:11:38 +00:00
|
|
|
} // nv namespace
|
|
|
|
|
|
|
|
|
2010-03-16 22:37:25 +00:00
|
|
|
#endif // NV_TT_COMPRESSORDXT_H
|