ASTC encoding support

- Add 3rdparty/astc with lib version of the standard encoder
- Add astc_compress call for ASTC formats

- Add BIMG_CONFIG_ASTC_DECODE-gated decompression support. This is just for
  testing, the decompress code is currently too heavy to include in the core lib.
- Add fourcc support for DDS decode so ASTC and other formats not covered by
  dxgi can be read

- Add --formats option to texturec, lists all supported formats

- Update genie files -- add astc to bimg_encode and remove redundant files from
  texturec
This commit is contained in:
Andrew Willmott
2018-07-23 19:05:11 +01:00
parent 746f1053d7
commit 03ad3921ef
36 changed files with 40258 additions and 46 deletions

View File

@@ -156,12 +156,12 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData
const bimg::ImageBlockInfo& inputBlockInfo = bimg::getBlockInfo(inputFormat);
const bimg::ImageBlockInfo& outputBlockInfo = bimg::getBlockInfo(outputFormat);
const uint32_t blockWidth = outputBlockInfo.blockWidth;
const uint32_t blockHeight = outputBlockInfo.blockHeight;
const uint32_t minBlockX = outputBlockInfo.minBlockX;
const uint32_t minBlockY = outputBlockInfo.minBlockY;
uint32_t outputWidth = bx::uint32_max(blockWidth * minBlockX, ( (input->m_width + blockWidth - 1) / blockWidth )*blockWidth);
uint32_t outputHeight = bx::uint32_max(blockHeight * minBlockY, ( (input->m_height + blockHeight - 1) / blockHeight)*blockHeight);
uint32_t outputDepth = input->m_depth;
const uint32_t blockHeight = outputBlockInfo.blockHeight;
const uint32_t minBlockX = outputBlockInfo.minBlockX;
const uint32_t minBlockY = outputBlockInfo.minBlockY;
uint32_t outputWidth = bx::uint32_max(blockWidth * minBlockX, ( (input->m_width + blockWidth - 1) / blockWidth )*blockWidth);
uint32_t outputHeight = bx::uint32_max(blockHeight * minBlockY, ( (input->m_height + blockHeight - 1) / blockHeight)*blockHeight);
uint32_t outputDepth = input->m_depth;
if (_options.equirect)
{
@@ -842,10 +842,11 @@ void help(const char* _error = NULL, bool _showHelp = true)
" aspect ratio will be preserved.\n"
" --radiance <model> Radiance cubemap filter. (Lighting model: Phong, PhongBrdf, Blinn, BlinnBrdf, GGX)\n"
" --as <extension> Save as.\n"
" --formats List all supported formats.\n"
" --validate *DEBUG* Validate that output image produced matches after loading.\n"
"\n"
"For additional information, see https://github.com/bkaradzic/bgfx\n"
"For additional information, see https://github.com/bkaradzic/bimg\n"
);
}
@@ -909,6 +910,24 @@ int main(int _argc, const char* _argv[])
return bx::kExitFailure;
}
if (cmdLine.hasArg("formats"))
{
printf("Uncompressed formats:\n");
for (int format = bimg::TextureFormat::Unknown + 1; format < bimg::TextureFormat::UnknownDepth; format++)
printf(" %s\n", bimg::getName((bimg::TextureFormat::Enum) format));
for (int format = bimg::TextureFormat::UnknownDepth + 1; format < bimg::TextureFormat::Count; format++)
printf(" %s\n", bimg::getName((bimg::TextureFormat::Enum) format));
printf("Compressed formats:\n");
for (int format = 0; format < bimg::TextureFormat::Unknown; format++)
printf(" %s\n", bimg::getName((bimg::TextureFormat::Enum) format));
return bx::kExitSuccess;
}
const char* inputFileName = cmdLine.findOption('f');
if (NULL == inputFileName)
{