Branch data Line data Source code
1 : : /**
2 : : * Loader generated by glad 2.0.8 on -
3 : : *
4 : : * SPDX-License-Identifier: (WTFPL OR CC0-1.0) AND Apache-2.0
5 : : *
6 : : * Generator: C/C++
7 : : * Specification: egl
8 : : * Extensions: 7
9 : : *
10 : : * APIs:
11 : : * - egl=1.5
12 : : *
13 : : * Options:
14 : : * - ALIAS = False
15 : : * - DEBUG = False
16 : : * - HEADER_ONLY = True
17 : : * - LOADER = True
18 : : * - MX = True
19 : : * - ON_DEMAND = False
20 : : *
21 : : * Commandline:
22 : : * --merge --api='egl=1.5' --extensions='EGL_EXT_image_dma_buf_import,EGL_EXT_image_dma_buf_import_modifiers,EGL_EXT_platform_base,EGL_KHR_debug,EGL_KHR_image_base,EGL_MESA_image_dma_buf_export,EGL_MESA_platform_surfaceless' c --header-only --loader --mx
23 : : *
24 : : * Online:
25 : : * http://glad.sh/#api=egl%3D1.5&extensions=EGL_EXT_image_dma_buf_import%2CEGL_EXT_image_dma_buf_import_modifiers%2CEGL_EXT_platform_base%2CEGL_KHR_debug%2CEGL_KHR_image_base%2CEGL_MESA_image_dma_buf_export%2CEGL_MESA_platform_surfaceless&generator=c&options=MERGE%2CHEADER_ONLY%2CLOADER%2CMX
26 : : *
27 : : */
28 : :
29 : : #ifndef GLAD_EGL_H_
30 : : #define GLAD_EGL_H_
31 : :
32 : :
33 : : #define GLAD_EGL
34 : : #define GLAD_OPTION_EGL_HEADER_ONLY
35 : : #define GLAD_OPTION_EGL_LOADER
36 : :
37 : : #ifdef __cplusplus
38 : : extern "C" {
39 : : #endif
40 : :
41 : : #ifndef GLAD_PLATFORM_H_
42 : : #define GLAD_PLATFORM_H_
43 : :
44 : : #ifndef GLAD_PLATFORM_WIN32
45 : : #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__)
46 : : #define GLAD_PLATFORM_WIN32 1
47 : : #else
48 : : #define GLAD_PLATFORM_WIN32 0
49 : : #endif
50 : : #endif
51 : :
52 : : #ifndef GLAD_PLATFORM_APPLE
53 : : #ifdef __APPLE__
54 : : #define GLAD_PLATFORM_APPLE 1
55 : : #else
56 : : #define GLAD_PLATFORM_APPLE 0
57 : : #endif
58 : : #endif
59 : :
60 : : #ifndef GLAD_PLATFORM_EMSCRIPTEN
61 : : #ifdef __EMSCRIPTEN__
62 : : #define GLAD_PLATFORM_EMSCRIPTEN 1
63 : : #else
64 : : #define GLAD_PLATFORM_EMSCRIPTEN 0
65 : : #endif
66 : : #endif
67 : :
68 : : #ifndef GLAD_PLATFORM_UWP
69 : : #if defined(_MSC_VER) && !defined(GLAD_INTERNAL_HAVE_WINAPIFAMILY)
70 : : #ifdef __has_include
71 : : #if __has_include(<winapifamily.h>)
72 : : #define GLAD_INTERNAL_HAVE_WINAPIFAMILY 1
73 : : #endif
74 : : #elif _MSC_VER >= 1700 && !_USING_V110_SDK71_
75 : : #define GLAD_INTERNAL_HAVE_WINAPIFAMILY 1
76 : : #endif
77 : : #endif
78 : :
79 : : #ifdef GLAD_INTERNAL_HAVE_WINAPIFAMILY
80 : : #include <winapifamily.h>
81 : : #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
82 : : #define GLAD_PLATFORM_UWP 1
83 : : #endif
84 : : #endif
85 : :
86 : : #ifndef GLAD_PLATFORM_UWP
87 : : #define GLAD_PLATFORM_UWP 0
88 : : #endif
89 : : #endif
90 : :
91 : : #ifdef __GNUC__
92 : : #define GLAD_GNUC_EXTENSION __extension__
93 : : #else
94 : : #define GLAD_GNUC_EXTENSION
95 : : #endif
96 : :
97 : : #define GLAD_UNUSED(x) (void)(x)
98 : :
99 : : #ifndef GLAD_API_CALL
100 : : #if defined(GLAD_API_CALL_EXPORT)
101 : : #if GLAD_PLATFORM_WIN32 || defined(__CYGWIN__)
102 : : #if defined(GLAD_API_CALL_EXPORT_BUILD)
103 : : #if defined(__GNUC__)
104 : : #define GLAD_API_CALL __attribute__ ((dllexport)) extern
105 : : #else
106 : : #define GLAD_API_CALL __declspec(dllexport) extern
107 : : #endif
108 : : #else
109 : : #if defined(__GNUC__)
110 : : #define GLAD_API_CALL __attribute__ ((dllimport)) extern
111 : : #else
112 : : #define GLAD_API_CALL __declspec(dllimport) extern
113 : : #endif
114 : : #endif
115 : : #elif defined(__GNUC__) && defined(GLAD_API_CALL_EXPORT_BUILD)
116 : : #define GLAD_API_CALL __attribute__ ((visibility ("default"))) extern
117 : : #else
118 : : #define GLAD_API_CALL extern
119 : : #endif
120 : : #else
121 : : #define GLAD_API_CALL extern
122 : : #endif
123 : : #endif
124 : :
125 : : #ifdef APIENTRY
126 : : #define GLAD_API_PTR APIENTRY
127 : : #elif GLAD_PLATFORM_WIN32
128 : : #define GLAD_API_PTR __stdcall
129 : : #else
130 : : #define GLAD_API_PTR
131 : : #endif
132 : :
133 : : #ifndef GLAPI
134 : : #define GLAPI GLAD_API_CALL
135 : : #endif
136 : :
137 : : #ifndef GLAPIENTRY
138 : : #define GLAPIENTRY GLAD_API_PTR
139 : : #endif
140 : :
141 : : #define GLAD_MAKE_VERSION(major, minor) (major * 10000 + minor)
142 : : #define GLAD_VERSION_MAJOR(version) (version / 10000)
143 : : #define GLAD_VERSION_MINOR(version) (version % 10000)
144 : :
145 : : #define GLAD_GENERATOR_VERSION "2.0.8"
146 : :
147 : : typedef void (*GLADapiproc)(void);
148 : :
149 : : typedef GLADapiproc (*GLADloadfunc)(const char *name);
150 : : typedef GLADapiproc (*GLADuserptrloadfunc)(void *userptr, const char *name);
151 : :
152 : : typedef void (*GLADprecallback)(const char *name, GLADapiproc apiproc, int len_args, ...);
153 : : typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apiproc, int len_args, ...);
154 : :
155 : : #endif /* GLAD_PLATFORM_H_ */
156 : :
157 : : #define EGL_ALPHA_FORMAT 0x3088
158 : : #define EGL_ALPHA_FORMAT_NONPRE 0x308B
159 : : #define EGL_ALPHA_FORMAT_PRE 0x308C
160 : : #define EGL_ALPHA_MASK_SIZE 0x303E
161 : : #define EGL_ALPHA_SIZE 0x3021
162 : : #define EGL_BACK_BUFFER 0x3084
163 : : #define EGL_BAD_ACCESS 0x3002
164 : : #define EGL_BAD_ALLOC 0x3003
165 : : #define EGL_BAD_ATTRIBUTE 0x3004
166 : : #define EGL_BAD_CONFIG 0x3005
167 : : #define EGL_BAD_CONTEXT 0x3006
168 : : #define EGL_BAD_CURRENT_SURFACE 0x3007
169 : : #define EGL_BAD_DISPLAY 0x3008
170 : : #define EGL_BAD_MATCH 0x3009
171 : : #define EGL_BAD_NATIVE_PIXMAP 0x300A
172 : : #define EGL_BAD_NATIVE_WINDOW 0x300B
173 : : #define EGL_BAD_PARAMETER 0x300C
174 : : #define EGL_BAD_SURFACE 0x300D
175 : : #define EGL_BIND_TO_TEXTURE_RGB 0x3039
176 : : #define EGL_BIND_TO_TEXTURE_RGBA 0x303A
177 : : #define EGL_BLUE_SIZE 0x3022
178 : : #define EGL_BUFFER_DESTROYED 0x3095
179 : : #define EGL_BUFFER_PRESERVED 0x3094
180 : : #define EGL_BUFFER_SIZE 0x3020
181 : : #define EGL_CLIENT_APIS 0x308D
182 : : #define EGL_CL_EVENT_HANDLE 0x309C
183 : : #define EGL_COLORSPACE 0x3087
184 : : #define EGL_COLORSPACE_LINEAR 0x308A
185 : : #define EGL_COLORSPACE_sRGB 0x3089
186 : : #define EGL_COLOR_BUFFER_TYPE 0x303F
187 : : #define EGL_CONDITION_SATISFIED 0x30F6
188 : : #define EGL_CONFIG_CAVEAT 0x3027
189 : : #define EGL_CONFIG_ID 0x3028
190 : : #define EGL_CONFORMANT 0x3042
191 : : #define EGL_CONTEXT_CLIENT_TYPE 0x3097
192 : : #define EGL_CONTEXT_CLIENT_VERSION 0x3098
193 : : #define EGL_CONTEXT_LOST 0x300E
194 : : #define EGL_CONTEXT_MAJOR_VERSION 0x3098
195 : : #define EGL_CONTEXT_MINOR_VERSION 0x30FB
196 : : #define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002
197 : : #define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001
198 : : #define EGL_CONTEXT_OPENGL_DEBUG 0x31B0
199 : : #define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1
200 : : #define EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD
201 : : #define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD
202 : : #define EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2
203 : : #define EGL_CORE_NATIVE_ENGINE 0x305B
204 : : #define EGL_DEBUG_CALLBACK_KHR 0x33B8
205 : : #define EGL_DEBUG_MSG_CRITICAL_KHR 0x33B9
206 : : #define EGL_DEBUG_MSG_ERROR_KHR 0x33BA
207 : : #define EGL_DEBUG_MSG_INFO_KHR 0x33BC
208 : : #define EGL_DEBUG_MSG_WARN_KHR 0x33BB
209 : : #define EGL_DEFAULT_DISPLAY EGL_CAST(EGLNativeDisplayType,0)
210 : : #define EGL_DEPTH_SIZE 0x3025
211 : : #define EGL_DISPLAY_SCALING 10000
212 : : #define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272
213 : : #define EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT 0x3444
214 : : #define EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT 0x3443
215 : : #define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273
216 : : #define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274
217 : : #define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275
218 : : #define EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT 0x3446
219 : : #define EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT 0x3445
220 : : #define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276
221 : : #define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277
222 : : #define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278
223 : : #define EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT 0x3448
224 : : #define EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT 0x3447
225 : : #define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279
226 : : #define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
227 : : #define EGL_DMA_BUF_PLANE3_FD_EXT 0x3440
228 : : #define EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT 0x344A
229 : : #define EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT 0x3449
230 : : #define EGL_DMA_BUF_PLANE3_OFFSET_EXT 0x3441
231 : : #define EGL_DMA_BUF_PLANE3_PITCH_EXT 0x3442
232 : : #define EGL_DONT_CARE EGL_CAST(EGLint,-1)
233 : : #define EGL_DRAW 0x3059
234 : : #define EGL_EXTENSIONS 0x3055
235 : : #define EGL_FALSE 0
236 : : #define EGL_FOREVER 0xFFFFFFFFFFFFFFFF
237 : : #define EGL_GL_COLORSPACE 0x309D
238 : : #define EGL_GL_COLORSPACE_LINEAR 0x308A
239 : : #define EGL_GL_COLORSPACE_SRGB 0x3089
240 : : #define EGL_GL_RENDERBUFFER 0x30B9
241 : : #define EGL_GL_TEXTURE_2D 0x30B1
242 : : #define EGL_GL_TEXTURE_3D 0x30B2
243 : : #define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4
244 : : #define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6
245 : : #define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8
246 : : #define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3
247 : : #define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5
248 : : #define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7
249 : : #define EGL_GL_TEXTURE_LEVEL 0x30BC
250 : : #define EGL_GL_TEXTURE_ZOFFSET 0x30BD
251 : : #define EGL_GREEN_SIZE 0x3023
252 : : #define EGL_HEIGHT 0x3056
253 : : #define EGL_HORIZONTAL_RESOLUTION 0x3090
254 : : #define EGL_IMAGE_PRESERVED 0x30D2
255 : : #define EGL_IMAGE_PRESERVED_KHR 0x30D2
256 : : #define EGL_ITU_REC2020_EXT 0x3281
257 : : #define EGL_ITU_REC601_EXT 0x327F
258 : : #define EGL_ITU_REC709_EXT 0x3280
259 : : #define EGL_LARGEST_PBUFFER 0x3058
260 : : #define EGL_LEVEL 0x3029
261 : : #define EGL_LINUX_DMA_BUF_EXT 0x3270
262 : : #define EGL_LINUX_DRM_FOURCC_EXT 0x3271
263 : : #define EGL_LOSE_CONTEXT_ON_RESET 0x31BF
264 : : #define EGL_LUMINANCE_BUFFER 0x308F
265 : : #define EGL_LUMINANCE_SIZE 0x303D
266 : : #define EGL_MATCH_NATIVE_PIXMAP 0x3041
267 : : #define EGL_MAX_PBUFFER_HEIGHT 0x302A
268 : : #define EGL_MAX_PBUFFER_PIXELS 0x302B
269 : : #define EGL_MAX_PBUFFER_WIDTH 0x302C
270 : : #define EGL_MAX_SWAP_INTERVAL 0x303C
271 : : #define EGL_MIN_SWAP_INTERVAL 0x303B
272 : : #define EGL_MIPMAP_LEVEL 0x3083
273 : : #define EGL_MIPMAP_TEXTURE 0x3082
274 : : #define EGL_MULTISAMPLE_RESOLVE 0x3099
275 : : #define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B
276 : : #define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200
277 : : #define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A
278 : : #define EGL_NATIVE_RENDERABLE 0x302D
279 : : #define EGL_NATIVE_VISUAL_ID 0x302E
280 : : #define EGL_NATIVE_VISUAL_TYPE 0x302F
281 : : #define EGL_NONE 0x3038
282 : : #define EGL_NON_CONFORMANT_CONFIG 0x3051
283 : : #define EGL_NOT_INITIALIZED 0x3001
284 : : #define EGL_NO_CONTEXT EGL_CAST(EGLContext,0)
285 : : #define EGL_NO_DISPLAY EGL_CAST(EGLDisplay,0)
286 : : #define EGL_NO_IMAGE EGL_CAST(EGLImage,0)
287 : : #define EGL_NO_IMAGE_KHR EGL_CAST(EGLImageKHR,0)
288 : : #define EGL_NO_RESET_NOTIFICATION 0x31BE
289 : : #define EGL_NO_SURFACE EGL_CAST(EGLSurface,0)
290 : : #define EGL_NO_SYNC EGL_CAST(EGLSync,0)
291 : : #define EGL_NO_TEXTURE 0x305C
292 : : #define EGL_OBJECT_CONTEXT_KHR 0x33B2
293 : : #define EGL_OBJECT_DISPLAY_KHR 0x33B1
294 : : #define EGL_OBJECT_IMAGE_KHR 0x33B4
295 : : #define EGL_OBJECT_STREAM_KHR 0x33B6
296 : : #define EGL_OBJECT_SURFACE_KHR 0x33B3
297 : : #define EGL_OBJECT_SYNC_KHR 0x33B5
298 : : #define EGL_OBJECT_THREAD_KHR 0x33B0
299 : : #define EGL_OPENGL_API 0x30A2
300 : : #define EGL_OPENGL_BIT 0x0008
301 : : #define EGL_OPENGL_ES2_BIT 0x0004
302 : : #define EGL_OPENGL_ES3_BIT 0x00000040
303 : : #define EGL_OPENGL_ES_API 0x30A0
304 : : #define EGL_OPENGL_ES_BIT 0x0001
305 : : #define EGL_OPENVG_API 0x30A1
306 : : #define EGL_OPENVG_BIT 0x0002
307 : : #define EGL_OPENVG_IMAGE 0x3096
308 : : #define EGL_PBUFFER_BIT 0x0001
309 : : #define EGL_PIXEL_ASPECT_RATIO 0x3092
310 : : #define EGL_PIXMAP_BIT 0x0002
311 : : #define EGL_PLATFORM_SURFACELESS_MESA 0x31DD
312 : : #define EGL_READ 0x305A
313 : : #define EGL_RED_SIZE 0x3024
314 : : #define EGL_RENDERABLE_TYPE 0x3040
315 : : #define EGL_RENDER_BUFFER 0x3086
316 : : #define EGL_RGB_BUFFER 0x308E
317 : : #define EGL_SAMPLES 0x3031
318 : : #define EGL_SAMPLE_BUFFERS 0x3032
319 : : #define EGL_SAMPLE_RANGE_HINT_EXT 0x327C
320 : : #define EGL_SIGNALED 0x30F2
321 : : #define EGL_SINGLE_BUFFER 0x3085
322 : : #define EGL_SLOW_CONFIG 0x3050
323 : : #define EGL_STENCIL_SIZE 0x3026
324 : : #define EGL_SUCCESS 0x3000
325 : : #define EGL_SURFACE_TYPE 0x3033
326 : : #define EGL_SWAP_BEHAVIOR 0x3093
327 : : #define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400
328 : : #define EGL_SYNC_CL_EVENT 0x30FE
329 : : #define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF
330 : : #define EGL_SYNC_CONDITION 0x30F8
331 : : #define EGL_SYNC_FENCE 0x30F9
332 : : #define EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001
333 : : #define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0
334 : : #define EGL_SYNC_STATUS 0x30F1
335 : : #define EGL_SYNC_TYPE 0x30F7
336 : : #define EGL_TEXTURE_2D 0x305F
337 : : #define EGL_TEXTURE_FORMAT 0x3080
338 : : #define EGL_TEXTURE_RGB 0x305D
339 : : #define EGL_TEXTURE_RGBA 0x305E
340 : : #define EGL_TEXTURE_TARGET 0x3081
341 : : #define EGL_TIMEOUT_EXPIRED 0x30F5
342 : : #define EGL_TRANSPARENT_BLUE_VALUE 0x3035
343 : : #define EGL_TRANSPARENT_GREEN_VALUE 0x3036
344 : : #define EGL_TRANSPARENT_RED_VALUE 0x3037
345 : : #define EGL_TRANSPARENT_RGB 0x3052
346 : : #define EGL_TRANSPARENT_TYPE 0x3034
347 : : #define EGL_TRUE 1
348 : : #define EGL_UNKNOWN EGL_CAST(EGLint,-1)
349 : : #define EGL_UNSIGNALED 0x30F3
350 : : #define EGL_VENDOR 0x3053
351 : : #define EGL_VERSION 0x3054
352 : : #define EGL_VERTICAL_RESOLUTION 0x3091
353 : : #define EGL_VG_ALPHA_FORMAT 0x3088
354 : : #define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B
355 : : #define EGL_VG_ALPHA_FORMAT_PRE 0x308C
356 : : #define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040
357 : : #define EGL_VG_COLORSPACE 0x3087
358 : : #define EGL_VG_COLORSPACE_LINEAR 0x308A
359 : : #define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020
360 : : #define EGL_VG_COLORSPACE_sRGB 0x3089
361 : : #define EGL_WIDTH 0x3057
362 : : #define EGL_WINDOW_BIT 0x0004
363 : : #define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
364 : : #define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285
365 : : #define EGL_YUV_CHROMA_SITING_0_EXT 0x3284
366 : : #define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
367 : : #define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B
368 : : #define EGL_YUV_FULL_RANGE_EXT 0x3282
369 : : #define EGL_YUV_NARROW_RANGE_EXT 0x3283
370 : :
371 : :
372 : : #ifndef __khrplatform_h_
373 : : #define __khrplatform_h_
374 : :
375 : : /*
376 : : ** Copyright (c) 2008-2018 The Khronos Group Inc.
377 : : **
378 : : ** Permission is hereby granted, free of charge, to any person obtaining a
379 : : ** copy of this software and/or associated documentation files (the
380 : : ** "Materials"), to deal in the Materials without restriction, including
381 : : ** without limitation the rights to use, copy, modify, merge, publish,
382 : : ** distribute, sublicense, and/or sell copies of the Materials, and to
383 : : ** permit persons to whom the Materials are furnished to do so, subject to
384 : : ** the following conditions:
385 : : **
386 : : ** The above copyright notice and this permission notice shall be included
387 : : ** in all copies or substantial portions of the Materials.
388 : : **
389 : : ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
390 : : ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
391 : : ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
392 : : ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
393 : : ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
394 : : ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
395 : : ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
396 : : */
397 : :
398 : : /* Khronos platform-specific types and definitions.
399 : : *
400 : : * The master copy of khrplatform.h is maintained in the Khronos EGL
401 : : * Registry repository at https://github.com/KhronosGroup/EGL-Registry
402 : : * The last semantic modification to khrplatform.h was at commit ID:
403 : : * 67a3e0864c2d75ea5287b9f3d2eb74a745936692
404 : : *
405 : : * Adopters may modify this file to suit their platform. Adopters are
406 : : * encouraged to submit platform specific modifications to the Khronos
407 : : * group so that they can be included in future versions of this file.
408 : : * Please submit changes by filing pull requests or issues on
409 : : * the EGL Registry repository linked above.
410 : : *
411 : : *
412 : : * See the Implementer's Guidelines for information about where this file
413 : : * should be located on your system and for more details of its use:
414 : : * http://www.khronos.org/registry/implementers_guide.pdf
415 : : *
416 : : * This file should be included as
417 : : * #include <KHR/khrplatform.h>
418 : : * by Khronos client API header files that use its types and defines.
419 : : *
420 : : * The types in khrplatform.h should only be used to define API-specific types.
421 : : *
422 : : * Types defined in khrplatform.h:
423 : : * khronos_int8_t signed 8 bit
424 : : * khronos_uint8_t unsigned 8 bit
425 : : * khronos_int16_t signed 16 bit
426 : : * khronos_uint16_t unsigned 16 bit
427 : : * khronos_int32_t signed 32 bit
428 : : * khronos_uint32_t unsigned 32 bit
429 : : * khronos_int64_t signed 64 bit
430 : : * khronos_uint64_t unsigned 64 bit
431 : : * khronos_intptr_t signed same number of bits as a pointer
432 : : * khronos_uintptr_t unsigned same number of bits as a pointer
433 : : * khronos_ssize_t signed size
434 : : * khronos_usize_t unsigned size
435 : : * khronos_float_t signed 32 bit floating point
436 : : * khronos_time_ns_t unsigned 64 bit time in nanoseconds
437 : : * khronos_utime_nanoseconds_t unsigned time interval or absolute time in
438 : : * nanoseconds
439 : : * khronos_stime_nanoseconds_t signed time interval in nanoseconds
440 : : * khronos_boolean_enum_t enumerated boolean type. This should
441 : : * only be used as a base type when a client API's boolean type is
442 : : * an enum. Client APIs which use an integer or other type for
443 : : * booleans cannot use this as the base type for their boolean.
444 : : *
445 : : * Tokens defined in khrplatform.h:
446 : : *
447 : : * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
448 : : *
449 : : * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
450 : : * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
451 : : *
452 : : * Calling convention macros defined in this file:
453 : : * KHRONOS_APICALL
454 : : * KHRONOS_GLAD_API_PTR
455 : : * KHRONOS_APIATTRIBUTES
456 : : *
457 : : * These may be used in function prototypes as:
458 : : *
459 : : * KHRONOS_APICALL void KHRONOS_GLAD_API_PTR funcname(
460 : : * int arg1,
461 : : * int arg2) KHRONOS_APIATTRIBUTES;
462 : : */
463 : :
464 : : #if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)
465 : : # define KHRONOS_STATIC 1
466 : : #endif
467 : :
468 : : /*-------------------------------------------------------------------------
469 : : * Definition of KHRONOS_APICALL
470 : : *-------------------------------------------------------------------------
471 : : * This precedes the return type of the function in the function prototype.
472 : : */
473 : : #if defined(KHRONOS_STATIC)
474 : : /* If the preprocessor constant KHRONOS_STATIC is defined, make the
475 : : * header compatible with static linking. */
476 : : # define KHRONOS_APICALL
477 : : #elif defined(_WIN32)
478 : : # define KHRONOS_APICALL __declspec(dllimport)
479 : : #elif defined (__SYMBIAN32__)
480 : : # define KHRONOS_APICALL IMPORT_C
481 : : #elif defined(__ANDROID__)
482 : : # define KHRONOS_APICALL __attribute__((visibility("default")))
483 : : #else
484 : : # define KHRONOS_APICALL
485 : : #endif
486 : :
487 : : /*-------------------------------------------------------------------------
488 : : * Definition of KHRONOS_GLAD_API_PTR
489 : : *-------------------------------------------------------------------------
490 : : * This follows the return type of the function and precedes the function
491 : : * name in the function prototype.
492 : : */
493 : : #if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
494 : : /* Win32 but not WinCE */
495 : : # define KHRONOS_GLAD_API_PTR __stdcall
496 : : #else
497 : : # define KHRONOS_GLAD_API_PTR
498 : : #endif
499 : :
500 : : /*-------------------------------------------------------------------------
501 : : * Definition of KHRONOS_APIATTRIBUTES
502 : : *-------------------------------------------------------------------------
503 : : * This follows the closing parenthesis of the function prototype arguments.
504 : : */
505 : : #if defined (__ARMCC_2__)
506 : : #define KHRONOS_APIATTRIBUTES __softfp
507 : : #else
508 : : #define KHRONOS_APIATTRIBUTES
509 : : #endif
510 : :
511 : : /*-------------------------------------------------------------------------
512 : : * basic type definitions
513 : : *-----------------------------------------------------------------------*/
514 : : #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
515 : :
516 : :
517 : : /*
518 : : * Using <stdint.h>
519 : : */
520 : : #include <stdint.h>
521 : : typedef int32_t khronos_int32_t;
522 : : typedef uint32_t khronos_uint32_t;
523 : : typedef int64_t khronos_int64_t;
524 : : typedef uint64_t khronos_uint64_t;
525 : : #define KHRONOS_SUPPORT_INT64 1
526 : : #define KHRONOS_SUPPORT_FLOAT 1
527 : : /*
528 : : * To support platform where unsigned long cannot be used interchangeably with
529 : : * inptr_t (e.g. CHERI-extended ISAs), we can use the stdint.h intptr_t.
530 : : * Ideally, we could just use (u)intptr_t everywhere, but this could result in
531 : : * ABI breakage if khronos_uintptr_t is changed from unsigned long to
532 : : * unsigned long long or similar (this results in different C++ name mangling).
533 : : * To avoid changes for existing platforms, we restrict usage of intptr_t to
534 : : * platforms where the size of a pointer is larger than the size of long.
535 : : */
536 : : #if defined(__SIZEOF_LONG__) && defined(__SIZEOF_POINTER__)
537 : : #if __SIZEOF_POINTER__ > __SIZEOF_LONG__
538 : : #define KHRONOS_USE_INTPTR_T
539 : : #endif
540 : : #endif
541 : :
542 : : #elif defined(__VMS ) || defined(__sgi)
543 : :
544 : : /*
545 : : * Using <inttypes.h>
546 : : */
547 : : #include <inttypes.h>
548 : : typedef int32_t khronos_int32_t;
549 : : typedef uint32_t khronos_uint32_t;
550 : : typedef int64_t khronos_int64_t;
551 : : typedef uint64_t khronos_uint64_t;
552 : : #define KHRONOS_SUPPORT_INT64 1
553 : : #define KHRONOS_SUPPORT_FLOAT 1
554 : :
555 : : #elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
556 : :
557 : : /*
558 : : * Win32
559 : : */
560 : : typedef __int32 khronos_int32_t;
561 : : typedef unsigned __int32 khronos_uint32_t;
562 : : typedef __int64 khronos_int64_t;
563 : : typedef unsigned __int64 khronos_uint64_t;
564 : : #define KHRONOS_SUPPORT_INT64 1
565 : : #define KHRONOS_SUPPORT_FLOAT 1
566 : :
567 : : #elif defined(__sun__) || defined(__digital__)
568 : :
569 : : /*
570 : : * Sun or Digital
571 : : */
572 : : typedef int khronos_int32_t;
573 : : typedef unsigned int khronos_uint32_t;
574 : : #if defined(__arch64__) || defined(_LP64)
575 : : typedef long int khronos_int64_t;
576 : : typedef unsigned long int khronos_uint64_t;
577 : : #else
578 : : typedef long long int khronos_int64_t;
579 : : typedef unsigned long long int khronos_uint64_t;
580 : : #endif /* __arch64__ */
581 : : #define KHRONOS_SUPPORT_INT64 1
582 : : #define KHRONOS_SUPPORT_FLOAT 1
583 : :
584 : : #elif 0
585 : :
586 : : /*
587 : : * Hypothetical platform with no float or int64 support
588 : : */
589 : : typedef int khronos_int32_t;
590 : : typedef unsigned int khronos_uint32_t;
591 : : #define KHRONOS_SUPPORT_INT64 0
592 : : #define KHRONOS_SUPPORT_FLOAT 0
593 : :
594 : : #else
595 : :
596 : : /*
597 : : * Generic fallback
598 : : */
599 : : #include <stdint.h>
600 : : typedef int32_t khronos_int32_t;
601 : : typedef uint32_t khronos_uint32_t;
602 : : typedef int64_t khronos_int64_t;
603 : : typedef uint64_t khronos_uint64_t;
604 : : #define KHRONOS_SUPPORT_INT64 1
605 : : #define KHRONOS_SUPPORT_FLOAT 1
606 : :
607 : : #endif
608 : :
609 : :
610 : : /*
611 : : * Types that are (so far) the same on all platforms
612 : : */
613 : : typedef signed char khronos_int8_t;
614 : : typedef unsigned char khronos_uint8_t;
615 : : typedef signed short int khronos_int16_t;
616 : : typedef unsigned short int khronos_uint16_t;
617 : :
618 : : /*
619 : : * Types that differ between LLP64 and LP64 architectures - in LLP64,
620 : : * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
621 : : * to be the only LLP64 architecture in current use.
622 : : */
623 : : #ifdef KHRONOS_USE_INTPTR_T
624 : : typedef intptr_t khronos_intptr_t;
625 : : typedef uintptr_t khronos_uintptr_t;
626 : : #elif defined(_WIN64)
627 : : typedef signed long long int khronos_intptr_t;
628 : : typedef unsigned long long int khronos_uintptr_t;
629 : : #else
630 : : typedef signed long int khronos_intptr_t;
631 : : typedef unsigned long int khronos_uintptr_t;
632 : : #endif
633 : :
634 : : #if defined(_WIN64)
635 : : typedef signed long long int khronos_ssize_t;
636 : : typedef unsigned long long int khronos_usize_t;
637 : : #else
638 : : typedef signed long int khronos_ssize_t;
639 : : typedef unsigned long int khronos_usize_t;
640 : : #endif
641 : :
642 : : #if KHRONOS_SUPPORT_FLOAT
643 : : /*
644 : : * Float type
645 : : */
646 : : typedef float khronos_float_t;
647 : : #endif
648 : :
649 : : #if KHRONOS_SUPPORT_INT64
650 : : /* Time types
651 : : *
652 : : * These types can be used to represent a time interval in nanoseconds or
653 : : * an absolute Unadjusted System Time. Unadjusted System Time is the number
654 : : * of nanoseconds since some arbitrary system event (e.g. since the last
655 : : * time the system booted). The Unadjusted System Time is an unsigned
656 : : * 64 bit value that wraps back to 0 every 584 years. Time intervals
657 : : * may be either signed or unsigned.
658 : : */
659 : : typedef khronos_uint64_t khronos_utime_nanoseconds_t;
660 : : typedef khronos_int64_t khronos_stime_nanoseconds_t;
661 : : #endif
662 : :
663 : : /*
664 : : * Dummy value used to pad enum types to 32 bits.
665 : : */
666 : : #ifndef KHRONOS_MAX_ENUM
667 : : #define KHRONOS_MAX_ENUM 0x7FFFFFFF
668 : : #endif
669 : :
670 : : /*
671 : : * Enumerated boolean type
672 : : *
673 : : * Values other than zero should be considered to be true. Therefore
674 : : * comparisons should not be made against KHRONOS_TRUE.
675 : : */
676 : : typedef enum {
677 : : KHRONOS_FALSE = 0,
678 : : KHRONOS_TRUE = 1,
679 : : KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
680 : : } khronos_boolean_enum_t;
681 : :
682 : : #endif /* __khrplatform_h_ */
683 : : #ifndef __eglplatform_h_
684 : : #define __eglplatform_h_
685 : :
686 : : /*
687 : : ** Copyright 2007-2020 The Khronos Group Inc.
688 : : ** SPDX-License-Identifier: Apache-2.0
689 : : */
690 : :
691 : : /* Platform-specific types and definitions for egl.h
692 : : *
693 : : * Adopters may modify khrplatform.h and this file to suit their platform.
694 : : * You are encouraged to submit all modifications to the Khronos group so that
695 : : * they can be included in future versions of this file. Please submit changes
696 : : * by filing an issue or pull request on the public Khronos EGL Registry, at
697 : : * https://www.github.com/KhronosGroup/EGL-Registry/
698 : : */
699 : :
700 : : /* #include <KHR/khrplatform.h> */
701 : :
702 : : /* Macros used in EGL function prototype declarations.
703 : : *
704 : : * EGL functions should be prototyped as:
705 : : *
706 : : * EGLAPI return-type EGLGLAD_API_PTR eglFunction(arguments);
707 : : * typedef return-type (EXPGLAD_API_PTRP PFNEGLFUNCTIONPROC) (arguments);
708 : : *
709 : : * KHRONOS_APICALL and KHRONOS_GLAD_API_PTR are defined in KHR/khrplatform.h
710 : : */
711 : :
712 : : #ifndef EGLAPI
713 : : #define EGLAPI KHRONOS_APICALL
714 : : #endif
715 : :
716 : : #ifndef EGLGLAD_API_PTR
717 : : #define EGLGLAD_API_PTR KHRONOS_GLAD_API_PTR
718 : : #endif
719 : : #define EGLGLAD_API_PTRP EGLGLAD_API_PTR*
720 : :
721 : : /* The types NativeDisplayType, NativeWindowType, and NativePixmapType
722 : : * are aliases of window-system-dependent types, such as X Display * or
723 : : * Windows Device Context. They must be defined in platform-specific
724 : : * code below. The EGL-prefixed versions of Native*Type are the same
725 : : * types, renamed in EGL 1.3 so all types in the API start with "EGL".
726 : : *
727 : : * Khronos STRONGLY RECOMMENDS that you use the default definitions
728 : : * provided below, since these changes affect both binary and source
729 : : * portability of applications using EGL running on different EGL
730 : : * implementations.
731 : : */
732 : :
733 : : #if defined(EGL_NO_PLATFORM_SPECIFIC_TYPES)
734 : :
735 : : typedef void *EGLNativeDisplayType;
736 : : typedef void *EGLNativePixmapType;
737 : : typedef void *EGLNativeWindowType;
738 : :
739 : : #elif defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
740 : : #ifndef WIN32_LEAN_AND_MEAN
741 : : #define WIN32_LEAN_AND_MEAN 1
742 : : #endif
743 : : #include <windows.h>
744 : :
745 : : typedef HDC EGLNativeDisplayType;
746 : : typedef HBITMAP EGLNativePixmapType;
747 : : typedef HWND EGLNativeWindowType;
748 : :
749 : : #elif defined(__QNX__)
750 : :
751 : : typedef khronos_uintptr_t EGLNativeDisplayType;
752 : : typedef struct _screen_pixmap* EGLNativePixmapType; /* screen_pixmap_t */
753 : : typedef struct _screen_window* EGLNativeWindowType; /* screen_window_t */
754 : :
755 : : #elif defined(__EMSCRIPTEN__)
756 : :
757 : : typedef int EGLNativeDisplayType;
758 : : typedef int EGLNativePixmapType;
759 : : typedef int EGLNativeWindowType;
760 : :
761 : : #elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
762 : :
763 : : typedef int EGLNativeDisplayType;
764 : : typedef void *EGLNativePixmapType;
765 : : typedef void *EGLNativeWindowType;
766 : :
767 : : #elif defined(WL_EGL_PLATFORM)
768 : :
769 : : typedef struct wl_display *EGLNativeDisplayType;
770 : : typedef struct wl_egl_pixmap *EGLNativePixmapType;
771 : : typedef struct wl_egl_window *EGLNativeWindowType;
772 : :
773 : : #elif defined(__GBM__)
774 : :
775 : : typedef struct gbm_device *EGLNativeDisplayType;
776 : : typedef struct gbm_bo *EGLNativePixmapType;
777 : : typedef void *EGLNativeWindowType;
778 : :
779 : : #elif defined(__ANDROID__) || defined(ANDROID)
780 : :
781 : : struct ANativeWindow;
782 : : struct egl_native_pixmap_t;
783 : :
784 : : typedef void* EGLNativeDisplayType;
785 : : typedef struct egl_native_pixmap_t* EGLNativePixmapType;
786 : : typedef struct ANativeWindow* EGLNativeWindowType;
787 : :
788 : : #elif defined(USE_OZONE)
789 : :
790 : : typedef intptr_t EGLNativeDisplayType;
791 : : typedef intptr_t EGLNativePixmapType;
792 : : typedef intptr_t EGLNativeWindowType;
793 : :
794 : : #elif defined(USE_X11)
795 : :
796 : : /* X11 (tentative) */
797 : : #include <X11/Xlib.h>
798 : : #include <X11/Xutil.h>
799 : :
800 : : typedef Display *EGLNativeDisplayType;
801 : : typedef Pixmap EGLNativePixmapType;
802 : : typedef Window EGLNativeWindowType;
803 : :
804 : : #elif defined(__unix__)
805 : :
806 : : typedef void *EGLNativeDisplayType;
807 : : typedef khronos_uintptr_t EGLNativePixmapType;
808 : : typedef khronos_uintptr_t EGLNativeWindowType;
809 : :
810 : : #elif defined(__APPLE__)
811 : :
812 : : typedef int EGLNativeDisplayType;
813 : : typedef void *EGLNativePixmapType;
814 : : typedef void *EGLNativeWindowType;
815 : :
816 : : #elif defined(__HAIKU__)
817 : :
818 : : #include <kernel/image.h>
819 : :
820 : : typedef void *EGLNativeDisplayType;
821 : : typedef khronos_uintptr_t EGLNativePixmapType;
822 : : typedef khronos_uintptr_t EGLNativeWindowType;
823 : :
824 : : #elif defined(__Fuchsia__)
825 : :
826 : : typedef void *EGLNativeDisplayType;
827 : : typedef khronos_uintptr_t EGLNativePixmapType;
828 : : typedef khronos_uintptr_t EGLNativeWindowType;
829 : :
830 : : #else
831 : : #error "Platform not recognized"
832 : : #endif
833 : :
834 : : /* EGL 1.2 types, renamed for consistency in EGL 1.3 */
835 : : typedef EGLNativeDisplayType NativeDisplayType;
836 : : typedef EGLNativePixmapType NativePixmapType;
837 : : typedef EGLNativeWindowType NativeWindowType;
838 : :
839 : :
840 : : /* Define EGLint. This must be a signed integral type large enough to contain
841 : : * all legal attribute names and values passed into and out of EGL, whether
842 : : * their type is boolean, bitmask, enumerant (symbolic constant), integer,
843 : : * handle, or other. While in general a 32-bit integer will suffice, if
844 : : * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
845 : : * integer type.
846 : : */
847 : : typedef khronos_int32_t EGLint;
848 : :
849 : :
850 : : /* C++ / C typecast macros for special EGL handle values */
851 : : #if defined(__cplusplus)
852 : : #define EGL_CAST(type, value) (static_cast<type>(value))
853 : : #else
854 : : #define EGL_CAST(type, value) ((type) (value))
855 : : #endif
856 : :
857 : : #endif /* __eglplatform_h */
858 : :
859 : :
860 : :
861 : :
862 : :
863 : :
864 : :
865 : :
866 : :
867 : :
868 : :
869 : : struct AHardwareBuffer;
870 : : struct wl_buffer;
871 : : struct wl_display;
872 : : struct wl_resource;
873 : :
874 : : typedef unsigned int EGLBoolean;
875 : : typedef unsigned int EGLenum;
876 : : typedef intptr_t EGLAttribKHR;
877 : : typedef intptr_t EGLAttrib;
878 : : typedef void *EGLClientBuffer;
879 : : typedef void *EGLConfig;
880 : : typedef void *EGLContext;
881 : : typedef void *EGLDeviceEXT;
882 : : typedef void *EGLDisplay;
883 : : typedef void *EGLImage;
884 : : typedef void *EGLImageKHR;
885 : : typedef void *EGLLabelKHR;
886 : : typedef void *EGLObjectKHR;
887 : : typedef void *EGLOutputLayerEXT;
888 : : typedef void *EGLOutputPortEXT;
889 : : typedef void *EGLStreamKHR;
890 : : typedef void *EGLSurface;
891 : : typedef void *EGLSync;
892 : : typedef void *EGLSyncKHR;
893 : : typedef void *EGLSyncNV;
894 : : typedef void (*__eglMustCastToProperFunctionPointerType)(void);
895 : : typedef khronos_utime_nanoseconds_t EGLTimeKHR;
896 : : typedef khronos_utime_nanoseconds_t EGLTime;
897 : : typedef khronos_utime_nanoseconds_t EGLTimeNV;
898 : : typedef khronos_utime_nanoseconds_t EGLuint64NV;
899 : : typedef khronos_uint64_t EGLuint64KHR;
900 : : typedef khronos_stime_nanoseconds_t EGLnsecsANDROID;
901 : : typedef int EGLNativeFileDescriptorKHR;
902 : : typedef khronos_ssize_t EGLsizeiANDROID;
903 : : typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
904 : : typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
905 : : struct EGLClientPixmapHI {
906 : : void *pData;
907 : : EGLint iWidth;
908 : : EGLint iHeight;
909 : : EGLint iStride;
910 : : };
911 : : typedef void (GLAD_API_PTR *EGLDEBUGPROCKHR)(EGLenum error,const char *command,EGLint messageType,EGLLabelKHR threadLabel,EGLLabelKHR objectLabel,const char* message);
912 : : #define PFNEGLBINDWAYLANDDISPLAYWL PFNEGLBINDWAYLANDDISPLAYWLPROC
913 : : #define PFNEGLUNBINDWAYLANDDISPLAYWL PFNEGLUNBINDWAYLANDDISPLAYWLPROC
914 : : #define PFNEGLQUERYWAYLANDBUFFERWL PFNEGLQUERYWAYLANDBUFFERWLPROC
915 : : #define PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWL PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWLPROC
916 : :
917 : :
918 : : #define EGL_VERSION_1_0 1
919 : : GLAD_API_CALL int GLAD_EGL_VERSION_1_0;
920 : : #define EGL_VERSION_1_1 1
921 : : GLAD_API_CALL int GLAD_EGL_VERSION_1_1;
922 : : #define EGL_VERSION_1_2 1
923 : : GLAD_API_CALL int GLAD_EGL_VERSION_1_2;
924 : : #define EGL_VERSION_1_3 1
925 : : GLAD_API_CALL int GLAD_EGL_VERSION_1_3;
926 : : #define EGL_VERSION_1_4 1
927 : : GLAD_API_CALL int GLAD_EGL_VERSION_1_4;
928 : : #define EGL_VERSION_1_5 1
929 : : GLAD_API_CALL int GLAD_EGL_VERSION_1_5;
930 : : #define EGL_EXT_image_dma_buf_import 1
931 : : GLAD_API_CALL int GLAD_EGL_EXT_image_dma_buf_import;
932 : : #define EGL_EXT_image_dma_buf_import_modifiers 1
933 : : GLAD_API_CALL int GLAD_EGL_EXT_image_dma_buf_import_modifiers;
934 : : #define EGL_EXT_platform_base 1
935 : : GLAD_API_CALL int GLAD_EGL_EXT_platform_base;
936 : : #define EGL_KHR_debug 1
937 : : GLAD_API_CALL int GLAD_EGL_KHR_debug;
938 : : #define EGL_KHR_image_base 1
939 : : GLAD_API_CALL int GLAD_EGL_KHR_image_base;
940 : : #define EGL_MESA_image_dma_buf_export 1
941 : : GLAD_API_CALL int GLAD_EGL_MESA_image_dma_buf_export;
942 : : #define EGL_MESA_platform_surfaceless 1
943 : : GLAD_API_CALL int GLAD_EGL_MESA_platform_surfaceless;
944 : :
945 : :
946 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLBINDAPIPROC)(EGLenum api);
947 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLBINDTEXIMAGEPROC)(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
948 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLCHOOSECONFIGPROC)(EGLDisplay dpy, const EGLint * attrib_list, EGLConfig * configs, EGLint config_size, EGLint * num_config);
949 : : typedef EGLint (GLAD_API_PTR *PFNEGLCLIENTWAITSYNCPROC)(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
950 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLCOPYBUFFERSPROC)(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
951 : : typedef EGLContext (GLAD_API_PTR *PFNEGLCREATECONTEXTPROC)(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint * attrib_list);
952 : : typedef EGLImage (GLAD_API_PTR *PFNEGLCREATEIMAGEPROC)(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib * attrib_list);
953 : : typedef EGLImageKHR (GLAD_API_PTR *PFNEGLCREATEIMAGEKHRPROC)(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint * attrib_list);
954 : : typedef EGLSurface (GLAD_API_PTR *PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC)(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint * attrib_list);
955 : : typedef EGLSurface (GLAD_API_PTR *PFNEGLCREATEPBUFFERSURFACEPROC)(EGLDisplay dpy, EGLConfig config, const EGLint * attrib_list);
956 : : typedef EGLSurface (GLAD_API_PTR *PFNEGLCREATEPIXMAPSURFACEPROC)(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint * attrib_list);
957 : : typedef EGLSurface (GLAD_API_PTR *PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC)(EGLDisplay dpy, EGLConfig config, void * native_pixmap, const EGLAttrib * attrib_list);
958 : : typedef EGLSurface (GLAD_API_PTR *PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC)(EGLDisplay dpy, EGLConfig config, void * native_pixmap, const EGLint * attrib_list);
959 : : typedef EGLSurface (GLAD_API_PTR *PFNEGLCREATEPLATFORMWINDOWSURFACEPROC)(EGLDisplay dpy, EGLConfig config, void * native_window, const EGLAttrib * attrib_list);
960 : : typedef EGLSurface (GLAD_API_PTR *PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(EGLDisplay dpy, EGLConfig config, void * native_window, const EGLint * attrib_list);
961 : : typedef EGLSync (GLAD_API_PTR *PFNEGLCREATESYNCPROC)(EGLDisplay dpy, EGLenum type, const EGLAttrib * attrib_list);
962 : : typedef EGLSurface (GLAD_API_PTR *PFNEGLCREATEWINDOWSURFACEPROC)(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint * attrib_list);
963 : : typedef EGLint (GLAD_API_PTR *PFNEGLDEBUGMESSAGECONTROLKHRPROC)(EGLDEBUGPROCKHR callback, const EGLAttrib * attrib_list);
964 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLDESTROYCONTEXTPROC)(EGLDisplay dpy, EGLContext ctx);
965 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLDESTROYIMAGEPROC)(EGLDisplay dpy, EGLImage image);
966 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLDESTROYIMAGEKHRPROC)(EGLDisplay dpy, EGLImageKHR image);
967 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLDESTROYSURFACEPROC)(EGLDisplay dpy, EGLSurface surface);
968 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLDESTROYSYNCPROC)(EGLDisplay dpy, EGLSync sync);
969 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLEXPORTDMABUFIMAGEMESAPROC)(EGLDisplay dpy, EGLImageKHR image, int * fds, EGLint * strides, EGLint * offsets);
970 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC)(EGLDisplay dpy, EGLImageKHR image, int * fourcc, int * num_planes, EGLuint64KHR * modifiers);
971 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLGETCONFIGATTRIBPROC)(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint * value);
972 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLGETCONFIGSPROC)(EGLDisplay dpy, EGLConfig * configs, EGLint config_size, EGLint * num_config);
973 : : typedef EGLContext (GLAD_API_PTR *PFNEGLGETCURRENTCONTEXTPROC)(void);
974 : : typedef EGLDisplay (GLAD_API_PTR *PFNEGLGETCURRENTDISPLAYPROC)(void);
975 : : typedef EGLSurface (GLAD_API_PTR *PFNEGLGETCURRENTSURFACEPROC)(EGLint readdraw);
976 : : typedef EGLDisplay (GLAD_API_PTR *PFNEGLGETDISPLAYPROC)(EGLNativeDisplayType display_id);
977 : : typedef EGLint (GLAD_API_PTR *PFNEGLGETERRORPROC)(void);
978 : : typedef EGLDisplay (GLAD_API_PTR *PFNEGLGETPLATFORMDISPLAYPROC)(EGLenum platform, void * native_display, const EGLAttrib * attrib_list);
979 : : typedef EGLDisplay (GLAD_API_PTR *PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum platform, void * native_display, const EGLint * attrib_list);
980 : : typedef __eglMustCastToProperFunctionPointerType (GLAD_API_PTR *PFNEGLGETPROCADDRESSPROC)(const char * procname);
981 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLGETSYNCATTRIBPROC)(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib * value);
982 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLINITIALIZEPROC)(EGLDisplay dpy, EGLint * major, EGLint * minor);
983 : : typedef EGLint (GLAD_API_PTR *PFNEGLLABELOBJECTKHRPROC)(EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label);
984 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLMAKECURRENTPROC)(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
985 : : typedef EGLenum (GLAD_API_PTR *PFNEGLQUERYAPIPROC)(void);
986 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLQUERYCONTEXTPROC)(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint * value);
987 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLQUERYDEBUGKHRPROC)(EGLint attribute, EGLAttrib * value);
988 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLQUERYDMABUFFORMATSEXTPROC)(EGLDisplay dpy, EGLint max_formats, EGLint * formats, EGLint * num_formats);
989 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLQUERYDMABUFMODIFIERSEXTPROC)(EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR * modifiers, EGLBoolean * external_only, EGLint * num_modifiers);
990 : : typedef const char * (GLAD_API_PTR *PFNEGLQUERYSTRINGPROC)(EGLDisplay dpy, EGLint name);
991 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLQUERYSURFACEPROC)(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint * value);
992 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLRELEASETEXIMAGEPROC)(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
993 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLRELEASETHREADPROC)(void);
994 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLSURFACEATTRIBPROC)(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
995 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLSWAPBUFFERSPROC)(EGLDisplay dpy, EGLSurface surface);
996 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLSWAPINTERVALPROC)(EGLDisplay dpy, EGLint interval);
997 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLTERMINATEPROC)(EGLDisplay dpy);
998 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLWAITCLIENTPROC)(void);
999 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLWAITGLPROC)(void);
1000 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLWAITNATIVEPROC)(EGLint engine);
1001 : : typedef EGLBoolean (GLAD_API_PTR *PFNEGLWAITSYNCPROC)(EGLDisplay dpy, EGLSync sync, EGLint flags);
1002 : :
1003 : : GLAD_API_CALL PFNEGLBINDAPIPROC glad_eglBindAPI;
1004 : : #define eglBindAPI glad_eglBindAPI
1005 : : GLAD_API_CALL PFNEGLBINDTEXIMAGEPROC glad_eglBindTexImage;
1006 : : #define eglBindTexImage glad_eglBindTexImage
1007 : : GLAD_API_CALL PFNEGLCHOOSECONFIGPROC glad_eglChooseConfig;
1008 : : #define eglChooseConfig glad_eglChooseConfig
1009 : : GLAD_API_CALL PFNEGLCLIENTWAITSYNCPROC glad_eglClientWaitSync;
1010 : : #define eglClientWaitSync glad_eglClientWaitSync
1011 : : GLAD_API_CALL PFNEGLCOPYBUFFERSPROC glad_eglCopyBuffers;
1012 : : #define eglCopyBuffers glad_eglCopyBuffers
1013 : : GLAD_API_CALL PFNEGLCREATECONTEXTPROC glad_eglCreateContext;
1014 : : #define eglCreateContext glad_eglCreateContext
1015 : : GLAD_API_CALL PFNEGLCREATEIMAGEPROC glad_eglCreateImage;
1016 : : #define eglCreateImage glad_eglCreateImage
1017 : : GLAD_API_CALL PFNEGLCREATEIMAGEKHRPROC glad_eglCreateImageKHR;
1018 : : #define eglCreateImageKHR glad_eglCreateImageKHR
1019 : : GLAD_API_CALL PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC glad_eglCreatePbufferFromClientBuffer;
1020 : : #define eglCreatePbufferFromClientBuffer glad_eglCreatePbufferFromClientBuffer
1021 : : GLAD_API_CALL PFNEGLCREATEPBUFFERSURFACEPROC glad_eglCreatePbufferSurface;
1022 : : #define eglCreatePbufferSurface glad_eglCreatePbufferSurface
1023 : : GLAD_API_CALL PFNEGLCREATEPIXMAPSURFACEPROC glad_eglCreatePixmapSurface;
1024 : : #define eglCreatePixmapSurface glad_eglCreatePixmapSurface
1025 : : GLAD_API_CALL PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC glad_eglCreatePlatformPixmapSurface;
1026 : : #define eglCreatePlatformPixmapSurface glad_eglCreatePlatformPixmapSurface
1027 : : GLAD_API_CALL PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC glad_eglCreatePlatformPixmapSurfaceEXT;
1028 : : #define eglCreatePlatformPixmapSurfaceEXT glad_eglCreatePlatformPixmapSurfaceEXT
1029 : : GLAD_API_CALL PFNEGLCREATEPLATFORMWINDOWSURFACEPROC glad_eglCreatePlatformWindowSurface;
1030 : : #define eglCreatePlatformWindowSurface glad_eglCreatePlatformWindowSurface
1031 : : GLAD_API_CALL PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC glad_eglCreatePlatformWindowSurfaceEXT;
1032 : : #define eglCreatePlatformWindowSurfaceEXT glad_eglCreatePlatformWindowSurfaceEXT
1033 : : GLAD_API_CALL PFNEGLCREATESYNCPROC glad_eglCreateSync;
1034 : : #define eglCreateSync glad_eglCreateSync
1035 : : GLAD_API_CALL PFNEGLCREATEWINDOWSURFACEPROC glad_eglCreateWindowSurface;
1036 : : #define eglCreateWindowSurface glad_eglCreateWindowSurface
1037 : : GLAD_API_CALL PFNEGLDEBUGMESSAGECONTROLKHRPROC glad_eglDebugMessageControlKHR;
1038 : : #define eglDebugMessageControlKHR glad_eglDebugMessageControlKHR
1039 : : GLAD_API_CALL PFNEGLDESTROYCONTEXTPROC glad_eglDestroyContext;
1040 : : #define eglDestroyContext glad_eglDestroyContext
1041 : : GLAD_API_CALL PFNEGLDESTROYIMAGEPROC glad_eglDestroyImage;
1042 : : #define eglDestroyImage glad_eglDestroyImage
1043 : : GLAD_API_CALL PFNEGLDESTROYIMAGEKHRPROC glad_eglDestroyImageKHR;
1044 : : #define eglDestroyImageKHR glad_eglDestroyImageKHR
1045 : : GLAD_API_CALL PFNEGLDESTROYSURFACEPROC glad_eglDestroySurface;
1046 : : #define eglDestroySurface glad_eglDestroySurface
1047 : : GLAD_API_CALL PFNEGLDESTROYSYNCPROC glad_eglDestroySync;
1048 : : #define eglDestroySync glad_eglDestroySync
1049 : : GLAD_API_CALL PFNEGLEXPORTDMABUFIMAGEMESAPROC glad_eglExportDMABUFImageMESA;
1050 : : #define eglExportDMABUFImageMESA glad_eglExportDMABUFImageMESA
1051 : : GLAD_API_CALL PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC glad_eglExportDMABUFImageQueryMESA;
1052 : : #define eglExportDMABUFImageQueryMESA glad_eglExportDMABUFImageQueryMESA
1053 : : GLAD_API_CALL PFNEGLGETCONFIGATTRIBPROC glad_eglGetConfigAttrib;
1054 : : #define eglGetConfigAttrib glad_eglGetConfigAttrib
1055 : : GLAD_API_CALL PFNEGLGETCONFIGSPROC glad_eglGetConfigs;
1056 : : #define eglGetConfigs glad_eglGetConfigs
1057 : : GLAD_API_CALL PFNEGLGETCURRENTCONTEXTPROC glad_eglGetCurrentContext;
1058 : : #define eglGetCurrentContext glad_eglGetCurrentContext
1059 : : GLAD_API_CALL PFNEGLGETCURRENTDISPLAYPROC glad_eglGetCurrentDisplay;
1060 : : #define eglGetCurrentDisplay glad_eglGetCurrentDisplay
1061 : : GLAD_API_CALL PFNEGLGETCURRENTSURFACEPROC glad_eglGetCurrentSurface;
1062 : : #define eglGetCurrentSurface glad_eglGetCurrentSurface
1063 : : GLAD_API_CALL PFNEGLGETDISPLAYPROC glad_eglGetDisplay;
1064 : : #define eglGetDisplay glad_eglGetDisplay
1065 : : GLAD_API_CALL PFNEGLGETERRORPROC glad_eglGetError;
1066 : : #define eglGetError glad_eglGetError
1067 : : GLAD_API_CALL PFNEGLGETPLATFORMDISPLAYPROC glad_eglGetPlatformDisplay;
1068 : : #define eglGetPlatformDisplay glad_eglGetPlatformDisplay
1069 : : GLAD_API_CALL PFNEGLGETPLATFORMDISPLAYEXTPROC glad_eglGetPlatformDisplayEXT;
1070 : : #define eglGetPlatformDisplayEXT glad_eglGetPlatformDisplayEXT
1071 : : GLAD_API_CALL PFNEGLGETPROCADDRESSPROC glad_eglGetProcAddress;
1072 : : #define eglGetProcAddress glad_eglGetProcAddress
1073 : : GLAD_API_CALL PFNEGLGETSYNCATTRIBPROC glad_eglGetSyncAttrib;
1074 : : #define eglGetSyncAttrib glad_eglGetSyncAttrib
1075 : : GLAD_API_CALL PFNEGLINITIALIZEPROC glad_eglInitialize;
1076 : : #define eglInitialize glad_eglInitialize
1077 : : GLAD_API_CALL PFNEGLLABELOBJECTKHRPROC glad_eglLabelObjectKHR;
1078 : : #define eglLabelObjectKHR glad_eglLabelObjectKHR
1079 : : GLAD_API_CALL PFNEGLMAKECURRENTPROC glad_eglMakeCurrent;
1080 : : #define eglMakeCurrent glad_eglMakeCurrent
1081 : : GLAD_API_CALL PFNEGLQUERYAPIPROC glad_eglQueryAPI;
1082 : : #define eglQueryAPI glad_eglQueryAPI
1083 : : GLAD_API_CALL PFNEGLQUERYCONTEXTPROC glad_eglQueryContext;
1084 : : #define eglQueryContext glad_eglQueryContext
1085 : : GLAD_API_CALL PFNEGLQUERYDEBUGKHRPROC glad_eglQueryDebugKHR;
1086 : : #define eglQueryDebugKHR glad_eglQueryDebugKHR
1087 : : GLAD_API_CALL PFNEGLQUERYDMABUFFORMATSEXTPROC glad_eglQueryDmaBufFormatsEXT;
1088 : : #define eglQueryDmaBufFormatsEXT glad_eglQueryDmaBufFormatsEXT
1089 : : GLAD_API_CALL PFNEGLQUERYDMABUFMODIFIERSEXTPROC glad_eglQueryDmaBufModifiersEXT;
1090 : : #define eglQueryDmaBufModifiersEXT glad_eglQueryDmaBufModifiersEXT
1091 : : GLAD_API_CALL PFNEGLQUERYSTRINGPROC glad_eglQueryString;
1092 : : #define eglQueryString glad_eglQueryString
1093 : : GLAD_API_CALL PFNEGLQUERYSURFACEPROC glad_eglQuerySurface;
1094 : : #define eglQuerySurface glad_eglQuerySurface
1095 : : GLAD_API_CALL PFNEGLRELEASETEXIMAGEPROC glad_eglReleaseTexImage;
1096 : : #define eglReleaseTexImage glad_eglReleaseTexImage
1097 : : GLAD_API_CALL PFNEGLRELEASETHREADPROC glad_eglReleaseThread;
1098 : : #define eglReleaseThread glad_eglReleaseThread
1099 : : GLAD_API_CALL PFNEGLSURFACEATTRIBPROC glad_eglSurfaceAttrib;
1100 : : #define eglSurfaceAttrib glad_eglSurfaceAttrib
1101 : : GLAD_API_CALL PFNEGLSWAPBUFFERSPROC glad_eglSwapBuffers;
1102 : : #define eglSwapBuffers glad_eglSwapBuffers
1103 : : GLAD_API_CALL PFNEGLSWAPINTERVALPROC glad_eglSwapInterval;
1104 : : #define eglSwapInterval glad_eglSwapInterval
1105 : : GLAD_API_CALL PFNEGLTERMINATEPROC glad_eglTerminate;
1106 : : #define eglTerminate glad_eglTerminate
1107 : : GLAD_API_CALL PFNEGLWAITCLIENTPROC glad_eglWaitClient;
1108 : : #define eglWaitClient glad_eglWaitClient
1109 : : GLAD_API_CALL PFNEGLWAITGLPROC glad_eglWaitGL;
1110 : : #define eglWaitGL glad_eglWaitGL
1111 : : GLAD_API_CALL PFNEGLWAITNATIVEPROC glad_eglWaitNative;
1112 : : #define eglWaitNative glad_eglWaitNative
1113 : : GLAD_API_CALL PFNEGLWAITSYNCPROC glad_eglWaitSync;
1114 : : #define eglWaitSync glad_eglWaitSync
1115 : :
1116 : :
1117 : :
1118 : :
1119 : :
1120 : : GLAD_API_CALL int gladLoadEGLUserPtr(EGLDisplay display, GLADuserptrloadfunc load, void *userptr);
1121 : : GLAD_API_CALL int gladLoadEGL(EGLDisplay display, GLADloadfunc load);
1122 : :
1123 : : #ifdef GLAD_EGL
1124 : :
1125 : : GLAD_API_CALL int gladLoaderLoadEGL(EGLDisplay display);
1126 : :
1127 : : GLAD_API_CALL void gladLoaderUnloadEGL(void);
1128 : :
1129 : : #endif
1130 : : #ifdef __cplusplus
1131 : : }
1132 : : #endif
1133 : : #endif
1134 : :
1135 : : /* Source */
1136 : : #ifdef GLAD_EGL_IMPLEMENTATION
1137 : : /**
1138 : : * SPDX-License-Identifier: (WTFPL OR CC0-1.0) AND Apache-2.0
1139 : : */
1140 : : #include <stdio.h>
1141 : : #include <stdlib.h>
1142 : : #include <string.h>
1143 : :
1144 : : #ifndef GLAD_IMPL_UTIL_C_
1145 : : #define GLAD_IMPL_UTIL_C_
1146 : :
1147 : : #ifdef _MSC_VER
1148 : : #define GLAD_IMPL_UTIL_SSCANF sscanf_s
1149 : : #else
1150 : : #define GLAD_IMPL_UTIL_SSCANF sscanf
1151 : : #endif
1152 : :
1153 : : #endif /* GLAD_IMPL_UTIL_C_ */
1154 : :
1155 : : #ifdef __cplusplus
1156 : : extern "C" {
1157 : : #endif
1158 : :
1159 : :
1160 : :
1161 : : int GLAD_EGL_VERSION_1_0 = 0;
1162 : : int GLAD_EGL_VERSION_1_1 = 0;
1163 : : int GLAD_EGL_VERSION_1_2 = 0;
1164 : : int GLAD_EGL_VERSION_1_3 = 0;
1165 : : int GLAD_EGL_VERSION_1_4 = 0;
1166 : : int GLAD_EGL_VERSION_1_5 = 0;
1167 : : int GLAD_EGL_EXT_image_dma_buf_import = 0;
1168 : : int GLAD_EGL_EXT_image_dma_buf_import_modifiers = 0;
1169 : : int GLAD_EGL_EXT_platform_base = 0;
1170 : : int GLAD_EGL_KHR_debug = 0;
1171 : : int GLAD_EGL_KHR_image_base = 0;
1172 : : int GLAD_EGL_MESA_image_dma_buf_export = 0;
1173 : : int GLAD_EGL_MESA_platform_surfaceless = 0;
1174 : :
1175 : :
1176 : :
1177 : : PFNEGLBINDAPIPROC glad_eglBindAPI = NULL;
1178 : : PFNEGLBINDTEXIMAGEPROC glad_eglBindTexImage = NULL;
1179 : : PFNEGLCHOOSECONFIGPROC glad_eglChooseConfig = NULL;
1180 : : PFNEGLCLIENTWAITSYNCPROC glad_eglClientWaitSync = NULL;
1181 : : PFNEGLCOPYBUFFERSPROC glad_eglCopyBuffers = NULL;
1182 : : PFNEGLCREATECONTEXTPROC glad_eglCreateContext = NULL;
1183 : : PFNEGLCREATEIMAGEPROC glad_eglCreateImage = NULL;
1184 : : PFNEGLCREATEIMAGEKHRPROC glad_eglCreateImageKHR = NULL;
1185 : : PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC glad_eglCreatePbufferFromClientBuffer = NULL;
1186 : : PFNEGLCREATEPBUFFERSURFACEPROC glad_eglCreatePbufferSurface = NULL;
1187 : : PFNEGLCREATEPIXMAPSURFACEPROC glad_eglCreatePixmapSurface = NULL;
1188 : : PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC glad_eglCreatePlatformPixmapSurface = NULL;
1189 : : PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC glad_eglCreatePlatformPixmapSurfaceEXT = NULL;
1190 : : PFNEGLCREATEPLATFORMWINDOWSURFACEPROC glad_eglCreatePlatformWindowSurface = NULL;
1191 : : PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC glad_eglCreatePlatformWindowSurfaceEXT = NULL;
1192 : : PFNEGLCREATESYNCPROC glad_eglCreateSync = NULL;
1193 : : PFNEGLCREATEWINDOWSURFACEPROC glad_eglCreateWindowSurface = NULL;
1194 : : PFNEGLDEBUGMESSAGECONTROLKHRPROC glad_eglDebugMessageControlKHR = NULL;
1195 : : PFNEGLDESTROYCONTEXTPROC glad_eglDestroyContext = NULL;
1196 : : PFNEGLDESTROYIMAGEPROC glad_eglDestroyImage = NULL;
1197 : : PFNEGLDESTROYIMAGEKHRPROC glad_eglDestroyImageKHR = NULL;
1198 : : PFNEGLDESTROYSURFACEPROC glad_eglDestroySurface = NULL;
1199 : : PFNEGLDESTROYSYNCPROC glad_eglDestroySync = NULL;
1200 : : PFNEGLEXPORTDMABUFIMAGEMESAPROC glad_eglExportDMABUFImageMESA = NULL;
1201 : : PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC glad_eglExportDMABUFImageQueryMESA = NULL;
1202 : : PFNEGLGETCONFIGATTRIBPROC glad_eglGetConfigAttrib = NULL;
1203 : : PFNEGLGETCONFIGSPROC glad_eglGetConfigs = NULL;
1204 : : PFNEGLGETCURRENTCONTEXTPROC glad_eglGetCurrentContext = NULL;
1205 : : PFNEGLGETCURRENTDISPLAYPROC glad_eglGetCurrentDisplay = NULL;
1206 : : PFNEGLGETCURRENTSURFACEPROC glad_eglGetCurrentSurface = NULL;
1207 : : PFNEGLGETDISPLAYPROC glad_eglGetDisplay = NULL;
1208 : : PFNEGLGETERRORPROC glad_eglGetError = NULL;
1209 : : PFNEGLGETPLATFORMDISPLAYPROC glad_eglGetPlatformDisplay = NULL;
1210 : : PFNEGLGETPLATFORMDISPLAYEXTPROC glad_eglGetPlatformDisplayEXT = NULL;
1211 : : PFNEGLGETPROCADDRESSPROC glad_eglGetProcAddress = NULL;
1212 : : PFNEGLGETSYNCATTRIBPROC glad_eglGetSyncAttrib = NULL;
1213 : : PFNEGLINITIALIZEPROC glad_eglInitialize = NULL;
1214 : : PFNEGLLABELOBJECTKHRPROC glad_eglLabelObjectKHR = NULL;
1215 : : PFNEGLMAKECURRENTPROC glad_eglMakeCurrent = NULL;
1216 : : PFNEGLQUERYAPIPROC glad_eglQueryAPI = NULL;
1217 : : PFNEGLQUERYCONTEXTPROC glad_eglQueryContext = NULL;
1218 : : PFNEGLQUERYDEBUGKHRPROC glad_eglQueryDebugKHR = NULL;
1219 : : PFNEGLQUERYDMABUFFORMATSEXTPROC glad_eglQueryDmaBufFormatsEXT = NULL;
1220 : : PFNEGLQUERYDMABUFMODIFIERSEXTPROC glad_eglQueryDmaBufModifiersEXT = NULL;
1221 : : PFNEGLQUERYSTRINGPROC glad_eglQueryString = NULL;
1222 : : PFNEGLQUERYSURFACEPROC glad_eglQuerySurface = NULL;
1223 : : PFNEGLRELEASETEXIMAGEPROC glad_eglReleaseTexImage = NULL;
1224 : : PFNEGLRELEASETHREADPROC glad_eglReleaseThread = NULL;
1225 : : PFNEGLSURFACEATTRIBPROC glad_eglSurfaceAttrib = NULL;
1226 : : PFNEGLSWAPBUFFERSPROC glad_eglSwapBuffers = NULL;
1227 : : PFNEGLSWAPINTERVALPROC glad_eglSwapInterval = NULL;
1228 : : PFNEGLTERMINATEPROC glad_eglTerminate = NULL;
1229 : : PFNEGLWAITCLIENTPROC glad_eglWaitClient = NULL;
1230 : : PFNEGLWAITGLPROC glad_eglWaitGL = NULL;
1231 : : PFNEGLWAITNATIVEPROC glad_eglWaitNative = NULL;
1232 : : PFNEGLWAITSYNCPROC glad_eglWaitSync = NULL;
1233 : :
1234 : :
1235 : 6 : static void glad_egl_load_EGL_VERSION_1_0( GLADuserptrloadfunc load, void* userptr) {
1236 [ + - ]: 6 : if(!GLAD_EGL_VERSION_1_0) return;
1237 : 6 : glad_eglChooseConfig = (PFNEGLCHOOSECONFIGPROC) load(userptr, "eglChooseConfig");
1238 : 6 : glad_eglCopyBuffers = (PFNEGLCOPYBUFFERSPROC) load(userptr, "eglCopyBuffers");
1239 : 6 : glad_eglCreateContext = (PFNEGLCREATECONTEXTPROC) load(userptr, "eglCreateContext");
1240 : 6 : glad_eglCreatePbufferSurface = (PFNEGLCREATEPBUFFERSURFACEPROC) load(userptr, "eglCreatePbufferSurface");
1241 : 6 : glad_eglCreatePixmapSurface = (PFNEGLCREATEPIXMAPSURFACEPROC) load(userptr, "eglCreatePixmapSurface");
1242 : 6 : glad_eglCreateWindowSurface = (PFNEGLCREATEWINDOWSURFACEPROC) load(userptr, "eglCreateWindowSurface");
1243 : 6 : glad_eglDestroyContext = (PFNEGLDESTROYCONTEXTPROC) load(userptr, "eglDestroyContext");
1244 : 6 : glad_eglDestroySurface = (PFNEGLDESTROYSURFACEPROC) load(userptr, "eglDestroySurface");
1245 : 6 : glad_eglGetConfigAttrib = (PFNEGLGETCONFIGATTRIBPROC) load(userptr, "eglGetConfigAttrib");
1246 : 6 : glad_eglGetConfigs = (PFNEGLGETCONFIGSPROC) load(userptr, "eglGetConfigs");
1247 : 6 : glad_eglGetCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC) load(userptr, "eglGetCurrentDisplay");
1248 : 6 : glad_eglGetCurrentSurface = (PFNEGLGETCURRENTSURFACEPROC) load(userptr, "eglGetCurrentSurface");
1249 : 6 : glad_eglGetDisplay = (PFNEGLGETDISPLAYPROC) load(userptr, "eglGetDisplay");
1250 : 6 : glad_eglGetError = (PFNEGLGETERRORPROC) load(userptr, "eglGetError");
1251 : 6 : glad_eglGetProcAddress = (PFNEGLGETPROCADDRESSPROC) load(userptr, "eglGetProcAddress");
1252 : 6 : glad_eglInitialize = (PFNEGLINITIALIZEPROC) load(userptr, "eglInitialize");
1253 : 6 : glad_eglMakeCurrent = (PFNEGLMAKECURRENTPROC) load(userptr, "eglMakeCurrent");
1254 : 6 : glad_eglQueryContext = (PFNEGLQUERYCONTEXTPROC) load(userptr, "eglQueryContext");
1255 : 6 : glad_eglQueryString = (PFNEGLQUERYSTRINGPROC) load(userptr, "eglQueryString");
1256 : 6 : glad_eglQuerySurface = (PFNEGLQUERYSURFACEPROC) load(userptr, "eglQuerySurface");
1257 : 6 : glad_eglSwapBuffers = (PFNEGLSWAPBUFFERSPROC) load(userptr, "eglSwapBuffers");
1258 : 6 : glad_eglTerminate = (PFNEGLTERMINATEPROC) load(userptr, "eglTerminate");
1259 : 6 : glad_eglWaitGL = (PFNEGLWAITGLPROC) load(userptr, "eglWaitGL");
1260 : 6 : glad_eglWaitNative = (PFNEGLWAITNATIVEPROC) load(userptr, "eglWaitNative");
1261 : : }
1262 : 6 : static void glad_egl_load_EGL_VERSION_1_1( GLADuserptrloadfunc load, void* userptr) {
1263 [ + + ]: 6 : if(!GLAD_EGL_VERSION_1_1) return;
1264 : 5 : glad_eglBindTexImage = (PFNEGLBINDTEXIMAGEPROC) load(userptr, "eglBindTexImage");
1265 : 5 : glad_eglReleaseTexImage = (PFNEGLRELEASETEXIMAGEPROC) load(userptr, "eglReleaseTexImage");
1266 : 5 : glad_eglSurfaceAttrib = (PFNEGLSURFACEATTRIBPROC) load(userptr, "eglSurfaceAttrib");
1267 : 5 : glad_eglSwapInterval = (PFNEGLSWAPINTERVALPROC) load(userptr, "eglSwapInterval");
1268 : : }
1269 : 6 : static void glad_egl_load_EGL_VERSION_1_2( GLADuserptrloadfunc load, void* userptr) {
1270 [ + + ]: 6 : if(!GLAD_EGL_VERSION_1_2) return;
1271 : 5 : glad_eglBindAPI = (PFNEGLBINDAPIPROC) load(userptr, "eglBindAPI");
1272 : 5 : glad_eglCreatePbufferFromClientBuffer = (PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC) load(userptr, "eglCreatePbufferFromClientBuffer");
1273 : 5 : glad_eglQueryAPI = (PFNEGLQUERYAPIPROC) load(userptr, "eglQueryAPI");
1274 : 5 : glad_eglReleaseThread = (PFNEGLRELEASETHREADPROC) load(userptr, "eglReleaseThread");
1275 : 5 : glad_eglWaitClient = (PFNEGLWAITCLIENTPROC) load(userptr, "eglWaitClient");
1276 : : }
1277 : : static void glad_egl_load_EGL_VERSION_1_4( GLADuserptrloadfunc load, void* userptr) {
1278 [ + + ]: 6 : if(!GLAD_EGL_VERSION_1_4) return;
1279 : 5 : glad_eglGetCurrentContext = (PFNEGLGETCURRENTCONTEXTPROC) load(userptr, "eglGetCurrentContext");
1280 : : }
1281 : 6 : static void glad_egl_load_EGL_VERSION_1_5( GLADuserptrloadfunc load, void* userptr) {
1282 [ + + ]: 6 : if(!GLAD_EGL_VERSION_1_5) return;
1283 : 5 : glad_eglClientWaitSync = (PFNEGLCLIENTWAITSYNCPROC) load(userptr, "eglClientWaitSync");
1284 : 5 : glad_eglCreateImage = (PFNEGLCREATEIMAGEPROC) load(userptr, "eglCreateImage");
1285 : 5 : glad_eglCreatePlatformPixmapSurface = (PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC) load(userptr, "eglCreatePlatformPixmapSurface");
1286 : 5 : glad_eglCreatePlatformWindowSurface = (PFNEGLCREATEPLATFORMWINDOWSURFACEPROC) load(userptr, "eglCreatePlatformWindowSurface");
1287 : 5 : glad_eglCreateSync = (PFNEGLCREATESYNCPROC) load(userptr, "eglCreateSync");
1288 : 5 : glad_eglDestroyImage = (PFNEGLDESTROYIMAGEPROC) load(userptr, "eglDestroyImage");
1289 : 5 : glad_eglDestroySync = (PFNEGLDESTROYSYNCPROC) load(userptr, "eglDestroySync");
1290 : 5 : glad_eglGetPlatformDisplay = (PFNEGLGETPLATFORMDISPLAYPROC) load(userptr, "eglGetPlatformDisplay");
1291 : 5 : glad_eglGetSyncAttrib = (PFNEGLGETSYNCATTRIBPROC) load(userptr, "eglGetSyncAttrib");
1292 : 5 : glad_eglWaitSync = (PFNEGLWAITSYNCPROC) load(userptr, "eglWaitSync");
1293 : : }
1294 : : static void glad_egl_load_EGL_EXT_image_dma_buf_import_modifiers( GLADuserptrloadfunc load, void* userptr) {
1295 [ + + ]: 6 : if(!GLAD_EGL_EXT_image_dma_buf_import_modifiers) return;
1296 : 5 : glad_eglQueryDmaBufFormatsEXT = (PFNEGLQUERYDMABUFFORMATSEXTPROC) load(userptr, "eglQueryDmaBufFormatsEXT");
1297 : 5 : glad_eglQueryDmaBufModifiersEXT = (PFNEGLQUERYDMABUFMODIFIERSEXTPROC) load(userptr, "eglQueryDmaBufModifiersEXT");
1298 : : }
1299 : 6 : static void glad_egl_load_EGL_EXT_platform_base( GLADuserptrloadfunc load, void* userptr) {
1300 [ + + ]: 6 : if(!GLAD_EGL_EXT_platform_base) return;
1301 : 1 : glad_eglCreatePlatformPixmapSurfaceEXT = (PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) load(userptr, "eglCreatePlatformPixmapSurfaceEXT");
1302 : 1 : glad_eglCreatePlatformWindowSurfaceEXT = (PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) load(userptr, "eglCreatePlatformWindowSurfaceEXT");
1303 : 1 : glad_eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC) load(userptr, "eglGetPlatformDisplayEXT");
1304 : : }
1305 : 6 : static void glad_egl_load_EGL_KHR_debug( GLADuserptrloadfunc load, void* userptr) {
1306 [ + + ]: 6 : if(!GLAD_EGL_KHR_debug) return;
1307 : 1 : glad_eglDebugMessageControlKHR = (PFNEGLDEBUGMESSAGECONTROLKHRPROC) load(userptr, "eglDebugMessageControlKHR");
1308 : 1 : glad_eglLabelObjectKHR = (PFNEGLLABELOBJECTKHRPROC) load(userptr, "eglLabelObjectKHR");
1309 : 1 : glad_eglQueryDebugKHR = (PFNEGLQUERYDEBUGKHRPROC) load(userptr, "eglQueryDebugKHR");
1310 : : }
1311 : : static void glad_egl_load_EGL_KHR_image_base( GLADuserptrloadfunc load, void* userptr) {
1312 [ + + ]: 6 : if(!GLAD_EGL_KHR_image_base) return;
1313 : 5 : glad_eglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC) load(userptr, "eglCreateImageKHR");
1314 : 5 : glad_eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC) load(userptr, "eglDestroyImageKHR");
1315 : : }
1316 : : static void glad_egl_load_EGL_MESA_image_dma_buf_export( GLADuserptrloadfunc load, void* userptr) {
1317 [ + + ]: 6 : if(!GLAD_EGL_MESA_image_dma_buf_export) return;
1318 : 5 : glad_eglExportDMABUFImageMESA = (PFNEGLEXPORTDMABUFIMAGEMESAPROC) load(userptr, "eglExportDMABUFImageMESA");
1319 : 5 : glad_eglExportDMABUFImageQueryMESA = (PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC) load(userptr, "eglExportDMABUFImageQueryMESA");
1320 : : }
1321 : :
1322 : :
1323 : :
1324 : : static int glad_egl_get_extensions(EGLDisplay display, const char **extensions) {
1325 : 6 : *extensions = eglQueryString(display, EGL_EXTENSIONS);
1326 : :
1327 : : return extensions != NULL;
1328 : : }
1329 : :
1330 : 42 : static int glad_egl_has_extension(const char *extensions, const char *ext) {
1331 : : const char *loc;
1332 : : const char *terminator;
1333 [ + - ]: 42 : if(extensions == NULL) {
1334 : : return 0;
1335 : : }
1336 : : while(1) {
1337 : 42 : loc = strstr(extensions, ext);
1338 [ + + ]: 42 : if(loc == NULL) {
1339 : : return 0;
1340 : : }
1341 : 23 : terminator = loc + strlen(ext);
1342 [ + - - + ]: 23 : if((loc == extensions || *(loc - 1) == ' ') &&
1343 [ - + ]: 23 : (*terminator == ' ' || *terminator == '\0')) {
1344 : : return 1;
1345 : : }
1346 : : extensions = terminator;
1347 : : }
1348 : : }
1349 : :
1350 : 216 : static GLADapiproc glad_egl_get_proc_from_userptr(void *userptr, const char *name) {
1351 : 216 : return (GLAD_GNUC_EXTENSION (GLADapiproc (*)(const char *name)) userptr)(name);
1352 : : }
1353 : :
1354 : 6 : static int glad_egl_find_extensions_egl(EGLDisplay display) {
1355 : : const char *extensions;
1356 : : if (!glad_egl_get_extensions(display, &extensions)) return 0;
1357 : :
1358 : 6 : GLAD_EGL_EXT_image_dma_buf_import = glad_egl_has_extension(extensions, "EGL_EXT_image_dma_buf_import");
1359 : 6 : GLAD_EGL_EXT_image_dma_buf_import_modifiers = glad_egl_has_extension(extensions, "EGL_EXT_image_dma_buf_import_modifiers");
1360 : 6 : GLAD_EGL_EXT_platform_base = glad_egl_has_extension(extensions, "EGL_EXT_platform_base");
1361 : 6 : GLAD_EGL_KHR_debug = glad_egl_has_extension(extensions, "EGL_KHR_debug");
1362 : 6 : GLAD_EGL_KHR_image_base = glad_egl_has_extension(extensions, "EGL_KHR_image_base");
1363 : 6 : GLAD_EGL_MESA_image_dma_buf_export = glad_egl_has_extension(extensions, "EGL_MESA_image_dma_buf_export");
1364 : 6 : GLAD_EGL_MESA_platform_surfaceless = glad_egl_has_extension(extensions, "EGL_MESA_platform_surfaceless");
1365 : :
1366 : : return 1;
1367 : : }
1368 : :
1369 : 6 : static int glad_egl_find_core_egl(EGLDisplay display) {
1370 : : int major, minor;
1371 : : const char *version;
1372 : :
1373 [ + + ]: 6 : if (display == NULL) {
1374 : : display = EGL_NO_DISPLAY; /* this is usually NULL, better safe than sorry */
1375 : : }
1376 : : if (display == EGL_NO_DISPLAY) {
1377 : 1 : display = eglGetCurrentDisplay();
1378 : : }
1379 : : #ifdef EGL_VERSION_1_4
1380 [ + + ]: 6 : if (display == EGL_NO_DISPLAY) {
1381 : 1 : display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
1382 : : }
1383 : : #endif
1384 : : #ifndef EGL_VERSION_1_5
1385 : : if (display == EGL_NO_DISPLAY) {
1386 : : return 0;
1387 : : }
1388 : : #endif
1389 : :
1390 : 6 : version = eglQueryString(display, EGL_VERSION);
1391 : 6 : (void) eglGetError();
1392 : :
1393 [ + + ]: 6 : if (version == NULL) {
1394 : 1 : major = 1;
1395 : 1 : minor = 0;
1396 : : } else {
1397 : 5 : GLAD_IMPL_UTIL_SSCANF(version, "%d.%d", &major, &minor);
1398 : : }
1399 : :
1400 [ + - - + : 6 : GLAD_EGL_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1;
- - ]
1401 [ + - + + : 6 : GLAD_EGL_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1;
- + ]
1402 [ + - + + : 6 : GLAD_EGL_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1;
- + ]
1403 [ + - + + : 6 : GLAD_EGL_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1;
- + ]
1404 [ + - + + : 6 : GLAD_EGL_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1;
- + ]
1405 [ + - + + : 6 : GLAD_EGL_VERSION_1_5 = (major == 1 && minor >= 5) || major > 1;
- + ]
1406 : :
1407 : 6 : return GLAD_MAKE_VERSION(major, minor);
1408 : : }
1409 : :
1410 : 6 : int gladLoadEGLUserPtr(EGLDisplay display, GLADuserptrloadfunc load, void* userptr) {
1411 : : int version;
1412 : 6 : eglGetDisplay = (PFNEGLGETDISPLAYPROC) load(userptr, "eglGetDisplay");
1413 : 6 : eglGetCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC) load(userptr, "eglGetCurrentDisplay");
1414 : 6 : eglQueryString = (PFNEGLQUERYSTRINGPROC) load(userptr, "eglQueryString");
1415 : 6 : eglGetError = (PFNEGLGETERRORPROC) load(userptr, "eglGetError");
1416 [ + - + - : 6 : if (eglGetDisplay == NULL || eglGetCurrentDisplay == NULL || eglQueryString == NULL || eglGetError == NULL) return 0;
+ - - + ]
1417 : :
1418 : 6 : version = glad_egl_find_core_egl(display);
1419 [ - + ]: 6 : if (!version) return 0;
1420 : 6 : glad_egl_load_EGL_VERSION_1_0(load, userptr);
1421 : 6 : glad_egl_load_EGL_VERSION_1_1(load, userptr);
1422 : 6 : glad_egl_load_EGL_VERSION_1_2(load, userptr);
1423 : : glad_egl_load_EGL_VERSION_1_4(load, userptr);
1424 : 6 : glad_egl_load_EGL_VERSION_1_5(load, userptr);
1425 : :
1426 [ - + ]: 6 : if (!glad_egl_find_extensions_egl(display)) return 0;
1427 : : glad_egl_load_EGL_EXT_image_dma_buf_import_modifiers(load, userptr);
1428 : 6 : glad_egl_load_EGL_EXT_platform_base(load, userptr);
1429 : 6 : glad_egl_load_EGL_KHR_debug(load, userptr);
1430 : : glad_egl_load_EGL_KHR_image_base(load, userptr);
1431 : : glad_egl_load_EGL_MESA_image_dma_buf_export(load, userptr);
1432 : :
1433 : :
1434 : : return version;
1435 : : }
1436 : :
1437 : 4 : int gladLoadEGL(EGLDisplay display, GLADloadfunc load) {
1438 : 4 : return gladLoadEGLUserPtr(display, glad_egl_get_proc_from_userptr, GLAD_GNUC_EXTENSION (void*) load);
1439 : : }
1440 : :
1441 : :
1442 : :
1443 : : #ifdef GLAD_EGL
1444 : :
1445 : : #ifndef GLAD_LOADER_LIBRARY_C_
1446 : : #define GLAD_LOADER_LIBRARY_C_
1447 : :
1448 : : #include <stddef.h>
1449 : : #include <stdlib.h>
1450 : :
1451 : : #if GLAD_PLATFORM_WIN32
1452 : : #include <windows.h>
1453 : : #else
1454 : : #include <dlfcn.h>
1455 : : #endif
1456 : :
1457 : :
1458 : 1 : static void* glad_get_dlopen_handle(const char *lib_names[], int length) {
1459 : : void *handle = NULL;
1460 : : int i;
1461 : :
1462 [ + - ]: 1 : for (i = 0; i < length; ++i) {
1463 : : #if GLAD_PLATFORM_WIN32
1464 : : #if GLAD_PLATFORM_UWP
1465 : : size_t buffer_size = (strlen(lib_names[i]) + 1) * sizeof(WCHAR);
1466 : : LPWSTR buffer = (LPWSTR) malloc(buffer_size);
1467 : : if (buffer != NULL) {
1468 : : int ret = MultiByteToWideChar(CP_ACP, 0, lib_names[i], -1, buffer, buffer_size);
1469 : : if (ret != 0) {
1470 : : handle = (void*) LoadPackagedLibrary(buffer, 0);
1471 : : }
1472 : : free((void*) buffer);
1473 : : }
1474 : : #else
1475 : : handle = (void*) LoadLibraryA(lib_names[i]);
1476 : : #endif
1477 : : #else
1478 : 1 : handle = dlopen(lib_names[i], RTLD_LAZY | RTLD_LOCAL);
1479 : : #endif
1480 [ + - ]: 1 : if (handle != NULL) {
1481 : 1 : return handle;
1482 : : }
1483 : : }
1484 : :
1485 : : return NULL;
1486 : : }
1487 : :
1488 : : static void glad_close_dlopen_handle(void* handle) {
1489 : : if (handle != NULL) {
1490 : : #if GLAD_PLATFORM_WIN32
1491 : : FreeLibrary((HMODULE) handle);
1492 : : #else
1493 : 1 : dlclose(handle);
1494 : : #endif
1495 : : }
1496 : : }
1497 : :
1498 : : static GLADapiproc glad_dlsym_handle(void* handle, const char *name) {
1499 : 88 : if (handle == NULL) {
1500 : : return NULL;
1501 : : }
1502 : :
1503 : : #if GLAD_PLATFORM_WIN32
1504 : : return (GLADapiproc) GetProcAddress((HMODULE) handle, name);
1505 : : #else
1506 : 90 : return GLAD_GNUC_EXTENSION (GLADapiproc) dlsym(handle, name);
1507 : : #endif
1508 : : }
1509 : :
1510 : : #endif /* GLAD_LOADER_LIBRARY_C_ */
1511 : :
1512 : : struct _glad_egl_userptr {
1513 : : void *handle;
1514 : : PFNEGLGETPROCADDRESSPROC get_proc_address_ptr;
1515 : : };
1516 : :
1517 : 88 : static GLADapiproc glad_egl_get_proc(void *vuserptr, const char* name) {
1518 [ + - ]: 88 : struct _glad_egl_userptr userptr = *(struct _glad_egl_userptr*) vuserptr;
1519 : : GLADapiproc result = NULL;
1520 : :
1521 : : result = glad_dlsym_handle(userptr.handle, name);
1522 [ + + ]: 88 : if (result == NULL) {
1523 : 12 : result = GLAD_GNUC_EXTENSION (GLADapiproc) userptr.get_proc_address_ptr(name);
1524 : : }
1525 : :
1526 : 88 : return result;
1527 : : }
1528 : :
1529 : : static void* _egl_handle = NULL;
1530 : :
1531 : : static void* glad_egl_dlopen_handle(void) {
1532 : : #if GLAD_PLATFORM_APPLE
1533 : : static const char *NAMES[] = {"libEGL.dylib"};
1534 : : #elif GLAD_PLATFORM_WIN32
1535 : : static const char *NAMES[] = {"libEGL.dll", "EGL.dll"};
1536 : : #else
1537 : : static const char *NAMES[] = {"libEGL.so.1", "libEGL.so"};
1538 : : #endif
1539 : :
1540 : 2 : if (_egl_handle == NULL) {
1541 : 1 : _egl_handle = glad_get_dlopen_handle(NAMES, sizeof(NAMES) / sizeof(NAMES[0]));
1542 : : }
1543 : :
1544 : 2 : return _egl_handle;
1545 : : }
1546 : :
1547 : : static struct _glad_egl_userptr glad_egl_build_userptr(void *handle) {
1548 : : struct _glad_egl_userptr userptr;
1549 : : userptr.handle = handle;
1550 : : userptr.get_proc_address_ptr = (PFNEGLGETPROCADDRESSPROC) glad_dlsym_handle(handle, "eglGetProcAddress");
1551 : : return userptr;
1552 : : }
1553 : :
1554 : 2 : int gladLoaderLoadEGL(EGLDisplay display) {
1555 : : int version = 0;
1556 : : void *handle = NULL;
1557 : : int did_load = 0;
1558 : : struct _glad_egl_userptr userptr;
1559 : :
1560 [ + + ]: 2 : did_load = _egl_handle == NULL;
1561 : : handle = glad_egl_dlopen_handle();
1562 [ - + ]: 2 : if (handle != NULL) {
1563 : 2 : userptr = glad_egl_build_userptr(handle);
1564 : :
1565 [ + - ]: 2 : if (userptr.get_proc_address_ptr != NULL) {
1566 : 2 : version = gladLoadEGLUserPtr(display, glad_egl_get_proc, &userptr);
1567 : : }
1568 : :
1569 [ - + ]: 2 : if (!version && did_load) {
1570 : : gladLoaderUnloadEGL();
1571 : : }
1572 : : }
1573 : :
1574 : 2 : return version;
1575 : : }
1576 : :
1577 : :
1578 : 1 : void gladLoaderUnloadEGL(void) {
1579 [ + - - - ]: 1 : if (_egl_handle != NULL) {
1580 : : glad_close_dlopen_handle(_egl_handle);
1581 : 1 : _egl_handle = NULL;
1582 : : }
1583 : 1 : }
1584 : :
1585 : : #endif /* GLAD_EGL */
1586 : :
1587 : : #ifdef __cplusplus
1588 : : }
1589 : : #endif
1590 : :
1591 : : #endif /* GLAD_EGL_IMPLEMENTATION */
1592 : :
|