xref: /aosp_15_r20/external/angle/src/libGLESv2/entry_points_egl_ext_autogen.cpp (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by generate_entry_points.py using data from egl.xml and egl_angle_ext.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_ext_autogen.cpp:
9 //   Defines the EGL Extension entry points.
10 
11 #include "libGLESv2/entry_points_egl_ext_autogen.h"
12 
13 #include "libANGLE/capture/capture_egl_autogen.h"
14 #include "libANGLE/entry_points_utils.h"
15 #include "libANGLE/validationEGL_autogen.h"
16 #include "libGLESv2/egl_context_lock_impl.h"
17 #include "libGLESv2/egl_ext_stubs_autogen.h"
18 #include "libGLESv2/global_state.h"
19 
20 using namespace egl;
21 
22 extern "C" {
23 
24 // EGL_ANDROID_blob_cache
EGL_SetBlobCacheFuncsANDROID(EGLDisplay dpy,EGLSetBlobFuncANDROID set,EGLGetBlobFuncANDROID get)25 void EGLAPIENTRY EGL_SetBlobCacheFuncsANDROID(EGLDisplay dpy,
26                                               EGLSetBlobFuncANDROID set,
27                                               EGLGetBlobFuncANDROID get)
28 {
29 
30     Thread *thread = egl::GetCurrentThread();
31     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
32     {
33         ANGLE_SCOPED_GLOBAL_LOCK();
34         EGL_EVENT(SetBlobCacheFuncsANDROID,
35                   "dpy = 0x%016" PRIxPTR ", set = 0x%016" PRIxPTR ", get = 0x%016" PRIxPTR "",
36                   (uintptr_t)dpy, (uintptr_t)set, (uintptr_t)get);
37 
38         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
39 
40         {
41             ANGLE_EGL_SCOPED_CONTEXT_LOCK(SetBlobCacheFuncsANDROID, thread, dpyPacked);
42             if (IsEGLValidationEnabled())
43             {
44                 ANGLE_EGL_VALIDATE_VOID(thread, SetBlobCacheFuncsANDROID,
45                                         GetDisplayIfValid(dpyPacked), dpyPacked, set, get);
46             }
47             else
48             {
49             }
50 
51             SetBlobCacheFuncsANDROID(thread, dpyPacked, set, get);
52         }
53 
54         ANGLE_CAPTURE_EGL(SetBlobCacheFuncsANDROID, true, thread, dpyPacked, set, get);
55     }
56     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
57 }
58 
59 // EGL_ANDROID_create_native_client_buffer
EGL_CreateNativeClientBufferANDROID(const EGLint * attrib_list)60 EGLClientBuffer EGLAPIENTRY EGL_CreateNativeClientBufferANDROID(const EGLint *attrib_list)
61 {
62 
63     Thread *thread = egl::GetCurrentThread();
64     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
65     EGLClientBuffer returnValue;
66     {
67         ANGLE_SCOPED_GLOBAL_LOCK();
68         EGL_EVENT(CreateNativeClientBufferANDROID, "attrib_list = 0x%016" PRIxPTR "",
69                   (uintptr_t)attrib_list);
70 
71         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
72 
73         {
74             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreateNativeClientBufferANDROID, thread);
75             if (IsEGLValidationEnabled())
76             {
77                 ANGLE_EGL_VALIDATE(thread, CreateNativeClientBufferANDROID, nullptr,
78                                    EGLClientBuffer, attrib_listPacked);
79             }
80             else
81             {
82                 attrib_listPacked.initializeWithoutValidation();
83             }
84 
85             returnValue = CreateNativeClientBufferANDROID(thread, attrib_listPacked);
86         }
87 
88         ANGLE_CAPTURE_EGL(CreateNativeClientBufferANDROID, true, thread, attrib_listPacked,
89                           returnValue);
90     }
91     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
92     return returnValue;
93 }
94 
95 // EGL_ANDROID_get_frame_timestamps
EGL_GetCompositorTimingSupportedANDROID(EGLDisplay dpy,EGLSurface surface,EGLint name)96 EGLBoolean EGLAPIENTRY EGL_GetCompositorTimingSupportedANDROID(EGLDisplay dpy,
97                                                                EGLSurface surface,
98                                                                EGLint name)
99 {
100 
101     Thread *thread = egl::GetCurrentThread();
102     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
103     EGLBoolean returnValue;
104     {
105         ANGLE_SCOPED_GLOBAL_LOCK();
106         EGL_EVENT(GetCompositorTimingSupportedANDROID,
107                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", name = %d", (uintptr_t)dpy,
108                   (uintptr_t)surface, name);
109 
110         egl::Display *dpyPacked     = PackParam<egl::Display *>(dpy);
111         SurfaceID surfacePacked     = PackParam<SurfaceID>(surface);
112         CompositorTiming namePacked = PackParam<CompositorTiming>(name);
113 
114         {
115             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetCompositorTimingSupportedANDROID, thread, dpyPacked);
116             if (IsEGLValidationEnabled())
117             {
118                 ANGLE_EGL_VALIDATE(thread, GetCompositorTimingSupportedANDROID,
119                                    GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
120                                    surfacePacked, namePacked);
121             }
122             else
123             {
124             }
125 
126             returnValue =
127                 GetCompositorTimingSupportedANDROID(thread, dpyPacked, surfacePacked, namePacked);
128         }
129 
130         ANGLE_CAPTURE_EGL(GetCompositorTimingSupportedANDROID, true, thread, dpyPacked,
131                           surfacePacked, namePacked, returnValue);
132     }
133     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
134     return returnValue;
135 }
136 
EGL_GetCompositorTimingANDROID(EGLDisplay dpy,EGLSurface surface,EGLint numTimestamps,const EGLint * names,EGLnsecsANDROID * values)137 EGLBoolean EGLAPIENTRY EGL_GetCompositorTimingANDROID(EGLDisplay dpy,
138                                                       EGLSurface surface,
139                                                       EGLint numTimestamps,
140                                                       const EGLint *names,
141                                                       EGLnsecsANDROID *values)
142 {
143 
144     Thread *thread = egl::GetCurrentThread();
145     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
146     EGLBoolean returnValue;
147     {
148         ANGLE_SCOPED_GLOBAL_LOCK();
149         EGL_EVENT(GetCompositorTimingANDROID,
150                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR
151                   ", numTimestamps = %d, names = 0x%016" PRIxPTR ", values = 0x%016" PRIxPTR "",
152                   (uintptr_t)dpy, (uintptr_t)surface, numTimestamps, (uintptr_t)names,
153                   (uintptr_t)values);
154 
155         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
156         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
157 
158         {
159             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetCompositorTimingANDROID, thread, dpyPacked);
160             if (IsEGLValidationEnabled())
161             {
162                 ANGLE_EGL_VALIDATE(thread, GetCompositorTimingANDROID, GetDisplayIfValid(dpyPacked),
163                                    EGLBoolean, dpyPacked, surfacePacked, numTimestamps, names,
164                                    values);
165             }
166             else
167             {
168             }
169 
170             returnValue = GetCompositorTimingANDROID(thread, dpyPacked, surfacePacked,
171                                                      numTimestamps, names, values);
172         }
173 
174         ANGLE_CAPTURE_EGL(GetCompositorTimingANDROID, true, thread, dpyPacked, surfacePacked,
175                           numTimestamps, names, values, returnValue);
176     }
177     egl::Display::GetCurrentThreadUnlockedTailCall()->run(&returnValue);
178     return returnValue;
179 }
180 
EGL_GetNextFrameIdANDROID(EGLDisplay dpy,EGLSurface surface,EGLuint64KHR * frameId)181 EGLBoolean EGLAPIENTRY EGL_GetNextFrameIdANDROID(EGLDisplay dpy,
182                                                  EGLSurface surface,
183                                                  EGLuint64KHR *frameId)
184 {
185 
186     Thread *thread = egl::GetCurrentThread();
187     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
188     EGLBoolean returnValue;
189     {
190         ANGLE_SCOPED_GLOBAL_LOCK();
191         EGL_EVENT(GetNextFrameIdANDROID,
192                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", frameId = 0x%016" PRIxPTR
193                   "",
194                   (uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)frameId);
195 
196         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
197         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
198 
199         {
200             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetNextFrameIdANDROID, thread, dpyPacked);
201             if (IsEGLValidationEnabled())
202             {
203                 ANGLE_EGL_VALIDATE(thread, GetNextFrameIdANDROID, GetDisplayIfValid(dpyPacked),
204                                    EGLBoolean, dpyPacked, surfacePacked, frameId);
205             }
206             else
207             {
208             }
209 
210             returnValue = GetNextFrameIdANDROID(thread, dpyPacked, surfacePacked, frameId);
211         }
212 
213         ANGLE_CAPTURE_EGL(GetNextFrameIdANDROID, true, thread, dpyPacked, surfacePacked, frameId,
214                           returnValue);
215     }
216     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
217     return returnValue;
218 }
219 
EGL_GetFrameTimestampSupportedANDROID(EGLDisplay dpy,EGLSurface surface,EGLint timestamp)220 EGLBoolean EGLAPIENTRY EGL_GetFrameTimestampSupportedANDROID(EGLDisplay dpy,
221                                                              EGLSurface surface,
222                                                              EGLint timestamp)
223 {
224 
225     Thread *thread = egl::GetCurrentThread();
226     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
227     EGLBoolean returnValue;
228     {
229         ANGLE_SCOPED_GLOBAL_LOCK();
230         EGL_EVENT(GetFrameTimestampSupportedANDROID,
231                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", timestamp = %d",
232                   (uintptr_t)dpy, (uintptr_t)surface, timestamp);
233 
234         egl::Display *dpyPacked   = PackParam<egl::Display *>(dpy);
235         SurfaceID surfacePacked   = PackParam<SurfaceID>(surface);
236         Timestamp timestampPacked = PackParam<Timestamp>(timestamp);
237 
238         {
239             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetFrameTimestampSupportedANDROID, thread, dpyPacked);
240             if (IsEGLValidationEnabled())
241             {
242                 ANGLE_EGL_VALIDATE(thread, GetFrameTimestampSupportedANDROID,
243                                    GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
244                                    surfacePacked, timestampPacked);
245             }
246             else
247             {
248             }
249 
250             returnValue = GetFrameTimestampSupportedANDROID(thread, dpyPacked, surfacePacked,
251                                                             timestampPacked);
252         }
253 
254         ANGLE_CAPTURE_EGL(GetFrameTimestampSupportedANDROID, true, thread, dpyPacked, surfacePacked,
255                           timestampPacked, returnValue);
256     }
257     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
258     return returnValue;
259 }
260 
EGL_GetFrameTimestampsANDROID(EGLDisplay dpy,EGLSurface surface,EGLuint64KHR frameId,EGLint numTimestamps,const EGLint * timestamps,EGLnsecsANDROID * values)261 EGLBoolean EGLAPIENTRY EGL_GetFrameTimestampsANDROID(EGLDisplay dpy,
262                                                      EGLSurface surface,
263                                                      EGLuint64KHR frameId,
264                                                      EGLint numTimestamps,
265                                                      const EGLint *timestamps,
266                                                      EGLnsecsANDROID *values)
267 {
268 
269     Thread *thread = egl::GetCurrentThread();
270     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
271     EGLBoolean returnValue;
272     {
273         ANGLE_SCOPED_GLOBAL_LOCK();
274         EGL_EVENT(GetFrameTimestampsANDROID,
275                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR
276                   ", frameId = %llu, numTimestamps = %d, timestamps = 0x%016" PRIxPTR
277                   ", values = 0x%016" PRIxPTR "",
278                   (uintptr_t)dpy, (uintptr_t)surface, static_cast<unsigned long long>(frameId),
279                   numTimestamps, (uintptr_t)timestamps, (uintptr_t)values);
280 
281         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
282         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
283 
284         {
285             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetFrameTimestampsANDROID, thread, dpyPacked);
286             if (IsEGLValidationEnabled())
287             {
288                 ANGLE_EGL_VALIDATE(thread, GetFrameTimestampsANDROID, GetDisplayIfValid(dpyPacked),
289                                    EGLBoolean, dpyPacked, surfacePacked, frameId, numTimestamps,
290                                    timestamps, values);
291             }
292             else
293             {
294             }
295 
296             returnValue = GetFrameTimestampsANDROID(thread, dpyPacked, surfacePacked, frameId,
297                                                     numTimestamps, timestamps, values);
298         }
299 
300         ANGLE_CAPTURE_EGL(GetFrameTimestampsANDROID, true, thread, dpyPacked, surfacePacked,
301                           frameId, numTimestamps, timestamps, values, returnValue);
302     }
303     egl::Display::GetCurrentThreadUnlockedTailCall()->run(&returnValue);
304     return returnValue;
305 }
306 
307 // EGL_ANDROID_get_native_client_buffer
EGL_GetNativeClientBufferANDROID(const struct AHardwareBuffer * buffer)308 EGLClientBuffer EGLAPIENTRY EGL_GetNativeClientBufferANDROID(const struct AHardwareBuffer *buffer)
309 {
310 
311     Thread *thread = egl::GetCurrentThread();
312     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
313     EGLClientBuffer returnValue;
314     {
315         ANGLE_SCOPED_GLOBAL_LOCK();
316         EGL_EVENT(GetNativeClientBufferANDROID, "buffer = 0x%016" PRIxPTR "", (uintptr_t)buffer);
317 
318         {
319             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetNativeClientBufferANDROID, thread);
320             if (IsEGLValidationEnabled())
321             {
322                 ANGLE_EGL_VALIDATE(thread, GetNativeClientBufferANDROID, nullptr, EGLClientBuffer,
323                                    buffer);
324             }
325             else
326             {
327             }
328 
329             returnValue = GetNativeClientBufferANDROID(thread, buffer);
330         }
331 
332         ANGLE_CAPTURE_EGL(GetNativeClientBufferANDROID, true, thread, buffer, returnValue);
333     }
334     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
335     return returnValue;
336 }
337 
338 // EGL_ANDROID_native_fence_sync
EGL_DupNativeFenceFDANDROID(EGLDisplay dpy,EGLSyncKHR sync)339 EGLint EGLAPIENTRY EGL_DupNativeFenceFDANDROID(EGLDisplay dpy, EGLSyncKHR sync)
340 {
341 
342     Thread *thread = egl::GetCurrentThread();
343     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
344     EGLint returnValue;
345     {
346         ANGLE_SCOPED_GLOBAL_EGL_SYNC_LOCK();
347         EGL_EVENT(DupNativeFenceFDANDROID, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR "",
348                   (uintptr_t)dpy, (uintptr_t)sync);
349 
350         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
351         egl::SyncID syncPacked  = PackParam<egl::SyncID>(sync);
352 
353         {
354             ANGLE_EGL_SCOPED_CONTEXT_LOCK(DupNativeFenceFDANDROID, thread, dpyPacked);
355             if (IsEGLValidationEnabled())
356             {
357                 ANGLE_EGL_VALIDATE(thread, DupNativeFenceFDANDROID, GetDisplayIfValid(dpyPacked),
358                                    EGLint, dpyPacked, syncPacked);
359             }
360             else
361             {
362             }
363 
364             returnValue = DupNativeFenceFDANDROID(thread, dpyPacked, syncPacked);
365         }
366 
367         ANGLE_CAPTURE_EGL(DupNativeFenceFDANDROID, true, thread, dpyPacked, syncPacked,
368                           returnValue);
369     }
370     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
371     return returnValue;
372 }
373 
374 // EGL_ANDROID_presentation_time
EGL_PresentationTimeANDROID(EGLDisplay dpy,EGLSurface surface,EGLnsecsANDROID time)375 EGLBoolean EGLAPIENTRY EGL_PresentationTimeANDROID(EGLDisplay dpy,
376                                                    EGLSurface surface,
377                                                    EGLnsecsANDROID time)
378 {
379 
380     Thread *thread = egl::GetCurrentThread();
381     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
382     EGLBoolean returnValue;
383     {
384         ANGLE_SCOPED_GLOBAL_LOCK();
385         EGL_EVENT(PresentationTimeANDROID,
386                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", time = %llu",
387                   (uintptr_t)dpy, (uintptr_t)surface, static_cast<unsigned long long>(time));
388 
389         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
390         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
391 
392         {
393             ANGLE_EGL_SCOPED_CONTEXT_LOCK(PresentationTimeANDROID, thread, dpyPacked);
394             if (IsEGLValidationEnabled())
395             {
396                 ANGLE_EGL_VALIDATE(thread, PresentationTimeANDROID, GetDisplayIfValid(dpyPacked),
397                                    EGLBoolean, dpyPacked, surfacePacked, time);
398             }
399             else
400             {
401             }
402 
403             returnValue = PresentationTimeANDROID(thread, dpyPacked, surfacePacked, time);
404         }
405 
406         ANGLE_CAPTURE_EGL(PresentationTimeANDROID, true, thread, dpyPacked, surfacePacked, time,
407                           returnValue);
408     }
409     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
410     return returnValue;
411 }
412 
413 // EGL_ANGLE_device_creation
EGL_CreateDeviceANGLE(EGLint device_type,void * native_device,const EGLAttrib * attrib_list)414 EGLDeviceEXT EGLAPIENTRY EGL_CreateDeviceANGLE(EGLint device_type,
415                                                void *native_device,
416                                                const EGLAttrib *attrib_list)
417 {
418 
419     Thread *thread = egl::GetCurrentThread();
420     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
421     EGLDeviceEXT returnValue;
422     {
423         ANGLE_SCOPED_GLOBAL_LOCK();
424         EGL_EVENT(CreateDeviceANGLE,
425                   "device_type = %d, native_device = 0x%016" PRIxPTR
426                   ", attrib_list = 0x%016" PRIxPTR "",
427                   device_type, (uintptr_t)native_device, (uintptr_t)attrib_list);
428 
429         {
430             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreateDeviceANGLE, thread);
431             if (IsEGLValidationEnabled())
432             {
433                 ANGLE_EGL_VALIDATE(thread, CreateDeviceANGLE, nullptr, EGLDeviceEXT, device_type,
434                                    native_device, attrib_list);
435             }
436             else
437             {
438             }
439 
440             returnValue = CreateDeviceANGLE(thread, device_type, native_device, attrib_list);
441         }
442 
443         ANGLE_CAPTURE_EGL(CreateDeviceANGLE, true, thread, device_type, native_device, attrib_list,
444                           returnValue);
445     }
446     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
447     return returnValue;
448 }
449 
EGL_ReleaseDeviceANGLE(EGLDeviceEXT device)450 EGLBoolean EGLAPIENTRY EGL_ReleaseDeviceANGLE(EGLDeviceEXT device)
451 {
452 
453     Thread *thread = egl::GetCurrentThread();
454     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
455     EGLBoolean returnValue;
456     {
457         ANGLE_SCOPED_GLOBAL_LOCK();
458         EGL_EVENT(ReleaseDeviceANGLE, "device = 0x%016" PRIxPTR "", (uintptr_t)device);
459 
460         egl::Device *devicePacked = PackParam<egl::Device *>(device);
461 
462         {
463             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ReleaseDeviceANGLE, thread);
464             if (IsEGLValidationEnabled())
465             {
466                 ANGLE_EGL_VALIDATE(thread, ReleaseDeviceANGLE, nullptr, EGLBoolean, devicePacked);
467             }
468             else
469             {
470             }
471 
472             returnValue = ReleaseDeviceANGLE(thread, devicePacked);
473         }
474 
475         ANGLE_CAPTURE_EGL(ReleaseDeviceANGLE, true, thread, devicePacked, returnValue);
476     }
477     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
478     return returnValue;
479 }
480 
481 // EGL_ANGLE_external_context_and_surface
EGL_AcquireExternalContextANGLE(EGLDisplay dpy,EGLSurface drawAndRead)482 void EGLAPIENTRY EGL_AcquireExternalContextANGLE(EGLDisplay dpy, EGLSurface drawAndRead)
483 {
484 
485     Thread *thread = egl::GetCurrentThread();
486     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
487     {
488         ANGLE_SCOPED_GLOBAL_LOCK();
489         EGL_EVENT(AcquireExternalContextANGLE,
490                   "dpy = 0x%016" PRIxPTR ", drawAndRead = 0x%016" PRIxPTR "", (uintptr_t)dpy,
491                   (uintptr_t)drawAndRead);
492 
493         egl::Display *dpyPacked     = PackParam<egl::Display *>(dpy);
494         SurfaceID drawAndReadPacked = PackParam<SurfaceID>(drawAndRead);
495 
496         {
497             ANGLE_EGL_SCOPED_CONTEXT_LOCK(AcquireExternalContextANGLE, thread, dpyPacked);
498             if (IsEGLValidationEnabled())
499             {
500                 ANGLE_EGL_VALIDATE_VOID(thread, AcquireExternalContextANGLE,
501                                         GetDisplayIfValid(dpyPacked), dpyPacked, drawAndReadPacked);
502             }
503             else
504             {
505             }
506 
507             AcquireExternalContextANGLE(thread, dpyPacked, drawAndReadPacked);
508         }
509 
510         ANGLE_CAPTURE_EGL(AcquireExternalContextANGLE, true, thread, dpyPacked, drawAndReadPacked);
511     }
512     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
513 }
514 
EGL_ReleaseExternalContextANGLE(EGLDisplay dpy)515 void EGLAPIENTRY EGL_ReleaseExternalContextANGLE(EGLDisplay dpy)
516 {
517 
518     Thread *thread = egl::GetCurrentThread();
519     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
520     {
521         ANGLE_SCOPED_GLOBAL_LOCK();
522         EGL_EVENT(ReleaseExternalContextANGLE, "dpy = 0x%016" PRIxPTR "", (uintptr_t)dpy);
523 
524         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
525 
526         {
527             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ReleaseExternalContextANGLE, thread, dpyPacked);
528             if (IsEGLValidationEnabled())
529             {
530                 ANGLE_EGL_VALIDATE_VOID(thread, ReleaseExternalContextANGLE,
531                                         GetDisplayIfValid(dpyPacked), dpyPacked);
532             }
533             else
534             {
535             }
536 
537             ReleaseExternalContextANGLE(thread, dpyPacked);
538         }
539 
540         ANGLE_CAPTURE_EGL(ReleaseExternalContextANGLE, true, thread, dpyPacked);
541     }
542     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
543 }
544 
545 // EGL_ANGLE_feature_control
EGL_QueryStringiANGLE(EGLDisplay dpy,EGLint name,EGLint index)546 const char *EGLAPIENTRY EGL_QueryStringiANGLE(EGLDisplay dpy, EGLint name, EGLint index)
547 {
548 
549     Thread *thread = egl::GetCurrentThread();
550     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
551     const char *returnValue;
552     {
553         ANGLE_SCOPED_GLOBAL_LOCK();
554         EGL_EVENT(QueryStringiANGLE, "dpy = 0x%016" PRIxPTR ", name = %d, index = %d",
555                   (uintptr_t)dpy, name, index);
556 
557         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
558 
559         {
560             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryStringiANGLE, thread, dpyPacked);
561             if (IsEGLValidationEnabled())
562             {
563                 ANGLE_EGL_VALIDATE(thread, QueryStringiANGLE, GetDisplayIfValid(dpyPacked),
564                                    const char *, dpyPacked, name, index);
565             }
566             else
567             {
568             }
569 
570             returnValue = QueryStringiANGLE(thread, dpyPacked, name, index);
571         }
572 
573         ANGLE_CAPTURE_EGL(QueryStringiANGLE, true, thread, dpyPacked, name, index, returnValue);
574     }
575     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
576     return returnValue;
577 }
578 
EGL_QueryDisplayAttribANGLE(EGLDisplay dpy,EGLint attribute,EGLAttrib * value)579 EGLBoolean EGLAPIENTRY EGL_QueryDisplayAttribANGLE(EGLDisplay dpy,
580                                                    EGLint attribute,
581                                                    EGLAttrib *value)
582 {
583 
584     Thread *thread = egl::GetCurrentThread();
585     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
586     EGLBoolean returnValue;
587     {
588         ANGLE_SCOPED_GLOBAL_LOCK();
589         EGL_EVENT(QueryDisplayAttribANGLE,
590                   "dpy = 0x%016" PRIxPTR ", attribute = %d, value = 0x%016" PRIxPTR "",
591                   (uintptr_t)dpy, attribute, (uintptr_t)value);
592 
593         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
594 
595         {
596             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryDisplayAttribANGLE, thread, dpyPacked, attribute);
597             if (IsEGLValidationEnabled())
598             {
599                 ANGLE_EGL_VALIDATE(thread, QueryDisplayAttribANGLE, GetDisplayIfValid(dpyPacked),
600                                    EGLBoolean, dpyPacked, attribute, value);
601             }
602             else
603             {
604             }
605 
606             returnValue = QueryDisplayAttribANGLE(thread, dpyPacked, attribute, value);
607         }
608 
609         ANGLE_CAPTURE_EGL(QueryDisplayAttribANGLE, true, thread, dpyPacked, attribute, value,
610                           returnValue);
611     }
612     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
613     return returnValue;
614 }
615 
616 // EGL_ANGLE_metal_shared_event_sync
EGL_CopyMetalSharedEventANGLE(EGLDisplay dpy,EGLSyncKHR sync)617 void *EGLAPIENTRY EGL_CopyMetalSharedEventANGLE(EGLDisplay dpy, EGLSyncKHR sync)
618 {
619 
620     Thread *thread = egl::GetCurrentThread();
621     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
622     void *returnValue;
623     {
624         ANGLE_SCOPED_GLOBAL_EGL_SYNC_LOCK();
625         EGL_EVENT(CopyMetalSharedEventANGLE, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR "",
626                   (uintptr_t)dpy, (uintptr_t)sync);
627 
628         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
629         egl::SyncID syncPacked  = PackParam<egl::SyncID>(sync);
630 
631         {
632             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CopyMetalSharedEventANGLE, thread, dpyPacked);
633             if (IsEGLValidationEnabled())
634             {
635                 ANGLE_EGL_VALIDATE(thread, CopyMetalSharedEventANGLE, GetDisplayIfValid(dpyPacked),
636                                    void *, dpyPacked, syncPacked);
637             }
638             else
639             {
640             }
641 
642             returnValue = CopyMetalSharedEventANGLE(thread, dpyPacked, syncPacked);
643         }
644 
645         ANGLE_CAPTURE_EGL(CopyMetalSharedEventANGLE, true, thread, dpyPacked, syncPacked,
646                           returnValue);
647     }
648     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
649     return returnValue;
650 }
651 
652 // EGL_ANGLE_no_error
EGL_SetValidationEnabledANGLE(EGLBoolean validationState)653 void EGLAPIENTRY EGL_SetValidationEnabledANGLE(EGLBoolean validationState)
654 {
655 
656     Thread *thread = egl::GetCurrentThread();
657     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
658     {
659         ANGLE_SCOPED_GLOBAL_LOCK();
660         EGL_EVENT(SetValidationEnabledANGLE, "validationState = %u", validationState);
661 
662         {
663             ANGLE_EGL_SCOPED_CONTEXT_LOCK(SetValidationEnabledANGLE, thread);
664             if (IsEGLValidationEnabled())
665             {
666                 ANGLE_EGL_VALIDATE_VOID(thread, SetValidationEnabledANGLE, nullptr,
667                                         validationState);
668             }
669             else
670             {
671             }
672 
673             SetValidationEnabledANGLE(thread, validationState);
674         }
675 
676         ANGLE_CAPTURE_EGL(SetValidationEnabledANGLE, true, thread, validationState);
677     }
678     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
679 }
680 
681 // EGL_ANGLE_power_preference
EGL_ReleaseHighPowerGPUANGLE(EGLDisplay dpy,EGLContext ctx)682 void EGLAPIENTRY EGL_ReleaseHighPowerGPUANGLE(EGLDisplay dpy, EGLContext ctx)
683 {
684 
685     Thread *thread = egl::GetCurrentThread();
686     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
687     {
688         ANGLE_SCOPED_GLOBAL_LOCK();
689         EGL_EVENT(ReleaseHighPowerGPUANGLE, "dpy = 0x%016" PRIxPTR ", ctx = 0x%016" PRIxPTR "",
690                   (uintptr_t)dpy, (uintptr_t)ctx);
691 
692         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
693         gl::ContextID ctxPacked = PackParam<gl::ContextID>(ctx);
694 
695         {
696             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ReleaseHighPowerGPUANGLE, thread, dpyPacked, ctxPacked);
697             if (IsEGLValidationEnabled())
698             {
699                 ANGLE_EGL_VALIDATE_VOID(thread, ReleaseHighPowerGPUANGLE,
700                                         GetDisplayIfValid(dpyPacked), dpyPacked, ctxPacked);
701             }
702             else
703             {
704             }
705 
706             ReleaseHighPowerGPUANGLE(thread, dpyPacked, ctxPacked);
707         }
708 
709         ANGLE_CAPTURE_EGL(ReleaseHighPowerGPUANGLE, true, thread, dpyPacked, ctxPacked);
710     }
711     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
712 }
713 
EGL_ReacquireHighPowerGPUANGLE(EGLDisplay dpy,EGLContext ctx)714 void EGLAPIENTRY EGL_ReacquireHighPowerGPUANGLE(EGLDisplay dpy, EGLContext ctx)
715 {
716 
717     Thread *thread = egl::GetCurrentThread();
718     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
719     {
720         ANGLE_SCOPED_GLOBAL_LOCK();
721         EGL_EVENT(ReacquireHighPowerGPUANGLE, "dpy = 0x%016" PRIxPTR ", ctx = 0x%016" PRIxPTR "",
722                   (uintptr_t)dpy, (uintptr_t)ctx);
723 
724         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
725         gl::ContextID ctxPacked = PackParam<gl::ContextID>(ctx);
726 
727         {
728             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ReacquireHighPowerGPUANGLE, thread, dpyPacked, ctxPacked);
729             if (IsEGLValidationEnabled())
730             {
731                 ANGLE_EGL_VALIDATE_VOID(thread, ReacquireHighPowerGPUANGLE,
732                                         GetDisplayIfValid(dpyPacked), dpyPacked, ctxPacked);
733             }
734             else
735             {
736             }
737 
738             ReacquireHighPowerGPUANGLE(thread, dpyPacked, ctxPacked);
739         }
740 
741         ANGLE_CAPTURE_EGL(ReacquireHighPowerGPUANGLE, true, thread, dpyPacked, ctxPacked);
742     }
743     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
744 }
745 
EGL_HandleGPUSwitchANGLE(EGLDisplay dpy)746 void EGLAPIENTRY EGL_HandleGPUSwitchANGLE(EGLDisplay dpy)
747 {
748 
749     Thread *thread = egl::GetCurrentThread();
750     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
751     {
752         ANGLE_SCOPED_GLOBAL_LOCK();
753         EGL_EVENT(HandleGPUSwitchANGLE, "dpy = 0x%016" PRIxPTR "", (uintptr_t)dpy);
754 
755         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
756 
757         {
758             ANGLE_EGL_SCOPED_CONTEXT_LOCK(HandleGPUSwitchANGLE, thread, dpyPacked);
759             if (IsEGLValidationEnabled())
760             {
761                 ANGLE_EGL_VALIDATE_VOID(thread, HandleGPUSwitchANGLE, GetDisplayIfValid(dpyPacked),
762                                         dpyPacked);
763             }
764             else
765             {
766             }
767 
768             HandleGPUSwitchANGLE(thread, dpyPacked);
769         }
770 
771         ANGLE_CAPTURE_EGL(HandleGPUSwitchANGLE, true, thread, dpyPacked);
772     }
773     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
774 }
775 
EGL_ForceGPUSwitchANGLE(EGLDisplay dpy,EGLint gpuIDHigh,EGLint gpuIDLow)776 void EGLAPIENTRY EGL_ForceGPUSwitchANGLE(EGLDisplay dpy, EGLint gpuIDHigh, EGLint gpuIDLow)
777 {
778 
779     Thread *thread = egl::GetCurrentThread();
780     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
781     {
782         ANGLE_SCOPED_GLOBAL_LOCK();
783         EGL_EVENT(ForceGPUSwitchANGLE, "dpy = 0x%016" PRIxPTR ", gpuIDHigh = %d, gpuIDLow = %d",
784                   (uintptr_t)dpy, gpuIDHigh, gpuIDLow);
785 
786         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
787 
788         {
789             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ForceGPUSwitchANGLE, thread, dpyPacked);
790             if (IsEGLValidationEnabled())
791             {
792                 ANGLE_EGL_VALIDATE_VOID(thread, ForceGPUSwitchANGLE, GetDisplayIfValid(dpyPacked),
793                                         dpyPacked, gpuIDHigh, gpuIDLow);
794             }
795             else
796             {
797             }
798 
799             ForceGPUSwitchANGLE(thread, dpyPacked, gpuIDHigh, gpuIDLow);
800         }
801 
802         ANGLE_CAPTURE_EGL(ForceGPUSwitchANGLE, true, thread, dpyPacked, gpuIDHigh, gpuIDLow);
803     }
804     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
805 }
806 
807 // EGL_ANGLE_prepare_swap_buffers
EGL_PrepareSwapBuffersANGLE(EGLDisplay dpy,EGLSurface surface)808 EGLBoolean EGLAPIENTRY EGL_PrepareSwapBuffersANGLE(EGLDisplay dpy, EGLSurface surface)
809 {
810 
811     Thread *thread = egl::GetCurrentThread();
812     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
813     EGLBoolean returnValue;
814     {
815         ANGLE_SCOPED_GLOBAL_LOCK();
816         EGL_EVENT(PrepareSwapBuffersANGLE, "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR "",
817                   (uintptr_t)dpy, (uintptr_t)surface);
818 
819         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
820         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
821 
822         {
823             ANGLE_EGL_SCOPED_CONTEXT_LOCK(PrepareSwapBuffersANGLE, thread, dpyPacked);
824             if (IsEGLValidationEnabled())
825             {
826                 ANGLE_EGL_VALIDATE(thread, PrepareSwapBuffersANGLE, GetDisplayIfValid(dpyPacked),
827                                    EGLBoolean, dpyPacked, surfacePacked);
828             }
829             else
830             {
831             }
832 
833             returnValue = PrepareSwapBuffersANGLE(thread, dpyPacked, surfacePacked);
834         }
835 
836         ANGLE_CAPTURE_EGL(PrepareSwapBuffersANGLE, true, thread, dpyPacked, surfacePacked,
837                           returnValue);
838     }
839     egl::Display::GetCurrentThreadUnlockedTailCall()->run(nullptr);
840     return returnValue;
841 }
842 
843 // EGL_ANGLE_program_cache_control
EGL_ProgramCacheGetAttribANGLE(EGLDisplay dpy,EGLenum attrib)844 EGLint EGLAPIENTRY EGL_ProgramCacheGetAttribANGLE(EGLDisplay dpy, EGLenum attrib)
845 {
846 
847     Thread *thread = egl::GetCurrentThread();
848     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
849     EGLint returnValue;
850     {
851         ANGLE_SCOPED_GLOBAL_LOCK();
852         EGL_EVENT(ProgramCacheGetAttribANGLE, "dpy = 0x%016" PRIxPTR ", attrib = 0x%X",
853                   (uintptr_t)dpy, attrib);
854 
855         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
856 
857         {
858             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ProgramCacheGetAttribANGLE, thread, dpyPacked);
859             if (IsEGLValidationEnabled())
860             {
861                 ANGLE_EGL_VALIDATE(thread, ProgramCacheGetAttribANGLE, GetDisplayIfValid(dpyPacked),
862                                    EGLint, dpyPacked, attrib);
863             }
864             else
865             {
866             }
867 
868             returnValue = ProgramCacheGetAttribANGLE(thread, dpyPacked, attrib);
869         }
870 
871         ANGLE_CAPTURE_EGL(ProgramCacheGetAttribANGLE, true, thread, dpyPacked, attrib, returnValue);
872     }
873     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
874     return returnValue;
875 }
876 
EGL_ProgramCacheQueryANGLE(EGLDisplay dpy,EGLint index,void * key,EGLint * keysize,void * binary,EGLint * binarysize)877 void EGLAPIENTRY EGL_ProgramCacheQueryANGLE(EGLDisplay dpy,
878                                             EGLint index,
879                                             void *key,
880                                             EGLint *keysize,
881                                             void *binary,
882                                             EGLint *binarysize)
883 {
884 
885     Thread *thread = egl::GetCurrentThread();
886     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
887     {
888         ANGLE_SCOPED_GLOBAL_LOCK();
889         EGL_EVENT(ProgramCacheQueryANGLE,
890                   "dpy = 0x%016" PRIxPTR ", index = %d, key = 0x%016" PRIxPTR
891                   ", keysize = 0x%016" PRIxPTR ", binary = 0x%016" PRIxPTR
892                   ", binarysize = 0x%016" PRIxPTR "",
893                   (uintptr_t)dpy, index, (uintptr_t)key, (uintptr_t)keysize, (uintptr_t)binary,
894                   (uintptr_t)binarysize);
895 
896         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
897 
898         {
899             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ProgramCacheQueryANGLE, thread, dpyPacked);
900             if (IsEGLValidationEnabled())
901             {
902                 ANGLE_EGL_VALIDATE_VOID(thread, ProgramCacheQueryANGLE,
903                                         GetDisplayIfValid(dpyPacked), dpyPacked, index, key,
904                                         keysize, binary, binarysize);
905             }
906             else
907             {
908             }
909 
910             ProgramCacheQueryANGLE(thread, dpyPacked, index, key, keysize, binary, binarysize);
911         }
912 
913         ANGLE_CAPTURE_EGL(ProgramCacheQueryANGLE, true, thread, dpyPacked, index, key, keysize,
914                           binary, binarysize);
915     }
916     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
917 }
918 
EGL_ProgramCachePopulateANGLE(EGLDisplay dpy,const void * key,EGLint keysize,const void * binary,EGLint binarysize)919 void EGLAPIENTRY EGL_ProgramCachePopulateANGLE(EGLDisplay dpy,
920                                                const void *key,
921                                                EGLint keysize,
922                                                const void *binary,
923                                                EGLint binarysize)
924 {
925 
926     Thread *thread = egl::GetCurrentThread();
927     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
928     {
929         ANGLE_SCOPED_GLOBAL_LOCK();
930         EGL_EVENT(ProgramCachePopulateANGLE,
931                   "dpy = 0x%016" PRIxPTR ", key = 0x%016" PRIxPTR
932                   ", keysize = %d, binary = 0x%016" PRIxPTR ", binarysize = %d",
933                   (uintptr_t)dpy, (uintptr_t)key, keysize, (uintptr_t)binary, binarysize);
934 
935         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
936 
937         {
938             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ProgramCachePopulateANGLE, thread, dpyPacked);
939             if (IsEGLValidationEnabled())
940             {
941                 ANGLE_EGL_VALIDATE_VOID(thread, ProgramCachePopulateANGLE,
942                                         GetDisplayIfValid(dpyPacked), dpyPacked, key, keysize,
943                                         binary, binarysize);
944             }
945             else
946             {
947             }
948 
949             ProgramCachePopulateANGLE(thread, dpyPacked, key, keysize, binary, binarysize);
950         }
951 
952         ANGLE_CAPTURE_EGL(ProgramCachePopulateANGLE, true, thread, dpyPacked, key, keysize, binary,
953                           binarysize);
954     }
955     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
956 }
957 
EGL_ProgramCacheResizeANGLE(EGLDisplay dpy,EGLint limit,EGLint mode)958 EGLint EGLAPIENTRY EGL_ProgramCacheResizeANGLE(EGLDisplay dpy, EGLint limit, EGLint mode)
959 {
960 
961     Thread *thread = egl::GetCurrentThread();
962     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
963     EGLint returnValue;
964     {
965         ANGLE_SCOPED_GLOBAL_LOCK();
966         EGL_EVENT(ProgramCacheResizeANGLE, "dpy = 0x%016" PRIxPTR ", limit = %d, mode = %d",
967                   (uintptr_t)dpy, limit, mode);
968 
969         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
970 
971         {
972             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ProgramCacheResizeANGLE, thread, dpyPacked);
973             if (IsEGLValidationEnabled())
974             {
975                 ANGLE_EGL_VALIDATE(thread, ProgramCacheResizeANGLE, GetDisplayIfValid(dpyPacked),
976                                    EGLint, dpyPacked, limit, mode);
977             }
978             else
979             {
980             }
981 
982             returnValue = ProgramCacheResizeANGLE(thread, dpyPacked, limit, mode);
983         }
984 
985         ANGLE_CAPTURE_EGL(ProgramCacheResizeANGLE, true, thread, dpyPacked, limit, mode,
986                           returnValue);
987     }
988     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
989     return returnValue;
990 }
991 
992 // EGL_ANGLE_query_surface_pointer
EGL_QuerySurfacePointerANGLE(EGLDisplay dpy,EGLSurface surface,EGLint attribute,void ** value)993 EGLBoolean EGLAPIENTRY EGL_QuerySurfacePointerANGLE(EGLDisplay dpy,
994                                                     EGLSurface surface,
995                                                     EGLint attribute,
996                                                     void **value)
997 {
998 
999     Thread *thread = egl::GetCurrentThread();
1000     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1001     EGLBoolean returnValue;
1002     {
1003         ANGLE_SCOPED_GLOBAL_LOCK();
1004         EGL_EVENT(QuerySurfacePointerANGLE,
1005                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR
1006                   ", attribute = %d, value = 0x%016" PRIxPTR "",
1007                   (uintptr_t)dpy, (uintptr_t)surface, attribute, (uintptr_t)value);
1008 
1009         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1010         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
1011 
1012         {
1013             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QuerySurfacePointerANGLE, thread, dpyPacked, attribute);
1014             if (IsEGLValidationEnabled())
1015             {
1016                 ANGLE_EGL_VALIDATE(thread, QuerySurfacePointerANGLE, GetDisplayIfValid(dpyPacked),
1017                                    EGLBoolean, dpyPacked, surfacePacked, attribute, value);
1018             }
1019             else
1020             {
1021             }
1022 
1023             returnValue =
1024                 QuerySurfacePointerANGLE(thread, dpyPacked, surfacePacked, attribute, value);
1025         }
1026 
1027         ANGLE_CAPTURE_EGL(QuerySurfacePointerANGLE, true, thread, dpyPacked, surfacePacked,
1028                           attribute, value, returnValue);
1029     }
1030     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1031     return returnValue;
1032 }
1033 
1034 // EGL_ANGLE_stream_producer_d3d_texture
EGL_CreateStreamProducerD3DTextureANGLE(EGLDisplay dpy,EGLStreamKHR stream,const EGLAttrib * attrib_list)1035 EGLBoolean EGLAPIENTRY EGL_CreateStreamProducerD3DTextureANGLE(EGLDisplay dpy,
1036                                                                EGLStreamKHR stream,
1037                                                                const EGLAttrib *attrib_list)
1038 {
1039 
1040     Thread *thread = egl::GetCurrentThread();
1041     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1042     EGLBoolean returnValue;
1043     {
1044         ANGLE_SCOPED_GLOBAL_LOCK();
1045         EGL_EVENT(CreateStreamProducerD3DTextureANGLE,
1046                   "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR
1047                   ", attrib_list = 0x%016" PRIxPTR "",
1048                   (uintptr_t)dpy, (uintptr_t)stream, (uintptr_t)attrib_list);
1049 
1050         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
1051         egl::Stream *streamPacked             = PackParam<egl::Stream *>(stream);
1052         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1053 
1054         {
1055             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreateStreamProducerD3DTextureANGLE, thread, dpyPacked);
1056             if (IsEGLValidationEnabled())
1057             {
1058                 ANGLE_EGL_VALIDATE(thread, CreateStreamProducerD3DTextureANGLE,
1059                                    GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
1060                                    streamPacked, attrib_listPacked);
1061             }
1062             else
1063             {
1064                 attrib_listPacked.initializeWithoutValidation();
1065             }
1066 
1067             returnValue = CreateStreamProducerD3DTextureANGLE(thread, dpyPacked, streamPacked,
1068                                                               attrib_listPacked);
1069         }
1070 
1071         ANGLE_CAPTURE_EGL(CreateStreamProducerD3DTextureANGLE, true, thread, dpyPacked,
1072                           streamPacked, attrib_listPacked, returnValue);
1073     }
1074     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1075     return returnValue;
1076 }
1077 
EGL_StreamPostD3DTextureANGLE(EGLDisplay dpy,EGLStreamKHR stream,void * texture,const EGLAttrib * attrib_list)1078 EGLBoolean EGLAPIENTRY EGL_StreamPostD3DTextureANGLE(EGLDisplay dpy,
1079                                                      EGLStreamKHR stream,
1080                                                      void *texture,
1081                                                      const EGLAttrib *attrib_list)
1082 {
1083 
1084     Thread *thread = egl::GetCurrentThread();
1085     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1086     EGLBoolean returnValue;
1087     {
1088         ANGLE_SCOPED_GLOBAL_LOCK();
1089         EGL_EVENT(StreamPostD3DTextureANGLE,
1090                   "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR ", texture = 0x%016" PRIxPTR
1091                   ", attrib_list = 0x%016" PRIxPTR "",
1092                   (uintptr_t)dpy, (uintptr_t)stream, (uintptr_t)texture, (uintptr_t)attrib_list);
1093 
1094         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
1095         egl::Stream *streamPacked             = PackParam<egl::Stream *>(stream);
1096         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1097 
1098         {
1099             ANGLE_EGL_SCOPED_CONTEXT_LOCK(StreamPostD3DTextureANGLE, thread, dpyPacked);
1100             if (IsEGLValidationEnabled())
1101             {
1102                 ANGLE_EGL_VALIDATE(thread, StreamPostD3DTextureANGLE, GetDisplayIfValid(dpyPacked),
1103                                    EGLBoolean, dpyPacked, streamPacked, texture, attrib_listPacked);
1104             }
1105             else
1106             {
1107                 attrib_listPacked.initializeWithoutValidation();
1108             }
1109 
1110             returnValue = StreamPostD3DTextureANGLE(thread, dpyPacked, streamPacked, texture,
1111                                                     attrib_listPacked);
1112         }
1113 
1114         ANGLE_CAPTURE_EGL(StreamPostD3DTextureANGLE, true, thread, dpyPacked, streamPacked, texture,
1115                           attrib_listPacked, returnValue);
1116     }
1117     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1118     return returnValue;
1119 }
1120 
1121 // EGL_ANGLE_swap_with_frame_token
EGL_SwapBuffersWithFrameTokenANGLE(EGLDisplay dpy,EGLSurface surface,EGLFrameTokenANGLE frametoken)1122 EGLBoolean EGLAPIENTRY EGL_SwapBuffersWithFrameTokenANGLE(EGLDisplay dpy,
1123                                                           EGLSurface surface,
1124                                                           EGLFrameTokenANGLE frametoken)
1125 {
1126     ANGLE_EGLBOOLEAN_TRY(EGL_PrepareSwapBuffersANGLE(dpy, surface));
1127     Thread *thread = egl::GetCurrentThread();
1128     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1129     EGLBoolean returnValue;
1130     {
1131         ANGLE_SCOPED_GLOBAL_LOCK();
1132         EGL_EVENT(SwapBuffersWithFrameTokenANGLE,
1133                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", frametoken = 0x%llX",
1134                   (uintptr_t)dpy, (uintptr_t)surface, static_cast<unsigned long long>(frametoken));
1135 
1136         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1137         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
1138 
1139         {
1140             ANGLE_EGL_SCOPED_CONTEXT_LOCK(SwapBuffersWithFrameTokenANGLE, thread, dpyPacked);
1141             if (IsEGLValidationEnabled())
1142             {
1143                 ANGLE_EGL_VALIDATE(thread, SwapBuffersWithFrameTokenANGLE,
1144                                    GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
1145                                    surfacePacked, frametoken);
1146             }
1147             else
1148             {
1149             }
1150 
1151             returnValue =
1152                 SwapBuffersWithFrameTokenANGLE(thread, dpyPacked, surfacePacked, frametoken);
1153         }
1154 
1155         ANGLE_CAPTURE_EGL(SwapBuffersWithFrameTokenANGLE, true, thread, dpyPacked, surfacePacked,
1156                           frametoken, returnValue);
1157     }
1158     egl::Display::GetCurrentThreadUnlockedTailCall()->run(nullptr);
1159     return returnValue;
1160 }
1161 
1162 // EGL_ANGLE_sync_control_rate
EGL_GetMscRateANGLE(EGLDisplay dpy,EGLSurface surface,EGLint * numerator,EGLint * denominator)1163 EGLBoolean EGLAPIENTRY EGL_GetMscRateANGLE(EGLDisplay dpy,
1164                                            EGLSurface surface,
1165                                            EGLint *numerator,
1166                                            EGLint *denominator)
1167 {
1168 
1169     Thread *thread = egl::GetCurrentThread();
1170     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1171     EGLBoolean returnValue;
1172     {
1173         ANGLE_SCOPED_GLOBAL_LOCK();
1174         EGL_EVENT(GetMscRateANGLE,
1175                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", numerator = 0x%016" PRIxPTR
1176                   ", denominator = 0x%016" PRIxPTR "",
1177                   (uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)numerator, (uintptr_t)denominator);
1178 
1179         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1180         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
1181 
1182         {
1183             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetMscRateANGLE, thread, dpyPacked);
1184             if (IsEGLValidationEnabled())
1185             {
1186                 ANGLE_EGL_VALIDATE(thread, GetMscRateANGLE, GetDisplayIfValid(dpyPacked),
1187                                    EGLBoolean, dpyPacked, surfacePacked, numerator, denominator);
1188             }
1189             else
1190             {
1191             }
1192 
1193             returnValue = GetMscRateANGLE(thread, dpyPacked, surfacePacked, numerator, denominator);
1194         }
1195 
1196         ANGLE_CAPTURE_EGL(GetMscRateANGLE, true, thread, dpyPacked, surfacePacked, numerator,
1197                           denominator, returnValue);
1198     }
1199     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1200     return returnValue;
1201 }
1202 
1203 // EGL_ANGLE_vulkan_image
EGL_ExportVkImageANGLE(EGLDisplay dpy,EGLImage image,void * vk_image,void * vk_image_create_info)1204 EGLBoolean EGLAPIENTRY EGL_ExportVkImageANGLE(EGLDisplay dpy,
1205                                               EGLImage image,
1206                                               void *vk_image,
1207                                               void *vk_image_create_info)
1208 {
1209 
1210     Thread *thread = egl::GetCurrentThread();
1211     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1212     EGLBoolean returnValue;
1213     {
1214         ANGLE_SCOPED_GLOBAL_LOCK();
1215         EGL_EVENT(ExportVkImageANGLE,
1216                   "dpy = 0x%016" PRIxPTR ", image = 0x%016" PRIxPTR ", vk_image = 0x%016" PRIxPTR
1217                   ", vk_image_create_info = 0x%016" PRIxPTR "",
1218                   (uintptr_t)dpy, (uintptr_t)image, (uintptr_t)vk_image,
1219                   (uintptr_t)vk_image_create_info);
1220 
1221         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1222         ImageID imagePacked     = PackParam<ImageID>(image);
1223 
1224         {
1225             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ExportVkImageANGLE, thread, dpyPacked);
1226             if (IsEGLValidationEnabled())
1227             {
1228                 ANGLE_EGL_VALIDATE(thread, ExportVkImageANGLE, GetDisplayIfValid(dpyPacked),
1229                                    EGLBoolean, dpyPacked, imagePacked, vk_image,
1230                                    vk_image_create_info);
1231             }
1232             else
1233             {
1234             }
1235 
1236             returnValue =
1237                 ExportVkImageANGLE(thread, dpyPacked, imagePacked, vk_image, vk_image_create_info);
1238         }
1239 
1240         ANGLE_CAPTURE_EGL(ExportVkImageANGLE, true, thread, dpyPacked, imagePacked, vk_image,
1241                           vk_image_create_info, returnValue);
1242     }
1243     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1244     return returnValue;
1245 }
1246 
1247 // EGL_ANGLE_wait_until_work_scheduled
EGL_WaitUntilWorkScheduledANGLE(EGLDisplay dpy)1248 void EGLAPIENTRY EGL_WaitUntilWorkScheduledANGLE(EGLDisplay dpy)
1249 {
1250 
1251     Thread *thread = egl::GetCurrentThread();
1252     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1253     {
1254         ANGLE_SCOPED_GLOBAL_LOCK();
1255         EGL_EVENT(WaitUntilWorkScheduledANGLE, "dpy = 0x%016" PRIxPTR "", (uintptr_t)dpy);
1256 
1257         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1258 
1259         {
1260             ANGLE_EGL_SCOPED_CONTEXT_LOCK(WaitUntilWorkScheduledANGLE, thread, dpyPacked);
1261             if (IsEGLValidationEnabled())
1262             {
1263                 ANGLE_EGL_VALIDATE_VOID(thread, WaitUntilWorkScheduledANGLE,
1264                                         GetDisplayIfValid(dpyPacked), dpyPacked);
1265             }
1266             else
1267             {
1268             }
1269 
1270             WaitUntilWorkScheduledANGLE(thread, dpyPacked);
1271         }
1272 
1273         ANGLE_CAPTURE_EGL(WaitUntilWorkScheduledANGLE, true, thread, dpyPacked);
1274     }
1275     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1276 }
1277 
1278 // EGL_CHROMIUM_sync_control
EGL_GetSyncValuesCHROMIUM(EGLDisplay dpy,EGLSurface surface,EGLuint64KHR * ust,EGLuint64KHR * msc,EGLuint64KHR * sbc)1279 EGLBoolean EGLAPIENTRY EGL_GetSyncValuesCHROMIUM(EGLDisplay dpy,
1280                                                  EGLSurface surface,
1281                                                  EGLuint64KHR *ust,
1282                                                  EGLuint64KHR *msc,
1283                                                  EGLuint64KHR *sbc)
1284 {
1285 
1286     Thread *thread = egl::GetCurrentThread();
1287     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1288     EGLBoolean returnValue;
1289     {
1290         ANGLE_SCOPED_GLOBAL_LOCK();
1291         EGL_EVENT(GetSyncValuesCHROMIUM,
1292                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", ust = 0x%016" PRIxPTR
1293                   ", msc = 0x%016" PRIxPTR ", sbc = 0x%016" PRIxPTR "",
1294                   (uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)ust, (uintptr_t)msc,
1295                   (uintptr_t)sbc);
1296 
1297         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1298         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
1299 
1300         {
1301             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetSyncValuesCHROMIUM, thread, dpyPacked);
1302             if (IsEGLValidationEnabled())
1303             {
1304                 ANGLE_EGL_VALIDATE(thread, GetSyncValuesCHROMIUM, GetDisplayIfValid(dpyPacked),
1305                                    EGLBoolean, dpyPacked, surfacePacked, ust, msc, sbc);
1306             }
1307             else
1308             {
1309             }
1310 
1311             returnValue = GetSyncValuesCHROMIUM(thread, dpyPacked, surfacePacked, ust, msc, sbc);
1312         }
1313 
1314         ANGLE_CAPTURE_EGL(GetSyncValuesCHROMIUM, true, thread, dpyPacked, surfacePacked, ust, msc,
1315                           sbc, returnValue);
1316     }
1317     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1318     return returnValue;
1319 }
1320 
1321 // EGL_EXT_device_query
EGL_QueryDeviceAttribEXT(EGLDeviceEXT device,EGLint attribute,EGLAttrib * value)1322 EGLBoolean EGLAPIENTRY EGL_QueryDeviceAttribEXT(EGLDeviceEXT device,
1323                                                 EGLint attribute,
1324                                                 EGLAttrib *value)
1325 {
1326 
1327     Thread *thread = egl::GetCurrentThread();
1328     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1329     EGLBoolean returnValue;
1330     {
1331         ANGLE_SCOPED_GLOBAL_LOCK();
1332         EGL_EVENT(QueryDeviceAttribEXT,
1333                   "device = 0x%016" PRIxPTR ", attribute = %d, value = 0x%016" PRIxPTR "",
1334                   (uintptr_t)device, attribute, (uintptr_t)value);
1335 
1336         egl::Device *devicePacked = PackParam<egl::Device *>(device);
1337 
1338         {
1339             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryDeviceAttribEXT, thread, attribute);
1340             if (IsEGLValidationEnabled())
1341             {
1342                 ANGLE_EGL_VALIDATE(thread, QueryDeviceAttribEXT, nullptr, EGLBoolean, devicePacked,
1343                                    attribute, value);
1344             }
1345             else
1346             {
1347             }
1348 
1349             returnValue = QueryDeviceAttribEXT(thread, devicePacked, attribute, value);
1350         }
1351 
1352         ANGLE_CAPTURE_EGL(QueryDeviceAttribEXT, true, thread, devicePacked, attribute, value,
1353                           returnValue);
1354     }
1355     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1356     return returnValue;
1357 }
1358 
EGL_QueryDeviceStringEXT(EGLDeviceEXT device,EGLint name)1359 const char *EGLAPIENTRY EGL_QueryDeviceStringEXT(EGLDeviceEXT device, EGLint name)
1360 {
1361 
1362     Thread *thread = egl::GetCurrentThread();
1363     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1364     const char *returnValue;
1365     {
1366         ANGLE_SCOPED_GLOBAL_LOCK();
1367         EGL_EVENT(QueryDeviceStringEXT, "device = 0x%016" PRIxPTR ", name = %d", (uintptr_t)device,
1368                   name);
1369 
1370         egl::Device *devicePacked = PackParam<egl::Device *>(device);
1371 
1372         {
1373             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryDeviceStringEXT, thread);
1374             if (IsEGLValidationEnabled())
1375             {
1376                 ANGLE_EGL_VALIDATE(thread, QueryDeviceStringEXT, nullptr, const char *,
1377                                    devicePacked, name);
1378             }
1379             else
1380             {
1381             }
1382 
1383             returnValue = QueryDeviceStringEXT(thread, devicePacked, name);
1384         }
1385 
1386         ANGLE_CAPTURE_EGL(QueryDeviceStringEXT, true, thread, devicePacked, name, returnValue);
1387     }
1388     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1389     return returnValue;
1390 }
1391 
EGL_QueryDisplayAttribEXT(EGLDisplay dpy,EGLint attribute,EGLAttrib * value)1392 EGLBoolean EGLAPIENTRY EGL_QueryDisplayAttribEXT(EGLDisplay dpy, EGLint attribute, EGLAttrib *value)
1393 {
1394 
1395     Thread *thread = egl::GetCurrentThread();
1396     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1397     EGLBoolean returnValue;
1398     {
1399         ANGLE_SCOPED_GLOBAL_LOCK();
1400         EGL_EVENT(QueryDisplayAttribEXT,
1401                   "dpy = 0x%016" PRIxPTR ", attribute = %d, value = 0x%016" PRIxPTR "",
1402                   (uintptr_t)dpy, attribute, (uintptr_t)value);
1403 
1404         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1405 
1406         {
1407             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryDisplayAttribEXT, thread, dpyPacked, attribute);
1408             if (IsEGLValidationEnabled())
1409             {
1410                 ANGLE_EGL_VALIDATE(thread, QueryDisplayAttribEXT, GetDisplayIfValid(dpyPacked),
1411                                    EGLBoolean, dpyPacked, attribute, value);
1412             }
1413             else
1414             {
1415             }
1416 
1417             returnValue = QueryDisplayAttribEXT(thread, dpyPacked, attribute, value);
1418         }
1419 
1420         ANGLE_CAPTURE_EGL(QueryDisplayAttribEXT, true, thread, dpyPacked, attribute, value,
1421                           returnValue);
1422     }
1423     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1424     return returnValue;
1425 }
1426 
1427 // EGL_EXT_image_dma_buf_import_modifiers
EGL_QueryDmaBufFormatsEXT(EGLDisplay dpy,EGLint max_formats,EGLint * formats,EGLint * num_formats)1428 EGLBoolean EGLAPIENTRY EGL_QueryDmaBufFormatsEXT(EGLDisplay dpy,
1429                                                  EGLint max_formats,
1430                                                  EGLint *formats,
1431                                                  EGLint *num_formats)
1432 {
1433 
1434     Thread *thread = egl::GetCurrentThread();
1435     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1436     EGLBoolean returnValue;
1437     {
1438         ANGLE_SCOPED_GLOBAL_LOCK();
1439         EGL_EVENT(QueryDmaBufFormatsEXT,
1440                   "dpy = 0x%016" PRIxPTR ", max_formats = %d, formats = 0x%016" PRIxPTR
1441                   ", num_formats = 0x%016" PRIxPTR "",
1442                   (uintptr_t)dpy, max_formats, (uintptr_t)formats, (uintptr_t)num_formats);
1443 
1444         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1445 
1446         {
1447             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryDmaBufFormatsEXT, thread, dpyPacked);
1448             if (IsEGLValidationEnabled())
1449             {
1450                 ANGLE_EGL_VALIDATE(thread, QueryDmaBufFormatsEXT, GetDisplayIfValid(dpyPacked),
1451                                    EGLBoolean, dpyPacked, max_formats, formats, num_formats);
1452             }
1453             else
1454             {
1455             }
1456 
1457             returnValue =
1458                 QueryDmaBufFormatsEXT(thread, dpyPacked, max_formats, formats, num_formats);
1459         }
1460 
1461         ANGLE_CAPTURE_EGL(QueryDmaBufFormatsEXT, true, thread, dpyPacked, max_formats, formats,
1462                           num_formats, returnValue);
1463     }
1464     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1465     return returnValue;
1466 }
1467 
EGL_QueryDmaBufModifiersEXT(EGLDisplay dpy,EGLint format,EGLint max_modifiers,EGLuint64KHR * modifiers,EGLBoolean * external_only,EGLint * num_modifiers)1468 EGLBoolean EGLAPIENTRY EGL_QueryDmaBufModifiersEXT(EGLDisplay dpy,
1469                                                    EGLint format,
1470                                                    EGLint max_modifiers,
1471                                                    EGLuint64KHR *modifiers,
1472                                                    EGLBoolean *external_only,
1473                                                    EGLint *num_modifiers)
1474 {
1475 
1476     Thread *thread = egl::GetCurrentThread();
1477     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1478     EGLBoolean returnValue;
1479     {
1480         ANGLE_SCOPED_GLOBAL_LOCK();
1481         EGL_EVENT(QueryDmaBufModifiersEXT,
1482                   "dpy = 0x%016" PRIxPTR
1483                   ", format = %d, max_modifiers = %d, modifiers = 0x%016" PRIxPTR
1484                   ", external_only = 0x%016" PRIxPTR ", num_modifiers = 0x%016" PRIxPTR "",
1485                   (uintptr_t)dpy, format, max_modifiers, (uintptr_t)modifiers,
1486                   (uintptr_t)external_only, (uintptr_t)num_modifiers);
1487 
1488         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1489 
1490         {
1491             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryDmaBufModifiersEXT, thread, dpyPacked);
1492             if (IsEGLValidationEnabled())
1493             {
1494                 ANGLE_EGL_VALIDATE(thread, QueryDmaBufModifiersEXT, GetDisplayIfValid(dpyPacked),
1495                                    EGLBoolean, dpyPacked, format, max_modifiers, modifiers,
1496                                    external_only, num_modifiers);
1497             }
1498             else
1499             {
1500             }
1501 
1502             returnValue = QueryDmaBufModifiersEXT(thread, dpyPacked, format, max_modifiers,
1503                                                   modifiers, external_only, num_modifiers);
1504         }
1505 
1506         ANGLE_CAPTURE_EGL(QueryDmaBufModifiersEXT, true, thread, dpyPacked, format, max_modifiers,
1507                           modifiers, external_only, num_modifiers, returnValue);
1508     }
1509     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1510     return returnValue;
1511 }
1512 
1513 // EGL_EXT_platform_base
EGL_CreatePlatformPixmapSurfaceEXT(EGLDisplay dpy,EGLConfig config,void * native_pixmap,const EGLint * attrib_list)1514 EGLSurface EGLAPIENTRY EGL_CreatePlatformPixmapSurfaceEXT(EGLDisplay dpy,
1515                                                           EGLConfig config,
1516                                                           void *native_pixmap,
1517                                                           const EGLint *attrib_list)
1518 {
1519 
1520     Thread *thread = egl::GetCurrentThread();
1521     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1522     EGLSurface returnValue;
1523     {
1524         ANGLE_SCOPED_GLOBAL_LOCK();
1525         EGL_EVENT(CreatePlatformPixmapSurfaceEXT,
1526                   "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR
1527                   ", native_pixmap = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
1528                   (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_pixmap,
1529                   (uintptr_t)attrib_list);
1530 
1531         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
1532         egl::Config *configPacked             = PackParam<egl::Config *>(config);
1533         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1534 
1535         {
1536             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreatePlatformPixmapSurfaceEXT, thread, dpyPacked);
1537             if (IsEGLValidationEnabled())
1538             {
1539                 ANGLE_EGL_VALIDATE(thread, CreatePlatformPixmapSurfaceEXT,
1540                                    GetDisplayIfValid(dpyPacked), EGLSurface, dpyPacked,
1541                                    configPacked, native_pixmap, attrib_listPacked);
1542             }
1543             else
1544             {
1545                 attrib_listPacked.initializeWithoutValidation();
1546             }
1547 
1548             returnValue = CreatePlatformPixmapSurfaceEXT(thread, dpyPacked, configPacked,
1549                                                          native_pixmap, attrib_listPacked);
1550         }
1551 
1552         ANGLE_CAPTURE_EGL(CreatePlatformPixmapSurfaceEXT, true, thread, dpyPacked, configPacked,
1553                           native_pixmap, attrib_listPacked, returnValue);
1554     }
1555     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1556     return returnValue;
1557 }
1558 
EGL_CreatePlatformWindowSurfaceEXT(EGLDisplay dpy,EGLConfig config,void * native_window,const EGLint * attrib_list)1559 EGLSurface EGLAPIENTRY EGL_CreatePlatformWindowSurfaceEXT(EGLDisplay dpy,
1560                                                           EGLConfig config,
1561                                                           void *native_window,
1562                                                           const EGLint *attrib_list)
1563 {
1564 
1565     Thread *thread = egl::GetCurrentThread();
1566     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1567     EGLSurface returnValue;
1568     {
1569         ANGLE_SCOPED_GLOBAL_LOCK();
1570         EGL_EVENT(CreatePlatformWindowSurfaceEXT,
1571                   "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR
1572                   ", native_window = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
1573                   (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_window,
1574                   (uintptr_t)attrib_list);
1575 
1576         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
1577         egl::Config *configPacked             = PackParam<egl::Config *>(config);
1578         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1579 
1580         {
1581             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreatePlatformWindowSurfaceEXT, thread, dpyPacked);
1582             if (IsEGLValidationEnabled())
1583             {
1584                 ANGLE_EGL_VALIDATE(thread, CreatePlatformWindowSurfaceEXT,
1585                                    GetDisplayIfValid(dpyPacked), EGLSurface, dpyPacked,
1586                                    configPacked, native_window, attrib_listPacked);
1587             }
1588             else
1589             {
1590                 attrib_listPacked.initializeWithoutValidation();
1591             }
1592 
1593             returnValue = CreatePlatformWindowSurfaceEXT(thread, dpyPacked, configPacked,
1594                                                          native_window, attrib_listPacked);
1595         }
1596 
1597         ANGLE_CAPTURE_EGL(CreatePlatformWindowSurfaceEXT, true, thread, dpyPacked, configPacked,
1598                           native_window, attrib_listPacked, returnValue);
1599     }
1600     egl::Display::GetCurrentThreadUnlockedTailCall()->run(nullptr);
1601     return returnValue;
1602 }
1603 
EGL_GetPlatformDisplayEXT(EGLenum platform,void * native_display,const EGLint * attrib_list)1604 EGLDisplay EGLAPIENTRY EGL_GetPlatformDisplayEXT(EGLenum platform,
1605                                                  void *native_display,
1606                                                  const EGLint *attrib_list)
1607 {
1608 
1609     Thread *thread = egl::GetCurrentThread();
1610     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1611     EGLDisplay returnValue;
1612     {
1613         ANGLE_SCOPED_GLOBAL_LOCK();
1614         EGL_EVENT(GetPlatformDisplayEXT,
1615                   "platform = 0x%X, native_display = 0x%016" PRIxPTR
1616                   ", attrib_list = 0x%016" PRIxPTR "",
1617                   platform, (uintptr_t)native_display, (uintptr_t)attrib_list);
1618 
1619         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1620 
1621         {
1622             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetPlatformDisplayEXT, thread);
1623             if (IsEGLValidationEnabled())
1624             {
1625                 ANGLE_EGL_VALIDATE(thread, GetPlatformDisplayEXT, nullptr, EGLDisplay, platform,
1626                                    native_display, attrib_listPacked);
1627             }
1628             else
1629             {
1630                 attrib_listPacked.initializeWithoutValidation();
1631             }
1632 
1633             returnValue =
1634                 GetPlatformDisplayEXT(thread, platform, native_display, attrib_listPacked);
1635         }
1636 
1637         ANGLE_CAPTURE_EGL(GetPlatformDisplayEXT, true, thread, platform, native_display,
1638                           attrib_listPacked, returnValue);
1639     }
1640     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1641     return returnValue;
1642 }
1643 
1644 // EGL_KHR_debug
EGL_DebugMessageControlKHR(EGLDEBUGPROCKHR callback,const EGLAttrib * attrib_list)1645 EGLint EGLAPIENTRY EGL_DebugMessageControlKHR(EGLDEBUGPROCKHR callback,
1646                                               const EGLAttrib *attrib_list)
1647 {
1648 
1649     Thread *thread = egl::GetCurrentThread();
1650     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1651     EGLint returnValue;
1652     {
1653         ANGLE_SCOPED_GLOBAL_LOCK();
1654         EGL_EVENT(DebugMessageControlKHR,
1655                   "callback = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
1656                   (uintptr_t)callback, (uintptr_t)attrib_list);
1657 
1658         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1659 
1660         {
1661             ANGLE_EGL_SCOPED_CONTEXT_LOCK(DebugMessageControlKHR, thread);
1662             if (IsEGLValidationEnabled())
1663             {
1664                 ANGLE_EGL_VALIDATE(thread, DebugMessageControlKHR, nullptr, EGLint, callback,
1665                                    attrib_listPacked);
1666             }
1667             else
1668             {
1669                 attrib_listPacked.initializeWithoutValidation();
1670             }
1671 
1672             returnValue = DebugMessageControlKHR(thread, callback, attrib_listPacked);
1673         }
1674 
1675         ANGLE_CAPTURE_EGL(DebugMessageControlKHR, true, thread, callback, attrib_listPacked,
1676                           returnValue);
1677     }
1678     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1679     return returnValue;
1680 }
1681 
EGL_LabelObjectKHR(EGLDisplay display,EGLenum objectType,EGLObjectKHR object,EGLLabelKHR label)1682 EGLint EGLAPIENTRY EGL_LabelObjectKHR(EGLDisplay display,
1683                                       EGLenum objectType,
1684                                       EGLObjectKHR object,
1685                                       EGLLabelKHR label)
1686 {
1687 
1688     Thread *thread = egl::GetCurrentThread();
1689     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1690     EGLint returnValue;
1691     {
1692         ANGLE_SCOPED_GLOBAL_EGL_AND_EGL_SYNC_LOCK();
1693         EGL_EVENT(LabelObjectKHR,
1694                   "display = 0x%016" PRIxPTR ", objectType = 0x%X, object = 0x%016" PRIxPTR
1695                   ", label = 0x%016" PRIxPTR "",
1696                   (uintptr_t)display, objectType, (uintptr_t)object, (uintptr_t)label);
1697 
1698         egl::Display *displayPacked = PackParam<egl::Display *>(display);
1699         ObjectType objectTypePacked = PackParam<ObjectType>(objectType);
1700 
1701         {
1702             ANGLE_EGL_SCOPED_CONTEXT_LOCK(LabelObjectKHR, thread, displayPacked);
1703             if (IsEGLValidationEnabled())
1704             {
1705                 ANGLE_EGL_VALIDATE(thread, LabelObjectKHR, GetDisplayIfValid(displayPacked), EGLint,
1706                                    displayPacked, objectTypePacked, object, label);
1707             }
1708             else
1709             {
1710             }
1711 
1712             returnValue = LabelObjectKHR(thread, displayPacked, objectTypePacked, object, label);
1713         }
1714 
1715         ANGLE_CAPTURE_EGL(LabelObjectKHR, true, thread, displayPacked, objectTypePacked, object,
1716                           label, returnValue);
1717     }
1718     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1719     return returnValue;
1720 }
1721 
EGL_QueryDebugKHR(EGLint attribute,EGLAttrib * value)1722 EGLBoolean EGLAPIENTRY EGL_QueryDebugKHR(EGLint attribute, EGLAttrib *value)
1723 {
1724 
1725     Thread *thread = egl::GetCurrentThread();
1726     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1727     EGLBoolean returnValue;
1728     {
1729         ANGLE_SCOPED_GLOBAL_LOCK();
1730         EGL_EVENT(QueryDebugKHR, "attribute = %d, value = 0x%016" PRIxPTR "", attribute,
1731                   (uintptr_t)value);
1732 
1733         {
1734             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryDebugKHR, thread, attribute);
1735             if (IsEGLValidationEnabled())
1736             {
1737                 ANGLE_EGL_VALIDATE(thread, QueryDebugKHR, nullptr, EGLBoolean, attribute, value);
1738             }
1739             else
1740             {
1741             }
1742 
1743             returnValue = QueryDebugKHR(thread, attribute, value);
1744         }
1745 
1746         ANGLE_CAPTURE_EGL(QueryDebugKHR, true, thread, attribute, value, returnValue);
1747     }
1748     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1749     return returnValue;
1750 }
1751 
1752 // EGL_KHR_fence_sync
EGL_ClientWaitSyncKHR(EGLDisplay dpy,EGLSyncKHR sync,EGLint flags,EGLTimeKHR timeout)1753 EGLint EGLAPIENTRY EGL_ClientWaitSyncKHR(EGLDisplay dpy,
1754                                          EGLSyncKHR sync,
1755                                          EGLint flags,
1756                                          EGLTimeKHR timeout)
1757 {
1758 
1759     Thread *thread = egl::GetCurrentThread();
1760     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1761     EGLint returnValue;
1762     {
1763         ANGLE_SCOPED_GLOBAL_EGL_SYNC_LOCK();
1764         EGL_EVENT(ClientWaitSyncKHR,
1765                   "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR ", flags = %d, timeout = %llu",
1766                   (uintptr_t)dpy, (uintptr_t)sync, flags, static_cast<unsigned long long>(timeout));
1767 
1768         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1769         egl::SyncID syncPacked  = PackParam<egl::SyncID>(sync);
1770 
1771         {
1772             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ClientWaitSyncKHR, thread, dpyPacked, flags);
1773             if (IsEGLValidationEnabled())
1774             {
1775                 ANGLE_EGL_VALIDATE(thread, ClientWaitSyncKHR, GetDisplayIfValid(dpyPacked), EGLint,
1776                                    dpyPacked, syncPacked, flags, timeout);
1777             }
1778             else
1779             {
1780             }
1781 
1782             returnValue = ClientWaitSyncKHR(thread, dpyPacked, syncPacked, flags, timeout);
1783         }
1784 
1785         ANGLE_CAPTURE_EGL(ClientWaitSyncKHR, true, thread, dpyPacked, syncPacked, flags, timeout,
1786                           returnValue);
1787     }
1788     egl::Display::GetCurrentThreadUnlockedTailCall()->run(&returnValue);
1789     return returnValue;
1790 }
1791 
EGL_CreateSyncKHR(EGLDisplay dpy,EGLenum type,const EGLint * attrib_list)1792 EGLSyncKHR EGLAPIENTRY EGL_CreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
1793 {
1794 
1795     Thread *thread = egl::GetCurrentThread();
1796     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1797     EGLSyncKHR returnValue;
1798     {
1799         ANGLE_SCOPED_GLOBAL_EGL_SYNC_LOCK();
1800         EGL_EVENT(CreateSyncKHR,
1801                   "dpy = 0x%016" PRIxPTR ", type = 0x%X, attrib_list = 0x%016" PRIxPTR "",
1802                   (uintptr_t)dpy, type, (uintptr_t)attrib_list);
1803 
1804         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
1805         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1806 
1807         {
1808             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreateSyncKHR, thread, dpyPacked);
1809             if (IsEGLValidationEnabled())
1810             {
1811                 ANGLE_EGL_VALIDATE(thread, CreateSyncKHR, GetDisplayIfValid(dpyPacked), EGLSyncKHR,
1812                                    dpyPacked, type, attrib_listPacked);
1813             }
1814             else
1815             {
1816                 attrib_listPacked.initializeWithoutValidation();
1817             }
1818 
1819             returnValue = CreateSyncKHR(thread, dpyPacked, type, attrib_listPacked);
1820         }
1821 
1822         ANGLE_CAPTURE_EGL(CreateSyncKHR, true, thread, dpyPacked, type, attrib_listPacked,
1823                           returnValue);
1824     }
1825     egl::Display::GetCurrentThreadUnlockedTailCall()->run(&returnValue);
1826     return returnValue;
1827 }
1828 
EGL_DestroySyncKHR(EGLDisplay dpy,EGLSyncKHR sync)1829 EGLBoolean EGLAPIENTRY EGL_DestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
1830 {
1831 
1832     Thread *thread = egl::GetCurrentThread();
1833     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1834     EGLBoolean returnValue;
1835     {
1836         ANGLE_SCOPED_GLOBAL_EGL_SYNC_LOCK();
1837         EGL_EVENT(DestroySyncKHR, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR "",
1838                   (uintptr_t)dpy, (uintptr_t)sync);
1839 
1840         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1841         egl::SyncID syncPacked  = PackParam<egl::SyncID>(sync);
1842 
1843         {
1844             ANGLE_EGL_SCOPED_CONTEXT_LOCK(DestroySyncKHR, thread, dpyPacked);
1845             if (IsEGLValidationEnabled())
1846             {
1847                 ANGLE_EGL_VALIDATE(thread, DestroySyncKHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
1848                                    dpyPacked, syncPacked);
1849             }
1850             else
1851             {
1852             }
1853 
1854             returnValue = DestroySyncKHR(thread, dpyPacked, syncPacked);
1855         }
1856 
1857         ANGLE_CAPTURE_EGL(DestroySyncKHR, true, thread, dpyPacked, syncPacked, returnValue);
1858     }
1859     egl::Display::GetCurrentThreadUnlockedTailCall()->run(&returnValue);
1860     return returnValue;
1861 }
1862 
EGL_GetSyncAttribKHR(EGLDisplay dpy,EGLSyncKHR sync,EGLint attribute,EGLint * value)1863 EGLBoolean EGLAPIENTRY EGL_GetSyncAttribKHR(EGLDisplay dpy,
1864                                             EGLSyncKHR sync,
1865                                             EGLint attribute,
1866                                             EGLint *value)
1867 {
1868 
1869     Thread *thread = egl::GetCurrentThread();
1870     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1871     EGLBoolean returnValue;
1872     {
1873         ANGLE_SCOPED_GLOBAL_EGL_SYNC_LOCK();
1874         EGL_EVENT(GetSyncAttribKHR,
1875                   "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR
1876                   ", attribute = %d, value = 0x%016" PRIxPTR "",
1877                   (uintptr_t)dpy, (uintptr_t)sync, attribute, (uintptr_t)value);
1878 
1879         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1880         egl::SyncID syncPacked  = PackParam<egl::SyncID>(sync);
1881 
1882         {
1883             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetSyncAttribKHR, thread, dpyPacked, attribute);
1884             if (IsEGLValidationEnabled())
1885             {
1886                 ANGLE_EGL_VALIDATE(thread, GetSyncAttribKHR, GetDisplayIfValid(dpyPacked),
1887                                    EGLBoolean, dpyPacked, syncPacked, attribute, value);
1888             }
1889             else
1890             {
1891             }
1892 
1893             returnValue = GetSyncAttribKHR(thread, dpyPacked, syncPacked, attribute, value);
1894         }
1895 
1896         ANGLE_CAPTURE_EGL(GetSyncAttribKHR, true, thread, dpyPacked, syncPacked, attribute, value,
1897                           returnValue);
1898     }
1899     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1900     return returnValue;
1901 }
1902 
1903 // EGL_KHR_image
EGL_CreateImageKHR(EGLDisplay dpy,EGLContext ctx,EGLenum target,EGLClientBuffer buffer,const EGLint * attrib_list)1904 EGLImageKHR EGLAPIENTRY EGL_CreateImageKHR(EGLDisplay dpy,
1905                                            EGLContext ctx,
1906                                            EGLenum target,
1907                                            EGLClientBuffer buffer,
1908                                            const EGLint *attrib_list)
1909 {
1910 
1911     Thread *thread = egl::GetCurrentThread();
1912     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1913     EGLImageKHR returnValue;
1914     {
1915         ANGLE_SCOPED_GLOBAL_LOCK();
1916         EGL_EVENT(CreateImageKHR,
1917                   "dpy = 0x%016" PRIxPTR ", ctx = 0x%016" PRIxPTR
1918                   ", target = 0x%X, buffer = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
1919                   (uintptr_t)dpy, (uintptr_t)ctx, target, (uintptr_t)buffer,
1920                   (uintptr_t)attrib_list);
1921 
1922         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
1923         gl::ContextID ctxPacked               = PackParam<gl::ContextID>(ctx);
1924         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1925 
1926         {
1927             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreateImageKHR, thread, dpyPacked, ctxPacked);
1928             if (IsEGLValidationEnabled())
1929             {
1930                 ANGLE_EGL_VALIDATE(thread, CreateImageKHR, GetDisplayIfValid(dpyPacked),
1931                                    EGLImageKHR, dpyPacked, ctxPacked, target, buffer,
1932                                    attrib_listPacked);
1933             }
1934             else
1935             {
1936                 attrib_listPacked.initializeWithoutValidation();
1937             }
1938 
1939             returnValue =
1940                 CreateImageKHR(thread, dpyPacked, ctxPacked, target, buffer, attrib_listPacked);
1941         }
1942 
1943         ANGLE_CAPTURE_EGL(CreateImageKHR, true, thread, dpyPacked, ctxPacked, target, buffer,
1944                           attrib_listPacked, returnValue);
1945     }
1946     egl::Display::GetCurrentThreadUnlockedTailCall()->run(&returnValue);
1947     return returnValue;
1948 }
1949 
EGL_DestroyImageKHR(EGLDisplay dpy,EGLImageKHR image)1950 EGLBoolean EGLAPIENTRY EGL_DestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
1951 {
1952 
1953     Thread *thread = egl::GetCurrentThread();
1954     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1955     EGLBoolean returnValue;
1956     {
1957         ANGLE_SCOPED_GLOBAL_LOCK();
1958         EGL_EVENT(DestroyImageKHR, "dpy = 0x%016" PRIxPTR ", image = 0x%016" PRIxPTR "",
1959                   (uintptr_t)dpy, (uintptr_t)image);
1960 
1961         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1962         ImageID imagePacked     = PackParam<ImageID>(image);
1963 
1964         {
1965             ANGLE_EGL_SCOPED_CONTEXT_LOCK(DestroyImageKHR, thread, dpyPacked);
1966             if (IsEGLValidationEnabled())
1967             {
1968                 ANGLE_EGL_VALIDATE(thread, DestroyImageKHR, GetDisplayIfValid(dpyPacked),
1969                                    EGLBoolean, dpyPacked, imagePacked);
1970             }
1971             else
1972             {
1973             }
1974 
1975             returnValue = DestroyImageKHR(thread, dpyPacked, imagePacked);
1976         }
1977 
1978         ANGLE_CAPTURE_EGL(DestroyImageKHR, true, thread, dpyPacked, imagePacked, returnValue);
1979     }
1980     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1981     return returnValue;
1982 }
1983 
1984 // EGL_KHR_lock_surface3
EGL_LockSurfaceKHR(EGLDisplay dpy,EGLSurface surface,const EGLint * attrib_list)1985 EGLBoolean EGLAPIENTRY EGL_LockSurfaceKHR(EGLDisplay dpy,
1986                                           EGLSurface surface,
1987                                           const EGLint *attrib_list)
1988 {
1989 
1990     Thread *thread = egl::GetCurrentThread();
1991     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1992     EGLBoolean returnValue;
1993     {
1994         ANGLE_SCOPED_GLOBAL_LOCK();
1995         EGL_EVENT(LockSurfaceKHR,
1996                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR
1997                   ", attrib_list = 0x%016" PRIxPTR "",
1998                   (uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)attrib_list);
1999 
2000         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
2001         SurfaceID surfacePacked               = PackParam<SurfaceID>(surface);
2002         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
2003 
2004         {
2005             ANGLE_EGL_SCOPED_CONTEXT_LOCK(LockSurfaceKHR, thread, dpyPacked);
2006             if (IsEGLValidationEnabled())
2007             {
2008                 ANGLE_EGL_VALIDATE(thread, LockSurfaceKHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
2009                                    dpyPacked, surfacePacked, attrib_listPacked);
2010             }
2011             else
2012             {
2013                 attrib_listPacked.initializeWithoutValidation();
2014             }
2015 
2016             returnValue = LockSurfaceKHR(thread, dpyPacked, surfacePacked, attrib_listPacked);
2017         }
2018 
2019         ANGLE_CAPTURE_EGL(LockSurfaceKHR, true, thread, dpyPacked, surfacePacked, attrib_listPacked,
2020                           returnValue);
2021     }
2022     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2023     return returnValue;
2024 }
2025 
EGL_QuerySurface64KHR(EGLDisplay dpy,EGLSurface surface,EGLint attribute,EGLAttribKHR * value)2026 EGLBoolean EGLAPIENTRY EGL_QuerySurface64KHR(EGLDisplay dpy,
2027                                              EGLSurface surface,
2028                                              EGLint attribute,
2029                                              EGLAttribKHR *value)
2030 {
2031     if (attribute == EGL_BUFFER_AGE_EXT)
2032     {
2033         ANGLE_EGLBOOLEAN_TRY(EGL_PrepareSwapBuffersANGLE(dpy, surface));
2034     }
2035     Thread *thread = egl::GetCurrentThread();
2036     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2037     EGLBoolean returnValue;
2038     {
2039         ANGLE_SCOPED_GLOBAL_LOCK();
2040         EGL_EVENT(QuerySurface64KHR,
2041                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR
2042                   ", attribute = %d, value = 0x%016" PRIxPTR "",
2043                   (uintptr_t)dpy, (uintptr_t)surface, attribute, (uintptr_t)value);
2044 
2045         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
2046         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
2047 
2048         {
2049             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QuerySurface64KHR, thread, dpyPacked, attribute);
2050             if (IsEGLValidationEnabled())
2051             {
2052                 ANGLE_EGL_VALIDATE(thread, QuerySurface64KHR, GetDisplayIfValid(dpyPacked),
2053                                    EGLBoolean, dpyPacked, surfacePacked, attribute, value);
2054             }
2055             else
2056             {
2057             }
2058 
2059             returnValue = QuerySurface64KHR(thread, dpyPacked, surfacePacked, attribute, value);
2060         }
2061 
2062         ANGLE_CAPTURE_EGL(QuerySurface64KHR, true, thread, dpyPacked, surfacePacked, attribute,
2063                           value, returnValue);
2064     }
2065     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2066     return returnValue;
2067 }
2068 
EGL_UnlockSurfaceKHR(EGLDisplay dpy,EGLSurface surface)2069 EGLBoolean EGLAPIENTRY EGL_UnlockSurfaceKHR(EGLDisplay dpy, EGLSurface surface)
2070 {
2071 
2072     Thread *thread = egl::GetCurrentThread();
2073     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2074     EGLBoolean returnValue;
2075     {
2076         ANGLE_SCOPED_GLOBAL_LOCK();
2077         EGL_EVENT(UnlockSurfaceKHR, "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR "",
2078                   (uintptr_t)dpy, (uintptr_t)surface);
2079 
2080         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
2081         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
2082 
2083         {
2084             ANGLE_EGL_SCOPED_CONTEXT_LOCK(UnlockSurfaceKHR, thread, dpyPacked);
2085             if (IsEGLValidationEnabled())
2086             {
2087                 ANGLE_EGL_VALIDATE(thread, UnlockSurfaceKHR, GetDisplayIfValid(dpyPacked),
2088                                    EGLBoolean, dpyPacked, surfacePacked);
2089             }
2090             else
2091             {
2092             }
2093 
2094             returnValue = UnlockSurfaceKHR(thread, dpyPacked, surfacePacked);
2095         }
2096 
2097         ANGLE_CAPTURE_EGL(UnlockSurfaceKHR, true, thread, dpyPacked, surfacePacked, returnValue);
2098     }
2099     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2100     return returnValue;
2101 }
2102 
2103 // EGL_KHR_partial_update
EGL_SetDamageRegionKHR(EGLDisplay dpy,EGLSurface surface,EGLint * rects,EGLint n_rects)2104 EGLBoolean EGLAPIENTRY EGL_SetDamageRegionKHR(EGLDisplay dpy,
2105                                               EGLSurface surface,
2106                                               EGLint *rects,
2107                                               EGLint n_rects)
2108 {
2109 
2110     Thread *thread = egl::GetCurrentThread();
2111     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2112     EGLBoolean returnValue;
2113     {
2114         ANGLE_SCOPED_GLOBAL_LOCK();
2115         EGL_EVENT(SetDamageRegionKHR,
2116                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", rects = 0x%016" PRIxPTR
2117                   ", n_rects = %d",
2118                   (uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)rects, n_rects);
2119 
2120         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
2121         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
2122 
2123         {
2124             ANGLE_EGL_SCOPED_CONTEXT_LOCK(SetDamageRegionKHR, thread, dpyPacked);
2125             if (IsEGLValidationEnabled())
2126             {
2127                 ANGLE_EGL_VALIDATE(thread, SetDamageRegionKHR, GetDisplayIfValid(dpyPacked),
2128                                    EGLBoolean, dpyPacked, surfacePacked, rects, n_rects);
2129             }
2130             else
2131             {
2132             }
2133 
2134             returnValue = SetDamageRegionKHR(thread, dpyPacked, surfacePacked, rects, n_rects);
2135         }
2136 
2137         ANGLE_CAPTURE_EGL(SetDamageRegionKHR, true, thread, dpyPacked, surfacePacked, rects,
2138                           n_rects, returnValue);
2139     }
2140     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2141     return returnValue;
2142 }
2143 
2144 // EGL_KHR_reusable_sync
EGL_SignalSyncKHR(EGLDisplay dpy,EGLSyncKHR sync,EGLenum mode)2145 EGLBoolean EGLAPIENTRY EGL_SignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode)
2146 {
2147 
2148     Thread *thread = egl::GetCurrentThread();
2149     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2150     EGLBoolean returnValue;
2151     {
2152         ANGLE_SCOPED_GLOBAL_EGL_SYNC_LOCK();
2153         EGL_EVENT(SignalSyncKHR, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR ", mode = 0x%X",
2154                   (uintptr_t)dpy, (uintptr_t)sync, mode);
2155 
2156         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
2157         egl::SyncID syncPacked  = PackParam<egl::SyncID>(sync);
2158 
2159         {
2160             ANGLE_EGL_SCOPED_CONTEXT_LOCK(SignalSyncKHR, thread, dpyPacked);
2161             if (IsEGLValidationEnabled())
2162             {
2163                 ANGLE_EGL_VALIDATE(thread, SignalSyncKHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
2164                                    dpyPacked, syncPacked, mode);
2165             }
2166             else
2167             {
2168             }
2169 
2170             returnValue = SignalSyncKHR(thread, dpyPacked, syncPacked, mode);
2171         }
2172 
2173         ANGLE_CAPTURE_EGL(SignalSyncKHR, true, thread, dpyPacked, syncPacked, mode, returnValue);
2174     }
2175     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2176     return returnValue;
2177 }
2178 
2179 // ClientWaitSyncKHR is already defined.
2180 
2181 // CreateSyncKHR is already defined.
2182 
2183 // DestroySyncKHR is already defined.
2184 
2185 // GetSyncAttribKHR is already defined.
2186 
2187 // EGL_KHR_stream
EGL_CreateStreamKHR(EGLDisplay dpy,const EGLint * attrib_list)2188 EGLStreamKHR EGLAPIENTRY EGL_CreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list)
2189 {
2190 
2191     Thread *thread = egl::GetCurrentThread();
2192     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2193     EGLStreamKHR returnValue;
2194     {
2195         ANGLE_SCOPED_GLOBAL_LOCK();
2196         EGL_EVENT(CreateStreamKHR, "dpy = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
2197                   (uintptr_t)dpy, (uintptr_t)attrib_list);
2198 
2199         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
2200         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
2201 
2202         {
2203             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreateStreamKHR, thread, dpyPacked);
2204             if (IsEGLValidationEnabled())
2205             {
2206                 ANGLE_EGL_VALIDATE(thread, CreateStreamKHR, GetDisplayIfValid(dpyPacked),
2207                                    EGLStreamKHR, dpyPacked, attrib_listPacked);
2208             }
2209             else
2210             {
2211                 attrib_listPacked.initializeWithoutValidation();
2212             }
2213 
2214             returnValue = CreateStreamKHR(thread, dpyPacked, attrib_listPacked);
2215         }
2216 
2217         ANGLE_CAPTURE_EGL(CreateStreamKHR, true, thread, dpyPacked, attrib_listPacked, returnValue);
2218     }
2219     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2220     return returnValue;
2221 }
2222 
EGL_DestroyStreamKHR(EGLDisplay dpy,EGLStreamKHR stream)2223 EGLBoolean EGLAPIENTRY EGL_DestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream)
2224 {
2225 
2226     Thread *thread = egl::GetCurrentThread();
2227     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2228     EGLBoolean returnValue;
2229     {
2230         ANGLE_SCOPED_GLOBAL_LOCK();
2231         EGL_EVENT(DestroyStreamKHR, "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR "",
2232                   (uintptr_t)dpy, (uintptr_t)stream);
2233 
2234         egl::Display *dpyPacked   = PackParam<egl::Display *>(dpy);
2235         egl::Stream *streamPacked = PackParam<egl::Stream *>(stream);
2236 
2237         {
2238             ANGLE_EGL_SCOPED_CONTEXT_LOCK(DestroyStreamKHR, thread, dpyPacked);
2239             if (IsEGLValidationEnabled())
2240             {
2241                 ANGLE_EGL_VALIDATE(thread, DestroyStreamKHR, GetDisplayIfValid(dpyPacked),
2242                                    EGLBoolean, dpyPacked, streamPacked);
2243             }
2244             else
2245             {
2246             }
2247 
2248             returnValue = DestroyStreamKHR(thread, dpyPacked, streamPacked);
2249         }
2250 
2251         ANGLE_CAPTURE_EGL(DestroyStreamKHR, true, thread, dpyPacked, streamPacked, returnValue);
2252     }
2253     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2254     return returnValue;
2255 }
2256 
EGL_QueryStreamKHR(EGLDisplay dpy,EGLStreamKHR stream,EGLenum attribute,EGLint * value)2257 EGLBoolean EGLAPIENTRY EGL_QueryStreamKHR(EGLDisplay dpy,
2258                                           EGLStreamKHR stream,
2259                                           EGLenum attribute,
2260                                           EGLint *value)
2261 {
2262 
2263     Thread *thread = egl::GetCurrentThread();
2264     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2265     EGLBoolean returnValue;
2266     {
2267         ANGLE_SCOPED_GLOBAL_LOCK();
2268         EGL_EVENT(QueryStreamKHR,
2269                   "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR
2270                   ", attribute = 0x%X, value = 0x%016" PRIxPTR "",
2271                   (uintptr_t)dpy, (uintptr_t)stream, attribute, (uintptr_t)value);
2272 
2273         egl::Display *dpyPacked   = PackParam<egl::Display *>(dpy);
2274         egl::Stream *streamPacked = PackParam<egl::Stream *>(stream);
2275 
2276         {
2277             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryStreamKHR, thread, dpyPacked, attribute);
2278             if (IsEGLValidationEnabled())
2279             {
2280                 ANGLE_EGL_VALIDATE(thread, QueryStreamKHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
2281                                    dpyPacked, streamPacked, attribute, value);
2282             }
2283             else
2284             {
2285             }
2286 
2287             returnValue = QueryStreamKHR(thread, dpyPacked, streamPacked, attribute, value);
2288         }
2289 
2290         ANGLE_CAPTURE_EGL(QueryStreamKHR, true, thread, dpyPacked, streamPacked, attribute, value,
2291                           returnValue);
2292     }
2293     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2294     return returnValue;
2295 }
2296 
EGL_QueryStreamu64KHR(EGLDisplay dpy,EGLStreamKHR stream,EGLenum attribute,EGLuint64KHR * value)2297 EGLBoolean EGLAPIENTRY EGL_QueryStreamu64KHR(EGLDisplay dpy,
2298                                              EGLStreamKHR stream,
2299                                              EGLenum attribute,
2300                                              EGLuint64KHR *value)
2301 {
2302 
2303     Thread *thread = egl::GetCurrentThread();
2304     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2305     EGLBoolean returnValue;
2306     {
2307         ANGLE_SCOPED_GLOBAL_LOCK();
2308         EGL_EVENT(QueryStreamu64KHR,
2309                   "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR
2310                   ", attribute = 0x%X, value = 0x%016" PRIxPTR "",
2311                   (uintptr_t)dpy, (uintptr_t)stream, attribute, (uintptr_t)value);
2312 
2313         egl::Display *dpyPacked   = PackParam<egl::Display *>(dpy);
2314         egl::Stream *streamPacked = PackParam<egl::Stream *>(stream);
2315 
2316         {
2317             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryStreamu64KHR, thread, dpyPacked, attribute);
2318             if (IsEGLValidationEnabled())
2319             {
2320                 ANGLE_EGL_VALIDATE(thread, QueryStreamu64KHR, GetDisplayIfValid(dpyPacked),
2321                                    EGLBoolean, dpyPacked, streamPacked, attribute, value);
2322             }
2323             else
2324             {
2325             }
2326 
2327             returnValue = QueryStreamu64KHR(thread, dpyPacked, streamPacked, attribute, value);
2328         }
2329 
2330         ANGLE_CAPTURE_EGL(QueryStreamu64KHR, true, thread, dpyPacked, streamPacked, attribute,
2331                           value, returnValue);
2332     }
2333     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2334     return returnValue;
2335 }
2336 
EGL_StreamAttribKHR(EGLDisplay dpy,EGLStreamKHR stream,EGLenum attribute,EGLint value)2337 EGLBoolean EGLAPIENTRY EGL_StreamAttribKHR(EGLDisplay dpy,
2338                                            EGLStreamKHR stream,
2339                                            EGLenum attribute,
2340                                            EGLint value)
2341 {
2342 
2343     Thread *thread = egl::GetCurrentThread();
2344     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2345     EGLBoolean returnValue;
2346     {
2347         ANGLE_SCOPED_GLOBAL_LOCK();
2348         EGL_EVENT(StreamAttribKHR,
2349                   "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR
2350                   ", attribute = 0x%X, value = %d",
2351                   (uintptr_t)dpy, (uintptr_t)stream, attribute, value);
2352 
2353         egl::Display *dpyPacked   = PackParam<egl::Display *>(dpy);
2354         egl::Stream *streamPacked = PackParam<egl::Stream *>(stream);
2355 
2356         {
2357             ANGLE_EGL_SCOPED_CONTEXT_LOCK(StreamAttribKHR, thread, dpyPacked, attribute);
2358             if (IsEGLValidationEnabled())
2359             {
2360                 ANGLE_EGL_VALIDATE(thread, StreamAttribKHR, GetDisplayIfValid(dpyPacked),
2361                                    EGLBoolean, dpyPacked, streamPacked, attribute, value);
2362             }
2363             else
2364             {
2365             }
2366 
2367             returnValue = StreamAttribKHR(thread, dpyPacked, streamPacked, attribute, value);
2368         }
2369 
2370         ANGLE_CAPTURE_EGL(StreamAttribKHR, true, thread, dpyPacked, streamPacked, attribute, value,
2371                           returnValue);
2372     }
2373     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2374     return returnValue;
2375 }
2376 
2377 // EGL_KHR_stream_consumer_gltexture
EGL_StreamConsumerAcquireKHR(EGLDisplay dpy,EGLStreamKHR stream)2378 EGLBoolean EGLAPIENTRY EGL_StreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream)
2379 {
2380 
2381     Thread *thread = egl::GetCurrentThread();
2382     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2383     EGLBoolean returnValue;
2384     {
2385         ANGLE_SCOPED_GLOBAL_LOCK();
2386         EGL_EVENT(StreamConsumerAcquireKHR, "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR "",
2387                   (uintptr_t)dpy, (uintptr_t)stream);
2388 
2389         egl::Display *dpyPacked   = PackParam<egl::Display *>(dpy);
2390         egl::Stream *streamPacked = PackParam<egl::Stream *>(stream);
2391 
2392         {
2393             ANGLE_EGL_SCOPED_CONTEXT_LOCK(StreamConsumerAcquireKHR, thread, dpyPacked);
2394             if (IsEGLValidationEnabled())
2395             {
2396                 ANGLE_EGL_VALIDATE(thread, StreamConsumerAcquireKHR, GetDisplayIfValid(dpyPacked),
2397                                    EGLBoolean, dpyPacked, streamPacked);
2398             }
2399             else
2400             {
2401             }
2402 
2403             returnValue = StreamConsumerAcquireKHR(thread, dpyPacked, streamPacked);
2404         }
2405 
2406         ANGLE_CAPTURE_EGL(StreamConsumerAcquireKHR, true, thread, dpyPacked, streamPacked,
2407                           returnValue);
2408     }
2409     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2410     return returnValue;
2411 }
2412 
EGL_StreamConsumerGLTextureExternalKHR(EGLDisplay dpy,EGLStreamKHR stream)2413 EGLBoolean EGLAPIENTRY EGL_StreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream)
2414 {
2415 
2416     Thread *thread = egl::GetCurrentThread();
2417     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2418     EGLBoolean returnValue;
2419     {
2420         ANGLE_SCOPED_GLOBAL_LOCK();
2421         EGL_EVENT(StreamConsumerGLTextureExternalKHR,
2422                   "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR "", (uintptr_t)dpy,
2423                   (uintptr_t)stream);
2424 
2425         egl::Display *dpyPacked   = PackParam<egl::Display *>(dpy);
2426         egl::Stream *streamPacked = PackParam<egl::Stream *>(stream);
2427 
2428         {
2429             ANGLE_EGL_SCOPED_CONTEXT_LOCK(StreamConsumerGLTextureExternalKHR, thread, dpyPacked);
2430             if (IsEGLValidationEnabled())
2431             {
2432                 ANGLE_EGL_VALIDATE(thread, StreamConsumerGLTextureExternalKHR,
2433                                    GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
2434                                    streamPacked);
2435             }
2436             else
2437             {
2438             }
2439 
2440             returnValue = StreamConsumerGLTextureExternalKHR(thread, dpyPacked, streamPacked);
2441         }
2442 
2443         ANGLE_CAPTURE_EGL(StreamConsumerGLTextureExternalKHR, true, thread, dpyPacked, streamPacked,
2444                           returnValue);
2445     }
2446     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2447     return returnValue;
2448 }
2449 
EGL_StreamConsumerReleaseKHR(EGLDisplay dpy,EGLStreamKHR stream)2450 EGLBoolean EGLAPIENTRY EGL_StreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream)
2451 {
2452 
2453     Thread *thread = egl::GetCurrentThread();
2454     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2455     EGLBoolean returnValue;
2456     {
2457         ANGLE_SCOPED_GLOBAL_LOCK();
2458         EGL_EVENT(StreamConsumerReleaseKHR, "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR "",
2459                   (uintptr_t)dpy, (uintptr_t)stream);
2460 
2461         egl::Display *dpyPacked   = PackParam<egl::Display *>(dpy);
2462         egl::Stream *streamPacked = PackParam<egl::Stream *>(stream);
2463 
2464         {
2465             ANGLE_EGL_SCOPED_CONTEXT_LOCK(StreamConsumerReleaseKHR, thread, dpyPacked);
2466             if (IsEGLValidationEnabled())
2467             {
2468                 ANGLE_EGL_VALIDATE(thread, StreamConsumerReleaseKHR, GetDisplayIfValid(dpyPacked),
2469                                    EGLBoolean, dpyPacked, streamPacked);
2470             }
2471             else
2472             {
2473             }
2474 
2475             returnValue = StreamConsumerReleaseKHR(thread, dpyPacked, streamPacked);
2476         }
2477 
2478         ANGLE_CAPTURE_EGL(StreamConsumerReleaseKHR, true, thread, dpyPacked, streamPacked,
2479                           returnValue);
2480     }
2481     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2482     return returnValue;
2483 }
2484 
2485 // EGL_KHR_swap_buffers_with_damage
EGL_SwapBuffersWithDamageKHR(EGLDisplay dpy,EGLSurface surface,const EGLint * rects,EGLint n_rects)2486 EGLBoolean EGLAPIENTRY EGL_SwapBuffersWithDamageKHR(EGLDisplay dpy,
2487                                                     EGLSurface surface,
2488                                                     const EGLint *rects,
2489                                                     EGLint n_rects)
2490 {
2491     ANGLE_EGLBOOLEAN_TRY(EGL_PrepareSwapBuffersANGLE(dpy, surface));
2492     Thread *thread = egl::GetCurrentThread();
2493     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2494     EGLBoolean returnValue;
2495     {
2496         ANGLE_SCOPED_GLOBAL_LOCK();
2497         EGL_EVENT(SwapBuffersWithDamageKHR,
2498                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", rects = 0x%016" PRIxPTR
2499                   ", n_rects = %d",
2500                   (uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)rects, n_rects);
2501 
2502         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
2503         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
2504 
2505         {
2506             ANGLE_EGL_SCOPED_CONTEXT_LOCK(SwapBuffersWithDamageKHR, thread, dpyPacked);
2507             if (IsEGLValidationEnabled())
2508             {
2509                 ANGLE_EGL_VALIDATE(thread, SwapBuffersWithDamageKHR, GetDisplayIfValid(dpyPacked),
2510                                    EGLBoolean, dpyPacked, surfacePacked, rects, n_rects);
2511             }
2512             else
2513             {
2514             }
2515 
2516             returnValue =
2517                 SwapBuffersWithDamageKHR(thread, dpyPacked, surfacePacked, rects, n_rects);
2518         }
2519 
2520         ANGLE_CAPTURE_EGL(SwapBuffersWithDamageKHR, true, thread, dpyPacked, surfacePacked, rects,
2521                           n_rects, returnValue);
2522     }
2523     egl::Display::GetCurrentThreadUnlockedTailCall()->run(&returnValue);
2524     return returnValue;
2525 }
2526 
2527 // EGL_KHR_wait_sync
EGL_WaitSyncKHR(EGLDisplay dpy,EGLSyncKHR sync,EGLint flags)2528 EGLint EGLAPIENTRY EGL_WaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags)
2529 {
2530 
2531     Thread *thread = egl::GetCurrentThread();
2532     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2533     EGLint returnValue;
2534     {
2535         ANGLE_SCOPED_GLOBAL_EGL_SYNC_LOCK();
2536         EGL_EVENT(WaitSyncKHR, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR ", flags = %d",
2537                   (uintptr_t)dpy, (uintptr_t)sync, flags);
2538 
2539         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
2540         egl::SyncID syncPacked  = PackParam<egl::SyncID>(sync);
2541 
2542         {
2543             ANGLE_EGL_SCOPED_CONTEXT_LOCK(WaitSyncKHR, thread, dpyPacked, flags);
2544             if (IsEGLValidationEnabled())
2545             {
2546                 ANGLE_EGL_VALIDATE(thread, WaitSyncKHR, GetDisplayIfValid(dpyPacked), EGLint,
2547                                    dpyPacked, syncPacked, flags);
2548             }
2549             else
2550             {
2551             }
2552 
2553             returnValue = WaitSyncKHR(thread, dpyPacked, syncPacked, flags);
2554         }
2555 
2556         ANGLE_CAPTURE_EGL(WaitSyncKHR, true, thread, dpyPacked, syncPacked, flags, returnValue);
2557     }
2558     egl::Display::GetCurrentThreadUnlockedTailCall()->run(&returnValue);
2559     return returnValue;
2560 }
2561 
2562 // EGL_NV_post_sub_buffer
EGL_PostSubBufferNV(EGLDisplay dpy,EGLSurface surface,EGLint x,EGLint y,EGLint width,EGLint height)2563 EGLBoolean EGLAPIENTRY EGL_PostSubBufferNV(EGLDisplay dpy,
2564                                            EGLSurface surface,
2565                                            EGLint x,
2566                                            EGLint y,
2567                                            EGLint width,
2568                                            EGLint height)
2569 {
2570 
2571     Thread *thread = egl::GetCurrentThread();
2572     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2573     EGLBoolean returnValue;
2574     {
2575         ANGLE_SCOPED_GLOBAL_LOCK();
2576         EGL_EVENT(PostSubBufferNV,
2577                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR
2578                   ", x = %d, y = %d, width = %d, height = %d",
2579                   (uintptr_t)dpy, (uintptr_t)surface, x, y, width, height);
2580 
2581         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
2582         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
2583 
2584         {
2585             ANGLE_EGL_SCOPED_CONTEXT_LOCK(PostSubBufferNV, thread, dpyPacked);
2586             if (IsEGLValidationEnabled())
2587             {
2588                 ANGLE_EGL_VALIDATE(thread, PostSubBufferNV, GetDisplayIfValid(dpyPacked),
2589                                    EGLBoolean, dpyPacked, surfacePacked, x, y, width, height);
2590             }
2591             else
2592             {
2593             }
2594 
2595             returnValue = PostSubBufferNV(thread, dpyPacked, surfacePacked, x, y, width, height);
2596         }
2597 
2598         ANGLE_CAPTURE_EGL(PostSubBufferNV, true, thread, dpyPacked, surfacePacked, x, y, width,
2599                           height, returnValue);
2600     }
2601     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2602     return returnValue;
2603 }
2604 
2605 // EGL_NV_stream_consumer_gltexture_yuv
EGL_StreamConsumerGLTextureExternalAttribsNV(EGLDisplay dpy,EGLStreamKHR stream,const EGLAttrib * attrib_list)2606 EGLBoolean EGLAPIENTRY EGL_StreamConsumerGLTextureExternalAttribsNV(EGLDisplay dpy,
2607                                                                     EGLStreamKHR stream,
2608                                                                     const EGLAttrib *attrib_list)
2609 {
2610 
2611     Thread *thread = egl::GetCurrentThread();
2612     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2613     EGLBoolean returnValue;
2614     {
2615         ANGLE_SCOPED_GLOBAL_LOCK();
2616         EGL_EVENT(StreamConsumerGLTextureExternalAttribsNV,
2617                   "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR
2618                   ", attrib_list = 0x%016" PRIxPTR "",
2619                   (uintptr_t)dpy, (uintptr_t)stream, (uintptr_t)attrib_list);
2620 
2621         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
2622         egl::Stream *streamPacked             = PackParam<egl::Stream *>(stream);
2623         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
2624 
2625         {
2626             ANGLE_EGL_SCOPED_CONTEXT_LOCK(StreamConsumerGLTextureExternalAttribsNV, thread,
2627                                           dpyPacked);
2628             if (IsEGLValidationEnabled())
2629             {
2630                 ANGLE_EGL_VALIDATE(thread, StreamConsumerGLTextureExternalAttribsNV,
2631                                    GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
2632                                    streamPacked, attrib_listPacked);
2633             }
2634             else
2635             {
2636                 attrib_listPacked.initializeWithoutValidation();
2637             }
2638 
2639             returnValue = StreamConsumerGLTextureExternalAttribsNV(thread, dpyPacked, streamPacked,
2640                                                                    attrib_listPacked);
2641         }
2642 
2643         ANGLE_CAPTURE_EGL(StreamConsumerGLTextureExternalAttribsNV, true, thread, dpyPacked,
2644                           streamPacked, attrib_listPacked, returnValue);
2645     }
2646     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2647     return returnValue;
2648 }
2649 
2650 }  // extern "C"
2651