• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by generate_entry_points.py using data from egl.xml.
3 //
4 // Copyright 2020 The ANGLE Project Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style license that can be
6 // found in the LICENSE file.
7 //
8 // entry_points_egl_autogen.cpp:
9 //   Defines the EGL entry points.
10 
11 #include "libGLESv2/entry_points_egl_autogen.h"
12 
13 #include "libANGLE/entry_points_utils.h"
14 #include "libANGLE/validationEGL_autogen.h"
15 #include "libGLESv2/egl_stubs_autogen.h"
16 #include "libGLESv2/global_state.h"
17 
18 using namespace egl;
19 
20 extern "C" {
21 
22 // EGL 1.0
EGL_ChooseConfig(EGLDisplay dpy,const EGLint * attrib_list,EGLConfig * configs,EGLint config_size,EGLint * num_config)23 EGLBoolean EGLAPIENTRY EGL_ChooseConfig(EGLDisplay dpy,
24                                         const EGLint *attrib_list,
25                                         EGLConfig *configs,
26                                         EGLint config_size,
27                                         EGLint *num_config)
28 {
29     ANGLE_SCOPED_GLOBAL_LOCK();
30     EGL_EVENT(ChooseConfig,
31               "dpy = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR ", configs = 0x%016" PRIxPTR
32               ", config_size = %d, num_config = 0x%016" PRIxPTR "",
33               (uintptr_t)dpy, (uintptr_t)attrib_list, (uintptr_t)configs, config_size,
34               (uintptr_t)num_config);
35 
36     Thread *thread = egl::GetCurrentThread();
37 
38     egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
39     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
40 
41     ANGLE_EGL_VALIDATE(thread, ChooseConfig, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
42                        attrib_listPacked, configs, config_size, num_config);
43 
44     return ChooseConfig(thread, dpyPacked, attrib_listPacked, configs, config_size, num_config);
45 }
46 
EGL_CopyBuffers(EGLDisplay dpy,EGLSurface surface,EGLNativePixmapType target)47 EGLBoolean EGLAPIENTRY EGL_CopyBuffers(EGLDisplay dpy,
48                                        EGLSurface surface,
49                                        EGLNativePixmapType target)
50 {
51     ANGLE_SCOPED_GLOBAL_LOCK();
52     EGL_EVENT(CopyBuffers,
53               "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", target = 0x%016" PRIxPTR "",
54               (uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)target);
55 
56     Thread *thread = egl::GetCurrentThread();
57 
58     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
59     Surface *surfacePacked  = PackParam<Surface *>(surface);
60 
61     ANGLE_EGL_VALIDATE(thread, CopyBuffers, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
62                        surfacePacked, target);
63 
64     return CopyBuffers(thread, dpyPacked, surfacePacked, target);
65 }
66 
EGL_CreateContext(EGLDisplay dpy,EGLConfig config,EGLContext share_context,const EGLint * attrib_list)67 EGLContext EGLAPIENTRY EGL_CreateContext(EGLDisplay dpy,
68                                          EGLConfig config,
69                                          EGLContext share_context,
70                                          const EGLint *attrib_list)
71 {
72     ANGLE_SCOPED_GLOBAL_LOCK();
73     EGL_EVENT(CreateContext,
74               "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", share_context = 0x%016" PRIxPTR
75               ", attrib_list = 0x%016" PRIxPTR "",
76               (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)share_context, (uintptr_t)attrib_list);
77 
78     Thread *thread = egl::GetCurrentThread();
79 
80     egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
81     Config *configPacked                  = PackParam<Config *>(config);
82     gl::Context *share_contextPacked      = PackParam<gl::Context *>(share_context);
83     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
84 
85     ANGLE_EGL_VALIDATE(thread, CreateContext, GetDisplayIfValid(dpyPacked), EGLContext, dpyPacked,
86                        configPacked, share_contextPacked, attrib_listPacked);
87 
88     return CreateContext(thread, dpyPacked, configPacked, share_contextPacked, attrib_listPacked);
89 }
90 
EGL_CreatePbufferSurface(EGLDisplay dpy,EGLConfig config,const EGLint * attrib_list)91 EGLSurface EGLAPIENTRY EGL_CreatePbufferSurface(EGLDisplay dpy,
92                                                 EGLConfig config,
93                                                 const EGLint *attrib_list)
94 {
95     ANGLE_SCOPED_GLOBAL_LOCK();
96     EGL_EVENT(CreatePbufferSurface,
97               "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR
98               "",
99               (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)attrib_list);
100 
101     Thread *thread = egl::GetCurrentThread();
102 
103     egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
104     Config *configPacked                  = PackParam<Config *>(config);
105     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
106 
107     ANGLE_EGL_VALIDATE(thread, CreatePbufferSurface, GetDisplayIfValid(dpyPacked), EGLSurface,
108                        dpyPacked, configPacked, attrib_listPacked);
109 
110     return CreatePbufferSurface(thread, dpyPacked, configPacked, attrib_listPacked);
111 }
112 
EGL_CreatePixmapSurface(EGLDisplay dpy,EGLConfig config,EGLNativePixmapType pixmap,const EGLint * attrib_list)113 EGLSurface EGLAPIENTRY EGL_CreatePixmapSurface(EGLDisplay dpy,
114                                                EGLConfig config,
115                                                EGLNativePixmapType pixmap,
116                                                const EGLint *attrib_list)
117 {
118     ANGLE_SCOPED_GLOBAL_LOCK();
119     EGL_EVENT(CreatePixmapSurface,
120               "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", pixmap = 0x%016" PRIxPTR
121               ", attrib_list = 0x%016" PRIxPTR "",
122               (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)pixmap, (uintptr_t)attrib_list);
123 
124     Thread *thread = egl::GetCurrentThread();
125 
126     egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
127     Config *configPacked                  = PackParam<Config *>(config);
128     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
129 
130     ANGLE_EGL_VALIDATE(thread, CreatePixmapSurface, GetDisplayIfValid(dpyPacked), EGLSurface,
131                        dpyPacked, configPacked, pixmap, attrib_listPacked);
132 
133     return CreatePixmapSurface(thread, dpyPacked, configPacked, pixmap, attrib_listPacked);
134 }
135 
EGL_CreateWindowSurface(EGLDisplay dpy,EGLConfig config,EGLNativeWindowType win,const EGLint * attrib_list)136 EGLSurface EGLAPIENTRY EGL_CreateWindowSurface(EGLDisplay dpy,
137                                                EGLConfig config,
138                                                EGLNativeWindowType win,
139                                                const EGLint *attrib_list)
140 {
141     ANGLE_SCOPED_GLOBAL_LOCK();
142     EGL_EVENT(CreateWindowSurface,
143               "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", win = 0x%016" PRIxPTR
144               ", attrib_list = 0x%016" PRIxPTR "",
145               (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)win, (uintptr_t)attrib_list);
146 
147     Thread *thread = egl::GetCurrentThread();
148 
149     egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
150     Config *configPacked                  = PackParam<Config *>(config);
151     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
152 
153     ANGLE_EGL_VALIDATE(thread, CreateWindowSurface, GetDisplayIfValid(dpyPacked), EGLSurface,
154                        dpyPacked, configPacked, win, attrib_listPacked);
155 
156     return CreateWindowSurface(thread, dpyPacked, configPacked, win, attrib_listPacked);
157 }
158 
EGL_DestroyContext(EGLDisplay dpy,EGLContext ctx)159 EGLBoolean EGLAPIENTRY EGL_DestroyContext(EGLDisplay dpy, EGLContext ctx)
160 {
161     ANGLE_SCOPED_GLOBAL_LOCK();
162     EGL_EVENT(DestroyContext, "dpy = 0x%016" PRIxPTR ", ctx = 0x%016" PRIxPTR "", (uintptr_t)dpy,
163               (uintptr_t)ctx);
164 
165     Thread *thread = egl::GetCurrentThread();
166 
167     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
168     gl::Context *ctxPacked  = PackParam<gl::Context *>(ctx);
169 
170     ANGLE_EGL_VALIDATE(thread, DestroyContext, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
171                        ctxPacked);
172 
173     return DestroyContext(thread, dpyPacked, ctxPacked);
174 }
175 
EGL_DestroySurface(EGLDisplay dpy,EGLSurface surface)176 EGLBoolean EGLAPIENTRY EGL_DestroySurface(EGLDisplay dpy, EGLSurface surface)
177 {
178     ANGLE_SCOPED_GLOBAL_LOCK();
179     EGL_EVENT(DestroySurface, "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR "",
180               (uintptr_t)dpy, (uintptr_t)surface);
181 
182     Thread *thread = egl::GetCurrentThread();
183 
184     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
185     Surface *surfacePacked  = PackParam<Surface *>(surface);
186 
187     ANGLE_EGL_VALIDATE(thread, DestroySurface, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
188                        surfacePacked);
189 
190     return DestroySurface(thread, dpyPacked, surfacePacked);
191 }
192 
EGL_GetConfigAttrib(EGLDisplay dpy,EGLConfig config,EGLint attribute,EGLint * value)193 EGLBoolean EGLAPIENTRY EGL_GetConfigAttrib(EGLDisplay dpy,
194                                            EGLConfig config,
195                                            EGLint attribute,
196                                            EGLint *value)
197 {
198     ANGLE_SCOPED_GLOBAL_LOCK();
199     EGL_EVENT(GetConfigAttrib,
200               "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR
201               ", attribute = %d, value = 0x%016" PRIxPTR "",
202               (uintptr_t)dpy, (uintptr_t)config, attribute, (uintptr_t)value);
203 
204     Thread *thread = egl::GetCurrentThread();
205 
206     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
207     Config *configPacked    = PackParam<Config *>(config);
208 
209     ANGLE_EGL_VALIDATE(thread, GetConfigAttrib, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
210                        configPacked, attribute, value);
211 
212     return GetConfigAttrib(thread, dpyPacked, configPacked, attribute, value);
213 }
214 
EGL_GetConfigs(EGLDisplay dpy,EGLConfig * configs,EGLint config_size,EGLint * num_config)215 EGLBoolean EGLAPIENTRY EGL_GetConfigs(EGLDisplay dpy,
216                                       EGLConfig *configs,
217                                       EGLint config_size,
218                                       EGLint *num_config)
219 {
220     ANGLE_SCOPED_GLOBAL_LOCK();
221     EGL_EVENT(GetConfigs,
222               "dpy = 0x%016" PRIxPTR ", configs = 0x%016" PRIxPTR
223               ", config_size = %d, num_config = 0x%016" PRIxPTR "",
224               (uintptr_t)dpy, (uintptr_t)configs, config_size, (uintptr_t)num_config);
225 
226     Thread *thread = egl::GetCurrentThread();
227 
228     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
229 
230     ANGLE_EGL_VALIDATE(thread, GetConfigs, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
231                        configs, config_size, num_config);
232 
233     return GetConfigs(thread, dpyPacked, configs, config_size, num_config);
234 }
235 
EGL_GetCurrentDisplay()236 EGLDisplay EGLAPIENTRY EGL_GetCurrentDisplay()
237 {
238     ANGLE_SCOPED_GLOBAL_LOCK();
239     EGL_EVENT(GetCurrentDisplay, "");
240 
241     Thread *thread = egl::GetCurrentThread();
242 
243     ANGLE_EGL_VALIDATE(thread, GetCurrentDisplay, nullptr, EGLDisplay);
244 
245     return GetCurrentDisplay(thread);
246 }
247 
EGL_GetCurrentSurface(EGLint readdraw)248 EGLSurface EGLAPIENTRY EGL_GetCurrentSurface(EGLint readdraw)
249 {
250     ANGLE_SCOPED_GLOBAL_LOCK();
251     EGL_EVENT(GetCurrentSurface, "readdraw = %d", readdraw);
252 
253     Thread *thread = egl::GetCurrentThread();
254 
255     ANGLE_EGL_VALIDATE(thread, GetCurrentSurface, nullptr, EGLSurface, readdraw);
256 
257     return GetCurrentSurface(thread, readdraw);
258 }
259 
EGL_GetDisplay(EGLNativeDisplayType display_id)260 EGLDisplay EGLAPIENTRY EGL_GetDisplay(EGLNativeDisplayType display_id)
261 {
262     ANGLE_SCOPED_GLOBAL_LOCK();
263     EGL_EVENT(GetDisplay, "display_id = 0x%016" PRIxPTR "", (uintptr_t)display_id);
264 
265     Thread *thread = egl::GetCurrentThread();
266 
267     ANGLE_EGL_VALIDATE(thread, GetDisplay, nullptr, EGLDisplay, display_id);
268 
269     return GetDisplay(thread, display_id);
270 }
271 
EGL_GetError()272 EGLint EGLAPIENTRY EGL_GetError()
273 {
274     ANGLE_SCOPED_GLOBAL_LOCK();
275     EGL_EVENT(GetError, "");
276 
277     Thread *thread = egl::GetCurrentThread();
278 
279     ANGLE_EGL_VALIDATE(thread, GetError, nullptr, EGLint);
280 
281     return GetError(thread);
282 }
283 
EGL_GetProcAddress(const char * procname)284 __eglMustCastToProperFunctionPointerType EGLAPIENTRY EGL_GetProcAddress(const char *procname)
285 {
286     ANGLE_SCOPED_GLOBAL_LOCK();
287     EGL_EVENT(GetProcAddress, "procname = 0x%016" PRIxPTR "", (uintptr_t)procname);
288 
289     Thread *thread = egl::GetCurrentThread();
290 
291     ANGLE_EGL_VALIDATE(thread, GetProcAddress, nullptr, __eglMustCastToProperFunctionPointerType,
292                        procname);
293 
294     return GetProcAddress(thread, procname);
295 }
296 
EGL_Initialize(EGLDisplay dpy,EGLint * major,EGLint * minor)297 EGLBoolean EGLAPIENTRY EGL_Initialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
298 {
299     ANGLE_SCOPED_GLOBAL_LOCK();
300     EGL_EVENT(Initialize,
301               "dpy = 0x%016" PRIxPTR ", major = 0x%016" PRIxPTR ", minor = 0x%016" PRIxPTR "",
302               (uintptr_t)dpy, (uintptr_t)major, (uintptr_t)minor);
303 
304     Thread *thread = egl::GetCurrentThread();
305 
306     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
307 
308     ANGLE_EGL_VALIDATE(thread, Initialize, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
309                        major, minor);
310 
311     return Initialize(thread, dpyPacked, major, minor);
312 }
313 
EGL_MakeCurrent(EGLDisplay dpy,EGLSurface draw,EGLSurface read,EGLContext ctx)314 EGLBoolean EGLAPIENTRY EGL_MakeCurrent(EGLDisplay dpy,
315                                        EGLSurface draw,
316                                        EGLSurface read,
317                                        EGLContext ctx)
318 {
319     ANGLE_SCOPED_GLOBAL_LOCK();
320     EGL_EVENT(MakeCurrent,
321               "dpy = 0x%016" PRIxPTR ", draw = 0x%016" PRIxPTR ", read = 0x%016" PRIxPTR
322               ", ctx = 0x%016" PRIxPTR "",
323               (uintptr_t)dpy, (uintptr_t)draw, (uintptr_t)read, (uintptr_t)ctx);
324 
325     Thread *thread = egl::GetCurrentThread();
326 
327     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
328     Surface *drawPacked     = PackParam<Surface *>(draw);
329     Surface *readPacked     = PackParam<Surface *>(read);
330     gl::Context *ctxPacked  = PackParam<gl::Context *>(ctx);
331 
332     ANGLE_EGL_VALIDATE(thread, MakeCurrent, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
333                        drawPacked, readPacked, ctxPacked);
334 
335     return MakeCurrent(thread, dpyPacked, drawPacked, readPacked, ctxPacked);
336 }
337 
EGL_QueryContext(EGLDisplay dpy,EGLContext ctx,EGLint attribute,EGLint * value)338 EGLBoolean EGLAPIENTRY EGL_QueryContext(EGLDisplay dpy,
339                                         EGLContext ctx,
340                                         EGLint attribute,
341                                         EGLint *value)
342 {
343     ANGLE_SCOPED_GLOBAL_LOCK();
344     EGL_EVENT(QueryContext,
345               "dpy = 0x%016" PRIxPTR ", ctx = 0x%016" PRIxPTR
346               ", attribute = %d, value = 0x%016" PRIxPTR "",
347               (uintptr_t)dpy, (uintptr_t)ctx, attribute, (uintptr_t)value);
348 
349     Thread *thread = egl::GetCurrentThread();
350 
351     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
352     gl::Context *ctxPacked  = PackParam<gl::Context *>(ctx);
353 
354     ANGLE_EGL_VALIDATE(thread, QueryContext, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
355                        ctxPacked, attribute, value);
356 
357     return QueryContext(thread, dpyPacked, ctxPacked, attribute, value);
358 }
359 
EGL_QueryString(EGLDisplay dpy,EGLint name)360 const char *EGLAPIENTRY EGL_QueryString(EGLDisplay dpy, EGLint name)
361 {
362     ANGLE_SCOPED_GLOBAL_LOCK();
363     EGL_EVENT(QueryString, "dpy = 0x%016" PRIxPTR ", name = %d", (uintptr_t)dpy, name);
364 
365     Thread *thread = egl::GetCurrentThread();
366 
367     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
368 
369     ANGLE_EGL_VALIDATE(thread, QueryString, GetDisplayIfValid(dpyPacked), const char *, dpyPacked,
370                        name);
371 
372     return QueryString(thread, dpyPacked, name);
373 }
374 
EGL_QuerySurface(EGLDisplay dpy,EGLSurface surface,EGLint attribute,EGLint * value)375 EGLBoolean EGLAPIENTRY EGL_QuerySurface(EGLDisplay dpy,
376                                         EGLSurface surface,
377                                         EGLint attribute,
378                                         EGLint *value)
379 {
380     ANGLE_SCOPED_GLOBAL_LOCK();
381     EGL_EVENT(QuerySurface,
382               "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR
383               ", attribute = %d, value = 0x%016" PRIxPTR "",
384               (uintptr_t)dpy, (uintptr_t)surface, attribute, (uintptr_t)value);
385 
386     Thread *thread = egl::GetCurrentThread();
387 
388     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
389     Surface *surfacePacked  = PackParam<Surface *>(surface);
390 
391     ANGLE_EGL_VALIDATE(thread, QuerySurface, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
392                        surfacePacked, attribute, value);
393 
394     return QuerySurface(thread, dpyPacked, surfacePacked, attribute, value);
395 }
396 
EGL_SwapBuffers(EGLDisplay dpy,EGLSurface surface)397 EGLBoolean EGLAPIENTRY EGL_SwapBuffers(EGLDisplay dpy, EGLSurface surface)
398 {
399     ANGLE_SCOPED_GLOBAL_LOCK();
400     EGL_EVENT(SwapBuffers, "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR "", (uintptr_t)dpy,
401               (uintptr_t)surface);
402 
403     Thread *thread = egl::GetCurrentThread();
404 
405     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
406     Surface *surfacePacked  = PackParam<Surface *>(surface);
407 
408     ANGLE_EGL_VALIDATE(thread, SwapBuffers, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
409                        surfacePacked);
410 
411     return SwapBuffers(thread, dpyPacked, surfacePacked);
412 }
413 
EGL_Terminate(EGLDisplay dpy)414 EGLBoolean EGLAPIENTRY EGL_Terminate(EGLDisplay dpy)
415 {
416     ANGLE_SCOPED_GLOBAL_LOCK();
417     EGL_EVENT(Terminate, "dpy = 0x%016" PRIxPTR "", (uintptr_t)dpy);
418 
419     Thread *thread = egl::GetCurrentThread();
420 
421     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
422 
423     ANGLE_EGL_VALIDATE(thread, Terminate, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked);
424 
425     return Terminate(thread, dpyPacked);
426 }
427 
EGL_WaitGL()428 EGLBoolean EGLAPIENTRY EGL_WaitGL()
429 {
430     ANGLE_SCOPED_GLOBAL_LOCK();
431     EGL_EVENT(WaitGL, "");
432 
433     Thread *thread = egl::GetCurrentThread();
434 
435     ANGLE_EGL_VALIDATE(thread, WaitGL, nullptr, EGLBoolean);
436 
437     return WaitGL(thread);
438 }
439 
EGL_WaitNative(EGLint engine)440 EGLBoolean EGLAPIENTRY EGL_WaitNative(EGLint engine)
441 {
442     ANGLE_SCOPED_GLOBAL_LOCK();
443     EGL_EVENT(WaitNative, "engine = %d", engine);
444 
445     Thread *thread = egl::GetCurrentThread();
446 
447     ANGLE_EGL_VALIDATE(thread, WaitNative, nullptr, EGLBoolean, engine);
448 
449     return WaitNative(thread, engine);
450 }
451 
452 // EGL 1.1
EGL_BindTexImage(EGLDisplay dpy,EGLSurface surface,EGLint buffer)453 EGLBoolean EGLAPIENTRY EGL_BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
454 {
455     ANGLE_SCOPED_GLOBAL_LOCK();
456     EGL_EVENT(BindTexImage, "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", buffer = %d",
457               (uintptr_t)dpy, (uintptr_t)surface, buffer);
458 
459     Thread *thread = egl::GetCurrentThread();
460 
461     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
462     Surface *surfacePacked  = PackParam<Surface *>(surface);
463 
464     ANGLE_EGL_VALIDATE(thread, BindTexImage, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
465                        surfacePacked, buffer);
466 
467     return BindTexImage(thread, dpyPacked, surfacePacked, buffer);
468 }
469 
EGL_ReleaseTexImage(EGLDisplay dpy,EGLSurface surface,EGLint buffer)470 EGLBoolean EGLAPIENTRY EGL_ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
471 {
472     ANGLE_SCOPED_GLOBAL_LOCK();
473     EGL_EVENT(ReleaseTexImage, "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", buffer = %d",
474               (uintptr_t)dpy, (uintptr_t)surface, buffer);
475 
476     Thread *thread = egl::GetCurrentThread();
477 
478     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
479     Surface *surfacePacked  = PackParam<Surface *>(surface);
480 
481     ANGLE_EGL_VALIDATE(thread, ReleaseTexImage, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
482                        surfacePacked, buffer);
483 
484     return ReleaseTexImage(thread, dpyPacked, surfacePacked, buffer);
485 }
486 
EGL_SurfaceAttrib(EGLDisplay dpy,EGLSurface surface,EGLint attribute,EGLint value)487 EGLBoolean EGLAPIENTRY EGL_SurfaceAttrib(EGLDisplay dpy,
488                                          EGLSurface surface,
489                                          EGLint attribute,
490                                          EGLint value)
491 {
492     ANGLE_SCOPED_GLOBAL_LOCK();
493     EGL_EVENT(SurfaceAttrib,
494               "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", attribute = %d, value = %d",
495               (uintptr_t)dpy, (uintptr_t)surface, attribute, value);
496 
497     Thread *thread = egl::GetCurrentThread();
498 
499     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
500     Surface *surfacePacked  = PackParam<Surface *>(surface);
501 
502     ANGLE_EGL_VALIDATE(thread, SurfaceAttrib, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
503                        surfacePacked, attribute, value);
504 
505     return SurfaceAttrib(thread, dpyPacked, surfacePacked, attribute, value);
506 }
507 
EGL_SwapInterval(EGLDisplay dpy,EGLint interval)508 EGLBoolean EGLAPIENTRY EGL_SwapInterval(EGLDisplay dpy, EGLint interval)
509 {
510     ANGLE_SCOPED_GLOBAL_LOCK();
511     EGL_EVENT(SwapInterval, "dpy = 0x%016" PRIxPTR ", interval = %d", (uintptr_t)dpy, interval);
512 
513     Thread *thread = egl::GetCurrentThread();
514 
515     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
516 
517     ANGLE_EGL_VALIDATE(thread, SwapInterval, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
518                        interval);
519 
520     return SwapInterval(thread, dpyPacked, interval);
521 }
522 
523 // EGL 1.2
EGL_BindAPI(EGLenum api)524 EGLBoolean EGLAPIENTRY EGL_BindAPI(EGLenum api)
525 {
526     ANGLE_SCOPED_GLOBAL_LOCK();
527     EGL_EVENT(BindAPI, "api = 0x%X", api);
528 
529     Thread *thread = egl::GetCurrentThread();
530 
531     ANGLE_EGL_VALIDATE(thread, BindAPI, nullptr, EGLBoolean, api);
532 
533     return BindAPI(thread, api);
534 }
535 
EGL_CreatePbufferFromClientBuffer(EGLDisplay dpy,EGLenum buftype,EGLClientBuffer buffer,EGLConfig config,const EGLint * attrib_list)536 EGLSurface EGLAPIENTRY EGL_CreatePbufferFromClientBuffer(EGLDisplay dpy,
537                                                          EGLenum buftype,
538                                                          EGLClientBuffer buffer,
539                                                          EGLConfig config,
540                                                          const EGLint *attrib_list)
541 {
542     ANGLE_SCOPED_GLOBAL_LOCK();
543     EGL_EVENT(CreatePbufferFromClientBuffer,
544               "dpy = 0x%016" PRIxPTR ", buftype = 0x%X, buffer = 0x%016" PRIxPTR
545               ", config = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
546               (uintptr_t)dpy, buftype, (uintptr_t)buffer, (uintptr_t)config,
547               (uintptr_t)attrib_list);
548 
549     Thread *thread = egl::GetCurrentThread();
550 
551     egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
552     Config *configPacked                  = PackParam<Config *>(config);
553     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
554 
555     ANGLE_EGL_VALIDATE(thread, CreatePbufferFromClientBuffer, GetDisplayIfValid(dpyPacked),
556                        EGLSurface, dpyPacked, buftype, buffer, configPacked, attrib_listPacked);
557 
558     return CreatePbufferFromClientBuffer(thread, dpyPacked, buftype, buffer, configPacked,
559                                          attrib_listPacked);
560 }
561 
EGL_QueryAPI()562 EGLenum EGLAPIENTRY EGL_QueryAPI()
563 {
564     ANGLE_SCOPED_GLOBAL_LOCK();
565     EGL_EVENT(QueryAPI, "");
566 
567     Thread *thread = egl::GetCurrentThread();
568 
569     ANGLE_EGL_VALIDATE(thread, QueryAPI, nullptr, EGLenum);
570 
571     return QueryAPI(thread);
572 }
573 
EGL_ReleaseThread()574 EGLBoolean EGLAPIENTRY EGL_ReleaseThread()
575 {
576     ANGLE_SCOPED_GLOBAL_LOCK();
577     EGL_EVENT(ReleaseThread, "");
578 
579     Thread *thread = egl::GetCurrentThread();
580 
581     ANGLE_EGL_VALIDATE(thread, ReleaseThread, nullptr, EGLBoolean);
582 
583     return ReleaseThread(thread);
584 }
585 
EGL_WaitClient()586 EGLBoolean EGLAPIENTRY EGL_WaitClient()
587 {
588     ANGLE_SCOPED_GLOBAL_LOCK();
589     EGL_EVENT(WaitClient, "");
590 
591     Thread *thread = egl::GetCurrentThread();
592 
593     ANGLE_EGL_VALIDATE(thread, WaitClient, nullptr, EGLBoolean);
594 
595     return WaitClient(thread);
596 }
597 
598 // EGL 1.4
EGL_GetCurrentContext()599 EGLContext EGLAPIENTRY EGL_GetCurrentContext()
600 {
601     ANGLE_SCOPED_GLOBAL_LOCK();
602     EGL_EVENT(GetCurrentContext, "");
603 
604     Thread *thread = egl::GetCurrentThread();
605 
606     ANGLE_EGL_VALIDATE(thread, GetCurrentContext, nullptr, EGLContext);
607 
608     return GetCurrentContext(thread);
609 }
610 
611 // EGL 1.5
EGL_ClientWaitSync(EGLDisplay dpy,EGLSync sync,EGLint flags,EGLTime timeout)612 EGLint EGLAPIENTRY EGL_ClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout)
613 {
614     ANGLE_SCOPED_GLOBAL_LOCK();
615     EGL_EVENT(ClientWaitSync,
616               "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR ", flags = %d, timeout = %llu",
617               (uintptr_t)dpy, (uintptr_t)sync, flags, static_cast<unsigned long long>(timeout));
618 
619     Thread *thread = egl::GetCurrentThread();
620 
621     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
622     Sync *syncPacked        = PackParam<Sync *>(sync);
623 
624     ANGLE_EGL_VALIDATE(thread, ClientWaitSync, GetDisplayIfValid(dpyPacked), EGLint, dpyPacked,
625                        syncPacked, flags, timeout);
626 
627     return ClientWaitSync(thread, dpyPacked, syncPacked, flags, timeout);
628 }
629 
EGL_CreateImage(EGLDisplay dpy,EGLContext ctx,EGLenum target,EGLClientBuffer buffer,const EGLAttrib * attrib_list)630 EGLImage EGLAPIENTRY EGL_CreateImage(EGLDisplay dpy,
631                                      EGLContext ctx,
632                                      EGLenum target,
633                                      EGLClientBuffer buffer,
634                                      const EGLAttrib *attrib_list)
635 {
636     ANGLE_SCOPED_GLOBAL_LOCK();
637     EGL_EVENT(CreateImage,
638               "dpy = 0x%016" PRIxPTR ", ctx = 0x%016" PRIxPTR
639               ", target = 0x%X, buffer = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
640               (uintptr_t)dpy, (uintptr_t)ctx, target, (uintptr_t)buffer, (uintptr_t)attrib_list);
641 
642     Thread *thread = egl::GetCurrentThread();
643 
644     egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
645     gl::Context *ctxPacked                = PackParam<gl::Context *>(ctx);
646     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
647 
648     ANGLE_EGL_VALIDATE(thread, CreateImage, GetDisplayIfValid(dpyPacked), EGLImage, dpyPacked,
649                        ctxPacked, target, buffer, attrib_listPacked);
650 
651     return CreateImage(thread, dpyPacked, ctxPacked, target, buffer, attrib_listPacked);
652 }
653 
EGL_CreatePlatformPixmapSurface(EGLDisplay dpy,EGLConfig config,void * native_pixmap,const EGLAttrib * attrib_list)654 EGLSurface EGLAPIENTRY EGL_CreatePlatformPixmapSurface(EGLDisplay dpy,
655                                                        EGLConfig config,
656                                                        void *native_pixmap,
657                                                        const EGLAttrib *attrib_list)
658 {
659     ANGLE_SCOPED_GLOBAL_LOCK();
660     EGL_EVENT(CreatePlatformPixmapSurface,
661               "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", native_pixmap = 0x%016" PRIxPTR
662               ", attrib_list = 0x%016" PRIxPTR "",
663               (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_pixmap, (uintptr_t)attrib_list);
664 
665     Thread *thread = egl::GetCurrentThread();
666 
667     egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
668     Config *configPacked                  = PackParam<Config *>(config);
669     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
670 
671     ANGLE_EGL_VALIDATE(thread, CreatePlatformPixmapSurface, GetDisplayIfValid(dpyPacked),
672                        EGLSurface, dpyPacked, configPacked, native_pixmap, attrib_listPacked);
673 
674     return CreatePlatformPixmapSurface(thread, dpyPacked, configPacked, native_pixmap,
675                                        attrib_listPacked);
676 }
677 
EGL_CreatePlatformWindowSurface(EGLDisplay dpy,EGLConfig config,void * native_window,const EGLAttrib * attrib_list)678 EGLSurface EGLAPIENTRY EGL_CreatePlatformWindowSurface(EGLDisplay dpy,
679                                                        EGLConfig config,
680                                                        void *native_window,
681                                                        const EGLAttrib *attrib_list)
682 {
683     ANGLE_SCOPED_GLOBAL_LOCK();
684     EGL_EVENT(CreatePlatformWindowSurface,
685               "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR ", native_window = 0x%016" PRIxPTR
686               ", attrib_list = 0x%016" PRIxPTR "",
687               (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_window, (uintptr_t)attrib_list);
688 
689     Thread *thread = egl::GetCurrentThread();
690 
691     egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
692     Config *configPacked                  = PackParam<Config *>(config);
693     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
694 
695     ANGLE_EGL_VALIDATE(thread, CreatePlatformWindowSurface, GetDisplayIfValid(dpyPacked),
696                        EGLSurface, dpyPacked, configPacked, native_window, attrib_listPacked);
697 
698     return CreatePlatformWindowSurface(thread, dpyPacked, configPacked, native_window,
699                                        attrib_listPacked);
700 }
701 
EGL_CreateSync(EGLDisplay dpy,EGLenum type,const EGLAttrib * attrib_list)702 EGLSync EGLAPIENTRY EGL_CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
703 {
704     ANGLE_SCOPED_GLOBAL_LOCK();
705     EGL_EVENT(CreateSync, "dpy = 0x%016" PRIxPTR ", type = 0x%X, attrib_list = 0x%016" PRIxPTR "",
706               (uintptr_t)dpy, type, (uintptr_t)attrib_list);
707 
708     Thread *thread = egl::GetCurrentThread();
709 
710     egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
711     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
712 
713     ANGLE_EGL_VALIDATE(thread, CreateSync, GetDisplayIfValid(dpyPacked), EGLSync, dpyPacked, type,
714                        attrib_listPacked);
715 
716     return CreateSync(thread, dpyPacked, type, attrib_listPacked);
717 }
718 
EGL_DestroyImage(EGLDisplay dpy,EGLImage image)719 EGLBoolean EGLAPIENTRY EGL_DestroyImage(EGLDisplay dpy, EGLImage image)
720 {
721     ANGLE_SCOPED_GLOBAL_LOCK();
722     EGL_EVENT(DestroyImage, "dpy = 0x%016" PRIxPTR ", image = 0x%016" PRIxPTR "", (uintptr_t)dpy,
723               (uintptr_t)image);
724 
725     Thread *thread = egl::GetCurrentThread();
726 
727     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
728     Image *imagePacked      = PackParam<Image *>(image);
729 
730     ANGLE_EGL_VALIDATE(thread, DestroyImage, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
731                        imagePacked);
732 
733     return DestroyImage(thread, dpyPacked, imagePacked);
734 }
735 
EGL_DestroySync(EGLDisplay dpy,EGLSync sync)736 EGLBoolean EGLAPIENTRY EGL_DestroySync(EGLDisplay dpy, EGLSync sync)
737 {
738     ANGLE_SCOPED_GLOBAL_LOCK();
739     EGL_EVENT(DestroySync, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR "", (uintptr_t)dpy,
740               (uintptr_t)sync);
741 
742     Thread *thread = egl::GetCurrentThread();
743 
744     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
745     Sync *syncPacked        = PackParam<Sync *>(sync);
746 
747     ANGLE_EGL_VALIDATE(thread, DestroySync, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
748                        syncPacked);
749 
750     return DestroySync(thread, dpyPacked, syncPacked);
751 }
752 
EGL_GetPlatformDisplay(EGLenum platform,void * native_display,const EGLAttrib * attrib_list)753 EGLDisplay EGLAPIENTRY EGL_GetPlatformDisplay(EGLenum platform,
754                                               void *native_display,
755                                               const EGLAttrib *attrib_list)
756 {
757     ANGLE_SCOPED_GLOBAL_LOCK();
758     EGL_EVENT(GetPlatformDisplay,
759               "platform = 0x%X, native_display = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR
760               "",
761               platform, (uintptr_t)native_display, (uintptr_t)attrib_list);
762 
763     Thread *thread = egl::GetCurrentThread();
764 
765     const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
766 
767     ANGLE_EGL_VALIDATE(thread, GetPlatformDisplay, nullptr, EGLDisplay, platform, native_display,
768                        attrib_listPacked);
769 
770     return GetPlatformDisplay(thread, platform, native_display, attrib_listPacked);
771 }
772 
EGL_GetSyncAttrib(EGLDisplay dpy,EGLSync sync,EGLint attribute,EGLAttrib * value)773 EGLBoolean EGLAPIENTRY EGL_GetSyncAttrib(EGLDisplay dpy,
774                                          EGLSync sync,
775                                          EGLint attribute,
776                                          EGLAttrib *value)
777 {
778     ANGLE_SCOPED_GLOBAL_LOCK();
779     EGL_EVENT(GetSyncAttrib,
780               "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR
781               ", attribute = %d, value = 0x%016" PRIxPTR "",
782               (uintptr_t)dpy, (uintptr_t)sync, attribute, (uintptr_t)value);
783 
784     Thread *thread = egl::GetCurrentThread();
785 
786     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
787     Sync *syncPacked        = PackParam<Sync *>(sync);
788 
789     ANGLE_EGL_VALIDATE(thread, GetSyncAttrib, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
790                        syncPacked, attribute, value);
791 
792     return GetSyncAttrib(thread, dpyPacked, syncPacked, attribute, value);
793 }
794 
EGL_WaitSync(EGLDisplay dpy,EGLSync sync,EGLint flags)795 EGLBoolean EGLAPIENTRY EGL_WaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
796 {
797     ANGLE_SCOPED_GLOBAL_LOCK();
798     EGL_EVENT(WaitSync, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR ", flags = %d",
799               (uintptr_t)dpy, (uintptr_t)sync, flags);
800 
801     Thread *thread = egl::GetCurrentThread();
802 
803     egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
804     Sync *syncPacked        = PackParam<Sync *>(sync);
805 
806     ANGLE_EGL_VALIDATE(thread, WaitSync, GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked,
807                        syncPacked, flags);
808 
809     return WaitSync(thread, dpyPacked, syncPacked, flags);
810 }
811 
812 }  // extern "C"
813