• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by generate_entry_points.py using data from egl.xml.
3 //
4 // Copyright 2020 The ANGLE Project Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style license that can be
6 // found in the LICENSE file.
7 //
8 // entry_points_egl_autogen.cpp:
9 //   Defines the EGL entry points.
10 
11 #include "libGLESv2/entry_points_egl_autogen.h"
12 
13 #include "libANGLE/entry_points_utils.h"
14 #include "libANGLE/validationEGL_autogen.h"
15 #include "libGLESv2/egl_ext_stubs_autogen.h"
16 #include "libGLESv2/egl_stubs_autogen.h"
17 #include "libGLESv2/global_state.h"
18 
19 using namespace egl;
20 
21 extern "C" {
22 
23 // EGL 1.0
EGL_ChooseConfig(EGLDisplay dpy,const EGLint * attrib_list,EGLConfig * configs,EGLint config_size,EGLint * num_config)24 EGLBoolean EGLAPIENTRY EGL_ChooseConfig(EGLDisplay dpy,
25                                         const EGLint *attrib_list,
26                                         EGLConfig *configs,
27                                         EGLint config_size,
28                                         EGLint *num_config)
29 {
30 
31     ANGLE_SCOPED_GLOBAL_LOCK();
32     EGL_EVENT(ChooseConfig,
33               "dpy = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR ", configs = 0x%016" PRIxPTR
34               ", config_size = %d, num_config = 0x%016" PRIxPTR "",
35               (uintptr_t)dpy, (uintptr_t)attrib_list, (uintptr_t)configs, config_size,
36               (uintptr_t)num_config);
37 
38     Thread *thread = egl::GetCurrentThread();
39 
40     egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
41     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
42 
43     ANGLE_EGL_VALIDATE(thread, ChooseConfig, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
44                        attrib_listPacked, configs, config_size, num_config);
45 
46     return ChooseConfig(thread, dpyPacked, attrib_listPacked, configs, config_size, num_config);
47 }
48 
EGL_CopyBuffers(EGLDisplay dpy,EGLSurface surface,EGLNativePixmapType target)49 EGLBoolean EGLAPIENTRY EGL_CopyBuffers(EGLDisplay dpy,
50                                        EGLSurface surface,
51                                        EGLNativePixmapType target)
52 {
53 
54     ANGLE_SCOPED_GLOBAL_SURFACE_LOCK();
55     ANGLE_SCOPED_GLOBAL_LOCK();
56     EGL_EVENT(CopyBuffers,
57               "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", target = 0x%016" PRIxPTR "",
58               (uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)target);
59 
60     Thread *thread = egl::GetCurrentThread();
61 
62     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
63     Surface *surfacePacked  = PackParam<Surface *>(surface);
64 
65     ANGLE_EGL_VALIDATE(thread, CopyBuffers, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
66                        surfacePacked, target);
67 
68     return CopyBuffers(thread, dpyPacked, surfacePacked, target);
69 }
70 
EGL_CreateContext(EGLDisplay dpy,EGLConfig config,EGLContext share_context,const EGLint * attrib_list)71 EGLContext EGLAPIENTRY EGL_CreateContext(EGLDisplay dpy,
72                                          EGLConfig config,
73                                          EGLContext share_context,
74                                          const EGLint *attrib_list)
75 {
76 
77     ANGLE_SCOPED_GLOBAL_LOCK();
78     EGL_EVENT(CreateContext,
79               "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", share_context = 0x%016" PRIxPTR
80               ", attrib_list = 0x%016" PRIxPTR "",
81               (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)share_context, (uintptr_t)attrib_list);
82 
83     Thread *thread = egl::GetCurrentThread();
84 
85     egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
86     Config *configPacked                  = PackParam<Config *>(config);
87     gl::Context *share_contextPacked      = PackParam<gl::Context *>(share_context);
88     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
89 
90     ANGLE_EGL_VALIDATE(thread, CreateContext, GetDisplayIfValid(dpyPacked), EGLContext, dpyPacked,
91                        configPacked, share_contextPacked, attrib_listPacked);
92 
93     return CreateContext(thread, dpyPacked, configPacked, share_contextPacked, attrib_listPacked);
94 }
95 
EGL_CreatePbufferSurface(EGLDisplay dpy,EGLConfig config,const EGLint * attrib_list)96 EGLSurface EGLAPIENTRY EGL_CreatePbufferSurface(EGLDisplay dpy,
97                                                 EGLConfig config,
98                                                 const EGLint *attrib_list)
99 {
100 
101     ANGLE_SCOPED_GLOBAL_LOCK();
102     EGL_EVENT(CreatePbufferSurface,
103               "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR
104               "",
105               (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)attrib_list);
106 
107     Thread *thread = egl::GetCurrentThread();
108 
109     egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
110     Config *configPacked                  = PackParam<Config *>(config);
111     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
112 
113     ANGLE_EGL_VALIDATE(thread, CreatePbufferSurface, GetDisplayIfValid(dpyPacked), EGLSurface,
114                        dpyPacked, configPacked, attrib_listPacked);
115 
116     return CreatePbufferSurface(thread, dpyPacked, configPacked, attrib_listPacked);
117 }
118 
EGL_CreatePixmapSurface(EGLDisplay dpy,EGLConfig config,EGLNativePixmapType pixmap,const EGLint * attrib_list)119 EGLSurface EGLAPIENTRY EGL_CreatePixmapSurface(EGLDisplay dpy,
120                                                EGLConfig config,
121                                                EGLNativePixmapType pixmap,
122                                                const EGLint *attrib_list)
123 {
124 
125     ANGLE_SCOPED_GLOBAL_LOCK();
126     EGL_EVENT(CreatePixmapSurface,
127               "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", pixmap = 0x%016" PRIxPTR
128               ", attrib_list = 0x%016" PRIxPTR "",
129               (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)pixmap, (uintptr_t)attrib_list);
130 
131     Thread *thread = egl::GetCurrentThread();
132 
133     egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
134     Config *configPacked                  = PackParam<Config *>(config);
135     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
136 
137     ANGLE_EGL_VALIDATE(thread, CreatePixmapSurface, GetDisplayIfValid(dpyPacked), EGLSurface,
138                        dpyPacked, configPacked, pixmap, attrib_listPacked);
139 
140     return CreatePixmapSurface(thread, dpyPacked, configPacked, pixmap, attrib_listPacked);
141 }
142 
EGL_CreateWindowSurface(EGLDisplay dpy,EGLConfig config,EGLNativeWindowType win,const EGLint * attrib_list)143 EGLSurface EGLAPIENTRY EGL_CreateWindowSurface(EGLDisplay dpy,
144                                                EGLConfig config,
145                                                EGLNativeWindowType win,
146                                                const EGLint *attrib_list)
147 {
148 
149     ANGLE_SCOPED_GLOBAL_LOCK();
150     EGL_EVENT(CreateWindowSurface,
151               "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", win = 0x%016" PRIxPTR
152               ", attrib_list = 0x%016" PRIxPTR "",
153               (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)win, (uintptr_t)attrib_list);
154 
155     Thread *thread = egl::GetCurrentThread();
156 
157     egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
158     Config *configPacked                  = PackParam<Config *>(config);
159     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
160 
161     ANGLE_EGL_VALIDATE(thread, CreateWindowSurface, GetDisplayIfValid(dpyPacked), EGLSurface,
162                        dpyPacked, configPacked, win, attrib_listPacked);
163 
164     return CreateWindowSurface(thread, dpyPacked, configPacked, win, attrib_listPacked);
165 }
166 
EGL_DestroyContext(EGLDisplay dpy,EGLContext ctx)167 EGLBoolean EGLAPIENTRY EGL_DestroyContext(EGLDisplay dpy, EGLContext ctx)
168 {
169 
170     ANGLE_SCOPED_GLOBAL_LOCK();
171     EGL_EVENT(DestroyContext, "dpy = 0x%016" PRIxPTR ", ctx = 0x%016" PRIxPTR "", (uintptr_t)dpy,
172               (uintptr_t)ctx);
173 
174     Thread *thread = egl::GetCurrentThread();
175 
176     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
177     gl::Context *ctxPacked  = PackParam<gl::Context *>(ctx);
178 
179     ANGLE_EGL_VALIDATE(thread, DestroyContext, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
180                        ctxPacked);
181 
182     return DestroyContext(thread, dpyPacked, ctxPacked);
183 }
184 
EGL_DestroySurface(EGLDisplay dpy,EGLSurface surface)185 EGLBoolean EGLAPIENTRY EGL_DestroySurface(EGLDisplay dpy, EGLSurface surface)
186 {
187 
188     ANGLE_SCOPED_GLOBAL_SURFACE_LOCK();
189     ANGLE_SCOPED_GLOBAL_LOCK();
190     EGL_EVENT(DestroySurface, "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR "",
191               (uintptr_t)dpy, (uintptr_t)surface);
192 
193     Thread *thread = egl::GetCurrentThread();
194 
195     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
196     Surface *surfacePacked  = PackParam<Surface *>(surface);
197 
198     ANGLE_EGL_VALIDATE(thread, DestroySurface, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
199                        surfacePacked);
200 
201     return DestroySurface(thread, dpyPacked, surfacePacked);
202 }
203 
EGL_GetConfigAttrib(EGLDisplay dpy,EGLConfig config,EGLint attribute,EGLint * value)204 EGLBoolean EGLAPIENTRY EGL_GetConfigAttrib(EGLDisplay dpy,
205                                            EGLConfig config,
206                                            EGLint attribute,
207                                            EGLint *value)
208 {
209 
210     ANGLE_SCOPED_GLOBAL_LOCK();
211     EGL_EVENT(GetConfigAttrib,
212               "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR
213               ", attribute = %d, value = 0x%016" PRIxPTR "",
214               (uintptr_t)dpy, (uintptr_t)config, attribute, (uintptr_t)value);
215 
216     Thread *thread = egl::GetCurrentThread();
217 
218     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
219     Config *configPacked    = PackParam<Config *>(config);
220 
221     ANGLE_EGL_VALIDATE(thread, GetConfigAttrib, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
222                        configPacked, attribute, value);
223 
224     return GetConfigAttrib(thread, dpyPacked, configPacked, attribute, value);
225 }
226 
EGL_GetConfigs(EGLDisplay dpy,EGLConfig * configs,EGLint config_size,EGLint * num_config)227 EGLBoolean EGLAPIENTRY EGL_GetConfigs(EGLDisplay dpy,
228                                       EGLConfig *configs,
229                                       EGLint config_size,
230                                       EGLint *num_config)
231 {
232 
233     ANGLE_SCOPED_GLOBAL_LOCK();
234     EGL_EVENT(GetConfigs,
235               "dpy = 0x%016" PRIxPTR ", configs = 0x%016" PRIxPTR
236               ", config_size = %d, num_config = 0x%016" PRIxPTR "",
237               (uintptr_t)dpy, (uintptr_t)configs, config_size, (uintptr_t)num_config);
238 
239     Thread *thread = egl::GetCurrentThread();
240 
241     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
242 
243     ANGLE_EGL_VALIDATE(thread, GetConfigs, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
244                        configs, config_size, num_config);
245 
246     return GetConfigs(thread, dpyPacked, configs, config_size, num_config);
247 }
248 
EGL_GetCurrentDisplay()249 EGLDisplay EGLAPIENTRY EGL_GetCurrentDisplay()
250 {
251 
252     ANGLE_SCOPED_GLOBAL_LOCK();
253     EGL_EVENT(GetCurrentDisplay, "");
254 
255     Thread *thread = egl::GetCurrentThread();
256 
257     ANGLE_EGL_VALIDATE(thread, GetCurrentDisplay, nullptr, EGLDisplay);
258 
259     return GetCurrentDisplay(thread);
260 }
261 
EGL_GetCurrentSurface(EGLint readdraw)262 EGLSurface EGLAPIENTRY EGL_GetCurrentSurface(EGLint readdraw)
263 {
264 
265     ANGLE_SCOPED_GLOBAL_LOCK();
266     EGL_EVENT(GetCurrentSurface, "readdraw = %d", readdraw);
267 
268     Thread *thread = egl::GetCurrentThread();
269 
270     ANGLE_EGL_VALIDATE(thread, GetCurrentSurface, nullptr, EGLSurface, readdraw);
271 
272     return GetCurrentSurface(thread, readdraw);
273 }
274 
EGL_GetDisplay(EGLNativeDisplayType display_id)275 EGLDisplay EGLAPIENTRY EGL_GetDisplay(EGLNativeDisplayType display_id)
276 {
277 
278     ANGLE_SCOPED_GLOBAL_LOCK();
279     EGL_EVENT(GetDisplay, "display_id = 0x%016" PRIxPTR "", (uintptr_t)display_id);
280 
281     Thread *thread = egl::GetCurrentThread();
282 
283     ANGLE_EGL_VALIDATE(thread, GetDisplay, nullptr, EGLDisplay, display_id);
284 
285     return GetDisplay(thread, display_id);
286 }
287 
EGL_GetError()288 EGLint EGLAPIENTRY EGL_GetError()
289 {
290 
291     ANGLE_SCOPED_GLOBAL_LOCK();
292     EGL_EVENT(GetError, "");
293 
294     Thread *thread = egl::GetCurrentThread();
295 
296     ANGLE_EGL_VALIDATE(thread, GetError, nullptr, EGLint);
297 
298     return GetError(thread);
299 }
300 
EGL_GetProcAddress(const char * procname)301 __eglMustCastToProperFunctionPointerType EGLAPIENTRY EGL_GetProcAddress(const char *procname)
302 {
303 
304     ANGLE_SCOPED_GLOBAL_LOCK();
305     EGL_EVENT(GetProcAddress, "procname = 0x%016" PRIxPTR "", (uintptr_t)procname);
306 
307     Thread *thread = egl::GetCurrentThread();
308 
309     ANGLE_EGL_VALIDATE(thread, GetProcAddress, nullptr, __eglMustCastToProperFunctionPointerType,
310                        procname);
311 
312     return GetProcAddress(thread, procname);
313 }
314 
EGL_Initialize(EGLDisplay dpy,EGLint * major,EGLint * minor)315 EGLBoolean EGLAPIENTRY EGL_Initialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
316 {
317 
318     ANGLE_SCOPED_GLOBAL_LOCK();
319     EGL_EVENT(Initialize,
320               "dpy = 0x%016" PRIxPTR ", major = 0x%016" PRIxPTR ", minor = 0x%016" PRIxPTR "",
321               (uintptr_t)dpy, (uintptr_t)major, (uintptr_t)minor);
322 
323     Thread *thread = egl::GetCurrentThread();
324 
325     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
326 
327     ANGLE_EGL_VALIDATE(thread, Initialize, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
328                        major, minor);
329 
330     return Initialize(thread, dpyPacked, major, minor);
331 }
332 
EGL_MakeCurrent(EGLDisplay dpy,EGLSurface draw,EGLSurface read,EGLContext ctx)333 EGLBoolean EGLAPIENTRY EGL_MakeCurrent(EGLDisplay dpy,
334                                        EGLSurface draw,
335                                        EGLSurface read,
336                                        EGLContext ctx)
337 {
338 
339     ANGLE_SCOPED_GLOBAL_SURFACE_LOCK();
340     ANGLE_SCOPED_GLOBAL_LOCK();
341     EGL_EVENT(MakeCurrent,
342               "dpy = 0x%016" PRIxPTR ", draw = 0x%016" PRIxPTR ", read = 0x%016" PRIxPTR
343               ", ctx = 0x%016" PRIxPTR "",
344               (uintptr_t)dpy, (uintptr_t)draw, (uintptr_t)read, (uintptr_t)ctx);
345 
346     Thread *thread = egl::GetCurrentThread();
347 
348     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
349     Surface *drawPacked     = PackParam<Surface *>(draw);
350     Surface *readPacked     = PackParam<Surface *>(read);
351     gl::Context *ctxPacked  = PackParam<gl::Context *>(ctx);
352 
353     ANGLE_EGL_VALIDATE(thread, MakeCurrent, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
354                        drawPacked, readPacked, ctxPacked);
355 
356     return MakeCurrent(thread, dpyPacked, drawPacked, readPacked, ctxPacked);
357 }
358 
EGL_QueryContext(EGLDisplay dpy,EGLContext ctx,EGLint attribute,EGLint * value)359 EGLBoolean EGLAPIENTRY EGL_QueryContext(EGLDisplay dpy,
360                                         EGLContext ctx,
361                                         EGLint attribute,
362                                         EGLint *value)
363 {
364 
365     ANGLE_SCOPED_GLOBAL_LOCK();
366     EGL_EVENT(QueryContext,
367               "dpy = 0x%016" PRIxPTR ", ctx = 0x%016" PRIxPTR
368               ", attribute = %d, value = 0x%016" PRIxPTR "",
369               (uintptr_t)dpy, (uintptr_t)ctx, attribute, (uintptr_t)value);
370 
371     Thread *thread = egl::GetCurrentThread();
372 
373     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
374     gl::Context *ctxPacked  = PackParam<gl::Context *>(ctx);
375 
376     ANGLE_EGL_VALIDATE(thread, QueryContext, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
377                        ctxPacked, attribute, value);
378 
379     return QueryContext(thread, dpyPacked, ctxPacked, attribute, value);
380 }
381 
EGL_QueryString(EGLDisplay dpy,EGLint name)382 const char *EGLAPIENTRY EGL_QueryString(EGLDisplay dpy, EGLint name)
383 {
384 
385     ANGLE_SCOPED_GLOBAL_LOCK();
386     EGL_EVENT(QueryString, "dpy = 0x%016" PRIxPTR ", name = %d", (uintptr_t)dpy, name);
387 
388     Thread *thread = egl::GetCurrentThread();
389 
390     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
391 
392     ANGLE_EGL_VALIDATE(thread, QueryString, GetDisplayIfValid(dpyPacked), const char *, dpyPacked,
393                        name);
394 
395     return QueryString(thread, dpyPacked, name);
396 }
397 
EGL_QuerySurface(EGLDisplay dpy,EGLSurface surface,EGLint attribute,EGLint * value)398 EGLBoolean EGLAPIENTRY EGL_QuerySurface(EGLDisplay dpy,
399                                         EGLSurface surface,
400                                         EGLint attribute,
401                                         EGLint *value)
402 {
403 
404     ANGLE_SCOPED_GLOBAL_SURFACE_LOCK();
405     ANGLE_SCOPED_GLOBAL_LOCK();
406     EGL_EVENT(QuerySurface,
407               "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR
408               ", attribute = %d, value = 0x%016" PRIxPTR "",
409               (uintptr_t)dpy, (uintptr_t)surface, attribute, (uintptr_t)value);
410 
411     Thread *thread = egl::GetCurrentThread();
412 
413     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
414     Surface *surfacePacked  = PackParam<Surface *>(surface);
415 
416     ANGLE_EGL_VALIDATE(thread, QuerySurface, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
417                        surfacePacked, attribute, value);
418 
419     return QuerySurface(thread, dpyPacked, surfacePacked, attribute, value);
420 }
421 
EGL_SwapBuffers(EGLDisplay dpy,EGLSurface surface)422 EGLBoolean EGLAPIENTRY EGL_SwapBuffers(EGLDisplay dpy, EGLSurface surface)
423 {
424     ANGLE_EGLBOOLEAN_TRY(PrepareSwapBuffersANGLE(dpy, surface));
425     ANGLE_SCOPED_GLOBAL_SURFACE_LOCK();
426     ANGLE_SCOPED_GLOBAL_LOCK();
427     EGL_EVENT(SwapBuffers, "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR "", (uintptr_t)dpy,
428               (uintptr_t)surface);
429 
430     Thread *thread = egl::GetCurrentThread();
431 
432     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
433     Surface *surfacePacked  = PackParam<Surface *>(surface);
434 
435     ANGLE_EGL_VALIDATE(thread, SwapBuffers, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
436                        surfacePacked);
437 
438     return SwapBuffers(thread, dpyPacked, surfacePacked);
439 }
440 
EGL_Terminate(EGLDisplay dpy)441 EGLBoolean EGLAPIENTRY EGL_Terminate(EGLDisplay dpy)
442 {
443 
444     ANGLE_SCOPED_GLOBAL_LOCK();
445     EGL_EVENT(Terminate, "dpy = 0x%016" PRIxPTR "", (uintptr_t)dpy);
446 
447     Thread *thread = egl::GetCurrentThread();
448 
449     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
450 
451     ANGLE_EGL_VALIDATE(thread, Terminate, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked);
452 
453     return Terminate(thread, dpyPacked);
454 }
455 
EGL_WaitGL()456 EGLBoolean EGLAPIENTRY EGL_WaitGL()
457 {
458 
459     ANGLE_SCOPED_GLOBAL_LOCK();
460     EGL_EVENT(WaitGL, "");
461 
462     Thread *thread = egl::GetCurrentThread();
463 
464     ANGLE_EGL_VALIDATE(thread, WaitGL, nullptr, EGLBoolean);
465 
466     return WaitGL(thread);
467 }
468 
EGL_WaitNative(EGLint engine)469 EGLBoolean EGLAPIENTRY EGL_WaitNative(EGLint engine)
470 {
471 
472     ANGLE_SCOPED_GLOBAL_LOCK();
473     EGL_EVENT(WaitNative, "engine = %d", engine);
474 
475     Thread *thread = egl::GetCurrentThread();
476 
477     ANGLE_EGL_VALIDATE(thread, WaitNative, nullptr, EGLBoolean, engine);
478 
479     return WaitNative(thread, engine);
480 }
481 
482 // EGL 1.1
EGL_BindTexImage(EGLDisplay dpy,EGLSurface surface,EGLint buffer)483 EGLBoolean EGLAPIENTRY EGL_BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
484 {
485 
486     ANGLE_SCOPED_GLOBAL_SURFACE_LOCK();
487     ANGLE_SCOPED_GLOBAL_LOCK();
488     EGL_EVENT(BindTexImage, "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", buffer = %d",
489               (uintptr_t)dpy, (uintptr_t)surface, buffer);
490 
491     Thread *thread = egl::GetCurrentThread();
492 
493     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
494     Surface *surfacePacked  = PackParam<Surface *>(surface);
495 
496     ANGLE_EGL_VALIDATE(thread, BindTexImage, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
497                        surfacePacked, buffer);
498 
499     return BindTexImage(thread, dpyPacked, surfacePacked, buffer);
500 }
501 
EGL_ReleaseTexImage(EGLDisplay dpy,EGLSurface surface,EGLint buffer)502 EGLBoolean EGLAPIENTRY EGL_ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
503 {
504 
505     ANGLE_SCOPED_GLOBAL_SURFACE_LOCK();
506     ANGLE_SCOPED_GLOBAL_LOCK();
507     EGL_EVENT(ReleaseTexImage, "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", buffer = %d",
508               (uintptr_t)dpy, (uintptr_t)surface, buffer);
509 
510     Thread *thread = egl::GetCurrentThread();
511 
512     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
513     Surface *surfacePacked  = PackParam<Surface *>(surface);
514 
515     ANGLE_EGL_VALIDATE(thread, ReleaseTexImage, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
516                        surfacePacked, buffer);
517 
518     return ReleaseTexImage(thread, dpyPacked, surfacePacked, buffer);
519 }
520 
EGL_SurfaceAttrib(EGLDisplay dpy,EGLSurface surface,EGLint attribute,EGLint value)521 EGLBoolean EGLAPIENTRY EGL_SurfaceAttrib(EGLDisplay dpy,
522                                          EGLSurface surface,
523                                          EGLint attribute,
524                                          EGLint value)
525 {
526 
527     ANGLE_SCOPED_GLOBAL_SURFACE_LOCK();
528     ANGLE_SCOPED_GLOBAL_LOCK();
529     EGL_EVENT(SurfaceAttrib,
530               "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", attribute = %d, value = %d",
531               (uintptr_t)dpy, (uintptr_t)surface, attribute, value);
532 
533     Thread *thread = egl::GetCurrentThread();
534 
535     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
536     Surface *surfacePacked  = PackParam<Surface *>(surface);
537 
538     ANGLE_EGL_VALIDATE(thread, SurfaceAttrib, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
539                        surfacePacked, attribute, value);
540 
541     return SurfaceAttrib(thread, dpyPacked, surfacePacked, attribute, value);
542 }
543 
EGL_SwapInterval(EGLDisplay dpy,EGLint interval)544 EGLBoolean EGLAPIENTRY EGL_SwapInterval(EGLDisplay dpy, EGLint interval)
545 {
546 
547     ANGLE_SCOPED_GLOBAL_LOCK();
548     EGL_EVENT(SwapInterval, "dpy = 0x%016" PRIxPTR ", interval = %d", (uintptr_t)dpy, interval);
549 
550     Thread *thread = egl::GetCurrentThread();
551 
552     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
553 
554     ANGLE_EGL_VALIDATE(thread, SwapInterval, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
555                        interval);
556 
557     return SwapInterval(thread, dpyPacked, interval);
558 }
559 
560 // EGL 1.2
EGL_BindAPI(EGLenum api)561 EGLBoolean EGLAPIENTRY EGL_BindAPI(EGLenum api)
562 {
563 
564     ANGLE_SCOPED_GLOBAL_LOCK();
565     EGL_EVENT(BindAPI, "api = 0x%X", api);
566 
567     Thread *thread = egl::GetCurrentThread();
568 
569     ANGLE_EGL_VALIDATE(thread, BindAPI, nullptr, EGLBoolean, api);
570 
571     return BindAPI(thread, api);
572 }
573 
EGL_CreatePbufferFromClientBuffer(EGLDisplay dpy,EGLenum buftype,EGLClientBuffer buffer,EGLConfig config,const EGLint * attrib_list)574 EGLSurface EGLAPIENTRY EGL_CreatePbufferFromClientBuffer(EGLDisplay dpy,
575                                                          EGLenum buftype,
576                                                          EGLClientBuffer buffer,
577                                                          EGLConfig config,
578                                                          const EGLint *attrib_list)
579 {
580 
581     ANGLE_SCOPED_GLOBAL_LOCK();
582     EGL_EVENT(CreatePbufferFromClientBuffer,
583               "dpy = 0x%016" PRIxPTR ", buftype = 0x%X, buffer = 0x%016" PRIxPTR
584               ", config = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
585               (uintptr_t)dpy, buftype, (uintptr_t)buffer, (uintptr_t)config,
586               (uintptr_t)attrib_list);
587 
588     Thread *thread = egl::GetCurrentThread();
589 
590     egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
591     Config *configPacked                  = PackParam<Config *>(config);
592     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
593 
594     ANGLE_EGL_VALIDATE(thread, CreatePbufferFromClientBuffer, GetDisplayIfValid(dpyPacked),
595                        EGLSurface, dpyPacked, buftype, buffer, configPacked, attrib_listPacked);
596 
597     return CreatePbufferFromClientBuffer(thread, dpyPacked, buftype, buffer, configPacked,
598                                          attrib_listPacked);
599 }
600 
EGL_QueryAPI()601 EGLenum EGLAPIENTRY EGL_QueryAPI()
602 {
603 
604     ANGLE_SCOPED_GLOBAL_LOCK();
605     EGL_EVENT(QueryAPI, "");
606 
607     Thread *thread = egl::GetCurrentThread();
608 
609     ANGLE_EGL_VALIDATE(thread, QueryAPI, nullptr, EGLenum);
610 
611     return QueryAPI(thread);
612 }
613 
EGL_ReleaseThread()614 EGLBoolean EGLAPIENTRY EGL_ReleaseThread()
615 {
616 
617     ANGLE_SCOPED_GLOBAL_LOCK();
618     EGL_EVENT(ReleaseThread, "");
619 
620     Thread *thread = egl::GetCurrentThread();
621 
622     ANGLE_EGL_VALIDATE(thread, ReleaseThread, nullptr, EGLBoolean);
623 
624     return ReleaseThread(thread);
625 }
626 
EGL_WaitClient()627 EGLBoolean EGLAPIENTRY EGL_WaitClient()
628 {
629 
630     ANGLE_SCOPED_GLOBAL_LOCK();
631     EGL_EVENT(WaitClient, "");
632 
633     Thread *thread = egl::GetCurrentThread();
634 
635     ANGLE_EGL_VALIDATE(thread, WaitClient, nullptr, EGLBoolean);
636 
637     return WaitClient(thread);
638 }
639 
640 // EGL 1.4
EGL_GetCurrentContext()641 EGLContext EGLAPIENTRY EGL_GetCurrentContext()
642 {
643 
644     ANGLE_SCOPED_GLOBAL_LOCK();
645     EGL_EVENT(GetCurrentContext, "");
646 
647     Thread *thread = egl::GetCurrentThread();
648 
649     ANGLE_EGL_VALIDATE(thread, GetCurrentContext, nullptr, EGLContext);
650 
651     return GetCurrentContext(thread);
652 }
653 
654 // EGL 1.5
EGL_ClientWaitSync(EGLDisplay dpy,EGLSync sync,EGLint flags,EGLTime timeout)655 EGLint EGLAPIENTRY EGL_ClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout)
656 {
657 
658     ANGLE_SCOPED_GLOBAL_LOCK();
659     EGL_EVENT(ClientWaitSync,
660               "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR ", flags = %d, timeout = %llu",
661               (uintptr_t)dpy, (uintptr_t)sync, flags, static_cast<unsigned long long>(timeout));
662 
663     Thread *thread = egl::GetCurrentThread();
664 
665     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
666     Sync *syncPacked        = PackParam<Sync *>(sync);
667 
668     ANGLE_EGL_VALIDATE(thread, ClientWaitSync, GetDisplayIfValid(dpyPacked), EGLint, dpyPacked,
669                        syncPacked, flags, timeout);
670 
671     return ClientWaitSync(thread, dpyPacked, syncPacked, flags, timeout);
672 }
673 
EGL_CreateImage(EGLDisplay dpy,EGLContext ctx,EGLenum target,EGLClientBuffer buffer,const EGLAttrib * attrib_list)674 EGLImage EGLAPIENTRY EGL_CreateImage(EGLDisplay dpy,
675                                      EGLContext ctx,
676                                      EGLenum target,
677                                      EGLClientBuffer buffer,
678                                      const EGLAttrib *attrib_list)
679 {
680 
681     ANGLE_SCOPED_GLOBAL_LOCK();
682     EGL_EVENT(CreateImage,
683               "dpy = 0x%016" PRIxPTR ", ctx = 0x%016" PRIxPTR
684               ", target = 0x%X, buffer = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
685               (uintptr_t)dpy, (uintptr_t)ctx, target, (uintptr_t)buffer, (uintptr_t)attrib_list);
686 
687     Thread *thread = egl::GetCurrentThread();
688 
689     egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
690     gl::Context *ctxPacked                = PackParam<gl::Context *>(ctx);
691     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
692 
693     ANGLE_EGL_VALIDATE(thread, CreateImage, GetDisplayIfValid(dpyPacked), EGLImage, dpyPacked,
694                        ctxPacked, target, buffer, attrib_listPacked);
695 
696     return CreateImage(thread, dpyPacked, ctxPacked, target, buffer, attrib_listPacked);
697 }
698 
EGL_CreatePlatformPixmapSurface(EGLDisplay dpy,EGLConfig config,void * native_pixmap,const EGLAttrib * attrib_list)699 EGLSurface EGLAPIENTRY EGL_CreatePlatformPixmapSurface(EGLDisplay dpy,
700                                                        EGLConfig config,
701                                                        void *native_pixmap,
702                                                        const EGLAttrib *attrib_list)
703 {
704 
705     ANGLE_SCOPED_GLOBAL_LOCK();
706     EGL_EVENT(CreatePlatformPixmapSurface,
707               "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", native_pixmap = 0x%016" PRIxPTR
708               ", attrib_list = 0x%016" PRIxPTR "",
709               (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_pixmap, (uintptr_t)attrib_list);
710 
711     Thread *thread = egl::GetCurrentThread();
712 
713     egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
714     Config *configPacked                  = PackParam<Config *>(config);
715     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
716 
717     ANGLE_EGL_VALIDATE(thread, CreatePlatformPixmapSurface, GetDisplayIfValid(dpyPacked),
718                        EGLSurface, dpyPacked, configPacked, native_pixmap, attrib_listPacked);
719 
720     return CreatePlatformPixmapSurface(thread, dpyPacked, configPacked, native_pixmap,
721                                        attrib_listPacked);
722 }
723 
EGL_CreatePlatformWindowSurface(EGLDisplay dpy,EGLConfig config,void * native_window,const EGLAttrib * attrib_list)724 EGLSurface EGLAPIENTRY EGL_CreatePlatformWindowSurface(EGLDisplay dpy,
725                                                        EGLConfig config,
726                                                        void *native_window,
727                                                        const EGLAttrib *attrib_list)
728 {
729 
730     ANGLE_SCOPED_GLOBAL_LOCK();
731     EGL_EVENT(CreatePlatformWindowSurface,
732               "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", native_window = 0x%016" PRIxPTR
733               ", attrib_list = 0x%016" PRIxPTR "",
734               (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_window, (uintptr_t)attrib_list);
735 
736     Thread *thread = egl::GetCurrentThread();
737 
738     egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
739     Config *configPacked                  = PackParam<Config *>(config);
740     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
741 
742     ANGLE_EGL_VALIDATE(thread, CreatePlatformWindowSurface, GetDisplayIfValid(dpyPacked),
743                        EGLSurface, dpyPacked, configPacked, native_window, attrib_listPacked);
744 
745     return CreatePlatformWindowSurface(thread, dpyPacked, configPacked, native_window,
746                                        attrib_listPacked);
747 }
748 
EGL_CreateSync(EGLDisplay dpy,EGLenum type,const EGLAttrib * attrib_list)749 EGLSync EGLAPIENTRY EGL_CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
750 {
751 
752     ANGLE_SCOPED_GLOBAL_LOCK();
753     EGL_EVENT(CreateSync, "dpy = 0x%016" PRIxPTR ", type = 0x%X, attrib_list = 0x%016" PRIxPTR "",
754               (uintptr_t)dpy, type, (uintptr_t)attrib_list);
755 
756     Thread *thread = egl::GetCurrentThread();
757 
758     egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
759     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
760 
761     ANGLE_EGL_VALIDATE(thread, CreateSync, GetDisplayIfValid(dpyPacked), EGLSync, dpyPacked, type,
762                        attrib_listPacked);
763 
764     return CreateSync(thread, dpyPacked, type, attrib_listPacked);
765 }
766 
EGL_DestroyImage(EGLDisplay dpy,EGLImage image)767 EGLBoolean EGLAPIENTRY EGL_DestroyImage(EGLDisplay dpy, EGLImage image)
768 {
769 
770     ANGLE_SCOPED_GLOBAL_LOCK();
771     EGL_EVENT(DestroyImage, "dpy = 0x%016" PRIxPTR ", image = 0x%016" PRIxPTR "", (uintptr_t)dpy,
772               (uintptr_t)image);
773 
774     Thread *thread = egl::GetCurrentThread();
775 
776     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
777     Image *imagePacked      = PackParam<Image *>(image);
778 
779     ANGLE_EGL_VALIDATE(thread, DestroyImage, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
780                        imagePacked);
781 
782     return DestroyImage(thread, dpyPacked, imagePacked);
783 }
784 
EGL_DestroySync(EGLDisplay dpy,EGLSync sync)785 EGLBoolean EGLAPIENTRY EGL_DestroySync(EGLDisplay dpy, EGLSync sync)
786 {
787 
788     ANGLE_SCOPED_GLOBAL_LOCK();
789     EGL_EVENT(DestroySync, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR "", (uintptr_t)dpy,
790               (uintptr_t)sync);
791 
792     Thread *thread = egl::GetCurrentThread();
793 
794     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
795     Sync *syncPacked        = PackParam<Sync *>(sync);
796 
797     ANGLE_EGL_VALIDATE(thread, DestroySync, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
798                        syncPacked);
799 
800     return DestroySync(thread, dpyPacked, syncPacked);
801 }
802 
EGL_GetPlatformDisplay(EGLenum platform,void * native_display,const EGLAttrib * attrib_list)803 EGLDisplay EGLAPIENTRY EGL_GetPlatformDisplay(EGLenum platform,
804                                               void *native_display,
805                                               const EGLAttrib *attrib_list)
806 {
807 
808     ANGLE_SCOPED_GLOBAL_LOCK();
809     EGL_EVENT(GetPlatformDisplay,
810               "platform = 0x%X, native_display = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR
811               "",
812               platform, (uintptr_t)native_display, (uintptr_t)attrib_list);
813 
814     Thread *thread = egl::GetCurrentThread();
815 
816     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
817 
818     ANGLE_EGL_VALIDATE(thread, GetPlatformDisplay, nullptr, EGLDisplay, platform, native_display,
819                        attrib_listPacked);
820 
821     return GetPlatformDisplay(thread, platform, native_display, attrib_listPacked);
822 }
823 
EGL_GetSyncAttrib(EGLDisplay dpy,EGLSync sync,EGLint attribute,EGLAttrib * value)824 EGLBoolean EGLAPIENTRY EGL_GetSyncAttrib(EGLDisplay dpy,
825                                          EGLSync sync,
826                                          EGLint attribute,
827                                          EGLAttrib *value)
828 {
829 
830     ANGLE_SCOPED_GLOBAL_LOCK();
831     EGL_EVENT(GetSyncAttrib,
832               "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR
833               ", attribute = %d, value = 0x%016" PRIxPTR "",
834               (uintptr_t)dpy, (uintptr_t)sync, attribute, (uintptr_t)value);
835 
836     Thread *thread = egl::GetCurrentThread();
837 
838     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
839     Sync *syncPacked        = PackParam<Sync *>(sync);
840 
841     ANGLE_EGL_VALIDATE(thread, GetSyncAttrib, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
842                        syncPacked, attribute, value);
843 
844     return GetSyncAttrib(thread, dpyPacked, syncPacked, attribute, value);
845 }
846 
EGL_WaitSync(EGLDisplay dpy,EGLSync sync,EGLint flags)847 EGLBoolean EGLAPIENTRY EGL_WaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
848 {
849 
850     ANGLE_SCOPED_GLOBAL_LOCK();
851     EGL_EVENT(WaitSync, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR ", flags = %d",
852               (uintptr_t)dpy, (uintptr_t)sync, flags);
853 
854     Thread *thread = egl::GetCurrentThread();
855 
856     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
857     Sync *syncPacked        = PackParam<Sync *>(sync);
858 
859     ANGLE_EGL_VALIDATE(thread, WaitSync, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
860                        syncPacked, flags);
861 
862     return WaitSync(thread, dpyPacked, syncPacked, flags);
863 }
864 
865 }  // extern "C"
866