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