Some bug fixes and more progress toward BC6-7 support.
This commit is contained in:
parent
68cbe543b0
commit
322dcd72c1
@ -246,6 +246,20 @@ namespace
|
||||
DXGI_FORMAT_B5G5R5A1_UNORM = 86,
|
||||
DXGI_FORMAT_B8G8R8A8_UNORM = 87,
|
||||
DXGI_FORMAT_B8G8R8X8_UNORM = 88,
|
||||
|
||||
DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89,
|
||||
DXGI_FORMAT_B8G8R8A8_TYPELESS = 90,
|
||||
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91,
|
||||
DXGI_FORMAT_B8G8R8X8_TYPELESS = 92,
|
||||
DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93,
|
||||
|
||||
DXGI_FORMAT_BC6H_TYPELESS = 94,
|
||||
DXGI_FORMAT_BC6H_UF16 = 95,
|
||||
DXGI_FORMAT_BC6H_SF16 = 96,
|
||||
|
||||
DXGI_FORMAT_BC7_TYPELESS = 97,
|
||||
DXGI_FORMAT_BC7_UNORM = 98,
|
||||
DXGI_FORMAT_BC7_UNORM_SRGB = 99,
|
||||
};
|
||||
|
||||
enum D3D10_RESOURCE_DIMENSION
|
||||
|
@ -148,7 +148,7 @@ void FloatImage::free()
|
||||
void FloatImage::resizeChannelCount(uint c)
|
||||
{
|
||||
if (m_componentNum != c) {
|
||||
uint count = w * h * c;
|
||||
uint count = m_width * m_height * c;
|
||||
nv::mem::realloc(m_mem, count * sizeof(float));
|
||||
|
||||
if (c > m_componentNum) {
|
||||
|
@ -29,6 +29,7 @@
|
||||
namespace nv
|
||||
{
|
||||
struct ColorBlock;
|
||||
struct Tile;
|
||||
|
||||
struct FixedBlockCompressor : public CompressorInterface
|
||||
{
|
||||
@ -38,6 +39,14 @@ namespace nv
|
||||
virtual uint blockSize() const = 0;
|
||||
};
|
||||
|
||||
struct TileCompressor : public CompressorInterface
|
||||
{
|
||||
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);
|
||||
|
||||
virtual void compressBlock(Tile & tile, nvtt::AlphaMode alphaMode, const nvtt::CompressionOptions::Private & compressionOptions, void * output) = 0;
|
||||
virtual uint blockSize() const = 0;
|
||||
};
|
||||
|
||||
} // nv namespace
|
||||
|
||||
|
||||
|
@ -455,25 +455,32 @@ bool Compressor::Private::outputHeader(const InputOptions::Private & inputOption
|
||||
else
|
||||
{
|
||||
if (compressionOptions.format == Format_DXT1 || compressionOptions.format == Format_DXT1a || compressionOptions.format == Format_DXT1n) {
|
||||
header.setDX10Format(71);
|
||||
header.setDX10Format(70); // DXGI_FORMAT_BC1_TYPELESS
|
||||
if (compressionOptions.format == Format_DXT1a) header.setHasAlphaFlag(true);
|
||||
if (inputOptions.isNormalMap) header.setNormalFlag(true);
|
||||
}
|
||||
else if (compressionOptions.format == Format_DXT3) {
|
||||
header.setDX10Format(74);
|
||||
header.setDX10Format(73); // DXGI_FORMAT_BC2_TYPELESS
|
||||
}
|
||||
else if (compressionOptions.format == Format_DXT5) {
|
||||
header.setDX10Format(77);
|
||||
header.setDX10Format(76); // DXGI_FORMAT_BC3_TYPELESS
|
||||
}
|
||||
else if (compressionOptions.format == Format_DXT5n) {
|
||||
header.setDX10Format(77);
|
||||
header.setDX10Format(76); // DXGI_FORMAT_BC3_TYPELESS
|
||||
if (inputOptions.isNormalMap) header.setNormalFlag(true);
|
||||
}
|
||||
else if (compressionOptions.format == Format_BC4) {
|
||||
header.setDX10Format(80);
|
||||
header.setDX10Format(79); // DXGI_FORMAT_BC4_TYPELESS
|
||||
}
|
||||
else if (compressionOptions.format == Format_BC5) {
|
||||
header.setDX10Format(83);
|
||||
header.setDX10Format(82); // DXGI_FORMAT_BC5_TYPELESS
|
||||
if (inputOptions.isNormalMap) header.setNormalFlag(true);
|
||||
}
|
||||
else if (compressionOptions.format == Format_BC6) {
|
||||
header.setDX10Format(94); // DXGI_FORMAT_BC6H_TYPELESS
|
||||
}
|
||||
else if (compressionOptions.format == Format_BC7) {
|
||||
header.setDX10Format(97); // DXGI_FORMAT_BC7_TYPELESS
|
||||
if (inputOptions.isNormalMap) header.setNormalFlag(true);
|
||||
}
|
||||
else {
|
||||
@ -581,6 +588,13 @@ bool Compressor::Private::outputHeader(const InputOptions::Private & inputOption
|
||||
header.setSwizzleCode('A', '2', 'X', 'Y');
|
||||
}
|
||||
}
|
||||
else if (compressionOptions.format == Format_BC6) {
|
||||
header.setFourCC('Z', 'O', 'H', ' ');
|
||||
}
|
||||
else if (compressionOptions.format == Format_BC7) {
|
||||
header.setFourCC('Z', 'O', 'L', 'A');
|
||||
if (inputOptions.isNormalMap) header.setNormalFlag(true);
|
||||
}
|
||||
else if (compressionOptions.format == Format_CTX1) {
|
||||
header.setFourCC('C', 'T', 'X', '1');
|
||||
if (inputOptions.isNormalMap) header.setNormalFlag(true);
|
||||
|
@ -93,7 +93,7 @@ namespace nvtt
|
||||
|
||||
Format_DXT1n,// Not supported on CPU yet.
|
||||
Format_CTX1, // Not supported on CPU yet.
|
||||
Format_YCoCg_DXT5, // Not supported yet.
|
||||
//Format_YCoCg_DXT5, // Not supported yet.
|
||||
|
||||
Format_BC6, // Not supported yet.
|
||||
Format_BC7, // Not supported yet.
|
||||
@ -101,7 +101,7 @@ namespace nvtt
|
||||
Format_RGBE,
|
||||
};
|
||||
|
||||
/// Pixel types.
|
||||
/// Pixel types. These basically indicate how the output should be interpreted, but do not have any influence over the input.
|
||||
enum PixelType
|
||||
{
|
||||
PixelType_UnsignedNorm,
|
||||
@ -109,6 +109,7 @@ namespace nvtt
|
||||
PixelType_UnsignedInt, // Not supported yet.
|
||||
PixelType_SignedInt, // Not supported yet.
|
||||
PixelType_Float,
|
||||
PixelType_UnsignedFloat,
|
||||
};
|
||||
|
||||
/// Quality modes.
|
||||
|
Loading…
Reference in New Issue
Block a user