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