1/* 
2================================================================================================ 
3 
4Description : OpenGL formats/types and properties. 
5Author : J.M.P. van Waveren 
6Date : 07/17/2016 
7Language : C99 
8Format : Real tabs with the tab size equal to 4 spaces. 
9Copyright : Copyright (c) 2016 Oculus VR, LLC. All Rights reserved. 
10 
11 
12LICENSE 
13======= 
14 
15Copyright 2016 Oculus VR, LLC. 
16SPDX-License-Identifier: Apache-2.0 
17 
18 
19DESCRIPTION 
20=========== 
21 
22This header stores the OpenGL formats/types and two simple routines 
23to derive the format/type from an internal format. These routines 
24are useful to verify the data in a KTX container files. The OpenGL 
25constants are generally useful to convert files like KTX and glTF 
26to different graphics APIs. 
27 
28This header stores the OpenGL formats/types that are used as parameters 
29to the following OpenGL functions: 
30 
31void glTexImage2D( GLenum target, GLint level, GLint internalFormat, 
32 GLsizei width, GLsizei height, GLint border, 
33 GLenum format, GLenum type, const GLvoid * data ); 
34void glTexImage3D( GLenum target, GLint level, GLint internalFormat, 
35 GLsizei width, GLsizei height, GLsizei depth, GLint border, 
36 GLenum format, GLenum type, const GLvoid * data ); 
37void glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, 
38 GLsizei width, GLsizei height, GLint border, 
39 GLsizei imageSize, const GLvoid * data ); 
40void glCompressedTexImage3D( GLenum target, GLint level, GLenum internalformat, 
41 GLsizei width, GLsizei height, GLsizei depth, GLint border, 
42 GLsizei imageSize, const GLvoid * data ); 
43void glTexStorage2D( GLenum target, GLsizei levels, GLenum internalformat, 
44 GLsizei width, GLsizei height ); 
45void glTexStorage3D( GLenum target, GLsizei levels, GLenum internalformat, 
46 GLsizei width, GLsizei height, GLsizei depth ); 
47void glVertexAttribPointer( GLuint index, GLint size, GLenum type, GLboolean normalized, 
48 GLsizei stride, const GLvoid * pointer); 
49 
50 
51IMPLEMENTATION 
52============== 
53 
54This file does not include OpenGL / OpenGL ES headers because: 
55 
56 1. Including OpenGL / OpenGL ES headers is platform dependent and 
57 may require a separate installation of an OpenGL SDK. 
58 2. The OpenGL format/type constants are the same between extensions and core. 
59 3. The OpenGL format/type constants are the same between OpenGL and OpenGL ES. 
60 4. The OpenGL constants in this header are also used to derive Vulkan formats 
61 from the OpenGL formats/types stored in files like KTX and glTF. These file 
62 formats may use OpenGL formats/types that are not supported by the OpenGL 
63 implementation on the platform but are supported by the Vulkan implementation. 
64 
65 
66ENTRY POINTS 
67============ 
68 
69static inline GLenum glGetFormatFromInternalFormat( const GLenum internalFormat ); 
70static inline GLenum glGetTypeFromInternalFormat( const GLenum internalFormat ); 
71static inline void glGetFormatSize( const GLenum internalFormat, GlFormatSize * pFormatSize ); 
72static inline unsigned int glGetTypeSizeFromType( const GLenum type ); 
73 
74MODIFICATIONS for use in libktx 
75=============================== 
76 
772018.3.23 Added glGetTypeSizeFromType. Mark Callow, Edgewise Consulting. 
782019.3.09 #if 0 around GL type declarations. 〃 
792019.5.30 Use common ktxFormatSize to return results. 〃 
802019.5.30 Return blockSizeInBits 0 for default case of glGetFormatSize. 〃 
81 
82================================================================================================ 
83*/ 
84 
85#if !defined( GL_FORMAT_H ) 
86#define GL_FORMAT_H 
87 
88#include <assert.h> 
89#include "formatsize.h" 
90#include "vkformat_enum.h" 
91 
92#if defined(_WIN32) && !defined(__MINGW32__) 
93#if !defined(NOMINMAX) 
94#define NOMINMAX 
95#endif // !defined(NOMINMAX) 
96#ifndef __cplusplus 
97#undef inline 
98#define inline __inline 
99#endif // __cplusplus 
100#endif 
101 
102 
103/* 
104=========================================================================== 
105Avoid warnings or even errors when using strict C99. "Redefinition of 
106(type) is a C11 feature." All includers in libktx also include ktx.h where 
107they are also defined. 
108=========================================================================== 
109*/ 
110#if 0 
111typedef unsigned int GLenum; 
112typedef unsigned char GLboolean; 
113typedef unsigned int GLuint; 
114#endif 
115 
116#if !defined( GL_INVALID_VALUE ) 
117#define GL_INVALID_VALUE 0x0501 
118#endif 
119 
120/* 
121================================================================================================================================ 
122 
123Format to glTexImage2D and glTexImage3D. 
124 
125================================================================================================================================ 
126*/ 
127 
128#if !defined( GL_RED ) 
129#define GL_RED 0x1903 // same as GL_RED_EXT 
130#endif 
131#if !defined( GL_GREEN ) 
132#define GL_GREEN 0x1904 // deprecated 
133#endif 
134#if !defined( GL_BLUE ) 
135#define GL_BLUE 0x1905 // deprecated 
136#endif 
137#if !defined( GL_ALPHA ) 
138#define GL_ALPHA 0x1906 // deprecated 
139#endif 
140#if !defined( GL_LUMINANCE ) 
141#define GL_LUMINANCE 0x1909 // deprecated 
142#endif 
143#if !defined( GL_SLUMINANCE ) 
144#define GL_SLUMINANCE 0x8C46 // deprecated, same as GL_SLUMINANCE_EXT 
145#endif 
146#if !defined( GL_LUMINANCE_ALPHA ) 
147#define GL_LUMINANCE_ALPHA 0x190A // deprecated 
148#endif 
149#if !defined( GL_SLUMINANCE_ALPHA ) 
150#define GL_SLUMINANCE_ALPHA 0x8C44 // deprecated, same as GL_SLUMINANCE_ALPHA_EXT 
151#endif 
152#if !defined( GL_INTENSITY ) 
153#define GL_INTENSITY 0x8049 // deprecated, same as GL_INTENSITY_EXT 
154#endif 
155#if !defined( GL_RG ) 
156#define GL_RG 0x8227 // same as GL_RG_EXT 
157#endif 
158#if !defined( GL_RGB ) 
159#define GL_RGB 0x1907 
160#endif 
161#if !defined( GL_BGR ) 
162#define GL_BGR 0x80E0 // same as GL_BGR_EXT 
163#endif 
164#if !defined( GL_RGBA ) 
165#define GL_RGBA 0x1908 
166#endif 
167#if !defined( GL_BGRA ) 
168#define GL_BGRA 0x80E1 // same as GL_BGRA_EXT 
169#endif 
170#if !defined( GL_RED_INTEGER ) 
171#define GL_RED_INTEGER 0x8D94 // same as GL_RED_INTEGER_EXT 
172#endif 
173#if !defined( GL_GREEN_INTEGER ) 
174#define GL_GREEN_INTEGER 0x8D95 // deprecated, same as GL_GREEN_INTEGER_EXT 
175#endif 
176#if !defined( GL_BLUE_INTEGER ) 
177#define GL_BLUE_INTEGER 0x8D96 // deprecated, same as GL_BLUE_INTEGER_EXT 
178#endif 
179#if !defined( GL_ALPHA_INTEGER ) 
180#define GL_ALPHA_INTEGER 0x8D97 // deprecated, same as GL_ALPHA_INTEGER_EXT 
181#endif 
182#if !defined( GL_LUMINANCE_INTEGER ) 
183#define GL_LUMINANCE_INTEGER 0x8D9C // deprecated, same as GL_LUMINANCE_INTEGER_EXT 
184#endif 
185#if !defined( GL_LUMINANCE_ALPHA_INTEGER ) 
186#define GL_LUMINANCE_ALPHA_INTEGER 0x8D9D // deprecated, same as GL_LUMINANCE_ALPHA_INTEGER_EXT 
187#endif 
188#if !defined( GL_RG_INTEGER ) 
189#define GL_RG_INTEGER 0x8228 // same as GL_RG_INTEGER_EXT 
190#endif 
191#if !defined( GL_RGB_INTEGER ) 
192#define GL_RGB_INTEGER 0x8D98 // same as GL_RGB_INTEGER_EXT 
193#endif 
194#if !defined( GL_BGR_INTEGER ) 
195#define GL_BGR_INTEGER 0x8D9A // same as GL_BGR_INTEGER_EXT 
196#endif 
197#if !defined( GL_RGBA_INTEGER ) 
198#define GL_RGBA_INTEGER 0x8D99 // same as GL_RGBA_INTEGER_EXT 
199#endif 
200#if !defined( GL_BGRA_INTEGER ) 
201#define GL_BGRA_INTEGER 0x8D9B // same as GL_BGRA_INTEGER_EXT 
202#endif 
203#if !defined( GL_COLOR_INDEX ) 
204#define GL_COLOR_INDEX 0x1900 // deprecated 
205#endif 
206#if !defined( GL_STENCIL_INDEX ) 
207#define GL_STENCIL_INDEX 0x1901 
208#endif 
209#if !defined( GL_DEPTH_COMPONENT ) 
210#define GL_DEPTH_COMPONENT 0x1902 
211#endif 
212#if !defined( GL_DEPTH_STENCIL ) 
213#define GL_DEPTH_STENCIL 0x84F9 // same as GL_DEPTH_STENCIL_NV and GL_DEPTH_STENCIL_EXT and GL_DEPTH_STENCIL_OES 
214#endif 
215 
216/* 
217================================================================================================================================ 
218 
219Type to glTexImage2D, glTexImage3D and glVertexAttribPointer. 
220 
221================================================================================================================================ 
222*/ 
223 
224#if !defined( GL_BYTE ) 
225#define GL_BYTE 0x1400 
226#endif 
227#if !defined( GL_UNSIGNED_BYTE ) 
228#define GL_UNSIGNED_BYTE 0x1401 
229#endif 
230#if !defined( GL_SHORT ) 
231#define GL_SHORT 0x1402 
232#endif 
233#if !defined( GL_UNSIGNED_SHORT ) 
234#define GL_UNSIGNED_SHORT 0x1403 
235#endif 
236#if !defined( GL_INT ) 
237#define GL_INT 0x1404 
238#endif 
239#if !defined( GL_UNSIGNED_INT ) 
240#define GL_UNSIGNED_INT 0x1405 
241#endif 
242#if !defined( GL_INT64 ) 
243#define GL_INT64 0x140E // same as GL_INT64_NV and GL_INT64_ARB 
244#endif 
245#if !defined( GL_UNSIGNED_INT64 ) 
246#define GL_UNSIGNED_INT64 0x140F // same as GL_UNSIGNED_INT64_NV and GL_UNSIGNED_INT64_ARB 
247#endif 
248#if !defined( GL_HALF_FLOAT ) 
249#define GL_HALF_FLOAT 0x140B // same as GL_HALF_FLOAT_NV and GL_HALF_FLOAT_ARB 
250#endif 
251#if !defined( GL_HALF_FLOAT_OES ) 
252#define GL_HALF_FLOAT_OES 0x8D61 // Note that this different from GL_HALF_FLOAT. 
253#endif 
254#if !defined( GL_FLOAT ) 
255#define GL_FLOAT 0x1406 
256#endif 
257#if !defined( GL_DOUBLE ) 
258#define GL_DOUBLE 0x140A // same as GL_DOUBLE_EXT 
259#endif 
260#if !defined( GL_UNSIGNED_BYTE_3_3_2 ) 
261#define GL_UNSIGNED_BYTE_3_3_2 0x8032 // same as GL_UNSIGNED_BYTE_3_3_2_EXT 
262#endif 
263#if !defined( GL_UNSIGNED_BYTE_2_3_3_REV ) 
264#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 // same as GL_UNSIGNED_BYTE_2_3_3_REV_EXT 
265#endif 
266#if !defined( GL_UNSIGNED_SHORT_5_6_5 ) 
267#define GL_UNSIGNED_SHORT_5_6_5 0x8363 // same as GL_UNSIGNED_SHORT_5_6_5_EXT 
268#endif 
269#if !defined( GL_UNSIGNED_SHORT_5_6_5_REV ) 
270#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 // same as GL_UNSIGNED_SHORT_5_6_5_REV_EXT 
271#endif 
272#if !defined( GL_UNSIGNED_SHORT_4_4_4_4 ) 
273#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 // same as GL_UNSIGNED_SHORT_4_4_4_4_EXT 
274#endif 
275#if !defined( GL_UNSIGNED_SHORT_4_4_4_4_REV ) 
276#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 // same as GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG and GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 
277#endif 
278#if !defined( GL_UNSIGNED_SHORT_5_5_5_1 ) 
279#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 // same as GL_UNSIGNED_SHORT_5_5_5_1_EXT 
280#endif 
281#if !defined( GL_UNSIGNED_SHORT_1_5_5_5_REV ) 
282#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 // same as GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 
283#endif 
284#if !defined( GL_UNSIGNED_INT_8_8_8_8 ) 
285#define GL_UNSIGNED_INT_8_8_8_8 0x8035 // same as GL_UNSIGNED_INT_8_8_8_8_EXT 
286#endif 
287#if !defined( GL_UNSIGNED_INT_8_8_8_8_REV ) 
288#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 // same as GL_UNSIGNED_INT_8_8_8_8_REV_EXT 
289#endif 
290#if !defined( GL_UNSIGNED_INT_10_10_10_2 ) 
291#define GL_UNSIGNED_INT_10_10_10_2 0x8036 // same as GL_UNSIGNED_INT_10_10_10_2_EXT 
292#endif 
293#if !defined( GL_UNSIGNED_INT_2_10_10_10_REV ) 
294#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 // same as GL_UNSIGNED_INT_2_10_10_10_REV_EXT 
295#endif 
296#if !defined( GL_UNSIGNED_INT_10F_11F_11F_REV ) 
297#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B // same as GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 
298#endif 
299#if !defined( GL_UNSIGNED_INT_5_9_9_9_REV ) 
300#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E // same as GL_UNSIGNED_INT_5_9_9_9_REV_EXT 
301#endif 
302#if !defined( GL_UNSIGNED_INT_24_8 ) 
303#define GL_UNSIGNED_INT_24_8 0x84FA // same as GL_UNSIGNED_INT_24_8_NV and GL_UNSIGNED_INT_24_8_EXT and GL_UNSIGNED_INT_24_8_OES 
304#endif 
305#if !defined( GL_FLOAT_32_UNSIGNED_INT_24_8_REV ) 
306#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD // same as GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV and GL_FLOAT_32_UNSIGNED_INT_24_8_REV_ARB 
307#endif 
308 
309/* 
310================================================================================================================================ 
311 
312Internal format to glTexImage2D, glTexImage3D, glCompressedTexImage2D, glCompressedTexImage3D, glTexStorage2D, glTexStorage3D 
313 
314================================================================================================================================ 
315*/ 
316 
317// 
318// 8 bits per component 
319// 
320 
321#if !defined( GL_R8 ) 
322#define GL_R8 0x8229 // same as GL_R8_EXT 
323#endif 
324#if !defined( GL_RG8 ) 
325#define GL_RG8 0x822B // same as GL_RG8_EXT 
326#endif 
327#if !defined( GL_RGB8 ) 
328#define GL_RGB8 0x8051 // same as GL_RGB8_EXT and GL_RGB8_OES 
329#endif 
330#if !defined( GL_RGBA8 ) 
331#define GL_RGBA8 0x8058 // same as GL_RGBA8_EXT and GL_RGBA8_OES 
332#endif 
333 
334#if !defined( GL_R8_SNORM ) 
335#define GL_R8_SNORM 0x8F94 
336#endif 
337#if !defined( GL_RG8_SNORM ) 
338#define GL_RG8_SNORM 0x8F95 
339#endif 
340#if !defined( GL_RGB8_SNORM ) 
341#define GL_RGB8_SNORM 0x8F96 
342#endif 
343#if !defined( GL_RGBA8_SNORM ) 
344#define GL_RGBA8_SNORM 0x8F97 
345#endif 
346 
347#if !defined( GL_R8UI ) 
348#define GL_R8UI 0x8232 
349#endif 
350#if !defined( GL_RG8UI ) 
351#define GL_RG8UI 0x8238 
352#endif 
353#if !defined( GL_RGB8UI ) 
354#define GL_RGB8UI 0x8D7D // same as GL_RGB8UI_EXT 
355#endif 
356#if !defined( GL_RGBA8UI ) 
357#define GL_RGBA8UI 0x8D7C // same as GL_RGBA8UI_EXT 
358#endif 
359 
360#if !defined( GL_R8I ) 
361#define GL_R8I 0x8231 
362#endif 
363#if !defined( GL_RG8I ) 
364#define GL_RG8I 0x8237 
365#endif 
366#if !defined( GL_RGB8I ) 
367#define GL_RGB8I 0x8D8F // same as GL_RGB8I_EXT 
368#endif 
369#if !defined( GL_RGBA8I ) 
370#define GL_RGBA8I 0x8D8E // same as GL_RGBA8I_EXT 
371#endif 
372 
373#if !defined( GL_SR8 ) 
374#define GL_SR8 0x8FBD // same as GL_SR8_EXT 
375#endif 
376#if !defined( GL_SRG8 ) 
377#define GL_SRG8 0x8FBE // same as GL_SRG8_EXT 
378#endif 
379#if !defined( GL_SRGB8 ) 
380#define GL_SRGB8 0x8C41 // same as GL_SRGB8_EXT 
381#endif 
382#if !defined( GL_SRGB8_ALPHA8 ) 
383#define GL_SRGB8_ALPHA8 0x8C43 // same as GL_SRGB8_ALPHA8_EXT 
384#endif 
385 
386// 
387// 16 bits per component 
388// 
389 
390#if !defined( GL_R16 ) 
391#define GL_R16 0x822A // same as GL_R16_EXT 
392#endif 
393#if !defined( GL_RG16 ) 
394#define GL_RG16 0x822C // same as GL_RG16_EXT 
395#endif 
396#if !defined( GL_RGB16 ) 
397#define GL_RGB16 0x8054 // same as GL_RGB16_EXT 
398#endif 
399#if !defined( GL_RGBA16 ) 
400#define GL_RGBA16 0x805B // same as GL_RGBA16_EXT 
401#endif 
402 
403#if !defined( GL_R16_SNORM ) 
404#define GL_R16_SNORM 0x8F98 // same as GL_R16_SNORM_EXT 
405#endif 
406#if !defined( GL_RG16_SNORM ) 
407#define GL_RG16_SNORM 0x8F99 // same as GL_RG16_SNORM_EXT 
408#endif 
409#if !defined( GL_RGB16_SNORM ) 
410#define GL_RGB16_SNORM 0x8F9A // same as GL_RGB16_SNORM_EXT 
411#endif 
412#if !defined( GL_RGBA16_SNORM ) 
413#define GL_RGBA16_SNORM 0x8F9B // same as GL_RGBA16_SNORM_EXT 
414#endif 
415 
416#if !defined( GL_R16UI ) 
417#define GL_R16UI 0x8234 
418#endif 
419#if !defined( GL_RG16UI ) 
420#define GL_RG16UI 0x823A 
421#endif 
422#if !defined( GL_RGB16UI ) 
423#define GL_RGB16UI 0x8D77 // same as GL_RGB16UI_EXT 
424#endif 
425#if !defined( GL_RGBA16UI ) 
426#define GL_RGBA16UI 0x8D76 // same as GL_RGBA16UI_EXT 
427#endif 
428 
429#if !defined( GL_R16I ) 
430#define GL_R16I 0x8233 
431#endif 
432#if !defined( GL_RG16I ) 
433#define GL_RG16I 0x8239 
434#endif 
435#if !defined( GL_RGB16I ) 
436#define GL_RGB16I 0x8D89 // same as GL_RGB16I_EXT 
437#endif 
438#if !defined( GL_RGBA16I ) 
439#define GL_RGBA16I 0x8D88 // same as GL_RGBA16I_EXT 
440#endif 
441 
442#if !defined( GL_R16F ) 
443#define GL_R16F 0x822D // same as GL_R16F_EXT 
444#endif 
445#if !defined( GL_RG16F ) 
446#define GL_RG16F 0x822F // same as GL_RG16F_EXT 
447#endif 
448#if !defined( GL_RGB16F ) 
449#define GL_RGB16F 0x881B // same as GL_RGB16F_EXT and GL_RGB16F_ARB 
450#endif 
451#if !defined( GL_RGBA16F ) 
452#define GL_RGBA16F 0x881A // sama as GL_RGBA16F_EXT and GL_RGBA16F_ARB 
453#endif 
454 
455// 
456// 32 bits per component 
457// 
458 
459#if !defined( GL_R32UI ) 
460#define GL_R32UI 0x8236 
461#endif 
462#if !defined( GL_RG32UI ) 
463#define GL_RG32UI 0x823C 
464#endif 
465#if !defined( GL_RGB32UI ) 
466#define GL_RGB32UI 0x8D71 // same as GL_RGB32UI_EXT 
467#endif 
468#if !defined( GL_RGBA32UI ) 
469#define GL_RGBA32UI 0x8D70 // same as GL_RGBA32UI_EXT 
470#endif 
471 
472#if !defined( GL_R32I ) 
473#define GL_R32I 0x8235 
474#endif 
475#if !defined( GL_RG32I ) 
476#define GL_RG32I 0x823B 
477#endif 
478#if !defined( GL_RGB32I ) 
479#define GL_RGB32I 0x8D83 // same as GL_RGB32I_EXT 
480#endif 
481#if !defined( GL_RGBA32I ) 
482#define GL_RGBA32I 0x8D82 // same as GL_RGBA32I_EXT 
483#endif 
484 
485#if !defined( GL_R32F ) 
486#define GL_R32F 0x822E // same as GL_R32F_EXT 
487#endif 
488#if !defined( GL_RG32F ) 
489#define GL_RG32F 0x8230 // same as GL_RG32F_EXT 
490#endif 
491#if !defined( GL_RGB32F ) 
492#define GL_RGB32F 0x8815 // same as GL_RGB32F_EXT and GL_RGB32F_ARB 
493#endif 
494#if !defined( GL_RGBA32F ) 
495#define GL_RGBA32F 0x8814 // same as GL_RGBA32F_EXT and GL_RGBA32F_ARB 
496#endif 
497 
498// 
499// Packed 
500// 
501 
502#if !defined( GL_R3_G3_B2 ) 
503#define GL_R3_G3_B2 0x2A10 
504#endif 
505#if !defined( GL_RGB4 ) 
506#define GL_RGB4 0x804F // same as GL_RGB4_EXT 
507#endif 
508#if !defined( GL_RGB5 ) 
509#define GL_RGB5 0x8050 // same as GL_RGB5_EXT 
510#endif 
511#if !defined( GL_RGB565 ) 
512#define GL_RGB565 0x8D62 // same as GL_RGB565_EXT and GL_RGB565_OES 
513#endif 
514#if !defined( GL_RGB10 ) 
515#define GL_RGB10 0x8052 // same as GL_RGB10_EXT 
516#endif 
517#if !defined( GL_RGB12 ) 
518#define GL_RGB12 0x8053 // same as GL_RGB12_EXT 
519#endif 
520#if !defined( GL_RGBA2 ) 
521#define GL_RGBA2 0x8055 // same as GL_RGBA2_EXT 
522#endif 
523#if !defined( GL_RGBA4 ) 
524#define GL_RGBA4 0x8056 // same as GL_RGBA4_EXT and GL_RGBA4_OES 
525#endif 
526#if !defined( GL_RGBA12 ) 
527#define GL_RGBA12 0x805A // same as GL_RGBA12_EXT 
528#endif 
529#if !defined( GL_RGB5_A1 ) 
530#define GL_RGB5_A1 0x8057 // same as GL_RGB5_A1_EXT and GL_RGB5_A1_OES 
531#endif 
532#if !defined( GL_RGB10_A2 ) 
533#define GL_RGB10_A2 0x8059 // same as GL_RGB10_A2_EXT 
534#endif 
535#if !defined( GL_RGB10_A2UI ) 
536#define GL_RGB10_A2UI 0x906F 
537#endif 
538#if !defined( GL_R11F_G11F_B10F ) 
539#define GL_R11F_G11F_B10F 0x8C3A // same as GL_R11F_G11F_B10F_APPLE and GL_R11F_G11F_B10F_EXT 
540#endif 
541#if !defined( GL_RGB9_E5 ) 
542#define GL_RGB9_E5 0x8C3D // same as GL_RGB9_E5_APPLE and GL_RGB9_E5_EXT 
543#endif 
544 
545// 
546// Alpha 
547// 
548 
549#if !defined( GL_ALPHA4 ) 
550#define GL_ALPHA4 0x803B // deprecated, same as GL_ALPHA4_EXT 
551#endif 
552#if !defined( GL_ALPHA8 ) 
553#define GL_ALPHA8 0x803C // deprecated, same as GL_ALPHA8_EXT 
554#endif 
555#if !defined( GL_ALPHA8_SNORM ) 
556#define GL_ALPHA8_SNORM 0x9014 // deprecated 
557#endif 
558#if !defined( GL_ALPHA8UI_EXT ) 
559#define GL_ALPHA8UI_EXT 0x8D7E // deprecated 
560#endif 
561#if !defined( GL_ALPHA8I_EXT ) 
562#define GL_ALPHA8I_EXT 0x8D90 // deprecated 
563#endif 
564#if !defined( GL_ALPHA12 ) 
565#define GL_ALPHA12 0x803D // deprecated, same as GL_ALPHA12_EXT 
566#endif 
567#if !defined( GL_ALPHA16 ) 
568#define GL_ALPHA16 0x803E // deprecated, same as GL_ALPHA16_EXT 
569#endif 
570#if !defined( GL_ALPHA16_SNORM ) 
571#define GL_ALPHA16_SNORM 0x9018 // deprecated 
572#endif 
573#if !defined( GL_ALPHA16UI_EXT ) 
574#define GL_ALPHA16UI_EXT 0x8D78 // deprecated 
575#endif 
576#if !defined( GL_ALPHA16I_EXT ) 
577#define GL_ALPHA16I_EXT 0x8D8A // deprecated 
578#endif 
579#if !defined( GL_ALPHA16F_ARB ) 
580#define GL_ALPHA16F_ARB 0x881C // deprecated, same as GL_ALPHA_FLOAT16_APPLE and GL_ALPHA_FLOAT16_ATI 
581#endif 
582#if !defined( GL_ALPHA32UI_EXT ) 
583#define GL_ALPHA32UI_EXT 0x8D72 // deprecated 
584#endif 
585#if !defined( GL_ALPHA32I_EXT ) 
586#define GL_ALPHA32I_EXT 0x8D84 // deprecated 
587#endif 
588#if !defined( GL_ALPHA32F_ARB ) 
589#define GL_ALPHA32F_ARB 0x8816 // deprecated, same as GL_ALPHA_FLOAT32_APPLE and GL_ALPHA_FLOAT32_ATI 
590#endif 
591 
592// 
593// Luminance 
594// 
595 
596#if !defined( GL_LUMINANCE4 ) 
597#define GL_LUMINANCE4 0x803F // deprecated, same as GL_LUMINANCE4_EXT 
598#endif 
599#if !defined( GL_LUMINANCE8 ) 
600#define GL_LUMINANCE8 0x8040 // deprecated, same as GL_LUMINANCE8_EXT 
601#endif 
602#if !defined( GL_LUMINANCE8_SNORM ) 
603#define GL_LUMINANCE8_SNORM 0x9015 // deprecated 
604#endif 
605#if !defined( GL_SLUMINANCE8 ) 
606#define GL_SLUMINANCE8 0x8C47 // deprecated, same as GL_SLUMINANCE8_EXT 
607#endif 
608#if !defined( GL_LUMINANCE8UI_EXT ) 
609#define GL_LUMINANCE8UI_EXT 0x8D80 // deprecated 
610#endif 
611#if !defined( GL_LUMINANCE8I_EXT ) 
612#define GL_LUMINANCE8I_EXT 0x8D92 // deprecated 
613#endif 
614#if !defined( GL_LUMINANCE12 ) 
615#define GL_LUMINANCE12 0x8041 // deprecated, same as GL_LUMINANCE12_EXT 
616#endif 
617#if !defined( GL_LUMINANCE16 ) 
618#define GL_LUMINANCE16 0x8042 // deprecated, same as GL_LUMINANCE16_EXT 
619#endif 
620#if !defined( GL_LUMINANCE16_SNORM ) 
621#define GL_LUMINANCE16_SNORM 0x9019 // deprecated 
622#endif 
623#if !defined( GL_LUMINANCE16UI_EXT ) 
624#define GL_LUMINANCE16UI_EXT 0x8D7A // deprecated 
625#endif 
626#if !defined( GL_LUMINANCE16I_EXT ) 
627#define GL_LUMINANCE16I_EXT 0x8D8C // deprecated 
628#endif 
629#if !defined( GL_LUMINANCE16F_ARB ) 
630#define GL_LUMINANCE16F_ARB 0x881E // deprecated, same as GL_LUMINANCE_FLOAT16_APPLE and GL_LUMINANCE_FLOAT16_ATI 
631#endif 
632#if !defined( GL_LUMINANCE32UI_EXT ) 
633#define GL_LUMINANCE32UI_EXT 0x8D74 // deprecated 
634#endif 
635#if !defined( GL_LUMINANCE32I_EXT ) 
636#define GL_LUMINANCE32I_EXT 0x8D86 // deprecated 
637#endif 
638#if !defined( GL_LUMINANCE32F_ARB ) 
639#define GL_LUMINANCE32F_ARB 0x8818 // deprecated, same as GL_LUMINANCE_FLOAT32_APPLE and GL_LUMINANCE_FLOAT32_ATI 
640#endif 
641 
642// 
643// Luminance/Alpha 
644// 
645 
646#if !defined( GL_LUMINANCE4_ALPHA4 ) 
647#define GL_LUMINANCE4_ALPHA4 0x8043 // deprecated, same as GL_LUMINANCE4_ALPHA4_EXT 
648#endif 
649#if !defined( GL_LUMINANCE6_ALPHA2 ) 
650#define GL_LUMINANCE6_ALPHA2 0x8044 // deprecated, same as GL_LUMINANCE6_ALPHA2_EXT 
651#endif 
652#if !defined( GL_LUMINANCE8_ALPHA8 ) 
653#define GL_LUMINANCE8_ALPHA8 0x8045 // deprecated, same as GL_LUMINANCE8_ALPHA8_EXT 
654#endif 
655#if !defined( GL_LUMINANCE8_ALPHA8_SNORM ) 
656#define GL_LUMINANCE8_ALPHA8_SNORM 0x9016 // deprecated 
657#endif 
658#if !defined( GL_SLUMINANCE8_ALPHA8 ) 
659#define GL_SLUMINANCE8_ALPHA8 0x8C45 // deprecated, same as GL_SLUMINANCE8_ALPHA8_EXT 
660#endif 
661#if !defined( GL_LUMINANCE_ALPHA8UI_EXT ) 
662#define GL_LUMINANCE_ALPHA8UI_EXT 0x8D81 // deprecated 
663#endif 
664#if !defined( GL_LUMINANCE_ALPHA8I_EXT ) 
665#define GL_LUMINANCE_ALPHA8I_EXT 0x8D93 // deprecated 
666#endif 
667#if !defined( GL_LUMINANCE12_ALPHA4 ) 
668#define GL_LUMINANCE12_ALPHA4 0x8046 // deprecated, same as GL_LUMINANCE12_ALPHA4_EXT 
669#endif 
670#if !defined( GL_LUMINANCE12_ALPHA12 ) 
671#define GL_LUMINANCE12_ALPHA12 0x8047 // deprecated, same as GL_LUMINANCE12_ALPHA12_EXT 
672#endif 
673#if !defined( GL_LUMINANCE16_ALPHA16 ) 
674#define GL_LUMINANCE16_ALPHA16 0x8048 // deprecated, same as GL_LUMINANCE16_ALPHA16_EXT 
675#endif 
676#if !defined( GL_LUMINANCE16_ALPHA16_SNORM ) 
677#define GL_LUMINANCE16_ALPHA16_SNORM 0x901A // deprecated 
678#endif 
679#if !defined( GL_LUMINANCE_ALPHA16UI_EXT ) 
680#define GL_LUMINANCE_ALPHA16UI_EXT 0x8D7B // deprecated 
681#endif 
682#if !defined( GL_LUMINANCE_ALPHA16I_EXT ) 
683#define GL_LUMINANCE_ALPHA16I_EXT 0x8D8D // deprecated 
684#endif 
685#if !defined( GL_LUMINANCE_ALPHA16F_ARB ) 
686#define GL_LUMINANCE_ALPHA16F_ARB 0x881F // deprecated, same as GL_LUMINANCE_ALPHA_FLOAT16_APPLE and GL_LUMINANCE_ALPHA_FLOAT16_ATI 
687#endif 
688#if !defined( GL_LUMINANCE_ALPHA32UI_EXT ) 
689#define GL_LUMINANCE_ALPHA32UI_EXT 0x8D75 // deprecated 
690#endif 
691#if !defined( GL_LUMINANCE_ALPHA32I_EXT ) 
692#define GL_LUMINANCE_ALPHA32I_EXT 0x8D87 // deprecated 
693#endif 
694#if !defined( GL_LUMINANCE_ALPHA32F_ARB ) 
695#define GL_LUMINANCE_ALPHA32F_ARB 0x8819 // deprecated, same as GL_LUMINANCE_ALPHA_FLOAT32_APPLE and GL_LUMINANCE_ALPHA_FLOAT32_ATI 
696#endif 
697 
698// 
699// Intensity 
700// 
701 
702#if !defined( GL_INTENSITY4 ) 
703#define GL_INTENSITY4 0x804A // deprecated, same as GL_INTENSITY4_EXT 
704#endif 
705#if !defined( GL_INTENSITY8 ) 
706#define GL_INTENSITY8 0x804B // deprecated, same as GL_INTENSITY8_EXT 
707#endif 
708#if !defined( GL_INTENSITY8_SNORM ) 
709#define GL_INTENSITY8_SNORM 0x9017 // deprecated 
710#endif 
711#if !defined( GL_INTENSITY8UI_EXT ) 
712#define GL_INTENSITY8UI_EXT 0x8D7F // deprecated 
713#endif 
714#if !defined( GL_INTENSITY8I_EXT ) 
715#define GL_INTENSITY8I_EXT 0x8D91 // deprecated 
716#endif 
717#if !defined( GL_INTENSITY12 ) 
718#define GL_INTENSITY12 0x804C // deprecated, same as GL_INTENSITY12_EXT 
719#endif 
720#if !defined( GL_INTENSITY16 ) 
721#define GL_INTENSITY16 0x804D // deprecated, same as GL_INTENSITY16_EXT 
722#endif 
723#if !defined( GL_INTENSITY16_SNORM ) 
724#define GL_INTENSITY16_SNORM 0x901B // deprecated 
725#endif 
726#if !defined( GL_INTENSITY16UI_EXT ) 
727#define GL_INTENSITY16UI_EXT 0x8D79 // deprecated 
728#endif 
729#if !defined( GL_INTENSITY16I_EXT ) 
730#define GL_INTENSITY16I_EXT 0x8D8B // deprecated 
731#endif 
732#if !defined( GL_INTENSITY16F_ARB ) 
733#define GL_INTENSITY16F_ARB 0x881D // deprecated, same as GL_INTENSITY_FLOAT16_APPLE and GL_INTENSITY_FLOAT16_ATI 
734#endif 
735#if !defined( GL_INTENSITY32UI_EXT ) 
736#define GL_INTENSITY32UI_EXT 0x8D73 // deprecated 
737#endif 
738#if !defined( GL_INTENSITY32I_EXT ) 
739#define GL_INTENSITY32I_EXT 0x8D85 // deprecated 
740#endif 
741#if !defined( GL_INTENSITY32F_ARB ) 
742#define GL_INTENSITY32F_ARB 0x8817 // deprecated, same as GL_INTENSITY_FLOAT32_APPLE and GL_INTENSITY_FLOAT32_ATI 
743#endif 
744 
745// 
746// Generic compression 
747// 
748 
749#if !defined( GL_COMPRESSED_RED ) 
750#define GL_COMPRESSED_RED 0x8225 
751#endif 
752#if !defined( GL_COMPRESSED_ALPHA ) 
753#define GL_COMPRESSED_ALPHA 0x84E9 // deprecated, same as GL_COMPRESSED_ALPHA_ARB 
754#endif 
755#if !defined( GL_COMPRESSED_LUMINANCE ) 
756#define GL_COMPRESSED_LUMINANCE 0x84EA // deprecated, same as GL_COMPRESSED_LUMINANCE_ARB 
757#endif 
758#if !defined( GL_COMPRESSED_SLUMINANCE ) 
759#define GL_COMPRESSED_SLUMINANCE 0x8C4A // deprecated, same as GL_COMPRESSED_SLUMINANCE_EXT 
760#endif 
761#if !defined( GL_COMPRESSED_LUMINANCE_ALPHA ) 
762#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB // deprecated, same as GL_COMPRESSED_LUMINANCE_ALPHA_ARB 
763#endif 
764#if !defined( GL_COMPRESSED_SLUMINANCE_ALPHA ) 
765#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B // deprecated, same as GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 
766#endif 
767#if !defined( GL_COMPRESSED_INTENSITY ) 
768#define GL_COMPRESSED_INTENSITY 0x84EC // deprecated, same as GL_COMPRESSED_INTENSITY_ARB 
769#endif 
770#if !defined( GL_COMPRESSED_RG ) 
771#define GL_COMPRESSED_RG 0x8226 
772#endif 
773#if !defined( GL_COMPRESSED_RGB ) 
774#define GL_COMPRESSED_RGB 0x84ED // same as GL_COMPRESSED_RGB_ARB 
775#endif 
776#if !defined( GL_COMPRESSED_RGBA ) 
777#define GL_COMPRESSED_RGBA 0x84EE // same as GL_COMPRESSED_RGBA_ARB 
778#endif 
779#if !defined( GL_COMPRESSED_SRGB ) 
780#define GL_COMPRESSED_SRGB 0x8C48 // same as GL_COMPRESSED_SRGB_EXT 
781#endif 
782#if !defined( GL_COMPRESSED_SRGB_ALPHA ) 
783#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 // same as GL_COMPRESSED_SRGB_ALPHA_EXT 
784#endif 
785 
786// 
787// FXT1 
788// 
789 
790#if !defined( GL_COMPRESSED_RGB_FXT1_3DFX ) 
791#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 // deprecated 
792#endif 
793#if !defined( GL_COMPRESSED_RGBA_FXT1_3DFX ) 
794#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 // deprecated 
795#endif 
796 
797// 
798// S3TC/DXT/BC 
799// 
800 
801#if !defined( GL_COMPRESSED_RGB_S3TC_DXT1_EXT ) 
802#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 
803#endif 
804#if !defined( GL_COMPRESSED_RGBA_S3TC_DXT1_EXT ) 
805#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 
806#endif 
807#if !defined( GL_COMPRESSED_RGBA_S3TC_DXT3_EXT ) 
808#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 
809#endif 
810#if !defined( GL_COMPRESSED_RGBA_S3TC_DXT5_EXT ) 
811#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 
812#endif 
813 
814#if !defined( GL_COMPRESSED_SRGB_S3TC_DXT1_EXT ) 
815#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C 
816#endif 
817#if !defined( GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT ) 
818#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D 
819#endif 
820#if !defined( GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT ) 
821#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E 
822#endif 
823#if !defined( GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT ) 
824#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F 
825#endif 
826 
827#if !defined( GL_COMPRESSED_LUMINANCE_LATC1_EXT ) 
828#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70 
829#endif 
830#if !defined( GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT ) 
831#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72 
832#endif 
833#if !defined( GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT ) 
834#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71 
835#endif 
836#if !defined( GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT ) 
837#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73 
838#endif 
839 
840#if !defined( GL_COMPRESSED_RED_RGTC1 ) 
841#define GL_COMPRESSED_RED_RGTC1 0x8DBB // same as GL_COMPRESSED_RED_RGTC1_EXT 
842#endif 
843#if !defined( GL_COMPRESSED_RG_RGTC2 ) 
844#define GL_COMPRESSED_RG_RGTC2 0x8DBD // same as GL_COMPRESSED_RG_RGTC2_EXT 
845#endif 
846#if !defined( GL_COMPRESSED_SIGNED_RED_RGTC1 ) 
847#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC // same as GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 
848#endif 
849#if !defined( GL_COMPRESSED_SIGNED_RG_RGTC2 ) 
850#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE // same as GL_COMPRESSED_SIGNED_RG_RGTC2_EXT 
851#endif 
852 
853#if !defined( GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT ) 
854#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E // same as GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 
855#endif 
856#if !defined( GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT ) 
857#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F // same as GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 
858#endif 
859#if !defined( GL_COMPRESSED_RGBA_BPTC_UNORM ) 
860#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C // same as GL_COMPRESSED_RGBA_BPTC_UNORM_ARB  
861#endif 
862#if !defined( GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM ) 
863#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D // same as GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 
864#endif 
865 
866// 
867// ETC 
868// 
869 
870#if !defined( GL_ETC1_RGB8_OES ) 
871#define GL_ETC1_RGB8_OES 0x8D64 
872#endif 
873 
874#if !defined( GL_COMPRESSED_RGB8_ETC2 ) 
875#define GL_COMPRESSED_RGB8_ETC2 0x9274 
876#endif 
877#if !defined( GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 ) 
878#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 
879#endif 
880#if !defined( GL_COMPRESSED_RGBA8_ETC2_EAC ) 
881#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 
882#endif 
883 
884#if !defined( GL_COMPRESSED_SRGB8_ETC2 ) 
885#define GL_COMPRESSED_SRGB8_ETC2 0x9275 
886#endif 
887#if !defined( GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 ) 
888#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 
889#endif 
890#if !defined( GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC ) 
891#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 
892#endif 
893 
894#if !defined( GL_COMPRESSED_R11_EAC ) 
895#define GL_COMPRESSED_R11_EAC 0x9270 
896#endif 
897#if !defined( GL_COMPRESSED_RG11_EAC ) 
898#define GL_COMPRESSED_RG11_EAC 0x9272 
899#endif 
900#if !defined( GL_COMPRESSED_SIGNED_R11_EAC ) 
901#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 
902#endif 
903#if !defined( GL_COMPRESSED_SIGNED_RG11_EAC ) 
904#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 
905#endif 
906 
907// 
908// PVRTC 
909// 
910 
911#if !defined( GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG ) 
912#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 
913#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 
914#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 
915#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 
916#endif 
917#if !defined( GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG ) 
918#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137 
919#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138 
920#endif 
921#if !defined( GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT ) 
922#define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54 
923#define GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55 
924#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56 
925#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57 
926#endif 
927#if !defined( GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG ) 
928#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG 0x93F0 
929#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG 0x93F1 
930#endif 
931 
932// 
933// ASTC 
934// 
935 
936#if !defined( GL_COMPRESSED_RGBA_ASTC_4x4_KHR ) 
937#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 
938#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 
939#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 
940#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 
941#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 
942#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 
943#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 
944#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 
945#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 
946#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 
947#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA 
948#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB 
949#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC 
950#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD 
951#endif 
952 
953#if !defined( GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR ) 
954#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 
955#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 
956#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 
957#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 
958#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 
959#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 
960#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 
961#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 
962#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 
963#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 
964#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA 
965#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB 
966#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC 
967#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD 
968#endif 
969 
970#if !defined( GL_COMPRESSED_RGBA_ASTC_3x3x3_OES ) 
971#define GL_COMPRESSED_RGBA_ASTC_3x3x3_OES 0x93C0 
972#define GL_COMPRESSED_RGBA_ASTC_4x3x3_OES 0x93C1 
973#define GL_COMPRESSED_RGBA_ASTC_4x4x3_OES 0x93C2 
974#define GL_COMPRESSED_RGBA_ASTC_4x4x4_OES 0x93C3 
975#define GL_COMPRESSED_RGBA_ASTC_5x4x4_OES 0x93C4 
976#define GL_COMPRESSED_RGBA_ASTC_5x5x4_OES 0x93C5 
977#define GL_COMPRESSED_RGBA_ASTC_5x5x5_OES 0x93C6 
978#define GL_COMPRESSED_RGBA_ASTC_6x5x5_OES 0x93C7 
979#define GL_COMPRESSED_RGBA_ASTC_6x6x5_OES 0x93C8 
980#define GL_COMPRESSED_RGBA_ASTC_6x6x6_OES 0x93C9 
981#endif 
982 
983#if !defined( GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES ) 
984#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES 0x93E0 
985#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES 0x93E1 
986#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES 0x93E2 
987#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES 0x93E3 
988#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES 0x93E4 
989#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES 0x93E5 
990#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES 0x93E6 
991#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES 0x93E7 
992#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES 0x93E8 
993#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES 0x93E9 
994#endif 
995 
996// 
997// ATC 
998// 
999 
1000#if !defined( GL_ATC_RGB_AMD ) 
1001#define GL_ATC_RGB_AMD 0x8C92 
1002#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 
1003#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE 
1004#endif 
1005 
1006// 
1007// Palletized (combined palette) 
1008// 
1009 
1010#if !defined( GL_PALETTE4_RGB8_OES ) 
1011#define GL_PALETTE4_RGB8_OES 0x8B90 
1012#define GL_PALETTE4_RGBA8_OES 0x8B91 
1013#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 
1014#define GL_PALETTE4_RGBA4_OES 0x8B93 
1015#define GL_PALETTE4_RGB5_A1_OES 0x8B94 
1016#define GL_PALETTE8_RGB8_OES 0x8B95 
1017#define GL_PALETTE8_RGBA8_OES 0x8B96 
1018#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 
1019#define GL_PALETTE8_RGBA4_OES 0x8B98 
1020#define GL_PALETTE8_RGB5_A1_OES 0x8B99 
1021#endif 
1022 
1023// 
1024// Palletized (separate palette) 
1025// 
1026 
1027#if !defined( GL_COLOR_INDEX1_EXT ) 
1028#define GL_COLOR_INDEX1_EXT 0x80E2 // deprecated 
1029#define GL_COLOR_INDEX2_EXT 0x80E3 // deprecated 
1030#define GL_COLOR_INDEX4_EXT 0x80E4 // deprecated 
1031#define GL_COLOR_INDEX8_EXT 0x80E5 // deprecated 
1032#define GL_COLOR_INDEX12_EXT 0x80E6 // deprecated 
1033#define GL_COLOR_INDEX16_EXT 0x80E7 // deprecated 
1034#endif 
1035 
1036// 
1037// Depth/stencil 
1038// 
1039 
1040#if !defined( GL_DEPTH_COMPONENT16 ) 
1041#define GL_DEPTH_COMPONENT16 0x81A5 // same as GL_DEPTH_COMPONENT16_SGIX and GL_DEPTH_COMPONENT16_ARB 
1042#endif 
1043#if !defined( GL_DEPTH_COMPONENT24 ) 
1044#define GL_DEPTH_COMPONENT24 0x81A6 // same as GL_DEPTH_COMPONENT24_SGIX and GL_DEPTH_COMPONENT24_ARB 
1045#endif 
1046#if !defined( GL_DEPTH_COMPONENT32 ) 
1047#define GL_DEPTH_COMPONENT32 0x81A7 // same as GL_DEPTH_COMPONENT32_SGIX and GL_DEPTH_COMPONENT32_ARB and GL_DEPTH_COMPONENT32_OES 
1048#endif 
1049#if !defined( GL_DEPTH_COMPONENT32F ) 
1050#define GL_DEPTH_COMPONENT32F 0x8CAC // same as GL_DEPTH_COMPONENT32F_ARB 
1051#endif 
1052#if !defined( GL_DEPTH_COMPONENT32F_NV ) 
1053#define GL_DEPTH_COMPONENT32F_NV 0x8DAB // note that this is different from GL_DEPTH_COMPONENT32F 
1054#endif 
1055#if !defined( GL_STENCIL_INDEX1 ) 
1056#define GL_STENCIL_INDEX1 0x8D46 // same as GL_STENCIL_INDEX1_EXT 
1057#endif 
1058#if !defined( GL_STENCIL_INDEX4 ) 
1059#define GL_STENCIL_INDEX4 0x8D47 // same as GL_STENCIL_INDEX4_EXT 
1060#endif 
1061#if !defined( GL_STENCIL_INDEX8 ) 
1062#define GL_STENCIL_INDEX8 0x8D48 // same as GL_STENCIL_INDEX8_EXT 
1063#endif 
1064#if !defined( GL_STENCIL_INDEX16 ) 
1065#define GL_STENCIL_INDEX16 0x8D49 // same as GL_STENCIL_INDEX16_EXT 
1066#endif 
1067#if !defined( GL_DEPTH24_STENCIL8 ) 
1068#define GL_DEPTH24_STENCIL8 0x88F0 // same as GL_DEPTH24_STENCIL8_EXT and GL_DEPTH24_STENCIL8_OES 
1069#endif 
1070#if !defined( GL_DEPTH32F_STENCIL8 ) 
1071#define GL_DEPTH32F_STENCIL8 0x8CAD // same as GL_DEPTH32F_STENCIL8_ARB 
1072#endif 
1073#if !defined( GL_DEPTH32F_STENCIL8_NV ) 
1074#define GL_DEPTH32F_STENCIL8_NV 0x8DAC // note that this is different from GL_DEPTH32F_STENCIL8 
1075#endif 
1076 
1077static inline GLenum glGetFormatFromInternalFormat( const GLenum internalFormat
1078
1079 switch ( internalFormat
1080
1081 // 
1082 // 8 bits per component 
1083 // 
1084 case GL_R8: return GL_RED; // 1-component, 8-bit unsigned normalized 
1085 case GL_RG8: return GL_RG; // 2-component, 8-bit unsigned normalized 
1086 case GL_RGB8: return GL_RGB; // 3-component, 8-bit unsigned normalized 
1087 case GL_RGBA8: return GL_RGBA; // 4-component, 8-bit unsigned normalized 
1088 
1089 case GL_R8_SNORM: return GL_RED; // 1-component, 8-bit signed normalized 
1090 case GL_RG8_SNORM: return GL_RG; // 2-component, 8-bit signed normalized 
1091 case GL_RGB8_SNORM: return GL_RGB; // 3-component, 8-bit signed normalized 
1092 case GL_RGBA8_SNORM: return GL_RGBA; // 4-component, 8-bit signed normalized 
1093 
1094 case GL_R8UI: return GL_RED; // 1-component, 8-bit unsigned integer 
1095 case GL_RG8UI: return GL_RG; // 2-component, 8-bit unsigned integer 
1096 case GL_RGB8UI: return GL_RGB; // 3-component, 8-bit unsigned integer 
1097 case GL_RGBA8UI: return GL_RGBA; // 4-component, 8-bit unsigned integer 
1098 
1099 case GL_R8I: return GL_RED; // 1-component, 8-bit signed integer 
1100 case GL_RG8I: return GL_RG; // 2-component, 8-bit signed integer 
1101 case GL_RGB8I: return GL_RGB; // 3-component, 8-bit signed integer 
1102 case GL_RGBA8I: return GL_RGBA; // 4-component, 8-bit signed integer 
1103 
1104 case GL_SR8: return GL_RED; // 1-component, 8-bit sRGB 
1105 case GL_SRG8: return GL_RG; // 2-component, 8-bit sRGB 
1106 case GL_SRGB8: return GL_RGB; // 3-component, 8-bit sRGB 
1107 case GL_SRGB8_ALPHA8: return GL_RGBA; // 4-component, 8-bit sRGB 
1108 
1109 // 
1110 // 16 bits per component 
1111 // 
1112 case GL_R16: return GL_RED; // 1-component, 16-bit unsigned normalized 
1113 case GL_RG16: return GL_RG; // 2-component, 16-bit unsigned normalized 
1114 case GL_RGB16: return GL_RGB; // 3-component, 16-bit unsigned normalized 
1115 case GL_RGBA16: return GL_RGBA; // 4-component, 16-bit unsigned normalized 
1116 
1117 case GL_R16_SNORM: return GL_RED; // 1-component, 16-bit signed normalized 
1118 case GL_RG16_SNORM: return GL_RG; // 2-component, 16-bit signed normalized 
1119 case GL_RGB16_SNORM: return GL_RGB; // 3-component, 16-bit signed normalized 
1120 case GL_RGBA16_SNORM: return GL_RGBA; // 4-component, 16-bit signed normalized 
1121 
1122 case GL_R16UI: return GL_RED; // 1-component, 16-bit unsigned integer 
1123 case GL_RG16UI: return GL_RG; // 2-component, 16-bit unsigned integer 
1124 case GL_RGB16UI: return GL_RGB; // 3-component, 16-bit unsigned integer 
1125 case GL_RGBA16UI: return GL_RGBA; // 4-component, 16-bit unsigned integer 
1126 
1127 case GL_R16I: return GL_RED; // 1-component, 16-bit signed integer 
1128 case GL_RG16I: return GL_RG; // 2-component, 16-bit signed integer 
1129 case GL_RGB16I: return GL_RGB; // 3-component, 16-bit signed integer 
1130 case GL_RGBA16I: return GL_RGBA; // 4-component, 16-bit signed integer 
1131 
1132 case GL_R16F: return GL_RED; // 1-component, 16-bit floating-point 
1133 case GL_RG16F: return GL_RG; // 2-component, 16-bit floating-point 
1134 case GL_RGB16F: return GL_RGB; // 3-component, 16-bit floating-point 
1135 case GL_RGBA16F: return GL_RGBA; // 4-component, 16-bit floating-point 
1136 
1137 // 
1138 // 32 bits per component 
1139 // 
1140 case GL_R32UI: return GL_RED; // 1-component, 32-bit unsigned integer 
1141 case GL_RG32UI: return GL_RG; // 2-component, 32-bit unsigned integer 
1142 case GL_RGB32UI: return GL_RGB; // 3-component, 32-bit unsigned integer 
1143 case GL_RGBA32UI: return GL_RGBA; // 4-component, 32-bit unsigned integer 
1144 
1145 case GL_R32I: return GL_RED; // 1-component, 32-bit signed integer 
1146 case GL_RG32I: return GL_RG; // 2-component, 32-bit signed integer 
1147 case GL_RGB32I: return GL_RGB; // 3-component, 32-bit signed integer 
1148 case GL_RGBA32I: return GL_RGBA; // 4-component, 32-bit signed integer 
1149 
1150 case GL_R32F: return GL_RED; // 1-component, 32-bit floating-point 
1151 case GL_RG32F: return GL_RG; // 2-component, 32-bit floating-point 
1152 case GL_RGB32F: return GL_RGB; // 3-component, 32-bit floating-point 
1153 case GL_RGBA32F: return GL_RGBA; // 4-component, 32-bit floating-point 
1154 
1155 // 
1156 // Packed 
1157 // 
1158 case GL_R3_G3_B2: return GL_RGB; // 3-component 3:3:2, unsigned normalized 
1159 case GL_RGB4: return GL_RGB; // 3-component 4:4:4, unsigned normalized 
1160 case GL_RGB5: return GL_RGB; // 3-component 5:5:5, unsigned normalized 
1161 case GL_RGB565: return GL_RGB; // 3-component 5:6:5, unsigned normalized 
1162 case GL_RGB10: return GL_RGB; // 3-component 10:10:10, unsigned normalized 
1163 case GL_RGB12: return GL_RGB; // 3-component 12:12:12, unsigned normalized 
1164 case GL_RGBA2: return GL_RGBA; // 4-component 2:2:2:2, unsigned normalized 
1165 case GL_RGBA4: return GL_RGBA; // 4-component 4:4:4:4, unsigned normalized 
1166 case GL_RGBA12: return GL_RGBA; // 4-component 12:12:12:12, unsigned normalized 
1167 case GL_RGB5_A1: return GL_RGBA; // 4-component 5:5:5:1, unsigned normalized 
1168 case GL_RGB10_A2: return GL_RGBA; // 4-component 10:10:10:2, unsigned normalized 
1169 case GL_RGB10_A2UI: return GL_RGBA; // 4-component 10:10:10:2, unsigned integer 
1170 case GL_R11F_G11F_B10F: return GL_RGB; // 3-component 11:11:10, floating-point 
1171 case GL_RGB9_E5: return GL_RGB; // 3-component/exp 9:9:9/5, floating-point 
1172 
1173 // 
1174 // S3TC/DXT/BC 
1175 // 
1176 
1177 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: return GL_RGB; // line through 3D space, 4x4 blocks, unsigned normalized 
1178 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: return GL_RGBA; // line through 3D space plus 1-bit alpha, 4x4 blocks, unsigned normalized 
1179 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: return GL_RGBA; // line through 3D space plus line through 1D space, 4x4 blocks, unsigned normalized 
1180 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: return GL_RGBA; // line through 3D space plus 4-bit alpha, 4x4 blocks, unsigned normalized 
1181 
1182 case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: return GL_RGB; // line through 3D space, 4x4 blocks, sRGB 
1183 case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: return GL_RGBA; // line through 3D space plus 1-bit alpha, 4x4 blocks, sRGB 
1184 case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: return GL_RGBA; // line through 3D space plus line through 1D space, 4x4 blocks, sRGB 
1185 case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: return GL_RGBA; // line through 3D space plus 4-bit alpha, 4x4 blocks, sRGB 
1186 
1187 case GL_COMPRESSED_LUMINANCE_LATC1_EXT: return GL_RED; // line through 1D space, 4x4 blocks, unsigned normalized 
1188 case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT: return GL_RG; // two lines through 1D space, 4x4 blocks, unsigned normalized 
1189 case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT: return GL_RED; // line through 1D space, 4x4 blocks, signed normalized 
1190 case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT: return GL_RG; // two lines through 1D space, 4x4 blocks, signed normalized 
1191 
1192 case GL_COMPRESSED_RED_RGTC1: return GL_RED; // line through 1D space, 4x4 blocks, unsigned normalized 
1193 case GL_COMPRESSED_RG_RGTC2: return GL_RG; // two lines through 1D space, 4x4 blocks, unsigned normalized 
1194 case GL_COMPRESSED_SIGNED_RED_RGTC1: return GL_RED; // line through 1D space, 4x4 blocks, signed normalized 
1195 case GL_COMPRESSED_SIGNED_RG_RGTC2: return GL_RG; // two lines through 1D space, 4x4 blocks, signed normalized 
1196 
1197 case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT: return GL_RGB; // 3-component, 4x4 blocks, unsigned floating-point 
1198 case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT: return GL_RGB; // 3-component, 4x4 blocks, signed floating-point 
1199 case GL_COMPRESSED_RGBA_BPTC_UNORM: return GL_RGBA; // 4-component, 4x4 blocks, unsigned normalized 
1200 case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM: return GL_RGBA; // 4-component, 4x4 blocks, sRGB 
1201 
1202 // 
1203 // ETC 
1204 // 
1205 case GL_ETC1_RGB8_OES: return GL_RGB; // 3-component ETC1, 4x4 blocks, unsigned normalized 
1206 
1207 case GL_COMPRESSED_RGB8_ETC2: return GL_RGB; // 3-component ETC2, 4x4 blocks, unsigned normalized 
1208 case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: return GL_RGBA; // 4-component ETC2 with 1-bit alpha, 4x4 blocks, unsigned normalized 
1209 case GL_COMPRESSED_RGBA8_ETC2_EAC: return GL_RGBA; // 4-component ETC2, 4x4 blocks, unsigned normalized 
1210 
1211 case GL_COMPRESSED_SRGB8_ETC2: return GL_RGB; // 3-component ETC2, 4x4 blocks, sRGB 
1212 case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: return GL_RGBA; // 4-component ETC2 with 1-bit alpha, 4x4 blocks, sRGB 
1213 case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: return GL_RGBA; // 4-component ETC2, 4x4 blocks, sRGB 
1214 
1215 case GL_COMPRESSED_R11_EAC: return GL_RED; // 1-component ETC, 4x4 blocks, unsigned normalized 
1216 case GL_COMPRESSED_RG11_EAC: return GL_RG; // 2-component ETC, 4x4 blocks, unsigned normalized 
1217 case GL_COMPRESSED_SIGNED_R11_EAC: return GL_RED; // 1-component ETC, 4x4 blocks, signed normalized 
1218 case GL_COMPRESSED_SIGNED_RG11_EAC: return GL_RG; // 2-component ETC, 4x4 blocks, signed normalized 
1219 
1220 // 
1221 // PVRTC 
1222 // 
1223 case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG: return GL_RGB; // 3-component PVRTC, 16x8 blocks, unsigned normalized 
1224 case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG: return GL_RGB; // 3-component PVRTC, 8x8 blocks, unsigned normalized 
1225 case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: return GL_RGBA; // 4-component PVRTC, 16x8 blocks, unsigned normalized 
1226 case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: return GL_RGBA; // 4-component PVRTC, 8x8 blocks, unsigned normalized 
1227 case GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG: return GL_RGBA; // 4-component PVRTC, 8x4 blocks, unsigned normalized 
1228 case GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG: return GL_RGBA; // 4-component PVRTC, 4x4 blocks, unsigned normalized 
1229 
1230 case GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT: return GL_RGB; // 3-component PVRTC, 16x8 blocks, sRGB 
1231 case GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT: return GL_RGB; // 3-component PVRTC, 8x8 blocks, sRGB 
1232 case GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT: return GL_RGBA; // 4-component PVRTC, 16x8 blocks, sRGB 
1233 case GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT: return GL_RGBA; // 4-component PVRTC, 8x8 blocks, sRGB 
1234 case GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG: return GL_RGBA; // 4-component PVRTC, 8x4 blocks, sRGB 
1235 case GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG: return GL_RGBA; // 4-component PVRTC, 4x4 blocks, sRGB 
1236 
1237 // 
1238 // ASTC 
1239 // 
1240 case GL_COMPRESSED_RGBA_ASTC_4x4_KHR: return GL_RGBA; // 4-component ASTC, 4x4 blocks, unsigned normalized 
1241 case GL_COMPRESSED_RGBA_ASTC_5x4_KHR: return GL_RGBA; // 4-component ASTC, 5x4 blocks, unsigned normalized 
1242 case GL_COMPRESSED_RGBA_ASTC_5x5_KHR: return GL_RGBA; // 4-component ASTC, 5x5 blocks, unsigned normalized 
1243 case GL_COMPRESSED_RGBA_ASTC_6x5_KHR: return GL_RGBA; // 4-component ASTC, 6x5 blocks, unsigned normalized 
1244 case GL_COMPRESSED_RGBA_ASTC_6x6_KHR: return GL_RGBA; // 4-component ASTC, 6x6 blocks, unsigned normalized 
1245 case GL_COMPRESSED_RGBA_ASTC_8x5_KHR: return GL_RGBA; // 4-component ASTC, 8x5 blocks, unsigned normalized 
1246 case GL_COMPRESSED_RGBA_ASTC_8x6_KHR: return GL_RGBA; // 4-component ASTC, 8x6 blocks, unsigned normalized 
1247 case GL_COMPRESSED_RGBA_ASTC_8x8_KHR: return GL_RGBA; // 4-component ASTC, 8x8 blocks, unsigned normalized 
1248 case GL_COMPRESSED_RGBA_ASTC_10x5_KHR: return GL_RGBA; // 4-component ASTC, 10x5 blocks, unsigned normalized 
1249 case GL_COMPRESSED_RGBA_ASTC_10x6_KHR: return GL_RGBA; // 4-component ASTC, 10x6 blocks, unsigned normalized 
1250 case GL_COMPRESSED_RGBA_ASTC_10x8_KHR: return GL_RGBA; // 4-component ASTC, 10x8 blocks, unsigned normalized 
1251 case GL_COMPRESSED_RGBA_ASTC_10x10_KHR: return GL_RGBA; // 4-component ASTC, 10x10 blocks, unsigned normalized 
1252 case GL_COMPRESSED_RGBA_ASTC_12x10_KHR: return GL_RGBA; // 4-component ASTC, 12x10 blocks, unsigned normalized 
1253 case GL_COMPRESSED_RGBA_ASTC_12x12_KHR: return GL_RGBA; // 4-component ASTC, 12x12 blocks, unsigned normalized 
1254 
1255 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: return GL_RGBA; // 4-component ASTC, 4x4 blocks, sRGB 
1256 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: return GL_RGBA; // 4-component ASTC, 5x4 blocks, sRGB 
1257 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: return GL_RGBA; // 4-component ASTC, 5x5 blocks, sRGB 
1258 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: return GL_RGBA; // 4-component ASTC, 6x5 blocks, sRGB 
1259 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: return GL_RGBA; // 4-component ASTC, 6x6 blocks, sRGB 
1260 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: return GL_RGBA; // 4-component ASTC, 8x5 blocks, sRGB 
1261 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: return GL_RGBA; // 4-component ASTC, 8x6 blocks, sRGB 
1262 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: return GL_RGBA; // 4-component ASTC, 8x8 blocks, sRGB 
1263 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: return GL_RGBA; // 4-component ASTC, 10x5 blocks, sRGB 
1264 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: return GL_RGBA; // 4-component ASTC, 10x6 blocks, sRGB 
1265 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: return GL_RGBA; // 4-component ASTC, 10x8 blocks, sRGB 
1266 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: return GL_RGBA; // 4-component ASTC, 10x10 blocks, sRGB 
1267 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: return GL_RGBA; // 4-component ASTC, 12x10 blocks, sRGB 
1268 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: return GL_RGBA; // 4-component ASTC, 12x12 blocks, sRGB 
1269 
1270 case GL_COMPRESSED_RGBA_ASTC_3x3x3_OES: return GL_RGBA; // 4-component ASTC, 3x3x3 blocks, unsigned normalized 
1271 case GL_COMPRESSED_RGBA_ASTC_4x3x3_OES: return GL_RGBA; // 4-component ASTC, 4x3x3 blocks, unsigned normalized 
1272 case GL_COMPRESSED_RGBA_ASTC_4x4x3_OES: return GL_RGBA; // 4-component ASTC, 4x4x3 blocks, unsigned normalized 
1273 case GL_COMPRESSED_RGBA_ASTC_4x4x4_OES: return GL_RGBA; // 4-component ASTC, 4x4x4 blocks, unsigned normalized 
1274 case GL_COMPRESSED_RGBA_ASTC_5x4x4_OES: return GL_RGBA; // 4-component ASTC, 5x4x4 blocks, unsigned normalized 
1275 case GL_COMPRESSED_RGBA_ASTC_5x5x4_OES: return GL_RGBA; // 4-component ASTC, 5x5x4 blocks, unsigned normalized 
1276 case GL_COMPRESSED_RGBA_ASTC_5x5x5_OES: return GL_RGBA; // 4-component ASTC, 5x5x5 blocks, unsigned normalized 
1277 case GL_COMPRESSED_RGBA_ASTC_6x5x5_OES: return GL_RGBA; // 4-component ASTC, 6x5x5 blocks, unsigned normalized 
1278 case GL_COMPRESSED_RGBA_ASTC_6x6x5_OES: return GL_RGBA; // 4-component ASTC, 6x6x5 blocks, unsigned normalized 
1279 case GL_COMPRESSED_RGBA_ASTC_6x6x6_OES: return GL_RGBA; // 4-component ASTC, 6x6x6 blocks, unsigned normalized 
1280 
1281 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES: return GL_RGBA; // 4-component ASTC, 3x3x3 blocks, sRGB 
1282 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES: return GL_RGBA; // 4-component ASTC, 4x3x3 blocks, sRGB 
1283 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES: return GL_RGBA; // 4-component ASTC, 4x4x3 blocks, sRGB 
1284 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES: return GL_RGBA; // 4-component ASTC, 4x4x4 blocks, sRGB 
1285 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES: return GL_RGBA; // 4-component ASTC, 5x4x4 blocks, sRGB 
1286 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES: return GL_RGBA; // 4-component ASTC, 5x5x4 blocks, sRGB 
1287 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES: return GL_RGBA; // 4-component ASTC, 5x5x5 blocks, sRGB 
1288 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES: return GL_RGBA; // 4-component ASTC, 6x5x5 blocks, sRGB 
1289 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES: return GL_RGBA; // 4-component ASTC, 6x6x5 blocks, sRGB 
1290 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES: return GL_RGBA; // 4-component ASTC, 6x6x6 blocks, sRGB 
1291 
1292 // 
1293 // ATC 
1294 // 
1295 case GL_ATC_RGB_AMD: return GL_RGB; // 3-component, 4x4 blocks, unsigned normalized 
1296 case GL_ATC_RGBA_EXPLICIT_ALPHA_AMD: return GL_RGBA; // 4-component, 4x4 blocks, unsigned normalized 
1297 case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD: return GL_RGBA; // 4-component, 4x4 blocks, unsigned normalized 
1298 
1299 // 
1300 // Palletized 
1301 // 
1302 case GL_PALETTE4_RGB8_OES: return GL_RGB; // 3-component 8:8:8, 4-bit palette, unsigned normalized 
1303 case GL_PALETTE4_RGBA8_OES: return GL_RGBA; // 4-component 8:8:8:8, 4-bit palette, unsigned normalized 
1304 case GL_PALETTE4_R5_G6_B5_OES: return GL_RGB; // 3-component 5:6:5, 4-bit palette, unsigned normalized 
1305 case GL_PALETTE4_RGBA4_OES: return GL_RGBA; // 4-component 4:4:4:4, 4-bit palette, unsigned normalized 
1306 case GL_PALETTE4_RGB5_A1_OES: return GL_RGBA; // 4-component 5:5:5:1, 4-bit palette, unsigned normalized 
1307 case GL_PALETTE8_RGB8_OES: return GL_RGB; // 3-component 8:8:8, 8-bit palette, unsigned normalized 
1308 case GL_PALETTE8_RGBA8_OES: return GL_RGBA; // 4-component 8:8:8:8, 8-bit palette, unsigned normalized 
1309 case GL_PALETTE8_R5_G6_B5_OES: return GL_RGB; // 3-component 5:6:5, 8-bit palette, unsigned normalized 
1310 case GL_PALETTE8_RGBA4_OES: return GL_RGBA; // 4-component 4:4:4:4, 8-bit palette, unsigned normalized 
1311 case GL_PALETTE8_RGB5_A1_OES: return GL_RGBA; // 4-component 5:5:5:1, 8-bit palette, unsigned normalized 
1312 
1313 // 
1314 // Depth/stencil 
1315 // 
1316 case GL_DEPTH_COMPONENT16: return GL_DEPTH_COMPONENT
1317 case GL_DEPTH_COMPONENT24: return GL_DEPTH_COMPONENT
1318 case GL_DEPTH_COMPONENT32: return GL_DEPTH_COMPONENT
1319 case GL_DEPTH_COMPONENT32F: return GL_DEPTH_COMPONENT
1320 case GL_DEPTH_COMPONENT32F_NV: return GL_DEPTH_COMPONENT
1321 case GL_STENCIL_INDEX1: return GL_STENCIL_INDEX
1322 case GL_STENCIL_INDEX4: return GL_STENCIL_INDEX
1323 case GL_STENCIL_INDEX8: return GL_STENCIL_INDEX
1324 case GL_STENCIL_INDEX16: return GL_STENCIL_INDEX
1325 case GL_DEPTH24_STENCIL8: return GL_DEPTH_STENCIL
1326 case GL_DEPTH32F_STENCIL8: return GL_DEPTH_STENCIL
1327 case GL_DEPTH32F_STENCIL8_NV: return GL_DEPTH_STENCIL
1328 
1329 default: return GL_INVALID_VALUE
1330
1331
1332 
1333static inline GLenum glGetTypeFromInternalFormat( const GLenum internalFormat
1334
1335 switch ( internalFormat
1336
1337 // 
1338 // 8 bits per component 
1339 // 
1340 case GL_R8: return GL_UNSIGNED_BYTE; // 1-component, 8-bit unsigned normalized 
1341 case GL_RG8: return GL_UNSIGNED_BYTE; // 2-component, 8-bit unsigned normalized 
1342 case GL_RGB8: return GL_UNSIGNED_BYTE; // 3-component, 8-bit unsigned normalized 
1343 case GL_RGBA8: return GL_UNSIGNED_BYTE; // 4-component, 8-bit unsigned normalized 
1344 
1345 case GL_R8_SNORM: return GL_BYTE; // 1-component, 8-bit signed normalized 
1346 case GL_RG8_SNORM: return GL_BYTE; // 2-component, 8-bit signed normalized 
1347 case GL_RGB8_SNORM: return GL_BYTE; // 3-component, 8-bit signed normalized 
1348 case GL_RGBA8_SNORM: return GL_BYTE; // 4-component, 8-bit signed normalized 
1349 
1350 case GL_R8UI: return GL_UNSIGNED_BYTE; // 1-component, 8-bit unsigned integer 
1351 case GL_RG8UI: return GL_UNSIGNED_BYTE; // 2-component, 8-bit unsigned integer 
1352 case GL_RGB8UI: return GL_UNSIGNED_BYTE; // 3-component, 8-bit unsigned integer 
1353 case GL_RGBA8UI: return GL_UNSIGNED_BYTE; // 4-component, 8-bit unsigned integer 
1354 
1355 case GL_R8I: return GL_BYTE; // 1-component, 8-bit signed integer 
1356 case GL_RG8I: return GL_BYTE; // 2-component, 8-bit signed integer 
1357 case GL_RGB8I: return GL_BYTE; // 3-component, 8-bit signed integer 
1358 case GL_RGBA8I: return GL_BYTE; // 4-component, 8-bit signed integer 
1359 
1360 case GL_SR8: return GL_UNSIGNED_BYTE; // 1-component, 8-bit sRGB 
1361 case GL_SRG8: return GL_UNSIGNED_BYTE; // 2-component, 8-bit sRGB 
1362 case GL_SRGB8: return GL_UNSIGNED_BYTE; // 3-component, 8-bit sRGB 
1363 case GL_SRGB8_ALPHA8: return GL_UNSIGNED_BYTE; // 4-component, 8-bit sRGB 
1364 
1365 // 
1366 // 16 bits per component 
1367 // 
1368 case GL_R16: return GL_UNSIGNED_SHORT; // 1-component, 16-bit unsigned normalized 
1369 case GL_RG16: return GL_UNSIGNED_SHORT; // 2-component, 16-bit unsigned normalized 
1370 case GL_RGB16: return GL_UNSIGNED_SHORT; // 3-component, 16-bit unsigned normalized 
1371 case GL_RGBA16: return GL_UNSIGNED_SHORT; // 4-component, 16-bit unsigned normalized 
1372 
1373 case GL_R16_SNORM: return GL_SHORT; // 1-component, 16-bit signed normalized 
1374 case GL_RG16_SNORM: return GL_SHORT; // 2-component, 16-bit signed normalized 
1375 case GL_RGB16_SNORM: return GL_SHORT; // 3-component, 16-bit signed normalized 
1376 case GL_RGBA16_SNORM: return GL_SHORT; // 4-component, 16-bit signed normalized 
1377 
1378 case GL_R16UI: return GL_UNSIGNED_SHORT; // 1-component, 16-bit unsigned integer 
1379 case GL_RG16UI: return GL_UNSIGNED_SHORT; // 2-component, 16-bit unsigned integer 
1380 case GL_RGB16UI: return GL_UNSIGNED_SHORT; // 3-component, 16-bit unsigned integer 
1381 case GL_RGBA16UI: return GL_UNSIGNED_SHORT; // 4-component, 16-bit unsigned integer 
1382 
1383 case GL_R16I: return GL_SHORT; // 1-component, 16-bit signed integer 
1384 case GL_RG16I: return GL_SHORT; // 2-component, 16-bit signed integer 
1385 case GL_RGB16I: return GL_SHORT; // 3-component, 16-bit signed integer 
1386 case GL_RGBA16I: return GL_SHORT; // 4-component, 16-bit signed integer 
1387 
1388 case GL_R16F: return GL_HALF_FLOAT; // 1-component, 16-bit floating-point 
1389 case GL_RG16F: return GL_HALF_FLOAT; // 2-component, 16-bit floating-point 
1390 case GL_RGB16F: return GL_HALF_FLOAT; // 3-component, 16-bit floating-point 
1391 case GL_RGBA16F: return GL_HALF_FLOAT; // 4-component, 16-bit floating-point 
1392 
1393 // 
1394 // 32 bits per component 
1395 // 
1396 case GL_R32UI: return GL_UNSIGNED_INT; // 1-component, 32-bit unsigned integer 
1397 case GL_RG32UI: return GL_UNSIGNED_INT; // 2-component, 32-bit unsigned integer 
1398 case GL_RGB32UI: return GL_UNSIGNED_INT; // 3-component, 32-bit unsigned integer 
1399 case GL_RGBA32UI: return GL_UNSIGNED_INT; // 4-component, 32-bit unsigned integer 
1400 
1401 case GL_R32I: return GL_INT; // 1-component, 32-bit signed integer 
1402 case GL_RG32I: return GL_INT; // 2-component, 32-bit signed integer 
1403 case GL_RGB32I: return GL_INT; // 3-component, 32-bit signed integer 
1404 case GL_RGBA32I: return GL_INT; // 4-component, 32-bit signed integer 
1405 
1406 case GL_R32F: return GL_FLOAT; // 1-component, 32-bit floating-point 
1407 case GL_RG32F: return GL_FLOAT; // 2-component, 32-bit floating-point 
1408 case GL_RGB32F: return GL_FLOAT; // 3-component, 32-bit floating-point 
1409 case GL_RGBA32F: return GL_FLOAT; // 4-component, 32-bit floating-point 
1410 
1411 // 
1412 // Packed 
1413 // 
1414 case GL_R3_G3_B2: return GL_UNSIGNED_BYTE_2_3_3_REV; // 3-component 3:3:2, unsigned normalized 
1415 case GL_RGB4: return GL_UNSIGNED_SHORT_4_4_4_4; // 3-component 4:4:4, unsigned normalized 
1416 case GL_RGB5: return GL_UNSIGNED_SHORT_5_5_5_1; // 3-component 5:5:5, unsigned normalized 
1417 case GL_RGB565: return GL_UNSIGNED_SHORT_5_6_5; // 3-component 5:6:5, unsigned normalized 
1418 case GL_RGB10: return GL_UNSIGNED_INT_10_10_10_2; // 3-component 10:10:10, unsigned normalized 
1419 case GL_RGB12: return GL_UNSIGNED_SHORT; // 3-component 12:12:12, unsigned normalized 
1420 case GL_RGBA2: return GL_UNSIGNED_BYTE; // 4-component 2:2:2:2, unsigned normalized 
1421 case GL_RGBA4: return GL_UNSIGNED_SHORT_4_4_4_4; // 4-component 4:4:4:4, unsigned normalized 
1422 case GL_RGBA12: return GL_UNSIGNED_SHORT; // 4-component 12:12:12:12, unsigned normalized 
1423 case GL_RGB5_A1: return GL_UNSIGNED_SHORT_5_5_5_1; // 4-component 5:5:5:1, unsigned normalized 
1424 case GL_RGB10_A2: return GL_UNSIGNED_INT_2_10_10_10_REV; // 4-component 10:10:10:2, unsigned normalized 
1425 case GL_RGB10_A2UI: return GL_UNSIGNED_INT_2_10_10_10_REV; // 4-component 10:10:10:2, unsigned integer 
1426 case GL_R11F_G11F_B10F: return GL_UNSIGNED_INT_10F_11F_11F_REV; // 3-component 11:11:10, floating-point 
1427 case GL_RGB9_E5: return GL_UNSIGNED_INT_5_9_9_9_REV; // 3-component/exp 9:9:9/5, floating-point 
1428 
1429 // 
1430 // S3TC/DXT/BC 
1431 // 
1432 
1433 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: return GL_UNSIGNED_BYTE; // line through 3D space, 4x4 blocks, unsigned normalized 
1434 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: return GL_UNSIGNED_BYTE; // line through 3D space plus 1-bit alpha, 4x4 blocks, unsigned normalized 
1435 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: return GL_UNSIGNED_BYTE; // line through 3D space plus line through 1D space, 4x4 blocks, unsigned normalized 
1436 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: return GL_UNSIGNED_BYTE; // line through 3D space plus 4-bit alpha, 4x4 blocks, unsigned normalized 
1437 
1438 case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: return GL_UNSIGNED_BYTE; // line through 3D space, 4x4 blocks, sRGB 
1439 case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: return GL_UNSIGNED_BYTE; // line through 3D space plus 1-bit alpha, 4x4 blocks, sRGB 
1440 case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: return GL_UNSIGNED_BYTE; // line through 3D space plus line through 1D space, 4x4 blocks, sRGB 
1441 case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: return GL_UNSIGNED_BYTE; // line through 3D space plus 4-bit alpha, 4x4 blocks, sRGB 
1442 
1443 case GL_COMPRESSED_LUMINANCE_LATC1_EXT: return GL_UNSIGNED_BYTE; // line through 1D space, 4x4 blocks, unsigned normalized 
1444 case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT: return GL_UNSIGNED_BYTE; // two lines through 1D space, 4x4 blocks, unsigned normalized 
1445 case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT: return GL_UNSIGNED_BYTE; // line through 1D space, 4x4 blocks, signed normalized 
1446 case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT: return GL_UNSIGNED_BYTE; // two lines through 1D space, 4x4 blocks, signed normalized 
1447 
1448 case GL_COMPRESSED_RED_RGTC1: return GL_UNSIGNED_BYTE; // line through 1D space, 4x4 blocks, unsigned normalized 
1449 case GL_COMPRESSED_RG_RGTC2: return GL_UNSIGNED_BYTE; // two lines through 1D space, 4x4 blocks, unsigned normalized 
1450 case GL_COMPRESSED_SIGNED_RED_RGTC1: return GL_UNSIGNED_BYTE; // line through 1D space, 4x4 blocks, signed normalized 
1451 case GL_COMPRESSED_SIGNED_RG_RGTC2: return GL_UNSIGNED_BYTE; // two lines through 1D space, 4x4 blocks, signed normalized 
1452 
1453 case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT: return GL_FLOAT; // 3-component, 4x4 blocks, unsigned floating-point 
1454 case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT: return GL_FLOAT; // 3-component, 4x4 blocks, signed floating-point 
1455 case GL_COMPRESSED_RGBA_BPTC_UNORM: return GL_UNSIGNED_BYTE; // 4-component, 4x4 blocks, unsigned normalized 
1456 case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM: return GL_UNSIGNED_BYTE; // 4-component, 4x4 blocks, sRGB 
1457 
1458 // 
1459 // ETC 
1460 // 
1461 case GL_ETC1_RGB8_OES: return GL_UNSIGNED_BYTE; // 3-component ETC1, 4x4 blocks, unsigned normalized" ), 
1462 
1463 case GL_COMPRESSED_RGB8_ETC2: return GL_UNSIGNED_BYTE; // 3-component ETC2, 4x4 blocks, unsigned normalized 
1464 case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: return GL_UNSIGNED_BYTE; // 4-component ETC2 with 1-bit alpha, 4x4 blocks, unsigned normalized 
1465 case GL_COMPRESSED_RGBA8_ETC2_EAC: return GL_UNSIGNED_BYTE; // 4-component ETC2, 4x4 blocks, unsigned normalized 
1466 
1467 case GL_COMPRESSED_SRGB8_ETC2: return GL_UNSIGNED_BYTE; // 3-component ETC2, 4x4 blocks, sRGB 
1468 case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: return GL_UNSIGNED_BYTE; // 4-component ETC2 with 1-bit alpha, 4x4 blocks, sRGB 
1469 case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: return GL_UNSIGNED_BYTE; // 4-component ETC2, 4x4 blocks, sRGB 
1470 
1471 case GL_COMPRESSED_R11_EAC: return GL_UNSIGNED_BYTE; // 1-component ETC, 4x4 blocks, unsigned normalized 
1472 case GL_COMPRESSED_RG11_EAC: return GL_UNSIGNED_BYTE; // 2-component ETC, 4x4 blocks, unsigned normalized 
1473 case GL_COMPRESSED_SIGNED_R11_EAC: return GL_UNSIGNED_BYTE; // 1-component ETC, 4x4 blocks, signed normalized 
1474 case GL_COMPRESSED_SIGNED_RG11_EAC: return GL_UNSIGNED_BYTE; // 2-component ETC, 4x4 blocks, signed normalized 
1475 
1476 // 
1477 // PVRTC 
1478 // 
1479 case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG: return GL_UNSIGNED_BYTE; // 3-component PVRTC, 16x8 blocks, unsigned normalized 
1480 case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG: return GL_UNSIGNED_BYTE; // 3-component PVRTC, 8x8 blocks, unsigned normalized 
1481 case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: return GL_UNSIGNED_BYTE; // 4-component PVRTC, 16x8 blocks, unsigned normalized 
1482 case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: return GL_UNSIGNED_BYTE; // 4-component PVRTC, 8x8 blocks, unsigned normalized 
1483 case GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG: return GL_UNSIGNED_BYTE; // 4-component PVRTC, 8x4 blocks, unsigned normalized 
1484 case GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG: return GL_UNSIGNED_BYTE; // 4-component PVRTC, 4x4 blocks, unsigned normalized 
1485 
1486 case GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT: return GL_UNSIGNED_BYTE; // 3-component PVRTC, 16x8 blocks, sRGB 
1487 case GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT: return GL_UNSIGNED_BYTE; // 3-component PVRTC, 8x8 blocks, sRGB 
1488 case GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT: return GL_UNSIGNED_BYTE; // 4-component PVRTC, 16x8 blocks, sRGB 
1489 case GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT: return GL_UNSIGNED_BYTE; // 4-component PVRTC, 8x8 blocks, sRGB 
1490 case GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG: return GL_UNSIGNED_BYTE; // 4-component PVRTC, 8x4 blocks, sRGB 
1491 case GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG: return GL_UNSIGNED_BYTE; // 4-component PVRTC, 4x4 blocks, sRGB 
1492 
1493 // 
1494 // ASTC 
1495 // 
1496 case GL_COMPRESSED_RGBA_ASTC_4x4_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 4x4 blocks, unsigned normalized 
1497 case GL_COMPRESSED_RGBA_ASTC_5x4_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 5x4 blocks, unsigned normalized 
1498 case GL_COMPRESSED_RGBA_ASTC_5x5_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 5x5 blocks, unsigned normalized 
1499 case GL_COMPRESSED_RGBA_ASTC_6x5_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 6x5 blocks, unsigned normalized 
1500 case GL_COMPRESSED_RGBA_ASTC_6x6_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 6x6 blocks, unsigned normalized 
1501 case GL_COMPRESSED_RGBA_ASTC_8x5_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 8x5 blocks, unsigned normalized 
1502 case GL_COMPRESSED_RGBA_ASTC_8x6_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 8x6 blocks, unsigned normalized 
1503 case GL_COMPRESSED_RGBA_ASTC_8x8_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 8x8 blocks, unsigned normalized 
1504 case GL_COMPRESSED_RGBA_ASTC_10x5_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 10x5 blocks, unsigned normalized 
1505 case GL_COMPRESSED_RGBA_ASTC_10x6_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 10x6 blocks, unsigned normalized 
1506 case GL_COMPRESSED_RGBA_ASTC_10x8_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 10x8 blocks, unsigned normalized 
1507 case GL_COMPRESSED_RGBA_ASTC_10x10_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 10x10 blocks, unsigned normalized 
1508 case GL_COMPRESSED_RGBA_ASTC_12x10_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 12x10 blocks, unsigned normalized 
1509 case GL_COMPRESSED_RGBA_ASTC_12x12_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 12x12 blocks, unsigned normalized 
1510 
1511 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 4x4 blocks, sRGB 
1512 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 5x4 blocks, sRGB 
1513 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 5x5 blocks, sRGB 
1514 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 6x5 blocks, sRGB 
1515 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 6x6 blocks, sRGB 
1516 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 8x5 blocks, sRGB 
1517 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 8x6 blocks, sRGB 
1518 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 8x8 blocks, sRGB 
1519 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 10x5 blocks, sRGB 
1520 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 10x6 blocks, sRGB 
1521 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 10x8 blocks, sRGB 
1522 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 10x10 blocks, sRGB 
1523 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 12x10 blocks, sRGB 
1524 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: return GL_UNSIGNED_BYTE; // 4-component ASTC, 12x12 blocks, sRGB 
1525 
1526 case GL_COMPRESSED_RGBA_ASTC_3x3x3_OES: return GL_UNSIGNED_BYTE; // 4-component ASTC, 3x3x3 blocks, unsigned normalized 
1527 case GL_COMPRESSED_RGBA_ASTC_4x3x3_OES: return GL_UNSIGNED_BYTE; // 4-component ASTC, 4x3x3 blocks, unsigned normalized 
1528 case GL_COMPRESSED_RGBA_ASTC_4x4x3_OES: return GL_UNSIGNED_BYTE; // 4-component ASTC, 4x4x3 blocks, unsigned normalized 
1529 case GL_COMPRESSED_RGBA_ASTC_4x4x4_OES: return GL_UNSIGNED_BYTE; // 4-component ASTC, 4x4x4 blocks, unsigned normalized 
1530 case GL_COMPRESSED_RGBA_ASTC_5x4x4_OES: return GL_UNSIGNED_BYTE; // 4-component ASTC, 5x4x4 blocks, unsigned normalized 
1531 case GL_COMPRESSED_RGBA_ASTC_5x5x4_OES: return GL_UNSIGNED_BYTE; // 4-component ASTC, 5x5x4 blocks, unsigned normalized 
1532 case GL_COMPRESSED_RGBA_ASTC_5x5x5_OES: return GL_UNSIGNED_BYTE; // 4-component ASTC, 5x5x5 blocks, unsigned normalized 
1533 case GL_COMPRESSED_RGBA_ASTC_6x5x5_OES: return GL_UNSIGNED_BYTE; // 4-component ASTC, 6x5x5 blocks, unsigned normalized 
1534 case GL_COMPRESSED_RGBA_ASTC_6x6x5_OES: return GL_UNSIGNED_BYTE; // 4-component ASTC, 6x6x5 blocks, unsigned normalized 
1535 case GL_COMPRESSED_RGBA_ASTC_6x6x6_OES: return GL_UNSIGNED_BYTE; // 4-component ASTC, 6x6x6 blocks, unsigned normalized 
1536 
1537 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES: return GL_UNSIGNED_BYTE; // 4-component ASTC, 3x3x3 blocks, sRGB 
1538 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES: return GL_UNSIGNED_BYTE; // 4-component ASTC, 4x3x3 blocks, sRGB 
1539 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES: return GL_UNSIGNED_BYTE; // 4-component ASTC, 4x4x3 blocks, sRGB 
1540 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES: return GL_UNSIGNED_BYTE; // 4-component ASTC, 4x4x4 blocks, sRGB 
1541 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES: return GL_UNSIGNED_BYTE; // 4-component ASTC, 5x4x4 blocks, sRGB 
1542 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES: return GL_UNSIGNED_BYTE; // 4-component ASTC, 5x5x4 blocks, sRGB 
1543 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES: return GL_UNSIGNED_BYTE; // 4-component ASTC, 5x5x5 blocks, sRGB 
1544 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES: return GL_UNSIGNED_BYTE; // 4-component ASTC, 6x5x5 blocks, sRGB 
1545 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES: return GL_UNSIGNED_BYTE; // 4-component ASTC, 6x6x5 blocks, sRGB 
1546 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES: return GL_UNSIGNED_BYTE; // 4-component ASTC, 6x6x6 blocks, sRGB 
1547 
1548 // 
1549 // ATC 
1550 // 
1551 case GL_ATC_RGB_AMD: return GL_UNSIGNED_BYTE; // 3-component, 4x4 blocks, unsigned normalized 
1552 case GL_ATC_RGBA_EXPLICIT_ALPHA_AMD: return GL_UNSIGNED_BYTE; // 4-component, 4x4 blocks, unsigned normalized 
1553 case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD: return GL_UNSIGNED_BYTE; // 4-component, 4x4 blocks, unsigned normalized 
1554 
1555 // 
1556 // Palletized 
1557 // 
1558 case GL_PALETTE4_RGB8_OES: return GL_UNSIGNED_BYTE; // 3-component 8:8:8, 4-bit palette, unsigned normalized 
1559 case GL_PALETTE4_RGBA8_OES: return GL_UNSIGNED_BYTE; // 4-component 8:8:8:8, 4-bit palette, unsigned normalized 
1560 case GL_PALETTE4_R5_G6_B5_OES: return GL_UNSIGNED_SHORT_5_6_5; // 3-component 5:6:5, 4-bit palette, unsigned normalized 
1561 case GL_PALETTE4_RGBA4_OES: return GL_UNSIGNED_SHORT_4_4_4_4; // 4-component 4:4:4:4, 4-bit palette, unsigned normalized 
1562 case GL_PALETTE4_RGB5_A1_OES: return GL_UNSIGNED_SHORT_5_5_5_1; // 4-component 5:5:5:1, 4-bit palette, unsigned normalized 
1563 case GL_PALETTE8_RGB8_OES: return GL_UNSIGNED_BYTE; // 3-component 8:8:8, 8-bit palette, unsigned normalized 
1564 case GL_PALETTE8_RGBA8_OES: return GL_UNSIGNED_BYTE; // 4-component 8:8:8:8, 8-bit palette, unsigned normalized 
1565 case GL_PALETTE8_R5_G6_B5_OES: return GL_UNSIGNED_SHORT_5_6_5; // 3-component 5:6:5, 8-bit palette, unsigned normalized 
1566 case GL_PALETTE8_RGBA4_OES: return GL_UNSIGNED_SHORT_4_4_4_4; // 4-component 4:4:4:4, 8-bit palette, unsigned normalized 
1567 case GL_PALETTE8_RGB5_A1_OES: return GL_UNSIGNED_SHORT_5_5_5_1; // 4-component 5:5:5:1, 8-bit palette, unsigned normalized 
1568 
1569 // 
1570 // Depth/stencil 
1571 // 
1572 case GL_DEPTH_COMPONENT16: return GL_UNSIGNED_SHORT
1573 case GL_DEPTH_COMPONENT24: return GL_UNSIGNED_INT_24_8
1574 case GL_DEPTH_COMPONENT32: return GL_UNSIGNED_INT
1575 case GL_DEPTH_COMPONENT32F: return GL_FLOAT
1576 case GL_DEPTH_COMPONENT32F_NV: return GL_FLOAT
1577 case GL_STENCIL_INDEX1: return GL_UNSIGNED_BYTE
1578 case GL_STENCIL_INDEX4: return GL_UNSIGNED_BYTE
1579 case GL_STENCIL_INDEX8: return GL_UNSIGNED_BYTE
1580 case GL_STENCIL_INDEX16: return GL_UNSIGNED_SHORT
1581 case GL_DEPTH24_STENCIL8: return GL_UNSIGNED_INT_24_8
1582 case GL_DEPTH32F_STENCIL8: return GL_FLOAT_32_UNSIGNED_INT_24_8_REV
1583 case GL_DEPTH32F_STENCIL8_NV: return GL_FLOAT_32_UNSIGNED_INT_24_8_REV
1584 
1585 default: return GL_INVALID_VALUE
1586
1587
1588 
1589static inline unsigned int glGetTypeSizeFromType(GLenum type
1590
1591 switch (type) { 
1592 case GL_BYTE
1593 case GL_UNSIGNED_BYTE
1594 case GL_UNSIGNED_BYTE_3_3_2
1595 case GL_UNSIGNED_BYTE_2_3_3_REV
1596 return 1
1597 
1598 case GL_SHORT
1599 case GL_UNSIGNED_SHORT
1600 case GL_UNSIGNED_SHORT_5_6_5
1601 case GL_UNSIGNED_SHORT_4_4_4_4
1602 case GL_UNSIGNED_SHORT_5_5_5_1
1603 case GL_UNSIGNED_SHORT_5_6_5_REV
1604 case GL_UNSIGNED_SHORT_4_4_4_4_REV
1605 case GL_UNSIGNED_SHORT_1_5_5_5_REV
1606 case GL_HALF_FLOAT
1607 return 2
1608 
1609 case GL_INT
1610 case GL_UNSIGNED_INT
1611 case GL_UNSIGNED_INT_8_8_8_8
1612 case GL_UNSIGNED_INT_8_8_8_8_REV
1613 case GL_UNSIGNED_INT_10_10_10_2
1614 case GL_UNSIGNED_INT_2_10_10_10_REV
1615 case GL_UNSIGNED_INT_24_8
1616 case GL_UNSIGNED_INT_10F_11F_11F_REV
1617 case GL_UNSIGNED_INT_5_9_9_9_REV
1618 case GL_FLOAT
1619 case GL_FLOAT_32_UNSIGNED_INT_24_8_REV
1620 return 4
1621 
1622 default
1623 return GL_INVALID_VALUE
1624
1625
1626 
1627static inline void glGetFormatSize( const GLenum internalFormat, ktxFormatSize * pFormatSize
1628
1629 pFormatSize->minBlocksX = pFormatSize->minBlocksY = 1
1630 switch ( internalFormat
1631
1632 // 
1633 // 8 bits per component 
1634 // 
1635 case GL_R8: // 1-component, 8-bit unsigned normalized 
1636 case GL_R8_SNORM: // 1-component, 8-bit signed normalized 
1637 case GL_R8UI: // 1-component, 8-bit unsigned integer 
1638 case GL_R8I: // 1-component, 8-bit signed integer 
1639 case GL_SR8: // 1-component, 8-bit sRGB 
1640 pFormatSize->flags = 0
1641 pFormatSize->paletteSizeInBits = 0
1642 pFormatSize->blockSizeInBits = 1 * 8
1643 pFormatSize->blockWidth = 1
1644 pFormatSize->blockHeight = 1
1645 pFormatSize->blockDepth = 1
1646 break
1647 case GL_RG8: // 2-component, 8-bit unsigned normalized 
1648 case GL_RG8_SNORM: // 2-component, 8-bit signed normalized 
1649 case GL_RG8UI: // 2-component, 8-bit unsigned integer 
1650 case GL_RG8I: // 2-component, 8-bit signed integer 
1651 case GL_SRG8: // 2-component, 8-bit sRGB 
1652 pFormatSize->flags = 0
1653 pFormatSize->paletteSizeInBits = 0
1654 pFormatSize->blockSizeInBits = 2 * 8
1655 pFormatSize->blockWidth = 1
1656 pFormatSize->blockHeight = 1
1657 pFormatSize->blockDepth = 1
1658 break
1659 case GL_RGB8: // 3-component, 8-bit unsigned normalized 
1660 case GL_RGB8_SNORM: // 3-component, 8-bit signed normalized 
1661 case GL_RGB8UI: // 3-component, 8-bit unsigned integer 
1662 case GL_RGB8I: // 3-component, 8-bit signed integer 
1663 case GL_SRGB8: // 3-component, 8-bit sRGB 
1664 pFormatSize->flags = 0
1665 pFormatSize->paletteSizeInBits = 0
1666 pFormatSize->blockSizeInBits = 3 * 8
1667 pFormatSize->blockWidth = 1
1668 pFormatSize->blockHeight = 1
1669 pFormatSize->blockDepth = 1
1670 break
1671 case GL_RGBA8: // 4-component, 8-bit unsigned normalized 
1672 case GL_RGBA8_SNORM: // 4-component, 8-bit signed normalized 
1673 case GL_RGBA8UI: // 4-component, 8-bit unsigned integer 
1674 case GL_RGBA8I: // 4-component, 8-bit signed integer 
1675 case GL_SRGB8_ALPHA8: // 4-component, 8-bit sRGB 
1676 pFormatSize->flags = 0
1677 pFormatSize->paletteSizeInBits = 0
1678 pFormatSize->blockSizeInBits = 4 * 8
1679 pFormatSize->blockWidth = 1
1680 pFormatSize->blockHeight = 1
1681 pFormatSize->blockDepth = 1
1682 break
1683 
1684 // 
1685 // 16 bits per component 
1686 // 
1687 case GL_R16: // 1-component, 16-bit unsigned normalized 
1688 case GL_R16_SNORM: // 1-component, 16-bit signed normalized 
1689 case GL_R16UI: // 1-component, 16-bit unsigned integer 
1690 case GL_R16I: // 1-component, 16-bit signed integer 
1691 case GL_R16F: // 1-component, 16-bit floating-point 
1692 pFormatSize->flags = 0
1693 pFormatSize->paletteSizeInBits = 0
1694 pFormatSize->blockSizeInBits = 2 * 8
1695 pFormatSize->blockWidth = 1
1696 pFormatSize->blockHeight = 1
1697 pFormatSize->blockDepth = 1
1698 break
1699 case GL_RG16: // 2-component, 16-bit unsigned normalized 
1700 case GL_RG16_SNORM: // 2-component, 16-bit signed normalized 
1701 case GL_RG16UI: // 2-component, 16-bit unsigned integer 
1702 case GL_RG16I: // 2-component, 16-bit signed integer 
1703 case GL_RG16F: // 2-component, 16-bit floating-point 
1704 pFormatSize->flags = 0
1705 pFormatSize->paletteSizeInBits = 0
1706 pFormatSize->blockSizeInBits = 4 * 8
1707 pFormatSize->blockWidth = 1
1708 pFormatSize->blockHeight = 1
1709 pFormatSize->blockDepth = 1
1710 break
1711 case GL_RGB16: // 3-component, 16-bit unsigned normalized 
1712 case GL_RGB16_SNORM: // 3-component, 16-bit signed normalized 
1713 case GL_RGB16UI: // 3-component, 16-bit unsigned integer 
1714 case GL_RGB16I: // 3-component, 16-bit signed integer 
1715 case GL_RGB16F: // 3-component, 16-bit floating-point 
1716 pFormatSize->flags = 0
1717 pFormatSize->paletteSizeInBits = 0
1718 pFormatSize->blockSizeInBits = 6 * 8
1719 pFormatSize->blockWidth = 1
1720 pFormatSize->blockHeight = 1
1721 pFormatSize->blockDepth = 1
1722 break
1723 case GL_RGBA16: // 4-component, 16-bit unsigned normalized 
1724 case GL_RGBA16_SNORM: // 4-component, 16-bit signed normalized 
1725 case GL_RGBA16UI: // 4-component, 16-bit unsigned integer 
1726 case GL_RGBA16I: // 4-component, 16-bit signed integer 
1727 case GL_RGBA16F: // 4-component, 16-bit floating-point 
1728 pFormatSize->flags = 0
1729 pFormatSize->paletteSizeInBits = 0
1730 pFormatSize->blockSizeInBits = 8 * 8
1731 pFormatSize->blockWidth = 1
1732 pFormatSize->blockHeight = 1
1733 pFormatSize->blockDepth = 1
1734 break
1735 
1736 // 
1737 // 32 bits per component 
1738 // 
1739 case GL_R32UI: // 1-component, 32-bit unsigned integer 
1740 case GL_R32I: // 1-component, 32-bit signed integer 
1741 case GL_R32F: // 1-component, 32-bit floating-point 
1742 pFormatSize->flags = 0
1743 pFormatSize->paletteSizeInBits = 0
1744 pFormatSize->blockSizeInBits = 4 * 8
1745 pFormatSize->blockWidth = 1
1746 pFormatSize->blockHeight = 1
1747 pFormatSize->blockDepth = 1
1748 break
1749 case GL_RG32UI: // 2-component, 32-bit unsigned integer 
1750 case GL_RG32I: // 2-component, 32-bit signed integer 
1751 case GL_RG32F: // 2-component, 32-bit floating-point 
1752 pFormatSize->flags = 0
1753 pFormatSize->paletteSizeInBits = 0
1754 pFormatSize->blockSizeInBits = 8 * 8
1755 pFormatSize->blockWidth = 1
1756 pFormatSize->blockHeight = 1
1757 pFormatSize->blockDepth = 1
1758 break
1759 case GL_RGB32UI: // 3-component, 32-bit unsigned integer 
1760 case GL_RGB32I: // 3-component, 32-bit signed integer 
1761 case GL_RGB32F: // 3-component, 32-bit floating-point 
1762 pFormatSize->flags = 0
1763 pFormatSize->paletteSizeInBits = 0
1764 pFormatSize->blockSizeInBits = 12 * 8
1765 pFormatSize->blockWidth = 1
1766 pFormatSize->blockHeight = 1
1767 pFormatSize->blockDepth = 1
1768 break
1769 case GL_RGBA32UI: // 4-component, 32-bit unsigned integer 
1770 case GL_RGBA32I: // 4-component, 32-bit signed integer 
1771 case GL_RGBA32F: // 4-component, 32-bit floating-point 
1772 pFormatSize->flags = 0
1773 pFormatSize->paletteSizeInBits = 0
1774 pFormatSize->blockSizeInBits = 16 * 8
1775 pFormatSize->blockWidth = 1
1776 pFormatSize->blockHeight = 1
1777 pFormatSize->blockDepth = 1
1778 break
1779 
1780 // 
1781 // Packed 
1782 // 
1783 case GL_R3_G3_B2: // 3-component 3:3:2, unsigned normalized 
1784 pFormatSize->flags = KTX_FORMAT_SIZE_PACKED_BIT
1785 pFormatSize->paletteSizeInBits = 0
1786 pFormatSize->blockSizeInBits = 8
1787 pFormatSize->blockWidth = 1
1788 pFormatSize->blockHeight = 1
1789 pFormatSize->blockDepth = 1
1790 break
1791 case GL_RGB4: // 3-component 4:4:4, unsigned normalized 
1792 pFormatSize->flags = KTX_FORMAT_SIZE_PACKED_BIT
1793 pFormatSize->paletteSizeInBits = 0
1794 pFormatSize->blockSizeInBits = 12
1795 pFormatSize->blockWidth = 1
1796 pFormatSize->blockHeight = 1
1797 pFormatSize->blockDepth = 1
1798 break
1799 case GL_RGB5: // 3-component 5:5:5, unsigned normalized 
1800 pFormatSize->flags = KTX_FORMAT_SIZE_PACKED_BIT
1801 pFormatSize->paletteSizeInBits = 0
1802 pFormatSize->blockSizeInBits = 16
1803 pFormatSize->blockWidth = 1
1804 pFormatSize->blockHeight = 1
1805 pFormatSize->blockDepth = 1
1806 break
1807 case GL_RGB565: // 3-component 5:6:5, unsigned normalized 
1808 pFormatSize->flags = KTX_FORMAT_SIZE_PACKED_BIT
1809 pFormatSize->paletteSizeInBits = 0
1810 pFormatSize->blockSizeInBits = 16
1811 pFormatSize->blockWidth = 1
1812 pFormatSize->blockHeight = 1
1813 pFormatSize->blockDepth = 1
1814 break
1815 case GL_RGB10: // 3-component 10:10:10, unsigned normalized 
1816 pFormatSize->flags = KTX_FORMAT_SIZE_PACKED_BIT
1817 pFormatSize->paletteSizeInBits = 0
1818 pFormatSize->blockSizeInBits = 32
1819 pFormatSize->blockWidth = 1
1820 pFormatSize->blockHeight = 1
1821 pFormatSize->blockDepth = 1
1822 break
1823 case GL_RGB12: // 3-component 12:12:12, unsigned normalized 
1824 pFormatSize->flags = KTX_FORMAT_SIZE_PACKED_BIT
1825 pFormatSize->paletteSizeInBits = 0
1826 pFormatSize->blockSizeInBits = 36
1827 pFormatSize->blockWidth = 1
1828 pFormatSize->blockHeight = 1
1829 pFormatSize->blockDepth = 1
1830 break
1831 case GL_RGBA2: // 4-component 2:2:2:2, unsigned normalized 
1832 pFormatSize->flags = KTX_FORMAT_SIZE_PACKED_BIT
1833 pFormatSize->paletteSizeInBits = 0
1834 pFormatSize->blockSizeInBits = 8
1835 pFormatSize->blockWidth = 1
1836 pFormatSize->blockHeight = 1
1837 pFormatSize->blockDepth = 1
1838 break
1839 case GL_RGBA4: // 4-component 4:4:4:4, unsigned normalized 
1840 pFormatSize->flags = KTX_FORMAT_SIZE_PACKED_BIT
1841 pFormatSize->paletteSizeInBits = 0
1842 pFormatSize->blockSizeInBits = 16
1843 pFormatSize->blockWidth = 1
1844 pFormatSize->blockHeight = 1
1845 pFormatSize->blockDepth = 1
1846 break
1847 case GL_RGBA12: // 4-component 12:12:12:12, unsigned normalized 
1848 pFormatSize->flags = KTX_FORMAT_SIZE_PACKED_BIT
1849 pFormatSize->paletteSizeInBits = 0
1850 pFormatSize->blockSizeInBits = 48
1851 pFormatSize->blockWidth = 1
1852 pFormatSize->blockHeight = 1
1853 pFormatSize->blockDepth = 1
1854 break
1855 case GL_RGB5_A1: // 4-component 5:5:5:1, unsigned normalized 
1856 pFormatSize->flags = KTX_FORMAT_SIZE_PACKED_BIT
1857 pFormatSize->paletteSizeInBits = 0
1858 pFormatSize->blockSizeInBits = 32
1859 pFormatSize->blockWidth = 1
1860 pFormatSize->blockHeight = 1
1861 pFormatSize->blockDepth = 1
1862 break
1863 case GL_RGB10_A2: // 4-component 10:10:10:2, unsigned normalized 
1864 pFormatSize->flags = KTX_FORMAT_SIZE_PACKED_BIT
1865 pFormatSize->paletteSizeInBits = 0
1866 pFormatSize->blockSizeInBits = 32
1867 pFormatSize->blockWidth = 1
1868 pFormatSize->blockHeight = 1
1869 pFormatSize->blockDepth = 1
1870 break
1871 case GL_RGB10_A2UI: // 4-component 10:10:10:2, unsigned integer 
1872 pFormatSize->flags = KTX_FORMAT_SIZE_PACKED_BIT
1873 pFormatSize->paletteSizeInBits = 0
1874 pFormatSize->blockSizeInBits = 32
1875 pFormatSize->blockWidth = 1
1876 pFormatSize->blockHeight = 1
1877 pFormatSize->blockDepth = 1
1878 break
1879 case GL_R11F_G11F_B10F: // 3-component 11:11:10, floating-point 
1880 case GL_RGB9_E5: // 3-component/exp 9:9:9/5, floating-point 
1881 pFormatSize->flags = KTX_FORMAT_SIZE_PACKED_BIT
1882 pFormatSize->paletteSizeInBits = 0
1883 pFormatSize->blockSizeInBits = 32
1884 pFormatSize->blockWidth = 1
1885 pFormatSize->blockHeight = 1
1886 pFormatSize->blockDepth = 1
1887 break
1888 
1889 // 
1890 // S3TC/DXT/BC 
1891 // 
1892 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: // line through 3D space, 4x4 blocks, unsigned normalized 
1893 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: // line through 3D space plus 1-bit alpha, 4x4 blocks, unsigned normalized 
1894 case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: // line through 3D space, 4x4 blocks, sRGB 
1895 case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: // line through 3D space plus 1-bit alpha, 4x4 blocks, sRGB 
1896 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
1897 pFormatSize->paletteSizeInBits = 0
1898 pFormatSize->blockSizeInBits = 64
1899 pFormatSize->blockWidth = 4
1900 pFormatSize->blockHeight = 4
1901 pFormatSize->blockDepth = 1
1902 break
1903 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: // line through 3D space plus line through 1D space, 4x4 blocks, unsigned normalized 
1904 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: // line through 3D space plus 4-bit alpha, 4x4 blocks, unsigned normalized 
1905 case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: // line through 3D space plus line through 1D space, 4x4 blocks, sRGB 
1906 case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: // line through 3D space plus 4-bit alpha, 4x4 blocks, sRGB 
1907 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
1908 pFormatSize->paletteSizeInBits = 0
1909 pFormatSize->blockSizeInBits = 128
1910 pFormatSize->blockWidth = 4
1911 pFormatSize->blockHeight = 4
1912 pFormatSize->blockDepth = 1
1913 break
1914 
1915 case GL_COMPRESSED_LUMINANCE_LATC1_EXT: // line through 1D space, 4x4 blocks, unsigned normalized 
1916 case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT: // line through 1D space, 4x4 blocks, signed normalized 
1917 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
1918 pFormatSize->paletteSizeInBits = 0
1919 pFormatSize->blockSizeInBits = 64
1920 pFormatSize->blockWidth = 4
1921 pFormatSize->blockHeight = 4
1922 pFormatSize->blockDepth = 1
1923 break
1924 case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT: // two lines through 1D space, 4x4 blocks, unsigned normalized 
1925 case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT: // two lines through 1D space, 4x4 blocks, signed normalized 
1926 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
1927 pFormatSize->paletteSizeInBits = 0
1928 pFormatSize->blockSizeInBits = 128
1929 pFormatSize->blockWidth = 4
1930 pFormatSize->blockHeight = 4
1931 pFormatSize->blockDepth = 1
1932 break
1933 
1934 case GL_COMPRESSED_RED_RGTC1: // line through 1D space, 4x4 blocks, unsigned normalized 
1935 case GL_COMPRESSED_SIGNED_RED_RGTC1: // line through 1D space, 4x4 blocks, signed normalized 
1936 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
1937 pFormatSize->paletteSizeInBits = 0
1938 pFormatSize->blockSizeInBits = 64
1939 pFormatSize->blockWidth = 4
1940 pFormatSize->blockHeight = 4
1941 pFormatSize->blockDepth = 1
1942 break
1943 case GL_COMPRESSED_RG_RGTC2: // two lines through 1D space, 4x4 blocks, unsigned normalized 
1944 case GL_COMPRESSED_SIGNED_RG_RGTC2: // two lines through 1D space, 4x4 blocks, signed normalized 
1945 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
1946 pFormatSize->paletteSizeInBits = 0
1947 pFormatSize->blockSizeInBits = 128
1948 pFormatSize->blockWidth = 4
1949 pFormatSize->blockHeight = 4
1950 pFormatSize->blockDepth = 1
1951 break
1952 
1953 case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT: // 3-component, 4x4 blocks, unsigned floating-point 
1954 case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT: // 3-component, 4x4 blocks, signed floating-point 
1955 case GL_COMPRESSED_RGBA_BPTC_UNORM: // 4-component, 4x4 blocks, unsigned normalized 
1956 case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM: // 4-component, 4x4 blocks, sRGB 
1957 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
1958 pFormatSize->paletteSizeInBits = 0
1959 pFormatSize->blockSizeInBits = 128
1960 pFormatSize->blockWidth = 4
1961 pFormatSize->blockHeight = 4
1962 pFormatSize->blockDepth = 1
1963 break
1964 
1965 // 
1966 // ETC 
1967 // 
1968 case GL_ETC1_RGB8_OES: // 3-component ETC1, 4x4 blocks, unsigned normalized" ), 
1969 case GL_COMPRESSED_RGB8_ETC2: // 3-component ETC2, 4x4 blocks, unsigned normalized 
1970 case GL_COMPRESSED_SRGB8_ETC2: // 3-component ETC2, 4x4 blocks, sRGB 
1971 case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: // 4-component ETC2 with 1-bit alpha, 4x4 blocks, unsigned normalized 
1972 case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: // 4-component ETC2 with 1-bit alpha, 4x4 blocks, sRGB 
1973 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
1974 pFormatSize->paletteSizeInBits = 0
1975 pFormatSize->blockSizeInBits = 64
1976 pFormatSize->blockWidth = 4
1977 pFormatSize->blockHeight = 4
1978 pFormatSize->blockDepth = 1
1979 break
1980 case GL_COMPRESSED_RGBA8_ETC2_EAC: // 4-component ETC2, 4x4 blocks, unsigned normalized 
1981 case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: // 4-component ETC2, 4x4 blocks, sRGB 
1982 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
1983 pFormatSize->paletteSizeInBits = 0
1984 pFormatSize->blockSizeInBits = 128
1985 pFormatSize->blockWidth = 4
1986 pFormatSize->blockHeight = 4
1987 pFormatSize->blockDepth = 1
1988 break
1989 
1990 case GL_COMPRESSED_R11_EAC: // 1-component ETC, 4x4 blocks, unsigned normalized 
1991 case GL_COMPRESSED_SIGNED_R11_EAC: // 1-component ETC, 4x4 blocks, signed normalized 
1992 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
1993 pFormatSize->paletteSizeInBits = 0
1994 pFormatSize->blockSizeInBits = 64
1995 pFormatSize->blockWidth = 4
1996 pFormatSize->blockHeight = 4
1997 pFormatSize->blockDepth = 1
1998 break
1999 case GL_COMPRESSED_RG11_EAC: // 2-component ETC, 4x4 blocks, unsigned normalized 
2000 case GL_COMPRESSED_SIGNED_RG11_EAC: // 2-component ETC, 4x4 blocks, signed normalized 
2001 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2002 pFormatSize->paletteSizeInBits = 0
2003 pFormatSize->blockSizeInBits = 128
2004 pFormatSize->blockWidth = 4
2005 pFormatSize->blockHeight = 4
2006 pFormatSize->blockDepth = 1
2007 break
2008 
2009 // 
2010 // PVRTC 
2011 // 
2012 case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG: // 3-component PVRTC, 8x4 blocks, unsigned normalized 
2013 case GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT: // 3-component PVRTC, 8x4 blocks, sRGB 
2014 case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: // 4-component PVRTC, 8x4 blocks, unsigned normalized 
2015 case GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT: // 4-component PVRTC, 8x4 blocks, sRGB 
2016 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2017 pFormatSize->paletteSizeInBits = 0
2018 pFormatSize->blockSizeInBits = 64
2019 pFormatSize->blockWidth = 8
2020 pFormatSize->blockHeight = 4
2021 pFormatSize->blockDepth = 1
2022 pFormatSize->minBlocksX = 2
2023 pFormatSize->minBlocksY = 2
2024 break
2025 case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG: // 3-component PVRTC, 4x4 blocks, unsigned normalized 
2026 case GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT: // 3-component PVRTC, 4x4 blocks, sRGB 
2027 case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: // 4-component PVRTC, 4x4 blocks, unsigned normalized 
2028 case GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT: // 4-component PVRTC, 4x4 blocks, sRGB 
2029 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2030 pFormatSize->paletteSizeInBits = 0
2031 pFormatSize->blockSizeInBits = 64
2032 pFormatSize->blockWidth = 4
2033 pFormatSize->blockHeight = 4
2034 pFormatSize->blockDepth = 1
2035 pFormatSize->minBlocksX = 2
2036 pFormatSize->minBlocksY = 2
2037 break
2038 case GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG: // 4-component PVRTC, 8x4 blocks, unsigned normalized 
2039 case GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG: // 4-component PVRTC, 8x4 blocks, sRGB 
2040 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2041 pFormatSize->paletteSizeInBits = 0
2042 pFormatSize->blockSizeInBits = 64
2043 pFormatSize->blockWidth = 8
2044 pFormatSize->blockHeight = 4
2045 pFormatSize->blockDepth = 1
2046 break
2047 case GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG: // 4-component PVRTC, 4x4 blocks, unsigned normalized 
2048 case GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG: // 4-component PVRTC, 4x4 blocks, sRGB 
2049 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2050 pFormatSize->paletteSizeInBits = 0
2051 pFormatSize->blockSizeInBits = 64
2052 pFormatSize->blockWidth = 4
2053 pFormatSize->blockHeight = 4
2054 pFormatSize->blockDepth = 1
2055 break
2056 
2057 // 
2058 // ASTC 
2059 // 
2060 case GL_COMPRESSED_RGBA_ASTC_4x4_KHR: // 4-component ASTC, 4x4 blocks, unsigned normalized 
2061 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: // 4-component ASTC, 4x4 blocks, sRGB 
2062 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2063 pFormatSize->paletteSizeInBits = 0
2064 pFormatSize->blockSizeInBits = 128
2065 pFormatSize->blockWidth = 4
2066 pFormatSize->blockHeight = 4
2067 pFormatSize->blockDepth = 1
2068 break
2069 case GL_COMPRESSED_RGBA_ASTC_5x4_KHR: // 4-component ASTC, 5x4 blocks, unsigned normalized 
2070 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: // 4-component ASTC, 5x4 blocks, sRGB 
2071 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2072 pFormatSize->paletteSizeInBits = 0
2073 pFormatSize->blockSizeInBits = 128
2074 pFormatSize->blockWidth = 5
2075 pFormatSize->blockHeight = 4
2076 pFormatSize->blockDepth = 1
2077 break
2078 case GL_COMPRESSED_RGBA_ASTC_5x5_KHR: // 4-component ASTC, 5x5 blocks, unsigned normalized 
2079 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: // 4-component ASTC, 5x5 blocks, sRGB 
2080 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2081 pFormatSize->paletteSizeInBits = 0
2082 pFormatSize->blockSizeInBits = 128
2083 pFormatSize->blockWidth = 5
2084 pFormatSize->blockHeight = 5
2085 pFormatSize->blockDepth = 1
2086 break
2087 case GL_COMPRESSED_RGBA_ASTC_6x5_KHR: // 4-component ASTC, 6x5 blocks, unsigned normalized 
2088 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: // 4-component ASTC, 6x5 blocks, sRGB 
2089 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2090 pFormatSize->paletteSizeInBits = 0
2091 pFormatSize->blockSizeInBits = 128
2092 pFormatSize->blockWidth = 6
2093 pFormatSize->blockHeight = 5
2094 pFormatSize->blockDepth = 1
2095 break
2096 case GL_COMPRESSED_RGBA_ASTC_6x6_KHR: // 4-component ASTC, 6x6 blocks, unsigned normalized 
2097 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: // 4-component ASTC, 6x6 blocks, sRGB 
2098 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2099 pFormatSize->paletteSizeInBits = 0
2100 pFormatSize->blockSizeInBits = 128
2101 pFormatSize->blockWidth = 6
2102 pFormatSize->blockHeight = 6
2103 pFormatSize->blockDepth = 1
2104 break
2105 case GL_COMPRESSED_RGBA_ASTC_8x5_KHR: // 4-component ASTC, 8x5 blocks, unsigned normalized 
2106 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: // 4-component ASTC, 8x5 blocks, sRGB 
2107 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2108 pFormatSize->paletteSizeInBits = 0
2109 pFormatSize->blockSizeInBits = 128
2110 pFormatSize->blockWidth = 8
2111 pFormatSize->blockHeight = 5
2112 pFormatSize->blockDepth = 1
2113 break
2114 case GL_COMPRESSED_RGBA_ASTC_8x6_KHR: // 4-component ASTC, 8x6 blocks, unsigned normalized 
2115 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: // 4-component ASTC, 8x6 blocks, sRGB 
2116 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2117 pFormatSize->paletteSizeInBits = 0
2118 pFormatSize->blockSizeInBits = 128
2119 pFormatSize->blockWidth = 8
2120 pFormatSize->blockHeight = 6
2121 pFormatSize->blockDepth = 1
2122 break
2123 case GL_COMPRESSED_RGBA_ASTC_8x8_KHR: // 4-component ASTC, 8x8 blocks, unsigned normalized 
2124 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: // 4-component ASTC, 8x8 blocks, sRGB 
2125 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2126 pFormatSize->paletteSizeInBits = 0
2127 pFormatSize->blockSizeInBits = 128
2128 pFormatSize->blockWidth = 8
2129 pFormatSize->blockHeight = 8
2130 pFormatSize->blockDepth = 1
2131 break
2132 case GL_COMPRESSED_RGBA_ASTC_10x5_KHR: // 4-component ASTC, 10x5 blocks, unsigned normalized 
2133 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: // 4-component ASTC, 10x5 blocks, sRGB 
2134 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2135 pFormatSize->paletteSizeInBits = 0
2136 pFormatSize->blockSizeInBits = 128
2137 pFormatSize->blockWidth = 10
2138 pFormatSize->blockHeight = 5
2139 pFormatSize->blockDepth = 1
2140 break
2141 case GL_COMPRESSED_RGBA_ASTC_10x6_KHR: // 4-component ASTC, 10x6 blocks, unsigned normalized 
2142 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: // 4-component ASTC, 10x6 blocks, sRGB 
2143 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2144 pFormatSize->paletteSizeInBits = 0
2145 pFormatSize->blockSizeInBits = 128
2146 pFormatSize->blockWidth = 10
2147 pFormatSize->blockHeight = 6
2148 pFormatSize->blockDepth = 1
2149 break
2150 case GL_COMPRESSED_RGBA_ASTC_10x8_KHR: // 4-component ASTC, 10x8 blocks, unsigned normalized 
2151 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: // 4-component ASTC, 10x8 blocks, sRGB 
2152 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2153 pFormatSize->paletteSizeInBits = 0
2154 pFormatSize->blockSizeInBits = 128
2155 pFormatSize->blockWidth = 10
2156 pFormatSize->blockHeight = 8
2157 pFormatSize->blockDepth = 1
2158 break
2159 case GL_COMPRESSED_RGBA_ASTC_10x10_KHR: // 4-component ASTC, 10x10 blocks, unsigned normalized 
2160 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: // 4-component ASTC, 10x10 blocks, sRGB 
2161 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2162 pFormatSize->paletteSizeInBits = 0
2163 pFormatSize->blockSizeInBits = 128
2164 pFormatSize->blockWidth = 10
2165 pFormatSize->blockHeight = 10
2166 pFormatSize->blockDepth = 1
2167 break
2168 case GL_COMPRESSED_RGBA_ASTC_12x10_KHR: // 4-component ASTC, 12x10 blocks, unsigned normalized 
2169 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: // 4-component ASTC, 12x10 blocks, sRGB 
2170 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2171 pFormatSize->paletteSizeInBits = 0
2172 pFormatSize->blockSizeInBits = 128
2173 pFormatSize->blockWidth = 12
2174 pFormatSize->blockHeight = 10
2175 pFormatSize->blockDepth = 1
2176 break
2177 case GL_COMPRESSED_RGBA_ASTC_12x12_KHR: // 4-component ASTC, 12x12 blocks, unsigned normalized 
2178 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: // 4-component ASTC, 12x12 blocks, sRGB 
2179 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2180 pFormatSize->paletteSizeInBits = 0
2181 pFormatSize->blockSizeInBits = 128
2182 pFormatSize->blockWidth = 12
2183 pFormatSize->blockHeight = 12
2184 pFormatSize->blockDepth = 1
2185 break
2186 
2187 case GL_COMPRESSED_RGBA_ASTC_3x3x3_OES: // 4-component ASTC, 3x3x3 blocks, unsigned normalized 
2188 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES: // 4-component ASTC, 3x3x3 blocks, sRGB 
2189 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2190 pFormatSize->paletteSizeInBits = 0
2191 pFormatSize->blockSizeInBits = 128
2192 pFormatSize->blockWidth = 3
2193 pFormatSize->blockHeight = 3
2194 pFormatSize->blockDepth = 3
2195 break
2196 case GL_COMPRESSED_RGBA_ASTC_4x3x3_OES: // 4-component ASTC, 4x3x3 blocks, unsigned normalized 
2197 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES: // 4-component ASTC, 4x3x3 blocks, sRGB 
2198 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2199 pFormatSize->paletteSizeInBits = 0
2200 pFormatSize->blockSizeInBits = 128
2201 pFormatSize->blockWidth = 4
2202 pFormatSize->blockHeight = 3
2203 pFormatSize->blockDepth = 3
2204 break
2205 case GL_COMPRESSED_RGBA_ASTC_4x4x3_OES: // 4-component ASTC, 4x4x3 blocks, unsigned normalized 
2206 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES: // 4-component ASTC, 4x4x3 blocks, sRGB 
2207 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2208 pFormatSize->paletteSizeInBits = 0
2209 pFormatSize->blockSizeInBits = 128
2210 pFormatSize->blockWidth = 4
2211 pFormatSize->blockHeight = 4
2212 pFormatSize->blockDepth = 3
2213 break
2214 case GL_COMPRESSED_RGBA_ASTC_4x4x4_OES: // 4-component ASTC, 4x4x4 blocks, unsigned normalized 
2215 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES: // 4-component ASTC, 4x4x4 blocks, sRGB 
2216 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2217 pFormatSize->paletteSizeInBits = 0
2218 pFormatSize->blockSizeInBits = 128
2219 pFormatSize->blockWidth = 4
2220 pFormatSize->blockHeight = 4
2221 pFormatSize->blockDepth = 4
2222 break
2223 case GL_COMPRESSED_RGBA_ASTC_5x4x4_OES: // 4-component ASTC, 5x4x4 blocks, unsigned normalized 
2224 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES: // 4-component ASTC, 5x4x4 blocks, sRGB 
2225 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2226 pFormatSize->paletteSizeInBits = 0
2227 pFormatSize->blockSizeInBits = 128
2228 pFormatSize->blockWidth = 5
2229 pFormatSize->blockHeight = 4
2230 pFormatSize->blockDepth = 4
2231 break
2232 case GL_COMPRESSED_RGBA_ASTC_5x5x4_OES: // 4-component ASTC, 5x5x4 blocks, unsigned normalized 
2233 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES: // 4-component ASTC, 5x5x4 blocks, sRGB 
2234 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2235 pFormatSize->paletteSizeInBits = 0
2236 pFormatSize->blockSizeInBits = 128
2237 pFormatSize->blockWidth = 5
2238 pFormatSize->blockHeight = 5
2239 pFormatSize->blockDepth = 4
2240 break
2241 case GL_COMPRESSED_RGBA_ASTC_5x5x5_OES: // 4-component ASTC, 5x5x5 blocks, unsigned normalized 
2242 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES: // 4-component ASTC, 5x5x5 blocks, sRGB 
2243 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2244 pFormatSize->paletteSizeInBits = 0
2245 pFormatSize->blockSizeInBits = 128
2246 pFormatSize->blockWidth = 5
2247 pFormatSize->blockHeight = 5
2248 pFormatSize->blockDepth = 5
2249 break
2250 case GL_COMPRESSED_RGBA_ASTC_6x5x5_OES: // 4-component ASTC, 6x5x5 blocks, unsigned normalized 
2251 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES: // 4-component ASTC, 6x5x5 blocks, sRGB 
2252 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2253 pFormatSize->paletteSizeInBits = 0
2254 pFormatSize->blockSizeInBits = 128
2255 pFormatSize->blockWidth = 6
2256 pFormatSize->blockHeight = 5
2257 pFormatSize->blockDepth = 5
2258 break
2259 case GL_COMPRESSED_RGBA_ASTC_6x6x5_OES: // 4-component ASTC, 6x6x5 blocks, unsigned normalized 
2260 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES: // 4-component ASTC, 6x6x5 blocks, sRGB 
2261 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2262 pFormatSize->paletteSizeInBits = 0
2263 pFormatSize->blockSizeInBits = 128
2264 pFormatSize->blockWidth = 6
2265 pFormatSize->blockHeight = 6
2266 pFormatSize->blockDepth = 5
2267 break
2268 case GL_COMPRESSED_RGBA_ASTC_6x6x6_OES: // 4-component ASTC, 6x6x6 blocks, unsigned normalized 
2269 case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES: // 4-component ASTC, 6x6x6 blocks, sRGB 
2270 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2271 pFormatSize->paletteSizeInBits = 0
2272 pFormatSize->blockSizeInBits = 128
2273 pFormatSize->blockWidth = 6
2274 pFormatSize->blockHeight = 6
2275 pFormatSize->blockDepth = 6
2276 break
2277 
2278 // 
2279 // ATC 
2280 // 
2281 case GL_ATC_RGB_AMD: // 3-component, 4x4 blocks, unsigned normalized 
2282 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2283 pFormatSize->paletteSizeInBits = 0
2284 pFormatSize->blockSizeInBits = 64
2285 pFormatSize->blockWidth = 4
2286 pFormatSize->blockHeight = 4
2287 pFormatSize->blockDepth = 1
2288 break
2289 case GL_ATC_RGBA_EXPLICIT_ALPHA_AMD: // 4-component, 4x4 blocks, unsigned normalized 
2290 case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD: // 4-component, 4x4 blocks, unsigned normalized 
2291 pFormatSize->flags = KTX_FORMAT_SIZE_COMPRESSED_BIT
2292 pFormatSize->paletteSizeInBits = 0
2293 pFormatSize->blockSizeInBits = 128
2294 pFormatSize->blockWidth = 4
2295 pFormatSize->blockHeight = 4
2296 pFormatSize->blockDepth = 1
2297 break
2298 
2299 // 
2300 // Palletized 
2301 // 
2302 case GL_PALETTE4_RGB8_OES: // 3-component 8:8:8, 4-bit palette, unsigned normalized 
2303 pFormatSize->flags = KTX_FORMAT_SIZE_PALETTIZED_BIT
2304 pFormatSize->paletteSizeInBits = 16 * 24
2305 pFormatSize->blockSizeInBits = 4
2306 pFormatSize->blockWidth = 1
2307 pFormatSize->blockHeight = 1
2308 pFormatSize->blockDepth = 1
2309 break
2310 case GL_PALETTE4_RGBA8_OES: // 4-component 8:8:8:8, 4-bit palette, unsigned normalized 
2311 pFormatSize->flags = KTX_FORMAT_SIZE_PALETTIZED_BIT
2312 pFormatSize->paletteSizeInBits = 16 * 32
2313 pFormatSize->blockSizeInBits = 4
2314 pFormatSize->blockWidth = 1
2315 pFormatSize->blockHeight = 1
2316 pFormatSize->blockDepth = 1
2317 break
2318 case GL_PALETTE4_R5_G6_B5_OES: // 3-component 5:6:5, 4-bit palette, unsigned normalized 
2319 case GL_PALETTE4_RGBA4_OES: // 4-component 4:4:4:4, 4-bit palette, unsigned normalized 
2320 case GL_PALETTE4_RGB5_A1_OES: // 4-component 5:5:5:1, 4-bit palette, unsigned normalized 
2321 pFormatSize->flags = KTX_FORMAT_SIZE_PALETTIZED_BIT
2322 pFormatSize->paletteSizeInBits = 16 * 16
2323 pFormatSize->blockSizeInBits = 4
2324 pFormatSize->blockWidth = 1
2325 pFormatSize->blockHeight = 1
2326 pFormatSize->blockDepth = 1
2327 break
2328 case GL_PALETTE8_RGB8_OES: // 3-component 8:8:8, 8-bit palette, unsigned normalized 
2329 pFormatSize->flags = KTX_FORMAT_SIZE_PALETTIZED_BIT
2330 pFormatSize->paletteSizeInBits = 256 * 24
2331 pFormatSize->blockSizeInBits = 8
2332 pFormatSize->blockWidth = 1
2333 pFormatSize->blockHeight = 1
2334 pFormatSize->blockDepth = 1
2335 break
2336 case GL_PALETTE8_RGBA8_OES: // 4-component 8:8:8:8, 8-bit palette, unsigned normalized 
2337 pFormatSize->flags = KTX_FORMAT_SIZE_PALETTIZED_BIT
2338 pFormatSize->paletteSizeInBits = 256 * 32
2339 pFormatSize->blockSizeInBits = 8
2340 pFormatSize->blockWidth = 1
2341 pFormatSize->blockHeight = 1
2342 pFormatSize->blockDepth = 1
2343 break
2344 case GL_PALETTE8_R5_G6_B5_OES: // 3-component 5:6:5, 8-bit palette, unsigned normalized 
2345 case GL_PALETTE8_RGBA4_OES: // 4-component 4:4:4:4, 8-bit palette, unsigned normalized 
2346 case GL_PALETTE8_RGB5_A1_OES: // 4-component 5:5:5:1, 8-bit palette, unsigned normalized 
2347 pFormatSize->flags = KTX_FORMAT_SIZE_PALETTIZED_BIT
2348 pFormatSize->paletteSizeInBits = 256 * 16
2349 pFormatSize->blockSizeInBits = 8
2350 pFormatSize->blockWidth = 1
2351 pFormatSize->blockHeight = 1
2352 pFormatSize->blockDepth = 1
2353 break
2354 
2355 // 
2356 // Depth/stencil 
2357 // 
2358 case GL_DEPTH_COMPONENT16
2359 pFormatSize->flags = KTX_FORMAT_SIZE_DEPTH_BIT
2360 pFormatSize->paletteSizeInBits = 0
2361 pFormatSize->blockSizeInBits = 16
2362 pFormatSize->blockWidth = 1
2363 pFormatSize->blockHeight = 1
2364 pFormatSize->blockDepth = 1
2365 break
2366 case GL_DEPTH_COMPONENT24
2367 case GL_DEPTH_COMPONENT32
2368 case GL_DEPTH_COMPONENT32F
2369 case GL_DEPTH_COMPONENT32F_NV
2370 pFormatSize->flags = KTX_FORMAT_SIZE_DEPTH_BIT
2371 pFormatSize->paletteSizeInBits = 0
2372 pFormatSize->blockSizeInBits = 32
2373 pFormatSize->blockWidth = 1
2374 pFormatSize->blockHeight = 1
2375 pFormatSize->blockDepth = 1
2376 break
2377 case GL_STENCIL_INDEX1
2378 pFormatSize->flags = KTX_FORMAT_SIZE_STENCIL_BIT
2379 pFormatSize->paletteSizeInBits = 0
2380 pFormatSize->blockSizeInBits = 1
2381 pFormatSize->blockWidth = 1
2382 pFormatSize->blockHeight = 1
2383 pFormatSize->blockDepth = 1
2384 break
2385 case GL_STENCIL_INDEX4
2386 pFormatSize->flags = KTX_FORMAT_SIZE_STENCIL_BIT
2387 pFormatSize->paletteSizeInBits = 0
2388 pFormatSize->blockSizeInBits = 4
2389 pFormatSize->blockWidth = 1
2390 pFormatSize->blockHeight = 1
2391 pFormatSize->blockDepth = 1
2392 break
2393 case GL_STENCIL_INDEX8
2394 pFormatSize->flags = KTX_FORMAT_SIZE_STENCIL_BIT
2395 pFormatSize->paletteSizeInBits = 0
2396 pFormatSize->blockSizeInBits = 8
2397 pFormatSize->blockWidth = 1
2398 pFormatSize->blockHeight = 1
2399 pFormatSize->blockDepth = 1
2400 break
2401 case GL_STENCIL_INDEX16
2402 pFormatSize->flags = KTX_FORMAT_SIZE_STENCIL_BIT
2403 pFormatSize->paletteSizeInBits = 0
2404 pFormatSize->blockSizeInBits = 16
2405 pFormatSize->blockWidth = 1
2406 pFormatSize->blockHeight = 1
2407 pFormatSize->blockDepth = 1
2408 break
2409 case GL_DEPTH24_STENCIL8
2410 pFormatSize->flags = KTX_FORMAT_SIZE_DEPTH_BIT | KTX_FORMAT_SIZE_STENCIL_BIT
2411 pFormatSize->paletteSizeInBits = 0
2412 pFormatSize->blockSizeInBits = 32
2413 pFormatSize->blockWidth = 1
2414 pFormatSize->blockHeight = 1
2415 pFormatSize->blockDepth = 1
2416 break
2417 case GL_DEPTH32F_STENCIL8
2418 case GL_DEPTH32F_STENCIL8_NV
2419 pFormatSize->flags = KTX_FORMAT_SIZE_DEPTH_BIT | KTX_FORMAT_SIZE_STENCIL_BIT
2420 pFormatSize->paletteSizeInBits = 0
2421 pFormatSize->blockSizeInBits = 64
2422 pFormatSize->blockWidth = 1
2423 pFormatSize->blockHeight = 1
2424 pFormatSize->blockDepth = 1
2425 break
2426 
2427 default
2428 pFormatSize->flags = 0
2429 pFormatSize->paletteSizeInBits = 0
2430 pFormatSize->blockSizeInBits = 0 * 8
2431 pFormatSize->blockWidth = 1
2432 pFormatSize->blockHeight = 1
2433 pFormatSize->blockDepth = 1
2434 break
2435
2436
2437 
2438#endif // !GL_FORMAT_H 
2439