mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Added KTX support of compressed HDR and HDR formats
This commit is contained in:
parent
5ec9c5bb45
commit
5699dc6f42
2 changed files with 17 additions and 0 deletions
|
@ -570,6 +570,12 @@ bool Texture::evalKTXFormat(const Element& mipFormat, const Element& texelFormat
|
|||
header.setCompressed(ktx::GLInternalFormat::COMPRESSED_RG_RGTC2, ktx::GLBaseInternalFormat::RG);
|
||||
} else if (texelFormat == Format::COLOR_COMPRESSED_SRGBA_HIGH && mipFormat == Format::COLOR_COMPRESSED_SRGBA_HIGH) {
|
||||
header.setCompressed(ktx::GLInternalFormat::COMPRESSED_SRGB_ALPHA_BPTC_UNORM, ktx::GLBaseInternalFormat::RGBA);
|
||||
} else if (texelFormat == Format::COLOR_COMPRESSED_HDR_RGB && mipFormat == Format::COLOR_COMPRESSED_HDR_RGB) {
|
||||
header.setCompressed(ktx::GLInternalFormat::COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, ktx::GLBaseInternalFormat::RGB);
|
||||
} else if (texelFormat == Format::COLOR_RGB9E5 && mipFormat == Format::COLOR_RGB9E5) {
|
||||
header.setUncompressed(ktx::GLType::UNSIGNED_INT_5_9_9_9_REV, 1, ktx::GLFormat::RGB, ktx::GLInternalFormat::RGB9_E5, ktx::GLBaseInternalFormat::RGB);
|
||||
} else if (texelFormat == Format::COLOR_R11G11B10 && mipFormat == Format::COLOR_R11G11B10) {
|
||||
header.setUncompressed(ktx::GLType::UNSIGNED_INT_10F_11F_11F_REV, 1, ktx::GLFormat::RGB, ktx::GLInternalFormat::R11F_G11F_B10F, ktx::GLBaseInternalFormat::RGB);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -631,6 +637,15 @@ bool Texture::evalTextureFormat(const ktx::Header& header, Element& mipFormat, E
|
|||
} else if (header.getGLInternaFormat() == ktx::GLInternalFormat::COMPRESSED_SRGB_ALPHA_BPTC_UNORM) {
|
||||
mipFormat = Format::COLOR_COMPRESSED_SRGBA_HIGH;
|
||||
texelFormat = Format::COLOR_COMPRESSED_SRGBA_HIGH;
|
||||
} else if (header.getGLInternaFormat() == ktx::GLInternalFormat::COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT) {
|
||||
mipFormat = Format::COLOR_COMPRESSED_HDR_RGB;
|
||||
texelFormat = Format::COLOR_COMPRESSED_HDR_RGB;
|
||||
} else if (header.getGLInternaFormat() == ktx::GLInternalFormat::RGB9_E5) {
|
||||
mipFormat = Format::COLOR_RGB9E5;
|
||||
texelFormat = Format::COLOR_RGB9E5;
|
||||
} else if (header.getGLInternaFormat() == ktx::GLInternalFormat::R11F_G11F_B10F) {
|
||||
mipFormat = Format::COLOR_R11G11B10;
|
||||
texelFormat = Format::COLOR_R11G11B10;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -225,6 +225,7 @@ namespace khronos {
|
|||
case InternalFormat::COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: // BC3
|
||||
case InternalFormat::COMPRESSED_RED_RGTC1: // BC4
|
||||
case InternalFormat::COMPRESSED_RG_RGTC2: // BC5
|
||||
case InternalFormat::COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT: // BC6
|
||||
case InternalFormat::COMPRESSED_SRGB_ALPHA_BPTC_UNORM: // BC7
|
||||
return evalAlignedCompressedBlockCount<4>(value);
|
||||
|
||||
|
@ -241,6 +242,7 @@ namespace khronos {
|
|||
return 8;
|
||||
|
||||
case InternalFormat::COMPRESSED_SRGB_ALPHA_BPTC_UNORM:
|
||||
case InternalFormat::COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:
|
||||
case InternalFormat::COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
|
||||
case InternalFormat::COMPRESSED_RG_RGTC2:
|
||||
return 16;
|
||||
|
|
Loading…
Reference in a new issue