gl_format.h 130 KB

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