xref: /aosp_15_r20/external/angle/src/libGLESv2/entry_points_egl_autogen.cpp (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
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 #include "libGLESv2/entry_points_egl_ext_autogen.h"
13 
14 #include "libANGLE/capture/capture_egl_autogen.h"
15 #include "libANGLE/entry_points_utils.h"
16 #include "libANGLE/validationEGL_autogen.h"
17 #include "libGLESv2/egl_context_lock_impl.h"
18 #include "libGLESv2/egl_ext_stubs_autogen.h"
19 #include "libGLESv2/egl_stubs_autogen.h"
20 #include "libGLESv2/global_state.h"
21 
22 using namespace egl;
23 
24 extern "C" {
25 
26 // EGL 1.0
EGL_ChooseConfig(EGLDisplay dpy,const EGLint * attrib_list,EGLConfig * configs,EGLint config_size,EGLint * num_config)27 EGLBoolean EGLAPIENTRY EGL_ChooseConfig(EGLDisplay dpy,
28                                         const EGLint *attrib_list,
29                                         EGLConfig *configs,
30                                         EGLint config_size,
31                                         EGLint *num_config)
32 {
33 
34     Thread *thread = egl::GetCurrentThread();
35     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
36     EGLBoolean returnValue;
37     {
38         ANGLE_SCOPED_GLOBAL_LOCK();
39         EGL_EVENT(ChooseConfig,
40                   "dpy = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR
41                   ", configs = 0x%016" PRIxPTR ", config_size = %d, num_config = 0x%016" PRIxPTR "",
42                   (uintptr_t)dpy, (uintptr_t)attrib_list, (uintptr_t)configs, config_size,
43                   (uintptr_t)num_config);
44 
45         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
46         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
47 
48         {
49             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ChooseConfig, thread, dpyPacked);
50             if (IsEGLValidationEnabled())
51             {
52                 ANGLE_EGL_VALIDATE(thread, ChooseConfig, GetDisplayIfValid(dpyPacked), EGLBoolean,
53                                    dpyPacked, attrib_listPacked, configs, config_size, num_config);
54             }
55             else
56             {
57                 attrib_listPacked.initializeWithoutValidation();
58             }
59 
60             returnValue = ChooseConfig(thread, dpyPacked, attrib_listPacked, configs, config_size,
61                                        num_config);
62         }
63 
64         ANGLE_CAPTURE_EGL(ChooseConfig, true, thread, dpyPacked, attrib_listPacked, configs,
65                           config_size, num_config, returnValue);
66     }
67     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
68     return returnValue;
69 }
70 
EGL_CopyBuffers(EGLDisplay dpy,EGLSurface surface,EGLNativePixmapType target)71 EGLBoolean EGLAPIENTRY EGL_CopyBuffers(EGLDisplay dpy,
72                                        EGLSurface surface,
73                                        EGLNativePixmapType target)
74 {
75 
76     Thread *thread = egl::GetCurrentThread();
77     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
78     EGLBoolean returnValue;
79     {
80         ANGLE_SCOPED_GLOBAL_LOCK();
81         EGL_EVENT(CopyBuffers,
82                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", target = 0x%016" PRIxPTR
83                   "",
84                   (uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)target);
85 
86         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
87         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
88 
89         {
90             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CopyBuffers, thread, dpyPacked);
91             if (IsEGLValidationEnabled())
92             {
93                 ANGLE_EGL_VALIDATE(thread, CopyBuffers, GetDisplayIfValid(dpyPacked), EGLBoolean,
94                                    dpyPacked, surfacePacked, target);
95             }
96             else
97             {
98             }
99 
100             returnValue = CopyBuffers(thread, dpyPacked, surfacePacked, target);
101         }
102 
103         ANGLE_CAPTURE_EGL(CopyBuffers, true, thread, dpyPacked, surfacePacked, target, returnValue);
104     }
105     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
106     return returnValue;
107 }
108 
EGL_CreateContext(EGLDisplay dpy,EGLConfig config,EGLContext share_context,const EGLint * attrib_list)109 EGLContext EGLAPIENTRY EGL_CreateContext(EGLDisplay dpy,
110                                          EGLConfig config,
111                                          EGLContext share_context,
112                                          const EGLint *attrib_list)
113 {
114 
115     Thread *thread = egl::GetCurrentThread();
116     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
117     EGLContext returnValue;
118     {
119         ANGLE_SCOPED_GLOBAL_LOCK();
120         EGL_EVENT(CreateContext,
121                   "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR
122                   ", share_context = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
123                   (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)share_context,
124                   (uintptr_t)attrib_list);
125 
126         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
127         egl::Config *configPacked             = PackParam<egl::Config *>(config);
128         gl::ContextID share_contextPacked     = PackParam<gl::ContextID>(share_context);
129         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
130 
131         {
132             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreateContext, thread, dpyPacked, share_contextPacked);
133             if (IsEGLValidationEnabled())
134             {
135                 ANGLE_EGL_VALIDATE(thread, CreateContext, GetDisplayIfValid(dpyPacked), EGLContext,
136                                    dpyPacked, configPacked, share_contextPacked, attrib_listPacked);
137             }
138             else
139             {
140                 attrib_listPacked.initializeWithoutValidation();
141             }
142 
143             returnValue = CreateContext(thread, dpyPacked, configPacked, share_contextPacked,
144                                         attrib_listPacked);
145         }
146 
147         ANGLE_CAPTURE_EGL(CreateContext, true, thread, dpyPacked, configPacked, share_contextPacked,
148                           attrib_listPacked, returnValue);
149     }
150     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
151     return returnValue;
152 }
153 
EGL_CreatePbufferSurface(EGLDisplay dpy,EGLConfig config,const EGLint * attrib_list)154 EGLSurface EGLAPIENTRY EGL_CreatePbufferSurface(EGLDisplay dpy,
155                                                 EGLConfig config,
156                                                 const EGLint *attrib_list)
157 {
158 
159     Thread *thread = egl::GetCurrentThread();
160     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
161     EGLSurface returnValue;
162     {
163         ANGLE_SCOPED_GLOBAL_LOCK();
164         EGL_EVENT(CreatePbufferSurface,
165                   "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR
166                   ", attrib_list = 0x%016" PRIxPTR "",
167                   (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)attrib_list);
168 
169         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
170         egl::Config *configPacked             = PackParam<egl::Config *>(config);
171         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
172 
173         {
174             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreatePbufferSurface, thread, dpyPacked);
175             if (IsEGLValidationEnabled())
176             {
177                 ANGLE_EGL_VALIDATE(thread, CreatePbufferSurface, GetDisplayIfValid(dpyPacked),
178                                    EGLSurface, dpyPacked, configPacked, attrib_listPacked);
179             }
180             else
181             {
182                 attrib_listPacked.initializeWithoutValidation();
183             }
184 
185             returnValue = CreatePbufferSurface(thread, dpyPacked, configPacked, attrib_listPacked);
186         }
187 
188         ANGLE_CAPTURE_EGL(CreatePbufferSurface, true, thread, dpyPacked, configPacked,
189                           attrib_listPacked, returnValue);
190     }
191     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
192     return returnValue;
193 }
194 
EGL_CreatePixmapSurface(EGLDisplay dpy,EGLConfig config,EGLNativePixmapType pixmap,const EGLint * attrib_list)195 EGLSurface EGLAPIENTRY EGL_CreatePixmapSurface(EGLDisplay dpy,
196                                                EGLConfig config,
197                                                EGLNativePixmapType pixmap,
198                                                const EGLint *attrib_list)
199 {
200 
201     Thread *thread = egl::GetCurrentThread();
202     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
203     EGLSurface returnValue;
204     {
205         ANGLE_SCOPED_GLOBAL_LOCK();
206         EGL_EVENT(CreatePixmapSurface,
207                   "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", pixmap = 0x%016" PRIxPTR
208                   ", attrib_list = 0x%016" PRIxPTR "",
209                   (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)pixmap, (uintptr_t)attrib_list);
210 
211         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
212         egl::Config *configPacked             = PackParam<egl::Config *>(config);
213         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
214 
215         {
216             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreatePixmapSurface, thread, dpyPacked);
217             if (IsEGLValidationEnabled())
218             {
219                 ANGLE_EGL_VALIDATE(thread, CreatePixmapSurface, GetDisplayIfValid(dpyPacked),
220                                    EGLSurface, dpyPacked, configPacked, pixmap, attrib_listPacked);
221             }
222             else
223             {
224                 attrib_listPacked.initializeWithoutValidation();
225             }
226 
227             returnValue =
228                 CreatePixmapSurface(thread, dpyPacked, configPacked, pixmap, attrib_listPacked);
229         }
230 
231         ANGLE_CAPTURE_EGL(CreatePixmapSurface, true, thread, dpyPacked, configPacked, pixmap,
232                           attrib_listPacked, returnValue);
233     }
234     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
235     return returnValue;
236 }
237 
EGL_CreateWindowSurface(EGLDisplay dpy,EGLConfig config,EGLNativeWindowType win,const EGLint * attrib_list)238 EGLSurface EGLAPIENTRY EGL_CreateWindowSurface(EGLDisplay dpy,
239                                                EGLConfig config,
240                                                EGLNativeWindowType win,
241                                                const EGLint *attrib_list)
242 {
243 
244     Thread *thread = egl::GetCurrentThread();
245     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
246     EGLSurface returnValue;
247     {
248         ANGLE_SCOPED_GLOBAL_LOCK();
249         EGL_EVENT(CreateWindowSurface,
250                   "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", win = 0x%016" PRIxPTR
251                   ", attrib_list = 0x%016" PRIxPTR "",
252                   (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)win, (uintptr_t)attrib_list);
253 
254         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
255         egl::Config *configPacked             = PackParam<egl::Config *>(config);
256         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
257 
258         {
259             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreateWindowSurface, thread, dpyPacked);
260             if (IsEGLValidationEnabled())
261             {
262                 ANGLE_EGL_VALIDATE(thread, CreateWindowSurface, GetDisplayIfValid(dpyPacked),
263                                    EGLSurface, dpyPacked, configPacked, win, attrib_listPacked);
264             }
265             else
266             {
267                 attrib_listPacked.initializeWithoutValidation();
268             }
269 
270             returnValue =
271                 CreateWindowSurface(thread, dpyPacked, configPacked, win, attrib_listPacked);
272         }
273 
274         ANGLE_CAPTURE_EGL(CreateWindowSurface, true, thread, dpyPacked, configPacked, win,
275                           attrib_listPacked, returnValue);
276     }
277     egl::Display::GetCurrentThreadUnlockedTailCall()->run(nullptr);
278     return returnValue;
279 }
280 
EGL_DestroyContext(EGLDisplay dpy,EGLContext ctx)281 EGLBoolean EGLAPIENTRY EGL_DestroyContext(EGLDisplay dpy, EGLContext ctx)
282 {
283 
284     Thread *thread = egl::GetCurrentThread();
285     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
286     EGLBoolean returnValue;
287     {
288         ANGLE_SCOPED_GLOBAL_LOCK();
289         EGL_EVENT(DestroyContext, "dpy = 0x%016" PRIxPTR ", ctx = 0x%016" PRIxPTR "",
290                   (uintptr_t)dpy, (uintptr_t)ctx);
291 
292         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
293         gl::ContextID ctxPacked = PackParam<gl::ContextID>(ctx);
294 
295         {
296             ANGLE_EGL_SCOPED_CONTEXT_LOCK(DestroyContext, thread, dpyPacked, ctxPacked);
297             if (IsEGLValidationEnabled())
298             {
299                 ANGLE_EGL_VALIDATE(thread, DestroyContext, GetDisplayIfValid(dpyPacked), EGLBoolean,
300                                    dpyPacked, ctxPacked);
301             }
302             else
303             {
304             }
305 
306             returnValue = DestroyContext(thread, dpyPacked, ctxPacked);
307         }
308 
309         ANGLE_CAPTURE_EGL(DestroyContext, true, thread, dpyPacked, ctxPacked, returnValue);
310     }
311     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
312     return returnValue;
313 }
314 
EGL_DestroySurface(EGLDisplay dpy,EGLSurface surface)315 EGLBoolean EGLAPIENTRY EGL_DestroySurface(EGLDisplay dpy, EGLSurface surface)
316 {
317 
318     Thread *thread = egl::GetCurrentThread();
319     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
320     EGLBoolean returnValue;
321     {
322         ANGLE_SCOPED_GLOBAL_LOCK();
323         EGL_EVENT(DestroySurface, "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR "",
324                   (uintptr_t)dpy, (uintptr_t)surface);
325 
326         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
327         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
328 
329         {
330             ANGLE_EGL_SCOPED_CONTEXT_LOCK(DestroySurface, thread, dpyPacked);
331             if (IsEGLValidationEnabled())
332             {
333                 ANGLE_EGL_VALIDATE(thread, DestroySurface, GetDisplayIfValid(dpyPacked), EGLBoolean,
334                                    dpyPacked, surfacePacked);
335             }
336             else
337             {
338             }
339 
340             returnValue = DestroySurface(thread, dpyPacked, surfacePacked);
341         }
342 
343         ANGLE_CAPTURE_EGL(DestroySurface, true, thread, dpyPacked, surfacePacked, returnValue);
344     }
345     egl::Display::GetCurrentThreadUnlockedTailCall()->run(nullptr);
346     return returnValue;
347 }
348 
EGL_GetConfigAttrib(EGLDisplay dpy,EGLConfig config,EGLint attribute,EGLint * value)349 EGLBoolean EGLAPIENTRY EGL_GetConfigAttrib(EGLDisplay dpy,
350                                            EGLConfig config,
351                                            EGLint attribute,
352                                            EGLint *value)
353 {
354 
355     Thread *thread = egl::GetCurrentThread();
356     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
357     EGLBoolean returnValue;
358     {
359         ANGLE_SCOPED_GLOBAL_LOCK();
360         EGL_EVENT(GetConfigAttrib,
361                   "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR
362                   ", attribute = %d, value = 0x%016" PRIxPTR "",
363                   (uintptr_t)dpy, (uintptr_t)config, attribute, (uintptr_t)value);
364 
365         egl::Display *dpyPacked   = PackParam<egl::Display *>(dpy);
366         egl::Config *configPacked = PackParam<egl::Config *>(config);
367 
368         {
369             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetConfigAttrib, thread, dpyPacked, attribute);
370             if (IsEGLValidationEnabled())
371             {
372                 ANGLE_EGL_VALIDATE(thread, GetConfigAttrib, GetDisplayIfValid(dpyPacked),
373                                    EGLBoolean, dpyPacked, configPacked, attribute, value);
374             }
375             else
376             {
377             }
378 
379             returnValue = GetConfigAttrib(thread, dpyPacked, configPacked, attribute, value);
380         }
381 
382         ANGLE_CAPTURE_EGL(GetConfigAttrib, true, thread, dpyPacked, configPacked, attribute, value,
383                           returnValue);
384     }
385     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
386     return returnValue;
387 }
388 
EGL_GetConfigs(EGLDisplay dpy,EGLConfig * configs,EGLint config_size,EGLint * num_config)389 EGLBoolean EGLAPIENTRY EGL_GetConfigs(EGLDisplay dpy,
390                                       EGLConfig *configs,
391                                       EGLint config_size,
392                                       EGLint *num_config)
393 {
394 
395     Thread *thread = egl::GetCurrentThread();
396     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
397     EGLBoolean returnValue;
398     {
399         ANGLE_SCOPED_GLOBAL_LOCK();
400         EGL_EVENT(GetConfigs,
401                   "dpy = 0x%016" PRIxPTR ", configs = 0x%016" PRIxPTR
402                   ", config_size = %d, num_config = 0x%016" PRIxPTR "",
403                   (uintptr_t)dpy, (uintptr_t)configs, config_size, (uintptr_t)num_config);
404 
405         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
406 
407         {
408             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetConfigs, thread, dpyPacked);
409             if (IsEGLValidationEnabled())
410             {
411                 ANGLE_EGL_VALIDATE(thread, GetConfigs, GetDisplayIfValid(dpyPacked), EGLBoolean,
412                                    dpyPacked, configs, config_size, num_config);
413             }
414             else
415             {
416             }
417 
418             returnValue = GetConfigs(thread, dpyPacked, configs, config_size, num_config);
419         }
420 
421         ANGLE_CAPTURE_EGL(GetConfigs, true, thread, dpyPacked, configs, config_size, num_config,
422                           returnValue);
423     }
424     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
425     return returnValue;
426 }
427 
EGL_GetCurrentDisplay()428 EGLDisplay EGLAPIENTRY EGL_GetCurrentDisplay()
429 {
430 
431     Thread *thread = egl::GetCurrentThread();
432     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
433     EGLDisplay returnValue;
434 
435     EGL_EVENT(GetCurrentDisplay, "");
436 
437     if (IsEGLValidationEnabled())
438     {
439         ANGLE_EGL_VALIDATE(thread, GetCurrentDisplay, nullptr, EGLDisplay);
440     }
441     else
442     {
443     }
444 
445     returnValue = GetCurrentDisplay(thread);
446 
447     ANGLE_CAPTURE_EGL(GetCurrentDisplay, true, thread, returnValue);
448 
449     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
450     return returnValue;
451 }
452 
EGL_GetCurrentSurface(EGLint readdraw)453 EGLSurface EGLAPIENTRY EGL_GetCurrentSurface(EGLint readdraw)
454 {
455 
456     Thread *thread = egl::GetCurrentThread();
457     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
458     EGLSurface returnValue;
459 
460     EGL_EVENT(GetCurrentSurface, "readdraw = %d", readdraw);
461 
462     if (IsEGLValidationEnabled())
463     {
464         ANGLE_EGL_VALIDATE(thread, GetCurrentSurface, nullptr, EGLSurface, readdraw);
465     }
466     else
467     {
468     }
469 
470     returnValue = GetCurrentSurface(thread, readdraw);
471 
472     ANGLE_CAPTURE_EGL(GetCurrentSurface, true, thread, readdraw, returnValue);
473 
474     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
475     return returnValue;
476 }
477 
EGL_GetDisplay(EGLNativeDisplayType display_id)478 EGLDisplay EGLAPIENTRY EGL_GetDisplay(EGLNativeDisplayType display_id)
479 {
480 
481     Thread *thread = egl::GetCurrentThread();
482     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
483     EGLDisplay returnValue;
484     {
485         ANGLE_SCOPED_GLOBAL_LOCK();
486         EGL_EVENT(GetDisplay, "display_id = 0x%016" PRIxPTR "", (uintptr_t)display_id);
487 
488         {
489             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetDisplay, thread);
490             if (IsEGLValidationEnabled())
491             {
492                 ANGLE_EGL_VALIDATE(thread, GetDisplay, nullptr, EGLDisplay, display_id);
493             }
494             else
495             {
496             }
497 
498             returnValue = GetDisplay(thread, display_id);
499         }
500 
501         ANGLE_CAPTURE_EGL(GetDisplay, true, thread, display_id, returnValue);
502     }
503     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
504     return returnValue;
505 }
506 
EGL_GetError()507 EGLint EGLAPIENTRY EGL_GetError()
508 {
509 
510     Thread *thread = egl::GetCurrentThread();
511     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
512     EGLint returnValue;
513 
514     EGL_EVENT(GetError, "");
515 
516     if (IsEGLValidationEnabled())
517     {
518         ANGLE_EGL_VALIDATE(thread, GetError, nullptr, EGLint);
519     }
520     else
521     {
522     }
523 
524     returnValue = GetError(thread);
525 
526     ANGLE_CAPTURE_EGL(GetError, true, thread, returnValue);
527 
528     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
529     return returnValue;
530 }
531 
EGL_GetProcAddress(const char * procname)532 __eglMustCastToProperFunctionPointerType EGLAPIENTRY EGL_GetProcAddress(const char *procname)
533 {
534 
535     Thread *thread = egl::GetCurrentThread();
536     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
537     __eglMustCastToProperFunctionPointerType returnValue;
538     {
539         ANGLE_SCOPED_GLOBAL_LOCK();
540         EGL_EVENT(GetProcAddress, "procname = 0x%016" PRIxPTR "", (uintptr_t)procname);
541 
542         {
543             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetProcAddress, thread);
544             if (IsEGLValidationEnabled())
545             {
546                 ANGLE_EGL_VALIDATE(thread, GetProcAddress, nullptr,
547                                    __eglMustCastToProperFunctionPointerType, procname);
548             }
549             else
550             {
551             }
552 
553             returnValue = GetProcAddress(thread, procname);
554         }
555 
556         ANGLE_CAPTURE_EGL(GetProcAddress, true, thread, procname, returnValue);
557     }
558     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
559     return returnValue;
560 }
561 
EGL_Initialize(EGLDisplay dpy,EGLint * major,EGLint * minor)562 EGLBoolean EGLAPIENTRY EGL_Initialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
563 {
564 
565     Thread *thread = egl::GetCurrentThread();
566     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
567     EGLBoolean returnValue;
568     {
569         ANGLE_SCOPED_GLOBAL_EGL_AND_EGL_SYNC_LOCK();
570         EGL_EVENT(Initialize,
571                   "dpy = 0x%016" PRIxPTR ", major = 0x%016" PRIxPTR ", minor = 0x%016" PRIxPTR "",
572                   (uintptr_t)dpy, (uintptr_t)major, (uintptr_t)minor);
573 
574         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
575 
576         {
577             ANGLE_EGL_SCOPED_CONTEXT_LOCK(Initialize, thread, dpyPacked);
578             if (IsEGLValidationEnabled())
579             {
580                 ANGLE_EGL_VALIDATE(thread, Initialize, GetDisplayIfValid(dpyPacked), EGLBoolean,
581                                    dpyPacked, major, minor);
582             }
583             else
584             {
585             }
586 
587             returnValue = Initialize(thread, dpyPacked, major, minor);
588         }
589 
590         ANGLE_CAPTURE_EGL(Initialize, true, thread, dpyPacked, major, minor, returnValue);
591     }
592     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
593     return returnValue;
594 }
595 
EGL_MakeCurrent(EGLDisplay dpy,EGLSurface draw,EGLSurface read,EGLContext ctx)596 EGLBoolean EGLAPIENTRY EGL_MakeCurrent(EGLDisplay dpy,
597                                        EGLSurface draw,
598                                        EGLSurface read,
599                                        EGLContext ctx)
600 {
601 
602     Thread *thread = egl::GetCurrentThread();
603     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
604     EGLBoolean returnValue;
605     {
606         ANGLE_SCOPED_GLOBAL_LOCK();
607         EGL_EVENT(MakeCurrent,
608                   "dpy = 0x%016" PRIxPTR ", draw = 0x%016" PRIxPTR ", read = 0x%016" PRIxPTR
609                   ", ctx = 0x%016" PRIxPTR "",
610                   (uintptr_t)dpy, (uintptr_t)draw, (uintptr_t)read, (uintptr_t)ctx);
611 
612         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
613         SurfaceID drawPacked    = PackParam<SurfaceID>(draw);
614         SurfaceID readPacked    = PackParam<SurfaceID>(read);
615         gl::ContextID ctxPacked = PackParam<gl::ContextID>(ctx);
616 
617         {
618             ANGLE_EGL_SCOPED_CONTEXT_LOCK(MakeCurrent, thread, dpyPacked, ctxPacked);
619             if (IsEGLValidationEnabled())
620             {
621                 ANGLE_EGL_VALIDATE(thread, MakeCurrent, GetDisplayIfValid(dpyPacked), EGLBoolean,
622                                    dpyPacked, drawPacked, readPacked, ctxPacked);
623             }
624             else
625             {
626             }
627 
628             returnValue = MakeCurrent(thread, dpyPacked, drawPacked, readPacked, ctxPacked);
629         }
630 
631         ANGLE_CAPTURE_EGL(MakeCurrent, true, thread, dpyPacked, drawPacked, readPacked, ctxPacked,
632                           returnValue);
633     }
634     egl::Display::GetCurrentThreadUnlockedTailCall()->run(nullptr);
635     return returnValue;
636 }
637 
EGL_QueryContext(EGLDisplay dpy,EGLContext ctx,EGLint attribute,EGLint * value)638 EGLBoolean EGLAPIENTRY EGL_QueryContext(EGLDisplay dpy,
639                                         EGLContext ctx,
640                                         EGLint attribute,
641                                         EGLint *value)
642 {
643 
644     Thread *thread = egl::GetCurrentThread();
645     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
646     EGLBoolean returnValue;
647     {
648         ANGLE_SCOPED_GLOBAL_LOCK();
649         EGL_EVENT(QueryContext,
650                   "dpy = 0x%016" PRIxPTR ", ctx = 0x%016" PRIxPTR
651                   ", attribute = %d, value = 0x%016" PRIxPTR "",
652                   (uintptr_t)dpy, (uintptr_t)ctx, attribute, (uintptr_t)value);
653 
654         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
655         gl::ContextID ctxPacked = PackParam<gl::ContextID>(ctx);
656 
657         {
658             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryContext, thread, dpyPacked, ctxPacked, attribute);
659             if (IsEGLValidationEnabled())
660             {
661                 ANGLE_EGL_VALIDATE(thread, QueryContext, GetDisplayIfValid(dpyPacked), EGLBoolean,
662                                    dpyPacked, ctxPacked, attribute, value);
663             }
664             else
665             {
666             }
667 
668             returnValue = QueryContext(thread, dpyPacked, ctxPacked, attribute, value);
669         }
670 
671         ANGLE_CAPTURE_EGL(QueryContext, true, thread, dpyPacked, ctxPacked, attribute, value,
672                           returnValue);
673     }
674     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
675     return returnValue;
676 }
677 
EGL_QueryString(EGLDisplay dpy,EGLint name)678 const char *EGLAPIENTRY EGL_QueryString(EGLDisplay dpy, EGLint name)
679 {
680 
681     Thread *thread = egl::GetCurrentThread();
682     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
683     const char *returnValue;
684     {
685         ANGLE_SCOPED_GLOBAL_LOCK();
686         EGL_EVENT(QueryString, "dpy = 0x%016" PRIxPTR ", name = %d", (uintptr_t)dpy, name);
687 
688         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
689 
690         {
691             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryString, thread, dpyPacked);
692             if (IsEGLValidationEnabled())
693             {
694                 ANGLE_EGL_VALIDATE(thread, QueryString, GetDisplayIfValid(dpyPacked), const char *,
695                                    dpyPacked, name);
696             }
697             else
698             {
699             }
700 
701             returnValue = QueryString(thread, dpyPacked, name);
702         }
703 
704         ANGLE_CAPTURE_EGL(QueryString, true, thread, dpyPacked, name, returnValue);
705     }
706     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
707     return returnValue;
708 }
709 
EGL_QuerySurface(EGLDisplay dpy,EGLSurface surface,EGLint attribute,EGLint * value)710 EGLBoolean EGLAPIENTRY EGL_QuerySurface(EGLDisplay dpy,
711                                         EGLSurface surface,
712                                         EGLint attribute,
713                                         EGLint *value)
714 {
715     if (attribute == EGL_BUFFER_AGE_EXT)
716     {
717         ANGLE_EGLBOOLEAN_TRY(EGL_PrepareSwapBuffersANGLE(dpy, surface));
718     }
719     Thread *thread = egl::GetCurrentThread();
720     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
721     EGLBoolean returnValue;
722     {
723         ANGLE_SCOPED_GLOBAL_LOCK();
724         EGL_EVENT(QuerySurface,
725                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR
726                   ", attribute = %d, value = 0x%016" PRIxPTR "",
727                   (uintptr_t)dpy, (uintptr_t)surface, attribute, (uintptr_t)value);
728 
729         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
730         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
731 
732         {
733             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QuerySurface, thread, dpyPacked, attribute);
734             if (IsEGLValidationEnabled())
735             {
736                 ANGLE_EGL_VALIDATE(thread, QuerySurface, GetDisplayIfValid(dpyPacked), EGLBoolean,
737                                    dpyPacked, surfacePacked, attribute, value);
738             }
739             else
740             {
741             }
742 
743             returnValue = QuerySurface(thread, dpyPacked, surfacePacked, attribute, value);
744         }
745 
746         ANGLE_CAPTURE_EGL(QuerySurface, true, thread, dpyPacked, surfacePacked, attribute, value,
747                           returnValue);
748     }
749     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
750     return returnValue;
751 }
752 
EGL_SwapBuffers(EGLDisplay dpy,EGLSurface surface)753 EGLBoolean EGLAPIENTRY EGL_SwapBuffers(EGLDisplay dpy, EGLSurface surface)
754 {
755     ANGLE_EGLBOOLEAN_TRY(EGL_PrepareSwapBuffersANGLE(dpy, surface));
756     Thread *thread = egl::GetCurrentThread();
757     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
758     EGLBoolean returnValue;
759     {
760         ANGLE_SCOPED_GLOBAL_LOCK();
761         EGL_EVENT(SwapBuffers, "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR "",
762                   (uintptr_t)dpy, (uintptr_t)surface);
763 
764         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
765         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
766 
767         {
768             ANGLE_EGL_SCOPED_CONTEXT_LOCK(SwapBuffers, thread, dpyPacked);
769             if (IsEGLValidationEnabled())
770             {
771                 ANGLE_EGL_VALIDATE(thread, SwapBuffers, GetDisplayIfValid(dpyPacked), EGLBoolean,
772                                    dpyPacked, surfacePacked);
773             }
774             else
775             {
776             }
777 
778             returnValue = SwapBuffers(thread, dpyPacked, surfacePacked);
779         }
780 
781         ANGLE_CAPTURE_EGL(SwapBuffers, true, thread, dpyPacked, surfacePacked, returnValue);
782     }
783     egl::Display::GetCurrentThreadUnlockedTailCall()->run(&returnValue);
784     return returnValue;
785 }
786 
EGL_Terminate(EGLDisplay dpy)787 EGLBoolean EGLAPIENTRY EGL_Terminate(EGLDisplay dpy)
788 {
789 
790     Thread *thread = egl::GetCurrentThread();
791     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
792     EGLBoolean returnValue;
793     {
794         ANGLE_SCOPED_GLOBAL_EGL_AND_EGL_SYNC_LOCK();
795         EGL_EVENT(Terminate, "dpy = 0x%016" PRIxPTR "", (uintptr_t)dpy);
796 
797         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
798 
799         {
800             ANGLE_EGL_SCOPED_CONTEXT_LOCK(Terminate, thread, dpyPacked);
801             if (IsEGLValidationEnabled())
802             {
803                 ANGLE_EGL_VALIDATE(thread, Terminate, GetDisplayIfValid(dpyPacked), EGLBoolean,
804                                    dpyPacked);
805             }
806             else
807             {
808             }
809 
810             returnValue = Terminate(thread, dpyPacked);
811         }
812 
813         ANGLE_CAPTURE_EGL(Terminate, true, thread, dpyPacked, returnValue);
814     }
815     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
816     return returnValue;
817 }
818 
EGL_WaitGL()819 EGLBoolean EGLAPIENTRY EGL_WaitGL()
820 {
821 
822     Thread *thread = egl::GetCurrentThread();
823     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
824     EGLBoolean returnValue;
825     {
826         ANGLE_SCOPED_GLOBAL_LOCK();
827         EGL_EVENT(WaitGL, "");
828 
829         {
830             ANGLE_EGL_SCOPED_CONTEXT_LOCK(WaitGL, thread);
831             if (IsEGLValidationEnabled())
832             {
833                 ANGLE_EGL_VALIDATE(thread, WaitGL, nullptr, EGLBoolean);
834             }
835             else
836             {
837             }
838 
839             returnValue = WaitGL(thread);
840         }
841 
842         ANGLE_CAPTURE_EGL(WaitGL, true, thread, returnValue);
843     }
844     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
845     return returnValue;
846 }
847 
EGL_WaitNative(EGLint engine)848 EGLBoolean EGLAPIENTRY EGL_WaitNative(EGLint engine)
849 {
850 
851     Thread *thread = egl::GetCurrentThread();
852     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
853     EGLBoolean returnValue;
854     {
855         ANGLE_SCOPED_GLOBAL_LOCK();
856         EGL_EVENT(WaitNative, "engine = %d", engine);
857 
858         {
859             ANGLE_EGL_SCOPED_CONTEXT_LOCK(WaitNative, thread);
860             if (IsEGLValidationEnabled())
861             {
862                 ANGLE_EGL_VALIDATE(thread, WaitNative, nullptr, EGLBoolean, engine);
863             }
864             else
865             {
866             }
867 
868             returnValue = WaitNative(thread, engine);
869         }
870 
871         ANGLE_CAPTURE_EGL(WaitNative, true, thread, engine, returnValue);
872     }
873     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
874     return returnValue;
875 }
876 
877 // EGL 1.1
EGL_BindTexImage(EGLDisplay dpy,EGLSurface surface,EGLint buffer)878 EGLBoolean EGLAPIENTRY EGL_BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
879 {
880 
881     Thread *thread = egl::GetCurrentThread();
882     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
883     EGLBoolean returnValue;
884     {
885         ANGLE_SCOPED_GLOBAL_LOCK();
886         EGL_EVENT(BindTexImage, "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", buffer = %d",
887                   (uintptr_t)dpy, (uintptr_t)surface, buffer);
888 
889         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
890         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
891 
892         {
893             ANGLE_EGL_SCOPED_CONTEXT_LOCK(BindTexImage, thread, dpyPacked);
894             if (IsEGLValidationEnabled())
895             {
896                 ANGLE_EGL_VALIDATE(thread, BindTexImage, GetDisplayIfValid(dpyPacked), EGLBoolean,
897                                    dpyPacked, surfacePacked, buffer);
898             }
899             else
900             {
901             }
902 
903             returnValue = BindTexImage(thread, dpyPacked, surfacePacked, buffer);
904         }
905 
906         ANGLE_CAPTURE_EGL(BindTexImage, true, thread, dpyPacked, surfacePacked, buffer,
907                           returnValue);
908     }
909     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
910     return returnValue;
911 }
912 
EGL_ReleaseTexImage(EGLDisplay dpy,EGLSurface surface,EGLint buffer)913 EGLBoolean EGLAPIENTRY EGL_ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
914 {
915 
916     Thread *thread = egl::GetCurrentThread();
917     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
918     EGLBoolean returnValue;
919     {
920         ANGLE_SCOPED_GLOBAL_LOCK();
921         EGL_EVENT(ReleaseTexImage,
922                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", buffer = %d",
923                   (uintptr_t)dpy, (uintptr_t)surface, buffer);
924 
925         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
926         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
927 
928         {
929             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ReleaseTexImage, thread, dpyPacked);
930             if (IsEGLValidationEnabled())
931             {
932                 ANGLE_EGL_VALIDATE(thread, ReleaseTexImage, GetDisplayIfValid(dpyPacked),
933                                    EGLBoolean, dpyPacked, surfacePacked, buffer);
934             }
935             else
936             {
937             }
938 
939             returnValue = ReleaseTexImage(thread, dpyPacked, surfacePacked, buffer);
940         }
941 
942         ANGLE_CAPTURE_EGL(ReleaseTexImage, true, thread, dpyPacked, surfacePacked, buffer,
943                           returnValue);
944     }
945     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
946     return returnValue;
947 }
948 
EGL_SurfaceAttrib(EGLDisplay dpy,EGLSurface surface,EGLint attribute,EGLint value)949 EGLBoolean EGLAPIENTRY EGL_SurfaceAttrib(EGLDisplay dpy,
950                                          EGLSurface surface,
951                                          EGLint attribute,
952                                          EGLint value)
953 {
954 
955     Thread *thread = egl::GetCurrentThread();
956     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
957     EGLBoolean returnValue;
958     {
959         ANGLE_SCOPED_GLOBAL_LOCK();
960         EGL_EVENT(SurfaceAttrib,
961                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR
962                   ", attribute = %d, value = %d",
963                   (uintptr_t)dpy, (uintptr_t)surface, attribute, value);
964 
965         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
966         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
967 
968         {
969             ANGLE_EGL_SCOPED_CONTEXT_LOCK(SurfaceAttrib, thread, dpyPacked, attribute);
970             if (IsEGLValidationEnabled())
971             {
972                 ANGLE_EGL_VALIDATE(thread, SurfaceAttrib, GetDisplayIfValid(dpyPacked), EGLBoolean,
973                                    dpyPacked, surfacePacked, attribute, value);
974             }
975             else
976             {
977             }
978 
979             returnValue = SurfaceAttrib(thread, dpyPacked, surfacePacked, attribute, value);
980         }
981 
982         ANGLE_CAPTURE_EGL(SurfaceAttrib, true, thread, dpyPacked, surfacePacked, attribute, value,
983                           returnValue);
984     }
985     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
986     return returnValue;
987 }
988 
EGL_SwapInterval(EGLDisplay dpy,EGLint interval)989 EGLBoolean EGLAPIENTRY EGL_SwapInterval(EGLDisplay dpy, EGLint interval)
990 {
991 
992     Thread *thread = egl::GetCurrentThread();
993     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
994     EGLBoolean returnValue;
995     {
996         ANGLE_SCOPED_GLOBAL_LOCK();
997         EGL_EVENT(SwapInterval, "dpy = 0x%016" PRIxPTR ", interval = %d", (uintptr_t)dpy, interval);
998 
999         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1000 
1001         {
1002             ANGLE_EGL_SCOPED_CONTEXT_LOCK(SwapInterval, thread, dpyPacked);
1003             if (IsEGLValidationEnabled())
1004             {
1005                 ANGLE_EGL_VALIDATE(thread, SwapInterval, GetDisplayIfValid(dpyPacked), EGLBoolean,
1006                                    dpyPacked, interval);
1007             }
1008             else
1009             {
1010             }
1011 
1012             returnValue = SwapInterval(thread, dpyPacked, interval);
1013         }
1014 
1015         ANGLE_CAPTURE_EGL(SwapInterval, true, thread, dpyPacked, interval, returnValue);
1016     }
1017     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1018     return returnValue;
1019 }
1020 
1021 // EGL 1.2
EGL_BindAPI(EGLenum api)1022 EGLBoolean EGLAPIENTRY EGL_BindAPI(EGLenum api)
1023 {
1024 
1025     Thread *thread = egl::GetCurrentThread();
1026     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1027     EGLBoolean returnValue;
1028     {
1029         ANGLE_SCOPED_GLOBAL_LOCK();
1030         EGL_EVENT(BindAPI, "api = 0x%X", api);
1031 
1032         {
1033             ANGLE_EGL_SCOPED_CONTEXT_LOCK(BindAPI, thread);
1034             if (IsEGLValidationEnabled())
1035             {
1036                 ANGLE_EGL_VALIDATE(thread, BindAPI, nullptr, EGLBoolean, api);
1037             }
1038             else
1039             {
1040             }
1041 
1042             returnValue = BindAPI(thread, api);
1043         }
1044 
1045         ANGLE_CAPTURE_EGL(BindAPI, true, thread, api, returnValue);
1046     }
1047     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1048     return returnValue;
1049 }
1050 
EGL_CreatePbufferFromClientBuffer(EGLDisplay dpy,EGLenum buftype,EGLClientBuffer buffer,EGLConfig config,const EGLint * attrib_list)1051 EGLSurface EGLAPIENTRY EGL_CreatePbufferFromClientBuffer(EGLDisplay dpy,
1052                                                          EGLenum buftype,
1053                                                          EGLClientBuffer buffer,
1054                                                          EGLConfig config,
1055                                                          const EGLint *attrib_list)
1056 {
1057 
1058     Thread *thread = egl::GetCurrentThread();
1059     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1060     EGLSurface returnValue;
1061     {
1062         ANGLE_SCOPED_GLOBAL_LOCK();
1063         EGL_EVENT(CreatePbufferFromClientBuffer,
1064                   "dpy = 0x%016" PRIxPTR ", buftype = 0x%X, buffer = 0x%016" PRIxPTR
1065                   ", config = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
1066                   (uintptr_t)dpy, buftype, (uintptr_t)buffer, (uintptr_t)config,
1067                   (uintptr_t)attrib_list);
1068 
1069         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
1070         egl::Config *configPacked             = PackParam<egl::Config *>(config);
1071         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1072 
1073         {
1074             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreatePbufferFromClientBuffer, thread, dpyPacked);
1075             if (IsEGLValidationEnabled())
1076             {
1077                 ANGLE_EGL_VALIDATE(thread, CreatePbufferFromClientBuffer,
1078                                    GetDisplayIfValid(dpyPacked), EGLSurface, dpyPacked, buftype,
1079                                    buffer, configPacked, attrib_listPacked);
1080             }
1081             else
1082             {
1083                 attrib_listPacked.initializeWithoutValidation();
1084             }
1085 
1086             returnValue = CreatePbufferFromClientBuffer(thread, dpyPacked, buftype, buffer,
1087                                                         configPacked, attrib_listPacked);
1088         }
1089 
1090         ANGLE_CAPTURE_EGL(CreatePbufferFromClientBuffer, true, thread, dpyPacked, buftype, buffer,
1091                           configPacked, attrib_listPacked, returnValue);
1092     }
1093     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1094     return returnValue;
1095 }
1096 
EGL_QueryAPI()1097 EGLenum EGLAPIENTRY EGL_QueryAPI()
1098 {
1099 
1100     Thread *thread = egl::GetCurrentThread();
1101     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1102     EGLenum returnValue;
1103     {
1104         ANGLE_SCOPED_GLOBAL_LOCK();
1105         EGL_EVENT(QueryAPI, "");
1106 
1107         {
1108             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryAPI, thread);
1109             if (IsEGLValidationEnabled())
1110             {
1111                 ANGLE_EGL_VALIDATE(thread, QueryAPI, nullptr, EGLenum);
1112             }
1113             else
1114             {
1115             }
1116 
1117             returnValue = QueryAPI(thread);
1118         }
1119 
1120         ANGLE_CAPTURE_EGL(QueryAPI, true, thread, returnValue);
1121     }
1122     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1123     return returnValue;
1124 }
1125 
EGL_ReleaseThread()1126 EGLBoolean EGLAPIENTRY EGL_ReleaseThread()
1127 {
1128 
1129     Thread *thread = egl::GetCurrentThread();
1130     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1131     EGLBoolean returnValue;
1132     {
1133         ANGLE_SCOPED_GLOBAL_EGL_AND_EGL_SYNC_LOCK();
1134         EGL_EVENT(ReleaseThread, "");
1135 
1136         {
1137             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ReleaseThread, thread);
1138             if (IsEGLValidationEnabled())
1139             {
1140                 ANGLE_EGL_VALIDATE(thread, ReleaseThread, nullptr, EGLBoolean);
1141             }
1142             else
1143             {
1144             }
1145 
1146             returnValue = ReleaseThread(thread);
1147         }
1148 
1149         ANGLE_CAPTURE_EGL(ReleaseThread, true, thread, returnValue);
1150     }
1151     egl::Display::GetCurrentThreadUnlockedTailCall()->run(nullptr);
1152     return returnValue;
1153 }
1154 
EGL_WaitClient()1155 EGLBoolean EGLAPIENTRY EGL_WaitClient()
1156 {
1157 
1158     Thread *thread = egl::GetCurrentThread();
1159     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1160     EGLBoolean returnValue;
1161     {
1162         ANGLE_SCOPED_GLOBAL_LOCK();
1163         EGL_EVENT(WaitClient, "");
1164 
1165         {
1166             ANGLE_EGL_SCOPED_CONTEXT_LOCK(WaitClient, thread);
1167             if (IsEGLValidationEnabled())
1168             {
1169                 ANGLE_EGL_VALIDATE(thread, WaitClient, nullptr, EGLBoolean);
1170             }
1171             else
1172             {
1173             }
1174 
1175             returnValue = WaitClient(thread);
1176         }
1177 
1178         ANGLE_CAPTURE_EGL(WaitClient, true, thread, returnValue);
1179     }
1180     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1181     return returnValue;
1182 }
1183 
1184 // EGL 1.4
EGL_GetCurrentContext()1185 EGLContext EGLAPIENTRY EGL_GetCurrentContext()
1186 {
1187 
1188     Thread *thread = egl::GetCurrentThread();
1189     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1190     EGLContext returnValue;
1191 
1192     EGL_EVENT(GetCurrentContext, "");
1193 
1194     if (IsEGLValidationEnabled())
1195     {
1196         ANGLE_EGL_VALIDATE(thread, GetCurrentContext, nullptr, EGLContext);
1197     }
1198     else
1199     {
1200     }
1201 
1202     returnValue = GetCurrentContext(thread);
1203 
1204     ANGLE_CAPTURE_EGL(GetCurrentContext, true, thread, returnValue);
1205 
1206     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1207     return returnValue;
1208 }
1209 
1210 // EGL 1.5
EGL_ClientWaitSync(EGLDisplay dpy,EGLSync sync,EGLint flags,EGLTime timeout)1211 EGLint EGLAPIENTRY EGL_ClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout)
1212 {
1213 
1214     Thread *thread = egl::GetCurrentThread();
1215     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1216     EGLint returnValue;
1217     {
1218         ANGLE_SCOPED_GLOBAL_EGL_SYNC_LOCK();
1219         EGL_EVENT(ClientWaitSync,
1220                   "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR ", flags = %d, timeout = %llu",
1221                   (uintptr_t)dpy, (uintptr_t)sync, flags, static_cast<unsigned long long>(timeout));
1222 
1223         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1224         egl::SyncID syncPacked  = PackParam<egl::SyncID>(sync);
1225 
1226         {
1227             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ClientWaitSync, thread, dpyPacked, flags);
1228             if (IsEGLValidationEnabled())
1229             {
1230                 ANGLE_EGL_VALIDATE(thread, ClientWaitSync, GetDisplayIfValid(dpyPacked), EGLint,
1231                                    dpyPacked, syncPacked, flags, timeout);
1232             }
1233             else
1234             {
1235             }
1236 
1237             returnValue = ClientWaitSync(thread, dpyPacked, syncPacked, flags, timeout);
1238         }
1239 
1240         ANGLE_CAPTURE_EGL(ClientWaitSync, true, thread, dpyPacked, syncPacked, flags, timeout,
1241                           returnValue);
1242     }
1243     egl::Display::GetCurrentThreadUnlockedTailCall()->run(&returnValue);
1244     return returnValue;
1245 }
1246 
EGL_CreateImage(EGLDisplay dpy,EGLContext ctx,EGLenum target,EGLClientBuffer buffer,const EGLAttrib * attrib_list)1247 EGLImage EGLAPIENTRY EGL_CreateImage(EGLDisplay dpy,
1248                                      EGLContext ctx,
1249                                      EGLenum target,
1250                                      EGLClientBuffer buffer,
1251                                      const EGLAttrib *attrib_list)
1252 {
1253 
1254     Thread *thread = egl::GetCurrentThread();
1255     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1256     EGLImage returnValue;
1257     {
1258         ANGLE_SCOPED_GLOBAL_LOCK();
1259         EGL_EVENT(CreateImage,
1260                   "dpy = 0x%016" PRIxPTR ", ctx = 0x%016" PRIxPTR
1261                   ", target = 0x%X, buffer = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
1262                   (uintptr_t)dpy, (uintptr_t)ctx, target, (uintptr_t)buffer,
1263                   (uintptr_t)attrib_list);
1264 
1265         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
1266         gl::ContextID ctxPacked               = PackParam<gl::ContextID>(ctx);
1267         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1268 
1269         {
1270             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreateImage, thread, dpyPacked, ctxPacked);
1271             if (IsEGLValidationEnabled())
1272             {
1273                 ANGLE_EGL_VALIDATE(thread, CreateImage, GetDisplayIfValid(dpyPacked), EGLImage,
1274                                    dpyPacked, ctxPacked, target, buffer, attrib_listPacked);
1275             }
1276             else
1277             {
1278                 attrib_listPacked.initializeWithoutValidation();
1279             }
1280 
1281             returnValue =
1282                 CreateImage(thread, dpyPacked, ctxPacked, target, buffer, attrib_listPacked);
1283         }
1284 
1285         ANGLE_CAPTURE_EGL(CreateImage, true, thread, dpyPacked, ctxPacked, target, buffer,
1286                           attrib_listPacked, returnValue);
1287     }
1288     egl::Display::GetCurrentThreadUnlockedTailCall()->run(&returnValue);
1289     return returnValue;
1290 }
1291 
EGL_CreatePlatformPixmapSurface(EGLDisplay dpy,EGLConfig config,void * native_pixmap,const EGLAttrib * attrib_list)1292 EGLSurface EGLAPIENTRY EGL_CreatePlatformPixmapSurface(EGLDisplay dpy,
1293                                                        EGLConfig config,
1294                                                        void *native_pixmap,
1295                                                        const EGLAttrib *attrib_list)
1296 {
1297 
1298     Thread *thread = egl::GetCurrentThread();
1299     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1300     EGLSurface returnValue;
1301     {
1302         ANGLE_SCOPED_GLOBAL_LOCK();
1303         EGL_EVENT(CreatePlatformPixmapSurface,
1304                   "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR
1305                   ", native_pixmap = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
1306                   (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_pixmap,
1307                   (uintptr_t)attrib_list);
1308 
1309         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
1310         egl::Config *configPacked             = PackParam<egl::Config *>(config);
1311         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1312 
1313         {
1314             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreatePlatformPixmapSurface, thread, dpyPacked);
1315             if (IsEGLValidationEnabled())
1316             {
1317                 ANGLE_EGL_VALIDATE(thread, CreatePlatformPixmapSurface,
1318                                    GetDisplayIfValid(dpyPacked), EGLSurface, dpyPacked,
1319                                    configPacked, native_pixmap, attrib_listPacked);
1320             }
1321             else
1322             {
1323                 attrib_listPacked.initializeWithoutValidation();
1324             }
1325 
1326             returnValue = CreatePlatformPixmapSurface(thread, dpyPacked, configPacked,
1327                                                       native_pixmap, attrib_listPacked);
1328         }
1329 
1330         ANGLE_CAPTURE_EGL(CreatePlatformPixmapSurface, true, thread, dpyPacked, configPacked,
1331                           native_pixmap, attrib_listPacked, returnValue);
1332     }
1333     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1334     return returnValue;
1335 }
1336 
EGL_CreatePlatformWindowSurface(EGLDisplay dpy,EGLConfig config,void * native_window,const EGLAttrib * attrib_list)1337 EGLSurface EGLAPIENTRY EGL_CreatePlatformWindowSurface(EGLDisplay dpy,
1338                                                        EGLConfig config,
1339                                                        void *native_window,
1340                                                        const EGLAttrib *attrib_list)
1341 {
1342 
1343     Thread *thread = egl::GetCurrentThread();
1344     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1345     EGLSurface returnValue;
1346     {
1347         ANGLE_SCOPED_GLOBAL_LOCK();
1348         EGL_EVENT(CreatePlatformWindowSurface,
1349                   "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR
1350                   ", native_window = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
1351                   (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_window,
1352                   (uintptr_t)attrib_list);
1353 
1354         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
1355         egl::Config *configPacked             = PackParam<egl::Config *>(config);
1356         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1357 
1358         {
1359             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreatePlatformWindowSurface, thread, dpyPacked);
1360             if (IsEGLValidationEnabled())
1361             {
1362                 ANGLE_EGL_VALIDATE(thread, CreatePlatformWindowSurface,
1363                                    GetDisplayIfValid(dpyPacked), EGLSurface, dpyPacked,
1364                                    configPacked, native_window, attrib_listPacked);
1365             }
1366             else
1367             {
1368                 attrib_listPacked.initializeWithoutValidation();
1369             }
1370 
1371             returnValue = CreatePlatformWindowSurface(thread, dpyPacked, configPacked,
1372                                                       native_window, attrib_listPacked);
1373         }
1374 
1375         ANGLE_CAPTURE_EGL(CreatePlatformWindowSurface, true, thread, dpyPacked, configPacked,
1376                           native_window, attrib_listPacked, returnValue);
1377     }
1378     egl::Display::GetCurrentThreadUnlockedTailCall()->run(nullptr);
1379     return returnValue;
1380 }
1381 
EGL_CreateSync(EGLDisplay dpy,EGLenum type,const EGLAttrib * attrib_list)1382 EGLSync EGLAPIENTRY EGL_CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
1383 {
1384 
1385     Thread *thread = egl::GetCurrentThread();
1386     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1387     EGLSync returnValue;
1388     {
1389         ANGLE_SCOPED_GLOBAL_EGL_SYNC_LOCK();
1390         EGL_EVENT(CreateSync,
1391                   "dpy = 0x%016" PRIxPTR ", type = 0x%X, attrib_list = 0x%016" PRIxPTR "",
1392                   (uintptr_t)dpy, type, (uintptr_t)attrib_list);
1393 
1394         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
1395         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1396 
1397         {
1398             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreateSync, thread, dpyPacked);
1399             if (IsEGLValidationEnabled())
1400             {
1401                 ANGLE_EGL_VALIDATE(thread, CreateSync, GetDisplayIfValid(dpyPacked), EGLSync,
1402                                    dpyPacked, type, attrib_listPacked);
1403             }
1404             else
1405             {
1406                 attrib_listPacked.initializeWithoutValidation();
1407             }
1408 
1409             returnValue = CreateSync(thread, dpyPacked, type, attrib_listPacked);
1410         }
1411 
1412         ANGLE_CAPTURE_EGL(CreateSync, true, thread, dpyPacked, type, attrib_listPacked,
1413                           returnValue);
1414     }
1415     egl::Display::GetCurrentThreadUnlockedTailCall()->run(&returnValue);
1416     return returnValue;
1417 }
1418 
EGL_DestroyImage(EGLDisplay dpy,EGLImage image)1419 EGLBoolean EGLAPIENTRY EGL_DestroyImage(EGLDisplay dpy, EGLImage image)
1420 {
1421 
1422     Thread *thread = egl::GetCurrentThread();
1423     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1424     EGLBoolean returnValue;
1425     {
1426         ANGLE_SCOPED_GLOBAL_LOCK();
1427         EGL_EVENT(DestroyImage, "dpy = 0x%016" PRIxPTR ", image = 0x%016" PRIxPTR "",
1428                   (uintptr_t)dpy, (uintptr_t)image);
1429 
1430         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1431         ImageID imagePacked     = PackParam<ImageID>(image);
1432 
1433         {
1434             ANGLE_EGL_SCOPED_CONTEXT_LOCK(DestroyImage, thread, dpyPacked);
1435             if (IsEGLValidationEnabled())
1436             {
1437                 ANGLE_EGL_VALIDATE(thread, DestroyImage, GetDisplayIfValid(dpyPacked), EGLBoolean,
1438                                    dpyPacked, imagePacked);
1439             }
1440             else
1441             {
1442             }
1443 
1444             returnValue = DestroyImage(thread, dpyPacked, imagePacked);
1445         }
1446 
1447         ANGLE_CAPTURE_EGL(DestroyImage, true, thread, dpyPacked, imagePacked, returnValue);
1448     }
1449     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1450     return returnValue;
1451 }
1452 
EGL_DestroySync(EGLDisplay dpy,EGLSync sync)1453 EGLBoolean EGLAPIENTRY EGL_DestroySync(EGLDisplay dpy, EGLSync sync)
1454 {
1455 
1456     Thread *thread = egl::GetCurrentThread();
1457     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1458     EGLBoolean returnValue;
1459     {
1460         ANGLE_SCOPED_GLOBAL_EGL_SYNC_LOCK();
1461         EGL_EVENT(DestroySync, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR "", (uintptr_t)dpy,
1462                   (uintptr_t)sync);
1463 
1464         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1465         egl::SyncID syncPacked  = PackParam<egl::SyncID>(sync);
1466 
1467         {
1468             ANGLE_EGL_SCOPED_CONTEXT_LOCK(DestroySync, thread, dpyPacked);
1469             if (IsEGLValidationEnabled())
1470             {
1471                 ANGLE_EGL_VALIDATE(thread, DestroySync, GetDisplayIfValid(dpyPacked), EGLBoolean,
1472                                    dpyPacked, syncPacked);
1473             }
1474             else
1475             {
1476             }
1477 
1478             returnValue = DestroySync(thread, dpyPacked, syncPacked);
1479         }
1480 
1481         ANGLE_CAPTURE_EGL(DestroySync, true, thread, dpyPacked, syncPacked, returnValue);
1482     }
1483     egl::Display::GetCurrentThreadUnlockedTailCall()->run(&returnValue);
1484     return returnValue;
1485 }
1486 
EGL_GetPlatformDisplay(EGLenum platform,void * native_display,const EGLAttrib * attrib_list)1487 EGLDisplay EGLAPIENTRY EGL_GetPlatformDisplay(EGLenum platform,
1488                                               void *native_display,
1489                                               const EGLAttrib *attrib_list)
1490 {
1491 
1492     Thread *thread = egl::GetCurrentThread();
1493     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1494     EGLDisplay returnValue;
1495     {
1496         ANGLE_SCOPED_GLOBAL_LOCK();
1497         EGL_EVENT(GetPlatformDisplay,
1498                   "platform = 0x%X, native_display = 0x%016" PRIxPTR
1499                   ", attrib_list = 0x%016" PRIxPTR "",
1500                   platform, (uintptr_t)native_display, (uintptr_t)attrib_list);
1501 
1502         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1503 
1504         {
1505             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetPlatformDisplay, thread);
1506             if (IsEGLValidationEnabled())
1507             {
1508                 ANGLE_EGL_VALIDATE(thread, GetPlatformDisplay, nullptr, EGLDisplay, platform,
1509                                    native_display, attrib_listPacked);
1510             }
1511             else
1512             {
1513                 attrib_listPacked.initializeWithoutValidation();
1514             }
1515 
1516             returnValue = GetPlatformDisplay(thread, platform, native_display, attrib_listPacked);
1517         }
1518 
1519         ANGLE_CAPTURE_EGL(GetPlatformDisplay, true, thread, platform, native_display,
1520                           attrib_listPacked, returnValue);
1521     }
1522     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1523     return returnValue;
1524 }
1525 
EGL_GetSyncAttrib(EGLDisplay dpy,EGLSync sync,EGLint attribute,EGLAttrib * value)1526 EGLBoolean EGLAPIENTRY EGL_GetSyncAttrib(EGLDisplay dpy,
1527                                          EGLSync sync,
1528                                          EGLint attribute,
1529                                          EGLAttrib *value)
1530 {
1531 
1532     Thread *thread = egl::GetCurrentThread();
1533     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1534     EGLBoolean returnValue;
1535     {
1536         ANGLE_SCOPED_GLOBAL_EGL_SYNC_LOCK();
1537         EGL_EVENT(GetSyncAttrib,
1538                   "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR
1539                   ", attribute = %d, value = 0x%016" PRIxPTR "",
1540                   (uintptr_t)dpy, (uintptr_t)sync, attribute, (uintptr_t)value);
1541 
1542         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1543         egl::SyncID syncPacked  = PackParam<egl::SyncID>(sync);
1544 
1545         {
1546             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetSyncAttrib, thread, dpyPacked, attribute);
1547             if (IsEGLValidationEnabled())
1548             {
1549                 ANGLE_EGL_VALIDATE(thread, GetSyncAttrib, GetDisplayIfValid(dpyPacked), EGLBoolean,
1550                                    dpyPacked, syncPacked, attribute, value);
1551             }
1552             else
1553             {
1554             }
1555 
1556             returnValue = GetSyncAttrib(thread, dpyPacked, syncPacked, attribute, value);
1557         }
1558 
1559         ANGLE_CAPTURE_EGL(GetSyncAttrib, true, thread, dpyPacked, syncPacked, attribute, value,
1560                           returnValue);
1561     }
1562     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1563     return returnValue;
1564 }
1565 
EGL_WaitSync(EGLDisplay dpy,EGLSync sync,EGLint flags)1566 EGLBoolean EGLAPIENTRY EGL_WaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
1567 {
1568 
1569     Thread *thread = egl::GetCurrentThread();
1570     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1571     EGLBoolean returnValue;
1572     {
1573         ANGLE_SCOPED_GLOBAL_EGL_SYNC_LOCK();
1574         EGL_EVENT(WaitSync, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR ", flags = %d",
1575                   (uintptr_t)dpy, (uintptr_t)sync, flags);
1576 
1577         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1578         egl::SyncID syncPacked  = PackParam<egl::SyncID>(sync);
1579 
1580         {
1581             ANGLE_EGL_SCOPED_CONTEXT_LOCK(WaitSync, thread, dpyPacked, flags);
1582             if (IsEGLValidationEnabled())
1583             {
1584                 ANGLE_EGL_VALIDATE(thread, WaitSync, GetDisplayIfValid(dpyPacked), EGLBoolean,
1585                                    dpyPacked, syncPacked, flags);
1586             }
1587             else
1588             {
1589             }
1590 
1591             returnValue = WaitSync(thread, dpyPacked, syncPacked, flags);
1592         }
1593 
1594         ANGLE_CAPTURE_EGL(WaitSync, true, thread, dpyPacked, syncPacked, flags, returnValue);
1595     }
1596     egl::Display::GetCurrentThreadUnlockedTailCall()->run(&returnValue);
1597     return returnValue;
1598 }
1599 
1600 }  // extern "C"
1601