GLTextureFormat.pas 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948
  1. //
  2. // This unit is part of the GLScene Engine, http://glscene.org
  3. //
  4. unit GLTextureFormat;
  5. (* Texture formats and functions *)
  6. interface
  7. uses
  8. Winapi.OpenGL,
  9. Winapi.OpenGLext,
  10. OpenGLTokens,
  11. Scene.Strings;
  12. type
  13. // Texture addressing rules
  14. TGLSeparateTextureWrap = (twRepeat, twClampToEdge, twClampToBorder,
  15. twMirrorRepeat, twMirrorClampToEdge, twMirrorClampToBorder);
  16. (* Specifies the texture comparison mode for currently bound depth textures.
  17. That is, a texture whose internal format is tfDEPTH_COMPONENT* *)
  18. TGLTextureCompareMode = (tcmNone, tcmCompareRtoTexture);
  19. // Filtering quality
  20. TGLTextureFilteringQuality = (tfIsotropic, tfAnisotropic);
  21. TGLTextureTarget =
  22. (
  23. ttNoShape, ttTexture1D, ttTexture2D, ttTexture3D, ttTexture1DArray,
  24. ttTexture2DArray, ttTextureRect, ttTextureBuffer, ttTextureCube,
  25. ttTexture2DMultisample, ttTexture2DMultisampleArray, ttTextureCubeArray
  26. );
  27. TGLTextureSwizzle = (tswRed, tswGreen, tswBlue, tswAlpha, tswZero, tswOne);
  28. TSwizzleVector = array[0..3] of TGLTextureSwizzle;
  29. TGLInternalFormat = (
  30. tfALPHA4,
  31. tfALPHA8,
  32. tfALPHA12,
  33. tfALPHA16,
  34. tfDEPTH_COMPONENT16,
  35. tfDEPTH_COMPONENT24,
  36. tfDEPTH_COMPONENT32,
  37. tfLUMINANCE4,
  38. tfLUMINANCE8,
  39. tfLUMINANCE12,
  40. tfLUMINANCE16,
  41. tfLUMINANCE4_ALPHA4,
  42. tfLUMINANCE6_ALPHA2,
  43. tfLUMINANCE8_ALPHA8,
  44. tfLUMINANCE12_ALPHA4,
  45. tfLUMINANCE12_ALPHA12,
  46. tfLUMINANCE16_ALPHA16,
  47. tfINTENSITY4,
  48. tfINTENSITY8,
  49. tfINTENSITY12,
  50. tfINTENSITY16,
  51. tfR3_G3_B2,
  52. tfRGB4,
  53. tfRGB5,
  54. tfRGB8,
  55. tfRGB10,
  56. tfRGB12,
  57. tfR16G16B16,
  58. tfRGBA2,
  59. tfRGBA4,
  60. tfRGB5_A1,
  61. tfRGBA8,
  62. tfRGB10_A2,
  63. tfRGBA12,
  64. tfR16G16B16A16,
  65. tfCOMPRESSED_RGB_S3TC_DXT1,
  66. tfCOMPRESSED_RGBA_S3TC_DXT1,
  67. tfCOMPRESSED_RGBA_S3TC_DXT3,
  68. tfCOMPRESSED_RGBA_S3TC_DXT5,
  69. tfSIGNED_LUMINANCE8,
  70. tfSIGNED_LUMINANCE8_ALPHA8,
  71. tfSIGNED_RGB8,
  72. tfSIGNED_RGBA8,
  73. tfSIGNED_RGB8_UNSIGNED_ALPHA8,
  74. tfSIGNED_ALPHA8,
  75. tfSIGNED_INTENSITY8,
  76. tfHILO16,
  77. tfSIGNED_HILO16,
  78. tfDSDT8,
  79. tfDSDT8_MAG8,
  80. tfDSDT8_MAG8_INTENSITY8,
  81. tfHILO8,
  82. tfSIGNED_HILO8,
  83. tfFLOAT_R16,
  84. tfFLOAT_R32,
  85. tfFLOAT_RG16,
  86. tfFLOAT_RGB16,
  87. tfFLOAT_RGBA16,
  88. tfFLOAT_RG32,
  89. tfFLOAT_RGB32,
  90. tfFLOAT_RGBA32,
  91. tfRGBA_FLOAT32,
  92. tfRGB_FLOAT32,
  93. tfALPHA_FLOAT32,
  94. tfINTENSITY_FLOAT32,
  95. tfLUMINANCE_FLOAT32,
  96. tfLUMINANCE_ALPHA_FLOAT32,
  97. tfRGBA_FLOAT16,
  98. tfRGB_FLOAT16,
  99. tfALPHA_FLOAT16,
  100. tfINTENSITY_FLOAT16,
  101. tfLUMINANCE_FLOAT16,
  102. tfLUMINANCE_ALPHA_FLOAT16,
  103. tfDEPTH24_STENCIL8,
  104. tfDEPTH_COMPONENT32F,
  105. tfDEPTH32F_STENCIL8,
  106. tfSRGB8,
  107. tfSRGB8_ALPHA8,
  108. tfSLUMINANCE8,
  109. tfSLUMINANCE8_ALPHA8,
  110. tfCOMPRESSED_SRGB_S3TC_DXT1,
  111. tfCOMPRESSED_SRGB_ALPHA_S3TC_DXT1,
  112. tfCOMPRESSED_SRGB_ALPHA_S3TC_DXT3,
  113. tfCOMPRESSED_SRGB_ALPHA_S3TC_DXT5,
  114. tfRGB9_E5,
  115. tfR11F_G11F_B10F,
  116. tfCOMPRESSED_LUMINANCE_LATC1,
  117. tfCOMPRESSED_SIGNED_LUMINANCE_LATC1,
  118. tfCOMPRESSED_LUMINANCE_ALPHA_LATC2,
  119. tfCOMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2,
  120. tfCOMPRESSED_LUMINANCE_ALPHA_3DC,
  121. tfRGBA32UI,
  122. tfRGB32UI,
  123. tfALPHA32UI,
  124. tfINTENSITY32UI,
  125. tfLUMINANCE32UI,
  126. tfLUMINANCE_ALPHA32UI,
  127. tfRGBA16UI,
  128. tfRGB16UI,
  129. tfALPHA16UI,
  130. tfINTENSITY16UI,
  131. tfLUMINANCE16UI,
  132. tfLUMINANCE_ALPHA16UI,
  133. tfRGBA8UI,
  134. tfRGB8UI,
  135. tfALPHA8UI,
  136. tfINTENSITY8UI,
  137. tfLUMINANCE8UI,
  138. tfLUMINANCE_ALPHA8UI,
  139. tfRGBA32I,
  140. tfRGB32I,
  141. tfALPHA32I,
  142. tfINTENSITY32I,
  143. tfLUMINANCE32I,
  144. tfLUMINANCE_ALPHA32I,
  145. tfRGBA16I,
  146. tfRGB16I,
  147. tfALPHA16I,
  148. tfINTENSITY16I,
  149. tfLUMINANCE16I,
  150. tfLUMINANCE_ALPHA16I,
  151. tfRGBA8I,
  152. tfRGB8I,
  153. tfALPHA8I,
  154. tfINTENSITY8I,
  155. tfLUMINANCE8I,
  156. tfLUMINANCE_ALPHA8I,
  157. tfRG32UI,
  158. tfR32UI,
  159. tfRG16UI,
  160. tfR16UI,
  161. tfRG8UI,
  162. tfR8UI,
  163. tfRG32I,
  164. tfR32I,
  165. tfRG16I,
  166. tfR16I,
  167. tfRG8I,
  168. tfR8I,
  169. tfRG8,
  170. tfR8,
  171. tfRG16,
  172. tfR16,
  173. tfRG16F,
  174. tfR16F,
  175. tfRG32F,
  176. tfR32F,
  177. tfCOMPRESSED_RED_RGTC1,
  178. tfCOMPRESSED_SIGNED_RED_RGTC1,
  179. tfCOMPRESSED_RG_RGTC2,
  180. tfCOMPRESSED_SIGNED_RG_RGTC2,
  181. tfR8_SNORM,
  182. tfRG8_SNORM,
  183. tfRGB8_SNORM,
  184. tfRGBA8_SNORM,
  185. tfR16_SNORM,
  186. tfRG16_SNORM,
  187. tfRGB16_SNORM,
  188. tfRGBA16_SNORM
  189. );
  190. (* Texture compression option.
  191. If OpenGL supports it, this will activate a compressed texture format:
  192. tcDefault : uses global default compression option
  193. tcNone : do not use compression
  194. tcStandard : use standard compression, average quality, average rate
  195. tcHighQuality : choose a high-quality, low-speed compression
  196. tcHighSpeed : choose a high-speed, low-quality compression *)
  197. TGLInternalCompression = (tcDefault, tcNone, tcStandard, tcHighQuality,
  198. tcHighSpeed);
  199. var
  200. vDefaultTextureFormat: TGLInternalFormat = tfRGBA8;
  201. vDefaultTextureCompression: TGLInternalCompression = tcNone;
  202. const
  203. cDefaultSwizzleVector: TSwizzleVector = (tswRed, tswGreen, tswBlue, tswAlpha);
  204. // Give a openGL texture format from GLScene texture format
  205. function InternalFormatToOpenGLFormat(intFormat: TGLInternalFormat): Cardinal;
  206. // Give a GLScene texture format from openGL texture format
  207. function OpenGLFormatToInternalFormat(glFormat: Cardinal): TGLInternalFormat;
  208. // Give a pixel size in bytes from texture format or data format
  209. function GetTextureElementSize(intFormat: TGLInternalFormat): Integer; overload;
  210. function GetTextureElementSize(colorFormat: Cardinal; dataType: Cardinal):
  211. Integer; overload;
  212. // Give compatible openGL image format and data type
  213. procedure FindCompatibleDataFormat(intFormat: TGLInternalFormat; out dFormat:
  214. TGLuint; out dType: TGLUint);
  215. (* Give a compressed openGL texture format from GLScene texture format
  216. if format is have not compression than return same openGL format *)
  217. function CompressedInternalFormatToOpenGL(intFormat: TGLInternalFormat):
  218. Integer;
  219. // True if texture target supported
  220. function IsTargetSupported(glTarget: Cardinal): Boolean; overload;
  221. function IsTargetSupported(target: TGLTextureTarget): Boolean; overload;
  222. // True if texture format is supported by hardware or software
  223. function IsFormatSupported(intFormat: TGLInternalFormat): Boolean;
  224. // True if texture format is float
  225. function IsFloatFormat(intFormat: TGLInternalFormat): Boolean; overload;
  226. function IsFloatFormat(glFormat: Cardinal): Boolean; overload;
  227. // True if depth texture
  228. function IsDepthFormat(intFormat: TGLInternalFormat): boolean; overload;
  229. function IsDepthFormat(glFormat: Cardinal): Boolean; overload;
  230. // True if texture compressed
  231. function IsCompressedFormat(intFormat: TGLInternalFormat): Boolean; overload;
  232. function IsCompressedFormat(glFormat: Cardinal): Boolean; overload;
  233. // Give generic compressed OpenGL texture format
  234. function GetGenericCompressedFormat(const intFormat: TGLInternalFormat;
  235. const colorFormat: Cardinal; out internalFormat: Cardinal): Boolean;
  236. // Give uncompressed texture format and OpenGL color format
  237. function GetUncompressedFormat(const intFormat: TGLInternalFormat;
  238. out internalFormat: TGLInternalFormat; out colorFormat: Cardinal): Boolean;
  239. function DecodeTextureTarget(const TextureTarget: TGLTextureTarget): Cardinal;
  240. function EncodeGLTextureTarget(const glTarget: Cardinal): TGLTextureTarget;
  241. function IsTargetSupportMipmap(const TextureTarget: TGLTextureTarget): Boolean; overload;
  242. function IsTargetSupportMipmap(const glTarget: Cardinal): Boolean; overload;
  243. //---------------------------------------------------------------------------
  244. implementation
  245. //---------------------------------------------------------------------------
  246. uses
  247. GLContext;
  248. type
  249. TFormatDesc = record
  250. IntFmt: Cardinal;
  251. ClrFmt: Cardinal;
  252. DataFmt: Cardinal;
  253. RBit: Byte;
  254. GBit: Byte;
  255. BBit: Byte;
  256. ABit: Byte;
  257. LBit: Byte;
  258. DBit: Byte;
  259. Sign: Boolean;
  260. Flt: Boolean;
  261. Fix: Boolean;
  262. Comp: Boolean;
  263. end;
  264. const
  265. // InternalFormat, ColorFormat, DataType
  266. cTextureFormatToOpenGL: array[low(TGLInternalFormat)..high(TGLInternalFormat)] of TFormatDesc =
  267. (
  268. (IntFmt: GL_ALPHA4; ClrFmt: GL_ALPHA; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 4; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  269. (IntFmt: GL_ALPHA8; ClrFmt: GL_ALPHA; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  270. (IntFmt: GL_ALPHA12; ClrFmt: GL_ALPHA; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 12; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  271. (IntFmt: GL_ALPHA16; ClrFmt: GL_ALPHA; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 16; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  272. (IntFmt: GL_DEPTH_COMPONENT16; ClrFmt: GL_DEPTH_COMPONENT; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 16; Sign: False; Flt: False; Fix: False; Comp: False),
  273. (IntFmt: GL_DEPTH_COMPONENT24; ClrFmt: GL_DEPTH_COMPONENT; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 24; Sign: False; Flt: False; Fix: False; Comp: False),
  274. (IntFmt: GL_DEPTH_COMPONENT32; ClrFmt: GL_DEPTH_COMPONENT; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 32; Sign: False; Flt: False; Fix: False; Comp: False),
  275. (IntFmt: GL_LUMINANCE4; ClrFmt: GL_LUMINANCE; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 4; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  276. (IntFmt: GL_LUMINANCE8; ClrFmt: GL_LUMINANCE; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  277. (IntFmt: GL_LUMINANCE12; ClrFmt: GL_LUMINANCE; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 12; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  278. (IntFmt: GL_LUMINANCE16; ClrFmt: GL_LUMINANCE; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 16; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  279. (IntFmt: GL_LUMINANCE4_ALPHA4; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 4; LBit: 4; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  280. (IntFmt: GL_LUMINANCE6_ALPHA2; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 6; LBit: 2; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  281. (IntFmt: GL_LUMINANCE8_ALPHA8; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 8; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  282. (IntFmt: GL_LUMINANCE12_ALPHA4; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 4; LBit: 12; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  283. (IntFmt: GL_LUMINANCE12_ALPHA12; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 12; LBit: 12; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  284. (IntFmt: GL_LUMINANCE16_ALPHA16; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 16; LBit: 16; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  285. (IntFmt: GL_INTENSITY4; ClrFmt: GL_LUMINANCE; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 4; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  286. (IntFmt: GL_INTENSITY8; ClrFmt: GL_LUMINANCE; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  287. (IntFmt: GL_INTENSITY12; ClrFmt: GL_LUMINANCE; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 12; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  288. (IntFmt: GL_INTENSITY16; ClrFmt: GL_LUMINANCE; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 16; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  289. (IntFmt: GL_R3_G3_B2; ClrFmt: GL_RGB; DataFmt: GL_UNSIGNED_BYTE_3_3_2; RBit: 3; GBit: 3; BBit: 2; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  290. (IntFmt: GL_RGB4; ClrFmt: GL_RGB; DataFmt: GL_UNSIGNED_BYTE; RBit: 4; GBit: 4; BBit: 4; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  291. (IntFmt: GL_RGB5; ClrFmt: GL_RGB; DataFmt: GL_UNSIGNED_SHORT_5_6_5; RBit: 5; GBit: 6; BBit: 5; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  292. (IntFmt: GL_RGB8; ClrFmt: GL_RGB; DataFmt: GL_UNSIGNED_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  293. (IntFmt: GL_RGB10; ClrFmt: GL_RGBA; DataFmt: GL_UNSIGNED_INT_10_10_10_2; RBit: 10; GBit: 10; BBit: 10; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  294. (IntFmt: GL_RGB12; ClrFmt: GL_RGB; DataFmt: GL_UNSIGNED_BYTE; RBit: 12; GBit: 12; BBit: 12; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  295. (IntFmt: GL_RGB16; ClrFmt: GL_RGB; DataFmt: GL_UNSIGNED_SHORT; RBit: 16; GBit: 16; BBit: 16; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  296. (IntFmt: GL_RGBA2; ClrFmt: GL_RGBA; DataFmt: GL_UNSIGNED_BYTE; RBit: 2; GBit: 2; BBit: 2; ABit: 2; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  297. (IntFmt: GL_RGBA4; ClrFmt: GL_RGBA; DataFmt: GL_UNSIGNED_SHORT_4_4_4_4; RBit: 4; GBit: 4; BBit: 4; ABit: 4; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  298. (IntFmt: GL_RGB5_A1; ClrFmt: GL_RGBA; DataFmt: GL_UNSIGNED_SHORT_5_5_5_1; RBit: 5; GBit: 5; BBit: 5; ABit: 1; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  299. (IntFmt: GL_RGBA8; ClrFmt: GL_RGBA; DataFmt: GL_UNSIGNED_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 8; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  300. (IntFmt: GL_RGB10_A2; ClrFmt: GL_RGBA; DataFmt: GL_UNSIGNED_INT_10_10_10_2; RBit: 10; GBit: 10; BBit: 10; ABit: 2; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  301. (IntFmt: GL_RGBA12; ClrFmt: GL_RGBA; DataFmt: GL_UNSIGNED_BYTE; RBit: 12; GBit: 12; BBit: 12; ABit: 12; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  302. (IntFmt: GL_RGBA16; ClrFmt: GL_RGBA; DataFmt: GL_UNSIGNED_SHORT; RBit: 16; GBit: 16; BBit: 16; ABit: 16; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  303. (IntFmt: GL_COMPRESSED_RGB_S3TC_DXT1_EXT; ClrFmt: GL_COMPRESSED_RGB_S3TC_DXT1_EXT; DataFmt: GL_COMPRESSED_RGB_S3TC_DXT1_EXT; RBit: 8; GBit: 8; BBit: 8; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  304. (IntFmt: GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; ClrFmt: GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; DataFmt: GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; RBit: 8; GBit: 8; BBit: 8; ABit: 1; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  305. (IntFmt: GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; ClrFmt: GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; DataFmt: GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; RBit: 8; GBit: 8; BBit: 8; ABit: 8; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  306. (IntFmt: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; ClrFmt: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; DataFmt: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; RBit: 8; GBit: 8; BBit: 0; ABit: 8; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  307. (IntFmt: GL_SIGNED_LUMINANCE8_NV; ClrFmt: GL_LUMINANCE; DataFmt: GL_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: False),
  308. (IntFmt: GL_SIGNED_LUMINANCE8_ALPHA8_NV; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 8; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: False),
  309. (IntFmt: GL_SIGNED_RGB8_NV; ClrFmt: GL_RGB; DataFmt: GL_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: False),
  310. (IntFmt: GL_SIGNED_RGBA8_NV; ClrFmt: GL_RGBA; DataFmt: GL_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 8; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: False),
  311. (IntFmt: GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV; ClrFmt: GL_RGBA; DataFmt: GL_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 8; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: False),
  312. (IntFmt: GL_SIGNED_ALPHA8_NV; ClrFmt: GL_ALPHA; DataFmt: GL_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: False),
  313. (IntFmt: GL_SIGNED_INTENSITY8_NV; ClrFmt: GL_INTENSITY; DataFmt: GL_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: False),
  314. (IntFmt: GL_HILO16_NV; ClrFmt: GL_RG; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  315. (IntFmt: GL_SIGNED_HILO16_NV; ClrFmt: GL_RG; DataFmt: GL_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: False),
  316. (IntFmt: GL_DSDT8_NV; ClrFmt: GL_RED; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  317. (IntFmt: GL_DSDT8_MAG8_NV; ClrFmt: GL_RG; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  318. (IntFmt: GL_DSDT8_MAG8_INTENSITY8_NV; ClrFmt: GL_RGB; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  319. (IntFmt: GL_HILO8_NV; ClrFmt: GL_RG; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  320. (IntFmt: GL_SIGNED_HILO8_NV; ClrFmt: GL_RG; DataFmt: GL_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: False),
  321. (IntFmt: GL_FLOAT_R16_NV; ClrFmt: GL_RED; DataFmt: GL_HALF_FLOAT; RBit: 16; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  322. (IntFmt: GL_FLOAT_R32_NV; ClrFmt: GL_RED; DataFmt: GL_FLOAT; RBit: 32; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  323. (IntFmt: GL_FLOAT_RG16_NV; ClrFmt: GL_RG; DataFmt: GL_HALF_FLOAT; RBit: 16; GBit: 16; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  324. (IntFmt: GL_FLOAT_RGB16_NV; ClrFmt: GL_RGB; DataFmt: GL_HALF_FLOAT; RBit: 16; GBit: 16; BBit: 16; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  325. (IntFmt: GL_FLOAT_RGBA16_NV; ClrFmt: GL_RGBA; DataFmt: GL_HALF_FLOAT; RBit: 16; GBit: 16; BBit: 16; ABit: 16; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  326. (IntFmt: GL_FLOAT_RG32_NV; ClrFmt: GL_RG; DataFmt: GL_FLOAT; RBit: 32; GBit: 32; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  327. (IntFmt: GL_FLOAT_RGB32_NV; ClrFmt: GL_RGB; DataFmt: GL_FLOAT; RBit: 32; GBit: 32; BBit: 32; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  328. (IntFmt: GL_FLOAT_RGBA32_NV; ClrFmt: GL_RGBA; DataFmt: GL_FLOAT; RBit: 32; GBit: 32; BBit: 32; ABit: 32; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  329. (IntFmt: GL_RGBA32F_ARB; ClrFmt: GL_RGBA; DataFmt: GL_FLOAT; RBit: 32; GBit: 32; BBit: 32; ABit: 32; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  330. (IntFmt: GL_RGB32F_ARB; ClrFmt: GL_RGB; DataFmt: GL_FLOAT; RBit: 32; GBit: 32; BBit: 32; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  331. (IntFmt: GL_ALPHA32F_ARB; ClrFmt: GL_ALPHA; DataFmt: GL_FLOAT; RBit: 0; GBit: 0; BBit: 0; ABit: 32; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  332. (IntFmt: GL_INTENSITY32F_ARB; ClrFmt: GL_LUMINANCE; DataFmt: GL_FLOAT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 32; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  333. (IntFmt: GL_LUMINANCE32F_ARB; ClrFmt: GL_LUMINANCE; DataFmt: GL_FLOAT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 32; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  334. (IntFmt: GL_LUMINANCE_ALPHA32F_ARB; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_FLOAT; RBit: 0; GBit: 0; BBit: 0; ABit: 32; LBit: 32; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  335. (IntFmt: GL_RGBA16F_ARB; ClrFmt: GL_RGBA; DataFmt: GL_HALF_FLOAT; RBit: 16; GBit: 16; BBit: 16; ABit: 16; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  336. (IntFmt: GL_RGB16F_ARB; ClrFmt: GL_RGB; DataFmt: GL_HALF_FLOAT; RBit: 16; GBit: 16; BBit: 16; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  337. (IntFmt: GL_ALPHA16F_ARB; ClrFmt: GL_ALPHA; DataFmt: GL_HALF_FLOAT; RBit: 0; GBit: 0; BBit: 0; ABit: 16; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  338. (IntFmt: GL_INTENSITY16F_ARB; ClrFmt: GL_LUMINANCE; DataFmt: GL_HALF_FLOAT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 16; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  339. (IntFmt: GL_LUMINANCE16F_ARB; ClrFmt: GL_LUMINANCE; DataFmt: GL_HALF_FLOAT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 16; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  340. (IntFmt: GL_LUMINANCE_ALPHA16F_ARB; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_HALF_FLOAT; RBit: 0; GBit: 0; BBit: 0; ABit: 16; LBit: 16; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  341. (IntFmt: GL_DEPTH24_STENCIL8; ClrFmt: GL_DEPTH_STENCIL; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 24; Sign: False; Flt: False; Fix: False; Comp: False),
  342. (IntFmt: GL_DEPTH_COMPONENT32F; ClrFmt: GL_DEPTH_COMPONENT; DataFmt: GL_FLOAT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 32; Sign: False; Flt: True; Fix: False; Comp: False),
  343. (IntFmt: GL_DEPTH32F_STENCIL8; ClrFmt: GL_DEPTH_STENCIL; DataFmt: GL_FLOAT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 32; Sign: False; Flt: True; Fix: False; Comp: False),
  344. (IntFmt: GL_SRGB8; ClrFmt: GL_RGB; DataFmt: GL_UNSIGNED_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  345. (IntFmt: GL_SRGB8_ALPHA8; ClrFmt: GL_RGBA; DataFmt: GL_UNSIGNED_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 8; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  346. (IntFmt: GL_SLUMINANCE8; ClrFmt: GL_LUMINANCE; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  347. (IntFmt: GL_SLUMINANCE8_ALPHA8; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 8; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  348. (IntFmt: GL_COMPRESSED_SRGB_S3TC_DXT1_EXT; ClrFmt: GL_COMPRESSED_SRGB_S3TC_DXT1_EXT; DataFmt: GL_COMPRESSED_SRGB_S3TC_DXT1_EXT; RBit: 8; GBit: 8; BBit: 8; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  349. (IntFmt: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; ClrFmt: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; DataFmt: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; RBit: 8; GBit: 8; BBit: 8; ABit: 1; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  350. (IntFmt: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; ClrFmt: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; DataFmt: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; RBit: 8; GBit: 8; BBit: 8; ABit: 8; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  351. (IntFmt: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; ClrFmt: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; DataFmt: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; RBit: 8; GBit: 8; BBit: 8; ABit: 8; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  352. (IntFmt: GL_RGB9_E5; ClrFmt: GL_RGBA; DataFmt: GL_FLOAT; RBit: 8; GBit: 8; BBit: 8; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  353. (IntFmt: GL_R11F_G11F_B10F; ClrFmt: GL_RGB; DataFmt: GL_FLOAT; RBit: 11; GBit: 11; BBit: 10; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  354. (IntFmt: GL_COMPRESSED_LUMINANCE_LATC1_EXT; ClrFmt: GL_COMPRESSED_LUMINANCE_LATC1_EXT; DataFmt: GL_COMPRESSED_LUMINANCE_LATC1_EXT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  355. (IntFmt: GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT; ClrFmt: GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT; DataFmt: GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: True),
  356. (IntFmt: GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT; ClrFmt: GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT; DataFmt: GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 8; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  357. (IntFmt: GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT; ClrFmt: GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT; DataFmt: GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 8; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: True),
  358. (IntFmt: GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI; ClrFmt: GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI; DataFmt: GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 8; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  359. (IntFmt: GL_RGBA32UI; ClrFmt: GL_RGBA_INTEGER; DataFmt: GL_UNSIGNED_INT; RBit: 32; GBit: 32; BBit: 32; ABit: 32; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  360. (IntFmt: GL_RGB32UI; ClrFmt: GL_RGB_INTEGER; DataFmt: GL_UNSIGNED_INT; RBit: 32; GBit: 32; BBit: 32; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  361. (IntFmt: GL_ALPHA32UI_EXT; ClrFmt: GL_ALPHA_INTEGER; DataFmt: GL_UNSIGNED_INT; RBit: 0; GBit: 0; BBit: 0; ABit: 32; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  362. (IntFmt: GL_INTENSITY32UI_EXT; ClrFmt: GL_LUMINANCE_INTEGER_EXT; DataFmt: GL_UNSIGNED_INT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 32; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  363. (IntFmt: GL_LUMINANCE32UI_EXT; ClrFmt: GL_LUMINANCE_INTEGER_EXT; DataFmt: GL_UNSIGNED_INT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 32; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  364. (IntFmt: GL_LUMINANCE_ALPHA32UI_EXT; ClrFmt: GL_LUMINANCE_ALPHA_INTEGER_EXT; DataFmt: GL_UNSIGNED_INT; RBit: 0; GBit: 0; BBit: 0; ABit: 32; LBit: 32; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  365. (IntFmt: GL_RGBA16UI; ClrFmt: GL_RGBA_INTEGER; DataFmt: GL_UNSIGNED_SHORT; RBit: 16; GBit: 16; BBit: 16; ABit: 16; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  366. (IntFmt: GL_RGB16UI; ClrFmt: GL_RGB_INTEGER; DataFmt: GL_UNSIGNED_SHORT; RBit: 16; GBit: 16; BBit: 16; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  367. (IntFmt: GL_ALPHA16UI_EXT; ClrFmt: GL_ALPHA_INTEGER; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 16; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  368. (IntFmt: GL_INTENSITY16UI_EXT; ClrFmt: GL_LUMINANCE_INTEGER_EXT; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 16; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  369. (IntFmt: GL_LUMINANCE16UI_EXT; ClrFmt: GL_LUMINANCE_INTEGER_EXT; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 16; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  370. (IntFmt: GL_LUMINANCE_ALPHA16UI_EXT; ClrFmt: GL_LUMINANCE_ALPHA_INTEGER_EXT; DataFmt: GL_UNSIGNED_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 16; LBit: 16; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  371. (IntFmt: GL_RGBA8UI; ClrFmt: GL_RGBA_INTEGER; DataFmt: GL_UNSIGNED_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 8; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  372. (IntFmt: GL_RGB8UI; ClrFmt: GL_RGB_INTEGER; DataFmt: GL_UNSIGNED_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  373. (IntFmt: GL_ALPHA8UI_EXT; ClrFmt: GL_ALPHA_INTEGER; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  374. (IntFmt: GL_INTENSITY8UI_EXT; ClrFmt: GL_LUMINANCE_INTEGER_EXT; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  375. (IntFmt: GL_LUMINANCE8UI_EXT; ClrFmt: GL_LUMINANCE_INTEGER_EXT; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  376. (IntFmt: GL_LUMINANCE_ALPHA8UI_EXT; ClrFmt: GL_LUMINANCE_ALPHA_INTEGER_EXT; DataFmt: GL_UNSIGNED_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 8; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  377. (IntFmt: GL_RGBA32I; ClrFmt: GL_RGBA_INTEGER; DataFmt: GL_INT; RBit: 32; GBit: 32; BBit: 32; ABit: 32; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  378. (IntFmt: GL_RGB32I; ClrFmt: GL_RGB_INTEGER; DataFmt: GL_INT; RBit: 32; GBit: 32; BBit: 32; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  379. (IntFmt: GL_ALPHA32I_EXT; ClrFmt: GL_ALPHA_INTEGER; DataFmt: GL_INT; RBit: 0; GBit: 0; BBit: 0; ABit: 32; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  380. (IntFmt: GL_INTENSITY32I_EXT; ClrFmt: GL_LUMINANCE_INTEGER_EXT; DataFmt: GL_INT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 32; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  381. (IntFmt: GL_LUMINANCE32I_EXT; ClrFmt: GL_LUMINANCE_INTEGER_EXT; DataFmt: GL_INT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 32; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  382. (IntFmt: GL_LUMINANCE_ALPHA32I_EXT; ClrFmt: GL_LUMINANCE_ALPHA_INTEGER_EXT; DataFmt: GL_INT; RBit: 0; GBit: 0; BBit: 0; ABit: 32; LBit: 32; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  383. (IntFmt: GL_RGBA16I; ClrFmt: GL_RGBA_INTEGER; DataFmt: GL_SHORT; RBit: 16; GBit: 16; BBit: 16; ABit: 16; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  384. (IntFmt: GL_RGB16I; ClrFmt: GL_RGB_INTEGER; DataFmt: GL_SHORT; RBit: 16; GBit: 16; BBit: 16; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  385. (IntFmt: GL_ALPHA16I_EXT; ClrFmt: GL_ALPHA_INTEGER; DataFmt: GL_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 16; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  386. (IntFmt: GL_INTENSITY16I_EXT; ClrFmt: GL_LUMINANCE_INTEGER_EXT; DataFmt: GL_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 16; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  387. (IntFmt: GL_LUMINANCE16I_EXT; ClrFmt: GL_LUMINANCE_INTEGER_EXT; DataFmt: GL_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 16; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  388. (IntFmt: GL_LUMINANCE_ALPHA16I_EXT; ClrFmt: GL_LUMINANCE_ALPHA_INTEGER_EXT; DataFmt: GL_SHORT; RBit: 0; GBit: 0; BBit: 0; ABit: 16; LBit: 16; DBit: 0; Sign: True; Flt: True; Fix: False; Comp: False),
  389. (IntFmt: GL_RGBA8I; ClrFmt: GL_RGBA_INTEGER; DataFmt: GL_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 8; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  390. (IntFmt: GL_RGB8I; ClrFmt: GL_RGB_INTEGER; DataFmt: GL_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  391. (IntFmt: GL_ALPHA8I_EXT; ClrFmt: GL_ALPHA_INTEGER; DataFmt: GL_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  392. (IntFmt: GL_INTENSITY8I_EXT; ClrFmt: GL_INTENSITY; DataFmt: GL_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  393. (IntFmt: GL_LUMINANCE8I_EXT; ClrFmt: GL_LUMINANCE; DataFmt: GL_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 0; LBit: 8; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  394. (IntFmt: GL_LUMINANCE_ALPHA8I_EXT; ClrFmt: GL_LUMINANCE_ALPHA; DataFmt: GL_BYTE; RBit: 0; GBit: 0; BBit: 0; ABit: 8; LBit: 8; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  395. (IntFmt: GL_RG32UI; ClrFmt: GL_RG; DataFmt: GL_UNSIGNED_INT; RBit: 8; GBit: 8; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  396. (IntFmt: GL_R32UI; ClrFmt: GL_RED_INTEGER; DataFmt: GL_UNSIGNED_INT; RBit: 8; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  397. (IntFmt: GL_RG16UI; ClrFmt: GL_RG; DataFmt: GL_UNSIGNED_SHORT; RBit: 16; GBit: 16; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  398. (IntFmt: GL_R16UI; ClrFmt: GL_RED_INTEGER; DataFmt: GL_UNSIGNED_SHORT; RBit: 16; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  399. (IntFmt: GL_RG8UI; ClrFmt: GL_RG; DataFmt: GL_UNSIGNED_BYTE; RBit: 8; GBit: 8; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: True; Comp: False),
  400. (IntFmt: GL_R8UI; ClrFmt: GL_RED_INTEGER; DataFmt: GL_UNSIGNED_BYTE; RBit: 8; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  401. (IntFmt: GL_RG32I; ClrFmt: GL_RG; DataFmt: GL_INT; RBit: 32; GBit: 32; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  402. (IntFmt: GL_R32I; ClrFmt: GL_RED_INTEGER; DataFmt: GL_INT; RBit: 16; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  403. (IntFmt: GL_RG16I; ClrFmt: GL_RG; DataFmt: GL_SHORT; RBit: 16; GBit: 16; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  404. (IntFmt: GL_R16I; ClrFmt: GL_RED_INTEGER; DataFmt: GL_SHORT; RBit: 16; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  405. (IntFmt: GL_RG8I; ClrFmt: GL_RG; DataFmt: GL_BYTE; RBit: 8; GBit: 8; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  406. (IntFmt: GL_R8I; ClrFmt: GL_RED_INTEGER; DataFmt: GL_BYTE; RBit: 8; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: True; Comp: False),
  407. (IntFmt: GL_RG8; ClrFmt: GL_RG; DataFmt: GL_BYTE; RBit: 8; GBit: 8; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  408. (IntFmt: GL_R8; ClrFmt: GL_RED; DataFmt: GL_BYTE; RBit: 8; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  409. (IntFmt: GL_RG16; ClrFmt: GL_RG; DataFmt: GL_SHORT; RBit: 16; GBit: 16; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  410. (IntFmt: GL_R16; ClrFmt: GL_RED; DataFmt: GL_SHORT; RBit: 16; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  411. (IntFmt: GL_RG16F; ClrFmt: GL_RG; DataFmt: GL_HALF_FLOAT; RBit: 16; GBit: 16; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  412. (IntFmt: GL_R16F; ClrFmt: GL_RED; DataFmt: GL_HALF_FLOAT; RBit: 16; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  413. (IntFmt: GL_RG32F; ClrFmt: GL_RG; DataFmt: GL_FLOAT; RBit: 32; GBit: 32; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  414. (IntFmt: GL_R32F; ClrFmt: GL_LUMINANCE; DataFmt: GL_FLOAT; RBit: 32; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: True; Fix: False; Comp: False),
  415. (IntFmt: GL_COMPRESSED_RED_RGTC1; ClrFmt: GL_COMPRESSED_RED_RGTC1; DataFmt: GL_COMPRESSED_RED_RGTC1; RBit: 8; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  416. (IntFmt: GL_COMPRESSED_SIGNED_RED_RGTC1; ClrFmt: GL_COMPRESSED_SIGNED_RED_RGTC1; DataFmt: GL_COMPRESSED_SIGNED_RED_RGTC1; RBit: 8; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: True),
  417. (IntFmt: GL_COMPRESSED_RG_RGTC2; ClrFmt: GL_COMPRESSED_RG_RGTC2; DataFmt: GL_COMPRESSED_RG_RGTC2; RBit: 8; GBit: 8; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: True),
  418. (IntFmt: GL_COMPRESSED_SIGNED_RG_RGTC2; ClrFmt: GL_COMPRESSED_SIGNED_RG_RGTC2; DataFmt: GL_COMPRESSED_SIGNED_RG_RGTC2; RBit: 8; GBit: 8; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: True; Flt: False; Fix: False; Comp: True),
  419. (IntFmt: GL_R8_SNORM; ClrFmt: GL_R; DataFmt: GL_BYTE; RBit: 8; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  420. (IntFmt: GL_RG8_SNORM; ClrFmt: GL_RG; DataFmt: GL_BYTE; RBit: 8; GBit: 8; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  421. (IntFmt: GL_RGB8_SNORM; ClrFmt: GL_RGB; DataFmt: GL_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  422. (IntFmt: GL_RGBA8_SNORM; ClrFmt: GL_RGBA; DataFmt: GL_BYTE; RBit: 8; GBit: 8; BBit: 8; ABit: 8; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  423. (IntFmt: GL_R16_SNORM; ClrFmt: GL_R; DataFmt: GL_SHORT; RBit: 16; GBit: 0; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  424. (IntFmt: GL_RG16_SNORM; ClrFmt: GL_RG; DataFmt: GL_SHORT; RBit: 16; GBit: 16; BBit: 0; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  425. (IntFmt: GL_RGB16_SNORM; ClrFmt: GL_RGB; DataFmt: GL_SHORT; RBit: 16; GBit: 16; BBit: 16; ABit: 0; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False),
  426. (IntFmt: GL_RGBA16_SNORM; ClrFmt: GL_RGBA; DataFmt: GL_SHORT; RBit: 16; GBit: 16; BBit: 16; ABit: 16; LBit: 0; DBit: 0; Sign: False; Flt: False; Fix: False; Comp: False)
  427. );
  428. function InternalFormatToOpenGLFormat(intFormat: TGLInternalFormat): Cardinal;
  429. begin
  430. Result := cTextureFormatToOpenGL[intFormat].IntFmt;
  431. end;
  432. function OpenGLFormatToInternalFormat(glFormat: Cardinal): TGLInternalFormat;
  433. var
  434. i: TGLInternalFormat;
  435. begin
  436. Result := tfRGBA8;
  437. for i := Low(cTextureFormatToOpenGL) to High(cTextureFormatToOpenGL) do
  438. if glFormat = cTextureFormatToOpenGL[i].IntFmt then
  439. begin
  440. Result := i;
  441. Exit;
  442. end;
  443. Assert(false);
  444. end;
  445. function GetTextureElementSize(intFormat: TGLInternalFormat): Integer;
  446. begin
  447. Result := GetTextureElementSize(
  448. cTextureFormatToOpenGL[intFormat].ClrFmt,
  449. cTextureFormatToOpenGL[intFormat].DataFmt);
  450. end;
  451. function GetTextureElementSize(colorFormat: Cardinal; dataType: Cardinal):
  452. Integer;
  453. var
  454. components: Byte;
  455. begin
  456. case colorFormat of
  457. GL_RGB, GL_BGR: components := 3;
  458. GL_RGBA, GL_BGRA: components := 4;
  459. GL_ALPHA: components := 1;
  460. GL_LUMINANCE: components := 1;
  461. GL_LUMINANCE_ALPHA: components := 2;
  462. GL_INTENSITY: components := 1;
  463. GL_RED: components := 1;
  464. GL_GREEN: components := 1;
  465. GL_BLUE: components := 1;
  466. GL_RG: components := 2;
  467. GL_RGB_INTEGER: components := 3;
  468. GL_RGBA_INTEGER: components := 4;
  469. GL_ALPHA_INTEGER: components := 1;
  470. GL_LUMINANCE_INTEGER_EXT: components := 1;
  471. GL_LUMINANCE_ALPHA_INTEGER_EXT: components := 2;
  472. GL_RED_INTEGER: components := 1;
  473. GL_RG_INTEGER: components := 2;
  474. else
  475. components := 1;
  476. end;
  477. case dataType of
  478. GL_BITMAP,
  479. GL_UNSIGNED_BYTE,
  480. GL_BYTE: Result := components;
  481. GL_UNSIGNED_BYTE_3_3_2,
  482. GL_UNSIGNED_BYTE_2_3_3_REV: Result := 1;
  483. GL_UNSIGNED_SHORT,
  484. GL_SHORT: Result := components * 2;
  485. GL_UNSIGNED_SHORT_4_4_4_4,
  486. GL_UNSIGNED_SHORT_4_4_4_4_REV,
  487. GL_UNSIGNED_SHORT_5_6_5,
  488. GL_UNSIGNED_SHORT_5_6_5_REV,
  489. GL_UNSIGNED_SHORT_5_5_5_1,
  490. GL_UNSIGNED_SHORT_1_5_5_5_REV: Result := 2;
  491. GL_UNSIGNED_INT,
  492. GL_INT: Result := components * 4;
  493. GL_UNSIGNED_INT_8_8_8_8,
  494. GL_UNSIGNED_INT_8_8_8_8_REV,
  495. GL_UNSIGNED_INT_10_10_10_2,
  496. GL_UNSIGNED_INT_2_10_10_10_REV: Result := 4;
  497. GL_FLOAT: Result := components * 4;
  498. GL_HALF_FLOAT: Result := components * 2;
  499. GL_COMPRESSED_RGB_S3TC_DXT1_EXT: Result := 8;
  500. GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: Result := 8;
  501. GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: Result := 16;
  502. GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: Result := 16;
  503. GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: Result := 8;
  504. GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: Result := 8;
  505. GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: Result := 16;
  506. GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: Result := 16;
  507. GL_COMPRESSED_LUMINANCE_LATC1_EXT: Result := 8;
  508. GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT: Result := 8;
  509. GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT: Result := 16;
  510. GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT: Result := 16;
  511. GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI: Result := 16;
  512. GL_COMPRESSED_RED_RGTC1: Result := 8;
  513. GL_COMPRESSED_SIGNED_RED_RGTC1: Result := 8;
  514. GL_COMPRESSED_RG_RGTC2: Result := 16;
  515. GL_COMPRESSED_SIGNED_RG_RGTC2: Result := 16;
  516. else
  517. Result := 1;
  518. end;
  519. end;
  520. function CompressedInternalFormatToOpenGL(intFormat: TGLInternalFormat):
  521. Integer;
  522. begin
  523. Result := GL_COMPRESSED_RGBA;
  524. case intFormat of
  525. tfRGB8: Result := GL_COMPRESSED_RGB;
  526. tfRGBA8: Result := GL_COMPRESSED_RGBA;
  527. tfRGB5: Result := GL_COMPRESSED_RGB;
  528. tfRGBA4: Result := GL_COMPRESSED_RGBA;
  529. tfALPHA8: Result := GL_COMPRESSED_ALPHA;
  530. tfLUMINANCE8: Result := GL_COMPRESSED_LUMINANCE;
  531. tfLUMINANCE8_ALPHA8: Result := GL_COMPRESSED_LUMINANCE_ALPHA;
  532. tfINTENSITY8: Result := GL_COMPRESSED_INTENSITY;
  533. else
  534. Assert(false);
  535. end;
  536. end;
  537. procedure FindCompatibleDataFormat(intFormat: TGLInternalFormat; out dFormat:
  538. Cardinal; out dType: Cardinal);
  539. begin
  540. dFormat := cTextureFormatToOpenGL[intFormat].ClrFmt;
  541. dType := cTextureFormatToOpenGL[intFormat].DataFmt;
  542. end;
  543. function IsTargetSupported(target: TGLTextureTarget): Boolean;
  544. begin
  545. Result := IsTargetSupported(DecodeTextureTarget(target));
  546. end;
  547. function IsTargetSupported(glTarget: Cardinal): Boolean;
  548. begin
  549. case glTarget of
  550. GL_TEXTURE_1D: Result := GL.VERSION_1_1 or GL.EXT_texture_object;
  551. GL_TEXTURE_2D: Result := GL.VERSION_1_1 or GL.EXT_texture_object;
  552. GL_TEXTURE_3D: Result := GL.EXT_texture3D;
  553. GL_TEXTURE_RECTANGLE: Result := GL.ARB_texture_rectangle;
  554. GL_TEXTURE_CUBE_MAP,
  555. GL_TEXTURE_CUBE_MAP_POSITIVE_X,
  556. GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
  557. GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
  558. GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
  559. GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
  560. GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: Result := GL.ARB_texture_cube_map;
  561. GL_TEXTURE_1D_ARRAY: Result := GL.EXT_texture_array;
  562. GL_TEXTURE_2D_ARRAY: Result := GL.EXT_texture_array;
  563. GL_TEXTURE_CUBE_MAP_ARRAY: Result := GL.ARB_texture_cube_map_array;
  564. GL_TEXTURE_BUFFER: Result := GL.ARB_texture_buffer_object;
  565. GL_TEXTURE_2D_MULTISAMPLE,
  566. GL_TEXTURE_2D_MULTISAMPLE_ARRAY: Result := GL.ARB_texture_multisample;
  567. else
  568. begin
  569. Result := false;
  570. Assert(False, strErrorEx + strUnknownType);
  571. end;
  572. end;
  573. end;
  574. function IsFormatSupported(intFormat: TGLInternalFormat): Boolean;
  575. begin
  576. Result := false;
  577. if ((intFormat >= tfALPHA4) and (intFormat <= tfALPHA16)) or
  578. ((intFormat >= tfLUMINANCE4) and (intFormat <= tfR16G16B16A16)) then
  579. begin
  580. Result := GL.VERSION_1_1;
  581. EXIT;
  582. end;
  583. if ((intFormat >= tfDEPTH_COMPONENT16) and (intFormat <= tfDEPTH_COMPONENT32)) then
  584. begin
  585. Result := GL.ARB_depth_texture;
  586. EXIT;
  587. end;
  588. if ((intFormat >= tfCOMPRESSED_RGB_S3TC_DXT1) and (intFormat <=
  589. tfCOMPRESSED_RGBA_S3TC_DXT5)) then
  590. begin
  591. Result := GL.EXT_texture_compression_s3tc;
  592. EXIT;
  593. end;
  594. if ((intFormat >= tfSIGNED_LUMINANCE8) and (intFormat <=
  595. tfDSDT8_MAG8_INTENSITY8)) then
  596. begin
  597. Result := GL.NV_texture_shader;
  598. EXIT;
  599. end;
  600. if ((intFormat = tfHILO8) or (intFormat = tfSIGNED_HILO8)) then
  601. begin
  602. Result := GL.NV_texture_shader3;
  603. EXIT;
  604. end;
  605. if ((intFormat >= tfFLOAT_R16) and (intFormat <= tfFLOAT_RGBA32)) then
  606. begin
  607. Result := GL.NV_float_buffer;
  608. EXIT;
  609. end;
  610. if ((intFormat >= tfRGBA_FLOAT32)
  611. and (intFormat <= tfLUMINANCE_ALPHA_FLOAT16)) then
  612. begin
  613. Result := GL.ARB_texture_float or GL.ATI_texture_float;
  614. EXIT;
  615. end;
  616. if intFormat = tfDEPTH24_STENCIL8 then
  617. begin
  618. Result := GL.EXT_packed_depth_stencil;
  619. EXIT;
  620. end;
  621. if ((intFormat = tfDEPTH_COMPONENT32F) or (intFormat = tfDEPTH32F_STENCIL8)) then
  622. begin
  623. Result := GL.NV_depth_buffer_float;
  624. EXIT;
  625. end;
  626. if ((intFormat >= tfSRGB8) and (intFormat <=
  627. tfCOMPRESSED_SRGB_ALPHA_S3TC_DXT5)) then
  628. begin
  629. Result := GL.EXT_texture_sRGB;
  630. EXIT;
  631. end;
  632. if intFormat = tfRGB9_E5 then
  633. begin
  634. Result := GL.EXT_texture_shared_exponent;
  635. EXIT;
  636. end;
  637. if intFormat = tfR11F_G11F_B10F then
  638. begin
  639. Result := GL.EXT_packed_float;
  640. EXIT;
  641. end;
  642. if ((intFormat >= tfCOMPRESSED_LUMINANCE_LATC1) and (intFormat <=
  643. tfCOMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2)) then
  644. begin
  645. Result := GL.EXT_texture_compression_latc;
  646. EXIT;
  647. end;
  648. if intFormat = tfCOMPRESSED_LUMINANCE_ALPHA_3DC then
  649. begin
  650. Result := GL.ATI_texture_compression_3dc;
  651. EXIT;
  652. end;
  653. if ((intFormat >= tfRGBA32UI) and (intFormat <= tfLUMINANCE_ALPHA8I)) then
  654. begin
  655. Result := GL.EXT_texture_integer;
  656. EXIT;
  657. end;
  658. if ((intFormat >= tfRG32UI) and (intFormat <= tfR32F)) then
  659. Result := GL.ARB_texture_rg;
  660. if ((intFormat >= tfCOMPRESSED_RED_RGTC1) and (intFormat <=
  661. tfCOMPRESSED_SIGNED_RG_RGTC2)) then
  662. begin
  663. Result := GL.ARB_texture_compression_rgtc;
  664. EXIT;
  665. end;
  666. if ((intFormat >= tfR8_SNORM) and (intFormat <= tfRGBA16_SNORM)) then
  667. begin
  668. Result := GL.VERSION_3_1;
  669. EXIT;
  670. end
  671. end;
  672. function IsFloatFormat(intFormat: TGLInternalFormat): boolean;
  673. begin
  674. Result := cTextureFormatToOpenGL[intFormat].Flt;
  675. end;
  676. function IsFloatFormat(glFormat: Cardinal): boolean;
  677. begin
  678. Result := IsFloatFormat(OpenGLFormatToInternalFormat(glFormat));
  679. end;
  680. function IsDepthFormat(intFormat: TGLInternalFormat): boolean;
  681. begin
  682. Result := cTextureFormatToOpenGL[intFormat].DBit > 0;
  683. end;
  684. function IsDepthFormat(glFormat: Cardinal): boolean;
  685. begin
  686. Result := cTextureFormatToOpenGL[OpenGLFormatToInternalFormat(glFormat)].DBit > 0;
  687. end;
  688. function IsCompressedFormat(intFormat: TGLInternalFormat): boolean;
  689. begin
  690. Result := cTextureFormatToOpenGL[intFormat].Comp;
  691. end;
  692. function IsCompressedFormat(glFormat: Cardinal): boolean;
  693. begin
  694. Result := cTextureFormatToOpenGL[OpenGLFormatToInternalFormat(glFormat)].Comp;
  695. end;
  696. function GetGenericCompressedFormat(const intFormat: TGLInternalFormat;
  697. const colorFormat: Cardinal; out internalFormat: Cardinal): Boolean;
  698. begin
  699. Result := false;
  700. if IsCompressedFormat(intFormat) then
  701. Exit;
  702. if not IsFormatSupported(intFormat) then
  703. Exit;
  704. internalFormat := 0;
  705. if ((intFormat >= tfSRGB8) and (intFormat <=
  706. tfCOMPRESSED_SRGB_ALPHA_S3TC_DXT5)) then
  707. case colorFormat of
  708. GL_RGB: internalFormat := GL_COMPRESSED_SRGB;
  709. GL_RGBA: internalFormat := GL_COMPRESSED_SRGB_ALPHA;
  710. GL_LUMINANCE: internalFormat := GL_COMPRESSED_SLUMINANCE;
  711. GL_LUMINANCE_ALPHA: internalFormat := GL_COMPRESSED_SLUMINANCE_ALPHA;
  712. end
  713. else
  714. case colorFormat of
  715. GL_RGB, GL_BGR: internalFormat := GL_COMPRESSED_RGB;
  716. GL_RGBA, GL_BGRA: internalFormat := GL_COMPRESSED_RGBA;
  717. GL_ALPHA: internalFormat := GL_COMPRESSED_ALPHA;
  718. GL_LUMINANCE: internalFormat := GL_COMPRESSED_LUMINANCE;
  719. GL_LUMINANCE_ALPHA: internalFormat := GL_COMPRESSED_LUMINANCE_ALPHA;
  720. GL_INTENSITY: internalFormat := GL_COMPRESSED_INTENSITY;
  721. GL_RED: internalFormat := GL_COMPRESSED_RED;
  722. GL_RG: internalFormat := GL_COMPRESSED_RG;
  723. end;
  724. if internalFormat = 0 then
  725. Exit;
  726. Result := true;
  727. end;
  728. function GetUncompressedFormat(const intFormat: TGLInternalFormat;
  729. out internalFormat: TGLInternalFormat; out colorFormat: Cardinal): Boolean;
  730. begin
  731. Result := false;
  732. if not IsCompressedFormat(intFormat) then
  733. Exit;
  734. if not IsFormatSupported(intFormat) then
  735. Exit;
  736. colorFormat := 0;
  737. case intFormat of
  738. tfCOMPRESSED_RGB_S3TC_DXT1:
  739. begin
  740. colorFormat := GL_RGB;
  741. internalFormat := tfRGB8;
  742. end;
  743. tfCOMPRESSED_RGBA_S3TC_DXT1:
  744. begin
  745. colorFormat := GL_RGBA;
  746. internalFormat := tfRGBA8;
  747. end;
  748. tfCOMPRESSED_RGBA_S3TC_DXT3:
  749. begin
  750. colorFormat := GL_RGBA;
  751. internalFormat := tfRGBA8;
  752. end;
  753. tfCOMPRESSED_RGBA_S3TC_DXT5:
  754. begin
  755. colorFormat := GL_RGBA;
  756. internalFormat := tfRGBA8;
  757. end;
  758. tfCOMPRESSED_SRGB_S3TC_DXT1:
  759. begin
  760. colorFormat := GL_RGBA;
  761. internalFormat := tfSRGB8;
  762. end;
  763. tfCOMPRESSED_SRGB_ALPHA_S3TC_DXT1:
  764. begin
  765. colorFormat := GL_RGBA;
  766. internalFormat := tfSRGB8_ALPHA8;
  767. end;
  768. tfCOMPRESSED_SRGB_ALPHA_S3TC_DXT3:
  769. begin
  770. colorFormat := GL_RGBA;
  771. internalFormat := tfSRGB8_ALPHA8;
  772. end;
  773. tfCOMPRESSED_SRGB_ALPHA_S3TC_DXT5:
  774. begin
  775. colorFormat := GL_RGBA;
  776. internalFormat := tfSRGB8_ALPHA8;
  777. end;
  778. tfCOMPRESSED_LUMINANCE_LATC1:
  779. begin
  780. colorFormat := GL_LUMINANCE;
  781. internalFormat := tfLUMINANCE8;
  782. end;
  783. tfCOMPRESSED_SIGNED_LUMINANCE_LATC1:
  784. begin
  785. colorFormat := GL_LUMINANCE;
  786. internalFormat := tfSIGNED_LUMINANCE8;
  787. end;
  788. tfCOMPRESSED_LUMINANCE_ALPHA_LATC2:
  789. begin
  790. colorFormat := GL_LUMINANCE_ALPHA;
  791. internalFormat := tfLUMINANCE8_ALPHA8;
  792. end;
  793. tfCOMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2:
  794. begin
  795. colorFormat := GL_LUMINANCE_ALPHA;
  796. internalFormat := tfSIGNED_LUMINANCE8_ALPHA8;
  797. end;
  798. tfCOMPRESSED_LUMINANCE_ALPHA_3DC:
  799. begin
  800. colorFormat := GL_LUMINANCE_ALPHA;
  801. internalFormat := tfLUMINANCE8_ALPHA8;
  802. end;
  803. tfCOMPRESSED_RED_RGTC1:
  804. begin
  805. colorFormat := GL_RED;
  806. internalFormat := tfR8;
  807. end;
  808. tfCOMPRESSED_SIGNED_RED_RGTC1:
  809. begin
  810. colorFormat := GL_RED;
  811. internalFormat := tfR8;
  812. end;
  813. tfCOMPRESSED_RG_RGTC2:
  814. begin
  815. colorFormat := GL_RG;
  816. internalFormat := tfRG8;
  817. end;
  818. tfCOMPRESSED_SIGNED_RG_RGTC2:
  819. begin
  820. colorFormat := GL_RG;
  821. internalFormat := tfRG8;
  822. end;
  823. end;
  824. Result := colorFormat <> 0;
  825. end;
  826. function DecodeTextureTarget(const TextureTarget: TGLTextureTarget): Cardinal;
  827. const
  828. cTargetToEnum: array[TGLTextureTarget] of Cardinal =
  829. (
  830. 0,
  831. GL_TEXTURE_1D,
  832. GL_TEXTURE_2D,
  833. GL_TEXTURE_3D,
  834. GL_TEXTURE_1D_ARRAY,
  835. GL_TEXTURE_2D_ARRAY,
  836. GL_TEXTURE_RECTANGLE,
  837. GL_TEXTURE_BUFFER,
  838. GL_TEXTURE_CUBE_MAP,
  839. GL_TEXTURE_2D_MULTISAMPLE,
  840. GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
  841. GL_TEXTURE_CUBE_MAP_ARRAY
  842. );
  843. begin
  844. Assert(TextureTarget <> ttNoShape);
  845. Result := cTargetToEnum[TextureTarget];
  846. end;
  847. function EncodeGLTextureTarget(const glTarget: Cardinal): TGLTextureTarget;
  848. begin
  849. case glTarget of
  850. GL_TEXTURE_1D: Result := ttTexture1d;
  851. GL_TEXTURE_2D: Result := ttTexture2d;
  852. GL_TEXTURE_3D: Result := ttTexture3d;
  853. GL_TEXTURE_RECTANGLE: Result := ttTextureRect;
  854. GL_TEXTURE_CUBE_MAP: Result := ttTextureCube;
  855. GL_TEXTURE_1D_ARRAY: Result := ttTexture1dArray;
  856. GL_TEXTURE_2D_ARRAY: Result := ttTexture2dArray;
  857. GL_TEXTURE_CUBE_MAP_ARRAY: Result := ttTextureCubeArray;
  858. GL_TEXTURE_2D_MULTISAMPLE: Result := ttTexture2DMultisample;
  859. GL_TEXTURE_2D_MULTISAMPLE_ARRAY: Result := ttTexture2DMultisampleArray;
  860. else
  861. begin
  862. Result := ttTexture2d;
  863. Assert(False, strErrorEx + strUnknownType);
  864. end;
  865. end;
  866. end;
  867. function IsTargetSupportMipmap(const TextureTarget: TGLTextureTarget): Boolean;
  868. begin
  869. Result := (TextureTarget <> ttTextureRect)
  870. and (TextureTarget <> ttTexture2DMultisample)
  871. and (TextureTarget <> ttTexture2DMultisampleArray);
  872. end;
  873. function IsTargetSupportMipmap(const glTarget: Cardinal): Boolean;
  874. begin
  875. Result := (glTarget <> GL_TEXTURE_RECTANGLE)
  876. and (glTarget <> GL_TEXTURE_2D_MULTISAMPLE)
  877. and (glTarget <> GL_TEXTURE_2D_MULTISAMPLE_ARRAY);
  878. end;
  879. end.