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