Logo

index : raylib-jai

---

  • summary
  • about
  • tree
  • log
  • branches
<< path: root/public/raylib-jai.git/html/Raylib/raylib/src/external/rl_gputex.h blob: 9c1092695146990b9dfb0fe569b4ef119fb9413e [raw] [clear marker]

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