Debian Codegraph @

src/external/rltexgpu.h

raw symbols SCIP
1 /**********************************************************************************************
2 *
3 * rltexgpu v1.2 - GPU compressed textures loading and saving
4 *
5 * DESCRIPTION:
6 *
7 * Load GPU compressed image data from image files provided as memory data arrays,
8 * data is loaded compressed, ready to be loaded into GPU
9 *
10 * Note that some file formats (DDS, PVR, KTX) also support uncompressed data storage.
11 * In those cases data is loaded uncompressed and format is returned
12 *
13 * FIXME: This library still depends on raylib due to the following reasons:
14 * - rl_save_ktx_to_memory() requires rlGetGlTextureFormats() from rlgl.h
15 *
16 * TODO:
17 * - Review rl_load_ktx_from_memory() to support KTX v2.2 specs
18 *
19 * CONFIGURATION:
20 *
21 * #define RLTEXGPU_SUPPORT_DDS
22 * #define RLTEXGPU_SUPPORT_PKM
23 * #define RLTEXGPU_SUPPORT_KTX
24 * #define RLTEXGPU_SUPPORT_PVR
25 * #define RLTEXGPU_SUPPORT_ASTC
26 * Define desired file formats to be supported
27 *
28 * #define RLTEXGPU_SHOW_LOG_INFO
29 * Define, if you wish to see warnings generated by the library
30 * This will include <stdio.h> unless you provide your own RLTEXGPU_LOG
31 * #define RLTEXGPU_LOG
32 * Define, if you wish to provide your own warning function
33 * Make sure that this macro puts newline character '\n' at the end
34 *
35 * #define RLTEXGPU_MALLOC
36 * #define RLTEXGPU_FREE
37 * Define those macros in order to provide your own libc-compliant allocator;
38 * not doing so will include <stdlib.h>
39 * If you're providing any of those, you must provide ALL of them,
40 * otherwise the code will (most likely) crash...
41 *
42 * #define RLTEXGPU_NULL
43 * Define in order to provide your own libc-compliant NULL pointer;
44 * not doing so will include <stdlib.h>
45 *
46 * #define RLTEXGPU_MEMCPY
47 * Define in order to provide your own libc-compliant 'memcpy' function;
48 * not doing so will include <string.h>
49 *
50 * #define RLGPUTEXAPI
51 * Define to compiler-specific intrinsic, if you wish to export public functions
52 * There is no need to do so when statically linking
53 *
54 * VERSIONS HISTORY:
55 * 1.2 (18-Mar-2026) Renamed library to `rltexgpu`
56 * Improved usage as standalone linrary
57 * Decouple logging and memory allocation from raylib
58 *
59 * 1.1 (15-Jul-2025) Several minor fixes related to specific image formats; some work has been done
60 * in order to decouple the library from raylib by introducing few new macros; library still
61 * requires raylib in order to function properly
62 *
63 * 1.0 (17-Sep-2022) First version has been created by migrating part of compressed-texture-loading
64 * functionality from raylib src/rtextures.c into self-contained library
65 *
66 * LICENSE: zlib/libpng
67 *
68 * Copyright (c) 2013-2026 Ramon Santamaria (@raysan5)
69 *
70 * This software is provided "as-is", without any express or implied warranty. In no event
71 * will the authors be held liable for any damages arising from the use of this software.
72 *
73 * Permission is granted to anyone to use this software for any purpose, including commercial
74 * applications, and to alter it and redistribute it freely, subject to the following restrictions:
75 *
76 * 1. The origin of this software must not be misrepresented; you must not claim that you
77 * wrote the original software. If you use this software in a product, an acknowledgment
78 * in the product documentation would be appreciated but is not required.
79 *
80 * 2. Altered source versions must be plainly marked as such, and must not be misrepresented
81 * as being the original software.
82 *
83 * 3. This notice may not be removed or altered from any source distribution.
84 *
85 **********************************************************************************************/
86
87 #ifndef RLTEXGPU_H
88 #define RLTEXGPU_H
89
90 #ifndef RLGPUTEXAPI
91 #define RLGPUTEXAPI // Functions defined as 'extern' by default (implicit specifiers)
92 #endif
93
94 // Texture pixel formats
95 // NOTE: Support depends on OpenGL version
96 // WARNING: Enum values aligned with raylib/rlgl equivalent PixelFormat/rlPixelFormat enum,
97 // to avoid value mapping between the 3 libraries format values
98 typedef enum {
99 RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1, // 8 bit per pixel (no alpha)
100 RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA, // 8*2 bpp (2 channels)
101 RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R5G6B5, // 16 bpp
102 RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R8G8B8, // 24 bpp
103 RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1, // 16 bpp (1 bit alpha)
104 RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4, // 16 bpp (4 bit alpha)
105 RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, // 32 bpp
106 RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R32, // 32 bpp (1 channel - float)
107 RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R32G32B32, // 32*3 bpp (3 channels - float)
108 RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32, // 32*4 bpp (4 channels - float)
109 RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R16, // 16 bpp (1 channel - half float)
110 RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R16G16B16, // 16*3 bpp (3 channels - half float)
111 RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16, // 16*4 bpp (4 channels - half float)
112 RLTEXGPU_PIXELFORMAT_COMPRESSED_DXT1_RGB, // 4 bpp (no alpha)
113 RLTEXGPU_PIXELFORMAT_COMPRESSED_DXT1_RGBA, // 4 bpp (1 bit alpha)
114 RLTEXGPU_PIXELFORMAT_COMPRESSED_DXT3_RGBA, // 8 bpp
115 RLTEXGPU_PIXELFORMAT_COMPRESSED_DXT5_RGBA, // 8 bpp
116 RLTEXGPU_PIXELFORMAT_COMPRESSED_ETC1_RGB, // 4 bpp
117 RLTEXGPU_PIXELFORMAT_COMPRESSED_ETC2_RGB, // 4 bpp
118 RLTEXGPU_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA, // 8 bpp
119 RLTEXGPU_PIXELFORMAT_COMPRESSED_PVRT_RGB, // 4 bpp
120 RLTEXGPU_PIXELFORMAT_COMPRESSED_PVRT_RGBA, // 4 bpp
121 RLTEXGPU_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA, // 8 bpp
122 RLTEXGPU_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA // 2 bpp
123 } rlGpuTexPixelFormat;
124
125 //----------------------------------------------------------------------------------
126 // Module Functions Declaration
127 //----------------------------------------------------------------------------------
128 #if defined(__cplusplus)
129 extern "C" { // Prevents name mangling of functions
130 #endif
131
132 // Load image data from memory data files
133 RLGPUTEXAPI void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_size, int *width, int *height, int *format, int *mips);
134 RLGPUTEXAPI void *rl_load_pkm_from_memory(const unsigned char *file_data, unsigned int file_size, int *width, int *height, int *format, int *mips);
135 RLGPUTEXAPI void *rl_load_ktx_from_memory(const unsigned char *file_data, unsigned int file_size, int *width, int *height, int *format, int *mips);
136 RLGPUTEXAPI void *rl_load_pvr_from_memory(const unsigned char *file_data, unsigned int file_size, int *width, int *height, int *format, int *mips);
137 RLGPUTEXAPI void *rl_load_astc_from_memory(const unsigned char *file_data, unsigned int file_size, int *width, int *height, int *format, int *mips);
138
139 RLGPUTEXAPI int rl_save_ktx_to_memory(const char *fileName, void *data, int width, int height, int format, int mipmaps); // Save image data as KTX file
140
141 #if defined(__cplusplus)
142 }
143 #endif
144
145 #endif // RLTEXGPU_H
146
147 /***********************************************************************************
148 *
149 * RL_GPUTEX IMPLEMENTATION
150 *
151 ************************************************************************************/
152
153 #if defined(RLTEXGPU_IMPLEMENTATION)
154
155 #if defined(RLTEXGPU_SHOW_LOG_INFO) && !defined(RLTEXGPU_LOG)
156 #include <stdio.h> // Required for: printf()
157 #endif
158 #if !defined(RLTEXGPU_MALLOC) || !defined(RLTEXGPU_NULL)
159 #include <stdlib.h> // Required for: NULL, malloc(), calloc(), free()
160 #endif
161 #if !defined(RLTEXGPU_MEMCPY)
162 #include <string.h> // Required for: memcpy()
163 #endif
164
165 #if defined(RLTEXGPU_MALLOC) || defined(RLTEXGPU_FREE)
166 #if !defined(RLTEXGPU_MALLOC) || !defined(RLTEXGPU_FREE)
167 #warning "RLTEXGPU_MALLOC and RLTEXGPU_FREE allocation functions are required to be provided"
168 #endif
169 #endif
170 #if !defined(RLTEXGPU_MALLOC)
171 #define RLTEXGPU_MALLOC(sz) malloc(sz)
172 #define RLTEXGPU_FREE(ptr) free(ptr)
173 #endif
174
175 #if !defined(RLTEXGPU_NULL)
176 #define RLTEXGPU_NULL NULL
177 #endif
178 #if !defined(RLTEXGPU_MEMCPY)
179 #define RLTEXGPU_MEMCPY(dest, src, num) memcpy(dest, src, num)
180 #endif
181
182 // Simple warning logging system to avoid LOG() calls if required
183 // NOTE: Avoiding those calls, also avoids const strings memory usage
184 // WARNING: This macro expects that newline character is added automatically
185 // in order to match the functionality of raylib's TRACELOG()
186 #if defined(RLTEXGPU_SHOW_LOG_INFO)
187 #if !defined(RLTEXGPU_LOG)
188 #define RLTEXGPU_LOG(...) (void)(printf("RL_GPUTEX: WARNING: " __VA_ARGS__), printf("\n"))
189 #endif
190 #else
191 #if defined(RLTEXGPU_LOG)
192 // Undefine it first in order to supress warnings about macro redefinition
193 #undef RLTEXGPU_LOG
194 #endif
195 #define RLTEXGPU_LOG(...)
196 #endif
197
198 //----------------------------------------------------------------------------------
199 // Module Internal Functions Declaration
200 //----------------------------------------------------------------------------------
201 // Get pixel data size in bytes for certain pixel format
202 static int get_pixel_data_size(int width, int height, int format);
203
204 // Get OpenGL internal formats and data type from rlGpuTexPixelFormat
205 void get_gl_texture_formats(int format, unsigned int *gl_internal_format, unsigned int *gl_format, unsigned int *gl_type);
206
207 //----------------------------------------------------------------------------------
208 // Module Functions Definition
209 //----------------------------------------------------------------------------------
210 #if defined(RLTEXGPU_SUPPORT_DDS)
211 // Loading DDS from memory image data (compressed or uncompressed)
212 void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_size, int *width, int *height, int *format, int *mips)
213 {
214 void *image_data = RLTEXGPU_NULL; // Image data pointer
215 int image_pixel_size = 0; // Image pixel size
216
217 unsigned char *file_data_ptr = (unsigned char *)file_data;
218
219 // Required extension:
220 // GL_EXT_texture_compression_s3tc
221
222 // Supported tokens (defined by extensions)
223 // GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
224 // GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
225 // GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
226 // GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
227
228 #define FOURCC_DXT1 0x31545844 // Equivalent to "DXT1" in ASCII
229 #define FOURCC_DXT3 0x33545844 // Equivalent to "DXT3" in ASCII
230 #define FOURCC_DXT5 0x35545844 // Equivalent to "DXT5" in ASCII
231
232 // DDS Pixel Format
233 typedef struct {
234 unsigned int size;
235 unsigned int flags;
236 unsigned int fourcc;
237 unsigned int rgb_bit_count;
238 unsigned int r_bit_mask;
239 unsigned int g_bit_mask;
240 unsigned int b_bit_mask;
241 unsigned int a_bit_mask;
242 } dds_pixel_format;
243
244 // DDS Header (124 bytes)
245 typedef struct {
246 unsigned int size;
247 unsigned int flags;
248 unsigned int height;
249 unsigned int width;
250 unsigned int pitch_or_linear_size;
251 unsigned int depth;
252 unsigned int mipmap_count;
253 unsigned int reserved1[11];
254 dds_pixel_format ddspf;
255 unsigned int caps;
256 unsigned int caps2;
257 unsigned int caps3;
258 unsigned int caps4;
259 unsigned int reserved2;
260 } dds_header;
261
262 if (file_data_ptr != RLTEXGPU_NULL)
263 {
264 // Verify the type of file
265 unsigned char *dds_header_id = file_data_ptr;
266 file_data_ptr += 4;
267
268 if ((dds_header_id[0] != 'D') || (dds_header_id[1] != 'D') || (dds_header_id[2] != 'S') || (dds_header_id[3] != ' '))
269 {
270 RLTEXGPU_LOG("DDS file data not valid");
271 }
272 else
273 {
274 dds_header *header = (dds_header *)file_data_ptr;
275
276 file_data_ptr += sizeof(dds_header); // Skip header
277
278 *width = header->width;
279 *height = header->height;
280
281 if (*width % 4 != 0) RLTEXGPU_LOG("DDS file width must be multiple of 4. Image will not display correctly");
282 if (*height % 4 != 0) RLTEXGPU_LOG("DDS file height must be multiple of 4. Image will not display correctly");
283
284 image_pixel_size = header->width*header->height;
285
286 if (header->mipmap_count == 0) *mips = 1; // Parameter not used
287 else *mips = header->mipmap_count;
288
289 if (header->ddspf.rgb_bit_count == 16) // 16bit mode, no compressed
290 {
291 if (header->ddspf.flags == 0x40) // No alpha channel
292 {
293 int data_size = image_pixel_size*sizeof(unsigned short);
294 if (header->mipmap_count > 1) data_size = data_size + data_size/3;
295 image_data = RLTEXGPU_MALLOC(data_size);
296
297 RLTEXGPU_MEMCPY(image_data, file_data_ptr, data_size);
298
299 *format = RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R5G6B5;
300 }
301 else if (header->ddspf.flags == 0x41) // With alpha channel
302 {
303 if (header->ddspf.a_bit_mask == 0x8000) // 1bit alpha
304 {
305 int data_size = image_pixel_size*sizeof(unsigned short);
306 if (header->mipmap_count > 1) data_size = data_size + data_size/3;
307 image_data = RLTEXGPU_MALLOC(data_size);
308
309 RLTEXGPU_MEMCPY(image_data, file_data_ptr, data_size);
310
311 unsigned char alpha = 0;
312
313 // NOTE: Data comes as A1R5G5B5, it must be reordered to R5G5B5A1
314 for (int i = 0; i < data_size/sizeof(unsigned short); i++)
315 {
316 alpha = ((unsigned short *)image_data)[i] >> 15;
317 ((unsigned short *)image_data)[i] = ((unsigned short *)image_data)[i] << 1;
318 ((unsigned short *)image_data)[i] += alpha;
319 }
320
321 *format = RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1;
322 }
323 else if (header->ddspf.a_bit_mask == 0xf000) // 4bit alpha
324 {
325 int data_size = image_pixel_size*sizeof(unsigned short);
326 if (header->mipmap_count > 1) data_size = data_size + data_size/3;
327 image_data = RLTEXGPU_MALLOC(data_size);
328
329 RLTEXGPU_MEMCPY(image_data, file_data_ptr, data_size);
330
331 unsigned char alpha = 0;
332
333 // NOTE: Data comes as A4R4G4B4, it must be reordered R4G4B4A4
334 for (int i = 0; i < data_size/sizeof(unsigned short); i++)
335 {
336 alpha = ((unsigned short *)image_data)[i] >> 12;
337 ((unsigned short *)image_data)[i] = ((unsigned short *)image_data)[i] << 4;
338 ((unsigned short *)image_data)[i] += alpha;
339 }
340
341 *format = RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4;
342 }
343 }
344 }
345 else if ((header->ddspf.flags == 0x40) && (header->ddspf.rgb_bit_count == 24)) // DDS_RGB, no compressed
346 {
347 int data_size = image_pixel_size*3*sizeof(unsigned char);
348 if (header->mipmap_count > 1) data_size = data_size + data_size/3;
349 image_data = RLTEXGPU_MALLOC(data_size);
350
351 RLTEXGPU_MEMCPY(image_data, file_data_ptr, data_size);
352
353 *format = RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R8G8B8;
354 }
355 else if ((header->ddspf.flags == 0x41) && (header->ddspf.rgb_bit_count == 32)) // DDS_RGBA, no compressed
356 {
357 int data_size = image_pixel_size*4*sizeof(unsigned char);
358 if (header->mipmap_count > 1) data_size = data_size + data_size/3;
359 image_data = RLTEXGPU_MALLOC(data_size);
360
361 RLTEXGPU_MEMCPY(image_data, file_data_ptr, data_size);
362
363 unsigned char blue = 0;
364
365 // NOTE: Data comes as A8R8G8B8, it must be reordered R8G8B8A8 (view next comment)
366 // DirecX understand ARGB as a 32bit DWORD but the actual memory byte alignment is BGRA
367 // So, we must realign B8G8R8A8 to R8G8B8A8
368 for (int i = 0; i < data_size; i += 4)
369 {
370 blue = ((unsigned char *)image_data)[i];
371 ((unsigned char *)image_data)[i] = ((unsigned char *)image_data)[i + 2];
372 ((unsigned char *)image_data)[i + 2] = blue;
373 }
374
375 *format = RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8;
376 }
377 else if (((header->ddspf.flags == 0x04) || (header->ddspf.flags == 0x05)) && (header->ddspf.fourcc > 0)) // Compressed
378 {
379 int data_size = 0;
380
381 // Calculate data size, including all mipmaps
382 if (header->mipmap_count > 1) data_size = header->pitch_or_linear_size + header->pitch_or_linear_size/3;
383 else data_size = header->pitch_or_linear_size;
384
385 image_data = RLTEXGPU_MALLOC(data_size*sizeof(unsigned char));
386
387 RLTEXGPU_MEMCPY(image_data, file_data_ptr, data_size);
388
389 switch (header->ddspf.fourcc)
390 {
391 case FOURCC_DXT1:
392 {
393 if (header->ddspf.flags == 0x04) *format = RLTEXGPU_PIXELFORMAT_COMPRESSED_DXT1_RGB;
394 else *format = RLTEXGPU_PIXELFORMAT_COMPRESSED_DXT1_RGBA;
395 } break;
396 case FOURCC_DXT3: *format = RLTEXGPU_PIXELFORMAT_COMPRESSED_DXT3_RGBA; break;
397 case FOURCC_DXT5: *format = RLTEXGPU_PIXELFORMAT_COMPRESSED_DXT5_RGBA; break;
398 default: break;
399 }
400 }
401 }
402 }
403
404 return image_data;
405 }
406 #endif
407
408 #if defined(RLTEXGPU_SUPPORT_PKM)
409 // Loading PKM image data (ETC1/ETC2 compression)
410 // NOTE: KTX is the standard Khronos Group compression format (ETC1/ETC2, mipmaps)
411 // PKM is a much simpler file format used mainly to contain a single ETC1/ETC2 compressed image (no mipmaps)
412 void *rl_load_pkm_from_memory(const unsigned char *file_data, unsigned int file_size, int *width, int *height, int *format, int *mips)
413 {
414 void *image_data = RLTEXGPU_NULL; // Image data pointer
415
416 unsigned char *file_data_ptr = (unsigned char *)file_data;
417
418 // Required extensions:
419 // GL_OES_compressed_ETC1_RGB8_texture (ETC1) (OpenGL ES 2.0)
420 // GL_ARB_ES3_compatibility (ETC2/EAC) (OpenGL ES 3.0)
421
422 // Supported tokens (defined by extensions)
423 // GL_ETC1_RGB8_OES 0x8D64
424 // GL_COMPRESSED_RGB8_ETC2 0x9274
425 // GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278
426
427 // PKM file (ETC1) Header (16 bytes)
428 typedef struct {
429 char id[4]; // "PKM "
430 char version[2]; // "10" or "20"
431 unsigned short format; // Data format (big-endian) (Check list below)
432 unsigned short width; // Texture width (big-endian) (orig_width rounded to multiple of 4)
433 unsigned short height; // Texture height (big-endian) (orig_height rounded to multiple of 4)
434 unsigned short orig_width; // Original width (big-endian)
435 unsigned short orig_height; // Original height (big-endian)
436 } pkm_header;
437
438 // Formats list
439 // version 10: format: 0=ETC1_RGB, [1=ETC1_RGBA, 2=ETC1_RGB_MIP, 3=ETC1_RGBA_MIP] (not used)
440 // version 20: format: 0=ETC1_RGB, 1=ETC2_RGB, 2=ETC2_RGBA_OLD, 3=ETC2_RGBA, 4=ETC2_RGBA1, 5=ETC2_R, 6=ETC2_RG, 7=ETC2_SIGNED_R, 8=ETC2_SIGNED_R
441
442 // NOTE: The extended width and height are the widths rounded up to a multiple of 4
443 // NOTE: ETC is always 4bit per pixel (64 bit for each 4x4 block of pixels)
444
445 if (file_data_ptr != RLTEXGPU_NULL)
446 {
447 pkm_header *header = (pkm_header *)file_data_ptr;
448
449 if ((header->id[0] != 'P') || (header->id[1] != 'K') || (header->id[2] != 'M') || (header->id[3] != ' '))
450 {
451 RLTEXGPU_LOG("PKM file data not valid");
452 }
453 else
454 {
455 file_data_ptr += sizeof(pkm_header); // Skip header
456
457 // NOTE: format, width and height come as big-endian, data must be swapped to little-endian
458 header->format = ((header->format & 0x00FF) << 8) | ((header->format & 0xFF00) >> 8);
459 header->width = ((header->width & 0x00FF) << 8) | ((header->width & 0xFF00) >> 8);
460 header->height = ((header->height & 0x00FF) << 8) | ((header->height & 0xFF00) >> 8);
461
462 *width = header->width;
463 *height = header->height;
464 *mips = 1;
465
466 int bpp = 4;
467 if (header->format == 3) bpp = 8;
468
469 int data_size = (*width)*(*height)*bpp/8; // Total data size in bytes
470
471 image_data = RLTEXGPU_MALLOC(data_size*sizeof(unsigned char));
472
473 RLTEXGPU_MEMCPY(image_data, file_data_ptr, data_size);
474
475 if (header->format == 0) *format = RLTEXGPU_PIXELFORMAT_COMPRESSED_ETC1_RGB;
476 else if (header->format == 1) *format = RLTEXGPU_PIXELFORMAT_COMPRESSED_ETC2_RGB;
477 else if (header->format == 3) *format = RLTEXGPU_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA;
478 }
479 }
480
481 return image_data;
482 }
483 #endif
484
485 #if defined(RLTEXGPU_SUPPORT_KTX)
486 // Load KTX compressed image data (ETC1/ETC2 compression)
487 // TODO: Review KTX loading, many things changed!
488 void *rl_load_ktx_from_memory(const unsigned char *file_data, unsigned int file_size, int *width, int *height, int *format, int *mips)
489 {
490 void *image_data = RLTEXGPU_NULL; // Image data pointer
491
492 unsigned char *file_data_ptr = (unsigned char *)file_data;
493
494 // Required extensions:
495 // GL_OES_compressed_ETC1_RGB8_texture (ETC1)
496 // GL_ARB_ES3_compatibility (ETC2/EAC)
497
498 // Supported tokens (defined by extensions)
499 // GL_ETC1_RGB8_OES 0x8D64
500 // GL_COMPRESSED_RGB8_ETC2 0x9274
501 // GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278
502
503 // KTX file Header (64 bytes)
504 // v1.1 - https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
505 // v2.0 - http://github.khronos.org/KTX-Specification/
506
507 // KTX 1.1 Header
508 // TODO: Support KTX 2.2 specs!
509 typedef struct {
510 char id[12]; // Identifier: "«KTX 11»\r\n\x1A\n"
511 unsigned int endianness; // Little endian: 0x01 0x02 0x03 0x04
512 unsigned int gl_type; // For compressed textures, glType must equal 0
513 unsigned int gl_type_size; // For compressed texture data, usually 1
514 unsigned int gl_format; // For compressed textures is 0
515 unsigned int gl_internal_format; // Compressed internal format
516 unsigned int gl_base_internal_format; // Same as glFormat (RGB, RGBA, ALPHA...)
517 unsigned int width; // Texture image width in pixels
518 unsigned int height; // Texture image height in pixels
519 unsigned int depth; // For 2D textures is 0
520 unsigned int elements; // Number of array elements, usually 0
521 unsigned int faces; // Cubemap faces, for no-cubemap = 1
522 unsigned int mipmap_levels; // Non-mipmapped textures = 1
523 unsigned int key_value_data_size; // Used to encode any arbitrary data...
524 } ktx_header;
525
526 // NOTE: Before start of every mipmap data block, we have: unsigned int data_size
527
528 if (file_data_ptr != RLTEXGPU_NULL)
529 {
530 ktx_header *header = (ktx_header *)file_data_ptr;
531
532 if ((header->id[1] != 'K') || (header->id[2] != 'T') || (header->id[3] != 'X') ||
533 (header->id[4] != ' ') || (header->id[5] != '1') || (header->id[6] != '1'))
534 {
535 RLTEXGPU_LOG("KTX file data not valid");
536 }
537 else
538 {
539 file_data_ptr += sizeof(ktx_header); // Move file data pointer
540
541 *width = header->width;
542 *height = header->height;
543 *mips = header->mipmap_levels;
544
545 file_data_ptr += header->key_value_data_size; // Skip value data size
546
547 int data_size = ((int *)file_data_ptr)[0];
548 file_data_ptr += sizeof(int);
549
550 image_data = RLTEXGPU_MALLOC(data_size*sizeof(unsigned char));
551
552 RLTEXGPU_MEMCPY(image_data, file_data_ptr, data_size);
553
554 if (header->gl_internal_format == 0x8D64) *format = RLTEXGPU_PIXELFORMAT_COMPRESSED_ETC1_RGB;
555 else if (header->gl_internal_format == 0x9274) *format = RLTEXGPU_PIXELFORMAT_COMPRESSED_ETC2_RGB;
556 else if (header->gl_internal_format == 0x9278) *format = RLTEXGPU_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA;
557
558 // TODO: Support uncompressed data formats? Right now it returns format = 0!
559 }
560 }
561
562 return image_data;
563 }
564
565 // Save image data as KTX file
566 // NOTE: By default KTX 1.1 spec is used, 2.0 is still on draft (01Oct2018)
567 // TODO: Review KTX saving, many things changed!
568 int rl_save_ktx(const char *file_name, void *data, int width, int height, int format, int mipmaps)
569 {
570 // KTX file Header (64 bytes)
571 // v1.1 - https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
572 // v2.0 - https://github.khronos.org/KTX-Specification/ktxspec.v2.html
573 typedef struct {
574 char id[12]; // Identifier: "«KTX 11»\r\n\x1A\n" // KTX 2.0: "«KTX 20»\r\n\x1A\n"
575 unsigned int endianness; // Little endian: 0x01 0x02 0x03 0x04
576 unsigned int gl_type; // For compressed textures, glType must equal 0
577 unsigned int gl_type_size; // For compressed texture data, usually 1
578 unsigned int gl_format; // For compressed textures is 0
579 unsigned int gl_internal_format; // Compressed internal format
580 unsigned int gl_base_internal_format; // Same as glFormat (RGB, RGBA, ALPHA...) // KTX 2.0: UInt32 vkFormat
581 unsigned int width; // Texture image width in pixels
582 unsigned int height; // Texture image height in pixels
583 unsigned int depth; // For 2D textures is 0
584 unsigned int elements; // Number of array elements, usually 0
585 unsigned int faces; // Cubemap faces, for no-cubemap = 1
586 unsigned int mipmap_levels; // Non-mipmapped textures = 1
587 unsigned int key_value_data_size; // Used to encode any arbitrary data... // KTX 2.0: UInt32 levelOrder - ordering of the mipmap levels, usually 0
588 // KTX 2.0: UInt32 supercompressionScheme - 0 (None), 1 (Crunch CRN), 2 (Zlib DEFLATE)...
589 // KTX 2.0 defines additional header elements...
590 } ktx_header;
591
592 /*
593 Byte[12] identifier
594 UInt32 vkFormat
595 UInt32 typeSize
596 UInt32 pixelWidth
597 UInt32 pixelHeight
598 UInt32 pixelDepth
599 UInt32 layerCount
600 UInt32 faceCount
601 UInt32 levelCount
602 UInt32 supercompressionScheme
603 */
604
605 // Calculate file data_size required
606 int data_size = sizeof(ktx_header);
607
608 for (int i = 0, w = width, h = height; i < mipmaps; i++)
609 {
610 data_size += get_pixel_data_size(w, h, format);
611 w /= 2; h /= 2;
612 }
613
614 unsigned char *file_data = RLTEXGPU_MALLOC(data_size);
615 unsigned char *file_data_ptr = file_data;
616
617 ktx_header header = { 0 };
618
619 // KTX identifier (v1.1)
620 //unsigned char id[12] = { '«', 'K', 'T', 'X', ' ', '1', '1', '»', '\r', '\n', '\x1A', '\n' };
621 //unsigned char id[12] = { 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A };
622
623 const char ktx_identifier[12] = { 0xAB, 'K', 'T', 'X', ' ', '1', '1', 0xBB, '\r', '\n', 0x1A, '\n' };
624
625 // Get the image header
626 RLTEXGPU_MEMCPY(header.id, ktx_identifier, 12); // KTX 1.1 signature
627 header.endianness = 0;
628 header.gl_type = 0; // Obtained from format
629 header.gl_type_size = 1;
630 header.gl_format = 0; // Obtained from format
631 header.gl_internal_format = 0; // Obtained from format
632 header.gl_base_internal_format = 0;
633 header.width = width;
634 header.height = height;
635 header.depth = 0;
636 header.elements = 0;
637 header.faces = 1;
638 header.mipmap_levels = mipmaps; // If it was 0, it means mipmaps should be generated on loading (not for compressed formats)
639 header.key_value_data_size = 0; // No extra data after the header
640
641 // TODO: WARNING: Function dependant on rlgl library!
642 rlGetGlTextureFormats(format, &header.gl_internal_format, &header.gl_format, &header.gl_type); // rlgl module function
643
644 header.gl_base_internal_format = header.gl_format; // TODO: WARNING: KTX 1.1 only
645
646 // NOTE: We can save into a .ktx all PixelFormats supported by raylib, including compressed formats like DXT, ETC or ASTC
647
648 if (header.gl_format == -1) RLTEXGPU_LOG("RL_GPUTEX: GL format not supported for KTX export (%i)", header.gl_format);
649 else
650 {
651 RLTEXGPU_MEMCPY(file_data_ptr, &header, sizeof(ktx_header));
652 file_data_ptr += sizeof(ktx_header);
653
654 int temp_width = width;
655 int temp_height = height;
656 int data_offset = 0;
657
658 // Save all mipmaps data
659 for (int i = 0; i < mipmaps; i++)
660 {
661 unsigned int data_size = get_pixel_data_size(temp_width, temp_height, format);
662
663 RLTEXGPU_MEMCPY(file_data_ptr, &data_size, sizeof(unsigned int));
664 RLTEXGPU_MEMCPY(file_data_ptr + 4, (unsigned char *)data + data_offset, data_size);
665
666 temp_width /= 2;
667 temp_height /= 2;
668 data_offset += data_size;
669 file_data_ptr += (4 + data_size);
670 }
671 }
672
673 // Save file data to file
674 int success = false;
675 FILE *file = fopen(file_name, "wb");
676
677 if (file != RLTEXGPU_NULL)
678 {
679 unsigned int count = (unsigned int)fwrite(file_data, sizeof(unsigned char), data_size, file);
680
681 if (count == 0) RLTEXGPU_LOG("FILEIO: [%s] Failed to write file", file_name);
682 else if (count != data_size) RLTEXGPU_LOG("FILEIO: [%s] File partially written", file_name);
683 else (void)0;
684
685 int result = fclose(file);
686 if (result != 0) RLTEXGPU_LOG("FILEIO: [%s] Failed to close file", file_name);
687
688 if (result == 0 && count == data_size) success = true;
689 }
690 else RLTEXGPU_LOG("FILEIO: [%s] Failed to open file", file_name);
691
692 RLTEXGPU_FREE(file_data); // Free file data buffer
693
694 // If all data has been written correctly to file, success = 1
695 return success;
696 }
697 #endif
698
699 #if defined(RLTEXGPU_SUPPORT_PVR)
700 // Loading PVR image data (uncompressed or PVRT compression)
701 // NOTE: PVR v2 not supported, use PVR v3 instead
702 void *rl_load_pvr_from_memory(const unsigned char *file_data, unsigned int file_size, int *width, int *height, int *format, int *mips)
703 {
704 void *image_data = RLTEXGPU_NULL; // Image data pointer
705
706 unsigned char *file_data_ptr = (unsigned char *)file_data;
707
708 // Required extension:
709 // GL_IMG_texture_compression_pvrtc
710
711 // Supported tokens (defined by extensions)
712 // GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
713 // GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
714
715 #if 0 // Not used...
716 // PVR file v2 Header (52 bytes)
717 typedef struct {
718 unsigned int headerLength;
719 unsigned int height;
720 unsigned int width;
721 unsigned int numMipmaps;
722 unsigned int flags;
723 unsigned int dataLength;
724 unsigned int bpp;
725 unsigned int bitmaskRed;
726 unsigned int bitmaskGreen;
727 unsigned int bitmaskBlue;
728 unsigned int bitmaskAlpha;
729 unsigned int pvrTag;
730 unsigned int numSurfs;
731 } PVRHeaderV2;
732 #endif
733
734 // PVR file v3 Header (52 bytes)
735 // NOTE: After it could be metadata (15 bytes?)
736 typedef struct {
737 char id[4];
738 unsigned int flags;
739 unsigned char channels[4]; // pixelFormat high part
740 unsigned char channel_depth[4]; // pixelFormat low part
741 unsigned int color_space;
742 unsigned int channel_type;
743 unsigned int height;
744 unsigned int width;
745 unsigned int depth;
746 unsigned int num_surfaces;
747 unsigned int num_faces;
748 unsigned int num_mipmaps;
749 unsigned int metadata_size;
750 } pvr_header;
751
752 #if 0 // Not used...
753 // Metadata (usually 15 bytes)
754 typedef struct {
755 unsigned int devFOURCC;
756 unsigned int key;
757 unsigned int data_size; // Not used?
758 unsigned char *data; // Not used?
759 } PVRMetadata;
760 #endif
761
762 if (file_data_ptr != RLTEXGPU_NULL)
763 {
764 // Check PVR image version
765 unsigned char pvr_version = file_data_ptr[0];
766
767 // Load different PVR data formats
768 if (pvr_version == 0x50)
769 {
770 pvr_header *header = (pvr_header *)file_data_ptr;
771
772 if ((header->id[0] != 'P') || (header->id[1] != 'V') || (header->id[2] != 'R') || (header->id[3] != 3))
773 {
774 RLTEXGPU_LOG("PVR file data not valid");
775 }
776 else
777 {
778 file_data_ptr += sizeof(pvr_header); // Skip header
779
780 *width = header->width;
781 *height = header->height;
782 *mips = header->num_mipmaps;
783
784 // Check data format
785 if (((header->channels[0] == 'l') && (header->channels[1] == 0)) && (header->channel_depth[0] == 8)) *format = RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE;
786 else if (((header->channels[0] == 'l') && (header->channels[1] == 'a')) && ((header->channel_depth[0] == 8) && (header->channel_depth[1] == 8))) *format = RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA;
787 else if ((header->channels[0] == 'r') && (header->channels[1] == 'g') && (header->channels[2] == 'b'))
788 {
789 if (header->channels[3] == 'a')
790 {
791 if ((header->channel_depth[0] == 5) && (header->channel_depth[1] == 5) && (header->channel_depth[2] == 5) && (header->channel_depth[3] == 1)) *format = RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1;
792 else if ((header->channel_depth[0] == 4) && (header->channel_depth[1] == 4) && (header->channel_depth[2] == 4) && (header->channel_depth[3] == 4)) *format = RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4;
793 else if ((header->channel_depth[0] == 8) && (header->channel_depth[1] == 8) && (header->channel_depth[2] == 8) && (header->channel_depth[3] == 8)) *format = RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8;
794 }
795 else if (header->channels[3] == 0)
796 {
797 if ((header->channel_depth[0] == 5) && (header->channel_depth[1] == 6) && (header->channel_depth[2] == 5)) *format = RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R5G6B5;
798 else if ((header->channel_depth[0] == 8) && (header->channel_depth[1] == 8) && (header->channel_depth[2] == 8)) *format = RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R8G8B8;
799 }
800 }
801 else if (header->channels[0] == 2) *format = RLTEXGPU_PIXELFORMAT_COMPRESSED_PVRT_RGB;
802 else if (header->channels[0] == 3) *format = RLTEXGPU_PIXELFORMAT_COMPRESSED_PVRT_RGBA;
803
804 file_data_ptr += header->metadata_size; // Skip meta data header
805
806 // Calculate data size (depends on format)
807 int bpp = 0;
808 switch (*format)
809 {
810 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE: bpp = 8; break;
811 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA:
812 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1:
813 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R5G6B5:
814 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4: bpp = 16; break;
815 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8: bpp = 32; break;
816 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R8G8B8: bpp = 24; break;
817 case RLTEXGPU_PIXELFORMAT_COMPRESSED_PVRT_RGB:
818 case RLTEXGPU_PIXELFORMAT_COMPRESSED_PVRT_RGBA: bpp = 4; break;
819 default: break;
820 }
821
822 int data_size = (*width)*(*height)*bpp/8; // Total data size in bytes
823 image_data = RLTEXGPU_MALLOC(data_size*sizeof(unsigned char));
824
825 RLTEXGPU_MEMCPY(image_data, file_data_ptr, data_size);
826 }
827 }
828 else if (pvr_version == 52) RLTEXGPU_LOG("PVRv2 format not supported, update your files to PVRv3");
829 }
830
831 return image_data;
832 }
833 #endif
834
835 #if defined(RLTEXGPU_SUPPORT_ASTC)
836 // Load ASTC compressed image data (ASTC compression)
837 void *rl_load_astc_from_memory(const unsigned char *file_data, unsigned int file_size, int *width, int *height, int *format, int *mips)
838 {
839 void *image_data = RLTEXGPU_NULL; // Image data pointer
840
841 unsigned char *file_data_ptr = (unsigned char *)file_data;
842
843 // Required extensions:
844 // GL_KHR_texture_compression_astc_hdr
845 // GL_KHR_texture_compression_astc_ldr
846
847 // Supported tokens (defined by extensions)
848 // GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93b0
849 // GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93b7
850
851 // ASTC file Header (16 bytes)
852 typedef struct {
853 unsigned char id[4]; // Signature: 0x13 0xAB 0xA1 0x5C
854 unsigned char blockX; // Block X dimensions
855 unsigned char blockY; // Block Y dimensions
856 unsigned char blockZ; // Block Z dimensions (1 for 2D images)
857 unsigned char width[3]; // void *width in pixels (24bit value)
858 unsigned char height[3]; // void *height in pixels (24bit value)
859 unsigned char length[3]; // void *Z-size (1 for 2D images)
860 } astc_header;
861
862 if (file_data_ptr != RLTEXGPU_NULL)
863 {
864 astc_header *header = (astc_header *)file_data_ptr;
865
866 if ((header->id[3] != 0x5c) || (header->id[2] != 0xa1) || (header->id[1] != 0xab) || (header->id[0] != 0x13))
867 {
868 RLTEXGPU_LOG("ASTC file data not valid");
869 }
870 else
871 {
872 file_data_ptr += sizeof(astc_header); // Skip header
873
874 // NOTE: Assuming Little Endian (could it be wrong?)
875 *width = 0x00000000 | ((int)header->width[2] << 16) | ((int)header->width[1] << 8) | ((int)header->width[0]);
876 *height = 0x00000000 | ((int)header->height[2] << 16) | ((int)header->height[1] << 8) | ((int)header->height[0]);
877 *mips = 1; // NOTE: ASTC format only contains one mipmap level
878
879 // NOTE: Each block is always stored in 128bit so we can calculate the bpp
880 int bpp = 128/(header->blockX*header->blockY);
881
882 // NOTE: Currently we only support 2 blocks configurations: 4x4 and 8x8
883 if ((bpp == 8) || (bpp == 2))
884 {
885 int data_size = (*width)*(*height)*bpp/8; // Data size in bytes
886
887 image_data = RLTEXGPU_MALLOC(data_size*sizeof(unsigned char));
888
889 RLTEXGPU_MEMCPY(image_data, file_data_ptr, data_size);
890
891 if (bpp == 8) *format = RLTEXGPU_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA;
892 else if (bpp == 2) *format = RLTEXGPU_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA;
893 }
894 else RLTEXGPU_LOG("ASTC block size configuration not supported");
895 }
896 }
897
898 return image_data;
899 }
900 #endif
901
902 //----------------------------------------------------------------------------------
903 // Module Internal Functions Definition
904 //----------------------------------------------------------------------------------
905 // Get pixel data size in bytes for certain pixel format
906 static int get_pixel_data_size(int width, int height, int format)
907 {
908 int data_size = 0; // Size in bytes
909 int bpp = 0; // Bits per pixel
910
911 switch (format)
912 {
913 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE: bpp = 8; break;
914 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA:
915 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R5G6B5:
916 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1:
917 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4: bpp = 16; break;
918 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8: bpp = 32; break;
919 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R8G8B8: bpp = 24; break;
920 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R32: bpp = 32; break;
921 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R32G32B32: bpp = 32*3; break;
922 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32: bpp = 32*4; break;
923 case RLTEXGPU_PIXELFORMAT_COMPRESSED_DXT1_RGB:
924 case RLTEXGPU_PIXELFORMAT_COMPRESSED_DXT1_RGBA:
925 case RLTEXGPU_PIXELFORMAT_COMPRESSED_ETC1_RGB:
926 case RLTEXGPU_PIXELFORMAT_COMPRESSED_ETC2_RGB:
927 case RLTEXGPU_PIXELFORMAT_COMPRESSED_PVRT_RGB:
928 case RLTEXGPU_PIXELFORMAT_COMPRESSED_PVRT_RGBA: bpp = 4; break;
929 case RLTEXGPU_PIXELFORMAT_COMPRESSED_DXT3_RGBA:
930 case RLTEXGPU_PIXELFORMAT_COMPRESSED_DXT5_RGBA:
931 case RLTEXGPU_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA:
932 case RLTEXGPU_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA: bpp = 8; break;
933 case RLTEXGPU_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA: bpp = 2; break;
934 default: break;
935 }
936
937 data_size = width*height*bpp/8; // Total data size in bytes
938
939 // Most compressed formats works on 4x4 blocks,
940 // if texture is smaller, minimum dataSize is 8 or 16
941 if ((width < 4) && (height < 4))
942 {
943 if ((format >= RLTEXGPU_PIXELFORMAT_COMPRESSED_DXT1_RGB) && (format < RLTEXGPU_PIXELFORMAT_COMPRESSED_DXT3_RGBA)) data_size = 8;
944 else if ((format >= RLTEXGPU_PIXELFORMAT_COMPRESSED_DXT3_RGBA) && (format < RLTEXGPU_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA)) data_size = 16;
945 }
946
947 return data_size;
948 }
949
950 // Get OpenGL internal formats and data type from rlGpuTexPixelFormat
951 void get_gl_texture_formats(int format, unsigned int *gl_internal_format, unsigned int *gl_format, unsigned int *gl_type)
952 {
953 // KTX 1.1 uses OpenGL formats on header info but KTX 2.0 uses Vulkan texture formats,
954 // if this library is being improved to support KTX 2.0, it requires those formats to be provided -> View list at the end!
955
956 /*
957 *gl_internal_format = 0;
958 *gl_format = 0;
959 *gl_type = 0;
960
961 switch (format)
962 {
963 #if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_21) || defined(GRAPHICS_API_OPENGL_ES2)
964 // NOTE: on OpenGL ES 2.0 (WebGL), internalFormat must match format and options allowed are: GL_LUMINANCE, GL_RGB, GL_RGBA
965 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE: *gl_internal_format = GL_LUMINANCE; *gl_format = GL_LUMINANCE; *gl_type = GL_UNSIGNED_BYTE; break;
966 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA: *gl_internal_format = GL_LUMINANCE_ALPHA; *gl_format = GL_LUMINANCE_ALPHA; *gl_type = GL_UNSIGNED_BYTE; break;
967 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R5G6B5: *gl_internal_format = GL_RGB; *gl_format = GL_RGB; *gl_type = GL_UNSIGNED_SHORT_5_6_5; break;
968 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R8G8B8: *gl_internal_format = GL_RGB; *gl_format = GL_RGB; *gl_type = GL_UNSIGNED_BYTE; break;
969 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1: *gl_internal_format = GL_RGBA; *gl_format = GL_RGBA; *gl_type = GL_UNSIGNED_SHORT_5_5_5_1; break;
970 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4: *gl_internal_format = GL_RGBA; *gl_format = GL_RGBA; *gl_type = GL_UNSIGNED_SHORT_4_4_4_4; break;
971 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8: *gl_internal_format = GL_RGBA; *gl_format = GL_RGBA; *gl_type = GL_UNSIGNED_BYTE; break;
972 #if !defined(GRAPHICS_API_OPENGL_11)
973 #if defined(GRAPHICS_API_OPENGL_ES3)
974 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R32: *gl_internal_format = GL_R32F_EXT; *gl_format = GL_RED_EXT; *gl_type = GL_FLOAT; break;
975 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R32G32B32: *gl_internal_format = GL_RGB32F_EXT; *gl_format = GL_RGB; *gl_type = GL_FLOAT; break;
976 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32: *gl_internal_format = GL_RGBA32F_EXT; *gl_format = GL_RGBA; *gl_type = GL_FLOAT; break;
977 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R16: *gl_internal_format = GL_R16F_EXT; *gl_format = GL_RED_EXT; *gl_type = GL_HALF_FLOAT; break;
978 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R16G16B16: *gl_internal_format = GL_RGB16F_EXT; *gl_format = GL_RGB; *gl_type = GL_HALF_FLOAT; break;
979 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16: *gl_internal_format = GL_RGBA16F_EXT; *gl_format = GL_RGBA; *gl_type = GL_HALF_FLOAT; break;
980 #else
981 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R32: *gl_internal_format = GL_LUMINANCE; *gl_format = GL_LUMINANCE; *gl_type = GL_FLOAT; break; // NOTE: Requires extension OES_texture_float
982 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R32G32B32: *gl_internal_format = GL_RGB; *gl_format = GL_RGB; *gl_type = GL_FLOAT; break; // NOTE: Requires extension OES_texture_float
983 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32: *gl_internal_format = GL_RGBA; *gl_format = GL_RGBA; *gl_type = GL_FLOAT; break; // NOTE: Requires extension OES_texture_float
984 #if defined(GRAPHICS_API_OPENGL_21)
985 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R16: *gl_internal_format = GL_LUMINANCE; *gl_format = GL_LUMINANCE; *gl_type = GL_HALF_FLOAT_ARB; break;
986 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R16G16B16: *gl_internal_format = GL_RGB; *gl_format = GL_RGB; *gl_type = GL_HALF_FLOAT_ARB; break;
987 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16: *gl_internal_format = GL_RGBA; *gl_format = GL_RGBA; *gl_type = GL_HALF_FLOAT_ARB; break;
988 #else // defined(GRAPHICS_API_OPENGL_ES2)
989 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R16: *gl_internal_format = GL_LUMINANCE; *gl_format = GL_LUMINANCE; *gl_type = GL_HALF_FLOAT_OES; break; // NOTE: Requires extension OES_texture_half_float
990 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R16G16B16: *gl_internal_format = GL_RGB; *gl_format = GL_RGB; *gl_type = GL_HALF_FLOAT_OES; break; // NOTE: Requires extension OES_texture_half_float
991 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16: *gl_internal_format = GL_RGBA; *gl_format = GL_RGBA; *gl_type = GL_HALF_FLOAT_OES; break; // NOTE: Requires extension OES_texture_half_float
992 #endif
993 #endif
994 #endif
995 #elif defined(GRAPHICS_API_OPENGL_33)
996 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE: *gl_internal_format = GL_R8; *gl_format = GL_RED; *gl_type = GL_UNSIGNED_BYTE; break;
997 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA: *gl_internal_format = GL_RG8; *gl_format = GL_RG; *gl_type = GL_UNSIGNED_BYTE; break;
998 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R5G6B5: *gl_internal_format = GL_RGB565; *gl_format = GL_RGB; *gl_type = GL_UNSIGNED_SHORT_5_6_5; break;
999 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R8G8B8: *gl_internal_format = GL_RGB8; *gl_format = GL_RGB; *gl_type = GL_UNSIGNED_BYTE; break;
1000 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1: *gl_internal_format = GL_RGB5_A1; *gl_format = GL_RGBA; *gl_type = GL_UNSIGNED_SHORT_5_5_5_1; break;
1001 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4: *gl_internal_format = GL_RGBA4; *gl_format = GL_RGBA; *gl_type = GL_UNSIGNED_SHORT_4_4_4_4; break;
1002 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8: *gl_internal_format = GL_RGBA8; *gl_format = GL_RGBA; *gl_type = GL_UNSIGNED_BYTE; break;
1003 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R32: *gl_internal_format = GL_R32F; *gl_format = GL_RED; *gl_type = GL_FLOAT; break;
1004 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R32G32B32: *gl_internal_format = GL_RGB32F; *gl_format = GL_RGB; *gl_type = GL_FLOAT; break;
1005 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32: *gl_internal_format = GL_RGBA32F; *gl_format = GL_RGBA; *gl_type = GL_FLOAT; break;
1006 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R16: *gl_internal_format = GL_R16F; *gl_format = GL_RED; *gl_type = GL_HALF_FLOAT; break;
1007 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R16G16B16: *gl_internal_format = GL_RGB16F; *gl_format = GL_RGB; *gl_type = GL_HALF_FLOAT; break;
1008 case RLTEXGPU_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16: *gl_internal_format = GL_RGBA16F; *gl_format = GL_RGBA; *gl_type = GL_HALF_FLOAT; break;
1009 #endif
1010 #if !defined(GRAPHICS_API_OPENGL_11)
1011 case RLTEXGPU_PIXELFORMAT_COMPRESSED_DXT1_RGB: *gl_internal_format = GL_COMPRESSED_RGB_S3TC_DXT1_EXT; break;
1012 case RLTEXGPU_PIXELFORMAT_COMPRESSED_DXT1_RGBA: *gl_internal_format = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; break;
1013 case RLTEXGPU_PIXELFORMAT_COMPRESSED_DXT3_RGBA: *gl_internal_format = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; break;
1014 case RLTEXGPU_PIXELFORMAT_COMPRESSED_DXT5_RGBA: *gl_internal_format = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break;
1015 case RLTEXGPU_PIXELFORMAT_COMPRESSED_ETC1_RGB: *gl_internal_format = GL_ETC1_RGB8_OES; break; // NOTE: Requires OpenGL ES 2.0 or OpenGL 4.3
1016 case RLTEXGPU_PIXELFORMAT_COMPRESSED_ETC2_RGB: *gl_internal_format = GL_COMPRESSED_RGB8_ETC2; break; // NOTE: Requires OpenGL ES 3.0 or OpenGL 4.3
1017 case RLTEXGPU_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA: *gl_internal_format = GL_COMPRESSED_RGBA8_ETC2_EAC; break; // NOTE: Requires OpenGL ES 3.0 or OpenGL 4.3
1018 case RLTEXGPU_PIXELFORMAT_COMPRESSED_PVRT_RGB: *gl_internal_format = GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG; break; // NOTE: Requires PowerVR GPU
1019 case RLTEXGPU_PIXELFORMAT_COMPRESSED_PVRT_RGBA: *gl_internal_format = GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; break; // NOTE: Requires PowerVR GPU
1020 case RLTEXGPU_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA: *gl_internal_format = GL_COMPRESSED_RGBA_ASTC_4x4_KHR; break; // NOTE: Requires OpenGL ES 3.1 or OpenGL 4.3
1021 case RLTEXGPU_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA: *gl_internal_format = GL_COMPRESSED_RGBA_ASTC_8x8_KHR; break; // NOTE: Requires OpenGL ES 3.1 or OpenGL 4.3
1022 #endif
1023 default: RLTEXGPU_LOG("GPUTEX: Current format not supported (%i)", format); break;
1024 }
1025 */
1026 }
1027 #endif // RLTEXGPU_IMPLEMENTATION
1028
1029 /*
1030 // OpenGL texture data formats
1031 // NOTE: Those values can be useful for KTX 1.1 saving,
1032 // probably only the latest OpenGL ones, not the extensions ones
1033 // So, there is no need to include full OpenGL headers
1034 #define GL_UNSIGNED_BYTE 0x1401
1035 #define GL_UNSIGNED_SHORT_5_6_5 0x8363
1036 #define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
1037 #define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
1038 #define GL_FLOAT 0x1406
1039 #define GL_HALF_FLOAT 0x140b
1040 #define GL_HALF_FLOAT_ARB 0x140b
1041 #define GL_HALF_FLOAT_OES 0x8d61
1042
1043 #define GL_RED_EXT 0x1903
1044 #define GL_RGB 0x1907
1045 #define GL_RGBA 0x1908
1046 #define GL_LUMINANCE 0x1909
1047 #define GL_R8 0x8229
1048 #define GL_RG8 0x822b
1049 #define GL_RGB565 0x8d62
1050 #define GL_RGB8 0x8051
1051 #define GL_RGB5_A1 0x8057
1052 #define GL_RGBA4 0x8056
1053 #define GL_RGBA8 0x8058
1054 #define GL_R16F 0x822d
1055 #define GL_RGB16F 0x881b
1056 #define GL_RGBA16F 0x881a
1057 #define GL_R32F 0x822e
1058 #define GL_RGB32F 0x8815
1059 #define GL_RGBA32F 0x8814
1060
1061 #define GL_R32F_EXT 0x822e
1062 #define GL_RGB32F_EXT 0x8815
1063 #define GL_RGBA32F_EXT 0x8814
1064 #define GL_R16F_EXT 0x822d
1065 #define GL_RGB16F_EXT 0x881b
1066 #define GL_RGBA16F_EXT 0x881a
1067
1068 // S3TC (DXT) compression
1069 #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83f0
1070 #define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83f1
1071 #define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83f2
1072 #define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83f3
1073
1074 // ETC formats
1075 #define GL_ETC1_RGB8_OES 0x8d64
1076 #define GL_COMPRESSED_RGB8_ETC2 0x9274
1077 #define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278
1078
1079 // PVRTC
1080 #define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8c00
1081 #define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8c02
1082
1083 // ASTC
1084 #define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93b0
1085 #define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93b7
1086 */
1087
1088 /*
1089 // Vulkan texture formats
1090 typedef enum VkFormat {
1091 // Provided by VK_VERSION_1_0
1092 VK_FORMAT_UNDEFINED = 0,
1093 VK_FORMAT_R4G4_UNORM_PACK8 = 1,
1094 VK_FORMAT_R4G4B4A4_UNORM_PACK16 = 2,
1095 VK_FORMAT_B4G4R4A4_UNORM_PACK16 = 3,
1096 VK_FORMAT_R5G6B5_UNORM_PACK16 = 4,
1097 VK_FORMAT_B5G6R5_UNORM_PACK16 = 5,
1098 VK_FORMAT_R5G5B5A1_UNORM_PACK16 = 6,
1099 VK_FORMAT_B5G5R5A1_UNORM_PACK16 = 7,
1100 VK_FORMAT_A1R5G5B5_UNORM_PACK16 = 8,
1101 VK_FORMAT_R8_UNORM = 9,
1102 VK_FORMAT_R8_SNORM = 10,
1103 VK_FORMAT_R8_USCALED = 11,
1104 VK_FORMAT_R8_SSCALED = 12,
1105 VK_FORMAT_R8_UINT = 13,
1106 VK_FORMAT_R8_SINT = 14,
1107 VK_FORMAT_R8_SRGB = 15,
1108 VK_FORMAT_R8G8_UNORM = 16,
1109 VK_FORMAT_R8G8_SNORM = 17,
1110 VK_FORMAT_R8G8_USCALED = 18,
1111 VK_FORMAT_R8G8_SSCALED = 19,
1112 VK_FORMAT_R8G8_UINT = 20,
1113 VK_FORMAT_R8G8_SINT = 21,
1114 VK_FORMAT_R8G8_SRGB = 22,
1115 VK_FORMAT_R8G8B8_UNORM = 23,
1116 VK_FORMAT_R8G8B8_SNORM = 24,
1117 VK_FORMAT_R8G8B8_USCALED = 25,
1118 VK_FORMAT_R8G8B8_SSCALED = 26,
1119 VK_FORMAT_R8G8B8_UINT = 27,
1120 VK_FORMAT_R8G8B8_SINT = 28,
1121 VK_FORMAT_R8G8B8_SRGB = 29,
1122 VK_FORMAT_B8G8R8_UNORM = 30,
1123 VK_FORMAT_B8G8R8_SNORM = 31,
1124 VK_FORMAT_B8G8R8_USCALED = 32,
1125 VK_FORMAT_B8G8R8_SSCALED = 33,
1126 VK_FORMAT_B8G8R8_UINT = 34,
1127 VK_FORMAT_B8G8R8_SINT = 35,
1128 VK_FORMAT_B8G8R8_SRGB = 36,
1129 VK_FORMAT_R8G8B8A8_UNORM = 37,
1130 VK_FORMAT_R8G8B8A8_SNORM = 38,
1131 VK_FORMAT_R8G8B8A8_USCALED = 39,
1132 VK_FORMAT_R8G8B8A8_SSCALED = 40,
1133 VK_FORMAT_R8G8B8A8_UINT = 41,
1134 VK_FORMAT_R8G8B8A8_SINT = 42,
1135 VK_FORMAT_R8G8B8A8_SRGB = 43,
1136 VK_FORMAT_B8G8R8A8_UNORM = 44,
1137 VK_FORMAT_B8G8R8A8_SNORM = 45,
1138 VK_FORMAT_B8G8R8A8_USCALED = 46,
1139 VK_FORMAT_B8G8R8A8_SSCALED = 47,
1140 VK_FORMAT_B8G8R8A8_UINT = 48,
1141 VK_FORMAT_B8G8R8A8_SINT = 49,
1142 VK_FORMAT_B8G8R8A8_SRGB = 50,
1143 VK_FORMAT_A8B8G8R8_UNORM_PACK32 = 51,
1144 VK_FORMAT_A8B8G8R8_SNORM_PACK32 = 52,
1145 VK_FORMAT_A8B8G8R8_USCALED_PACK32 = 53,
1146 VK_FORMAT_A8B8G8R8_SSCALED_PACK32 = 54,
1147 VK_FORMAT_A8B8G8R8_UINT_PACK32 = 55,
1148 VK_FORMAT_A8B8G8R8_SINT_PACK32 = 56,
1149 VK_FORMAT_A8B8G8R8_SRGB_PACK32 = 57,
1150 VK_FORMAT_A2R10G10B10_UNORM_PACK32 = 58,
1151 VK_FORMAT_A2R10G10B10_SNORM_PACK32 = 59,
1152 VK_FORMAT_A2R10G10B10_USCALED_PACK32 = 60,
1153 VK_FORMAT_A2R10G10B10_SSCALED_PACK32 = 61,
1154 VK_FORMAT_A2R10G10B10_UINT_PACK32 = 62,
1155 VK_FORMAT_A2R10G10B10_SINT_PACK32 = 63,
1156 VK_FORMAT_A2B10G10R10_UNORM_PACK32 = 64,
1157 VK_FORMAT_A2B10G10R10_SNORM_PACK32 = 65,
1158 VK_FORMAT_A2B10G10R10_USCALED_PACK32 = 66,
1159 VK_FORMAT_A2B10G10R10_SSCALED_PACK32 = 67,
1160 VK_FORMAT_A2B10G10R10_UINT_PACK32 = 68,
1161 VK_FORMAT_A2B10G10R10_SINT_PACK32 = 69,
1162 VK_FORMAT_R16_UNORM = 70,
1163 VK_FORMAT_R16_SNORM = 71,
1164 VK_FORMAT_R16_USCALED = 72,
1165 VK_FORMAT_R16_SSCALED = 73,
1166 VK_FORMAT_R16_UINT = 74,
1167 VK_FORMAT_R16_SINT = 75,
1168 VK_FORMAT_R16_SFLOAT = 76,
1169 VK_FORMAT_R16G16_UNORM = 77,
1170 VK_FORMAT_R16G16_SNORM = 78,
1171 VK_FORMAT_R16G16_USCALED = 79,
1172 VK_FORMAT_R16G16_SSCALED = 80,
1173 VK_FORMAT_R16G16_UINT = 81,
1174 VK_FORMAT_R16G16_SINT = 82,
1175 VK_FORMAT_R16G16_SFLOAT = 83,
1176 VK_FORMAT_R16G16B16_UNORM = 84,
1177 VK_FORMAT_R16G16B16_SNORM = 85,
1178 VK_FORMAT_R16G16B16_USCALED = 86,
1179 VK_FORMAT_R16G16B16_SSCALED = 87,
1180 VK_FORMAT_R16G16B16_UINT = 88,
1181 VK_FORMAT_R16G16B16_SINT = 89,
1182 VK_FORMAT_R16G16B16_SFLOAT = 90,
1183 VK_FORMAT_R16G16B16A16_UNORM = 91,
1184 VK_FORMAT_R16G16B16A16_SNORM = 92,
1185 VK_FORMAT_R16G16B16A16_USCALED = 93,
1186 VK_FORMAT_R16G16B16A16_SSCALED = 94,
1187 VK_FORMAT_R16G16B16A16_UINT = 95,
1188 VK_FORMAT_R16G16B16A16_SINT = 96,
1189 VK_FORMAT_R16G16B16A16_SFLOAT = 97,
1190 VK_FORMAT_R32_UINT = 98,
1191 VK_FORMAT_R32_SINT = 99,
1192 VK_FORMAT_R32_SFLOAT = 100,
1193 VK_FORMAT_R32G32_UINT = 101,
1194 VK_FORMAT_R32G32_SINT = 102,
1195 VK_FORMAT_R32G32_SFLOAT = 103,
1196 VK_FORMAT_R32G32B32_UINT = 104,
1197 VK_FORMAT_R32G32B32_SINT = 105,
1198 VK_FORMAT_R32G32B32_SFLOAT = 106,
1199 VK_FORMAT_R32G32B32A32_UINT = 107,
1200 VK_FORMAT_R32G32B32A32_SINT = 108,
1201 VK_FORMAT_R32G32B32A32_SFLOAT = 109,
1202 VK_FORMAT_R64_UINT = 110,
1203 VK_FORMAT_R64_SINT = 111,
1204 VK_FORMAT_R64_SFLOAT = 112,
1205 VK_FORMAT_R64G64_UINT = 113,
1206 VK_FORMAT_R64G64_SINT = 114,
1207 VK_FORMAT_R64G64_SFLOAT = 115,
1208 VK_FORMAT_R64G64B64_UINT = 116,
1209 VK_FORMAT_R64G64B64_SINT = 117,
1210 VK_FORMAT_R64G64B64_SFLOAT = 118,
1211 VK_FORMAT_R64G64B64A64_UINT = 119,
1212 VK_FORMAT_R64G64B64A64_SINT = 120,
1213 VK_FORMAT_R64G64B64A64_SFLOAT = 121,
1214 VK_FORMAT_B10G11R11_UFLOAT_PACK32 = 122,
1215 VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = 123,
1216 VK_FORMAT_D16_UNORM = 124,
1217 VK_FORMAT_X8_D24_UNORM_PACK32 = 125,
1218 VK_FORMAT_D32_SFLOAT = 126,
1219 VK_FORMAT_S8_UINT = 127,
1220 VK_FORMAT_D16_UNORM_S8_UINT = 128,
1221 VK_FORMAT_D24_UNORM_S8_UINT = 129,
1222 VK_FORMAT_D32_SFLOAT_S8_UINT = 130,
1223 VK_FORMAT_BC1_RGB_UNORM_BLOCK = 131,
1224 VK_FORMAT_BC1_RGB_SRGB_BLOCK = 132,
1225 VK_FORMAT_BC1_RGBA_UNORM_BLOCK = 133,
1226 VK_FORMAT_BC1_RGBA_SRGB_BLOCK = 134,
1227 VK_FORMAT_BC2_UNORM_BLOCK = 135,
1228 VK_FORMAT_BC2_SRGB_BLOCK = 136,
1229 VK_FORMAT_BC3_UNORM_BLOCK = 137,
1230 VK_FORMAT_BC3_SRGB_BLOCK = 138,
1231 VK_FORMAT_BC4_UNORM_BLOCK = 139,
1232 VK_FORMAT_BC4_SNORM_BLOCK = 140,
1233 VK_FORMAT_BC5_UNORM_BLOCK = 141,
1234 VK_FORMAT_BC5_SNORM_BLOCK = 142,
1235 VK_FORMAT_BC6H_UFLOAT_BLOCK = 143,
1236 VK_FORMAT_BC6H_SFLOAT_BLOCK = 144,
1237 VK_FORMAT_BC7_UNORM_BLOCK = 145,
1238 VK_FORMAT_BC7_SRGB_BLOCK = 146,
1239 VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = 147,
1240 VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = 148,
1241 VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = 149,
1242 VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = 150,
1243 VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = 151,
1244 VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = 152,
1245 VK_FORMAT_EAC_R11_UNORM_BLOCK = 153,
1246 VK_FORMAT_EAC_R11_SNORM_BLOCK = 154,
1247 VK_FORMAT_EAC_R11G11_UNORM_BLOCK = 155,
1248 VK_FORMAT_EAC_R11G11_SNORM_BLOCK = 156,
1249 VK_FORMAT_ASTC_4x4_UNORM_BLOCK = 157,
1250 VK_FORMAT_ASTC_4x4_SRGB_BLOCK = 158,
1251 VK_FORMAT_ASTC_5x4_UNORM_BLOCK = 159,
1252 VK_FORMAT_ASTC_5x4_SRGB_BLOCK = 160,
1253 VK_FORMAT_ASTC_5x5_UNORM_BLOCK = 161,
1254 VK_FORMAT_ASTC_5x5_SRGB_BLOCK = 162,
1255 VK_FORMAT_ASTC_6x5_UNORM_BLOCK = 163,
1256 VK_FORMAT_ASTC_6x5_SRGB_BLOCK = 164,
1257 VK_FORMAT_ASTC_6x6_UNORM_BLOCK = 165,
1258 VK_FORMAT_ASTC_6x6_SRGB_BLOCK = 166,
1259 VK_FORMAT_ASTC_8x5_UNORM_BLOCK = 167,
1260 VK_FORMAT_ASTC_8x5_SRGB_BLOCK = 168,
1261 VK_FORMAT_ASTC_8x6_UNORM_BLOCK = 169,
1262 VK_FORMAT_ASTC_8x6_SRGB_BLOCK = 170,
1263 VK_FORMAT_ASTC_8x8_UNORM_BLOCK = 171,
1264 VK_FORMAT_ASTC_8x8_SRGB_BLOCK = 172,
1265 VK_FORMAT_ASTC_10x5_UNORM_BLOCK = 173,
1266 VK_FORMAT_ASTC_10x5_SRGB_BLOCK = 174,
1267 VK_FORMAT_ASTC_10x6_UNORM_BLOCK = 175,
1268 VK_FORMAT_ASTC_10x6_SRGB_BLOCK = 176,
1269 VK_FORMAT_ASTC_10x8_UNORM_BLOCK = 177,
1270 VK_FORMAT_ASTC_10x8_SRGB_BLOCK = 178,
1271 VK_FORMAT_ASTC_10x10_UNORM_BLOCK = 179,
1272 VK_FORMAT_ASTC_10x10_SRGB_BLOCK = 180,
1273 VK_FORMAT_ASTC_12x10_UNORM_BLOCK = 181,
1274 VK_FORMAT_ASTC_12x10_SRGB_BLOCK = 182,
1275 VK_FORMAT_ASTC_12x12_UNORM_BLOCK = 183,
1276 VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184,
1277 // Provided by VK_VERSION_1_1
1278 VK_FORMAT_G8B8G8R8_422_UNORM = 1000156000,
1279 // Provided by VK_VERSION_1_1
1280 VK_FORMAT_B8G8R8G8_422_UNORM = 1000156001,
1281 // Provided by VK_VERSION_1_1
1282 VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM = 1000156002,
1283 // Provided by VK_VERSION_1_1
1284 VK_FORMAT_G8_B8R8_2PLANE_420_UNORM = 1000156003,
1285 // Provided by VK_VERSION_1_1
1286 VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM = 1000156004,
1287 // Provided by VK_VERSION_1_1
1288 VK_FORMAT_G8_B8R8_2PLANE_422_UNORM = 1000156005,
1289 // Provided by VK_VERSION_1_1
1290 VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM = 1000156006,
1291 // Provided by VK_VERSION_1_1
1292 VK_FORMAT_R10X6_UNORM_PACK16 = 1000156007,
1293 // Provided by VK_VERSION_1_1
1294 VK_FORMAT_R10X6G10X6_UNORM_2PACK16 = 1000156008,
1295 // Provided by VK_VERSION_1_1
1296 VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16 = 1000156009,
1297 // Provided by VK_VERSION_1_1
1298 VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16 = 1000156010,
1299 // Provided by VK_VERSION_1_1
1300 VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16 = 1000156011,
1301 // Provided by VK_VERSION_1_1
1302 VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16 = 1000156012,
1303 // Provided by VK_VERSION_1_1
1304 VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16 = 1000156013,
1305 // Provided by VK_VERSION_1_1
1306 VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16 = 1000156014,
1307 // Provided by VK_VERSION_1_1
1308 VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16 = 1000156015,
1309 // Provided by VK_VERSION_1_1
1310 VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16 = 1000156016,
1311 // Provided by VK_VERSION_1_1
1312 VK_FORMAT_R12X4_UNORM_PACK16 = 1000156017,
1313 // Provided by VK_VERSION_1_1
1314 VK_FORMAT_R12X4G12X4_UNORM_2PACK16 = 1000156018,
1315 // Provided by VK_VERSION_1_1
1316 VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16 = 1000156019,
1317 // Provided by VK_VERSION_1_1
1318 VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16 = 1000156020,
1319 // Provided by VK_VERSION_1_1
1320 VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16 = 1000156021,
1321 // Provided by VK_VERSION_1_1
1322 VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16 = 1000156022,
1323 // Provided by VK_VERSION_1_1
1324 VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16 = 1000156023,
1325 // Provided by VK_VERSION_1_1
1326 VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16 = 1000156024,
1327 // Provided by VK_VERSION_1_1
1328 VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16 = 1000156025,
1329 // Provided by VK_VERSION_1_1
1330 VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16 = 1000156026,
1331 // Provided by VK_VERSION_1_1
1332 VK_FORMAT_G16B16G16R16_422_UNORM = 1000156027,
1333 // Provided by VK_VERSION_1_1
1334 VK_FORMAT_B16G16R16G16_422_UNORM = 1000156028,
1335 // Provided by VK_VERSION_1_1
1336 VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM = 1000156029,
1337 // Provided by VK_VERSION_1_1
1338 VK_FORMAT_G16_B16R16_2PLANE_420_UNORM = 1000156030,
1339 // Provided by VK_VERSION_1_1
1340 VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM = 1000156031,
1341 // Provided by VK_VERSION_1_1
1342 VK_FORMAT_G16_B16R16_2PLANE_422_UNORM = 1000156032,
1343 // Provided by VK_VERSION_1_1
1344 VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM = 1000156033,
1345 // Provided by VK_VERSION_1_3
1346 VK_FORMAT_G8_B8R8_2PLANE_444_UNORM = 1000330000,
1347 // Provided by VK_VERSION_1_3
1348 VK_FORMAT_G10X6_B10X6R10X6_2PLANE_444_UNORM_3PACK16 = 1000330001,
1349 // Provided by VK_VERSION_1_3
1350 VK_FORMAT_G12X4_B12X4R12X4_2PLANE_444_UNORM_3PACK16 = 1000330002,
1351 // Provided by VK_VERSION_1_3
1352 VK_FORMAT_G16_B16R16_2PLANE_444_UNORM = 1000330003,
1353 // Provided by VK_VERSION_1_3
1354 VK_FORMAT_A4R4G4B4_UNORM_PACK16 = 1000340000,
1355 // Provided by VK_VERSION_1_3
1356 VK_FORMAT_A4B4G4R4_UNORM_PACK16 = 1000340001,
1357 // Provided by VK_VERSION_1_3
1358 VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK = 1000066000,
1359 // Provided by VK_VERSION_1_3
1360 VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK = 1000066001,
1361 // Provided by VK_VERSION_1_3
1362 VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK = 1000066002,
1363 // Provided by VK_VERSION_1_3
1364 VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK = 1000066003,
1365 // Provided by VK_VERSION_1_3
1366 VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK = 1000066004,
1367 // Provided by VK_VERSION_1_3
1368 VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK = 1000066005,
1369 // Provided by VK_VERSION_1_3
1370 VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK = 1000066006,
1371 // Provided by VK_VERSION_1_3
1372 VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK = 1000066007,
1373 // Provided by VK_VERSION_1_3
1374 VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK = 1000066008,
1375 // Provided by VK_VERSION_1_3
1376 VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK = 1000066009,
1377 // Provided by VK_VERSION_1_3
1378 VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK = 1000066010,
1379 // Provided by VK_VERSION_1_3
1380 VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK = 1000066011,
1381 // Provided by VK_VERSION_1_3
1382 VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK = 1000066012,
1383 // Provided by VK_VERSION_1_3
1384 VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK = 1000066013,
1385 // Provided by VK_VERSION_1_4
1386 VK_FORMAT_A1B5G5R5_UNORM_PACK16 = 1000470000,
1387 // Provided by VK_VERSION_1_4
1388 VK_FORMAT_A8_UNORM = 1000470001,
1389 // Provided by VK_IMG_format_pvrtc
1390 VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG = 1000054000,
1391 // Provided by VK_IMG_format_pvrtc
1392 VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG = 1000054001,
1393 // Provided by VK_IMG_format_pvrtc
1394 VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG = 1000054002,
1395 // Provided by VK_IMG_format_pvrtc
1396 VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG = 1000054003,
1397 // Provided by VK_IMG_format_pvrtc
1398 VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG = 1000054004,
1399 // Provided by VK_IMG_format_pvrtc
1400 VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = 1000054005,
1401 // Provided by VK_IMG_format_pvrtc
1402 VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = 1000054006,
1403 // Provided by VK_IMG_format_pvrtc
1404 VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = 1000054007,
1405 // Provided by VK_ARM_tensors
1406 VK_FORMAT_R8_BOOL_ARM = 1000460000,
1407 // Provided by VK_NV_optical_flow
1408 VK_FORMAT_R16G16_SFIXED5_NV = 1000464000,
1409 // Provided by VK_ARM_format_pack
1410 VK_FORMAT_R10X6_UINT_PACK16_ARM = 1000609000,
1411 // Provided by VK_ARM_format_pack
1412 VK_FORMAT_R10X6G10X6_UINT_2PACK16_ARM = 1000609001,
1413 // Provided by VK_ARM_format_pack
1414 VK_FORMAT_R10X6G10X6B10X6A10X6_UINT_4PACK16_ARM = 1000609002,
1415 // Provided by VK_ARM_format_pack
1416 VK_FORMAT_R12X4_UINT_PACK16_ARM = 1000609003,
1417 // Provided by VK_ARM_format_pack
1418 VK_FORMAT_R12X4G12X4_UINT_2PACK16_ARM = 1000609004,
1419 // Provided by VK_ARM_format_pack
1420 VK_FORMAT_R12X4G12X4B12X4A12X4_UINT_4PACK16_ARM = 1000609005,
1421 // Provided by VK_ARM_format_pack
1422 VK_FORMAT_R14X2_UINT_PACK16_ARM = 1000609006,
1423 // Provided by VK_ARM_format_pack
1424 VK_FORMAT_R14X2G14X2_UINT_2PACK16_ARM = 1000609007,
1425 // Provided by VK_ARM_format_pack
1426 VK_FORMAT_R14X2G14X2B14X2A14X2_UINT_4PACK16_ARM = 1000609008,
1427 // Provided by VK_ARM_format_pack
1428 VK_FORMAT_R14X2_UNORM_PACK16_ARM = 1000609009,
1429 // Provided by VK_ARM_format_pack
1430 VK_FORMAT_R14X2G14X2_UNORM_2PACK16_ARM = 1000609010,
1431 // Provided by VK_ARM_format_pack
1432 VK_FORMAT_R14X2G14X2B14X2A14X2_UNORM_4PACK16_ARM = 1000609011,
1433 // Provided by VK_ARM_format_pack
1434 VK_FORMAT_G14X2_B14X2R14X2_2PLANE_420_UNORM_3PACK16_ARM = 1000609012,
1435 // Provided by VK_ARM_format_pack
1436 VK_FORMAT_G14X2_B14X2R14X2_2PLANE_422_UNORM_3PACK16_ARM = 1000609013,
1437 // Provided by VK_EXT_texture_compression_astc_hdr
1438 VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK,
1439 // Provided by VK_EXT_texture_compression_astc_hdr
1440 VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK,
1441 // Provided by VK_EXT_texture_compression_astc_hdr
1442 VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK,
1443 // Provided by VK_EXT_texture_compression_astc_hdr
1444 VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK,
1445 // Provided by VK_EXT_texture_compression_astc_hdr
1446 VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK,
1447 // Provided by VK_EXT_texture_compression_astc_hdr
1448 VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK,
1449 // Provided by VK_EXT_texture_compression_astc_hdr
1450 VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK,
1451 // Provided by VK_EXT_texture_compression_astc_hdr
1452 VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK,
1453 // Provided by VK_EXT_texture_compression_astc_hdr
1454 VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK,
1455 // Provided by VK_EXT_texture_compression_astc_hdr
1456 VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK,
1457 // Provided by VK_EXT_texture_compression_astc_hdr
1458 VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK,
1459 // Provided by VK_EXT_texture_compression_astc_hdr
1460 VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK,
1461 // Provided by VK_EXT_texture_compression_astc_hdr
1462 VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK,
1463 // Provided by VK_EXT_texture_compression_astc_hdr
1464 VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK,
1465 // Provided by VK_KHR_sampler_ycbcr_conversion
1466 VK_FORMAT_G8B8G8R8_422_UNORM_KHR = VK_FORMAT_G8B8G8R8_422_UNORM,
1467 // Provided by VK_KHR_sampler_ycbcr_conversion
1468 VK_FORMAT_B8G8R8G8_422_UNORM_KHR = VK_FORMAT_B8G8R8G8_422_UNORM,
1469 // Provided by VK_KHR_sampler_ycbcr_conversion
1470 VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR = VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM,
1471 // Provided by VK_KHR_sampler_ycbcr_conversion
1472 VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR = VK_FORMAT_G8_B8R8_2PLANE_420_UNORM,
1473 // Provided by VK_KHR_sampler_ycbcr_conversion
1474 VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR = VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM,
1475 // Provided by VK_KHR_sampler_ycbcr_conversion
1476 VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR = VK_FORMAT_G8_B8R8_2PLANE_422_UNORM,
1477 // Provided by VK_KHR_sampler_ycbcr_conversion
1478 VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR = VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM,
1479 // Provided by VK_KHR_sampler_ycbcr_conversion
1480 VK_FORMAT_R10X6_UNORM_PACK16_KHR = VK_FORMAT_R10X6_UNORM_PACK16,
1481 // Provided by VK_KHR_sampler_ycbcr_conversion
1482 VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR = VK_FORMAT_R10X6G10X6_UNORM_2PACK16,
1483 // Provided by VK_KHR_sampler_ycbcr_conversion
1484 VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR = VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16,
1485 // Provided by VK_KHR_sampler_ycbcr_conversion
1486 VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR = VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16,
1487 // Provided by VK_KHR_sampler_ycbcr_conversion
1488 VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR = VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16,
1489 // Provided by VK_KHR_sampler_ycbcr_conversion
1490 VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR = VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16,
1491 // Provided by VK_KHR_sampler_ycbcr_conversion
1492 VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16,
1493 // Provided by VK_KHR_sampler_ycbcr_conversion
1494 VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR = VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16,
1495 // Provided by VK_KHR_sampler_ycbcr_conversion
1496 VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16,
1497 // Provided by VK_KHR_sampler_ycbcr_conversion
1498 VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR = VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16,
1499 // Provided by VK_KHR_sampler_ycbcr_conversion
1500 VK_FORMAT_R12X4_UNORM_PACK16_KHR = VK_FORMAT_R12X4_UNORM_PACK16,
1501 // Provided by VK_KHR_sampler_ycbcr_conversion
1502 VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR = VK_FORMAT_R12X4G12X4_UNORM_2PACK16,
1503 // Provided by VK_KHR_sampler_ycbcr_conversion
1504 VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR = VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16,
1505 // Provided by VK_KHR_sampler_ycbcr_conversion
1506 VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR = VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16,
1507 // Provided by VK_KHR_sampler_ycbcr_conversion
1508 VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR = VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16,
1509 // Provided by VK_KHR_sampler_ycbcr_conversion
1510 VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR = VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16,
1511 // Provided by VK_KHR_sampler_ycbcr_conversion
1512 VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR = VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16,
1513 // Provided by VK_KHR_sampler_ycbcr_conversion
1514 VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR = VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16,
1515 // Provided by VK_KHR_sampler_ycbcr_conversion
1516 VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR = VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16,
1517 // Provided by VK_KHR_sampler_ycbcr_conversion
1518 VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR = VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16,
1519 // Provided by VK_KHR_sampler_ycbcr_conversion
1520 VK_FORMAT_G16B16G16R16_422_UNORM_KHR = VK_FORMAT_G16B16G16R16_422_UNORM,
1521 // Provided by VK_KHR_sampler_ycbcr_conversion
1522 VK_FORMAT_B16G16R16G16_422_UNORM_KHR = VK_FORMAT_B16G16R16G16_422_UNORM,
1523 // Provided by VK_KHR_sampler_ycbcr_conversion
1524 VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR = VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM,
1525 // Provided by VK_KHR_sampler_ycbcr_conversion
1526 VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR = VK_FORMAT_G16_B16R16_2PLANE_420_UNORM,
1527 // Provided by VK_KHR_sampler_ycbcr_conversion
1528 VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR = VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM,
1529 // Provided by VK_KHR_sampler_ycbcr_conversion
1530 VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR = VK_FORMAT_G16_B16R16_2PLANE_422_UNORM,
1531 // Provided by VK_KHR_sampler_ycbcr_conversion
1532 VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR = VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM,
1533 // Provided by VK_EXT_ycbcr_2plane_444_formats
1534 VK_FORMAT_G8_B8R8_2PLANE_444_UNORM_EXT = VK_FORMAT_G8_B8R8_2PLANE_444_UNORM,
1535 // Provided by VK_EXT_ycbcr_2plane_444_formats
1536 VK_FORMAT_G10X6_B10X6R10X6_2PLANE_444_UNORM_3PACK16_EXT = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_444_UNORM_3PACK16,
1537 // Provided by VK_EXT_ycbcr_2plane_444_formats
1538 VK_FORMAT_G12X4_B12X4R12X4_2PLANE_444_UNORM_3PACK16_EXT = VK_FORMAT_G12X4_B12X4R12X4_2PLANE_444_UNORM_3PACK16,
1539 // Provided by VK_EXT_ycbcr_2plane_444_formats
1540 VK_FORMAT_G16_B16R16_2PLANE_444_UNORM_EXT = VK_FORMAT_G16_B16R16_2PLANE_444_UNORM,
1541 // Provided by VK_EXT_4444_formats
1542 VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT = VK_FORMAT_A4R4G4B4_UNORM_PACK16,
1543 // Provided by VK_EXT_4444_formats
1544 VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT = VK_FORMAT_A4B4G4R4_UNORM_PACK16,
1545 // Provided by VK_NV_optical_flow
1546 // VK_FORMAT_R16G16_S10_5_NV is a deprecated alias
1547 VK_FORMAT_R16G16_S10_5_NV = VK_FORMAT_R16G16_SFIXED5_NV,
1548 // Provided by VK_KHR_maintenance5
1549 VK_FORMAT_A1B5G5R5_UNORM_PACK16_KHR = VK_FORMAT_A1B5G5R5_UNORM_PACK16,
1550 // Provided by VK_KHR_maintenance5
1551 VK_FORMAT_A8_UNORM_KHR = VK_FORMAT_A8_UNORM,
1552 } VkFormat;
1553 */