@@ -67,6 +67,7 @@ enum KTXGLInternalFormat
67
67
{
68
68
KTX_GL_ETC1_RGB8_OES = 0x8D64 ,
69
69
70
+ // ETC2 and EAC.
70
71
KTX_GL_COMPRESSED_R11_EAC = 0x9270 ,
71
72
KTX_GL_COMPRESSED_SIGNED_R11_EAC = 0x9271 ,
72
73
KTX_GL_COMPRESSED_RG11_EAC = 0x9272 ,
@@ -78,17 +79,33 @@ enum KTXGLInternalFormat
78
79
KTX_GL_COMPRESSED_RGBA8_ETC2_EAC = 0x9278 ,
79
80
KTX_GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279 ,
80
81
81
- // I don't know if any KTX file contains PVR data, but why not support it .
82
+ // PVRTC1 .
82
83
KTX_GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00 ,
83
84
KTX_GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8C01 ,
84
85
KTX_GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02 ,
85
86
KTX_GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8C03 ,
86
87
87
- // Same with DXT1/3/5.
88
- KTX_GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0 ,
89
- KTX_GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2 ,
90
- KTX_GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3 ,
91
-
88
+ // DXT1, DXT3, and DXT5.
89
+ KTX_GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0 ,
90
+ KTX_GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2 ,
91
+ KTX_GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3 ,
92
+ KTX_GL_COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8C4C ,
93
+ KTX_GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 0x8C4E ,
94
+ KTX_GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8C4F ,
95
+
96
+ // BC4 and BC5.
97
+ KTX_GL_COMPRESSED_RED_RGTC1 = 0x8DBB ,
98
+ KTX_GL_COMPRESSED_SIGNED_RED_RGTC1 = 0x8DBC ,
99
+ KTX_GL_COMPRESSED_RG_RGTC2 = 0x8DBD ,
100
+ KTX_GL_COMPRESSED_SIGNED_RG_RGTC2 = 0x8DBE ,
101
+
102
+ // BC6 and BC7.
103
+ KTX_GL_COMPRESSED_RGBA_BPTC_UNORM = 0x8E8C ,
104
+ KTX_GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM = 0x8E8D ,
105
+ KTX_GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT = 0x8E8E ,
106
+ KTX_GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT = 0x8E8F ,
107
+
108
+ // ASTC.
92
109
KTX_GL_COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0 ,
93
110
KTX_GL_COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1 ,
94
111
KTX_GL_COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2 ,
@@ -129,6 +146,8 @@ CompressedImageData::Format convertFormat(uint32 glformat, bool &sRGB)
129
146
{
130
147
case KTX_GL_ETC1_RGB8_OES:
131
148
return CompressedImageData::FORMAT_ETC1;
149
+
150
+ // EAC and ETC2.
132
151
case KTX_GL_COMPRESSED_R11_EAC:
133
152
return CompressedImageData::FORMAT_EAC_R;
134
153
case KTX_GL_COMPRESSED_SIGNED_R11_EAC:
@@ -152,6 +171,8 @@ CompressedImageData::Format convertFormat(uint32 glformat, bool &sRGB)
152
171
case KTX_GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
153
172
sRGB = true ;
154
173
return CompressedImageData::FORMAT_ETC2_RGBA;
174
+
175
+ // PVRTC.
155
176
case KTX_GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG:
156
177
return CompressedImageData::FORMAT_PVR1_RGB4;
157
178
case KTX_GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG:
@@ -160,12 +181,42 @@ CompressedImageData::Format convertFormat(uint32 glformat, bool &sRGB)
160
181
return CompressedImageData::FORMAT_PVR1_RGBA4;
161
182
case KTX_GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:
162
183
return CompressedImageData::FORMAT_PVR1_RGBA2;
184
+
185
+ // DXT.
186
+ case KTX_GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
187
+ sRGB = true ;
163
188
case KTX_GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
164
189
return CompressedImageData::FORMAT_DXT1;
190
+ case KTX_GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
191
+ sRGB = true ;
165
192
case KTX_GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
166
193
return CompressedImageData::FORMAT_DXT3;
194
+ case KTX_GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
195
+ sRGB = true ;
167
196
case KTX_GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
168
197
return CompressedImageData::FORMAT_DXT5;
198
+
199
+ // BC4 and BC5.
200
+ case KTX_GL_COMPRESSED_RED_RGTC1:
201
+ return CompressedImageData::FORMAT_BC4;
202
+ case KTX_GL_COMPRESSED_SIGNED_RED_RGTC1:
203
+ return CompressedImageData::FORMAT_BC4s;
204
+ case KTX_GL_COMPRESSED_RG_RGTC2:
205
+ return CompressedImageData::FORMAT_BC5;
206
+ case KTX_GL_COMPRESSED_SIGNED_RG_RGTC2:
207
+ return CompressedImageData::FORMAT_BC5s;
208
+
209
+ // BC6 and BC7.
210
+ case KTX_GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM:
211
+ sRGB = true ;
212
+ case KTX_GL_COMPRESSED_RGBA_BPTC_UNORM:
213
+ return CompressedImageData::FORMAT_BC7;
214
+ case KTX_GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT:
215
+ return CompressedImageData::FORMAT_BC6Hs;
216
+ case KTX_GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:
217
+ return CompressedImageData::FORMAT_BC6H;
218
+
219
+ // ASTC.
169
220
case KTX_GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
170
221
sRGB = true ;
171
222
case KTX_GL_COMPRESSED_RGBA_ASTC_4x4_KHR:
0 commit comments