|
@@ -67,6 +67,7 @@ enum KTXGLInternalFormat
|
|
|
{
|
|
|
KTX_GL_ETC1_RGB8_OES = 0x8D64,
|
|
|
|
|
|
+ // ETC2 and EAC.
|
|
|
KTX_GL_COMPRESSED_R11_EAC = 0x9270,
|
|
|
KTX_GL_COMPRESSED_SIGNED_R11_EAC = 0x9271,
|
|
|
KTX_GL_COMPRESSED_RG11_EAC = 0x9272,
|
|
@@ -78,17 +79,33 @@ enum KTXGLInternalFormat
|
|
|
KTX_GL_COMPRESSED_RGBA8_ETC2_EAC = 0x9278,
|
|
|
KTX_GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279,
|
|
|
|
|
|
- // I don't know if any KTX file contains PVR data, but why not support it.
|
|
|
+ // PVRTC1.
|
|
|
KTX_GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00,
|
|
|
KTX_GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8C01,
|
|
|
KTX_GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02,
|
|
|
KTX_GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8C03,
|
|
|
|
|
|
- // Same with DXT1/3/5.
|
|
|
- KTX_GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0,
|
|
|
- KTX_GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2,
|
|
|
- KTX_GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3,
|
|
|
-
|
|
|
+ // DXT1, DXT3, and DXT5.
|
|
|
+ KTX_GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0,
|
|
|
+ KTX_GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2,
|
|
|
+ KTX_GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3,
|
|
|
+ KTX_GL_COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8C4C,
|
|
|
+ KTX_GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 0x8C4E,
|
|
|
+ KTX_GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8C4F,
|
|
|
+
|
|
|
+ // BC4 and BC5.
|
|
|
+ KTX_GL_COMPRESSED_RED_RGTC1 = 0x8DBB,
|
|
|
+ KTX_GL_COMPRESSED_SIGNED_RED_RGTC1 = 0x8DBC,
|
|
|
+ KTX_GL_COMPRESSED_RG_RGTC2 = 0x8DBD,
|
|
|
+ KTX_GL_COMPRESSED_SIGNED_RG_RGTC2 = 0x8DBE,
|
|
|
+
|
|
|
+ // BC6 and BC7.
|
|
|
+ KTX_GL_COMPRESSED_RGBA_BPTC_UNORM = 0x8E8C,
|
|
|
+ KTX_GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM = 0x8E8D,
|
|
|
+ KTX_GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT = 0x8E8E,
|
|
|
+ KTX_GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT = 0x8E8F,
|
|
|
+
|
|
|
+ // ASTC.
|
|
|
KTX_GL_COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0,
|
|
|
KTX_GL_COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1,
|
|
|
KTX_GL_COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2,
|
|
@@ -129,6 +146,8 @@ CompressedImageData::Format convertFormat(uint32 glformat, bool &sRGB)
|
|
|
{
|
|
|
case KTX_GL_ETC1_RGB8_OES:
|
|
|
return CompressedImageData::FORMAT_ETC1;
|
|
|
+
|
|
|
+ // EAC and ETC2.
|
|
|
case KTX_GL_COMPRESSED_R11_EAC:
|
|
|
return CompressedImageData::FORMAT_EAC_R;
|
|
|
case KTX_GL_COMPRESSED_SIGNED_R11_EAC:
|
|
@@ -152,6 +171,8 @@ CompressedImageData::Format convertFormat(uint32 glformat, bool &sRGB)
|
|
|
case KTX_GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
|
|
|
sRGB = true;
|
|
|
return CompressedImageData::FORMAT_ETC2_RGBA;
|
|
|
+
|
|
|
+ // PVRTC.
|
|
|
case KTX_GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG:
|
|
|
return CompressedImageData::FORMAT_PVR1_RGB4;
|
|
|
case KTX_GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG:
|
|
@@ -160,12 +181,42 @@ CompressedImageData::Format convertFormat(uint32 glformat, bool &sRGB)
|
|
|
return CompressedImageData::FORMAT_PVR1_RGBA4;
|
|
|
case KTX_GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:
|
|
|
return CompressedImageData::FORMAT_PVR1_RGBA2;
|
|
|
+
|
|
|
+ // DXT.
|
|
|
+ case KTX_GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
|
|
|
+ sRGB = true;
|
|
|
case KTX_GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
|
|
|
return CompressedImageData::FORMAT_DXT1;
|
|
|
+ case KTX_GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
|
|
|
+ sRGB = true;
|
|
|
case KTX_GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
|
|
|
return CompressedImageData::FORMAT_DXT3;
|
|
|
+ case KTX_GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
|
|
|
+ sRGB = true;
|
|
|
case KTX_GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
|
|
|
return CompressedImageData::FORMAT_DXT5;
|
|
|
+
|
|
|
+ // BC4 and BC5.
|
|
|
+ case KTX_GL_COMPRESSED_RED_RGTC1:
|
|
|
+ return CompressedImageData::FORMAT_BC4;
|
|
|
+ case KTX_GL_COMPRESSED_SIGNED_RED_RGTC1:
|
|
|
+ return CompressedImageData::FORMAT_BC4s;
|
|
|
+ case KTX_GL_COMPRESSED_RG_RGTC2:
|
|
|
+ return CompressedImageData::FORMAT_BC5;
|
|
|
+ case KTX_GL_COMPRESSED_SIGNED_RG_RGTC2:
|
|
|
+ return CompressedImageData::FORMAT_BC5s;
|
|
|
+
|
|
|
+ // BC6 and BC7.
|
|
|
+ case KTX_GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM:
|
|
|
+ sRGB = true;
|
|
|
+ case KTX_GL_COMPRESSED_RGBA_BPTC_UNORM:
|
|
|
+ return CompressedImageData::FORMAT_BC7;
|
|
|
+ case KTX_GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT:
|
|
|
+ return CompressedImageData::FORMAT_BC6Hs;
|
|
|
+ case KTX_GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:
|
|
|
+ return CompressedImageData::FORMAT_BC6H;
|
|
|
+
|
|
|
+ // ASTC.
|
|
|
case KTX_GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
|
|
|
sRGB = true;
|
|
|
case KTX_GL_COMPRESSED_RGBA_ASTC_4x4_KHR:
|