• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by generate_entry_points.py using data from gl.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_gl_1_autogen.cpp:
9 //   Defines the Desktop GL 1.x entry points.
10 
11 #include "libGL/entry_points_gl_1_autogen.h"
12 
13 #include "libANGLE/Context.h"
14 #include "libANGLE/Context.inl.h"
15 #include "libANGLE/capture/gl_enum_utils.h"
16 #include "libANGLE/entry_points_utils.h"
17 #include "libANGLE/validationEGL.h"
18 #include "libANGLE/validationES.h"
19 #include "libANGLE/validationES1.h"
20 #include "libANGLE/validationES2.h"
21 #include "libANGLE/validationES3.h"
22 #include "libANGLE/validationES31.h"
23 #include "libANGLE/validationES32.h"
24 #include "libANGLE/validationESEXT.h"
25 #include "libANGLE/validationGL1_autogen.h"
26 #include "libGLESv2/global_state.h"
27 
28 using namespace gl;
29 
30 extern "C" {
31 
32 // GL 1.0
GL_Accum(GLenum op,GLfloat value)33 void GL_APIENTRY GL_Accum(GLenum op, GLfloat value)
34 {
35     Context *context = GetValidGlobalContext();
36     EVENT(context, GLAccum, "context = %d, op = %s, value = %f", CID(context),
37           GLenumToString(GLenumGroup::AccumOp, op), value);
38 
39     if (context)
40     {
41         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
42         bool isCallValid                                      = (context->skipValidation() ||
43                             ValidateAccum(context, angle::EntryPoint::GLAccum, op, value));
44         if (isCallValid)
45         {
46             context->accum(op, value);
47         }
48         ANGLE_CAPTURE(Accum, isCallValid, context, op, value);
49     }
50     else
51     {
52         GenerateContextLostErrorOnCurrentGlobalContext();
53     }
54 }
55 
GL_AlphaFunc(GLenum func,GLfloat ref)56 void GL_APIENTRY GL_AlphaFunc(GLenum func, GLfloat ref)
57 {
58     Context *context = GetValidGlobalContext();
59     EVENT(context, GLAlphaFunc, "context = %d, func = %s, ref = %f", CID(context),
60           GLenumToString(GLenumGroup::AlphaFunction, func), ref);
61 
62     if (context)
63     {
64         AlphaTestFunc funcPacked                              = PackParam<AlphaTestFunc>(func);
65         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
66         bool isCallValid =
67             (context->skipValidation() ||
68              ValidateAlphaFunc(context, angle::EntryPoint::GLAlphaFunc, funcPacked, ref));
69         if (isCallValid)
70         {
71             context->alphaFunc(funcPacked, ref);
72         }
73         ANGLE_CAPTURE(AlphaFunc, isCallValid, context, funcPacked, ref);
74     }
75     else
76     {
77         GenerateContextLostErrorOnCurrentGlobalContext();
78     }
79 }
80 
GL_Begin(GLenum mode)81 void GL_APIENTRY GL_Begin(GLenum mode)
82 {
83     Context *context = GetValidGlobalContext();
84     EVENT(context, GLBegin, "context = %d, mode = %s", CID(context),
85           GLenumToString(GLenumGroup::PrimitiveType, mode));
86 
87     if (context)
88     {
89         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
90         bool isCallValid =
91             (context->skipValidation() || ValidateBegin(context, angle::EntryPoint::GLBegin, mode));
92         if (isCallValid)
93         {
94             context->begin(mode);
95         }
96         ANGLE_CAPTURE(Begin, isCallValid, context, mode);
97     }
98     else
99     {
100         GenerateContextLostErrorOnCurrentGlobalContext();
101     }
102 }
103 
GL_Bitmap(GLsizei width,GLsizei height,GLfloat xorig,GLfloat yorig,GLfloat xmove,GLfloat ymove,const GLubyte * bitmap)104 void GL_APIENTRY GL_Bitmap(GLsizei width,
105                            GLsizei height,
106                            GLfloat xorig,
107                            GLfloat yorig,
108                            GLfloat xmove,
109                            GLfloat ymove,
110                            const GLubyte *bitmap)
111 {
112     Context *context = GetValidGlobalContext();
113     EVENT(context, GLBitmap,
114           "context = %d, width = %d, height = %d, xorig = %f, yorig = %f, xmove = %f, ymove = %f, "
115           "bitmap = 0x%016" PRIxPTR "",
116           CID(context), width, height, xorig, yorig, xmove, ymove, (uintptr_t)bitmap);
117 
118     if (context)
119     {
120         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
121         bool isCallValid                                      = (context->skipValidation() ||
122                             ValidateBitmap(context, angle::EntryPoint::GLBitmap, width, height,
123                                            xorig, yorig, xmove, ymove, bitmap));
124         if (isCallValid)
125         {
126             context->bitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
127         }
128         ANGLE_CAPTURE(Bitmap, isCallValid, context, width, height, xorig, yorig, xmove, ymove,
129                       bitmap);
130     }
131     else
132     {
133         GenerateContextLostErrorOnCurrentGlobalContext();
134     }
135 }
136 
GL_BlendFunc(GLenum sfactor,GLenum dfactor)137 void GL_APIENTRY GL_BlendFunc(GLenum sfactor, GLenum dfactor)
138 {
139     Context *context = GetValidGlobalContext();
140     EVENT(context, GLBlendFunc, "context = %d, sfactor = %s, dfactor = %s", CID(context),
141           GLenumToString(GLenumGroup::BlendingFactor, sfactor),
142           GLenumToString(GLenumGroup::BlendingFactor, dfactor));
143 
144     if (context)
145     {
146         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
147         bool isCallValid =
148             (context->skipValidation() ||
149              ValidateBlendFunc(context, angle::EntryPoint::GLBlendFunc, sfactor, dfactor));
150         if (isCallValid)
151         {
152             context->blendFunc(sfactor, dfactor);
153         }
154         ANGLE_CAPTURE(BlendFunc, isCallValid, context, sfactor, dfactor);
155     }
156     else
157     {
158         GenerateContextLostErrorOnCurrentGlobalContext();
159     }
160 }
161 
GL_CallList(GLuint list)162 void GL_APIENTRY GL_CallList(GLuint list)
163 {
164     Context *context = GetValidGlobalContext();
165     EVENT(context, GLCallList, "context = %d, list = %u", CID(context), list);
166 
167     if (context)
168     {
169         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
170         bool isCallValid                                      = (context->skipValidation() ||
171                             ValidateCallList(context, angle::EntryPoint::GLCallList, list));
172         if (isCallValid)
173         {
174             context->callList(list);
175         }
176         ANGLE_CAPTURE(CallList, isCallValid, context, list);
177     }
178     else
179     {
180         GenerateContextLostErrorOnCurrentGlobalContext();
181     }
182 }
183 
GL_CallLists(GLsizei n,GLenum type,const void * lists)184 void GL_APIENTRY GL_CallLists(GLsizei n, GLenum type, const void *lists)
185 {
186     Context *context = GetValidGlobalContext();
187     EVENT(context, GLCallLists, "context = %d, n = %d, type = %s, lists = 0x%016" PRIxPTR "",
188           CID(context), n, GLenumToString(GLenumGroup::ListNameType, type), (uintptr_t)lists);
189 
190     if (context)
191     {
192         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
193         bool isCallValid =
194             (context->skipValidation() ||
195              ValidateCallLists(context, angle::EntryPoint::GLCallLists, n, type, lists));
196         if (isCallValid)
197         {
198             context->callLists(n, type, lists);
199         }
200         ANGLE_CAPTURE(CallLists, isCallValid, context, n, type, lists);
201     }
202     else
203     {
204         GenerateContextLostErrorOnCurrentGlobalContext();
205     }
206 }
207 
GL_Clear(GLbitfield mask)208 void GL_APIENTRY GL_Clear(GLbitfield mask)
209 {
210     Context *context = GetValidGlobalContext();
211     EVENT(context, GLClear, "context = %d, mask = %s", CID(context),
212           GLbitfieldToString(GLenumGroup::ClearBufferMask, mask).c_str());
213 
214     if (context)
215     {
216         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
217         bool isCallValid =
218             (context->skipValidation() || ValidateClear(context, angle::EntryPoint::GLClear, mask));
219         if (isCallValid)
220         {
221             context->clear(mask);
222         }
223         ANGLE_CAPTURE(Clear, isCallValid, context, mask);
224     }
225     else
226     {
227         GenerateContextLostErrorOnCurrentGlobalContext();
228     }
229 }
230 
GL_ClearAccum(GLfloat red,GLfloat green,GLfloat blue,GLfloat alpha)231 void GL_APIENTRY GL_ClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
232 {
233     Context *context = GetValidGlobalContext();
234     EVENT(context, GLClearAccum, "context = %d, red = %f, green = %f, blue = %f, alpha = %f",
235           CID(context), red, green, blue, alpha);
236 
237     if (context)
238     {
239         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
240         bool isCallValid =
241             (context->skipValidation() ||
242              ValidateClearAccum(context, angle::EntryPoint::GLClearAccum, red, green, blue, alpha));
243         if (isCallValid)
244         {
245             context->clearAccum(red, green, blue, alpha);
246         }
247         ANGLE_CAPTURE(ClearAccum, isCallValid, context, red, green, blue, alpha);
248     }
249     else
250     {
251         GenerateContextLostErrorOnCurrentGlobalContext();
252     }
253 }
254 
GL_ClearColor(GLfloat red,GLfloat green,GLfloat blue,GLfloat alpha)255 void GL_APIENTRY GL_ClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
256 {
257     Context *context = GetValidGlobalContext();
258     EVENT(context, GLClearColor, "context = %d, red = %f, green = %f, blue = %f, alpha = %f",
259           CID(context), red, green, blue, alpha);
260 
261     if (context)
262     {
263         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
264         bool isCallValid =
265             (context->skipValidation() ||
266              ValidateClearColor(context, angle::EntryPoint::GLClearColor, red, green, blue, alpha));
267         if (isCallValid)
268         {
269             context->clearColor(red, green, blue, alpha);
270         }
271         ANGLE_CAPTURE(ClearColor, isCallValid, context, red, green, blue, alpha);
272     }
273     else
274     {
275         GenerateContextLostErrorOnCurrentGlobalContext();
276     }
277 }
278 
GL_ClearDepth(GLdouble depth)279 void GL_APIENTRY GL_ClearDepth(GLdouble depth)
280 {
281     Context *context = GetValidGlobalContext();
282     EVENT(context, GLClearDepth, "context = %d, depth = %f", CID(context), depth);
283 
284     if (context)
285     {
286         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
287         bool isCallValid                                      = (context->skipValidation() ||
288                             ValidateClearDepth(context, angle::EntryPoint::GLClearDepth, depth));
289         if (isCallValid)
290         {
291             context->clearDepth(depth);
292         }
293         ANGLE_CAPTURE(ClearDepth, isCallValid, context, depth);
294     }
295     else
296     {
297         GenerateContextLostErrorOnCurrentGlobalContext();
298     }
299 }
300 
GL_ClearIndex(GLfloat c)301 void GL_APIENTRY GL_ClearIndex(GLfloat c)
302 {
303     Context *context = GetValidGlobalContext();
304     EVENT(context, GLClearIndex, "context = %d, c = %f", CID(context), c);
305 
306     if (context)
307     {
308         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
309         bool isCallValid                                      = (context->skipValidation() ||
310                             ValidateClearIndex(context, angle::EntryPoint::GLClearIndex, c));
311         if (isCallValid)
312         {
313             context->clearIndex(c);
314         }
315         ANGLE_CAPTURE(ClearIndex, isCallValid, context, c);
316     }
317     else
318     {
319         GenerateContextLostErrorOnCurrentGlobalContext();
320     }
321 }
322 
GL_ClearStencil(GLint s)323 void GL_APIENTRY GL_ClearStencil(GLint s)
324 {
325     Context *context = GetValidGlobalContext();
326     EVENT(context, GLClearStencil, "context = %d, s = %d", CID(context), s);
327 
328     if (context)
329     {
330         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
331         bool isCallValid                                      = (context->skipValidation() ||
332                             ValidateClearStencil(context, angle::EntryPoint::GLClearStencil, s));
333         if (isCallValid)
334         {
335             context->clearStencil(s);
336         }
337         ANGLE_CAPTURE(ClearStencil, isCallValid, context, s);
338     }
339     else
340     {
341         GenerateContextLostErrorOnCurrentGlobalContext();
342     }
343 }
344 
GL_ClipPlane(GLenum plane,const GLdouble * equation)345 void GL_APIENTRY GL_ClipPlane(GLenum plane, const GLdouble *equation)
346 {
347     Context *context = GetValidGlobalContext();
348     EVENT(context, GLClipPlane, "context = %d, plane = %s, equation = 0x%016" PRIxPTR "",
349           CID(context), GLenumToString(GLenumGroup::ClipPlaneName, plane), (uintptr_t)equation);
350 
351     if (context)
352     {
353         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
354         bool isCallValid =
355             (context->skipValidation() ||
356              ValidateClipPlane(context, angle::EntryPoint::GLClipPlane, plane, equation));
357         if (isCallValid)
358         {
359             context->clipPlane(plane, equation);
360         }
361         ANGLE_CAPTURE(ClipPlane, isCallValid, context, plane, equation);
362     }
363     else
364     {
365         GenerateContextLostErrorOnCurrentGlobalContext();
366     }
367 }
368 
GL_Color3b(GLbyte red,GLbyte green,GLbyte blue)369 void GL_APIENTRY GL_Color3b(GLbyte red, GLbyte green, GLbyte blue)
370 {
371     Context *context = GetValidGlobalContext();
372     EVENT(context, GLColor3b, "context = %d, red = %d, green = %d, blue = %d", CID(context), red,
373           green, blue);
374 
375     if (context)
376     {
377         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
378         bool isCallValid =
379             (context->skipValidation() ||
380              ValidateColor3b(context, angle::EntryPoint::GLColor3b, red, green, blue));
381         if (isCallValid)
382         {
383             context->color3b(red, green, blue);
384         }
385         ANGLE_CAPTURE(Color3b, isCallValid, context, red, green, blue);
386     }
387     else
388     {
389         GenerateContextLostErrorOnCurrentGlobalContext();
390     }
391 }
392 
GL_Color3bv(const GLbyte * v)393 void GL_APIENTRY GL_Color3bv(const GLbyte *v)
394 {
395     Context *context = GetValidGlobalContext();
396     EVENT(context, GLColor3bv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
397 
398     if (context)
399     {
400         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
401         bool isCallValid                                      = (context->skipValidation() ||
402                             ValidateColor3bv(context, angle::EntryPoint::GLColor3bv, v));
403         if (isCallValid)
404         {
405             context->color3bv(v);
406         }
407         ANGLE_CAPTURE(Color3bv, isCallValid, context, v);
408     }
409     else
410     {
411         GenerateContextLostErrorOnCurrentGlobalContext();
412     }
413 }
414 
GL_Color3d(GLdouble red,GLdouble green,GLdouble blue)415 void GL_APIENTRY GL_Color3d(GLdouble red, GLdouble green, GLdouble blue)
416 {
417     Context *context = GetValidGlobalContext();
418     EVENT(context, GLColor3d, "context = %d, red = %f, green = %f, blue = %f", CID(context), red,
419           green, blue);
420 
421     if (context)
422     {
423         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
424         bool isCallValid =
425             (context->skipValidation() ||
426              ValidateColor3d(context, angle::EntryPoint::GLColor3d, red, green, blue));
427         if (isCallValid)
428         {
429             context->color3d(red, green, blue);
430         }
431         ANGLE_CAPTURE(Color3d, isCallValid, context, red, green, blue);
432     }
433     else
434     {
435         GenerateContextLostErrorOnCurrentGlobalContext();
436     }
437 }
438 
GL_Color3dv(const GLdouble * v)439 void GL_APIENTRY GL_Color3dv(const GLdouble *v)
440 {
441     Context *context = GetValidGlobalContext();
442     EVENT(context, GLColor3dv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
443 
444     if (context)
445     {
446         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
447         bool isCallValid                                      = (context->skipValidation() ||
448                             ValidateColor3dv(context, angle::EntryPoint::GLColor3dv, v));
449         if (isCallValid)
450         {
451             context->color3dv(v);
452         }
453         ANGLE_CAPTURE(Color3dv, isCallValid, context, v);
454     }
455     else
456     {
457         GenerateContextLostErrorOnCurrentGlobalContext();
458     }
459 }
460 
GL_Color3f(GLfloat red,GLfloat green,GLfloat blue)461 void GL_APIENTRY GL_Color3f(GLfloat red, GLfloat green, GLfloat blue)
462 {
463     Context *context = GetValidGlobalContext();
464     EVENT(context, GLColor3f, "context = %d, red = %f, green = %f, blue = %f", CID(context), red,
465           green, blue);
466 
467     if (context)
468     {
469         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
470         bool isCallValid =
471             (context->skipValidation() ||
472              ValidateColor3f(context, angle::EntryPoint::GLColor3f, red, green, blue));
473         if (isCallValid)
474         {
475             context->color3f(red, green, blue);
476         }
477         ANGLE_CAPTURE(Color3f, isCallValid, context, red, green, blue);
478     }
479     else
480     {
481         GenerateContextLostErrorOnCurrentGlobalContext();
482     }
483 }
484 
GL_Color3fv(const GLfloat * v)485 void GL_APIENTRY GL_Color3fv(const GLfloat *v)
486 {
487     Context *context = GetValidGlobalContext();
488     EVENT(context, GLColor3fv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
489 
490     if (context)
491     {
492         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
493         bool isCallValid                                      = (context->skipValidation() ||
494                             ValidateColor3fv(context, angle::EntryPoint::GLColor3fv, v));
495         if (isCallValid)
496         {
497             context->color3fv(v);
498         }
499         ANGLE_CAPTURE(Color3fv, isCallValid, context, v);
500     }
501     else
502     {
503         GenerateContextLostErrorOnCurrentGlobalContext();
504     }
505 }
506 
GL_Color3i(GLint red,GLint green,GLint blue)507 void GL_APIENTRY GL_Color3i(GLint red, GLint green, GLint blue)
508 {
509     Context *context = GetValidGlobalContext();
510     EVENT(context, GLColor3i, "context = %d, red = %d, green = %d, blue = %d", CID(context), red,
511           green, blue);
512 
513     if (context)
514     {
515         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
516         bool isCallValid =
517             (context->skipValidation() ||
518              ValidateColor3i(context, angle::EntryPoint::GLColor3i, red, green, blue));
519         if (isCallValid)
520         {
521             context->color3i(red, green, blue);
522         }
523         ANGLE_CAPTURE(Color3i, isCallValid, context, red, green, blue);
524     }
525     else
526     {
527         GenerateContextLostErrorOnCurrentGlobalContext();
528     }
529 }
530 
GL_Color3iv(const GLint * v)531 void GL_APIENTRY GL_Color3iv(const GLint *v)
532 {
533     Context *context = GetValidGlobalContext();
534     EVENT(context, GLColor3iv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
535 
536     if (context)
537     {
538         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
539         bool isCallValid                                      = (context->skipValidation() ||
540                             ValidateColor3iv(context, angle::EntryPoint::GLColor3iv, v));
541         if (isCallValid)
542         {
543             context->color3iv(v);
544         }
545         ANGLE_CAPTURE(Color3iv, isCallValid, context, v);
546     }
547     else
548     {
549         GenerateContextLostErrorOnCurrentGlobalContext();
550     }
551 }
552 
GL_Color3s(GLshort red,GLshort green,GLshort blue)553 void GL_APIENTRY GL_Color3s(GLshort red, GLshort green, GLshort blue)
554 {
555     Context *context = GetValidGlobalContext();
556     EVENT(context, GLColor3s, "context = %d, red = %d, green = %d, blue = %d", CID(context), red,
557           green, blue);
558 
559     if (context)
560     {
561         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
562         bool isCallValid =
563             (context->skipValidation() ||
564              ValidateColor3s(context, angle::EntryPoint::GLColor3s, red, green, blue));
565         if (isCallValid)
566         {
567             context->color3s(red, green, blue);
568         }
569         ANGLE_CAPTURE(Color3s, isCallValid, context, red, green, blue);
570     }
571     else
572     {
573         GenerateContextLostErrorOnCurrentGlobalContext();
574     }
575 }
576 
GL_Color3sv(const GLshort * v)577 void GL_APIENTRY GL_Color3sv(const GLshort *v)
578 {
579     Context *context = GetValidGlobalContext();
580     EVENT(context, GLColor3sv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
581 
582     if (context)
583     {
584         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
585         bool isCallValid                                      = (context->skipValidation() ||
586                             ValidateColor3sv(context, angle::EntryPoint::GLColor3sv, v));
587         if (isCallValid)
588         {
589             context->color3sv(v);
590         }
591         ANGLE_CAPTURE(Color3sv, isCallValid, context, v);
592     }
593     else
594     {
595         GenerateContextLostErrorOnCurrentGlobalContext();
596     }
597 }
598 
GL_Color3ub(GLubyte red,GLubyte green,GLubyte blue)599 void GL_APIENTRY GL_Color3ub(GLubyte red, GLubyte green, GLubyte blue)
600 {
601     Context *context = GetValidGlobalContext();
602     EVENT(context, GLColor3ub, "context = %d, red = %d, green = %d, blue = %d", CID(context), red,
603           green, blue);
604 
605     if (context)
606     {
607         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
608         bool isCallValid =
609             (context->skipValidation() ||
610              ValidateColor3ub(context, angle::EntryPoint::GLColor3ub, red, green, blue));
611         if (isCallValid)
612         {
613             context->color3ub(red, green, blue);
614         }
615         ANGLE_CAPTURE(Color3ub, isCallValid, context, red, green, blue);
616     }
617     else
618     {
619         GenerateContextLostErrorOnCurrentGlobalContext();
620     }
621 }
622 
GL_Color3ubv(const GLubyte * v)623 void GL_APIENTRY GL_Color3ubv(const GLubyte *v)
624 {
625     Context *context = GetValidGlobalContext();
626     EVENT(context, GLColor3ubv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
627 
628     if (context)
629     {
630         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
631         bool isCallValid                                      = (context->skipValidation() ||
632                             ValidateColor3ubv(context, angle::EntryPoint::GLColor3ubv, v));
633         if (isCallValid)
634         {
635             context->color3ubv(v);
636         }
637         ANGLE_CAPTURE(Color3ubv, isCallValid, context, v);
638     }
639     else
640     {
641         GenerateContextLostErrorOnCurrentGlobalContext();
642     }
643 }
644 
GL_Color3ui(GLuint red,GLuint green,GLuint blue)645 void GL_APIENTRY GL_Color3ui(GLuint red, GLuint green, GLuint blue)
646 {
647     Context *context = GetValidGlobalContext();
648     EVENT(context, GLColor3ui, "context = %d, red = %u, green = %u, blue = %u", CID(context), red,
649           green, blue);
650 
651     if (context)
652     {
653         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
654         bool isCallValid =
655             (context->skipValidation() ||
656              ValidateColor3ui(context, angle::EntryPoint::GLColor3ui, red, green, blue));
657         if (isCallValid)
658         {
659             context->color3ui(red, green, blue);
660         }
661         ANGLE_CAPTURE(Color3ui, isCallValid, context, red, green, blue);
662     }
663     else
664     {
665         GenerateContextLostErrorOnCurrentGlobalContext();
666     }
667 }
668 
GL_Color3uiv(const GLuint * v)669 void GL_APIENTRY GL_Color3uiv(const GLuint *v)
670 {
671     Context *context = GetValidGlobalContext();
672     EVENT(context, GLColor3uiv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
673 
674     if (context)
675     {
676         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
677         bool isCallValid                                      = (context->skipValidation() ||
678                             ValidateColor3uiv(context, angle::EntryPoint::GLColor3uiv, v));
679         if (isCallValid)
680         {
681             context->color3uiv(v);
682         }
683         ANGLE_CAPTURE(Color3uiv, isCallValid, context, v);
684     }
685     else
686     {
687         GenerateContextLostErrorOnCurrentGlobalContext();
688     }
689 }
690 
GL_Color3us(GLushort red,GLushort green,GLushort blue)691 void GL_APIENTRY GL_Color3us(GLushort red, GLushort green, GLushort blue)
692 {
693     Context *context = GetValidGlobalContext();
694     EVENT(context, GLColor3us, "context = %d, red = %u, green = %u, blue = %u", CID(context), red,
695           green, blue);
696 
697     if (context)
698     {
699         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
700         bool isCallValid =
701             (context->skipValidation() ||
702              ValidateColor3us(context, angle::EntryPoint::GLColor3us, red, green, blue));
703         if (isCallValid)
704         {
705             context->color3us(red, green, blue);
706         }
707         ANGLE_CAPTURE(Color3us, isCallValid, context, red, green, blue);
708     }
709     else
710     {
711         GenerateContextLostErrorOnCurrentGlobalContext();
712     }
713 }
714 
GL_Color3usv(const GLushort * v)715 void GL_APIENTRY GL_Color3usv(const GLushort *v)
716 {
717     Context *context = GetValidGlobalContext();
718     EVENT(context, GLColor3usv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
719 
720     if (context)
721     {
722         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
723         bool isCallValid                                      = (context->skipValidation() ||
724                             ValidateColor3usv(context, angle::EntryPoint::GLColor3usv, v));
725         if (isCallValid)
726         {
727             context->color3usv(v);
728         }
729         ANGLE_CAPTURE(Color3usv, isCallValid, context, v);
730     }
731     else
732     {
733         GenerateContextLostErrorOnCurrentGlobalContext();
734     }
735 }
736 
GL_Color4b(GLbyte red,GLbyte green,GLbyte blue,GLbyte alpha)737 void GL_APIENTRY GL_Color4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
738 {
739     Context *context = GetValidGlobalContext();
740     EVENT(context, GLColor4b, "context = %d, red = %d, green = %d, blue = %d, alpha = %d",
741           CID(context), red, green, blue, alpha);
742 
743     if (context)
744     {
745         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
746         bool isCallValid =
747             (context->skipValidation() ||
748              ValidateColor4b(context, angle::EntryPoint::GLColor4b, red, green, blue, alpha));
749         if (isCallValid)
750         {
751             context->color4b(red, green, blue, alpha);
752         }
753         ANGLE_CAPTURE(Color4b, isCallValid, context, red, green, blue, alpha);
754     }
755     else
756     {
757         GenerateContextLostErrorOnCurrentGlobalContext();
758     }
759 }
760 
GL_Color4bv(const GLbyte * v)761 void GL_APIENTRY GL_Color4bv(const GLbyte *v)
762 {
763     Context *context = GetValidGlobalContext();
764     EVENT(context, GLColor4bv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
765 
766     if (context)
767     {
768         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
769         bool isCallValid                                      = (context->skipValidation() ||
770                             ValidateColor4bv(context, angle::EntryPoint::GLColor4bv, v));
771         if (isCallValid)
772         {
773             context->color4bv(v);
774         }
775         ANGLE_CAPTURE(Color4bv, isCallValid, context, v);
776     }
777     else
778     {
779         GenerateContextLostErrorOnCurrentGlobalContext();
780     }
781 }
782 
GL_Color4d(GLdouble red,GLdouble green,GLdouble blue,GLdouble alpha)783 void GL_APIENTRY GL_Color4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
784 {
785     Context *context = GetValidGlobalContext();
786     EVENT(context, GLColor4d, "context = %d, red = %f, green = %f, blue = %f, alpha = %f",
787           CID(context), red, green, blue, alpha);
788 
789     if (context)
790     {
791         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
792         bool isCallValid =
793             (context->skipValidation() ||
794              ValidateColor4d(context, angle::EntryPoint::GLColor4d, red, green, blue, alpha));
795         if (isCallValid)
796         {
797             context->color4d(red, green, blue, alpha);
798         }
799         ANGLE_CAPTURE(Color4d, isCallValid, context, red, green, blue, alpha);
800     }
801     else
802     {
803         GenerateContextLostErrorOnCurrentGlobalContext();
804     }
805 }
806 
GL_Color4dv(const GLdouble * v)807 void GL_APIENTRY GL_Color4dv(const GLdouble *v)
808 {
809     Context *context = GetValidGlobalContext();
810     EVENT(context, GLColor4dv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
811 
812     if (context)
813     {
814         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
815         bool isCallValid                                      = (context->skipValidation() ||
816                             ValidateColor4dv(context, angle::EntryPoint::GLColor4dv, v));
817         if (isCallValid)
818         {
819             context->color4dv(v);
820         }
821         ANGLE_CAPTURE(Color4dv, isCallValid, context, v);
822     }
823     else
824     {
825         GenerateContextLostErrorOnCurrentGlobalContext();
826     }
827 }
828 
GL_Color4f(GLfloat red,GLfloat green,GLfloat blue,GLfloat alpha)829 void GL_APIENTRY GL_Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
830 {
831     Context *context = GetValidGlobalContext();
832     EVENT(context, GLColor4f, "context = %d, red = %f, green = %f, blue = %f, alpha = %f",
833           CID(context), red, green, blue, alpha);
834 
835     if (context)
836     {
837         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
838         bool isCallValid =
839             (context->skipValidation() ||
840              ValidateColor4f(context, angle::EntryPoint::GLColor4f, red, green, blue, alpha));
841         if (isCallValid)
842         {
843             context->color4f(red, green, blue, alpha);
844         }
845         ANGLE_CAPTURE(Color4f, isCallValid, context, red, green, blue, alpha);
846     }
847     else
848     {
849         GenerateContextLostErrorOnCurrentGlobalContext();
850     }
851 }
852 
GL_Color4fv(const GLfloat * v)853 void GL_APIENTRY GL_Color4fv(const GLfloat *v)
854 {
855     Context *context = GetValidGlobalContext();
856     EVENT(context, GLColor4fv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
857 
858     if (context)
859     {
860         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
861         bool isCallValid                                      = (context->skipValidation() ||
862                             ValidateColor4fv(context, angle::EntryPoint::GLColor4fv, v));
863         if (isCallValid)
864         {
865             context->color4fv(v);
866         }
867         ANGLE_CAPTURE(Color4fv, isCallValid, context, v);
868     }
869     else
870     {
871         GenerateContextLostErrorOnCurrentGlobalContext();
872     }
873 }
874 
GL_Color4i(GLint red,GLint green,GLint blue,GLint alpha)875 void GL_APIENTRY GL_Color4i(GLint red, GLint green, GLint blue, GLint alpha)
876 {
877     Context *context = GetValidGlobalContext();
878     EVENT(context, GLColor4i, "context = %d, red = %d, green = %d, blue = %d, alpha = %d",
879           CID(context), red, green, blue, alpha);
880 
881     if (context)
882     {
883         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
884         bool isCallValid =
885             (context->skipValidation() ||
886              ValidateColor4i(context, angle::EntryPoint::GLColor4i, red, green, blue, alpha));
887         if (isCallValid)
888         {
889             context->color4i(red, green, blue, alpha);
890         }
891         ANGLE_CAPTURE(Color4i, isCallValid, context, red, green, blue, alpha);
892     }
893     else
894     {
895         GenerateContextLostErrorOnCurrentGlobalContext();
896     }
897 }
898 
GL_Color4iv(const GLint * v)899 void GL_APIENTRY GL_Color4iv(const GLint *v)
900 {
901     Context *context = GetValidGlobalContext();
902     EVENT(context, GLColor4iv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
903 
904     if (context)
905     {
906         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
907         bool isCallValid                                      = (context->skipValidation() ||
908                             ValidateColor4iv(context, angle::EntryPoint::GLColor4iv, v));
909         if (isCallValid)
910         {
911             context->color4iv(v);
912         }
913         ANGLE_CAPTURE(Color4iv, isCallValid, context, v);
914     }
915     else
916     {
917         GenerateContextLostErrorOnCurrentGlobalContext();
918     }
919 }
920 
GL_Color4s(GLshort red,GLshort green,GLshort blue,GLshort alpha)921 void GL_APIENTRY GL_Color4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
922 {
923     Context *context = GetValidGlobalContext();
924     EVENT(context, GLColor4s, "context = %d, red = %d, green = %d, blue = %d, alpha = %d",
925           CID(context), red, green, blue, alpha);
926 
927     if (context)
928     {
929         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
930         bool isCallValid =
931             (context->skipValidation() ||
932              ValidateColor4s(context, angle::EntryPoint::GLColor4s, red, green, blue, alpha));
933         if (isCallValid)
934         {
935             context->color4s(red, green, blue, alpha);
936         }
937         ANGLE_CAPTURE(Color4s, isCallValid, context, red, green, blue, alpha);
938     }
939     else
940     {
941         GenerateContextLostErrorOnCurrentGlobalContext();
942     }
943 }
944 
GL_Color4sv(const GLshort * v)945 void GL_APIENTRY GL_Color4sv(const GLshort *v)
946 {
947     Context *context = GetValidGlobalContext();
948     EVENT(context, GLColor4sv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
949 
950     if (context)
951     {
952         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
953         bool isCallValid                                      = (context->skipValidation() ||
954                             ValidateColor4sv(context, angle::EntryPoint::GLColor4sv, v));
955         if (isCallValid)
956         {
957             context->color4sv(v);
958         }
959         ANGLE_CAPTURE(Color4sv, isCallValid, context, v);
960     }
961     else
962     {
963         GenerateContextLostErrorOnCurrentGlobalContext();
964     }
965 }
966 
GL_Color4ub(GLubyte red,GLubyte green,GLubyte blue,GLubyte alpha)967 void GL_APIENTRY GL_Color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
968 {
969     Context *context = GetValidGlobalContext();
970     EVENT(context, GLColor4ub, "context = %d, red = %d, green = %d, blue = %d, alpha = %d",
971           CID(context), red, green, blue, alpha);
972 
973     if (context)
974     {
975         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
976         bool isCallValid =
977             (context->skipValidation() ||
978              ValidateColor4ub(context, angle::EntryPoint::GLColor4ub, red, green, blue, alpha));
979         if (isCallValid)
980         {
981             context->color4ub(red, green, blue, alpha);
982         }
983         ANGLE_CAPTURE(Color4ub, isCallValid, context, red, green, blue, alpha);
984     }
985     else
986     {
987         GenerateContextLostErrorOnCurrentGlobalContext();
988     }
989 }
990 
GL_Color4ubv(const GLubyte * v)991 void GL_APIENTRY GL_Color4ubv(const GLubyte *v)
992 {
993     Context *context = GetValidGlobalContext();
994     EVENT(context, GLColor4ubv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
995 
996     if (context)
997     {
998         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
999         bool isCallValid                                      = (context->skipValidation() ||
1000                             ValidateColor4ubv(context, angle::EntryPoint::GLColor4ubv, v));
1001         if (isCallValid)
1002         {
1003             context->color4ubv(v);
1004         }
1005         ANGLE_CAPTURE(Color4ubv, isCallValid, context, v);
1006     }
1007     else
1008     {
1009         GenerateContextLostErrorOnCurrentGlobalContext();
1010     }
1011 }
1012 
GL_Color4ui(GLuint red,GLuint green,GLuint blue,GLuint alpha)1013 void GL_APIENTRY GL_Color4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
1014 {
1015     Context *context = GetValidGlobalContext();
1016     EVENT(context, GLColor4ui, "context = %d, red = %u, green = %u, blue = %u, alpha = %u",
1017           CID(context), red, green, blue, alpha);
1018 
1019     if (context)
1020     {
1021         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1022         bool isCallValid =
1023             (context->skipValidation() ||
1024              ValidateColor4ui(context, angle::EntryPoint::GLColor4ui, red, green, blue, alpha));
1025         if (isCallValid)
1026         {
1027             context->color4ui(red, green, blue, alpha);
1028         }
1029         ANGLE_CAPTURE(Color4ui, isCallValid, context, red, green, blue, alpha);
1030     }
1031     else
1032     {
1033         GenerateContextLostErrorOnCurrentGlobalContext();
1034     }
1035 }
1036 
GL_Color4uiv(const GLuint * v)1037 void GL_APIENTRY GL_Color4uiv(const GLuint *v)
1038 {
1039     Context *context = GetValidGlobalContext();
1040     EVENT(context, GLColor4uiv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
1041 
1042     if (context)
1043     {
1044         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1045         bool isCallValid                                      = (context->skipValidation() ||
1046                             ValidateColor4uiv(context, angle::EntryPoint::GLColor4uiv, v));
1047         if (isCallValid)
1048         {
1049             context->color4uiv(v);
1050         }
1051         ANGLE_CAPTURE(Color4uiv, isCallValid, context, v);
1052     }
1053     else
1054     {
1055         GenerateContextLostErrorOnCurrentGlobalContext();
1056     }
1057 }
1058 
GL_Color4us(GLushort red,GLushort green,GLushort blue,GLushort alpha)1059 void GL_APIENTRY GL_Color4us(GLushort red, GLushort green, GLushort blue, GLushort alpha)
1060 {
1061     Context *context = GetValidGlobalContext();
1062     EVENT(context, GLColor4us, "context = %d, red = %u, green = %u, blue = %u, alpha = %u",
1063           CID(context), red, green, blue, alpha);
1064 
1065     if (context)
1066     {
1067         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1068         bool isCallValid =
1069             (context->skipValidation() ||
1070              ValidateColor4us(context, angle::EntryPoint::GLColor4us, red, green, blue, alpha));
1071         if (isCallValid)
1072         {
1073             context->color4us(red, green, blue, alpha);
1074         }
1075         ANGLE_CAPTURE(Color4us, isCallValid, context, red, green, blue, alpha);
1076     }
1077     else
1078     {
1079         GenerateContextLostErrorOnCurrentGlobalContext();
1080     }
1081 }
1082 
GL_Color4usv(const GLushort * v)1083 void GL_APIENTRY GL_Color4usv(const GLushort *v)
1084 {
1085     Context *context = GetValidGlobalContext();
1086     EVENT(context, GLColor4usv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
1087 
1088     if (context)
1089     {
1090         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1091         bool isCallValid                                      = (context->skipValidation() ||
1092                             ValidateColor4usv(context, angle::EntryPoint::GLColor4usv, v));
1093         if (isCallValid)
1094         {
1095             context->color4usv(v);
1096         }
1097         ANGLE_CAPTURE(Color4usv, isCallValid, context, v);
1098     }
1099     else
1100     {
1101         GenerateContextLostErrorOnCurrentGlobalContext();
1102     }
1103 }
1104 
GL_ColorMask(GLboolean red,GLboolean green,GLboolean blue,GLboolean alpha)1105 void GL_APIENTRY GL_ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
1106 {
1107     Context *context = GetValidGlobalContext();
1108     EVENT(context, GLColorMask, "context = %d, red = %s, green = %s, blue = %s, alpha = %s",
1109           CID(context), GLbooleanToString(red), GLbooleanToString(green), GLbooleanToString(blue),
1110           GLbooleanToString(alpha));
1111 
1112     if (context)
1113     {
1114         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1115         bool isCallValid =
1116             (context->skipValidation() ||
1117              ValidateColorMask(context, angle::EntryPoint::GLColorMask, red, green, blue, alpha));
1118         if (isCallValid)
1119         {
1120             context->colorMask(red, green, blue, alpha);
1121         }
1122         ANGLE_CAPTURE(ColorMask, isCallValid, context, red, green, blue, alpha);
1123     }
1124     else
1125     {
1126         GenerateContextLostErrorOnCurrentGlobalContext();
1127     }
1128 }
1129 
GL_ColorMaterial(GLenum face,GLenum mode)1130 void GL_APIENTRY GL_ColorMaterial(GLenum face, GLenum mode)
1131 {
1132     Context *context = GetValidGlobalContext();
1133     EVENT(context, GLColorMaterial, "context = %d, face = %s, mode = %s", CID(context),
1134           GLenumToString(GLenumGroup::MaterialFace, face),
1135           GLenumToString(GLenumGroup::ColorMaterialParameter, mode));
1136 
1137     if (context)
1138     {
1139         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1140         bool isCallValid =
1141             (context->skipValidation() ||
1142              ValidateColorMaterial(context, angle::EntryPoint::GLColorMaterial, face, mode));
1143         if (isCallValid)
1144         {
1145             context->colorMaterial(face, mode);
1146         }
1147         ANGLE_CAPTURE(ColorMaterial, isCallValid, context, face, mode);
1148     }
1149     else
1150     {
1151         GenerateContextLostErrorOnCurrentGlobalContext();
1152     }
1153 }
1154 
GL_CopyPixels(GLint x,GLint y,GLsizei width,GLsizei height,GLenum type)1155 void GL_APIENTRY GL_CopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
1156 {
1157     Context *context = GetValidGlobalContext();
1158     EVENT(context, GLCopyPixels, "context = %d, x = %d, y = %d, width = %d, height = %d, type = %s",
1159           CID(context), x, y, width, height, GLenumToString(GLenumGroup::PixelCopyType, type));
1160 
1161     if (context)
1162     {
1163         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1164         bool isCallValid                                      = (context->skipValidation() ||
1165                             ValidateCopyPixels(context, angle::EntryPoint::GLCopyPixels, x, y,
1166                                                width, height, type));
1167         if (isCallValid)
1168         {
1169             context->copyPixels(x, y, width, height, type);
1170         }
1171         ANGLE_CAPTURE(CopyPixels, isCallValid, context, x, y, width, height, type);
1172     }
1173     else
1174     {
1175         GenerateContextLostErrorOnCurrentGlobalContext();
1176     }
1177 }
1178 
GL_CullFace(GLenum mode)1179 void GL_APIENTRY GL_CullFace(GLenum mode)
1180 {
1181     Context *context = GetValidGlobalContext();
1182     EVENT(context, GLCullFace, "context = %d, mode = %s", CID(context),
1183           GLenumToString(GLenumGroup::CullFaceMode, mode));
1184 
1185     if (context)
1186     {
1187         CullFaceMode modePacked                               = PackParam<CullFaceMode>(mode);
1188         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1189         bool isCallValid                                      = (context->skipValidation() ||
1190                             ValidateCullFace(context, angle::EntryPoint::GLCullFace, modePacked));
1191         if (isCallValid)
1192         {
1193             context->cullFace(modePacked);
1194         }
1195         ANGLE_CAPTURE(CullFace, isCallValid, context, modePacked);
1196     }
1197     else
1198     {
1199         GenerateContextLostErrorOnCurrentGlobalContext();
1200     }
1201 }
1202 
GL_DeleteLists(GLuint list,GLsizei range)1203 void GL_APIENTRY GL_DeleteLists(GLuint list, GLsizei range)
1204 {
1205     Context *context = GetValidGlobalContext();
1206     EVENT(context, GLDeleteLists, "context = %d, list = %u, range = %d", CID(context), list, range);
1207 
1208     if (context)
1209     {
1210         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1211         bool isCallValid =
1212             (context->skipValidation() ||
1213              ValidateDeleteLists(context, angle::EntryPoint::GLDeleteLists, list, range));
1214         if (isCallValid)
1215         {
1216             context->deleteLists(list, range);
1217         }
1218         ANGLE_CAPTURE(DeleteLists, isCallValid, context, list, range);
1219     }
1220     else
1221     {
1222         GenerateContextLostErrorOnCurrentGlobalContext();
1223     }
1224 }
1225 
GL_DepthFunc(GLenum func)1226 void GL_APIENTRY GL_DepthFunc(GLenum func)
1227 {
1228     Context *context = GetValidGlobalContext();
1229     EVENT(context, GLDepthFunc, "context = %d, func = %s", CID(context),
1230           GLenumToString(GLenumGroup::DepthFunction, func));
1231 
1232     if (context)
1233     {
1234         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1235         bool isCallValid                                      = (context->skipValidation() ||
1236                             ValidateDepthFunc(context, angle::EntryPoint::GLDepthFunc, func));
1237         if (isCallValid)
1238         {
1239             context->depthFunc(func);
1240         }
1241         ANGLE_CAPTURE(DepthFunc, isCallValid, context, func);
1242     }
1243     else
1244     {
1245         GenerateContextLostErrorOnCurrentGlobalContext();
1246     }
1247 }
1248 
GL_DepthMask(GLboolean flag)1249 void GL_APIENTRY GL_DepthMask(GLboolean flag)
1250 {
1251     Context *context = GetValidGlobalContext();
1252     EVENT(context, GLDepthMask, "context = %d, flag = %s", CID(context), GLbooleanToString(flag));
1253 
1254     if (context)
1255     {
1256         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1257         bool isCallValid                                      = (context->skipValidation() ||
1258                             ValidateDepthMask(context, angle::EntryPoint::GLDepthMask, flag));
1259         if (isCallValid)
1260         {
1261             context->depthMask(flag);
1262         }
1263         ANGLE_CAPTURE(DepthMask, isCallValid, context, flag);
1264     }
1265     else
1266     {
1267         GenerateContextLostErrorOnCurrentGlobalContext();
1268     }
1269 }
1270 
GL_DepthRange(GLdouble n,GLdouble f)1271 void GL_APIENTRY GL_DepthRange(GLdouble n, GLdouble f)
1272 {
1273     Context *context = GetValidGlobalContext();
1274     EVENT(context, GLDepthRange, "context = %d, n = %f, f = %f", CID(context), n, f);
1275 
1276     if (context)
1277     {
1278         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1279         bool isCallValid                                      = (context->skipValidation() ||
1280                             ValidateDepthRange(context, angle::EntryPoint::GLDepthRange, n, f));
1281         if (isCallValid)
1282         {
1283             context->depthRange(n, f);
1284         }
1285         ANGLE_CAPTURE(DepthRange, isCallValid, context, n, f);
1286     }
1287     else
1288     {
1289         GenerateContextLostErrorOnCurrentGlobalContext();
1290     }
1291 }
1292 
GL_Disable(GLenum cap)1293 void GL_APIENTRY GL_Disable(GLenum cap)
1294 {
1295     Context *context = GetValidGlobalContext();
1296     EVENT(context, GLDisable, "context = %d, cap = %s", CID(context),
1297           GLenumToString(GLenumGroup::EnableCap, cap));
1298 
1299     if (context)
1300     {
1301         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1302         bool isCallValid                                      = (context->skipValidation() ||
1303                             ValidateDisable(context, angle::EntryPoint::GLDisable, cap));
1304         if (isCallValid)
1305         {
1306             context->disable(cap);
1307         }
1308         ANGLE_CAPTURE(Disable, isCallValid, context, cap);
1309     }
1310     else
1311     {
1312         GenerateContextLostErrorOnCurrentGlobalContext();
1313     }
1314 }
1315 
GL_DrawBuffer(GLenum buf)1316 void GL_APIENTRY GL_DrawBuffer(GLenum buf)
1317 {
1318     Context *context = GetValidGlobalContext();
1319     EVENT(context, GLDrawBuffer, "context = %d, buf = %s", CID(context),
1320           GLenumToString(GLenumGroup::DrawBufferMode, buf));
1321 
1322     if (context)
1323     {
1324         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1325         bool isCallValid                                      = (context->skipValidation() ||
1326                             ValidateDrawBuffer(context, angle::EntryPoint::GLDrawBuffer, buf));
1327         if (isCallValid)
1328         {
1329             context->drawBuffer(buf);
1330         }
1331         ANGLE_CAPTURE(DrawBuffer, isCallValid, context, buf);
1332     }
1333     else
1334     {
1335         GenerateContextLostErrorOnCurrentGlobalContext();
1336     }
1337 }
1338 
1339 void GL_APIENTRY
GL_DrawPixels(GLsizei width,GLsizei height,GLenum format,GLenum type,const void * pixels)1340 GL_DrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels)
1341 {
1342     Context *context = GetValidGlobalContext();
1343     EVENT(context, GLDrawPixels,
1344           "context = %d, width = %d, height = %d, format = %s, type = %s, pixels = 0x%016" PRIxPTR
1345           "",
1346           CID(context), width, height, GLenumToString(GLenumGroup::PixelFormat, format),
1347           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
1348 
1349     if (context)
1350     {
1351         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1352         bool isCallValid                                      = (context->skipValidation() ||
1353                             ValidateDrawPixels(context, angle::EntryPoint::GLDrawPixels, width,
1354                                                height, format, type, pixels));
1355         if (isCallValid)
1356         {
1357             context->drawPixels(width, height, format, type, pixels);
1358         }
1359         ANGLE_CAPTURE(DrawPixels, isCallValid, context, width, height, format, type, pixels);
1360     }
1361     else
1362     {
1363         GenerateContextLostErrorOnCurrentGlobalContext();
1364     }
1365 }
1366 
GL_EdgeFlag(GLboolean flag)1367 void GL_APIENTRY GL_EdgeFlag(GLboolean flag)
1368 {
1369     Context *context = GetValidGlobalContext();
1370     EVENT(context, GLEdgeFlag, "context = %d, flag = %s", CID(context), GLbooleanToString(flag));
1371 
1372     if (context)
1373     {
1374         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1375         bool isCallValid                                      = (context->skipValidation() ||
1376                             ValidateEdgeFlag(context, angle::EntryPoint::GLEdgeFlag, flag));
1377         if (isCallValid)
1378         {
1379             context->edgeFlag(flag);
1380         }
1381         ANGLE_CAPTURE(EdgeFlag, isCallValid, context, flag);
1382     }
1383     else
1384     {
1385         GenerateContextLostErrorOnCurrentGlobalContext();
1386     }
1387 }
1388 
GL_EdgeFlagv(const GLboolean * flag)1389 void GL_APIENTRY GL_EdgeFlagv(const GLboolean *flag)
1390 {
1391     Context *context = GetValidGlobalContext();
1392     EVENT(context, GLEdgeFlagv, "context = %d, flag = 0x%016" PRIxPTR "", CID(context),
1393           (uintptr_t)flag);
1394 
1395     if (context)
1396     {
1397         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1398         bool isCallValid                                      = (context->skipValidation() ||
1399                             ValidateEdgeFlagv(context, angle::EntryPoint::GLEdgeFlagv, flag));
1400         if (isCallValid)
1401         {
1402             context->edgeFlagv(flag);
1403         }
1404         ANGLE_CAPTURE(EdgeFlagv, isCallValid, context, flag);
1405     }
1406     else
1407     {
1408         GenerateContextLostErrorOnCurrentGlobalContext();
1409     }
1410 }
1411 
GL_Enable(GLenum cap)1412 void GL_APIENTRY GL_Enable(GLenum cap)
1413 {
1414     Context *context = GetValidGlobalContext();
1415     EVENT(context, GLEnable, "context = %d, cap = %s", CID(context),
1416           GLenumToString(GLenumGroup::EnableCap, cap));
1417 
1418     if (context)
1419     {
1420         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1421         bool isCallValid                                      = (context->skipValidation() ||
1422                             ValidateEnable(context, angle::EntryPoint::GLEnable, cap));
1423         if (isCallValid)
1424         {
1425             context->enable(cap);
1426         }
1427         ANGLE_CAPTURE(Enable, isCallValid, context, cap);
1428     }
1429     else
1430     {
1431         GenerateContextLostErrorOnCurrentGlobalContext();
1432     }
1433 }
1434 
GL_End()1435 void GL_APIENTRY GL_End()
1436 {
1437     Context *context = GetValidGlobalContext();
1438     EVENT(context, GLEnd, "context = %d", CID(context));
1439 
1440     if (context)
1441     {
1442         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1443         bool isCallValid =
1444             (context->skipValidation() || ValidateEnd(context, angle::EntryPoint::GLEnd));
1445         if (isCallValid)
1446         {
1447             context->end();
1448         }
1449         ANGLE_CAPTURE(End, isCallValid, context);
1450     }
1451     else
1452     {
1453         GenerateContextLostErrorOnCurrentGlobalContext();
1454     }
1455 }
1456 
GL_EndList()1457 void GL_APIENTRY GL_EndList()
1458 {
1459     Context *context = GetValidGlobalContext();
1460     EVENT(context, GLEndList, "context = %d", CID(context));
1461 
1462     if (context)
1463     {
1464         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1465         bool isCallValid =
1466             (context->skipValidation() || ValidateEndList(context, angle::EntryPoint::GLEndList));
1467         if (isCallValid)
1468         {
1469             context->endList();
1470         }
1471         ANGLE_CAPTURE(EndList, isCallValid, context);
1472     }
1473     else
1474     {
1475         GenerateContextLostErrorOnCurrentGlobalContext();
1476     }
1477 }
1478 
GL_EvalCoord1d(GLdouble u)1479 void GL_APIENTRY GL_EvalCoord1d(GLdouble u)
1480 {
1481     Context *context = GetValidGlobalContext();
1482     EVENT(context, GLEvalCoord1d, "context = %d, u = %f", CID(context), u);
1483 
1484     if (context)
1485     {
1486         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1487         bool isCallValid                                      = (context->skipValidation() ||
1488                             ValidateEvalCoord1d(context, angle::EntryPoint::GLEvalCoord1d, u));
1489         if (isCallValid)
1490         {
1491             context->evalCoord1d(u);
1492         }
1493         ANGLE_CAPTURE(EvalCoord1d, isCallValid, context, u);
1494     }
1495     else
1496     {
1497         GenerateContextLostErrorOnCurrentGlobalContext();
1498     }
1499 }
1500 
GL_EvalCoord1dv(const GLdouble * u)1501 void GL_APIENTRY GL_EvalCoord1dv(const GLdouble *u)
1502 {
1503     Context *context = GetValidGlobalContext();
1504     EVENT(context, GLEvalCoord1dv, "context = %d, u = 0x%016" PRIxPTR "", CID(context),
1505           (uintptr_t)u);
1506 
1507     if (context)
1508     {
1509         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1510         bool isCallValid                                      = (context->skipValidation() ||
1511                             ValidateEvalCoord1dv(context, angle::EntryPoint::GLEvalCoord1dv, u));
1512         if (isCallValid)
1513         {
1514             context->evalCoord1dv(u);
1515         }
1516         ANGLE_CAPTURE(EvalCoord1dv, isCallValid, context, u);
1517     }
1518     else
1519     {
1520         GenerateContextLostErrorOnCurrentGlobalContext();
1521     }
1522 }
1523 
GL_EvalCoord1f(GLfloat u)1524 void GL_APIENTRY GL_EvalCoord1f(GLfloat u)
1525 {
1526     Context *context = GetValidGlobalContext();
1527     EVENT(context, GLEvalCoord1f, "context = %d, u = %f", CID(context), u);
1528 
1529     if (context)
1530     {
1531         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1532         bool isCallValid                                      = (context->skipValidation() ||
1533                             ValidateEvalCoord1f(context, angle::EntryPoint::GLEvalCoord1f, u));
1534         if (isCallValid)
1535         {
1536             context->evalCoord1f(u);
1537         }
1538         ANGLE_CAPTURE(EvalCoord1f, isCallValid, context, u);
1539     }
1540     else
1541     {
1542         GenerateContextLostErrorOnCurrentGlobalContext();
1543     }
1544 }
1545 
GL_EvalCoord1fv(const GLfloat * u)1546 void GL_APIENTRY GL_EvalCoord1fv(const GLfloat *u)
1547 {
1548     Context *context = GetValidGlobalContext();
1549     EVENT(context, GLEvalCoord1fv, "context = %d, u = 0x%016" PRIxPTR "", CID(context),
1550           (uintptr_t)u);
1551 
1552     if (context)
1553     {
1554         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1555         bool isCallValid                                      = (context->skipValidation() ||
1556                             ValidateEvalCoord1fv(context, angle::EntryPoint::GLEvalCoord1fv, u));
1557         if (isCallValid)
1558         {
1559             context->evalCoord1fv(u);
1560         }
1561         ANGLE_CAPTURE(EvalCoord1fv, isCallValid, context, u);
1562     }
1563     else
1564     {
1565         GenerateContextLostErrorOnCurrentGlobalContext();
1566     }
1567 }
1568 
GL_EvalCoord2d(GLdouble u,GLdouble v)1569 void GL_APIENTRY GL_EvalCoord2d(GLdouble u, GLdouble v)
1570 {
1571     Context *context = GetValidGlobalContext();
1572     EVENT(context, GLEvalCoord2d, "context = %d, u = %f, v = %f", CID(context), u, v);
1573 
1574     if (context)
1575     {
1576         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1577         bool isCallValid                                      = (context->skipValidation() ||
1578                             ValidateEvalCoord2d(context, angle::EntryPoint::GLEvalCoord2d, u, v));
1579         if (isCallValid)
1580         {
1581             context->evalCoord2d(u, v);
1582         }
1583         ANGLE_CAPTURE(EvalCoord2d, isCallValid, context, u, v);
1584     }
1585     else
1586     {
1587         GenerateContextLostErrorOnCurrentGlobalContext();
1588     }
1589 }
1590 
GL_EvalCoord2dv(const GLdouble * u)1591 void GL_APIENTRY GL_EvalCoord2dv(const GLdouble *u)
1592 {
1593     Context *context = GetValidGlobalContext();
1594     EVENT(context, GLEvalCoord2dv, "context = %d, u = 0x%016" PRIxPTR "", CID(context),
1595           (uintptr_t)u);
1596 
1597     if (context)
1598     {
1599         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1600         bool isCallValid                                      = (context->skipValidation() ||
1601                             ValidateEvalCoord2dv(context, angle::EntryPoint::GLEvalCoord2dv, u));
1602         if (isCallValid)
1603         {
1604             context->evalCoord2dv(u);
1605         }
1606         ANGLE_CAPTURE(EvalCoord2dv, isCallValid, context, u);
1607     }
1608     else
1609     {
1610         GenerateContextLostErrorOnCurrentGlobalContext();
1611     }
1612 }
1613 
GL_EvalCoord2f(GLfloat u,GLfloat v)1614 void GL_APIENTRY GL_EvalCoord2f(GLfloat u, GLfloat v)
1615 {
1616     Context *context = GetValidGlobalContext();
1617     EVENT(context, GLEvalCoord2f, "context = %d, u = %f, v = %f", CID(context), u, v);
1618 
1619     if (context)
1620     {
1621         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1622         bool isCallValid                                      = (context->skipValidation() ||
1623                             ValidateEvalCoord2f(context, angle::EntryPoint::GLEvalCoord2f, u, v));
1624         if (isCallValid)
1625         {
1626             context->evalCoord2f(u, v);
1627         }
1628         ANGLE_CAPTURE(EvalCoord2f, isCallValid, context, u, v);
1629     }
1630     else
1631     {
1632         GenerateContextLostErrorOnCurrentGlobalContext();
1633     }
1634 }
1635 
GL_EvalCoord2fv(const GLfloat * u)1636 void GL_APIENTRY GL_EvalCoord2fv(const GLfloat *u)
1637 {
1638     Context *context = GetValidGlobalContext();
1639     EVENT(context, GLEvalCoord2fv, "context = %d, u = 0x%016" PRIxPTR "", CID(context),
1640           (uintptr_t)u);
1641 
1642     if (context)
1643     {
1644         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1645         bool isCallValid                                      = (context->skipValidation() ||
1646                             ValidateEvalCoord2fv(context, angle::EntryPoint::GLEvalCoord2fv, u));
1647         if (isCallValid)
1648         {
1649             context->evalCoord2fv(u);
1650         }
1651         ANGLE_CAPTURE(EvalCoord2fv, isCallValid, context, u);
1652     }
1653     else
1654     {
1655         GenerateContextLostErrorOnCurrentGlobalContext();
1656     }
1657 }
1658 
GL_EvalMesh1(GLenum mode,GLint i1,GLint i2)1659 void GL_APIENTRY GL_EvalMesh1(GLenum mode, GLint i1, GLint i2)
1660 {
1661     Context *context = GetValidGlobalContext();
1662     EVENT(context, GLEvalMesh1, "context = %d, mode = %s, i1 = %d, i2 = %d", CID(context),
1663           GLenumToString(GLenumGroup::MeshMode1, mode), i1, i2);
1664 
1665     if (context)
1666     {
1667         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1668         bool isCallValid =
1669             (context->skipValidation() ||
1670              ValidateEvalMesh1(context, angle::EntryPoint::GLEvalMesh1, mode, i1, i2));
1671         if (isCallValid)
1672         {
1673             context->evalMesh1(mode, i1, i2);
1674         }
1675         ANGLE_CAPTURE(EvalMesh1, isCallValid, context, mode, i1, i2);
1676     }
1677     else
1678     {
1679         GenerateContextLostErrorOnCurrentGlobalContext();
1680     }
1681 }
1682 
GL_EvalMesh2(GLenum mode,GLint i1,GLint i2,GLint j1,GLint j2)1683 void GL_APIENTRY GL_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
1684 {
1685     Context *context = GetValidGlobalContext();
1686     EVENT(context, GLEvalMesh2, "context = %d, mode = %s, i1 = %d, i2 = %d, j1 = %d, j2 = %d",
1687           CID(context), GLenumToString(GLenumGroup::MeshMode2, mode), i1, i2, j1, j2);
1688 
1689     if (context)
1690     {
1691         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1692         bool isCallValid =
1693             (context->skipValidation() ||
1694              ValidateEvalMesh2(context, angle::EntryPoint::GLEvalMesh2, mode, i1, i2, j1, j2));
1695         if (isCallValid)
1696         {
1697             context->evalMesh2(mode, i1, i2, j1, j2);
1698         }
1699         ANGLE_CAPTURE(EvalMesh2, isCallValid, context, mode, i1, i2, j1, j2);
1700     }
1701     else
1702     {
1703         GenerateContextLostErrorOnCurrentGlobalContext();
1704     }
1705 }
1706 
GL_EvalPoint1(GLint i)1707 void GL_APIENTRY GL_EvalPoint1(GLint i)
1708 {
1709     Context *context = GetValidGlobalContext();
1710     EVENT(context, GLEvalPoint1, "context = %d, i = %d", CID(context), i);
1711 
1712     if (context)
1713     {
1714         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1715         bool isCallValid                                      = (context->skipValidation() ||
1716                             ValidateEvalPoint1(context, angle::EntryPoint::GLEvalPoint1, i));
1717         if (isCallValid)
1718         {
1719             context->evalPoint1(i);
1720         }
1721         ANGLE_CAPTURE(EvalPoint1, isCallValid, context, i);
1722     }
1723     else
1724     {
1725         GenerateContextLostErrorOnCurrentGlobalContext();
1726     }
1727 }
1728 
GL_EvalPoint2(GLint i,GLint j)1729 void GL_APIENTRY GL_EvalPoint2(GLint i, GLint j)
1730 {
1731     Context *context = GetValidGlobalContext();
1732     EVENT(context, GLEvalPoint2, "context = %d, i = %d, j = %d", CID(context), i, j);
1733 
1734     if (context)
1735     {
1736         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1737         bool isCallValid                                      = (context->skipValidation() ||
1738                             ValidateEvalPoint2(context, angle::EntryPoint::GLEvalPoint2, i, j));
1739         if (isCallValid)
1740         {
1741             context->evalPoint2(i, j);
1742         }
1743         ANGLE_CAPTURE(EvalPoint2, isCallValid, context, i, j);
1744     }
1745     else
1746     {
1747         GenerateContextLostErrorOnCurrentGlobalContext();
1748     }
1749 }
1750 
GL_FeedbackBuffer(GLsizei size,GLenum type,GLfloat * buffer)1751 void GL_APIENTRY GL_FeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
1752 {
1753     Context *context = GetValidGlobalContext();
1754     EVENT(context, GLFeedbackBuffer,
1755           "context = %d, size = %d, type = %s, buffer = 0x%016" PRIxPTR "", CID(context), size,
1756           GLenumToString(GLenumGroup::FeedbackType, type), (uintptr_t)buffer);
1757 
1758     if (context)
1759     {
1760         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1761         bool isCallValid                                      = (context->skipValidation() ||
1762                             ValidateFeedbackBuffer(context, angle::EntryPoint::GLFeedbackBuffer,
1763                                                    size, type, buffer));
1764         if (isCallValid)
1765         {
1766             context->feedbackBuffer(size, type, buffer);
1767         }
1768         ANGLE_CAPTURE(FeedbackBuffer, isCallValid, context, size, type, buffer);
1769     }
1770     else
1771     {
1772         GenerateContextLostErrorOnCurrentGlobalContext();
1773     }
1774 }
1775 
GL_Finish()1776 void GL_APIENTRY GL_Finish()
1777 {
1778     Context *context = GetValidGlobalContext();
1779     EVENT(context, GLFinish, "context = %d", CID(context));
1780 
1781     if (context)
1782     {
1783         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1784         bool isCallValid =
1785             (context->skipValidation() || ValidateFinish(context, angle::EntryPoint::GLFinish));
1786         if (isCallValid)
1787         {
1788             context->finish();
1789         }
1790         ANGLE_CAPTURE(Finish, isCallValid, context);
1791     }
1792     else
1793     {
1794         GenerateContextLostErrorOnCurrentGlobalContext();
1795     }
1796 }
1797 
GL_Flush()1798 void GL_APIENTRY GL_Flush()
1799 {
1800     Context *context = GetValidGlobalContext();
1801     EVENT(context, GLFlush, "context = %d", CID(context));
1802 
1803     if (context)
1804     {
1805         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1806         bool isCallValid =
1807             (context->skipValidation() || ValidateFlush(context, angle::EntryPoint::GLFlush));
1808         if (isCallValid)
1809         {
1810             context->flush();
1811         }
1812         ANGLE_CAPTURE(Flush, isCallValid, context);
1813     }
1814     else
1815     {
1816         GenerateContextLostErrorOnCurrentGlobalContext();
1817     }
1818 }
1819 
GL_Fogf(GLenum pname,GLfloat param)1820 void GL_APIENTRY GL_Fogf(GLenum pname, GLfloat param)
1821 {
1822     Context *context = GetValidGlobalContext();
1823     EVENT(context, GLFogf, "context = %d, pname = %s, param = %f", CID(context),
1824           GLenumToString(GLenumGroup::FogParameter, pname), param);
1825 
1826     if (context)
1827     {
1828         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1829         bool isCallValid                                      = (context->skipValidation() ||
1830                             ValidateFogf(context, angle::EntryPoint::GLFogf, pname, param));
1831         if (isCallValid)
1832         {
1833             context->fogf(pname, param);
1834         }
1835         ANGLE_CAPTURE(Fogf, isCallValid, context, pname, param);
1836     }
1837     else
1838     {
1839         GenerateContextLostErrorOnCurrentGlobalContext();
1840     }
1841 }
1842 
GL_Fogfv(GLenum pname,const GLfloat * params)1843 void GL_APIENTRY GL_Fogfv(GLenum pname, const GLfloat *params)
1844 {
1845     Context *context = GetValidGlobalContext();
1846     EVENT(context, GLFogfv, "context = %d, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
1847           GLenumToString(GLenumGroup::FogParameter, pname), (uintptr_t)params);
1848 
1849     if (context)
1850     {
1851         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1852         bool isCallValid                                      = (context->skipValidation() ||
1853                             ValidateFogfv(context, angle::EntryPoint::GLFogfv, pname, params));
1854         if (isCallValid)
1855         {
1856             context->fogfv(pname, params);
1857         }
1858         ANGLE_CAPTURE(Fogfv, isCallValid, context, pname, params);
1859     }
1860     else
1861     {
1862         GenerateContextLostErrorOnCurrentGlobalContext();
1863     }
1864 }
1865 
GL_Fogi(GLenum pname,GLint param)1866 void GL_APIENTRY GL_Fogi(GLenum pname, GLint param)
1867 {
1868     Context *context = GetValidGlobalContext();
1869     EVENT(context, GLFogi, "context = %d, pname = %s, param = %d", CID(context),
1870           GLenumToString(GLenumGroup::FogParameter, pname), param);
1871 
1872     if (context)
1873     {
1874         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1875         bool isCallValid                                      = (context->skipValidation() ||
1876                             ValidateFogi(context, angle::EntryPoint::GLFogi, pname, param));
1877         if (isCallValid)
1878         {
1879             context->fogi(pname, param);
1880         }
1881         ANGLE_CAPTURE(Fogi, isCallValid, context, pname, param);
1882     }
1883     else
1884     {
1885         GenerateContextLostErrorOnCurrentGlobalContext();
1886     }
1887 }
1888 
GL_Fogiv(GLenum pname,const GLint * params)1889 void GL_APIENTRY GL_Fogiv(GLenum pname, const GLint *params)
1890 {
1891     Context *context = GetValidGlobalContext();
1892     EVENT(context, GLFogiv, "context = %d, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
1893           GLenumToString(GLenumGroup::FogParameter, pname), (uintptr_t)params);
1894 
1895     if (context)
1896     {
1897         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1898         bool isCallValid                                      = (context->skipValidation() ||
1899                             ValidateFogiv(context, angle::EntryPoint::GLFogiv, pname, params));
1900         if (isCallValid)
1901         {
1902             context->fogiv(pname, params);
1903         }
1904         ANGLE_CAPTURE(Fogiv, isCallValid, context, pname, params);
1905     }
1906     else
1907     {
1908         GenerateContextLostErrorOnCurrentGlobalContext();
1909     }
1910 }
1911 
GL_FrontFace(GLenum mode)1912 void GL_APIENTRY GL_FrontFace(GLenum mode)
1913 {
1914     Context *context = GetValidGlobalContext();
1915     EVENT(context, GLFrontFace, "context = %d, mode = %s", CID(context),
1916           GLenumToString(GLenumGroup::FrontFaceDirection, mode));
1917 
1918     if (context)
1919     {
1920         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1921         bool isCallValid                                      = (context->skipValidation() ||
1922                             ValidateFrontFace(context, angle::EntryPoint::GLFrontFace, mode));
1923         if (isCallValid)
1924         {
1925             context->frontFace(mode);
1926         }
1927         ANGLE_CAPTURE(FrontFace, isCallValid, context, mode);
1928     }
1929     else
1930     {
1931         GenerateContextLostErrorOnCurrentGlobalContext();
1932     }
1933 }
1934 
GL_Frustum(GLdouble left,GLdouble right,GLdouble bottom,GLdouble top,GLdouble zNear,GLdouble zFar)1935 void GL_APIENTRY GL_Frustum(GLdouble left,
1936                             GLdouble right,
1937                             GLdouble bottom,
1938                             GLdouble top,
1939                             GLdouble zNear,
1940                             GLdouble zFar)
1941 {
1942     Context *context = GetValidGlobalContext();
1943     EVENT(context, GLFrustum,
1944           "context = %d, left = %f, right = %f, bottom = %f, top = %f, zNear = %f, zFar = %f",
1945           CID(context), left, right, bottom, top, zNear, zFar);
1946 
1947     if (context)
1948     {
1949         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1950         bool isCallValid =
1951             (context->skipValidation() || ValidateFrustum(context, angle::EntryPoint::GLFrustum,
1952                                                           left, right, bottom, top, zNear, zFar));
1953         if (isCallValid)
1954         {
1955             context->frustum(left, right, bottom, top, zNear, zFar);
1956         }
1957         ANGLE_CAPTURE(Frustum, isCallValid, context, left, right, bottom, top, zNear, zFar);
1958     }
1959     else
1960     {
1961         GenerateContextLostErrorOnCurrentGlobalContext();
1962     }
1963 }
1964 
GL_GenLists(GLsizei range)1965 GLuint GL_APIENTRY GL_GenLists(GLsizei range)
1966 {
1967     Context *context = GetValidGlobalContext();
1968     EVENT(context, GLGenLists, "context = %d, range = %d", CID(context), range);
1969 
1970     GLuint returnValue;
1971     if (context)
1972     {
1973         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1974         bool isCallValid                                      = (context->skipValidation() ||
1975                             ValidateGenLists(context, angle::EntryPoint::GLGenLists, range));
1976         if (isCallValid)
1977         {
1978             returnValue = context->genLists(range);
1979         }
1980         else
1981         {
1982             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGenLists, GLuint>();
1983         }
1984         ANGLE_CAPTURE(GenLists, isCallValid, context, range, returnValue);
1985     }
1986     else
1987     {
1988         GenerateContextLostErrorOnCurrentGlobalContext();
1989         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGenLists, GLuint>();
1990     }
1991     return returnValue;
1992 }
1993 
GL_GetBooleanv(GLenum pname,GLboolean * data)1994 void GL_APIENTRY GL_GetBooleanv(GLenum pname, GLboolean *data)
1995 {
1996     Context *context = GetValidGlobalContext();
1997     EVENT(context, GLGetBooleanv, "context = %d, pname = %s, data = 0x%016" PRIxPTR "",
1998           CID(context), GLenumToString(GLenumGroup::GetPName, pname), (uintptr_t)data);
1999 
2000     if (context)
2001     {
2002         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2003         bool isCallValid =
2004             (context->skipValidation() ||
2005              ValidateGetBooleanv(context, angle::EntryPoint::GLGetBooleanv, pname, data));
2006         if (isCallValid)
2007         {
2008             context->getBooleanv(pname, data);
2009         }
2010         ANGLE_CAPTURE(GetBooleanv, isCallValid, context, pname, data);
2011     }
2012     else
2013     {
2014         GenerateContextLostErrorOnCurrentGlobalContext();
2015     }
2016 }
2017 
GL_GetClipPlane(GLenum plane,GLdouble * equation)2018 void GL_APIENTRY GL_GetClipPlane(GLenum plane, GLdouble *equation)
2019 {
2020     Context *context = GetValidGlobalContext();
2021     EVENT(context, GLGetClipPlane, "context = %d, plane = %s, equation = 0x%016" PRIxPTR "",
2022           CID(context), GLenumToString(GLenumGroup::ClipPlaneName, plane), (uintptr_t)equation);
2023 
2024     if (context)
2025     {
2026         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2027         bool isCallValid =
2028             (context->skipValidation() ||
2029              ValidateGetClipPlane(context, angle::EntryPoint::GLGetClipPlane, plane, equation));
2030         if (isCallValid)
2031         {
2032             context->getClipPlane(plane, equation);
2033         }
2034         ANGLE_CAPTURE(GetClipPlane, isCallValid, context, plane, equation);
2035     }
2036     else
2037     {
2038         GenerateContextLostErrorOnCurrentGlobalContext();
2039     }
2040 }
2041 
GL_GetDoublev(GLenum pname,GLdouble * data)2042 void GL_APIENTRY GL_GetDoublev(GLenum pname, GLdouble *data)
2043 {
2044     Context *context = GetValidGlobalContext();
2045     EVENT(context, GLGetDoublev, "context = %d, pname = %s, data = 0x%016" PRIxPTR "", CID(context),
2046           GLenumToString(GLenumGroup::GetPName, pname), (uintptr_t)data);
2047 
2048     if (context)
2049     {
2050         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2051         bool isCallValid =
2052             (context->skipValidation() ||
2053              ValidateGetDoublev(context, angle::EntryPoint::GLGetDoublev, pname, data));
2054         if (isCallValid)
2055         {
2056             context->getDoublev(pname, data);
2057         }
2058         ANGLE_CAPTURE(GetDoublev, isCallValid, context, pname, data);
2059     }
2060     else
2061     {
2062         GenerateContextLostErrorOnCurrentGlobalContext();
2063     }
2064 }
2065 
GL_GetError()2066 GLenum GL_APIENTRY GL_GetError()
2067 {
2068     Context *context = GetGlobalContext();
2069     EVENT(context, GLGetError, "context = %d", CID(context));
2070 
2071     GLenum returnValue;
2072     if (context)
2073     {
2074         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2075         bool isCallValid =
2076             (context->skipValidation() || ValidateGetError(context, angle::EntryPoint::GLGetError));
2077         if (isCallValid)
2078         {
2079             returnValue = context->getError();
2080         }
2081         else
2082         {
2083             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetError, GLenum>();
2084         }
2085         ANGLE_CAPTURE(GetError, isCallValid, context, returnValue);
2086     }
2087     else
2088     {
2089 
2090         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetError, GLenum>();
2091     }
2092     return returnValue;
2093 }
2094 
GL_GetFloatv(GLenum pname,GLfloat * data)2095 void GL_APIENTRY GL_GetFloatv(GLenum pname, GLfloat *data)
2096 {
2097     Context *context = GetValidGlobalContext();
2098     EVENT(context, GLGetFloatv, "context = %d, pname = %s, data = 0x%016" PRIxPTR "", CID(context),
2099           GLenumToString(GLenumGroup::GetPName, pname), (uintptr_t)data);
2100 
2101     if (context)
2102     {
2103         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2104         bool isCallValid =
2105             (context->skipValidation() ||
2106              ValidateGetFloatv(context, angle::EntryPoint::GLGetFloatv, pname, data));
2107         if (isCallValid)
2108         {
2109             context->getFloatv(pname, data);
2110         }
2111         ANGLE_CAPTURE(GetFloatv, isCallValid, context, pname, data);
2112     }
2113     else
2114     {
2115         GenerateContextLostErrorOnCurrentGlobalContext();
2116     }
2117 }
2118 
GL_GetIntegerv(GLenum pname,GLint * data)2119 void GL_APIENTRY GL_GetIntegerv(GLenum pname, GLint *data)
2120 {
2121     Context *context = GetValidGlobalContext();
2122     EVENT(context, GLGetIntegerv, "context = %d, pname = %s, data = 0x%016" PRIxPTR "",
2123           CID(context), GLenumToString(GLenumGroup::GetPName, pname), (uintptr_t)data);
2124 
2125     if (context)
2126     {
2127         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2128         bool isCallValid =
2129             (context->skipValidation() ||
2130              ValidateGetIntegerv(context, angle::EntryPoint::GLGetIntegerv, pname, data));
2131         if (isCallValid)
2132         {
2133             context->getIntegerv(pname, data);
2134         }
2135         ANGLE_CAPTURE(GetIntegerv, isCallValid, context, pname, data);
2136     }
2137     else
2138     {
2139         GenerateContextLostErrorOnCurrentGlobalContext();
2140     }
2141 }
2142 
GL_GetLightfv(GLenum light,GLenum pname,GLfloat * params)2143 void GL_APIENTRY GL_GetLightfv(GLenum light, GLenum pname, GLfloat *params)
2144 {
2145     Context *context = GetValidGlobalContext();
2146     EVENT(context, GLGetLightfv, "context = %d, light = %s, pname = %s, params = 0x%016" PRIxPTR "",
2147           CID(context), GLenumToString(GLenumGroup::LightName, light),
2148           GLenumToString(GLenumGroup::LightParameter, pname), (uintptr_t)params);
2149 
2150     if (context)
2151     {
2152         LightParameter pnamePacked                            = PackParam<LightParameter>(pname);
2153         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2154         bool isCallValid                                      = (context->skipValidation() ||
2155                             ValidateGetLightfv(context, angle::EntryPoint::GLGetLightfv, light,
2156                                                pnamePacked, params));
2157         if (isCallValid)
2158         {
2159             context->getLightfv(light, pnamePacked, params);
2160         }
2161         ANGLE_CAPTURE(GetLightfv, isCallValid, context, light, pnamePacked, params);
2162     }
2163     else
2164     {
2165         GenerateContextLostErrorOnCurrentGlobalContext();
2166     }
2167 }
2168 
GL_GetLightiv(GLenum light,GLenum pname,GLint * params)2169 void GL_APIENTRY GL_GetLightiv(GLenum light, GLenum pname, GLint *params)
2170 {
2171     Context *context = GetValidGlobalContext();
2172     EVENT(context, GLGetLightiv, "context = %d, light = %s, pname = %s, params = 0x%016" PRIxPTR "",
2173           CID(context), GLenumToString(GLenumGroup::LightName, light),
2174           GLenumToString(GLenumGroup::LightParameter, pname), (uintptr_t)params);
2175 
2176     if (context)
2177     {
2178         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2179         bool isCallValid =
2180             (context->skipValidation() ||
2181              ValidateGetLightiv(context, angle::EntryPoint::GLGetLightiv, light, pname, params));
2182         if (isCallValid)
2183         {
2184             context->getLightiv(light, pname, params);
2185         }
2186         ANGLE_CAPTURE(GetLightiv, isCallValid, context, light, pname, params);
2187     }
2188     else
2189     {
2190         GenerateContextLostErrorOnCurrentGlobalContext();
2191     }
2192 }
2193 
GL_GetMapdv(GLenum target,GLenum query,GLdouble * v)2194 void GL_APIENTRY GL_GetMapdv(GLenum target, GLenum query, GLdouble *v)
2195 {
2196     Context *context = GetValidGlobalContext();
2197     EVENT(context, GLGetMapdv, "context = %d, target = %s, query = %s, v = 0x%016" PRIxPTR "",
2198           CID(context), GLenumToString(GLenumGroup::MapTarget, target),
2199           GLenumToString(GLenumGroup::GetMapQuery, query), (uintptr_t)v);
2200 
2201     if (context)
2202     {
2203         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2204         bool isCallValid =
2205             (context->skipValidation() ||
2206              ValidateGetMapdv(context, angle::EntryPoint::GLGetMapdv, target, query, v));
2207         if (isCallValid)
2208         {
2209             context->getMapdv(target, query, v);
2210         }
2211         ANGLE_CAPTURE(GetMapdv, isCallValid, context, target, query, v);
2212     }
2213     else
2214     {
2215         GenerateContextLostErrorOnCurrentGlobalContext();
2216     }
2217 }
2218 
GL_GetMapfv(GLenum target,GLenum query,GLfloat * v)2219 void GL_APIENTRY GL_GetMapfv(GLenum target, GLenum query, GLfloat *v)
2220 {
2221     Context *context = GetValidGlobalContext();
2222     EVENT(context, GLGetMapfv, "context = %d, target = %s, query = %s, v = 0x%016" PRIxPTR "",
2223           CID(context), GLenumToString(GLenumGroup::MapTarget, target),
2224           GLenumToString(GLenumGroup::GetMapQuery, query), (uintptr_t)v);
2225 
2226     if (context)
2227     {
2228         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2229         bool isCallValid =
2230             (context->skipValidation() ||
2231              ValidateGetMapfv(context, angle::EntryPoint::GLGetMapfv, target, query, v));
2232         if (isCallValid)
2233         {
2234             context->getMapfv(target, query, v);
2235         }
2236         ANGLE_CAPTURE(GetMapfv, isCallValid, context, target, query, v);
2237     }
2238     else
2239     {
2240         GenerateContextLostErrorOnCurrentGlobalContext();
2241     }
2242 }
2243 
GL_GetMapiv(GLenum target,GLenum query,GLint * v)2244 void GL_APIENTRY GL_GetMapiv(GLenum target, GLenum query, GLint *v)
2245 {
2246     Context *context = GetValidGlobalContext();
2247     EVENT(context, GLGetMapiv, "context = %d, target = %s, query = %s, v = 0x%016" PRIxPTR "",
2248           CID(context), GLenumToString(GLenumGroup::MapTarget, target),
2249           GLenumToString(GLenumGroup::GetMapQuery, query), (uintptr_t)v);
2250 
2251     if (context)
2252     {
2253         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2254         bool isCallValid =
2255             (context->skipValidation() ||
2256              ValidateGetMapiv(context, angle::EntryPoint::GLGetMapiv, target, query, v));
2257         if (isCallValid)
2258         {
2259             context->getMapiv(target, query, v);
2260         }
2261         ANGLE_CAPTURE(GetMapiv, isCallValid, context, target, query, v);
2262     }
2263     else
2264     {
2265         GenerateContextLostErrorOnCurrentGlobalContext();
2266     }
2267 }
2268 
GL_GetMaterialfv(GLenum face,GLenum pname,GLfloat * params)2269 void GL_APIENTRY GL_GetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
2270 {
2271     Context *context = GetValidGlobalContext();
2272     EVENT(context, GLGetMaterialfv,
2273           "context = %d, face = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
2274           GLenumToString(GLenumGroup::MaterialFace, face),
2275           GLenumToString(GLenumGroup::MaterialParameter, pname), (uintptr_t)params);
2276 
2277     if (context)
2278     {
2279         MaterialParameter pnamePacked                         = PackParam<MaterialParameter>(pname);
2280         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2281         bool isCallValid                                      = (context->skipValidation() ||
2282                             ValidateGetMaterialfv(context, angle::EntryPoint::GLGetMaterialfv, face,
2283                                                   pnamePacked, params));
2284         if (isCallValid)
2285         {
2286             context->getMaterialfv(face, pnamePacked, params);
2287         }
2288         ANGLE_CAPTURE(GetMaterialfv, isCallValid, context, face, pnamePacked, params);
2289     }
2290     else
2291     {
2292         GenerateContextLostErrorOnCurrentGlobalContext();
2293     }
2294 }
2295 
GL_GetMaterialiv(GLenum face,GLenum pname,GLint * params)2296 void GL_APIENTRY GL_GetMaterialiv(GLenum face, GLenum pname, GLint *params)
2297 {
2298     Context *context = GetValidGlobalContext();
2299     EVENT(context, GLGetMaterialiv,
2300           "context = %d, face = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
2301           GLenumToString(GLenumGroup::MaterialFace, face),
2302           GLenumToString(GLenumGroup::MaterialParameter, pname), (uintptr_t)params);
2303 
2304     if (context)
2305     {
2306         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2307         bool isCallValid                                      = (context->skipValidation() ||
2308                             ValidateGetMaterialiv(context, angle::EntryPoint::GLGetMaterialiv, face,
2309                                                   pname, params));
2310         if (isCallValid)
2311         {
2312             context->getMaterialiv(face, pname, params);
2313         }
2314         ANGLE_CAPTURE(GetMaterialiv, isCallValid, context, face, pname, params);
2315     }
2316     else
2317     {
2318         GenerateContextLostErrorOnCurrentGlobalContext();
2319     }
2320 }
2321 
GL_GetPixelMapfv(GLenum map,GLfloat * values)2322 void GL_APIENTRY GL_GetPixelMapfv(GLenum map, GLfloat *values)
2323 {
2324     Context *context = GetValidGlobalContext();
2325     EVENT(context, GLGetPixelMapfv, "context = %d, map = %s, values = 0x%016" PRIxPTR "",
2326           CID(context), GLenumToString(GLenumGroup::PixelMap, map), (uintptr_t)values);
2327 
2328     if (context)
2329     {
2330         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2331         bool isCallValid =
2332             (context->skipValidation() ||
2333              ValidateGetPixelMapfv(context, angle::EntryPoint::GLGetPixelMapfv, map, values));
2334         if (isCallValid)
2335         {
2336             context->getPixelMapfv(map, values);
2337         }
2338         ANGLE_CAPTURE(GetPixelMapfv, isCallValid, context, map, values);
2339     }
2340     else
2341     {
2342         GenerateContextLostErrorOnCurrentGlobalContext();
2343     }
2344 }
2345 
GL_GetPixelMapuiv(GLenum map,GLuint * values)2346 void GL_APIENTRY GL_GetPixelMapuiv(GLenum map, GLuint *values)
2347 {
2348     Context *context = GetValidGlobalContext();
2349     EVENT(context, GLGetPixelMapuiv, "context = %d, map = %s, values = 0x%016" PRIxPTR "",
2350           CID(context), GLenumToString(GLenumGroup::PixelMap, map), (uintptr_t)values);
2351 
2352     if (context)
2353     {
2354         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2355         bool isCallValid =
2356             (context->skipValidation() ||
2357              ValidateGetPixelMapuiv(context, angle::EntryPoint::GLGetPixelMapuiv, map, values));
2358         if (isCallValid)
2359         {
2360             context->getPixelMapuiv(map, values);
2361         }
2362         ANGLE_CAPTURE(GetPixelMapuiv, isCallValid, context, map, values);
2363     }
2364     else
2365     {
2366         GenerateContextLostErrorOnCurrentGlobalContext();
2367     }
2368 }
2369 
GL_GetPixelMapusv(GLenum map,GLushort * values)2370 void GL_APIENTRY GL_GetPixelMapusv(GLenum map, GLushort *values)
2371 {
2372     Context *context = GetValidGlobalContext();
2373     EVENT(context, GLGetPixelMapusv, "context = %d, map = %s, values = 0x%016" PRIxPTR "",
2374           CID(context), GLenumToString(GLenumGroup::PixelMap, map), (uintptr_t)values);
2375 
2376     if (context)
2377     {
2378         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2379         bool isCallValid =
2380             (context->skipValidation() ||
2381              ValidateGetPixelMapusv(context, angle::EntryPoint::GLGetPixelMapusv, map, values));
2382         if (isCallValid)
2383         {
2384             context->getPixelMapusv(map, values);
2385         }
2386         ANGLE_CAPTURE(GetPixelMapusv, isCallValid, context, map, values);
2387     }
2388     else
2389     {
2390         GenerateContextLostErrorOnCurrentGlobalContext();
2391     }
2392 }
2393 
GL_GetPolygonStipple(GLubyte * mask)2394 void GL_APIENTRY GL_GetPolygonStipple(GLubyte *mask)
2395 {
2396     Context *context = GetValidGlobalContext();
2397     EVENT(context, GLGetPolygonStipple, "context = %d, mask = 0x%016" PRIxPTR "", CID(context),
2398           (uintptr_t)mask);
2399 
2400     if (context)
2401     {
2402         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2403         bool isCallValid =
2404             (context->skipValidation() ||
2405              ValidateGetPolygonStipple(context, angle::EntryPoint::GLGetPolygonStipple, mask));
2406         if (isCallValid)
2407         {
2408             context->getPolygonStipple(mask);
2409         }
2410         ANGLE_CAPTURE(GetPolygonStipple, isCallValid, context, mask);
2411     }
2412     else
2413     {
2414         GenerateContextLostErrorOnCurrentGlobalContext();
2415     }
2416 }
2417 
GL_GetString(GLenum name)2418 const GLubyte *GL_APIENTRY GL_GetString(GLenum name)
2419 {
2420     Context *context = GetValidGlobalContext();
2421     EVENT(context, GLGetString, "context = %d, name = %s", CID(context),
2422           GLenumToString(GLenumGroup::StringName, name));
2423 
2424     const GLubyte *returnValue;
2425     if (context)
2426     {
2427         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2428         bool isCallValid                                      = (context->skipValidation() ||
2429                             ValidateGetString(context, angle::EntryPoint::GLGetString, name));
2430         if (isCallValid)
2431         {
2432             returnValue = context->getString(name);
2433         }
2434         else
2435         {
2436             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetString, const GLubyte *>();
2437         }
2438         ANGLE_CAPTURE(GetString, isCallValid, context, name, returnValue);
2439     }
2440     else
2441     {
2442         GenerateContextLostErrorOnCurrentGlobalContext();
2443         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetString, const GLubyte *>();
2444     }
2445     return returnValue;
2446 }
2447 
GL_GetTexEnvfv(GLenum target,GLenum pname,GLfloat * params)2448 void GL_APIENTRY GL_GetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
2449 {
2450     Context *context = GetValidGlobalContext();
2451     EVENT(context, GLGetTexEnvfv,
2452           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
2453           GLenumToString(GLenumGroup::TextureEnvTarget, target),
2454           GLenumToString(GLenumGroup::TextureEnvParameter, pname), (uintptr_t)params);
2455 
2456     if (context)
2457     {
2458         TextureEnvTarget targetPacked   = PackParam<TextureEnvTarget>(target);
2459         TextureEnvParameter pnamePacked = PackParam<TextureEnvParameter>(pname);
2460         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2461         bool isCallValid                                      = (context->skipValidation() ||
2462                             ValidateGetTexEnvfv(context, angle::EntryPoint::GLGetTexEnvfv,
2463                                                 targetPacked, pnamePacked, params));
2464         if (isCallValid)
2465         {
2466             context->getTexEnvfv(targetPacked, pnamePacked, params);
2467         }
2468         ANGLE_CAPTURE(GetTexEnvfv, isCallValid, context, targetPacked, pnamePacked, params);
2469     }
2470     else
2471     {
2472         GenerateContextLostErrorOnCurrentGlobalContext();
2473     }
2474 }
2475 
GL_GetTexEnviv(GLenum target,GLenum pname,GLint * params)2476 void GL_APIENTRY GL_GetTexEnviv(GLenum target, GLenum pname, GLint *params)
2477 {
2478     Context *context = GetValidGlobalContext();
2479     EVENT(context, GLGetTexEnviv,
2480           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
2481           GLenumToString(GLenumGroup::TextureEnvTarget, target),
2482           GLenumToString(GLenumGroup::TextureEnvParameter, pname), (uintptr_t)params);
2483 
2484     if (context)
2485     {
2486         TextureEnvTarget targetPacked   = PackParam<TextureEnvTarget>(target);
2487         TextureEnvParameter pnamePacked = PackParam<TextureEnvParameter>(pname);
2488         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2489         bool isCallValid                                      = (context->skipValidation() ||
2490                             ValidateGetTexEnviv(context, angle::EntryPoint::GLGetTexEnviv,
2491                                                 targetPacked, pnamePacked, params));
2492         if (isCallValid)
2493         {
2494             context->getTexEnviv(targetPacked, pnamePacked, params);
2495         }
2496         ANGLE_CAPTURE(GetTexEnviv, isCallValid, context, targetPacked, pnamePacked, params);
2497     }
2498     else
2499     {
2500         GenerateContextLostErrorOnCurrentGlobalContext();
2501     }
2502 }
2503 
GL_GetTexGendv(GLenum coord,GLenum pname,GLdouble * params)2504 void GL_APIENTRY GL_GetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
2505 {
2506     Context *context = GetValidGlobalContext();
2507     EVENT(context, GLGetTexGendv,
2508           "context = %d, coord = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
2509           GLenumToString(GLenumGroup::TextureCoordName, coord),
2510           GLenumToString(GLenumGroup::TextureGenParameter, pname), (uintptr_t)params);
2511 
2512     if (context)
2513     {
2514         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2515         bool isCallValid =
2516             (context->skipValidation() ||
2517              ValidateGetTexGendv(context, angle::EntryPoint::GLGetTexGendv, coord, pname, params));
2518         if (isCallValid)
2519         {
2520             context->getTexGendv(coord, pname, params);
2521         }
2522         ANGLE_CAPTURE(GetTexGendv, isCallValid, context, coord, pname, params);
2523     }
2524     else
2525     {
2526         GenerateContextLostErrorOnCurrentGlobalContext();
2527     }
2528 }
2529 
GL_GetTexGenfv(GLenum coord,GLenum pname,GLfloat * params)2530 void GL_APIENTRY GL_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
2531 {
2532     Context *context = GetValidGlobalContext();
2533     EVENT(context, GLGetTexGenfv,
2534           "context = %d, coord = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
2535           GLenumToString(GLenumGroup::TextureCoordName, coord),
2536           GLenumToString(GLenumGroup::TextureGenParameter, pname), (uintptr_t)params);
2537 
2538     if (context)
2539     {
2540         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2541         bool isCallValid =
2542             (context->skipValidation() ||
2543              ValidateGetTexGenfv(context, angle::EntryPoint::GLGetTexGenfv, coord, pname, params));
2544         if (isCallValid)
2545         {
2546             context->getTexGenfv(coord, pname, params);
2547         }
2548         ANGLE_CAPTURE(GetTexGenfv, isCallValid, context, coord, pname, params);
2549     }
2550     else
2551     {
2552         GenerateContextLostErrorOnCurrentGlobalContext();
2553     }
2554 }
2555 
GL_GetTexGeniv(GLenum coord,GLenum pname,GLint * params)2556 void GL_APIENTRY GL_GetTexGeniv(GLenum coord, GLenum pname, GLint *params)
2557 {
2558     Context *context = GetValidGlobalContext();
2559     EVENT(context, GLGetTexGeniv,
2560           "context = %d, coord = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
2561           GLenumToString(GLenumGroup::TextureCoordName, coord),
2562           GLenumToString(GLenumGroup::TextureGenParameter, pname), (uintptr_t)params);
2563 
2564     if (context)
2565     {
2566         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2567         bool isCallValid =
2568             (context->skipValidation() ||
2569              ValidateGetTexGeniv(context, angle::EntryPoint::GLGetTexGeniv, coord, pname, params));
2570         if (isCallValid)
2571         {
2572             context->getTexGeniv(coord, pname, params);
2573         }
2574         ANGLE_CAPTURE(GetTexGeniv, isCallValid, context, coord, pname, params);
2575     }
2576     else
2577     {
2578         GenerateContextLostErrorOnCurrentGlobalContext();
2579     }
2580 }
2581 
2582 void GL_APIENTRY
GL_GetTexImage(GLenum target,GLint level,GLenum format,GLenum type,void * pixels)2583 GL_GetTexImage(GLenum target, GLint level, GLenum format, GLenum type, void *pixels)
2584 {
2585     Context *context = GetValidGlobalContext();
2586     EVENT(context, GLGetTexImage,
2587           "context = %d, target = %s, level = %d, format = %s, type = %s, pixels = 0x%016" PRIxPTR
2588           "",
2589           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level,
2590           GLenumToString(GLenumGroup::PixelFormat, format),
2591           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
2592 
2593     if (context)
2594     {
2595         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
2596         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2597         bool isCallValid                                      = (context->skipValidation() ||
2598                             ValidateGetTexImage(context, angle::EntryPoint::GLGetTexImage,
2599                                                 targetPacked, level, format, type, pixels));
2600         if (isCallValid)
2601         {
2602             context->getTexImage(targetPacked, level, format, type, pixels);
2603         }
2604         ANGLE_CAPTURE(GetTexImage, isCallValid, context, targetPacked, level, format, type, pixels);
2605     }
2606     else
2607     {
2608         GenerateContextLostErrorOnCurrentGlobalContext();
2609     }
2610 }
2611 
GL_GetTexLevelParameterfv(GLenum target,GLint level,GLenum pname,GLfloat * params)2612 void GL_APIENTRY GL_GetTexLevelParameterfv(GLenum target,
2613                                            GLint level,
2614                                            GLenum pname,
2615                                            GLfloat *params)
2616 {
2617     Context *context = GetValidGlobalContext();
2618     EVENT(context, GLGetTexLevelParameterfv,
2619           "context = %d, target = %s, level = %d, pname = %s, params = 0x%016" PRIxPTR "",
2620           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level,
2621           GLenumToString(GLenumGroup::GetTextureParameter, pname), (uintptr_t)params);
2622 
2623     if (context)
2624     {
2625         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
2626         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2627         bool isCallValid =
2628             (context->skipValidation() ||
2629              ValidateGetTexLevelParameterfv(context, angle::EntryPoint::GLGetTexLevelParameterfv,
2630                                             targetPacked, level, pname, params));
2631         if (isCallValid)
2632         {
2633             context->getTexLevelParameterfv(targetPacked, level, pname, params);
2634         }
2635         ANGLE_CAPTURE(GetTexLevelParameterfv, isCallValid, context, targetPacked, level, pname,
2636                       params);
2637     }
2638     else
2639     {
2640         GenerateContextLostErrorOnCurrentGlobalContext();
2641     }
2642 }
2643 
GL_GetTexLevelParameteriv(GLenum target,GLint level,GLenum pname,GLint * params)2644 void GL_APIENTRY GL_GetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
2645 {
2646     Context *context = GetValidGlobalContext();
2647     EVENT(context, GLGetTexLevelParameteriv,
2648           "context = %d, target = %s, level = %d, pname = %s, params = 0x%016" PRIxPTR "",
2649           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level,
2650           GLenumToString(GLenumGroup::GetTextureParameter, pname), (uintptr_t)params);
2651 
2652     if (context)
2653     {
2654         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
2655         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2656         bool isCallValid =
2657             (context->skipValidation() ||
2658              ValidateGetTexLevelParameteriv(context, angle::EntryPoint::GLGetTexLevelParameteriv,
2659                                             targetPacked, level, pname, params));
2660         if (isCallValid)
2661         {
2662             context->getTexLevelParameteriv(targetPacked, level, pname, params);
2663         }
2664         ANGLE_CAPTURE(GetTexLevelParameteriv, isCallValid, context, targetPacked, level, pname,
2665                       params);
2666     }
2667     else
2668     {
2669         GenerateContextLostErrorOnCurrentGlobalContext();
2670     }
2671 }
2672 
GL_GetTexParameterfv(GLenum target,GLenum pname,GLfloat * params)2673 void GL_APIENTRY GL_GetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
2674 {
2675     Context *context = GetValidGlobalContext();
2676     EVENT(context, GLGetTexParameterfv,
2677           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
2678           GLenumToString(GLenumGroup::TextureTarget, target),
2679           GLenumToString(GLenumGroup::GetTextureParameter, pname), (uintptr_t)params);
2680 
2681     if (context)
2682     {
2683         TextureType targetPacked                              = PackParam<TextureType>(target);
2684         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2685         bool isCallValid =
2686             (context->skipValidation() ||
2687              ValidateGetTexParameterfv(context, angle::EntryPoint::GLGetTexParameterfv,
2688                                        targetPacked, pname, params));
2689         if (isCallValid)
2690         {
2691             context->getTexParameterfv(targetPacked, pname, params);
2692         }
2693         ANGLE_CAPTURE(GetTexParameterfv, isCallValid, context, targetPacked, pname, params);
2694     }
2695     else
2696     {
2697         GenerateContextLostErrorOnCurrentGlobalContext();
2698     }
2699 }
2700 
GL_GetTexParameteriv(GLenum target,GLenum pname,GLint * params)2701 void GL_APIENTRY GL_GetTexParameteriv(GLenum target, GLenum pname, GLint *params)
2702 {
2703     Context *context = GetValidGlobalContext();
2704     EVENT(context, GLGetTexParameteriv,
2705           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
2706           GLenumToString(GLenumGroup::TextureTarget, target),
2707           GLenumToString(GLenumGroup::GetTextureParameter, pname), (uintptr_t)params);
2708 
2709     if (context)
2710     {
2711         TextureType targetPacked                              = PackParam<TextureType>(target);
2712         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2713         bool isCallValid =
2714             (context->skipValidation() ||
2715              ValidateGetTexParameteriv(context, angle::EntryPoint::GLGetTexParameteriv,
2716                                        targetPacked, pname, params));
2717         if (isCallValid)
2718         {
2719             context->getTexParameteriv(targetPacked, pname, params);
2720         }
2721         ANGLE_CAPTURE(GetTexParameteriv, isCallValid, context, targetPacked, pname, params);
2722     }
2723     else
2724     {
2725         GenerateContextLostErrorOnCurrentGlobalContext();
2726     }
2727 }
2728 
GL_Hint(GLenum target,GLenum mode)2729 void GL_APIENTRY GL_Hint(GLenum target, GLenum mode)
2730 {
2731     Context *context = GetValidGlobalContext();
2732     EVENT(context, GLHint, "context = %d, target = %s, mode = %s", CID(context),
2733           GLenumToString(GLenumGroup::HintTarget, target),
2734           GLenumToString(GLenumGroup::HintMode, mode));
2735 
2736     if (context)
2737     {
2738         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2739         bool isCallValid                                      = (context->skipValidation() ||
2740                             ValidateHint(context, angle::EntryPoint::GLHint, target, mode));
2741         if (isCallValid)
2742         {
2743             context->hint(target, mode);
2744         }
2745         ANGLE_CAPTURE(Hint, isCallValid, context, target, mode);
2746     }
2747     else
2748     {
2749         GenerateContextLostErrorOnCurrentGlobalContext();
2750     }
2751 }
2752 
GL_IndexMask(GLuint mask)2753 void GL_APIENTRY GL_IndexMask(GLuint mask)
2754 {
2755     Context *context = GetValidGlobalContext();
2756     EVENT(context, GLIndexMask, "context = %d, mask = %u", CID(context), mask);
2757 
2758     if (context)
2759     {
2760         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2761         bool isCallValid                                      = (context->skipValidation() ||
2762                             ValidateIndexMask(context, angle::EntryPoint::GLIndexMask, mask));
2763         if (isCallValid)
2764         {
2765             context->indexMask(mask);
2766         }
2767         ANGLE_CAPTURE(IndexMask, isCallValid, context, mask);
2768     }
2769     else
2770     {
2771         GenerateContextLostErrorOnCurrentGlobalContext();
2772     }
2773 }
2774 
GL_Indexd(GLdouble c)2775 void GL_APIENTRY GL_Indexd(GLdouble c)
2776 {
2777     Context *context = GetValidGlobalContext();
2778     EVENT(context, GLIndexd, "context = %d, c = %f", CID(context), c);
2779 
2780     if (context)
2781     {
2782         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2783         bool isCallValid =
2784             (context->skipValidation() || ValidateIndexd(context, angle::EntryPoint::GLIndexd, c));
2785         if (isCallValid)
2786         {
2787             context->indexd(c);
2788         }
2789         ANGLE_CAPTURE(Indexd, isCallValid, context, c);
2790     }
2791     else
2792     {
2793         GenerateContextLostErrorOnCurrentGlobalContext();
2794     }
2795 }
2796 
GL_Indexdv(const GLdouble * c)2797 void GL_APIENTRY GL_Indexdv(const GLdouble *c)
2798 {
2799     Context *context = GetValidGlobalContext();
2800     EVENT(context, GLIndexdv, "context = %d, c = 0x%016" PRIxPTR "", CID(context), (uintptr_t)c);
2801 
2802     if (context)
2803     {
2804         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2805         bool isCallValid                                      = (context->skipValidation() ||
2806                             ValidateIndexdv(context, angle::EntryPoint::GLIndexdv, c));
2807         if (isCallValid)
2808         {
2809             context->indexdv(c);
2810         }
2811         ANGLE_CAPTURE(Indexdv, isCallValid, context, c);
2812     }
2813     else
2814     {
2815         GenerateContextLostErrorOnCurrentGlobalContext();
2816     }
2817 }
2818 
GL_Indexf(GLfloat c)2819 void GL_APIENTRY GL_Indexf(GLfloat c)
2820 {
2821     Context *context = GetValidGlobalContext();
2822     EVENT(context, GLIndexf, "context = %d, c = %f", CID(context), c);
2823 
2824     if (context)
2825     {
2826         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2827         bool isCallValid =
2828             (context->skipValidation() || ValidateIndexf(context, angle::EntryPoint::GLIndexf, c));
2829         if (isCallValid)
2830         {
2831             context->indexf(c);
2832         }
2833         ANGLE_CAPTURE(Indexf, isCallValid, context, c);
2834     }
2835     else
2836     {
2837         GenerateContextLostErrorOnCurrentGlobalContext();
2838     }
2839 }
2840 
GL_Indexfv(const GLfloat * c)2841 void GL_APIENTRY GL_Indexfv(const GLfloat *c)
2842 {
2843     Context *context = GetValidGlobalContext();
2844     EVENT(context, GLIndexfv, "context = %d, c = 0x%016" PRIxPTR "", CID(context), (uintptr_t)c);
2845 
2846     if (context)
2847     {
2848         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2849         bool isCallValid                                      = (context->skipValidation() ||
2850                             ValidateIndexfv(context, angle::EntryPoint::GLIndexfv, c));
2851         if (isCallValid)
2852         {
2853             context->indexfv(c);
2854         }
2855         ANGLE_CAPTURE(Indexfv, isCallValid, context, c);
2856     }
2857     else
2858     {
2859         GenerateContextLostErrorOnCurrentGlobalContext();
2860     }
2861 }
2862 
GL_Indexi(GLint c)2863 void GL_APIENTRY GL_Indexi(GLint c)
2864 {
2865     Context *context = GetValidGlobalContext();
2866     EVENT(context, GLIndexi, "context = %d, c = %d", CID(context), c);
2867 
2868     if (context)
2869     {
2870         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2871         bool isCallValid =
2872             (context->skipValidation() || ValidateIndexi(context, angle::EntryPoint::GLIndexi, c));
2873         if (isCallValid)
2874         {
2875             context->indexi(c);
2876         }
2877         ANGLE_CAPTURE(Indexi, isCallValid, context, c);
2878     }
2879     else
2880     {
2881         GenerateContextLostErrorOnCurrentGlobalContext();
2882     }
2883 }
2884 
GL_Indexiv(const GLint * c)2885 void GL_APIENTRY GL_Indexiv(const GLint *c)
2886 {
2887     Context *context = GetValidGlobalContext();
2888     EVENT(context, GLIndexiv, "context = %d, c = 0x%016" PRIxPTR "", CID(context), (uintptr_t)c);
2889 
2890     if (context)
2891     {
2892         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2893         bool isCallValid                                      = (context->skipValidation() ||
2894                             ValidateIndexiv(context, angle::EntryPoint::GLIndexiv, c));
2895         if (isCallValid)
2896         {
2897             context->indexiv(c);
2898         }
2899         ANGLE_CAPTURE(Indexiv, isCallValid, context, c);
2900     }
2901     else
2902     {
2903         GenerateContextLostErrorOnCurrentGlobalContext();
2904     }
2905 }
2906 
GL_Indexs(GLshort c)2907 void GL_APIENTRY GL_Indexs(GLshort c)
2908 {
2909     Context *context = GetValidGlobalContext();
2910     EVENT(context, GLIndexs, "context = %d, c = %d", CID(context), c);
2911 
2912     if (context)
2913     {
2914         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2915         bool isCallValid =
2916             (context->skipValidation() || ValidateIndexs(context, angle::EntryPoint::GLIndexs, c));
2917         if (isCallValid)
2918         {
2919             context->indexs(c);
2920         }
2921         ANGLE_CAPTURE(Indexs, isCallValid, context, c);
2922     }
2923     else
2924     {
2925         GenerateContextLostErrorOnCurrentGlobalContext();
2926     }
2927 }
2928 
GL_Indexsv(const GLshort * c)2929 void GL_APIENTRY GL_Indexsv(const GLshort *c)
2930 {
2931     Context *context = GetValidGlobalContext();
2932     EVENT(context, GLIndexsv, "context = %d, c = 0x%016" PRIxPTR "", CID(context), (uintptr_t)c);
2933 
2934     if (context)
2935     {
2936         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2937         bool isCallValid                                      = (context->skipValidation() ||
2938                             ValidateIndexsv(context, angle::EntryPoint::GLIndexsv, c));
2939         if (isCallValid)
2940         {
2941             context->indexsv(c);
2942         }
2943         ANGLE_CAPTURE(Indexsv, isCallValid, context, c);
2944     }
2945     else
2946     {
2947         GenerateContextLostErrorOnCurrentGlobalContext();
2948     }
2949 }
2950 
GL_InitNames()2951 void GL_APIENTRY GL_InitNames()
2952 {
2953     Context *context = GetValidGlobalContext();
2954     EVENT(context, GLInitNames, "context = %d", CID(context));
2955 
2956     if (context)
2957     {
2958         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2959         bool isCallValid                                      = (context->skipValidation() ||
2960                             ValidateInitNames(context, angle::EntryPoint::GLInitNames));
2961         if (isCallValid)
2962         {
2963             context->initNames();
2964         }
2965         ANGLE_CAPTURE(InitNames, isCallValid, context);
2966     }
2967     else
2968     {
2969         GenerateContextLostErrorOnCurrentGlobalContext();
2970     }
2971 }
2972 
GL_IsEnabled(GLenum cap)2973 GLboolean GL_APIENTRY GL_IsEnabled(GLenum cap)
2974 {
2975     Context *context = GetValidGlobalContext();
2976     EVENT(context, GLIsEnabled, "context = %d, cap = %s", CID(context),
2977           GLenumToString(GLenumGroup::EnableCap, cap));
2978 
2979     GLboolean returnValue;
2980     if (context)
2981     {
2982         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2983         bool isCallValid                                      = (context->skipValidation() ||
2984                             ValidateIsEnabled(context, angle::EntryPoint::GLIsEnabled, cap));
2985         if (isCallValid)
2986         {
2987             returnValue = context->isEnabled(cap);
2988         }
2989         else
2990         {
2991             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsEnabled, GLboolean>();
2992         }
2993         ANGLE_CAPTURE(IsEnabled, isCallValid, context, cap, returnValue);
2994     }
2995     else
2996     {
2997         GenerateContextLostErrorOnCurrentGlobalContext();
2998         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsEnabled, GLboolean>();
2999     }
3000     return returnValue;
3001 }
3002 
GL_IsList(GLuint list)3003 GLboolean GL_APIENTRY GL_IsList(GLuint list)
3004 {
3005     Context *context = GetValidGlobalContext();
3006     EVENT(context, GLIsList, "context = %d, list = %u", CID(context), list);
3007 
3008     GLboolean returnValue;
3009     if (context)
3010     {
3011         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3012         bool isCallValid                                      = (context->skipValidation() ||
3013                             ValidateIsList(context, angle::EntryPoint::GLIsList, list));
3014         if (isCallValid)
3015         {
3016             returnValue = context->isList(list);
3017         }
3018         else
3019         {
3020             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsList, GLboolean>();
3021         }
3022         ANGLE_CAPTURE(IsList, isCallValid, context, list, returnValue);
3023     }
3024     else
3025     {
3026         GenerateContextLostErrorOnCurrentGlobalContext();
3027         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsList, GLboolean>();
3028     }
3029     return returnValue;
3030 }
3031 
GL_LightModelf(GLenum pname,GLfloat param)3032 void GL_APIENTRY GL_LightModelf(GLenum pname, GLfloat param)
3033 {
3034     Context *context = GetValidGlobalContext();
3035     EVENT(context, GLLightModelf, "context = %d, pname = %s, param = %f", CID(context),
3036           GLenumToString(GLenumGroup::LightModelParameter, pname), param);
3037 
3038     if (context)
3039     {
3040         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3041         bool isCallValid =
3042             (context->skipValidation() ||
3043              ValidateLightModelf(context, angle::EntryPoint::GLLightModelf, pname, param));
3044         if (isCallValid)
3045         {
3046             context->lightModelf(pname, param);
3047         }
3048         ANGLE_CAPTURE(LightModelf, isCallValid, context, pname, param);
3049     }
3050     else
3051     {
3052         GenerateContextLostErrorOnCurrentGlobalContext();
3053     }
3054 }
3055 
GL_LightModelfv(GLenum pname,const GLfloat * params)3056 void GL_APIENTRY GL_LightModelfv(GLenum pname, const GLfloat *params)
3057 {
3058     Context *context = GetValidGlobalContext();
3059     EVENT(context, GLLightModelfv, "context = %d, pname = %s, params = 0x%016" PRIxPTR "",
3060           CID(context), GLenumToString(GLenumGroup::LightModelParameter, pname), (uintptr_t)params);
3061 
3062     if (context)
3063     {
3064         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3065         bool isCallValid =
3066             (context->skipValidation() ||
3067              ValidateLightModelfv(context, angle::EntryPoint::GLLightModelfv, pname, params));
3068         if (isCallValid)
3069         {
3070             context->lightModelfv(pname, params);
3071         }
3072         ANGLE_CAPTURE(LightModelfv, isCallValid, context, pname, params);
3073     }
3074     else
3075     {
3076         GenerateContextLostErrorOnCurrentGlobalContext();
3077     }
3078 }
3079 
GL_LightModeli(GLenum pname,GLint param)3080 void GL_APIENTRY GL_LightModeli(GLenum pname, GLint param)
3081 {
3082     Context *context = GetValidGlobalContext();
3083     EVENT(context, GLLightModeli, "context = %d, pname = %s, param = %d", CID(context),
3084           GLenumToString(GLenumGroup::LightModelParameter, pname), param);
3085 
3086     if (context)
3087     {
3088         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3089         bool isCallValid =
3090             (context->skipValidation() ||
3091              ValidateLightModeli(context, angle::EntryPoint::GLLightModeli, pname, param));
3092         if (isCallValid)
3093         {
3094             context->lightModeli(pname, param);
3095         }
3096         ANGLE_CAPTURE(LightModeli, isCallValid, context, pname, param);
3097     }
3098     else
3099     {
3100         GenerateContextLostErrorOnCurrentGlobalContext();
3101     }
3102 }
3103 
GL_LightModeliv(GLenum pname,const GLint * params)3104 void GL_APIENTRY GL_LightModeliv(GLenum pname, const GLint *params)
3105 {
3106     Context *context = GetValidGlobalContext();
3107     EVENT(context, GLLightModeliv, "context = %d, pname = %s, params = 0x%016" PRIxPTR "",
3108           CID(context), GLenumToString(GLenumGroup::LightModelParameter, pname), (uintptr_t)params);
3109 
3110     if (context)
3111     {
3112         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3113         bool isCallValid =
3114             (context->skipValidation() ||
3115              ValidateLightModeliv(context, angle::EntryPoint::GLLightModeliv, pname, params));
3116         if (isCallValid)
3117         {
3118             context->lightModeliv(pname, params);
3119         }
3120         ANGLE_CAPTURE(LightModeliv, isCallValid, context, pname, params);
3121     }
3122     else
3123     {
3124         GenerateContextLostErrorOnCurrentGlobalContext();
3125     }
3126 }
3127 
GL_Lightf(GLenum light,GLenum pname,GLfloat param)3128 void GL_APIENTRY GL_Lightf(GLenum light, GLenum pname, GLfloat param)
3129 {
3130     Context *context = GetValidGlobalContext();
3131     EVENT(context, GLLightf, "context = %d, light = %s, pname = %s, param = %f", CID(context),
3132           GLenumToString(GLenumGroup::LightName, light),
3133           GLenumToString(GLenumGroup::LightParameter, pname), param);
3134 
3135     if (context)
3136     {
3137         LightParameter pnamePacked                            = PackParam<LightParameter>(pname);
3138         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3139         bool isCallValid =
3140             (context->skipValidation() ||
3141              ValidateLightf(context, angle::EntryPoint::GLLightf, light, pnamePacked, param));
3142         if (isCallValid)
3143         {
3144             context->lightf(light, pnamePacked, param);
3145         }
3146         ANGLE_CAPTURE(Lightf, isCallValid, context, light, pnamePacked, param);
3147     }
3148     else
3149     {
3150         GenerateContextLostErrorOnCurrentGlobalContext();
3151     }
3152 }
3153 
GL_Lightfv(GLenum light,GLenum pname,const GLfloat * params)3154 void GL_APIENTRY GL_Lightfv(GLenum light, GLenum pname, const GLfloat *params)
3155 {
3156     Context *context = GetValidGlobalContext();
3157     EVENT(context, GLLightfv, "context = %d, light = %s, pname = %s, params = 0x%016" PRIxPTR "",
3158           CID(context), GLenumToString(GLenumGroup::LightName, light),
3159           GLenumToString(GLenumGroup::LightParameter, pname), (uintptr_t)params);
3160 
3161     if (context)
3162     {
3163         LightParameter pnamePacked                            = PackParam<LightParameter>(pname);
3164         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3165         bool isCallValid =
3166             (context->skipValidation() ||
3167              ValidateLightfv(context, angle::EntryPoint::GLLightfv, light, pnamePacked, params));
3168         if (isCallValid)
3169         {
3170             context->lightfv(light, pnamePacked, params);
3171         }
3172         ANGLE_CAPTURE(Lightfv, isCallValid, context, light, pnamePacked, params);
3173     }
3174     else
3175     {
3176         GenerateContextLostErrorOnCurrentGlobalContext();
3177     }
3178 }
3179 
GL_Lighti(GLenum light,GLenum pname,GLint param)3180 void GL_APIENTRY GL_Lighti(GLenum light, GLenum pname, GLint param)
3181 {
3182     Context *context = GetValidGlobalContext();
3183     EVENT(context, GLLighti, "context = %d, light = %s, pname = %s, param = %d", CID(context),
3184           GLenumToString(GLenumGroup::LightName, light),
3185           GLenumToString(GLenumGroup::LightParameter, pname), param);
3186 
3187     if (context)
3188     {
3189         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3190         bool isCallValid =
3191             (context->skipValidation() ||
3192              ValidateLighti(context, angle::EntryPoint::GLLighti, light, pname, param));
3193         if (isCallValid)
3194         {
3195             context->lighti(light, pname, param);
3196         }
3197         ANGLE_CAPTURE(Lighti, isCallValid, context, light, pname, param);
3198     }
3199     else
3200     {
3201         GenerateContextLostErrorOnCurrentGlobalContext();
3202     }
3203 }
3204 
GL_Lightiv(GLenum light,GLenum pname,const GLint * params)3205 void GL_APIENTRY GL_Lightiv(GLenum light, GLenum pname, const GLint *params)
3206 {
3207     Context *context = GetValidGlobalContext();
3208     EVENT(context, GLLightiv, "context = %d, light = %s, pname = %s, params = 0x%016" PRIxPTR "",
3209           CID(context), GLenumToString(GLenumGroup::LightName, light),
3210           GLenumToString(GLenumGroup::LightParameter, pname), (uintptr_t)params);
3211 
3212     if (context)
3213     {
3214         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3215         bool isCallValid =
3216             (context->skipValidation() ||
3217              ValidateLightiv(context, angle::EntryPoint::GLLightiv, light, pname, params));
3218         if (isCallValid)
3219         {
3220             context->lightiv(light, pname, params);
3221         }
3222         ANGLE_CAPTURE(Lightiv, isCallValid, context, light, pname, params);
3223     }
3224     else
3225     {
3226         GenerateContextLostErrorOnCurrentGlobalContext();
3227     }
3228 }
3229 
GL_LineStipple(GLint factor,GLushort pattern)3230 void GL_APIENTRY GL_LineStipple(GLint factor, GLushort pattern)
3231 {
3232     Context *context = GetValidGlobalContext();
3233     EVENT(context, GLLineStipple, "context = %d, factor = %d, pattern = %u", CID(context), factor,
3234           pattern);
3235 
3236     if (context)
3237     {
3238         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3239         bool isCallValid =
3240             (context->skipValidation() ||
3241              ValidateLineStipple(context, angle::EntryPoint::GLLineStipple, factor, pattern));
3242         if (isCallValid)
3243         {
3244             context->lineStipple(factor, pattern);
3245         }
3246         ANGLE_CAPTURE(LineStipple, isCallValid, context, factor, pattern);
3247     }
3248     else
3249     {
3250         GenerateContextLostErrorOnCurrentGlobalContext();
3251     }
3252 }
3253 
GL_LineWidth(GLfloat width)3254 void GL_APIENTRY GL_LineWidth(GLfloat width)
3255 {
3256     Context *context = GetValidGlobalContext();
3257     EVENT(context, GLLineWidth, "context = %d, width = %f", CID(context), width);
3258 
3259     if (context)
3260     {
3261         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3262         bool isCallValid                                      = (context->skipValidation() ||
3263                             ValidateLineWidth(context, angle::EntryPoint::GLLineWidth, width));
3264         if (isCallValid)
3265         {
3266             context->lineWidth(width);
3267         }
3268         ANGLE_CAPTURE(LineWidth, isCallValid, context, width);
3269     }
3270     else
3271     {
3272         GenerateContextLostErrorOnCurrentGlobalContext();
3273     }
3274 }
3275 
GL_ListBase(GLuint base)3276 void GL_APIENTRY GL_ListBase(GLuint base)
3277 {
3278     Context *context = GetValidGlobalContext();
3279     EVENT(context, GLListBase, "context = %d, base = %u", CID(context), base);
3280 
3281     if (context)
3282     {
3283         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3284         bool isCallValid                                      = (context->skipValidation() ||
3285                             ValidateListBase(context, angle::EntryPoint::GLListBase, base));
3286         if (isCallValid)
3287         {
3288             context->listBase(base);
3289         }
3290         ANGLE_CAPTURE(ListBase, isCallValid, context, base);
3291     }
3292     else
3293     {
3294         GenerateContextLostErrorOnCurrentGlobalContext();
3295     }
3296 }
3297 
GL_LoadIdentity()3298 void GL_APIENTRY GL_LoadIdentity()
3299 {
3300     Context *context = GetValidGlobalContext();
3301     EVENT(context, GLLoadIdentity, "context = %d", CID(context));
3302 
3303     if (context)
3304     {
3305         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3306         bool isCallValid                                      = (context->skipValidation() ||
3307                             ValidateLoadIdentity(context, angle::EntryPoint::GLLoadIdentity));
3308         if (isCallValid)
3309         {
3310             context->loadIdentity();
3311         }
3312         ANGLE_CAPTURE(LoadIdentity, isCallValid, context);
3313     }
3314     else
3315     {
3316         GenerateContextLostErrorOnCurrentGlobalContext();
3317     }
3318 }
3319 
GL_LoadMatrixd(const GLdouble * m)3320 void GL_APIENTRY GL_LoadMatrixd(const GLdouble *m)
3321 {
3322     Context *context = GetValidGlobalContext();
3323     EVENT(context, GLLoadMatrixd, "context = %d, m = 0x%016" PRIxPTR "", CID(context),
3324           (uintptr_t)m);
3325 
3326     if (context)
3327     {
3328         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3329         bool isCallValid                                      = (context->skipValidation() ||
3330                             ValidateLoadMatrixd(context, angle::EntryPoint::GLLoadMatrixd, m));
3331         if (isCallValid)
3332         {
3333             context->loadMatrixd(m);
3334         }
3335         ANGLE_CAPTURE(LoadMatrixd, isCallValid, context, m);
3336     }
3337     else
3338     {
3339         GenerateContextLostErrorOnCurrentGlobalContext();
3340     }
3341 }
3342 
GL_LoadMatrixf(const GLfloat * m)3343 void GL_APIENTRY GL_LoadMatrixf(const GLfloat *m)
3344 {
3345     Context *context = GetValidGlobalContext();
3346     EVENT(context, GLLoadMatrixf, "context = %d, m = 0x%016" PRIxPTR "", CID(context),
3347           (uintptr_t)m);
3348 
3349     if (context)
3350     {
3351         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3352         bool isCallValid                                      = (context->skipValidation() ||
3353                             ValidateLoadMatrixf(context, angle::EntryPoint::GLLoadMatrixf, m));
3354         if (isCallValid)
3355         {
3356             context->loadMatrixf(m);
3357         }
3358         ANGLE_CAPTURE(LoadMatrixf, isCallValid, context, m);
3359     }
3360     else
3361     {
3362         GenerateContextLostErrorOnCurrentGlobalContext();
3363     }
3364 }
3365 
GL_LoadName(GLuint name)3366 void GL_APIENTRY GL_LoadName(GLuint name)
3367 {
3368     Context *context = GetValidGlobalContext();
3369     EVENT(context, GLLoadName, "context = %d, name = %u", CID(context), name);
3370 
3371     if (context)
3372     {
3373         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3374         bool isCallValid                                      = (context->skipValidation() ||
3375                             ValidateLoadName(context, angle::EntryPoint::GLLoadName, name));
3376         if (isCallValid)
3377         {
3378             context->loadName(name);
3379         }
3380         ANGLE_CAPTURE(LoadName, isCallValid, context, name);
3381     }
3382     else
3383     {
3384         GenerateContextLostErrorOnCurrentGlobalContext();
3385     }
3386 }
3387 
GL_LogicOp(GLenum opcode)3388 void GL_APIENTRY GL_LogicOp(GLenum opcode)
3389 {
3390     Context *context = GetValidGlobalContext();
3391     EVENT(context, GLLogicOp, "context = %d, opcode = %s", CID(context),
3392           GLenumToString(GLenumGroup::LogicOp, opcode));
3393 
3394     if (context)
3395     {
3396         LogicalOperation opcodePacked                         = PackParam<LogicalOperation>(opcode);
3397         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3398         bool isCallValid                                      = (context->skipValidation() ||
3399                             ValidateLogicOp(context, angle::EntryPoint::GLLogicOp, opcodePacked));
3400         if (isCallValid)
3401         {
3402             context->logicOp(opcodePacked);
3403         }
3404         ANGLE_CAPTURE(LogicOp, isCallValid, context, opcodePacked);
3405     }
3406     else
3407     {
3408         GenerateContextLostErrorOnCurrentGlobalContext();
3409     }
3410 }
3411 
3412 void GL_APIENTRY
GL_Map1d(GLenum target,GLdouble u1,GLdouble u2,GLint stride,GLint order,const GLdouble * points)3413 GL_Map1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)
3414 {
3415     Context *context = GetValidGlobalContext();
3416     EVENT(context, GLMap1d,
3417           "context = %d, target = %s, u1 = %f, u2 = %f, stride = %d, order = %d, points = "
3418           "0x%016" PRIxPTR "",
3419           CID(context), GLenumToString(GLenumGroup::MapTarget, target), u1, u2, stride, order,
3420           (uintptr_t)points);
3421 
3422     if (context)
3423     {
3424         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3425         bool isCallValid =
3426             (context->skipValidation() || ValidateMap1d(context, angle::EntryPoint::GLMap1d, target,
3427                                                         u1, u2, stride, order, points));
3428         if (isCallValid)
3429         {
3430             context->map1d(target, u1, u2, stride, order, points);
3431         }
3432         ANGLE_CAPTURE(Map1d, isCallValid, context, target, u1, u2, stride, order, points);
3433     }
3434     else
3435     {
3436         GenerateContextLostErrorOnCurrentGlobalContext();
3437     }
3438 }
3439 
3440 void GL_APIENTRY
GL_Map1f(GLenum target,GLfloat u1,GLfloat u2,GLint stride,GLint order,const GLfloat * points)3441 GL_Map1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)
3442 {
3443     Context *context = GetValidGlobalContext();
3444     EVENT(context, GLMap1f,
3445           "context = %d, target = %s, u1 = %f, u2 = %f, stride = %d, order = %d, points = "
3446           "0x%016" PRIxPTR "",
3447           CID(context), GLenumToString(GLenumGroup::MapTarget, target), u1, u2, stride, order,
3448           (uintptr_t)points);
3449 
3450     if (context)
3451     {
3452         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3453         bool isCallValid =
3454             (context->skipValidation() || ValidateMap1f(context, angle::EntryPoint::GLMap1f, target,
3455                                                         u1, u2, stride, order, points));
3456         if (isCallValid)
3457         {
3458             context->map1f(target, u1, u2, stride, order, points);
3459         }
3460         ANGLE_CAPTURE(Map1f, isCallValid, context, target, u1, u2, stride, order, points);
3461     }
3462     else
3463     {
3464         GenerateContextLostErrorOnCurrentGlobalContext();
3465     }
3466 }
3467 
GL_Map2d(GLenum target,GLdouble u1,GLdouble u2,GLint ustride,GLint uorder,GLdouble v1,GLdouble v2,GLint vstride,GLint vorder,const GLdouble * points)3468 void GL_APIENTRY GL_Map2d(GLenum target,
3469                           GLdouble u1,
3470                           GLdouble u2,
3471                           GLint ustride,
3472                           GLint uorder,
3473                           GLdouble v1,
3474                           GLdouble v2,
3475                           GLint vstride,
3476                           GLint vorder,
3477                           const GLdouble *points)
3478 {
3479     Context *context = GetValidGlobalContext();
3480     EVENT(context, GLMap2d,
3481           "context = %d, target = %s, u1 = %f, u2 = %f, ustride = %d, uorder = %d, v1 = %f, v2 = "
3482           "%f, vstride = %d, vorder = %d, points = 0x%016" PRIxPTR "",
3483           CID(context), GLenumToString(GLenumGroup::MapTarget, target), u1, u2, ustride, uorder, v1,
3484           v2, vstride, vorder, (uintptr_t)points);
3485 
3486     if (context)
3487     {
3488         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3489         bool isCallValid                                      = (context->skipValidation() ||
3490                             ValidateMap2d(context, angle::EntryPoint::GLMap2d, target, u1, u2,
3491                                           ustride, uorder, v1, v2, vstride, vorder, points));
3492         if (isCallValid)
3493         {
3494             context->map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
3495         }
3496         ANGLE_CAPTURE(Map2d, isCallValid, context, target, u1, u2, ustride, uorder, v1, v2, vstride,
3497                       vorder, points);
3498     }
3499     else
3500     {
3501         GenerateContextLostErrorOnCurrentGlobalContext();
3502     }
3503 }
3504 
GL_Map2f(GLenum target,GLfloat u1,GLfloat u2,GLint ustride,GLint uorder,GLfloat v1,GLfloat v2,GLint vstride,GLint vorder,const GLfloat * points)3505 void GL_APIENTRY GL_Map2f(GLenum target,
3506                           GLfloat u1,
3507                           GLfloat u2,
3508                           GLint ustride,
3509                           GLint uorder,
3510                           GLfloat v1,
3511                           GLfloat v2,
3512                           GLint vstride,
3513                           GLint vorder,
3514                           const GLfloat *points)
3515 {
3516     Context *context = GetValidGlobalContext();
3517     EVENT(context, GLMap2f,
3518           "context = %d, target = %s, u1 = %f, u2 = %f, ustride = %d, uorder = %d, v1 = %f, v2 = "
3519           "%f, vstride = %d, vorder = %d, points = 0x%016" PRIxPTR "",
3520           CID(context), GLenumToString(GLenumGroup::MapTarget, target), u1, u2, ustride, uorder, v1,
3521           v2, vstride, vorder, (uintptr_t)points);
3522 
3523     if (context)
3524     {
3525         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3526         bool isCallValid                                      = (context->skipValidation() ||
3527                             ValidateMap2f(context, angle::EntryPoint::GLMap2f, target, u1, u2,
3528                                           ustride, uorder, v1, v2, vstride, vorder, points));
3529         if (isCallValid)
3530         {
3531             context->map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
3532         }
3533         ANGLE_CAPTURE(Map2f, isCallValid, context, target, u1, u2, ustride, uorder, v1, v2, vstride,
3534                       vorder, points);
3535     }
3536     else
3537     {
3538         GenerateContextLostErrorOnCurrentGlobalContext();
3539     }
3540 }
3541 
GL_MapGrid1d(GLint un,GLdouble u1,GLdouble u2)3542 void GL_APIENTRY GL_MapGrid1d(GLint un, GLdouble u1, GLdouble u2)
3543 {
3544     Context *context = GetValidGlobalContext();
3545     EVENT(context, GLMapGrid1d, "context = %d, un = %d, u1 = %f, u2 = %f", CID(context), un, u1,
3546           u2);
3547 
3548     if (context)
3549     {
3550         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3551         bool isCallValid                                      = (context->skipValidation() ||
3552                             ValidateMapGrid1d(context, angle::EntryPoint::GLMapGrid1d, un, u1, u2));
3553         if (isCallValid)
3554         {
3555             context->mapGrid1d(un, u1, u2);
3556         }
3557         ANGLE_CAPTURE(MapGrid1d, isCallValid, context, un, u1, u2);
3558     }
3559     else
3560     {
3561         GenerateContextLostErrorOnCurrentGlobalContext();
3562     }
3563 }
3564 
GL_MapGrid1f(GLint un,GLfloat u1,GLfloat u2)3565 void GL_APIENTRY GL_MapGrid1f(GLint un, GLfloat u1, GLfloat u2)
3566 {
3567     Context *context = GetValidGlobalContext();
3568     EVENT(context, GLMapGrid1f, "context = %d, un = %d, u1 = %f, u2 = %f", CID(context), un, u1,
3569           u2);
3570 
3571     if (context)
3572     {
3573         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3574         bool isCallValid                                      = (context->skipValidation() ||
3575                             ValidateMapGrid1f(context, angle::EntryPoint::GLMapGrid1f, un, u1, u2));
3576         if (isCallValid)
3577         {
3578             context->mapGrid1f(un, u1, u2);
3579         }
3580         ANGLE_CAPTURE(MapGrid1f, isCallValid, context, un, u1, u2);
3581     }
3582     else
3583     {
3584         GenerateContextLostErrorOnCurrentGlobalContext();
3585     }
3586 }
3587 
3588 void GL_APIENTRY
GL_MapGrid2d(GLint un,GLdouble u1,GLdouble u2,GLint vn,GLdouble v1,GLdouble v2)3589 GL_MapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
3590 {
3591     Context *context = GetValidGlobalContext();
3592     EVENT(context, GLMapGrid2d,
3593           "context = %d, un = %d, u1 = %f, u2 = %f, vn = %d, v1 = %f, v2 = %f", CID(context), un,
3594           u1, u2, vn, v1, v2);
3595 
3596     if (context)
3597     {
3598         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3599         bool isCallValid =
3600             (context->skipValidation() ||
3601              ValidateMapGrid2d(context, angle::EntryPoint::GLMapGrid2d, un, u1, u2, vn, v1, v2));
3602         if (isCallValid)
3603         {
3604             context->mapGrid2d(un, u1, u2, vn, v1, v2);
3605         }
3606         ANGLE_CAPTURE(MapGrid2d, isCallValid, context, un, u1, u2, vn, v1, v2);
3607     }
3608     else
3609     {
3610         GenerateContextLostErrorOnCurrentGlobalContext();
3611     }
3612 }
3613 
GL_MapGrid2f(GLint un,GLfloat u1,GLfloat u2,GLint vn,GLfloat v1,GLfloat v2)3614 void GL_APIENTRY GL_MapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
3615 {
3616     Context *context = GetValidGlobalContext();
3617     EVENT(context, GLMapGrid2f,
3618           "context = %d, un = %d, u1 = %f, u2 = %f, vn = %d, v1 = %f, v2 = %f", CID(context), un,
3619           u1, u2, vn, v1, v2);
3620 
3621     if (context)
3622     {
3623         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3624         bool isCallValid =
3625             (context->skipValidation() ||
3626              ValidateMapGrid2f(context, angle::EntryPoint::GLMapGrid2f, un, u1, u2, vn, v1, v2));
3627         if (isCallValid)
3628         {
3629             context->mapGrid2f(un, u1, u2, vn, v1, v2);
3630         }
3631         ANGLE_CAPTURE(MapGrid2f, isCallValid, context, un, u1, u2, vn, v1, v2);
3632     }
3633     else
3634     {
3635         GenerateContextLostErrorOnCurrentGlobalContext();
3636     }
3637 }
3638 
GL_Materialf(GLenum face,GLenum pname,GLfloat param)3639 void GL_APIENTRY GL_Materialf(GLenum face, GLenum pname, GLfloat param)
3640 {
3641     Context *context = GetValidGlobalContext();
3642     EVENT(context, GLMaterialf, "context = %d, face = %s, pname = %s, param = %f", CID(context),
3643           GLenumToString(GLenumGroup::MaterialFace, face),
3644           GLenumToString(GLenumGroup::MaterialParameter, pname), param);
3645 
3646     if (context)
3647     {
3648         MaterialParameter pnamePacked                         = PackParam<MaterialParameter>(pname);
3649         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3650         bool isCallValid =
3651             (context->skipValidation() ||
3652              ValidateMaterialf(context, angle::EntryPoint::GLMaterialf, face, pnamePacked, param));
3653         if (isCallValid)
3654         {
3655             context->materialf(face, pnamePacked, param);
3656         }
3657         ANGLE_CAPTURE(Materialf, isCallValid, context, face, pnamePacked, param);
3658     }
3659     else
3660     {
3661         GenerateContextLostErrorOnCurrentGlobalContext();
3662     }
3663 }
3664 
GL_Materialfv(GLenum face,GLenum pname,const GLfloat * params)3665 void GL_APIENTRY GL_Materialfv(GLenum face, GLenum pname, const GLfloat *params)
3666 {
3667     Context *context = GetValidGlobalContext();
3668     EVENT(context, GLMaterialfv, "context = %d, face = %s, pname = %s, params = 0x%016" PRIxPTR "",
3669           CID(context), GLenumToString(GLenumGroup::MaterialFace, face),
3670           GLenumToString(GLenumGroup::MaterialParameter, pname), (uintptr_t)params);
3671 
3672     if (context)
3673     {
3674         MaterialParameter pnamePacked                         = PackParam<MaterialParameter>(pname);
3675         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3676         bool isCallValid                                      = (context->skipValidation() ||
3677                             ValidateMaterialfv(context, angle::EntryPoint::GLMaterialfv, face,
3678                                                pnamePacked, params));
3679         if (isCallValid)
3680         {
3681             context->materialfv(face, pnamePacked, params);
3682         }
3683         ANGLE_CAPTURE(Materialfv, isCallValid, context, face, pnamePacked, params);
3684     }
3685     else
3686     {
3687         GenerateContextLostErrorOnCurrentGlobalContext();
3688     }
3689 }
3690 
GL_Materiali(GLenum face,GLenum pname,GLint param)3691 void GL_APIENTRY GL_Materiali(GLenum face, GLenum pname, GLint param)
3692 {
3693     Context *context = GetValidGlobalContext();
3694     EVENT(context, GLMateriali, "context = %d, face = %s, pname = %s, param = %d", CID(context),
3695           GLenumToString(GLenumGroup::MaterialFace, face),
3696           GLenumToString(GLenumGroup::MaterialParameter, pname), param);
3697 
3698     if (context)
3699     {
3700         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3701         bool isCallValid =
3702             (context->skipValidation() ||
3703              ValidateMateriali(context, angle::EntryPoint::GLMateriali, face, pname, param));
3704         if (isCallValid)
3705         {
3706             context->materiali(face, pname, param);
3707         }
3708         ANGLE_CAPTURE(Materiali, isCallValid, context, face, pname, param);
3709     }
3710     else
3711     {
3712         GenerateContextLostErrorOnCurrentGlobalContext();
3713     }
3714 }
3715 
GL_Materialiv(GLenum face,GLenum pname,const GLint * params)3716 void GL_APIENTRY GL_Materialiv(GLenum face, GLenum pname, const GLint *params)
3717 {
3718     Context *context = GetValidGlobalContext();
3719     EVENT(context, GLMaterialiv, "context = %d, face = %s, pname = %s, params = 0x%016" PRIxPTR "",
3720           CID(context), GLenumToString(GLenumGroup::MaterialFace, face),
3721           GLenumToString(GLenumGroup::MaterialParameter, pname), (uintptr_t)params);
3722 
3723     if (context)
3724     {
3725         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3726         bool isCallValid =
3727             (context->skipValidation() ||
3728              ValidateMaterialiv(context, angle::EntryPoint::GLMaterialiv, face, pname, params));
3729         if (isCallValid)
3730         {
3731             context->materialiv(face, pname, params);
3732         }
3733         ANGLE_CAPTURE(Materialiv, isCallValid, context, face, pname, params);
3734     }
3735     else
3736     {
3737         GenerateContextLostErrorOnCurrentGlobalContext();
3738     }
3739 }
3740 
GL_MatrixMode(GLenum mode)3741 void GL_APIENTRY GL_MatrixMode(GLenum mode)
3742 {
3743     Context *context = GetValidGlobalContext();
3744     EVENT(context, GLMatrixMode, "context = %d, mode = %s", CID(context),
3745           GLenumToString(GLenumGroup::MatrixMode, mode));
3746 
3747     if (context)
3748     {
3749         MatrixType modePacked                                 = PackParam<MatrixType>(mode);
3750         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3751         bool isCallValid =
3752             (context->skipValidation() ||
3753              ValidateMatrixMode(context, angle::EntryPoint::GLMatrixMode, modePacked));
3754         if (isCallValid)
3755         {
3756             context->matrixMode(modePacked);
3757         }
3758         ANGLE_CAPTURE(MatrixMode, isCallValid, context, modePacked);
3759     }
3760     else
3761     {
3762         GenerateContextLostErrorOnCurrentGlobalContext();
3763     }
3764 }
3765 
GL_MultMatrixd(const GLdouble * m)3766 void GL_APIENTRY GL_MultMatrixd(const GLdouble *m)
3767 {
3768     Context *context = GetValidGlobalContext();
3769     EVENT(context, GLMultMatrixd, "context = %d, m = 0x%016" PRIxPTR "", CID(context),
3770           (uintptr_t)m);
3771 
3772     if (context)
3773     {
3774         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3775         bool isCallValid                                      = (context->skipValidation() ||
3776                             ValidateMultMatrixd(context, angle::EntryPoint::GLMultMatrixd, m));
3777         if (isCallValid)
3778         {
3779             context->multMatrixd(m);
3780         }
3781         ANGLE_CAPTURE(MultMatrixd, isCallValid, context, m);
3782     }
3783     else
3784     {
3785         GenerateContextLostErrorOnCurrentGlobalContext();
3786     }
3787 }
3788 
GL_MultMatrixf(const GLfloat * m)3789 void GL_APIENTRY GL_MultMatrixf(const GLfloat *m)
3790 {
3791     Context *context = GetValidGlobalContext();
3792     EVENT(context, GLMultMatrixf, "context = %d, m = 0x%016" PRIxPTR "", CID(context),
3793           (uintptr_t)m);
3794 
3795     if (context)
3796     {
3797         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3798         bool isCallValid                                      = (context->skipValidation() ||
3799                             ValidateMultMatrixf(context, angle::EntryPoint::GLMultMatrixf, m));
3800         if (isCallValid)
3801         {
3802             context->multMatrixf(m);
3803         }
3804         ANGLE_CAPTURE(MultMatrixf, isCallValid, context, m);
3805     }
3806     else
3807     {
3808         GenerateContextLostErrorOnCurrentGlobalContext();
3809     }
3810 }
3811 
GL_NewList(GLuint list,GLenum mode)3812 void GL_APIENTRY GL_NewList(GLuint list, GLenum mode)
3813 {
3814     Context *context = GetValidGlobalContext();
3815     EVENT(context, GLNewList, "context = %d, list = %u, mode = %s", CID(context), list,
3816           GLenumToString(GLenumGroup::ListMode, mode));
3817 
3818     if (context)
3819     {
3820         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3821         bool isCallValid                                      = (context->skipValidation() ||
3822                             ValidateNewList(context, angle::EntryPoint::GLNewList, list, mode));
3823         if (isCallValid)
3824         {
3825             context->newList(list, mode);
3826         }
3827         ANGLE_CAPTURE(NewList, isCallValid, context, list, mode);
3828     }
3829     else
3830     {
3831         GenerateContextLostErrorOnCurrentGlobalContext();
3832     }
3833 }
3834 
GL_Normal3b(GLbyte nx,GLbyte ny,GLbyte nz)3835 void GL_APIENTRY GL_Normal3b(GLbyte nx, GLbyte ny, GLbyte nz)
3836 {
3837     Context *context = GetValidGlobalContext();
3838     EVENT(context, GLNormal3b, "context = %d, nx = %d, ny = %d, nz = %d", CID(context), nx, ny, nz);
3839 
3840     if (context)
3841     {
3842         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3843         bool isCallValid                                      = (context->skipValidation() ||
3844                             ValidateNormal3b(context, angle::EntryPoint::GLNormal3b, nx, ny, nz));
3845         if (isCallValid)
3846         {
3847             context->normal3b(nx, ny, nz);
3848         }
3849         ANGLE_CAPTURE(Normal3b, isCallValid, context, nx, ny, nz);
3850     }
3851     else
3852     {
3853         GenerateContextLostErrorOnCurrentGlobalContext();
3854     }
3855 }
3856 
GL_Normal3bv(const GLbyte * v)3857 void GL_APIENTRY GL_Normal3bv(const GLbyte *v)
3858 {
3859     Context *context = GetValidGlobalContext();
3860     EVENT(context, GLNormal3bv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
3861 
3862     if (context)
3863     {
3864         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3865         bool isCallValid                                      = (context->skipValidation() ||
3866                             ValidateNormal3bv(context, angle::EntryPoint::GLNormal3bv, v));
3867         if (isCallValid)
3868         {
3869             context->normal3bv(v);
3870         }
3871         ANGLE_CAPTURE(Normal3bv, isCallValid, context, v);
3872     }
3873     else
3874     {
3875         GenerateContextLostErrorOnCurrentGlobalContext();
3876     }
3877 }
3878 
GL_Normal3d(GLdouble nx,GLdouble ny,GLdouble nz)3879 void GL_APIENTRY GL_Normal3d(GLdouble nx, GLdouble ny, GLdouble nz)
3880 {
3881     Context *context = GetValidGlobalContext();
3882     EVENT(context, GLNormal3d, "context = %d, nx = %f, ny = %f, nz = %f", CID(context), nx, ny, nz);
3883 
3884     if (context)
3885     {
3886         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3887         bool isCallValid                                      = (context->skipValidation() ||
3888                             ValidateNormal3d(context, angle::EntryPoint::GLNormal3d, nx, ny, nz));
3889         if (isCallValid)
3890         {
3891             context->normal3d(nx, ny, nz);
3892         }
3893         ANGLE_CAPTURE(Normal3d, isCallValid, context, nx, ny, nz);
3894     }
3895     else
3896     {
3897         GenerateContextLostErrorOnCurrentGlobalContext();
3898     }
3899 }
3900 
GL_Normal3dv(const GLdouble * v)3901 void GL_APIENTRY GL_Normal3dv(const GLdouble *v)
3902 {
3903     Context *context = GetValidGlobalContext();
3904     EVENT(context, GLNormal3dv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
3905 
3906     if (context)
3907     {
3908         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3909         bool isCallValid                                      = (context->skipValidation() ||
3910                             ValidateNormal3dv(context, angle::EntryPoint::GLNormal3dv, v));
3911         if (isCallValid)
3912         {
3913             context->normal3dv(v);
3914         }
3915         ANGLE_CAPTURE(Normal3dv, isCallValid, context, v);
3916     }
3917     else
3918     {
3919         GenerateContextLostErrorOnCurrentGlobalContext();
3920     }
3921 }
3922 
GL_Normal3f(GLfloat nx,GLfloat ny,GLfloat nz)3923 void GL_APIENTRY GL_Normal3f(GLfloat nx, GLfloat ny, GLfloat nz)
3924 {
3925     Context *context = GetValidGlobalContext();
3926     EVENT(context, GLNormal3f, "context = %d, nx = %f, ny = %f, nz = %f", CID(context), nx, ny, nz);
3927 
3928     if (context)
3929     {
3930         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3931         bool isCallValid                                      = (context->skipValidation() ||
3932                             ValidateNormal3f(context, angle::EntryPoint::GLNormal3f, nx, ny, nz));
3933         if (isCallValid)
3934         {
3935             context->normal3f(nx, ny, nz);
3936         }
3937         ANGLE_CAPTURE(Normal3f, isCallValid, context, nx, ny, nz);
3938     }
3939     else
3940     {
3941         GenerateContextLostErrorOnCurrentGlobalContext();
3942     }
3943 }
3944 
GL_Normal3fv(const GLfloat * v)3945 void GL_APIENTRY GL_Normal3fv(const GLfloat *v)
3946 {
3947     Context *context = GetValidGlobalContext();
3948     EVENT(context, GLNormal3fv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
3949 
3950     if (context)
3951     {
3952         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3953         bool isCallValid                                      = (context->skipValidation() ||
3954                             ValidateNormal3fv(context, angle::EntryPoint::GLNormal3fv, v));
3955         if (isCallValid)
3956         {
3957             context->normal3fv(v);
3958         }
3959         ANGLE_CAPTURE(Normal3fv, isCallValid, context, v);
3960     }
3961     else
3962     {
3963         GenerateContextLostErrorOnCurrentGlobalContext();
3964     }
3965 }
3966 
GL_Normal3i(GLint nx,GLint ny,GLint nz)3967 void GL_APIENTRY GL_Normal3i(GLint nx, GLint ny, GLint nz)
3968 {
3969     Context *context = GetValidGlobalContext();
3970     EVENT(context, GLNormal3i, "context = %d, nx = %d, ny = %d, nz = %d", CID(context), nx, ny, nz);
3971 
3972     if (context)
3973     {
3974         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3975         bool isCallValid                                      = (context->skipValidation() ||
3976                             ValidateNormal3i(context, angle::EntryPoint::GLNormal3i, nx, ny, nz));
3977         if (isCallValid)
3978         {
3979             context->normal3i(nx, ny, nz);
3980         }
3981         ANGLE_CAPTURE(Normal3i, isCallValid, context, nx, ny, nz);
3982     }
3983     else
3984     {
3985         GenerateContextLostErrorOnCurrentGlobalContext();
3986     }
3987 }
3988 
GL_Normal3iv(const GLint * v)3989 void GL_APIENTRY GL_Normal3iv(const GLint *v)
3990 {
3991     Context *context = GetValidGlobalContext();
3992     EVENT(context, GLNormal3iv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
3993 
3994     if (context)
3995     {
3996         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3997         bool isCallValid                                      = (context->skipValidation() ||
3998                             ValidateNormal3iv(context, angle::EntryPoint::GLNormal3iv, v));
3999         if (isCallValid)
4000         {
4001             context->normal3iv(v);
4002         }
4003         ANGLE_CAPTURE(Normal3iv, isCallValid, context, v);
4004     }
4005     else
4006     {
4007         GenerateContextLostErrorOnCurrentGlobalContext();
4008     }
4009 }
4010 
GL_Normal3s(GLshort nx,GLshort ny,GLshort nz)4011 void GL_APIENTRY GL_Normal3s(GLshort nx, GLshort ny, GLshort nz)
4012 {
4013     Context *context = GetValidGlobalContext();
4014     EVENT(context, GLNormal3s, "context = %d, nx = %d, ny = %d, nz = %d", CID(context), nx, ny, nz);
4015 
4016     if (context)
4017     {
4018         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4019         bool isCallValid                                      = (context->skipValidation() ||
4020                             ValidateNormal3s(context, angle::EntryPoint::GLNormal3s, nx, ny, nz));
4021         if (isCallValid)
4022         {
4023             context->normal3s(nx, ny, nz);
4024         }
4025         ANGLE_CAPTURE(Normal3s, isCallValid, context, nx, ny, nz);
4026     }
4027     else
4028     {
4029         GenerateContextLostErrorOnCurrentGlobalContext();
4030     }
4031 }
4032 
GL_Normal3sv(const GLshort * v)4033 void GL_APIENTRY GL_Normal3sv(const GLshort *v)
4034 {
4035     Context *context = GetValidGlobalContext();
4036     EVENT(context, GLNormal3sv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
4037 
4038     if (context)
4039     {
4040         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4041         bool isCallValid                                      = (context->skipValidation() ||
4042                             ValidateNormal3sv(context, angle::EntryPoint::GLNormal3sv, v));
4043         if (isCallValid)
4044         {
4045             context->normal3sv(v);
4046         }
4047         ANGLE_CAPTURE(Normal3sv, isCallValid, context, v);
4048     }
4049     else
4050     {
4051         GenerateContextLostErrorOnCurrentGlobalContext();
4052     }
4053 }
4054 
GL_Ortho(GLdouble left,GLdouble right,GLdouble bottom,GLdouble top,GLdouble zNear,GLdouble zFar)4055 void GL_APIENTRY GL_Ortho(GLdouble left,
4056                           GLdouble right,
4057                           GLdouble bottom,
4058                           GLdouble top,
4059                           GLdouble zNear,
4060                           GLdouble zFar)
4061 {
4062     Context *context = GetValidGlobalContext();
4063     EVENT(context, GLOrtho,
4064           "context = %d, left = %f, right = %f, bottom = %f, top = %f, zNear = %f, zFar = %f",
4065           CID(context), left, right, bottom, top, zNear, zFar);
4066 
4067     if (context)
4068     {
4069         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4070         bool isCallValid =
4071             (context->skipValidation() || ValidateOrtho(context, angle::EntryPoint::GLOrtho, left,
4072                                                         right, bottom, top, zNear, zFar));
4073         if (isCallValid)
4074         {
4075             context->ortho(left, right, bottom, top, zNear, zFar);
4076         }
4077         ANGLE_CAPTURE(Ortho, isCallValid, context, left, right, bottom, top, zNear, zFar);
4078     }
4079     else
4080     {
4081         GenerateContextLostErrorOnCurrentGlobalContext();
4082     }
4083 }
4084 
GL_PassThrough(GLfloat token)4085 void GL_APIENTRY GL_PassThrough(GLfloat token)
4086 {
4087     Context *context = GetValidGlobalContext();
4088     EVENT(context, GLPassThrough, "context = %d, token = %f", CID(context), token);
4089 
4090     if (context)
4091     {
4092         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4093         bool isCallValid                                      = (context->skipValidation() ||
4094                             ValidatePassThrough(context, angle::EntryPoint::GLPassThrough, token));
4095         if (isCallValid)
4096         {
4097             context->passThrough(token);
4098         }
4099         ANGLE_CAPTURE(PassThrough, isCallValid, context, token);
4100     }
4101     else
4102     {
4103         GenerateContextLostErrorOnCurrentGlobalContext();
4104     }
4105 }
4106 
GL_PixelMapfv(GLenum map,GLsizei mapsize,const GLfloat * values)4107 void GL_APIENTRY GL_PixelMapfv(GLenum map, GLsizei mapsize, const GLfloat *values)
4108 {
4109     Context *context = GetValidGlobalContext();
4110     EVENT(context, GLPixelMapfv, "context = %d, map = %s, mapsize = %d, values = 0x%016" PRIxPTR "",
4111           CID(context), GLenumToString(GLenumGroup::PixelMap, map), mapsize, (uintptr_t)values);
4112 
4113     if (context)
4114     {
4115         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4116         bool isCallValid =
4117             (context->skipValidation() ||
4118              ValidatePixelMapfv(context, angle::EntryPoint::GLPixelMapfv, map, mapsize, values));
4119         if (isCallValid)
4120         {
4121             context->pixelMapfv(map, mapsize, values);
4122         }
4123         ANGLE_CAPTURE(PixelMapfv, isCallValid, context, map, mapsize, values);
4124     }
4125     else
4126     {
4127         GenerateContextLostErrorOnCurrentGlobalContext();
4128     }
4129 }
4130 
GL_PixelMapuiv(GLenum map,GLsizei mapsize,const GLuint * values)4131 void GL_APIENTRY GL_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values)
4132 {
4133     Context *context = GetValidGlobalContext();
4134     EVENT(context, GLPixelMapuiv,
4135           "context = %d, map = %s, mapsize = %d, values = 0x%016" PRIxPTR "", CID(context),
4136           GLenumToString(GLenumGroup::PixelMap, map), mapsize, (uintptr_t)values);
4137 
4138     if (context)
4139     {
4140         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4141         bool isCallValid =
4142             (context->skipValidation() ||
4143              ValidatePixelMapuiv(context, angle::EntryPoint::GLPixelMapuiv, map, mapsize, values));
4144         if (isCallValid)
4145         {
4146             context->pixelMapuiv(map, mapsize, values);
4147         }
4148         ANGLE_CAPTURE(PixelMapuiv, isCallValid, context, map, mapsize, values);
4149     }
4150     else
4151     {
4152         GenerateContextLostErrorOnCurrentGlobalContext();
4153     }
4154 }
4155 
GL_PixelMapusv(GLenum map,GLsizei mapsize,const GLushort * values)4156 void GL_APIENTRY GL_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values)
4157 {
4158     Context *context = GetValidGlobalContext();
4159     EVENT(context, GLPixelMapusv,
4160           "context = %d, map = %s, mapsize = %d, values = 0x%016" PRIxPTR "", CID(context),
4161           GLenumToString(GLenumGroup::PixelMap, map), mapsize, (uintptr_t)values);
4162 
4163     if (context)
4164     {
4165         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4166         bool isCallValid =
4167             (context->skipValidation() ||
4168              ValidatePixelMapusv(context, angle::EntryPoint::GLPixelMapusv, map, mapsize, values));
4169         if (isCallValid)
4170         {
4171             context->pixelMapusv(map, mapsize, values);
4172         }
4173         ANGLE_CAPTURE(PixelMapusv, isCallValid, context, map, mapsize, values);
4174     }
4175     else
4176     {
4177         GenerateContextLostErrorOnCurrentGlobalContext();
4178     }
4179 }
4180 
GL_PixelStoref(GLenum pname,GLfloat param)4181 void GL_APIENTRY GL_PixelStoref(GLenum pname, GLfloat param)
4182 {
4183     Context *context = GetValidGlobalContext();
4184     EVENT(context, GLPixelStoref, "context = %d, pname = %s, param = %f", CID(context),
4185           GLenumToString(GLenumGroup::PixelStoreParameter, pname), param);
4186 
4187     if (context)
4188     {
4189         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4190         bool isCallValid =
4191             (context->skipValidation() ||
4192              ValidatePixelStoref(context, angle::EntryPoint::GLPixelStoref, pname, param));
4193         if (isCallValid)
4194         {
4195             context->pixelStoref(pname, param);
4196         }
4197         ANGLE_CAPTURE(PixelStoref, isCallValid, context, pname, param);
4198     }
4199     else
4200     {
4201         GenerateContextLostErrorOnCurrentGlobalContext();
4202     }
4203 }
4204 
GL_PixelStorei(GLenum pname,GLint param)4205 void GL_APIENTRY GL_PixelStorei(GLenum pname, GLint param)
4206 {
4207     Context *context = GetValidGlobalContext();
4208     EVENT(context, GLPixelStorei, "context = %d, pname = %s, param = %d", CID(context),
4209           GLenumToString(GLenumGroup::PixelStoreParameter, pname), param);
4210 
4211     if (context)
4212     {
4213         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4214         bool isCallValid =
4215             (context->skipValidation() ||
4216              ValidatePixelStorei(context, angle::EntryPoint::GLPixelStorei, pname, param));
4217         if (isCallValid)
4218         {
4219             context->pixelStorei(pname, param);
4220         }
4221         ANGLE_CAPTURE(PixelStorei, isCallValid, context, pname, param);
4222     }
4223     else
4224     {
4225         GenerateContextLostErrorOnCurrentGlobalContext();
4226     }
4227 }
4228 
GL_PixelTransferf(GLenum pname,GLfloat param)4229 void GL_APIENTRY GL_PixelTransferf(GLenum pname, GLfloat param)
4230 {
4231     Context *context = GetValidGlobalContext();
4232     EVENT(context, GLPixelTransferf, "context = %d, pname = %s, param = %f", CID(context),
4233           GLenumToString(GLenumGroup::PixelTransferParameter, pname), param);
4234 
4235     if (context)
4236     {
4237         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4238         bool isCallValid =
4239             (context->skipValidation() ||
4240              ValidatePixelTransferf(context, angle::EntryPoint::GLPixelTransferf, pname, param));
4241         if (isCallValid)
4242         {
4243             context->pixelTransferf(pname, param);
4244         }
4245         ANGLE_CAPTURE(PixelTransferf, isCallValid, context, pname, param);
4246     }
4247     else
4248     {
4249         GenerateContextLostErrorOnCurrentGlobalContext();
4250     }
4251 }
4252 
GL_PixelTransferi(GLenum pname,GLint param)4253 void GL_APIENTRY GL_PixelTransferi(GLenum pname, GLint param)
4254 {
4255     Context *context = GetValidGlobalContext();
4256     EVENT(context, GLPixelTransferi, "context = %d, pname = %s, param = %d", CID(context),
4257           GLenumToString(GLenumGroup::PixelTransferParameter, pname), param);
4258 
4259     if (context)
4260     {
4261         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4262         bool isCallValid =
4263             (context->skipValidation() ||
4264              ValidatePixelTransferi(context, angle::EntryPoint::GLPixelTransferi, pname, param));
4265         if (isCallValid)
4266         {
4267             context->pixelTransferi(pname, param);
4268         }
4269         ANGLE_CAPTURE(PixelTransferi, isCallValid, context, pname, param);
4270     }
4271     else
4272     {
4273         GenerateContextLostErrorOnCurrentGlobalContext();
4274     }
4275 }
4276 
GL_PixelZoom(GLfloat xfactor,GLfloat yfactor)4277 void GL_APIENTRY GL_PixelZoom(GLfloat xfactor, GLfloat yfactor)
4278 {
4279     Context *context = GetValidGlobalContext();
4280     EVENT(context, GLPixelZoom, "context = %d, xfactor = %f, yfactor = %f", CID(context), xfactor,
4281           yfactor);
4282 
4283     if (context)
4284     {
4285         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4286         bool isCallValid =
4287             (context->skipValidation() ||
4288              ValidatePixelZoom(context, angle::EntryPoint::GLPixelZoom, xfactor, yfactor));
4289         if (isCallValid)
4290         {
4291             context->pixelZoom(xfactor, yfactor);
4292         }
4293         ANGLE_CAPTURE(PixelZoom, isCallValid, context, xfactor, yfactor);
4294     }
4295     else
4296     {
4297         GenerateContextLostErrorOnCurrentGlobalContext();
4298     }
4299 }
4300 
GL_PointSize(GLfloat size)4301 void GL_APIENTRY GL_PointSize(GLfloat size)
4302 {
4303     Context *context = GetValidGlobalContext();
4304     EVENT(context, GLPointSize, "context = %d, size = %f", CID(context), size);
4305 
4306     if (context)
4307     {
4308         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4309         bool isCallValid                                      = (context->skipValidation() ||
4310                             ValidatePointSize(context, angle::EntryPoint::GLPointSize, size));
4311         if (isCallValid)
4312         {
4313             context->pointSize(size);
4314         }
4315         ANGLE_CAPTURE(PointSize, isCallValid, context, size);
4316     }
4317     else
4318     {
4319         GenerateContextLostErrorOnCurrentGlobalContext();
4320     }
4321 }
4322 
GL_PolygonMode(GLenum face,GLenum mode)4323 void GL_APIENTRY GL_PolygonMode(GLenum face, GLenum mode)
4324 {
4325     Context *context = GetValidGlobalContext();
4326     EVENT(context, GLPolygonMode, "context = %d, face = %s, mode = %s", CID(context),
4327           GLenumToString(GLenumGroup::MaterialFace, face),
4328           GLenumToString(GLenumGroup::PolygonMode, mode));
4329 
4330     if (context)
4331     {
4332         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4333         bool isCallValid =
4334             (context->skipValidation() ||
4335              ValidatePolygonMode(context, angle::EntryPoint::GLPolygonMode, face, mode));
4336         if (isCallValid)
4337         {
4338             context->polygonMode(face, mode);
4339         }
4340         ANGLE_CAPTURE(PolygonMode, isCallValid, context, face, mode);
4341     }
4342     else
4343     {
4344         GenerateContextLostErrorOnCurrentGlobalContext();
4345     }
4346 }
4347 
GL_PolygonStipple(const GLubyte * mask)4348 void GL_APIENTRY GL_PolygonStipple(const GLubyte *mask)
4349 {
4350     Context *context = GetValidGlobalContext();
4351     EVENT(context, GLPolygonStipple, "context = %d, mask = 0x%016" PRIxPTR "", CID(context),
4352           (uintptr_t)mask);
4353 
4354     if (context)
4355     {
4356         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4357         bool isCallValid =
4358             (context->skipValidation() ||
4359              ValidatePolygonStipple(context, angle::EntryPoint::GLPolygonStipple, mask));
4360         if (isCallValid)
4361         {
4362             context->polygonStipple(mask);
4363         }
4364         ANGLE_CAPTURE(PolygonStipple, isCallValid, context, mask);
4365     }
4366     else
4367     {
4368         GenerateContextLostErrorOnCurrentGlobalContext();
4369     }
4370 }
4371 
GL_PopAttrib()4372 void GL_APIENTRY GL_PopAttrib()
4373 {
4374     Context *context = GetValidGlobalContext();
4375     EVENT(context, GLPopAttrib, "context = %d", CID(context));
4376 
4377     if (context)
4378     {
4379         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4380         bool isCallValid                                      = (context->skipValidation() ||
4381                             ValidatePopAttrib(context, angle::EntryPoint::GLPopAttrib));
4382         if (isCallValid)
4383         {
4384             context->popAttrib();
4385         }
4386         ANGLE_CAPTURE(PopAttrib, isCallValid, context);
4387     }
4388     else
4389     {
4390         GenerateContextLostErrorOnCurrentGlobalContext();
4391     }
4392 }
4393 
GL_PopMatrix()4394 void GL_APIENTRY GL_PopMatrix()
4395 {
4396     Context *context = GetValidGlobalContext();
4397     EVENT(context, GLPopMatrix, "context = %d", CID(context));
4398 
4399     if (context)
4400     {
4401         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4402         bool isCallValid                                      = (context->skipValidation() ||
4403                             ValidatePopMatrix(context, angle::EntryPoint::GLPopMatrix));
4404         if (isCallValid)
4405         {
4406             context->popMatrix();
4407         }
4408         ANGLE_CAPTURE(PopMatrix, isCallValid, context);
4409     }
4410     else
4411     {
4412         GenerateContextLostErrorOnCurrentGlobalContext();
4413     }
4414 }
4415 
GL_PopName()4416 void GL_APIENTRY GL_PopName()
4417 {
4418     Context *context = GetValidGlobalContext();
4419     EVENT(context, GLPopName, "context = %d", CID(context));
4420 
4421     if (context)
4422     {
4423         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4424         bool isCallValid =
4425             (context->skipValidation() || ValidatePopName(context, angle::EntryPoint::GLPopName));
4426         if (isCallValid)
4427         {
4428             context->popName();
4429         }
4430         ANGLE_CAPTURE(PopName, isCallValid, context);
4431     }
4432     else
4433     {
4434         GenerateContextLostErrorOnCurrentGlobalContext();
4435     }
4436 }
4437 
GL_PushAttrib(GLbitfield mask)4438 void GL_APIENTRY GL_PushAttrib(GLbitfield mask)
4439 {
4440     Context *context = GetValidGlobalContext();
4441     EVENT(context, GLPushAttrib, "context = %d, mask = %s", CID(context),
4442           GLbitfieldToString(GLenumGroup::AttribMask, mask).c_str());
4443 
4444     if (context)
4445     {
4446         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4447         bool isCallValid                                      = (context->skipValidation() ||
4448                             ValidatePushAttrib(context, angle::EntryPoint::GLPushAttrib, mask));
4449         if (isCallValid)
4450         {
4451             context->pushAttrib(mask);
4452         }
4453         ANGLE_CAPTURE(PushAttrib, isCallValid, context, mask);
4454     }
4455     else
4456     {
4457         GenerateContextLostErrorOnCurrentGlobalContext();
4458     }
4459 }
4460 
GL_PushMatrix()4461 void GL_APIENTRY GL_PushMatrix()
4462 {
4463     Context *context = GetValidGlobalContext();
4464     EVENT(context, GLPushMatrix, "context = %d", CID(context));
4465 
4466     if (context)
4467     {
4468         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4469         bool isCallValid                                      = (context->skipValidation() ||
4470                             ValidatePushMatrix(context, angle::EntryPoint::GLPushMatrix));
4471         if (isCallValid)
4472         {
4473             context->pushMatrix();
4474         }
4475         ANGLE_CAPTURE(PushMatrix, isCallValid, context);
4476     }
4477     else
4478     {
4479         GenerateContextLostErrorOnCurrentGlobalContext();
4480     }
4481 }
4482 
GL_PushName(GLuint name)4483 void GL_APIENTRY GL_PushName(GLuint name)
4484 {
4485     Context *context = GetValidGlobalContext();
4486     EVENT(context, GLPushName, "context = %d, name = %u", CID(context), name);
4487 
4488     if (context)
4489     {
4490         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4491         bool isCallValid                                      = (context->skipValidation() ||
4492                             ValidatePushName(context, angle::EntryPoint::GLPushName, name));
4493         if (isCallValid)
4494         {
4495             context->pushName(name);
4496         }
4497         ANGLE_CAPTURE(PushName, isCallValid, context, name);
4498     }
4499     else
4500     {
4501         GenerateContextLostErrorOnCurrentGlobalContext();
4502     }
4503 }
4504 
GL_RasterPos2d(GLdouble x,GLdouble y)4505 void GL_APIENTRY GL_RasterPos2d(GLdouble x, GLdouble y)
4506 {
4507     Context *context = GetValidGlobalContext();
4508     EVENT(context, GLRasterPos2d, "context = %d, x = %f, y = %f", CID(context), x, y);
4509 
4510     if (context)
4511     {
4512         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4513         bool isCallValid                                      = (context->skipValidation() ||
4514                             ValidateRasterPos2d(context, angle::EntryPoint::GLRasterPos2d, x, y));
4515         if (isCallValid)
4516         {
4517             context->rasterPos2d(x, y);
4518         }
4519         ANGLE_CAPTURE(RasterPos2d, isCallValid, context, x, y);
4520     }
4521     else
4522     {
4523         GenerateContextLostErrorOnCurrentGlobalContext();
4524     }
4525 }
4526 
GL_RasterPos2dv(const GLdouble * v)4527 void GL_APIENTRY GL_RasterPos2dv(const GLdouble *v)
4528 {
4529     Context *context = GetValidGlobalContext();
4530     EVENT(context, GLRasterPos2dv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
4531           (uintptr_t)v);
4532 
4533     if (context)
4534     {
4535         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4536         bool isCallValid                                      = (context->skipValidation() ||
4537                             ValidateRasterPos2dv(context, angle::EntryPoint::GLRasterPos2dv, v));
4538         if (isCallValid)
4539         {
4540             context->rasterPos2dv(v);
4541         }
4542         ANGLE_CAPTURE(RasterPos2dv, isCallValid, context, v);
4543     }
4544     else
4545     {
4546         GenerateContextLostErrorOnCurrentGlobalContext();
4547     }
4548 }
4549 
GL_RasterPos2f(GLfloat x,GLfloat y)4550 void GL_APIENTRY GL_RasterPos2f(GLfloat x, GLfloat y)
4551 {
4552     Context *context = GetValidGlobalContext();
4553     EVENT(context, GLRasterPos2f, "context = %d, x = %f, y = %f", CID(context), x, y);
4554 
4555     if (context)
4556     {
4557         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4558         bool isCallValid                                      = (context->skipValidation() ||
4559                             ValidateRasterPos2f(context, angle::EntryPoint::GLRasterPos2f, x, y));
4560         if (isCallValid)
4561         {
4562             context->rasterPos2f(x, y);
4563         }
4564         ANGLE_CAPTURE(RasterPos2f, isCallValid, context, x, y);
4565     }
4566     else
4567     {
4568         GenerateContextLostErrorOnCurrentGlobalContext();
4569     }
4570 }
4571 
GL_RasterPos2fv(const GLfloat * v)4572 void GL_APIENTRY GL_RasterPos2fv(const GLfloat *v)
4573 {
4574     Context *context = GetValidGlobalContext();
4575     EVENT(context, GLRasterPos2fv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
4576           (uintptr_t)v);
4577 
4578     if (context)
4579     {
4580         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4581         bool isCallValid                                      = (context->skipValidation() ||
4582                             ValidateRasterPos2fv(context, angle::EntryPoint::GLRasterPos2fv, v));
4583         if (isCallValid)
4584         {
4585             context->rasterPos2fv(v);
4586         }
4587         ANGLE_CAPTURE(RasterPos2fv, isCallValid, context, v);
4588     }
4589     else
4590     {
4591         GenerateContextLostErrorOnCurrentGlobalContext();
4592     }
4593 }
4594 
GL_RasterPos2i(GLint x,GLint y)4595 void GL_APIENTRY GL_RasterPos2i(GLint x, GLint y)
4596 {
4597     Context *context = GetValidGlobalContext();
4598     EVENT(context, GLRasterPos2i, "context = %d, x = %d, y = %d", CID(context), x, y);
4599 
4600     if (context)
4601     {
4602         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4603         bool isCallValid                                      = (context->skipValidation() ||
4604                             ValidateRasterPos2i(context, angle::EntryPoint::GLRasterPos2i, x, y));
4605         if (isCallValid)
4606         {
4607             context->rasterPos2i(x, y);
4608         }
4609         ANGLE_CAPTURE(RasterPos2i, isCallValid, context, x, y);
4610     }
4611     else
4612     {
4613         GenerateContextLostErrorOnCurrentGlobalContext();
4614     }
4615 }
4616 
GL_RasterPos2iv(const GLint * v)4617 void GL_APIENTRY GL_RasterPos2iv(const GLint *v)
4618 {
4619     Context *context = GetValidGlobalContext();
4620     EVENT(context, GLRasterPos2iv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
4621           (uintptr_t)v);
4622 
4623     if (context)
4624     {
4625         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4626         bool isCallValid                                      = (context->skipValidation() ||
4627                             ValidateRasterPos2iv(context, angle::EntryPoint::GLRasterPos2iv, v));
4628         if (isCallValid)
4629         {
4630             context->rasterPos2iv(v);
4631         }
4632         ANGLE_CAPTURE(RasterPos2iv, isCallValid, context, v);
4633     }
4634     else
4635     {
4636         GenerateContextLostErrorOnCurrentGlobalContext();
4637     }
4638 }
4639 
GL_RasterPos2s(GLshort x,GLshort y)4640 void GL_APIENTRY GL_RasterPos2s(GLshort x, GLshort y)
4641 {
4642     Context *context = GetValidGlobalContext();
4643     EVENT(context, GLRasterPos2s, "context = %d, x = %d, y = %d", CID(context), x, y);
4644 
4645     if (context)
4646     {
4647         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4648         bool isCallValid                                      = (context->skipValidation() ||
4649                             ValidateRasterPos2s(context, angle::EntryPoint::GLRasterPos2s, x, y));
4650         if (isCallValid)
4651         {
4652             context->rasterPos2s(x, y);
4653         }
4654         ANGLE_CAPTURE(RasterPos2s, isCallValid, context, x, y);
4655     }
4656     else
4657     {
4658         GenerateContextLostErrorOnCurrentGlobalContext();
4659     }
4660 }
4661 
GL_RasterPos2sv(const GLshort * v)4662 void GL_APIENTRY GL_RasterPos2sv(const GLshort *v)
4663 {
4664     Context *context = GetValidGlobalContext();
4665     EVENT(context, GLRasterPos2sv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
4666           (uintptr_t)v);
4667 
4668     if (context)
4669     {
4670         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4671         bool isCallValid                                      = (context->skipValidation() ||
4672                             ValidateRasterPos2sv(context, angle::EntryPoint::GLRasterPos2sv, v));
4673         if (isCallValid)
4674         {
4675             context->rasterPos2sv(v);
4676         }
4677         ANGLE_CAPTURE(RasterPos2sv, isCallValid, context, v);
4678     }
4679     else
4680     {
4681         GenerateContextLostErrorOnCurrentGlobalContext();
4682     }
4683 }
4684 
GL_RasterPos3d(GLdouble x,GLdouble y,GLdouble z)4685 void GL_APIENTRY GL_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
4686 {
4687     Context *context = GetValidGlobalContext();
4688     EVENT(context, GLRasterPos3d, "context = %d, x = %f, y = %f, z = %f", CID(context), x, y, z);
4689 
4690     if (context)
4691     {
4692         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4693         bool isCallValid =
4694             (context->skipValidation() ||
4695              ValidateRasterPos3d(context, angle::EntryPoint::GLRasterPos3d, x, y, z));
4696         if (isCallValid)
4697         {
4698             context->rasterPos3d(x, y, z);
4699         }
4700         ANGLE_CAPTURE(RasterPos3d, isCallValid, context, x, y, z);
4701     }
4702     else
4703     {
4704         GenerateContextLostErrorOnCurrentGlobalContext();
4705     }
4706 }
4707 
GL_RasterPos3dv(const GLdouble * v)4708 void GL_APIENTRY GL_RasterPos3dv(const GLdouble *v)
4709 {
4710     Context *context = GetValidGlobalContext();
4711     EVENT(context, GLRasterPos3dv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
4712           (uintptr_t)v);
4713 
4714     if (context)
4715     {
4716         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4717         bool isCallValid                                      = (context->skipValidation() ||
4718                             ValidateRasterPos3dv(context, angle::EntryPoint::GLRasterPos3dv, v));
4719         if (isCallValid)
4720         {
4721             context->rasterPos3dv(v);
4722         }
4723         ANGLE_CAPTURE(RasterPos3dv, isCallValid, context, v);
4724     }
4725     else
4726     {
4727         GenerateContextLostErrorOnCurrentGlobalContext();
4728     }
4729 }
4730 
GL_RasterPos3f(GLfloat x,GLfloat y,GLfloat z)4731 void GL_APIENTRY GL_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
4732 {
4733     Context *context = GetValidGlobalContext();
4734     EVENT(context, GLRasterPos3f, "context = %d, x = %f, y = %f, z = %f", CID(context), x, y, z);
4735 
4736     if (context)
4737     {
4738         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4739         bool isCallValid =
4740             (context->skipValidation() ||
4741              ValidateRasterPos3f(context, angle::EntryPoint::GLRasterPos3f, x, y, z));
4742         if (isCallValid)
4743         {
4744             context->rasterPos3f(x, y, z);
4745         }
4746         ANGLE_CAPTURE(RasterPos3f, isCallValid, context, x, y, z);
4747     }
4748     else
4749     {
4750         GenerateContextLostErrorOnCurrentGlobalContext();
4751     }
4752 }
4753 
GL_RasterPos3fv(const GLfloat * v)4754 void GL_APIENTRY GL_RasterPos3fv(const GLfloat *v)
4755 {
4756     Context *context = GetValidGlobalContext();
4757     EVENT(context, GLRasterPos3fv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
4758           (uintptr_t)v);
4759 
4760     if (context)
4761     {
4762         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4763         bool isCallValid                                      = (context->skipValidation() ||
4764                             ValidateRasterPos3fv(context, angle::EntryPoint::GLRasterPos3fv, v));
4765         if (isCallValid)
4766         {
4767             context->rasterPos3fv(v);
4768         }
4769         ANGLE_CAPTURE(RasterPos3fv, isCallValid, context, v);
4770     }
4771     else
4772     {
4773         GenerateContextLostErrorOnCurrentGlobalContext();
4774     }
4775 }
4776 
GL_RasterPos3i(GLint x,GLint y,GLint z)4777 void GL_APIENTRY GL_RasterPos3i(GLint x, GLint y, GLint z)
4778 {
4779     Context *context = GetValidGlobalContext();
4780     EVENT(context, GLRasterPos3i, "context = %d, x = %d, y = %d, z = %d", CID(context), x, y, z);
4781 
4782     if (context)
4783     {
4784         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4785         bool isCallValid =
4786             (context->skipValidation() ||
4787              ValidateRasterPos3i(context, angle::EntryPoint::GLRasterPos3i, x, y, z));
4788         if (isCallValid)
4789         {
4790             context->rasterPos3i(x, y, z);
4791         }
4792         ANGLE_CAPTURE(RasterPos3i, isCallValid, context, x, y, z);
4793     }
4794     else
4795     {
4796         GenerateContextLostErrorOnCurrentGlobalContext();
4797     }
4798 }
4799 
GL_RasterPos3iv(const GLint * v)4800 void GL_APIENTRY GL_RasterPos3iv(const GLint *v)
4801 {
4802     Context *context = GetValidGlobalContext();
4803     EVENT(context, GLRasterPos3iv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
4804           (uintptr_t)v);
4805 
4806     if (context)
4807     {
4808         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4809         bool isCallValid                                      = (context->skipValidation() ||
4810                             ValidateRasterPos3iv(context, angle::EntryPoint::GLRasterPos3iv, v));
4811         if (isCallValid)
4812         {
4813             context->rasterPos3iv(v);
4814         }
4815         ANGLE_CAPTURE(RasterPos3iv, isCallValid, context, v);
4816     }
4817     else
4818     {
4819         GenerateContextLostErrorOnCurrentGlobalContext();
4820     }
4821 }
4822 
GL_RasterPos3s(GLshort x,GLshort y,GLshort z)4823 void GL_APIENTRY GL_RasterPos3s(GLshort x, GLshort y, GLshort z)
4824 {
4825     Context *context = GetValidGlobalContext();
4826     EVENT(context, GLRasterPos3s, "context = %d, x = %d, y = %d, z = %d", CID(context), x, y, z);
4827 
4828     if (context)
4829     {
4830         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4831         bool isCallValid =
4832             (context->skipValidation() ||
4833              ValidateRasterPos3s(context, angle::EntryPoint::GLRasterPos3s, x, y, z));
4834         if (isCallValid)
4835         {
4836             context->rasterPos3s(x, y, z);
4837         }
4838         ANGLE_CAPTURE(RasterPos3s, isCallValid, context, x, y, z);
4839     }
4840     else
4841     {
4842         GenerateContextLostErrorOnCurrentGlobalContext();
4843     }
4844 }
4845 
GL_RasterPos3sv(const GLshort * v)4846 void GL_APIENTRY GL_RasterPos3sv(const GLshort *v)
4847 {
4848     Context *context = GetValidGlobalContext();
4849     EVENT(context, GLRasterPos3sv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
4850           (uintptr_t)v);
4851 
4852     if (context)
4853     {
4854         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4855         bool isCallValid                                      = (context->skipValidation() ||
4856                             ValidateRasterPos3sv(context, angle::EntryPoint::GLRasterPos3sv, v));
4857         if (isCallValid)
4858         {
4859             context->rasterPos3sv(v);
4860         }
4861         ANGLE_CAPTURE(RasterPos3sv, isCallValid, context, v);
4862     }
4863     else
4864     {
4865         GenerateContextLostErrorOnCurrentGlobalContext();
4866     }
4867 }
4868 
GL_RasterPos4d(GLdouble x,GLdouble y,GLdouble z,GLdouble w)4869 void GL_APIENTRY GL_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
4870 {
4871     Context *context = GetValidGlobalContext();
4872     EVENT(context, GLRasterPos4d, "context = %d, x = %f, y = %f, z = %f, w = %f", CID(context), x,
4873           y, z, w);
4874 
4875     if (context)
4876     {
4877         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4878         bool isCallValid =
4879             (context->skipValidation() ||
4880              ValidateRasterPos4d(context, angle::EntryPoint::GLRasterPos4d, x, y, z, w));
4881         if (isCallValid)
4882         {
4883             context->rasterPos4d(x, y, z, w);
4884         }
4885         ANGLE_CAPTURE(RasterPos4d, isCallValid, context, x, y, z, w);
4886     }
4887     else
4888     {
4889         GenerateContextLostErrorOnCurrentGlobalContext();
4890     }
4891 }
4892 
GL_RasterPos4dv(const GLdouble * v)4893 void GL_APIENTRY GL_RasterPos4dv(const GLdouble *v)
4894 {
4895     Context *context = GetValidGlobalContext();
4896     EVENT(context, GLRasterPos4dv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
4897           (uintptr_t)v);
4898 
4899     if (context)
4900     {
4901         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4902         bool isCallValid                                      = (context->skipValidation() ||
4903                             ValidateRasterPos4dv(context, angle::EntryPoint::GLRasterPos4dv, v));
4904         if (isCallValid)
4905         {
4906             context->rasterPos4dv(v);
4907         }
4908         ANGLE_CAPTURE(RasterPos4dv, isCallValid, context, v);
4909     }
4910     else
4911     {
4912         GenerateContextLostErrorOnCurrentGlobalContext();
4913     }
4914 }
4915 
GL_RasterPos4f(GLfloat x,GLfloat y,GLfloat z,GLfloat w)4916 void GL_APIENTRY GL_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
4917 {
4918     Context *context = GetValidGlobalContext();
4919     EVENT(context, GLRasterPos4f, "context = %d, x = %f, y = %f, z = %f, w = %f", CID(context), x,
4920           y, z, w);
4921 
4922     if (context)
4923     {
4924         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4925         bool isCallValid =
4926             (context->skipValidation() ||
4927              ValidateRasterPos4f(context, angle::EntryPoint::GLRasterPos4f, x, y, z, w));
4928         if (isCallValid)
4929         {
4930             context->rasterPos4f(x, y, z, w);
4931         }
4932         ANGLE_CAPTURE(RasterPos4f, isCallValid, context, x, y, z, w);
4933     }
4934     else
4935     {
4936         GenerateContextLostErrorOnCurrentGlobalContext();
4937     }
4938 }
4939 
GL_RasterPos4fv(const GLfloat * v)4940 void GL_APIENTRY GL_RasterPos4fv(const GLfloat *v)
4941 {
4942     Context *context = GetValidGlobalContext();
4943     EVENT(context, GLRasterPos4fv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
4944           (uintptr_t)v);
4945 
4946     if (context)
4947     {
4948         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4949         bool isCallValid                                      = (context->skipValidation() ||
4950                             ValidateRasterPos4fv(context, angle::EntryPoint::GLRasterPos4fv, v));
4951         if (isCallValid)
4952         {
4953             context->rasterPos4fv(v);
4954         }
4955         ANGLE_CAPTURE(RasterPos4fv, isCallValid, context, v);
4956     }
4957     else
4958     {
4959         GenerateContextLostErrorOnCurrentGlobalContext();
4960     }
4961 }
4962 
GL_RasterPos4i(GLint x,GLint y,GLint z,GLint w)4963 void GL_APIENTRY GL_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
4964 {
4965     Context *context = GetValidGlobalContext();
4966     EVENT(context, GLRasterPos4i, "context = %d, x = %d, y = %d, z = %d, w = %d", CID(context), x,
4967           y, z, w);
4968 
4969     if (context)
4970     {
4971         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4972         bool isCallValid =
4973             (context->skipValidation() ||
4974              ValidateRasterPos4i(context, angle::EntryPoint::GLRasterPos4i, x, y, z, w));
4975         if (isCallValid)
4976         {
4977             context->rasterPos4i(x, y, z, w);
4978         }
4979         ANGLE_CAPTURE(RasterPos4i, isCallValid, context, x, y, z, w);
4980     }
4981     else
4982     {
4983         GenerateContextLostErrorOnCurrentGlobalContext();
4984     }
4985 }
4986 
GL_RasterPos4iv(const GLint * v)4987 void GL_APIENTRY GL_RasterPos4iv(const GLint *v)
4988 {
4989     Context *context = GetValidGlobalContext();
4990     EVENT(context, GLRasterPos4iv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
4991           (uintptr_t)v);
4992 
4993     if (context)
4994     {
4995         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4996         bool isCallValid                                      = (context->skipValidation() ||
4997                             ValidateRasterPos4iv(context, angle::EntryPoint::GLRasterPos4iv, v));
4998         if (isCallValid)
4999         {
5000             context->rasterPos4iv(v);
5001         }
5002         ANGLE_CAPTURE(RasterPos4iv, isCallValid, context, v);
5003     }
5004     else
5005     {
5006         GenerateContextLostErrorOnCurrentGlobalContext();
5007     }
5008 }
5009 
GL_RasterPos4s(GLshort x,GLshort y,GLshort z,GLshort w)5010 void GL_APIENTRY GL_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
5011 {
5012     Context *context = GetValidGlobalContext();
5013     EVENT(context, GLRasterPos4s, "context = %d, x = %d, y = %d, z = %d, w = %d", CID(context), x,
5014           y, z, w);
5015 
5016     if (context)
5017     {
5018         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5019         bool isCallValid =
5020             (context->skipValidation() ||
5021              ValidateRasterPos4s(context, angle::EntryPoint::GLRasterPos4s, x, y, z, w));
5022         if (isCallValid)
5023         {
5024             context->rasterPos4s(x, y, z, w);
5025         }
5026         ANGLE_CAPTURE(RasterPos4s, isCallValid, context, x, y, z, w);
5027     }
5028     else
5029     {
5030         GenerateContextLostErrorOnCurrentGlobalContext();
5031     }
5032 }
5033 
GL_RasterPos4sv(const GLshort * v)5034 void GL_APIENTRY GL_RasterPos4sv(const GLshort *v)
5035 {
5036     Context *context = GetValidGlobalContext();
5037     EVENT(context, GLRasterPos4sv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
5038           (uintptr_t)v);
5039 
5040     if (context)
5041     {
5042         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5043         bool isCallValid                                      = (context->skipValidation() ||
5044                             ValidateRasterPos4sv(context, angle::EntryPoint::GLRasterPos4sv, v));
5045         if (isCallValid)
5046         {
5047             context->rasterPos4sv(v);
5048         }
5049         ANGLE_CAPTURE(RasterPos4sv, isCallValid, context, v);
5050     }
5051     else
5052     {
5053         GenerateContextLostErrorOnCurrentGlobalContext();
5054     }
5055 }
5056 
GL_ReadBuffer(GLenum src)5057 void GL_APIENTRY GL_ReadBuffer(GLenum src)
5058 {
5059     Context *context = GetValidGlobalContext();
5060     EVENT(context, GLReadBuffer, "context = %d, src = %s", CID(context),
5061           GLenumToString(GLenumGroup::ReadBufferMode, src));
5062 
5063     if (context)
5064     {
5065         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5066         bool isCallValid                                      = (context->skipValidation() ||
5067                             ValidateReadBuffer(context, angle::EntryPoint::GLReadBuffer, src));
5068         if (isCallValid)
5069         {
5070             context->readBuffer(src);
5071         }
5072         ANGLE_CAPTURE(ReadBuffer, isCallValid, context, src);
5073     }
5074     else
5075     {
5076         GenerateContextLostErrorOnCurrentGlobalContext();
5077     }
5078 }
5079 
GL_ReadPixels(GLint x,GLint y,GLsizei width,GLsizei height,GLenum format,GLenum type,void * pixels)5080 void GL_APIENTRY GL_ReadPixels(GLint x,
5081                                GLint y,
5082                                GLsizei width,
5083                                GLsizei height,
5084                                GLenum format,
5085                                GLenum type,
5086                                void *pixels)
5087 {
5088     Context *context = GetValidGlobalContext();
5089     EVENT(context, GLReadPixels,
5090           "context = %d, x = %d, y = %d, width = %d, height = %d, format = %s, type = %s, pixels = "
5091           "0x%016" PRIxPTR "",
5092           CID(context), x, y, width, height, GLenumToString(GLenumGroup::PixelFormat, format),
5093           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
5094 
5095     if (context)
5096     {
5097         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5098         bool isCallValid                                      = (context->skipValidation() ||
5099                             ValidateReadPixels(context, angle::EntryPoint::GLReadPixels, x, y,
5100                                                width, height, format, type, pixels));
5101         if (isCallValid)
5102         {
5103             context->readPixels(x, y, width, height, format, type, pixels);
5104         }
5105         ANGLE_CAPTURE(ReadPixels, isCallValid, context, x, y, width, height, format, type, pixels);
5106     }
5107     else
5108     {
5109         GenerateContextLostErrorOnCurrentGlobalContext();
5110     }
5111 }
5112 
GL_Rectd(GLdouble x1,GLdouble y1,GLdouble x2,GLdouble y2)5113 void GL_APIENTRY GL_Rectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
5114 {
5115     Context *context = GetValidGlobalContext();
5116     EVENT(context, GLRectd, "context = %d, x1 = %f, y1 = %f, x2 = %f, y2 = %f", CID(context), x1,
5117           y1, x2, y2);
5118 
5119     if (context)
5120     {
5121         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5122         bool isCallValid                                      = (context->skipValidation() ||
5123                             ValidateRectd(context, angle::EntryPoint::GLRectd, x1, y1, x2, y2));
5124         if (isCallValid)
5125         {
5126             context->rectd(x1, y1, x2, y2);
5127         }
5128         ANGLE_CAPTURE(Rectd, isCallValid, context, x1, y1, x2, y2);
5129     }
5130     else
5131     {
5132         GenerateContextLostErrorOnCurrentGlobalContext();
5133     }
5134 }
5135 
GL_Rectdv(const GLdouble * v1,const GLdouble * v2)5136 void GL_APIENTRY GL_Rectdv(const GLdouble *v1, const GLdouble *v2)
5137 {
5138     Context *context = GetValidGlobalContext();
5139     EVENT(context, GLRectdv, "context = %d, v1 = 0x%016" PRIxPTR ", v2 = 0x%016" PRIxPTR "",
5140           CID(context), (uintptr_t)v1, (uintptr_t)v2);
5141 
5142     if (context)
5143     {
5144         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5145         bool isCallValid                                      = (context->skipValidation() ||
5146                             ValidateRectdv(context, angle::EntryPoint::GLRectdv, v1, v2));
5147         if (isCallValid)
5148         {
5149             context->rectdv(v1, v2);
5150         }
5151         ANGLE_CAPTURE(Rectdv, isCallValid, context, v1, v2);
5152     }
5153     else
5154     {
5155         GenerateContextLostErrorOnCurrentGlobalContext();
5156     }
5157 }
5158 
GL_Rectf(GLfloat x1,GLfloat y1,GLfloat x2,GLfloat y2)5159 void GL_APIENTRY GL_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
5160 {
5161     Context *context = GetValidGlobalContext();
5162     EVENT(context, GLRectf, "context = %d, x1 = %f, y1 = %f, x2 = %f, y2 = %f", CID(context), x1,
5163           y1, x2, y2);
5164 
5165     if (context)
5166     {
5167         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5168         bool isCallValid                                      = (context->skipValidation() ||
5169                             ValidateRectf(context, angle::EntryPoint::GLRectf, x1, y1, x2, y2));
5170         if (isCallValid)
5171         {
5172             context->rectf(x1, y1, x2, y2);
5173         }
5174         ANGLE_CAPTURE(Rectf, isCallValid, context, x1, y1, x2, y2);
5175     }
5176     else
5177     {
5178         GenerateContextLostErrorOnCurrentGlobalContext();
5179     }
5180 }
5181 
GL_Rectfv(const GLfloat * v1,const GLfloat * v2)5182 void GL_APIENTRY GL_Rectfv(const GLfloat *v1, const GLfloat *v2)
5183 {
5184     Context *context = GetValidGlobalContext();
5185     EVENT(context, GLRectfv, "context = %d, v1 = 0x%016" PRIxPTR ", v2 = 0x%016" PRIxPTR "",
5186           CID(context), (uintptr_t)v1, (uintptr_t)v2);
5187 
5188     if (context)
5189     {
5190         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5191         bool isCallValid                                      = (context->skipValidation() ||
5192                             ValidateRectfv(context, angle::EntryPoint::GLRectfv, v1, v2));
5193         if (isCallValid)
5194         {
5195             context->rectfv(v1, v2);
5196         }
5197         ANGLE_CAPTURE(Rectfv, isCallValid, context, v1, v2);
5198     }
5199     else
5200     {
5201         GenerateContextLostErrorOnCurrentGlobalContext();
5202     }
5203 }
5204 
GL_Recti(GLint x1,GLint y1,GLint x2,GLint y2)5205 void GL_APIENTRY GL_Recti(GLint x1, GLint y1, GLint x2, GLint y2)
5206 {
5207     Context *context = GetValidGlobalContext();
5208     EVENT(context, GLRecti, "context = %d, x1 = %d, y1 = %d, x2 = %d, y2 = %d", CID(context), x1,
5209           y1, x2, y2);
5210 
5211     if (context)
5212     {
5213         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5214         bool isCallValid                                      = (context->skipValidation() ||
5215                             ValidateRecti(context, angle::EntryPoint::GLRecti, x1, y1, x2, y2));
5216         if (isCallValid)
5217         {
5218             context->recti(x1, y1, x2, y2);
5219         }
5220         ANGLE_CAPTURE(Recti, isCallValid, context, x1, y1, x2, y2);
5221     }
5222     else
5223     {
5224         GenerateContextLostErrorOnCurrentGlobalContext();
5225     }
5226 }
5227 
GL_Rectiv(const GLint * v1,const GLint * v2)5228 void GL_APIENTRY GL_Rectiv(const GLint *v1, const GLint *v2)
5229 {
5230     Context *context = GetValidGlobalContext();
5231     EVENT(context, GLRectiv, "context = %d, v1 = 0x%016" PRIxPTR ", v2 = 0x%016" PRIxPTR "",
5232           CID(context), (uintptr_t)v1, (uintptr_t)v2);
5233 
5234     if (context)
5235     {
5236         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5237         bool isCallValid                                      = (context->skipValidation() ||
5238                             ValidateRectiv(context, angle::EntryPoint::GLRectiv, v1, v2));
5239         if (isCallValid)
5240         {
5241             context->rectiv(v1, v2);
5242         }
5243         ANGLE_CAPTURE(Rectiv, isCallValid, context, v1, v2);
5244     }
5245     else
5246     {
5247         GenerateContextLostErrorOnCurrentGlobalContext();
5248     }
5249 }
5250 
GL_Rects(GLshort x1,GLshort y1,GLshort x2,GLshort y2)5251 void GL_APIENTRY GL_Rects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
5252 {
5253     Context *context = GetValidGlobalContext();
5254     EVENT(context, GLRects, "context = %d, x1 = %d, y1 = %d, x2 = %d, y2 = %d", CID(context), x1,
5255           y1, x2, y2);
5256 
5257     if (context)
5258     {
5259         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5260         bool isCallValid                                      = (context->skipValidation() ||
5261                             ValidateRects(context, angle::EntryPoint::GLRects, x1, y1, x2, y2));
5262         if (isCallValid)
5263         {
5264             context->rects(x1, y1, x2, y2);
5265         }
5266         ANGLE_CAPTURE(Rects, isCallValid, context, x1, y1, x2, y2);
5267     }
5268     else
5269     {
5270         GenerateContextLostErrorOnCurrentGlobalContext();
5271     }
5272 }
5273 
GL_Rectsv(const GLshort * v1,const GLshort * v2)5274 void GL_APIENTRY GL_Rectsv(const GLshort *v1, const GLshort *v2)
5275 {
5276     Context *context = GetValidGlobalContext();
5277     EVENT(context, GLRectsv, "context = %d, v1 = 0x%016" PRIxPTR ", v2 = 0x%016" PRIxPTR "",
5278           CID(context), (uintptr_t)v1, (uintptr_t)v2);
5279 
5280     if (context)
5281     {
5282         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5283         bool isCallValid                                      = (context->skipValidation() ||
5284                             ValidateRectsv(context, angle::EntryPoint::GLRectsv, v1, v2));
5285         if (isCallValid)
5286         {
5287             context->rectsv(v1, v2);
5288         }
5289         ANGLE_CAPTURE(Rectsv, isCallValid, context, v1, v2);
5290     }
5291     else
5292     {
5293         GenerateContextLostErrorOnCurrentGlobalContext();
5294     }
5295 }
5296 
GL_RenderMode(GLenum mode)5297 GLint GL_APIENTRY GL_RenderMode(GLenum mode)
5298 {
5299     Context *context = GetValidGlobalContext();
5300     EVENT(context, GLRenderMode, "context = %d, mode = %s", CID(context),
5301           GLenumToString(GLenumGroup::RenderingMode, mode));
5302 
5303     GLint returnValue;
5304     if (context)
5305     {
5306         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5307         bool isCallValid                                      = (context->skipValidation() ||
5308                             ValidateRenderMode(context, angle::EntryPoint::GLRenderMode, mode));
5309         if (isCallValid)
5310         {
5311             returnValue = context->renderMode(mode);
5312         }
5313         else
5314         {
5315             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLRenderMode, GLint>();
5316         }
5317         ANGLE_CAPTURE(RenderMode, isCallValid, context, mode, returnValue);
5318     }
5319     else
5320     {
5321         GenerateContextLostErrorOnCurrentGlobalContext();
5322         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLRenderMode, GLint>();
5323     }
5324     return returnValue;
5325 }
5326 
GL_Rotated(GLdouble angle,GLdouble x,GLdouble y,GLdouble z)5327 void GL_APIENTRY GL_Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
5328 {
5329     Context *context = GetValidGlobalContext();
5330     EVENT(context, GLRotated, "context = %d, angle = %f, x = %f, y = %f, z = %f", CID(context),
5331           angle, x, y, z);
5332 
5333     if (context)
5334     {
5335         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5336         bool isCallValid                                      = (context->skipValidation() ||
5337                             ValidateRotated(context, angle::EntryPoint::GLRotated, angle, x, y, z));
5338         if (isCallValid)
5339         {
5340             context->rotated(angle, x, y, z);
5341         }
5342         ANGLE_CAPTURE(Rotated, isCallValid, context, angle, x, y, z);
5343     }
5344     else
5345     {
5346         GenerateContextLostErrorOnCurrentGlobalContext();
5347     }
5348 }
5349 
GL_Rotatef(GLfloat angle,GLfloat x,GLfloat y,GLfloat z)5350 void GL_APIENTRY GL_Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
5351 {
5352     Context *context = GetValidGlobalContext();
5353     EVENT(context, GLRotatef, "context = %d, angle = %f, x = %f, y = %f, z = %f", CID(context),
5354           angle, x, y, z);
5355 
5356     if (context)
5357     {
5358         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5359         bool isCallValid                                      = (context->skipValidation() ||
5360                             ValidateRotatef(context, angle::EntryPoint::GLRotatef, angle, x, y, z));
5361         if (isCallValid)
5362         {
5363             context->rotatef(angle, x, y, z);
5364         }
5365         ANGLE_CAPTURE(Rotatef, isCallValid, context, angle, x, y, z);
5366     }
5367     else
5368     {
5369         GenerateContextLostErrorOnCurrentGlobalContext();
5370     }
5371 }
5372 
GL_Scaled(GLdouble x,GLdouble y,GLdouble z)5373 void GL_APIENTRY GL_Scaled(GLdouble x, GLdouble y, GLdouble z)
5374 {
5375     Context *context = GetValidGlobalContext();
5376     EVENT(context, GLScaled, "context = %d, x = %f, y = %f, z = %f", CID(context), x, y, z);
5377 
5378     if (context)
5379     {
5380         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5381         bool isCallValid                                      = (context->skipValidation() ||
5382                             ValidateScaled(context, angle::EntryPoint::GLScaled, x, y, z));
5383         if (isCallValid)
5384         {
5385             context->scaled(x, y, z);
5386         }
5387         ANGLE_CAPTURE(Scaled, isCallValid, context, x, y, z);
5388     }
5389     else
5390     {
5391         GenerateContextLostErrorOnCurrentGlobalContext();
5392     }
5393 }
5394 
GL_Scalef(GLfloat x,GLfloat y,GLfloat z)5395 void GL_APIENTRY GL_Scalef(GLfloat x, GLfloat y, GLfloat z)
5396 {
5397     Context *context = GetValidGlobalContext();
5398     EVENT(context, GLScalef, "context = %d, x = %f, y = %f, z = %f", CID(context), x, y, z);
5399 
5400     if (context)
5401     {
5402         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5403         bool isCallValid                                      = (context->skipValidation() ||
5404                             ValidateScalef(context, angle::EntryPoint::GLScalef, x, y, z));
5405         if (isCallValid)
5406         {
5407             context->scalef(x, y, z);
5408         }
5409         ANGLE_CAPTURE(Scalef, isCallValid, context, x, y, z);
5410     }
5411     else
5412     {
5413         GenerateContextLostErrorOnCurrentGlobalContext();
5414     }
5415 }
5416 
GL_Scissor(GLint x,GLint y,GLsizei width,GLsizei height)5417 void GL_APIENTRY GL_Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
5418 {
5419     Context *context = GetValidGlobalContext();
5420     EVENT(context, GLScissor, "context = %d, x = %d, y = %d, width = %d, height = %d", CID(context),
5421           x, y, width, height);
5422 
5423     if (context)
5424     {
5425         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5426         bool isCallValid =
5427             (context->skipValidation() ||
5428              ValidateScissor(context, angle::EntryPoint::GLScissor, x, y, width, height));
5429         if (isCallValid)
5430         {
5431             context->scissor(x, y, width, height);
5432         }
5433         ANGLE_CAPTURE(Scissor, isCallValid, context, x, y, width, height);
5434     }
5435     else
5436     {
5437         GenerateContextLostErrorOnCurrentGlobalContext();
5438     }
5439 }
5440 
GL_SelectBuffer(GLsizei size,GLuint * buffer)5441 void GL_APIENTRY GL_SelectBuffer(GLsizei size, GLuint *buffer)
5442 {
5443     Context *context = GetValidGlobalContext();
5444     EVENT(context, GLSelectBuffer, "context = %d, size = %d, buffer = 0x%016" PRIxPTR "",
5445           CID(context), size, (uintptr_t)buffer);
5446 
5447     if (context)
5448     {
5449         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5450         bool isCallValid =
5451             (context->skipValidation() ||
5452              ValidateSelectBuffer(context, angle::EntryPoint::GLSelectBuffer, size, buffer));
5453         if (isCallValid)
5454         {
5455             context->selectBuffer(size, buffer);
5456         }
5457         ANGLE_CAPTURE(SelectBuffer, isCallValid, context, size, buffer);
5458     }
5459     else
5460     {
5461         GenerateContextLostErrorOnCurrentGlobalContext();
5462     }
5463 }
5464 
GL_ShadeModel(GLenum mode)5465 void GL_APIENTRY GL_ShadeModel(GLenum mode)
5466 {
5467     Context *context = GetValidGlobalContext();
5468     EVENT(context, GLShadeModel, "context = %d, mode = %s", CID(context),
5469           GLenumToString(GLenumGroup::ShadingModel, mode));
5470 
5471     if (context)
5472     {
5473         ShadingModel modePacked                               = PackParam<ShadingModel>(mode);
5474         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5475         bool isCallValid =
5476             (context->skipValidation() ||
5477              ValidateShadeModel(context, angle::EntryPoint::GLShadeModel, modePacked));
5478         if (isCallValid)
5479         {
5480             context->shadeModel(modePacked);
5481         }
5482         ANGLE_CAPTURE(ShadeModel, isCallValid, context, modePacked);
5483     }
5484     else
5485     {
5486         GenerateContextLostErrorOnCurrentGlobalContext();
5487     }
5488 }
5489 
GL_StencilFunc(GLenum func,GLint ref,GLuint mask)5490 void GL_APIENTRY GL_StencilFunc(GLenum func, GLint ref, GLuint mask)
5491 {
5492     Context *context = GetValidGlobalContext();
5493     EVENT(context, GLStencilFunc, "context = %d, func = %s, ref = %d, mask = %u", CID(context),
5494           GLenumToString(GLenumGroup::StencilFunction, func), ref, mask);
5495 
5496     if (context)
5497     {
5498         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5499         bool isCallValid =
5500             (context->skipValidation() ||
5501              ValidateStencilFunc(context, angle::EntryPoint::GLStencilFunc, func, ref, mask));
5502         if (isCallValid)
5503         {
5504             context->stencilFunc(func, ref, mask);
5505         }
5506         ANGLE_CAPTURE(StencilFunc, isCallValid, context, func, ref, mask);
5507     }
5508     else
5509     {
5510         GenerateContextLostErrorOnCurrentGlobalContext();
5511     }
5512 }
5513 
GL_StencilMask(GLuint mask)5514 void GL_APIENTRY GL_StencilMask(GLuint mask)
5515 {
5516     Context *context = GetValidGlobalContext();
5517     EVENT(context, GLStencilMask, "context = %d, mask = %u", CID(context), mask);
5518 
5519     if (context)
5520     {
5521         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5522         bool isCallValid                                      = (context->skipValidation() ||
5523                             ValidateStencilMask(context, angle::EntryPoint::GLStencilMask, mask));
5524         if (isCallValid)
5525         {
5526             context->stencilMask(mask);
5527         }
5528         ANGLE_CAPTURE(StencilMask, isCallValid, context, mask);
5529     }
5530     else
5531     {
5532         GenerateContextLostErrorOnCurrentGlobalContext();
5533     }
5534 }
5535 
GL_StencilOp(GLenum fail,GLenum zfail,GLenum zpass)5536 void GL_APIENTRY GL_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
5537 {
5538     Context *context = GetValidGlobalContext();
5539     EVENT(context, GLStencilOp, "context = %d, fail = %s, zfail = %s, zpass = %s", CID(context),
5540           GLenumToString(GLenumGroup::StencilOp, fail),
5541           GLenumToString(GLenumGroup::StencilOp, zfail),
5542           GLenumToString(GLenumGroup::StencilOp, zpass));
5543 
5544     if (context)
5545     {
5546         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5547         bool isCallValid =
5548             (context->skipValidation() ||
5549              ValidateStencilOp(context, angle::EntryPoint::GLStencilOp, fail, zfail, zpass));
5550         if (isCallValid)
5551         {
5552             context->stencilOp(fail, zfail, zpass);
5553         }
5554         ANGLE_CAPTURE(StencilOp, isCallValid, context, fail, zfail, zpass);
5555     }
5556     else
5557     {
5558         GenerateContextLostErrorOnCurrentGlobalContext();
5559     }
5560 }
5561 
GL_TexCoord1d(GLdouble s)5562 void GL_APIENTRY GL_TexCoord1d(GLdouble s)
5563 {
5564     Context *context = GetValidGlobalContext();
5565     EVENT(context, GLTexCoord1d, "context = %d, s = %f", CID(context), s);
5566 
5567     if (context)
5568     {
5569         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5570         bool isCallValid                                      = (context->skipValidation() ||
5571                             ValidateTexCoord1d(context, angle::EntryPoint::GLTexCoord1d, s));
5572         if (isCallValid)
5573         {
5574             context->texCoord1d(s);
5575         }
5576         ANGLE_CAPTURE(TexCoord1d, isCallValid, context, s);
5577     }
5578     else
5579     {
5580         GenerateContextLostErrorOnCurrentGlobalContext();
5581     }
5582 }
5583 
GL_TexCoord1dv(const GLdouble * v)5584 void GL_APIENTRY GL_TexCoord1dv(const GLdouble *v)
5585 {
5586     Context *context = GetValidGlobalContext();
5587     EVENT(context, GLTexCoord1dv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
5588           (uintptr_t)v);
5589 
5590     if (context)
5591     {
5592         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5593         bool isCallValid                                      = (context->skipValidation() ||
5594                             ValidateTexCoord1dv(context, angle::EntryPoint::GLTexCoord1dv, v));
5595         if (isCallValid)
5596         {
5597             context->texCoord1dv(v);
5598         }
5599         ANGLE_CAPTURE(TexCoord1dv, isCallValid, context, v);
5600     }
5601     else
5602     {
5603         GenerateContextLostErrorOnCurrentGlobalContext();
5604     }
5605 }
5606 
GL_TexCoord1f(GLfloat s)5607 void GL_APIENTRY GL_TexCoord1f(GLfloat s)
5608 {
5609     Context *context = GetValidGlobalContext();
5610     EVENT(context, GLTexCoord1f, "context = %d, s = %f", CID(context), s);
5611 
5612     if (context)
5613     {
5614         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5615         bool isCallValid                                      = (context->skipValidation() ||
5616                             ValidateTexCoord1f(context, angle::EntryPoint::GLTexCoord1f, s));
5617         if (isCallValid)
5618         {
5619             context->texCoord1f(s);
5620         }
5621         ANGLE_CAPTURE(TexCoord1f, isCallValid, context, s);
5622     }
5623     else
5624     {
5625         GenerateContextLostErrorOnCurrentGlobalContext();
5626     }
5627 }
5628 
GL_TexCoord1fv(const GLfloat * v)5629 void GL_APIENTRY GL_TexCoord1fv(const GLfloat *v)
5630 {
5631     Context *context = GetValidGlobalContext();
5632     EVENT(context, GLTexCoord1fv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
5633           (uintptr_t)v);
5634 
5635     if (context)
5636     {
5637         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5638         bool isCallValid                                      = (context->skipValidation() ||
5639                             ValidateTexCoord1fv(context, angle::EntryPoint::GLTexCoord1fv, v));
5640         if (isCallValid)
5641         {
5642             context->texCoord1fv(v);
5643         }
5644         ANGLE_CAPTURE(TexCoord1fv, isCallValid, context, v);
5645     }
5646     else
5647     {
5648         GenerateContextLostErrorOnCurrentGlobalContext();
5649     }
5650 }
5651 
GL_TexCoord1i(GLint s)5652 void GL_APIENTRY GL_TexCoord1i(GLint s)
5653 {
5654     Context *context = GetValidGlobalContext();
5655     EVENT(context, GLTexCoord1i, "context = %d, s = %d", CID(context), s);
5656 
5657     if (context)
5658     {
5659         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5660         bool isCallValid                                      = (context->skipValidation() ||
5661                             ValidateTexCoord1i(context, angle::EntryPoint::GLTexCoord1i, s));
5662         if (isCallValid)
5663         {
5664             context->texCoord1i(s);
5665         }
5666         ANGLE_CAPTURE(TexCoord1i, isCallValid, context, s);
5667     }
5668     else
5669     {
5670         GenerateContextLostErrorOnCurrentGlobalContext();
5671     }
5672 }
5673 
GL_TexCoord1iv(const GLint * v)5674 void GL_APIENTRY GL_TexCoord1iv(const GLint *v)
5675 {
5676     Context *context = GetValidGlobalContext();
5677     EVENT(context, GLTexCoord1iv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
5678           (uintptr_t)v);
5679 
5680     if (context)
5681     {
5682         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5683         bool isCallValid                                      = (context->skipValidation() ||
5684                             ValidateTexCoord1iv(context, angle::EntryPoint::GLTexCoord1iv, v));
5685         if (isCallValid)
5686         {
5687             context->texCoord1iv(v);
5688         }
5689         ANGLE_CAPTURE(TexCoord1iv, isCallValid, context, v);
5690     }
5691     else
5692     {
5693         GenerateContextLostErrorOnCurrentGlobalContext();
5694     }
5695 }
5696 
GL_TexCoord1s(GLshort s)5697 void GL_APIENTRY GL_TexCoord1s(GLshort s)
5698 {
5699     Context *context = GetValidGlobalContext();
5700     EVENT(context, GLTexCoord1s, "context = %d, s = %d", CID(context), s);
5701 
5702     if (context)
5703     {
5704         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5705         bool isCallValid                                      = (context->skipValidation() ||
5706                             ValidateTexCoord1s(context, angle::EntryPoint::GLTexCoord1s, s));
5707         if (isCallValid)
5708         {
5709             context->texCoord1s(s);
5710         }
5711         ANGLE_CAPTURE(TexCoord1s, isCallValid, context, s);
5712     }
5713     else
5714     {
5715         GenerateContextLostErrorOnCurrentGlobalContext();
5716     }
5717 }
5718 
GL_TexCoord1sv(const GLshort * v)5719 void GL_APIENTRY GL_TexCoord1sv(const GLshort *v)
5720 {
5721     Context *context = GetValidGlobalContext();
5722     EVENT(context, GLTexCoord1sv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
5723           (uintptr_t)v);
5724 
5725     if (context)
5726     {
5727         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5728         bool isCallValid                                      = (context->skipValidation() ||
5729                             ValidateTexCoord1sv(context, angle::EntryPoint::GLTexCoord1sv, v));
5730         if (isCallValid)
5731         {
5732             context->texCoord1sv(v);
5733         }
5734         ANGLE_CAPTURE(TexCoord1sv, isCallValid, context, v);
5735     }
5736     else
5737     {
5738         GenerateContextLostErrorOnCurrentGlobalContext();
5739     }
5740 }
5741 
GL_TexCoord2d(GLdouble s,GLdouble t)5742 void GL_APIENTRY GL_TexCoord2d(GLdouble s, GLdouble t)
5743 {
5744     Context *context = GetValidGlobalContext();
5745     EVENT(context, GLTexCoord2d, "context = %d, s = %f, t = %f", CID(context), s, t);
5746 
5747     if (context)
5748     {
5749         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5750         bool isCallValid                                      = (context->skipValidation() ||
5751                             ValidateTexCoord2d(context, angle::EntryPoint::GLTexCoord2d, s, t));
5752         if (isCallValid)
5753         {
5754             context->texCoord2d(s, t);
5755         }
5756         ANGLE_CAPTURE(TexCoord2d, isCallValid, context, s, t);
5757     }
5758     else
5759     {
5760         GenerateContextLostErrorOnCurrentGlobalContext();
5761     }
5762 }
5763 
GL_TexCoord2dv(const GLdouble * v)5764 void GL_APIENTRY GL_TexCoord2dv(const GLdouble *v)
5765 {
5766     Context *context = GetValidGlobalContext();
5767     EVENT(context, GLTexCoord2dv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
5768           (uintptr_t)v);
5769 
5770     if (context)
5771     {
5772         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5773         bool isCallValid                                      = (context->skipValidation() ||
5774                             ValidateTexCoord2dv(context, angle::EntryPoint::GLTexCoord2dv, v));
5775         if (isCallValid)
5776         {
5777             context->texCoord2dv(v);
5778         }
5779         ANGLE_CAPTURE(TexCoord2dv, isCallValid, context, v);
5780     }
5781     else
5782     {
5783         GenerateContextLostErrorOnCurrentGlobalContext();
5784     }
5785 }
5786 
GL_TexCoord2f(GLfloat s,GLfloat t)5787 void GL_APIENTRY GL_TexCoord2f(GLfloat s, GLfloat t)
5788 {
5789     Context *context = GetValidGlobalContext();
5790     EVENT(context, GLTexCoord2f, "context = %d, s = %f, t = %f", CID(context), s, t);
5791 
5792     if (context)
5793     {
5794         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5795         bool isCallValid                                      = (context->skipValidation() ||
5796                             ValidateTexCoord2f(context, angle::EntryPoint::GLTexCoord2f, s, t));
5797         if (isCallValid)
5798         {
5799             context->texCoord2f(s, t);
5800         }
5801         ANGLE_CAPTURE(TexCoord2f, isCallValid, context, s, t);
5802     }
5803     else
5804     {
5805         GenerateContextLostErrorOnCurrentGlobalContext();
5806     }
5807 }
5808 
GL_TexCoord2fv(const GLfloat * v)5809 void GL_APIENTRY GL_TexCoord2fv(const GLfloat *v)
5810 {
5811     Context *context = GetValidGlobalContext();
5812     EVENT(context, GLTexCoord2fv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
5813           (uintptr_t)v);
5814 
5815     if (context)
5816     {
5817         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5818         bool isCallValid                                      = (context->skipValidation() ||
5819                             ValidateTexCoord2fv(context, angle::EntryPoint::GLTexCoord2fv, v));
5820         if (isCallValid)
5821         {
5822             context->texCoord2fv(v);
5823         }
5824         ANGLE_CAPTURE(TexCoord2fv, isCallValid, context, v);
5825     }
5826     else
5827     {
5828         GenerateContextLostErrorOnCurrentGlobalContext();
5829     }
5830 }
5831 
GL_TexCoord2i(GLint s,GLint t)5832 void GL_APIENTRY GL_TexCoord2i(GLint s, GLint t)
5833 {
5834     Context *context = GetValidGlobalContext();
5835     EVENT(context, GLTexCoord2i, "context = %d, s = %d, t = %d", CID(context), s, t);
5836 
5837     if (context)
5838     {
5839         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5840         bool isCallValid                                      = (context->skipValidation() ||
5841                             ValidateTexCoord2i(context, angle::EntryPoint::GLTexCoord2i, s, t));
5842         if (isCallValid)
5843         {
5844             context->texCoord2i(s, t);
5845         }
5846         ANGLE_CAPTURE(TexCoord2i, isCallValid, context, s, t);
5847     }
5848     else
5849     {
5850         GenerateContextLostErrorOnCurrentGlobalContext();
5851     }
5852 }
5853 
GL_TexCoord2iv(const GLint * v)5854 void GL_APIENTRY GL_TexCoord2iv(const GLint *v)
5855 {
5856     Context *context = GetValidGlobalContext();
5857     EVENT(context, GLTexCoord2iv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
5858           (uintptr_t)v);
5859 
5860     if (context)
5861     {
5862         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5863         bool isCallValid                                      = (context->skipValidation() ||
5864                             ValidateTexCoord2iv(context, angle::EntryPoint::GLTexCoord2iv, v));
5865         if (isCallValid)
5866         {
5867             context->texCoord2iv(v);
5868         }
5869         ANGLE_CAPTURE(TexCoord2iv, isCallValid, context, v);
5870     }
5871     else
5872     {
5873         GenerateContextLostErrorOnCurrentGlobalContext();
5874     }
5875 }
5876 
GL_TexCoord2s(GLshort s,GLshort t)5877 void GL_APIENTRY GL_TexCoord2s(GLshort s, GLshort t)
5878 {
5879     Context *context = GetValidGlobalContext();
5880     EVENT(context, GLTexCoord2s, "context = %d, s = %d, t = %d", CID(context), s, t);
5881 
5882     if (context)
5883     {
5884         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5885         bool isCallValid                                      = (context->skipValidation() ||
5886                             ValidateTexCoord2s(context, angle::EntryPoint::GLTexCoord2s, s, t));
5887         if (isCallValid)
5888         {
5889             context->texCoord2s(s, t);
5890         }
5891         ANGLE_CAPTURE(TexCoord2s, isCallValid, context, s, t);
5892     }
5893     else
5894     {
5895         GenerateContextLostErrorOnCurrentGlobalContext();
5896     }
5897 }
5898 
GL_TexCoord2sv(const GLshort * v)5899 void GL_APIENTRY GL_TexCoord2sv(const GLshort *v)
5900 {
5901     Context *context = GetValidGlobalContext();
5902     EVENT(context, GLTexCoord2sv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
5903           (uintptr_t)v);
5904 
5905     if (context)
5906     {
5907         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5908         bool isCallValid                                      = (context->skipValidation() ||
5909                             ValidateTexCoord2sv(context, angle::EntryPoint::GLTexCoord2sv, v));
5910         if (isCallValid)
5911         {
5912             context->texCoord2sv(v);
5913         }
5914         ANGLE_CAPTURE(TexCoord2sv, isCallValid, context, v);
5915     }
5916     else
5917     {
5918         GenerateContextLostErrorOnCurrentGlobalContext();
5919     }
5920 }
5921 
GL_TexCoord3d(GLdouble s,GLdouble t,GLdouble r)5922 void GL_APIENTRY GL_TexCoord3d(GLdouble s, GLdouble t, GLdouble r)
5923 {
5924     Context *context = GetValidGlobalContext();
5925     EVENT(context, GLTexCoord3d, "context = %d, s = %f, t = %f, r = %f", CID(context), s, t, r);
5926 
5927     if (context)
5928     {
5929         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5930         bool isCallValid                                      = (context->skipValidation() ||
5931                             ValidateTexCoord3d(context, angle::EntryPoint::GLTexCoord3d, s, t, r));
5932         if (isCallValid)
5933         {
5934             context->texCoord3d(s, t, r);
5935         }
5936         ANGLE_CAPTURE(TexCoord3d, isCallValid, context, s, t, r);
5937     }
5938     else
5939     {
5940         GenerateContextLostErrorOnCurrentGlobalContext();
5941     }
5942 }
5943 
GL_TexCoord3dv(const GLdouble * v)5944 void GL_APIENTRY GL_TexCoord3dv(const GLdouble *v)
5945 {
5946     Context *context = GetValidGlobalContext();
5947     EVENT(context, GLTexCoord3dv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
5948           (uintptr_t)v);
5949 
5950     if (context)
5951     {
5952         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5953         bool isCallValid                                      = (context->skipValidation() ||
5954                             ValidateTexCoord3dv(context, angle::EntryPoint::GLTexCoord3dv, v));
5955         if (isCallValid)
5956         {
5957             context->texCoord3dv(v);
5958         }
5959         ANGLE_CAPTURE(TexCoord3dv, isCallValid, context, v);
5960     }
5961     else
5962     {
5963         GenerateContextLostErrorOnCurrentGlobalContext();
5964     }
5965 }
5966 
GL_TexCoord3f(GLfloat s,GLfloat t,GLfloat r)5967 void GL_APIENTRY GL_TexCoord3f(GLfloat s, GLfloat t, GLfloat r)
5968 {
5969     Context *context = GetValidGlobalContext();
5970     EVENT(context, GLTexCoord3f, "context = %d, s = %f, t = %f, r = %f", CID(context), s, t, r);
5971 
5972     if (context)
5973     {
5974         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5975         bool isCallValid                                      = (context->skipValidation() ||
5976                             ValidateTexCoord3f(context, angle::EntryPoint::GLTexCoord3f, s, t, r));
5977         if (isCallValid)
5978         {
5979             context->texCoord3f(s, t, r);
5980         }
5981         ANGLE_CAPTURE(TexCoord3f, isCallValid, context, s, t, r);
5982     }
5983     else
5984     {
5985         GenerateContextLostErrorOnCurrentGlobalContext();
5986     }
5987 }
5988 
GL_TexCoord3fv(const GLfloat * v)5989 void GL_APIENTRY GL_TexCoord3fv(const GLfloat *v)
5990 {
5991     Context *context = GetValidGlobalContext();
5992     EVENT(context, GLTexCoord3fv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
5993           (uintptr_t)v);
5994 
5995     if (context)
5996     {
5997         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5998         bool isCallValid                                      = (context->skipValidation() ||
5999                             ValidateTexCoord3fv(context, angle::EntryPoint::GLTexCoord3fv, v));
6000         if (isCallValid)
6001         {
6002             context->texCoord3fv(v);
6003         }
6004         ANGLE_CAPTURE(TexCoord3fv, isCallValid, context, v);
6005     }
6006     else
6007     {
6008         GenerateContextLostErrorOnCurrentGlobalContext();
6009     }
6010 }
6011 
GL_TexCoord3i(GLint s,GLint t,GLint r)6012 void GL_APIENTRY GL_TexCoord3i(GLint s, GLint t, GLint r)
6013 {
6014     Context *context = GetValidGlobalContext();
6015     EVENT(context, GLTexCoord3i, "context = %d, s = %d, t = %d, r = %d", CID(context), s, t, r);
6016 
6017     if (context)
6018     {
6019         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6020         bool isCallValid                                      = (context->skipValidation() ||
6021                             ValidateTexCoord3i(context, angle::EntryPoint::GLTexCoord3i, s, t, r));
6022         if (isCallValid)
6023         {
6024             context->texCoord3i(s, t, r);
6025         }
6026         ANGLE_CAPTURE(TexCoord3i, isCallValid, context, s, t, r);
6027     }
6028     else
6029     {
6030         GenerateContextLostErrorOnCurrentGlobalContext();
6031     }
6032 }
6033 
GL_TexCoord3iv(const GLint * v)6034 void GL_APIENTRY GL_TexCoord3iv(const GLint *v)
6035 {
6036     Context *context = GetValidGlobalContext();
6037     EVENT(context, GLTexCoord3iv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
6038           (uintptr_t)v);
6039 
6040     if (context)
6041     {
6042         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6043         bool isCallValid                                      = (context->skipValidation() ||
6044                             ValidateTexCoord3iv(context, angle::EntryPoint::GLTexCoord3iv, v));
6045         if (isCallValid)
6046         {
6047             context->texCoord3iv(v);
6048         }
6049         ANGLE_CAPTURE(TexCoord3iv, isCallValid, context, v);
6050     }
6051     else
6052     {
6053         GenerateContextLostErrorOnCurrentGlobalContext();
6054     }
6055 }
6056 
GL_TexCoord3s(GLshort s,GLshort t,GLshort r)6057 void GL_APIENTRY GL_TexCoord3s(GLshort s, GLshort t, GLshort r)
6058 {
6059     Context *context = GetValidGlobalContext();
6060     EVENT(context, GLTexCoord3s, "context = %d, s = %d, t = %d, r = %d", CID(context), s, t, r);
6061 
6062     if (context)
6063     {
6064         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6065         bool isCallValid                                      = (context->skipValidation() ||
6066                             ValidateTexCoord3s(context, angle::EntryPoint::GLTexCoord3s, s, t, r));
6067         if (isCallValid)
6068         {
6069             context->texCoord3s(s, t, r);
6070         }
6071         ANGLE_CAPTURE(TexCoord3s, isCallValid, context, s, t, r);
6072     }
6073     else
6074     {
6075         GenerateContextLostErrorOnCurrentGlobalContext();
6076     }
6077 }
6078 
GL_TexCoord3sv(const GLshort * v)6079 void GL_APIENTRY GL_TexCoord3sv(const GLshort *v)
6080 {
6081     Context *context = GetValidGlobalContext();
6082     EVENT(context, GLTexCoord3sv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
6083           (uintptr_t)v);
6084 
6085     if (context)
6086     {
6087         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6088         bool isCallValid                                      = (context->skipValidation() ||
6089                             ValidateTexCoord3sv(context, angle::EntryPoint::GLTexCoord3sv, v));
6090         if (isCallValid)
6091         {
6092             context->texCoord3sv(v);
6093         }
6094         ANGLE_CAPTURE(TexCoord3sv, isCallValid, context, v);
6095     }
6096     else
6097     {
6098         GenerateContextLostErrorOnCurrentGlobalContext();
6099     }
6100 }
6101 
GL_TexCoord4d(GLdouble s,GLdouble t,GLdouble r,GLdouble q)6102 void GL_APIENTRY GL_TexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
6103 {
6104     Context *context = GetValidGlobalContext();
6105     EVENT(context, GLTexCoord4d, "context = %d, s = %f, t = %f, r = %f, q = %f", CID(context), s, t,
6106           r, q);
6107 
6108     if (context)
6109     {
6110         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6111         bool isCallValid =
6112             (context->skipValidation() ||
6113              ValidateTexCoord4d(context, angle::EntryPoint::GLTexCoord4d, s, t, r, q));
6114         if (isCallValid)
6115         {
6116             context->texCoord4d(s, t, r, q);
6117         }
6118         ANGLE_CAPTURE(TexCoord4d, isCallValid, context, s, t, r, q);
6119     }
6120     else
6121     {
6122         GenerateContextLostErrorOnCurrentGlobalContext();
6123     }
6124 }
6125 
GL_TexCoord4dv(const GLdouble * v)6126 void GL_APIENTRY GL_TexCoord4dv(const GLdouble *v)
6127 {
6128     Context *context = GetValidGlobalContext();
6129     EVENT(context, GLTexCoord4dv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
6130           (uintptr_t)v);
6131 
6132     if (context)
6133     {
6134         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6135         bool isCallValid                                      = (context->skipValidation() ||
6136                             ValidateTexCoord4dv(context, angle::EntryPoint::GLTexCoord4dv, v));
6137         if (isCallValid)
6138         {
6139             context->texCoord4dv(v);
6140         }
6141         ANGLE_CAPTURE(TexCoord4dv, isCallValid, context, v);
6142     }
6143     else
6144     {
6145         GenerateContextLostErrorOnCurrentGlobalContext();
6146     }
6147 }
6148 
GL_TexCoord4f(GLfloat s,GLfloat t,GLfloat r,GLfloat q)6149 void GL_APIENTRY GL_TexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
6150 {
6151     Context *context = GetValidGlobalContext();
6152     EVENT(context, GLTexCoord4f, "context = %d, s = %f, t = %f, r = %f, q = %f", CID(context), s, t,
6153           r, q);
6154 
6155     if (context)
6156     {
6157         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6158         bool isCallValid =
6159             (context->skipValidation() ||
6160              ValidateTexCoord4f(context, angle::EntryPoint::GLTexCoord4f, s, t, r, q));
6161         if (isCallValid)
6162         {
6163             context->texCoord4f(s, t, r, q);
6164         }
6165         ANGLE_CAPTURE(TexCoord4f, isCallValid, context, s, t, r, q);
6166     }
6167     else
6168     {
6169         GenerateContextLostErrorOnCurrentGlobalContext();
6170     }
6171 }
6172 
GL_TexCoord4fv(const GLfloat * v)6173 void GL_APIENTRY GL_TexCoord4fv(const GLfloat *v)
6174 {
6175     Context *context = GetValidGlobalContext();
6176     EVENT(context, GLTexCoord4fv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
6177           (uintptr_t)v);
6178 
6179     if (context)
6180     {
6181         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6182         bool isCallValid                                      = (context->skipValidation() ||
6183                             ValidateTexCoord4fv(context, angle::EntryPoint::GLTexCoord4fv, v));
6184         if (isCallValid)
6185         {
6186             context->texCoord4fv(v);
6187         }
6188         ANGLE_CAPTURE(TexCoord4fv, isCallValid, context, v);
6189     }
6190     else
6191     {
6192         GenerateContextLostErrorOnCurrentGlobalContext();
6193     }
6194 }
6195 
GL_TexCoord4i(GLint s,GLint t,GLint r,GLint q)6196 void GL_APIENTRY GL_TexCoord4i(GLint s, GLint t, GLint r, GLint q)
6197 {
6198     Context *context = GetValidGlobalContext();
6199     EVENT(context, GLTexCoord4i, "context = %d, s = %d, t = %d, r = %d, q = %d", CID(context), s, t,
6200           r, q);
6201 
6202     if (context)
6203     {
6204         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6205         bool isCallValid =
6206             (context->skipValidation() ||
6207              ValidateTexCoord4i(context, angle::EntryPoint::GLTexCoord4i, s, t, r, q));
6208         if (isCallValid)
6209         {
6210             context->texCoord4i(s, t, r, q);
6211         }
6212         ANGLE_CAPTURE(TexCoord4i, isCallValid, context, s, t, r, q);
6213     }
6214     else
6215     {
6216         GenerateContextLostErrorOnCurrentGlobalContext();
6217     }
6218 }
6219 
GL_TexCoord4iv(const GLint * v)6220 void GL_APIENTRY GL_TexCoord4iv(const GLint *v)
6221 {
6222     Context *context = GetValidGlobalContext();
6223     EVENT(context, GLTexCoord4iv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
6224           (uintptr_t)v);
6225 
6226     if (context)
6227     {
6228         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6229         bool isCallValid                                      = (context->skipValidation() ||
6230                             ValidateTexCoord4iv(context, angle::EntryPoint::GLTexCoord4iv, v));
6231         if (isCallValid)
6232         {
6233             context->texCoord4iv(v);
6234         }
6235         ANGLE_CAPTURE(TexCoord4iv, isCallValid, context, v);
6236     }
6237     else
6238     {
6239         GenerateContextLostErrorOnCurrentGlobalContext();
6240     }
6241 }
6242 
GL_TexCoord4s(GLshort s,GLshort t,GLshort r,GLshort q)6243 void GL_APIENTRY GL_TexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
6244 {
6245     Context *context = GetValidGlobalContext();
6246     EVENT(context, GLTexCoord4s, "context = %d, s = %d, t = %d, r = %d, q = %d", CID(context), s, t,
6247           r, q);
6248 
6249     if (context)
6250     {
6251         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6252         bool isCallValid =
6253             (context->skipValidation() ||
6254              ValidateTexCoord4s(context, angle::EntryPoint::GLTexCoord4s, s, t, r, q));
6255         if (isCallValid)
6256         {
6257             context->texCoord4s(s, t, r, q);
6258         }
6259         ANGLE_CAPTURE(TexCoord4s, isCallValid, context, s, t, r, q);
6260     }
6261     else
6262     {
6263         GenerateContextLostErrorOnCurrentGlobalContext();
6264     }
6265 }
6266 
GL_TexCoord4sv(const GLshort * v)6267 void GL_APIENTRY GL_TexCoord4sv(const GLshort *v)
6268 {
6269     Context *context = GetValidGlobalContext();
6270     EVENT(context, GLTexCoord4sv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
6271           (uintptr_t)v);
6272 
6273     if (context)
6274     {
6275         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6276         bool isCallValid                                      = (context->skipValidation() ||
6277                             ValidateTexCoord4sv(context, angle::EntryPoint::GLTexCoord4sv, v));
6278         if (isCallValid)
6279         {
6280             context->texCoord4sv(v);
6281         }
6282         ANGLE_CAPTURE(TexCoord4sv, isCallValid, context, v);
6283     }
6284     else
6285     {
6286         GenerateContextLostErrorOnCurrentGlobalContext();
6287     }
6288 }
6289 
GL_TexEnvf(GLenum target,GLenum pname,GLfloat param)6290 void GL_APIENTRY GL_TexEnvf(GLenum target, GLenum pname, GLfloat param)
6291 {
6292     Context *context = GetValidGlobalContext();
6293     EVENT(context, GLTexEnvf, "context = %d, target = %s, pname = %s, param = %f", CID(context),
6294           GLenumToString(GLenumGroup::TextureEnvTarget, target),
6295           GLenumToString(GLenumGroup::TextureEnvParameter, pname), param);
6296 
6297     if (context)
6298     {
6299         TextureEnvTarget targetPacked   = PackParam<TextureEnvTarget>(target);
6300         TextureEnvParameter pnamePacked = PackParam<TextureEnvParameter>(pname);
6301         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6302         bool isCallValid =
6303             (context->skipValidation() || ValidateTexEnvf(context, angle::EntryPoint::GLTexEnvf,
6304                                                           targetPacked, pnamePacked, param));
6305         if (isCallValid)
6306         {
6307             context->texEnvf(targetPacked, pnamePacked, param);
6308         }
6309         ANGLE_CAPTURE(TexEnvf, isCallValid, context, targetPacked, pnamePacked, param);
6310     }
6311     else
6312     {
6313         GenerateContextLostErrorOnCurrentGlobalContext();
6314     }
6315 }
6316 
GL_TexEnvfv(GLenum target,GLenum pname,const GLfloat * params)6317 void GL_APIENTRY GL_TexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
6318 {
6319     Context *context = GetValidGlobalContext();
6320     EVENT(context, GLTexEnvfv, "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "",
6321           CID(context), GLenumToString(GLenumGroup::TextureEnvTarget, target),
6322           GLenumToString(GLenumGroup::TextureEnvParameter, pname), (uintptr_t)params);
6323 
6324     if (context)
6325     {
6326         TextureEnvTarget targetPacked   = PackParam<TextureEnvTarget>(target);
6327         TextureEnvParameter pnamePacked = PackParam<TextureEnvParameter>(pname);
6328         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6329         bool isCallValid =
6330             (context->skipValidation() || ValidateTexEnvfv(context, angle::EntryPoint::GLTexEnvfv,
6331                                                            targetPacked, pnamePacked, params));
6332         if (isCallValid)
6333         {
6334             context->texEnvfv(targetPacked, pnamePacked, params);
6335         }
6336         ANGLE_CAPTURE(TexEnvfv, isCallValid, context, targetPacked, pnamePacked, params);
6337     }
6338     else
6339     {
6340         GenerateContextLostErrorOnCurrentGlobalContext();
6341     }
6342 }
6343 
GL_TexEnvi(GLenum target,GLenum pname,GLint param)6344 void GL_APIENTRY GL_TexEnvi(GLenum target, GLenum pname, GLint param)
6345 {
6346     Context *context = GetValidGlobalContext();
6347     EVENT(context, GLTexEnvi, "context = %d, target = %s, pname = %s, param = %d", CID(context),
6348           GLenumToString(GLenumGroup::TextureEnvTarget, target),
6349           GLenumToString(GLenumGroup::TextureEnvParameter, pname), param);
6350 
6351     if (context)
6352     {
6353         TextureEnvTarget targetPacked   = PackParam<TextureEnvTarget>(target);
6354         TextureEnvParameter pnamePacked = PackParam<TextureEnvParameter>(pname);
6355         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6356         bool isCallValid =
6357             (context->skipValidation() || ValidateTexEnvi(context, angle::EntryPoint::GLTexEnvi,
6358                                                           targetPacked, pnamePacked, param));
6359         if (isCallValid)
6360         {
6361             context->texEnvi(targetPacked, pnamePacked, param);
6362         }
6363         ANGLE_CAPTURE(TexEnvi, isCallValid, context, targetPacked, pnamePacked, param);
6364     }
6365     else
6366     {
6367         GenerateContextLostErrorOnCurrentGlobalContext();
6368     }
6369 }
6370 
GL_TexEnviv(GLenum target,GLenum pname,const GLint * params)6371 void GL_APIENTRY GL_TexEnviv(GLenum target, GLenum pname, const GLint *params)
6372 {
6373     Context *context = GetValidGlobalContext();
6374     EVENT(context, GLTexEnviv, "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "",
6375           CID(context), GLenumToString(GLenumGroup::TextureEnvTarget, target),
6376           GLenumToString(GLenumGroup::TextureEnvParameter, pname), (uintptr_t)params);
6377 
6378     if (context)
6379     {
6380         TextureEnvTarget targetPacked   = PackParam<TextureEnvTarget>(target);
6381         TextureEnvParameter pnamePacked = PackParam<TextureEnvParameter>(pname);
6382         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6383         bool isCallValid =
6384             (context->skipValidation() || ValidateTexEnviv(context, angle::EntryPoint::GLTexEnviv,
6385                                                            targetPacked, pnamePacked, params));
6386         if (isCallValid)
6387         {
6388             context->texEnviv(targetPacked, pnamePacked, params);
6389         }
6390         ANGLE_CAPTURE(TexEnviv, isCallValid, context, targetPacked, pnamePacked, params);
6391     }
6392     else
6393     {
6394         GenerateContextLostErrorOnCurrentGlobalContext();
6395     }
6396 }
6397 
GL_TexGend(GLenum coord,GLenum pname,GLdouble param)6398 void GL_APIENTRY GL_TexGend(GLenum coord, GLenum pname, GLdouble param)
6399 {
6400     Context *context = GetValidGlobalContext();
6401     EVENT(context, GLTexGend, "context = %d, coord = %s, pname = %s, param = %f", CID(context),
6402           GLenumToString(GLenumGroup::TextureCoordName, coord),
6403           GLenumToString(GLenumGroup::TextureGenParameter, pname), param);
6404 
6405     if (context)
6406     {
6407         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6408         bool isCallValid =
6409             (context->skipValidation() ||
6410              ValidateTexGend(context, angle::EntryPoint::GLTexGend, coord, pname, param));
6411         if (isCallValid)
6412         {
6413             context->texGend(coord, pname, param);
6414         }
6415         ANGLE_CAPTURE(TexGend, isCallValid, context, coord, pname, param);
6416     }
6417     else
6418     {
6419         GenerateContextLostErrorOnCurrentGlobalContext();
6420     }
6421 }
6422 
GL_TexGendv(GLenum coord,GLenum pname,const GLdouble * params)6423 void GL_APIENTRY GL_TexGendv(GLenum coord, GLenum pname, const GLdouble *params)
6424 {
6425     Context *context = GetValidGlobalContext();
6426     EVENT(context, GLTexGendv, "context = %d, coord = %s, pname = %s, params = 0x%016" PRIxPTR "",
6427           CID(context), GLenumToString(GLenumGroup::TextureCoordName, coord),
6428           GLenumToString(GLenumGroup::TextureGenParameter, pname), (uintptr_t)params);
6429 
6430     if (context)
6431     {
6432         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6433         bool isCallValid =
6434             (context->skipValidation() ||
6435              ValidateTexGendv(context, angle::EntryPoint::GLTexGendv, coord, pname, params));
6436         if (isCallValid)
6437         {
6438             context->texGendv(coord, pname, params);
6439         }
6440         ANGLE_CAPTURE(TexGendv, isCallValid, context, coord, pname, params);
6441     }
6442     else
6443     {
6444         GenerateContextLostErrorOnCurrentGlobalContext();
6445     }
6446 }
6447 
GL_TexGenf(GLenum coord,GLenum pname,GLfloat param)6448 void GL_APIENTRY GL_TexGenf(GLenum coord, GLenum pname, GLfloat param)
6449 {
6450     Context *context = GetValidGlobalContext();
6451     EVENT(context, GLTexGenf, "context = %d, coord = %s, pname = %s, param = %f", CID(context),
6452           GLenumToString(GLenumGroup::TextureCoordName, coord),
6453           GLenumToString(GLenumGroup::TextureGenParameter, pname), param);
6454 
6455     if (context)
6456     {
6457         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6458         bool isCallValid =
6459             (context->skipValidation() ||
6460              ValidateTexGenf(context, angle::EntryPoint::GLTexGenf, coord, pname, param));
6461         if (isCallValid)
6462         {
6463             context->texGenf(coord, pname, param);
6464         }
6465         ANGLE_CAPTURE(TexGenf, isCallValid, context, coord, pname, param);
6466     }
6467     else
6468     {
6469         GenerateContextLostErrorOnCurrentGlobalContext();
6470     }
6471 }
6472 
GL_TexGenfv(GLenum coord,GLenum pname,const GLfloat * params)6473 void GL_APIENTRY GL_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
6474 {
6475     Context *context = GetValidGlobalContext();
6476     EVENT(context, GLTexGenfv, "context = %d, coord = %s, pname = %s, params = 0x%016" PRIxPTR "",
6477           CID(context), GLenumToString(GLenumGroup::TextureCoordName, coord),
6478           GLenumToString(GLenumGroup::TextureGenParameter, pname), (uintptr_t)params);
6479 
6480     if (context)
6481     {
6482         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6483         bool isCallValid =
6484             (context->skipValidation() ||
6485              ValidateTexGenfv(context, angle::EntryPoint::GLTexGenfv, coord, pname, params));
6486         if (isCallValid)
6487         {
6488             context->texGenfv(coord, pname, params);
6489         }
6490         ANGLE_CAPTURE(TexGenfv, isCallValid, context, coord, pname, params);
6491     }
6492     else
6493     {
6494         GenerateContextLostErrorOnCurrentGlobalContext();
6495     }
6496 }
6497 
GL_TexGeni(GLenum coord,GLenum pname,GLint param)6498 void GL_APIENTRY GL_TexGeni(GLenum coord, GLenum pname, GLint param)
6499 {
6500     Context *context = GetValidGlobalContext();
6501     EVENT(context, GLTexGeni, "context = %d, coord = %s, pname = %s, param = %d", CID(context),
6502           GLenumToString(GLenumGroup::TextureCoordName, coord),
6503           GLenumToString(GLenumGroup::TextureGenParameter, pname), param);
6504 
6505     if (context)
6506     {
6507         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6508         bool isCallValid =
6509             (context->skipValidation() ||
6510              ValidateTexGeni(context, angle::EntryPoint::GLTexGeni, coord, pname, param));
6511         if (isCallValid)
6512         {
6513             context->texGeni(coord, pname, param);
6514         }
6515         ANGLE_CAPTURE(TexGeni, isCallValid, context, coord, pname, param);
6516     }
6517     else
6518     {
6519         GenerateContextLostErrorOnCurrentGlobalContext();
6520     }
6521 }
6522 
GL_TexGeniv(GLenum coord,GLenum pname,const GLint * params)6523 void GL_APIENTRY GL_TexGeniv(GLenum coord, GLenum pname, const GLint *params)
6524 {
6525     Context *context = GetValidGlobalContext();
6526     EVENT(context, GLTexGeniv, "context = %d, coord = %s, pname = %s, params = 0x%016" PRIxPTR "",
6527           CID(context), GLenumToString(GLenumGroup::TextureCoordName, coord),
6528           GLenumToString(GLenumGroup::TextureGenParameter, pname), (uintptr_t)params);
6529 
6530     if (context)
6531     {
6532         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6533         bool isCallValid =
6534             (context->skipValidation() ||
6535              ValidateTexGeniv(context, angle::EntryPoint::GLTexGeniv, coord, pname, params));
6536         if (isCallValid)
6537         {
6538             context->texGeniv(coord, pname, params);
6539         }
6540         ANGLE_CAPTURE(TexGeniv, isCallValid, context, coord, pname, params);
6541     }
6542     else
6543     {
6544         GenerateContextLostErrorOnCurrentGlobalContext();
6545     }
6546 }
6547 
GL_TexImage1D(GLenum target,GLint level,GLint internalformat,GLsizei width,GLint border,GLenum format,GLenum type,const void * pixels)6548 void GL_APIENTRY GL_TexImage1D(GLenum target,
6549                                GLint level,
6550                                GLint internalformat,
6551                                GLsizei width,
6552                                GLint border,
6553                                GLenum format,
6554                                GLenum type,
6555                                const void *pixels)
6556 {
6557     Context *context = GetValidGlobalContext();
6558     EVENT(context, GLTexImage1D,
6559           "context = %d, target = %s, level = %d, internalformat = %d, width = %d, border = %d, "
6560           "format = %s, type = %s, pixels = 0x%016" PRIxPTR "",
6561           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, internalformat,
6562           width, border, GLenumToString(GLenumGroup::PixelFormat, format),
6563           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
6564 
6565     if (context)
6566     {
6567         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6568         bool isCallValid =
6569             (context->skipValidation() ||
6570              ValidateTexImage1D(context, angle::EntryPoint::GLTexImage1D, target, level,
6571                                 internalformat, width, border, format, type, pixels));
6572         if (isCallValid)
6573         {
6574             context->texImage1D(target, level, internalformat, width, border, format, type, pixels);
6575         }
6576         ANGLE_CAPTURE(TexImage1D, isCallValid, context, target, level, internalformat, width,
6577                       border, format, type, pixels);
6578     }
6579     else
6580     {
6581         GenerateContextLostErrorOnCurrentGlobalContext();
6582     }
6583 }
6584 
GL_TexImage2D(GLenum target,GLint level,GLint internalformat,GLsizei width,GLsizei height,GLint border,GLenum format,GLenum type,const void * pixels)6585 void GL_APIENTRY GL_TexImage2D(GLenum target,
6586                                GLint level,
6587                                GLint internalformat,
6588                                GLsizei width,
6589                                GLsizei height,
6590                                GLint border,
6591                                GLenum format,
6592                                GLenum type,
6593                                const void *pixels)
6594 {
6595     Context *context = GetValidGlobalContext();
6596     EVENT(context, GLTexImage2D,
6597           "context = %d, target = %s, level = %d, internalformat = %d, width = %d, height = %d, "
6598           "border = %d, format = %s, type = %s, pixels = 0x%016" PRIxPTR "",
6599           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, internalformat,
6600           width, height, border, GLenumToString(GLenumGroup::PixelFormat, format),
6601           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
6602 
6603     if (context)
6604     {
6605         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
6606         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6607         bool isCallValid =
6608             (context->skipValidation() ||
6609              ValidateTexImage2D(context, angle::EntryPoint::GLTexImage2D, targetPacked, level,
6610                                 internalformat, width, height, border, format, type, pixels));
6611         if (isCallValid)
6612         {
6613             context->texImage2D(targetPacked, level, internalformat, width, height, border, format,
6614                                 type, pixels);
6615         }
6616         ANGLE_CAPTURE(TexImage2D, isCallValid, context, targetPacked, level, internalformat, width,
6617                       height, border, format, type, pixels);
6618     }
6619     else
6620     {
6621         GenerateContextLostErrorOnCurrentGlobalContext();
6622     }
6623 }
6624 
GL_TexParameterf(GLenum target,GLenum pname,GLfloat param)6625 void GL_APIENTRY GL_TexParameterf(GLenum target, GLenum pname, GLfloat param)
6626 {
6627     Context *context = GetValidGlobalContext();
6628     EVENT(context, GLTexParameterf, "context = %d, target = %s, pname = %s, param = %f",
6629           CID(context), GLenumToString(GLenumGroup::TextureTarget, target),
6630           GLenumToString(GLenumGroup::TextureParameterName, pname), param);
6631 
6632     if (context)
6633     {
6634         TextureType targetPacked                              = PackParam<TextureType>(target);
6635         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6636         bool isCallValid                                      = (context->skipValidation() ||
6637                             ValidateTexParameterf(context, angle::EntryPoint::GLTexParameterf,
6638                                                   targetPacked, pname, param));
6639         if (isCallValid)
6640         {
6641             context->texParameterf(targetPacked, pname, param);
6642         }
6643         ANGLE_CAPTURE(TexParameterf, isCallValid, context, targetPacked, pname, param);
6644     }
6645     else
6646     {
6647         GenerateContextLostErrorOnCurrentGlobalContext();
6648     }
6649 }
6650 
GL_TexParameterfv(GLenum target,GLenum pname,const GLfloat * params)6651 void GL_APIENTRY GL_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
6652 {
6653     Context *context = GetValidGlobalContext();
6654     EVENT(context, GLTexParameterfv,
6655           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
6656           GLenumToString(GLenumGroup::TextureTarget, target),
6657           GLenumToString(GLenumGroup::TextureParameterName, pname), (uintptr_t)params);
6658 
6659     if (context)
6660     {
6661         TextureType targetPacked                              = PackParam<TextureType>(target);
6662         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6663         bool isCallValid                                      = (context->skipValidation() ||
6664                             ValidateTexParameterfv(context, angle::EntryPoint::GLTexParameterfv,
6665                                                    targetPacked, pname, params));
6666         if (isCallValid)
6667         {
6668             context->texParameterfv(targetPacked, pname, params);
6669         }
6670         ANGLE_CAPTURE(TexParameterfv, isCallValid, context, targetPacked, pname, params);
6671     }
6672     else
6673     {
6674         GenerateContextLostErrorOnCurrentGlobalContext();
6675     }
6676 }
6677 
GL_TexParameteri(GLenum target,GLenum pname,GLint param)6678 void GL_APIENTRY GL_TexParameteri(GLenum target, GLenum pname, GLint param)
6679 {
6680     Context *context = GetValidGlobalContext();
6681     EVENT(context, GLTexParameteri, "context = %d, target = %s, pname = %s, param = %d",
6682           CID(context), GLenumToString(GLenumGroup::TextureTarget, target),
6683           GLenumToString(GLenumGroup::TextureParameterName, pname), param);
6684 
6685     if (context)
6686     {
6687         TextureType targetPacked                              = PackParam<TextureType>(target);
6688         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6689         bool isCallValid                                      = (context->skipValidation() ||
6690                             ValidateTexParameteri(context, angle::EntryPoint::GLTexParameteri,
6691                                                   targetPacked, pname, param));
6692         if (isCallValid)
6693         {
6694             context->texParameteri(targetPacked, pname, param);
6695         }
6696         ANGLE_CAPTURE(TexParameteri, isCallValid, context, targetPacked, pname, param);
6697     }
6698     else
6699     {
6700         GenerateContextLostErrorOnCurrentGlobalContext();
6701     }
6702 }
6703 
GL_TexParameteriv(GLenum target,GLenum pname,const GLint * params)6704 void GL_APIENTRY GL_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
6705 {
6706     Context *context = GetValidGlobalContext();
6707     EVENT(context, GLTexParameteriv,
6708           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
6709           GLenumToString(GLenumGroup::TextureTarget, target),
6710           GLenumToString(GLenumGroup::TextureParameterName, pname), (uintptr_t)params);
6711 
6712     if (context)
6713     {
6714         TextureType targetPacked                              = PackParam<TextureType>(target);
6715         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6716         bool isCallValid                                      = (context->skipValidation() ||
6717                             ValidateTexParameteriv(context, angle::EntryPoint::GLTexParameteriv,
6718                                                    targetPacked, pname, params));
6719         if (isCallValid)
6720         {
6721             context->texParameteriv(targetPacked, pname, params);
6722         }
6723         ANGLE_CAPTURE(TexParameteriv, isCallValid, context, targetPacked, pname, params);
6724     }
6725     else
6726     {
6727         GenerateContextLostErrorOnCurrentGlobalContext();
6728     }
6729 }
6730 
GL_Translated(GLdouble x,GLdouble y,GLdouble z)6731 void GL_APIENTRY GL_Translated(GLdouble x, GLdouble y, GLdouble z)
6732 {
6733     Context *context = GetValidGlobalContext();
6734     EVENT(context, GLTranslated, "context = %d, x = %f, y = %f, z = %f", CID(context), x, y, z);
6735 
6736     if (context)
6737     {
6738         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6739         bool isCallValid                                      = (context->skipValidation() ||
6740                             ValidateTranslated(context, angle::EntryPoint::GLTranslated, x, y, z));
6741         if (isCallValid)
6742         {
6743             context->translated(x, y, z);
6744         }
6745         ANGLE_CAPTURE(Translated, isCallValid, context, x, y, z);
6746     }
6747     else
6748     {
6749         GenerateContextLostErrorOnCurrentGlobalContext();
6750     }
6751 }
6752 
GL_Translatef(GLfloat x,GLfloat y,GLfloat z)6753 void GL_APIENTRY GL_Translatef(GLfloat x, GLfloat y, GLfloat z)
6754 {
6755     Context *context = GetValidGlobalContext();
6756     EVENT(context, GLTranslatef, "context = %d, x = %f, y = %f, z = %f", CID(context), x, y, z);
6757 
6758     if (context)
6759     {
6760         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6761         bool isCallValid                                      = (context->skipValidation() ||
6762                             ValidateTranslatef(context, angle::EntryPoint::GLTranslatef, x, y, z));
6763         if (isCallValid)
6764         {
6765             context->translatef(x, y, z);
6766         }
6767         ANGLE_CAPTURE(Translatef, isCallValid, context, x, y, z);
6768     }
6769     else
6770     {
6771         GenerateContextLostErrorOnCurrentGlobalContext();
6772     }
6773 }
6774 
GL_Vertex2d(GLdouble x,GLdouble y)6775 void GL_APIENTRY GL_Vertex2d(GLdouble x, GLdouble y)
6776 {
6777     Context *context = GetValidGlobalContext();
6778     EVENT(context, GLVertex2d, "context = %d, x = %f, y = %f", CID(context), x, y);
6779 
6780     if (context)
6781     {
6782         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6783         bool isCallValid                                      = (context->skipValidation() ||
6784                             ValidateVertex2d(context, angle::EntryPoint::GLVertex2d, x, y));
6785         if (isCallValid)
6786         {
6787             context->vertex2d(x, y);
6788         }
6789         ANGLE_CAPTURE(Vertex2d, isCallValid, context, x, y);
6790     }
6791     else
6792     {
6793         GenerateContextLostErrorOnCurrentGlobalContext();
6794     }
6795 }
6796 
GL_Vertex2dv(const GLdouble * v)6797 void GL_APIENTRY GL_Vertex2dv(const GLdouble *v)
6798 {
6799     Context *context = GetValidGlobalContext();
6800     EVENT(context, GLVertex2dv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
6801 
6802     if (context)
6803     {
6804         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6805         bool isCallValid                                      = (context->skipValidation() ||
6806                             ValidateVertex2dv(context, angle::EntryPoint::GLVertex2dv, v));
6807         if (isCallValid)
6808         {
6809             context->vertex2dv(v);
6810         }
6811         ANGLE_CAPTURE(Vertex2dv, isCallValid, context, v);
6812     }
6813     else
6814     {
6815         GenerateContextLostErrorOnCurrentGlobalContext();
6816     }
6817 }
6818 
GL_Vertex2f(GLfloat x,GLfloat y)6819 void GL_APIENTRY GL_Vertex2f(GLfloat x, GLfloat y)
6820 {
6821     Context *context = GetValidGlobalContext();
6822     EVENT(context, GLVertex2f, "context = %d, x = %f, y = %f", CID(context), x, y);
6823 
6824     if (context)
6825     {
6826         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6827         bool isCallValid                                      = (context->skipValidation() ||
6828                             ValidateVertex2f(context, angle::EntryPoint::GLVertex2f, x, y));
6829         if (isCallValid)
6830         {
6831             context->vertex2f(x, y);
6832         }
6833         ANGLE_CAPTURE(Vertex2f, isCallValid, context, x, y);
6834     }
6835     else
6836     {
6837         GenerateContextLostErrorOnCurrentGlobalContext();
6838     }
6839 }
6840 
GL_Vertex2fv(const GLfloat * v)6841 void GL_APIENTRY GL_Vertex2fv(const GLfloat *v)
6842 {
6843     Context *context = GetValidGlobalContext();
6844     EVENT(context, GLVertex2fv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
6845 
6846     if (context)
6847     {
6848         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6849         bool isCallValid                                      = (context->skipValidation() ||
6850                             ValidateVertex2fv(context, angle::EntryPoint::GLVertex2fv, v));
6851         if (isCallValid)
6852         {
6853             context->vertex2fv(v);
6854         }
6855         ANGLE_CAPTURE(Vertex2fv, isCallValid, context, v);
6856     }
6857     else
6858     {
6859         GenerateContextLostErrorOnCurrentGlobalContext();
6860     }
6861 }
6862 
GL_Vertex2i(GLint x,GLint y)6863 void GL_APIENTRY GL_Vertex2i(GLint x, GLint y)
6864 {
6865     Context *context = GetValidGlobalContext();
6866     EVENT(context, GLVertex2i, "context = %d, x = %d, y = %d", CID(context), x, y);
6867 
6868     if (context)
6869     {
6870         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6871         bool isCallValid                                      = (context->skipValidation() ||
6872                             ValidateVertex2i(context, angle::EntryPoint::GLVertex2i, x, y));
6873         if (isCallValid)
6874         {
6875             context->vertex2i(x, y);
6876         }
6877         ANGLE_CAPTURE(Vertex2i, isCallValid, context, x, y);
6878     }
6879     else
6880     {
6881         GenerateContextLostErrorOnCurrentGlobalContext();
6882     }
6883 }
6884 
GL_Vertex2iv(const GLint * v)6885 void GL_APIENTRY GL_Vertex2iv(const GLint *v)
6886 {
6887     Context *context = GetValidGlobalContext();
6888     EVENT(context, GLVertex2iv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
6889 
6890     if (context)
6891     {
6892         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6893         bool isCallValid                                      = (context->skipValidation() ||
6894                             ValidateVertex2iv(context, angle::EntryPoint::GLVertex2iv, v));
6895         if (isCallValid)
6896         {
6897             context->vertex2iv(v);
6898         }
6899         ANGLE_CAPTURE(Vertex2iv, isCallValid, context, v);
6900     }
6901     else
6902     {
6903         GenerateContextLostErrorOnCurrentGlobalContext();
6904     }
6905 }
6906 
GL_Vertex2s(GLshort x,GLshort y)6907 void GL_APIENTRY GL_Vertex2s(GLshort x, GLshort y)
6908 {
6909     Context *context = GetValidGlobalContext();
6910     EVENT(context, GLVertex2s, "context = %d, x = %d, y = %d", CID(context), x, y);
6911 
6912     if (context)
6913     {
6914         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6915         bool isCallValid                                      = (context->skipValidation() ||
6916                             ValidateVertex2s(context, angle::EntryPoint::GLVertex2s, x, y));
6917         if (isCallValid)
6918         {
6919             context->vertex2s(x, y);
6920         }
6921         ANGLE_CAPTURE(Vertex2s, isCallValid, context, x, y);
6922     }
6923     else
6924     {
6925         GenerateContextLostErrorOnCurrentGlobalContext();
6926     }
6927 }
6928 
GL_Vertex2sv(const GLshort * v)6929 void GL_APIENTRY GL_Vertex2sv(const GLshort *v)
6930 {
6931     Context *context = GetValidGlobalContext();
6932     EVENT(context, GLVertex2sv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
6933 
6934     if (context)
6935     {
6936         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6937         bool isCallValid                                      = (context->skipValidation() ||
6938                             ValidateVertex2sv(context, angle::EntryPoint::GLVertex2sv, v));
6939         if (isCallValid)
6940         {
6941             context->vertex2sv(v);
6942         }
6943         ANGLE_CAPTURE(Vertex2sv, isCallValid, context, v);
6944     }
6945     else
6946     {
6947         GenerateContextLostErrorOnCurrentGlobalContext();
6948     }
6949 }
6950 
GL_Vertex3d(GLdouble x,GLdouble y,GLdouble z)6951 void GL_APIENTRY GL_Vertex3d(GLdouble x, GLdouble y, GLdouble z)
6952 {
6953     Context *context = GetValidGlobalContext();
6954     EVENT(context, GLVertex3d, "context = %d, x = %f, y = %f, z = %f", CID(context), x, y, z);
6955 
6956     if (context)
6957     {
6958         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6959         bool isCallValid                                      = (context->skipValidation() ||
6960                             ValidateVertex3d(context, angle::EntryPoint::GLVertex3d, x, y, z));
6961         if (isCallValid)
6962         {
6963             context->vertex3d(x, y, z);
6964         }
6965         ANGLE_CAPTURE(Vertex3d, isCallValid, context, x, y, z);
6966     }
6967     else
6968     {
6969         GenerateContextLostErrorOnCurrentGlobalContext();
6970     }
6971 }
6972 
GL_Vertex3dv(const GLdouble * v)6973 void GL_APIENTRY GL_Vertex3dv(const GLdouble *v)
6974 {
6975     Context *context = GetValidGlobalContext();
6976     EVENT(context, GLVertex3dv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
6977 
6978     if (context)
6979     {
6980         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6981         bool isCallValid                                      = (context->skipValidation() ||
6982                             ValidateVertex3dv(context, angle::EntryPoint::GLVertex3dv, v));
6983         if (isCallValid)
6984         {
6985             context->vertex3dv(v);
6986         }
6987         ANGLE_CAPTURE(Vertex3dv, isCallValid, context, v);
6988     }
6989     else
6990     {
6991         GenerateContextLostErrorOnCurrentGlobalContext();
6992     }
6993 }
6994 
GL_Vertex3f(GLfloat x,GLfloat y,GLfloat z)6995 void GL_APIENTRY GL_Vertex3f(GLfloat x, GLfloat y, GLfloat z)
6996 {
6997     Context *context = GetValidGlobalContext();
6998     EVENT(context, GLVertex3f, "context = %d, x = %f, y = %f, z = %f", CID(context), x, y, z);
6999 
7000     if (context)
7001     {
7002         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7003         bool isCallValid                                      = (context->skipValidation() ||
7004                             ValidateVertex3f(context, angle::EntryPoint::GLVertex3f, x, y, z));
7005         if (isCallValid)
7006         {
7007             context->vertex3f(x, y, z);
7008         }
7009         ANGLE_CAPTURE(Vertex3f, isCallValid, context, x, y, z);
7010     }
7011     else
7012     {
7013         GenerateContextLostErrorOnCurrentGlobalContext();
7014     }
7015 }
7016 
GL_Vertex3fv(const GLfloat * v)7017 void GL_APIENTRY GL_Vertex3fv(const GLfloat *v)
7018 {
7019     Context *context = GetValidGlobalContext();
7020     EVENT(context, GLVertex3fv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
7021 
7022     if (context)
7023     {
7024         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7025         bool isCallValid                                      = (context->skipValidation() ||
7026                             ValidateVertex3fv(context, angle::EntryPoint::GLVertex3fv, v));
7027         if (isCallValid)
7028         {
7029             context->vertex3fv(v);
7030         }
7031         ANGLE_CAPTURE(Vertex3fv, isCallValid, context, v);
7032     }
7033     else
7034     {
7035         GenerateContextLostErrorOnCurrentGlobalContext();
7036     }
7037 }
7038 
GL_Vertex3i(GLint x,GLint y,GLint z)7039 void GL_APIENTRY GL_Vertex3i(GLint x, GLint y, GLint z)
7040 {
7041     Context *context = GetValidGlobalContext();
7042     EVENT(context, GLVertex3i, "context = %d, x = %d, y = %d, z = %d", CID(context), x, y, z);
7043 
7044     if (context)
7045     {
7046         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7047         bool isCallValid                                      = (context->skipValidation() ||
7048                             ValidateVertex3i(context, angle::EntryPoint::GLVertex3i, x, y, z));
7049         if (isCallValid)
7050         {
7051             context->vertex3i(x, y, z);
7052         }
7053         ANGLE_CAPTURE(Vertex3i, isCallValid, context, x, y, z);
7054     }
7055     else
7056     {
7057         GenerateContextLostErrorOnCurrentGlobalContext();
7058     }
7059 }
7060 
GL_Vertex3iv(const GLint * v)7061 void GL_APIENTRY GL_Vertex3iv(const GLint *v)
7062 {
7063     Context *context = GetValidGlobalContext();
7064     EVENT(context, GLVertex3iv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
7065 
7066     if (context)
7067     {
7068         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7069         bool isCallValid                                      = (context->skipValidation() ||
7070                             ValidateVertex3iv(context, angle::EntryPoint::GLVertex3iv, v));
7071         if (isCallValid)
7072         {
7073             context->vertex3iv(v);
7074         }
7075         ANGLE_CAPTURE(Vertex3iv, isCallValid, context, v);
7076     }
7077     else
7078     {
7079         GenerateContextLostErrorOnCurrentGlobalContext();
7080     }
7081 }
7082 
GL_Vertex3s(GLshort x,GLshort y,GLshort z)7083 void GL_APIENTRY GL_Vertex3s(GLshort x, GLshort y, GLshort z)
7084 {
7085     Context *context = GetValidGlobalContext();
7086     EVENT(context, GLVertex3s, "context = %d, x = %d, y = %d, z = %d", CID(context), x, y, z);
7087 
7088     if (context)
7089     {
7090         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7091         bool isCallValid                                      = (context->skipValidation() ||
7092                             ValidateVertex3s(context, angle::EntryPoint::GLVertex3s, x, y, z));
7093         if (isCallValid)
7094         {
7095             context->vertex3s(x, y, z);
7096         }
7097         ANGLE_CAPTURE(Vertex3s, isCallValid, context, x, y, z);
7098     }
7099     else
7100     {
7101         GenerateContextLostErrorOnCurrentGlobalContext();
7102     }
7103 }
7104 
GL_Vertex3sv(const GLshort * v)7105 void GL_APIENTRY GL_Vertex3sv(const GLshort *v)
7106 {
7107     Context *context = GetValidGlobalContext();
7108     EVENT(context, GLVertex3sv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
7109 
7110     if (context)
7111     {
7112         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7113         bool isCallValid                                      = (context->skipValidation() ||
7114                             ValidateVertex3sv(context, angle::EntryPoint::GLVertex3sv, v));
7115         if (isCallValid)
7116         {
7117             context->vertex3sv(v);
7118         }
7119         ANGLE_CAPTURE(Vertex3sv, isCallValid, context, v);
7120     }
7121     else
7122     {
7123         GenerateContextLostErrorOnCurrentGlobalContext();
7124     }
7125 }
7126 
GL_Vertex4d(GLdouble x,GLdouble y,GLdouble z,GLdouble w)7127 void GL_APIENTRY GL_Vertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
7128 {
7129     Context *context = GetValidGlobalContext();
7130     EVENT(context, GLVertex4d, "context = %d, x = %f, y = %f, z = %f, w = %f", CID(context), x, y,
7131           z, w);
7132 
7133     if (context)
7134     {
7135         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7136         bool isCallValid                                      = (context->skipValidation() ||
7137                             ValidateVertex4d(context, angle::EntryPoint::GLVertex4d, x, y, z, w));
7138         if (isCallValid)
7139         {
7140             context->vertex4d(x, y, z, w);
7141         }
7142         ANGLE_CAPTURE(Vertex4d, isCallValid, context, x, y, z, w);
7143     }
7144     else
7145     {
7146         GenerateContextLostErrorOnCurrentGlobalContext();
7147     }
7148 }
7149 
GL_Vertex4dv(const GLdouble * v)7150 void GL_APIENTRY GL_Vertex4dv(const GLdouble *v)
7151 {
7152     Context *context = GetValidGlobalContext();
7153     EVENT(context, GLVertex4dv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
7154 
7155     if (context)
7156     {
7157         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7158         bool isCallValid                                      = (context->skipValidation() ||
7159                             ValidateVertex4dv(context, angle::EntryPoint::GLVertex4dv, v));
7160         if (isCallValid)
7161         {
7162             context->vertex4dv(v);
7163         }
7164         ANGLE_CAPTURE(Vertex4dv, isCallValid, context, v);
7165     }
7166     else
7167     {
7168         GenerateContextLostErrorOnCurrentGlobalContext();
7169     }
7170 }
7171 
GL_Vertex4f(GLfloat x,GLfloat y,GLfloat z,GLfloat w)7172 void GL_APIENTRY GL_Vertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
7173 {
7174     Context *context = GetValidGlobalContext();
7175     EVENT(context, GLVertex4f, "context = %d, x = %f, y = %f, z = %f, w = %f", CID(context), x, y,
7176           z, w);
7177 
7178     if (context)
7179     {
7180         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7181         bool isCallValid                                      = (context->skipValidation() ||
7182                             ValidateVertex4f(context, angle::EntryPoint::GLVertex4f, x, y, z, w));
7183         if (isCallValid)
7184         {
7185             context->vertex4f(x, y, z, w);
7186         }
7187         ANGLE_CAPTURE(Vertex4f, isCallValid, context, x, y, z, w);
7188     }
7189     else
7190     {
7191         GenerateContextLostErrorOnCurrentGlobalContext();
7192     }
7193 }
7194 
GL_Vertex4fv(const GLfloat * v)7195 void GL_APIENTRY GL_Vertex4fv(const GLfloat *v)
7196 {
7197     Context *context = GetValidGlobalContext();
7198     EVENT(context, GLVertex4fv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
7199 
7200     if (context)
7201     {
7202         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7203         bool isCallValid                                      = (context->skipValidation() ||
7204                             ValidateVertex4fv(context, angle::EntryPoint::GLVertex4fv, v));
7205         if (isCallValid)
7206         {
7207             context->vertex4fv(v);
7208         }
7209         ANGLE_CAPTURE(Vertex4fv, isCallValid, context, v);
7210     }
7211     else
7212     {
7213         GenerateContextLostErrorOnCurrentGlobalContext();
7214     }
7215 }
7216 
GL_Vertex4i(GLint x,GLint y,GLint z,GLint w)7217 void GL_APIENTRY GL_Vertex4i(GLint x, GLint y, GLint z, GLint w)
7218 {
7219     Context *context = GetValidGlobalContext();
7220     EVENT(context, GLVertex4i, "context = %d, x = %d, y = %d, z = %d, w = %d", CID(context), x, y,
7221           z, w);
7222 
7223     if (context)
7224     {
7225         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7226         bool isCallValid                                      = (context->skipValidation() ||
7227                             ValidateVertex4i(context, angle::EntryPoint::GLVertex4i, x, y, z, w));
7228         if (isCallValid)
7229         {
7230             context->vertex4i(x, y, z, w);
7231         }
7232         ANGLE_CAPTURE(Vertex4i, isCallValid, context, x, y, z, w);
7233     }
7234     else
7235     {
7236         GenerateContextLostErrorOnCurrentGlobalContext();
7237     }
7238 }
7239 
GL_Vertex4iv(const GLint * v)7240 void GL_APIENTRY GL_Vertex4iv(const GLint *v)
7241 {
7242     Context *context = GetValidGlobalContext();
7243     EVENT(context, GLVertex4iv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
7244 
7245     if (context)
7246     {
7247         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7248         bool isCallValid                                      = (context->skipValidation() ||
7249                             ValidateVertex4iv(context, angle::EntryPoint::GLVertex4iv, v));
7250         if (isCallValid)
7251         {
7252             context->vertex4iv(v);
7253         }
7254         ANGLE_CAPTURE(Vertex4iv, isCallValid, context, v);
7255     }
7256     else
7257     {
7258         GenerateContextLostErrorOnCurrentGlobalContext();
7259     }
7260 }
7261 
GL_Vertex4s(GLshort x,GLshort y,GLshort z,GLshort w)7262 void GL_APIENTRY GL_Vertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
7263 {
7264     Context *context = GetValidGlobalContext();
7265     EVENT(context, GLVertex4s, "context = %d, x = %d, y = %d, z = %d, w = %d", CID(context), x, y,
7266           z, w);
7267 
7268     if (context)
7269     {
7270         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7271         bool isCallValid                                      = (context->skipValidation() ||
7272                             ValidateVertex4s(context, angle::EntryPoint::GLVertex4s, x, y, z, w));
7273         if (isCallValid)
7274         {
7275             context->vertex4s(x, y, z, w);
7276         }
7277         ANGLE_CAPTURE(Vertex4s, isCallValid, context, x, y, z, w);
7278     }
7279     else
7280     {
7281         GenerateContextLostErrorOnCurrentGlobalContext();
7282     }
7283 }
7284 
GL_Vertex4sv(const GLshort * v)7285 void GL_APIENTRY GL_Vertex4sv(const GLshort *v)
7286 {
7287     Context *context = GetValidGlobalContext();
7288     EVENT(context, GLVertex4sv, "context = %d, v = 0x%016" PRIxPTR "", CID(context), (uintptr_t)v);
7289 
7290     if (context)
7291     {
7292         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7293         bool isCallValid                                      = (context->skipValidation() ||
7294                             ValidateVertex4sv(context, angle::EntryPoint::GLVertex4sv, v));
7295         if (isCallValid)
7296         {
7297             context->vertex4sv(v);
7298         }
7299         ANGLE_CAPTURE(Vertex4sv, isCallValid, context, v);
7300     }
7301     else
7302     {
7303         GenerateContextLostErrorOnCurrentGlobalContext();
7304     }
7305 }
7306 
GL_Viewport(GLint x,GLint y,GLsizei width,GLsizei height)7307 void GL_APIENTRY GL_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
7308 {
7309     Context *context = GetValidGlobalContext();
7310     EVENT(context, GLViewport, "context = %d, x = %d, y = %d, width = %d, height = %d",
7311           CID(context), x, y, width, height);
7312 
7313     if (context)
7314     {
7315         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7316         bool isCallValid =
7317             (context->skipValidation() ||
7318              ValidateViewport(context, angle::EntryPoint::GLViewport, x, y, width, height));
7319         if (isCallValid)
7320         {
7321             context->viewport(x, y, width, height);
7322         }
7323         ANGLE_CAPTURE(Viewport, isCallValid, context, x, y, width, height);
7324     }
7325     else
7326     {
7327         GenerateContextLostErrorOnCurrentGlobalContext();
7328     }
7329 }
7330 
7331 // GL 1.1
GL_AreTexturesResident(GLsizei n,const GLuint * textures,GLboolean * residences)7332 GLboolean GL_APIENTRY GL_AreTexturesResident(GLsizei n,
7333                                              const GLuint *textures,
7334                                              GLboolean *residences)
7335 {
7336     Context *context = GetValidGlobalContext();
7337     EVENT(context, GLAreTexturesResident,
7338           "context = %d, n = %d, textures = 0x%016" PRIxPTR ", residences = 0x%016" PRIxPTR "",
7339           CID(context), n, (uintptr_t)textures, (uintptr_t)residences);
7340 
7341     GLboolean returnValue;
7342     if (context)
7343     {
7344         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7345         bool isCallValid =
7346             (context->skipValidation() ||
7347              ValidateAreTexturesResident(context, angle::EntryPoint::GLAreTexturesResident, n,
7348                                          textures, residences));
7349         if (isCallValid)
7350         {
7351             returnValue = context->areTexturesResident(n, textures, residences);
7352         }
7353         else
7354         {
7355             returnValue =
7356                 GetDefaultReturnValue<angle::EntryPoint::GLAreTexturesResident, GLboolean>();
7357         }
7358         ANGLE_CAPTURE(AreTexturesResident, isCallValid, context, n, textures, residences,
7359                       returnValue);
7360     }
7361     else
7362     {
7363         GenerateContextLostErrorOnCurrentGlobalContext();
7364         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLAreTexturesResident, GLboolean>();
7365     }
7366     return returnValue;
7367 }
7368 
GL_ArrayElement(GLint i)7369 void GL_APIENTRY GL_ArrayElement(GLint i)
7370 {
7371     Context *context = GetValidGlobalContext();
7372     EVENT(context, GLArrayElement, "context = %d, i = %d", CID(context), i);
7373 
7374     if (context)
7375     {
7376         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7377         bool isCallValid                                      = (context->skipValidation() ||
7378                             ValidateArrayElement(context, angle::EntryPoint::GLArrayElement, i));
7379         if (isCallValid)
7380         {
7381             context->arrayElement(i);
7382         }
7383         ANGLE_CAPTURE(ArrayElement, isCallValid, context, i);
7384     }
7385     else
7386     {
7387         GenerateContextLostErrorOnCurrentGlobalContext();
7388     }
7389 }
7390 
GL_BindTexture(GLenum target,GLuint texture)7391 void GL_APIENTRY GL_BindTexture(GLenum target, GLuint texture)
7392 {
7393     Context *context = GetValidGlobalContext();
7394     EVENT(context, GLBindTexture, "context = %d, target = %s, texture = %u", CID(context),
7395           GLenumToString(GLenumGroup::TextureTarget, target), texture);
7396 
7397     if (context)
7398     {
7399         TextureType targetPacked                              = PackParam<TextureType>(target);
7400         TextureID texturePacked                               = PackParam<TextureID>(texture);
7401         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7402         bool isCallValid                                      = (context->skipValidation() ||
7403                             ValidateBindTexture(context, angle::EntryPoint::GLBindTexture,
7404                                                 targetPacked, texturePacked));
7405         if (isCallValid)
7406         {
7407             context->bindTexture(targetPacked, texturePacked);
7408         }
7409         ANGLE_CAPTURE(BindTexture, isCallValid, context, targetPacked, texturePacked);
7410     }
7411     else
7412     {
7413         GenerateContextLostErrorOnCurrentGlobalContext();
7414     }
7415 }
7416 
GL_ColorPointer(GLint size,GLenum type,GLsizei stride,const void * pointer)7417 void GL_APIENTRY GL_ColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
7418 {
7419     Context *context = GetValidGlobalContext();
7420     EVENT(context, GLColorPointer,
7421           "context = %d, size = %d, type = %s, stride = %d, pointer = 0x%016" PRIxPTR "",
7422           CID(context), size, GLenumToString(GLenumGroup::ColorPointerType, type), stride,
7423           (uintptr_t)pointer);
7424 
7425     if (context)
7426     {
7427         VertexAttribType typePacked                           = PackParam<VertexAttribType>(type);
7428         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7429         bool isCallValid                                      = (context->skipValidation() ||
7430                             ValidateColorPointer(context, angle::EntryPoint::GLColorPointer, size,
7431                                                  typePacked, stride, pointer));
7432         if (isCallValid)
7433         {
7434             context->colorPointer(size, typePacked, stride, pointer);
7435         }
7436         ANGLE_CAPTURE(ColorPointer, isCallValid, context, size, typePacked, stride, pointer);
7437     }
7438     else
7439     {
7440         GenerateContextLostErrorOnCurrentGlobalContext();
7441     }
7442 }
7443 
GL_CopyTexImage1D(GLenum target,GLint level,GLenum internalformat,GLint x,GLint y,GLsizei width,GLint border)7444 void GL_APIENTRY GL_CopyTexImage1D(GLenum target,
7445                                    GLint level,
7446                                    GLenum internalformat,
7447                                    GLint x,
7448                                    GLint y,
7449                                    GLsizei width,
7450                                    GLint border)
7451 {
7452     Context *context = GetValidGlobalContext();
7453     EVENT(context, GLCopyTexImage1D,
7454           "context = %d, target = %s, level = %d, internalformat = %s, x = %d, y = %d, width = %d, "
7455           "border = %d",
7456           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level,
7457           GLenumToString(GLenumGroup::InternalFormat, internalformat), x, y, width, border);
7458 
7459     if (context)
7460     {
7461         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7462         bool isCallValid =
7463             (context->skipValidation() ||
7464              ValidateCopyTexImage1D(context, angle::EntryPoint::GLCopyTexImage1D, target, level,
7465                                     internalformat, x, y, width, border));
7466         if (isCallValid)
7467         {
7468             context->copyTexImage1D(target, level, internalformat, x, y, width, border);
7469         }
7470         ANGLE_CAPTURE(CopyTexImage1D, isCallValid, context, target, level, internalformat, x, y,
7471                       width, border);
7472     }
7473     else
7474     {
7475         GenerateContextLostErrorOnCurrentGlobalContext();
7476     }
7477 }
7478 
GL_CopyTexImage2D(GLenum target,GLint level,GLenum internalformat,GLint x,GLint y,GLsizei width,GLsizei height,GLint border)7479 void GL_APIENTRY GL_CopyTexImage2D(GLenum target,
7480                                    GLint level,
7481                                    GLenum internalformat,
7482                                    GLint x,
7483                                    GLint y,
7484                                    GLsizei width,
7485                                    GLsizei height,
7486                                    GLint border)
7487 {
7488     Context *context = GetValidGlobalContext();
7489     EVENT(context, GLCopyTexImage2D,
7490           "context = %d, target = %s, level = %d, internalformat = %s, x = %d, y = %d, width = %d, "
7491           "height = %d, border = %d",
7492           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level,
7493           GLenumToString(GLenumGroup::InternalFormat, internalformat), x, y, width, height, border);
7494 
7495     if (context)
7496     {
7497         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
7498         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7499         bool isCallValid =
7500             (context->skipValidation() ||
7501              ValidateCopyTexImage2D(context, angle::EntryPoint::GLCopyTexImage2D, targetPacked,
7502                                     level, internalformat, x, y, width, height, border));
7503         if (isCallValid)
7504         {
7505             context->copyTexImage2D(targetPacked, level, internalformat, x, y, width, height,
7506                                     border);
7507         }
7508         ANGLE_CAPTURE(CopyTexImage2D, isCallValid, context, targetPacked, level, internalformat, x,
7509                       y, width, height, border);
7510     }
7511     else
7512     {
7513         GenerateContextLostErrorOnCurrentGlobalContext();
7514     }
7515 }
7516 
7517 void GL_APIENTRY
GL_CopyTexSubImage1D(GLenum target,GLint level,GLint xoffset,GLint x,GLint y,GLsizei width)7518 GL_CopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
7519 {
7520     Context *context = GetValidGlobalContext();
7521     EVENT(context, GLCopyTexSubImage1D,
7522           "context = %d, target = %s, level = %d, xoffset = %d, x = %d, y = %d, width = %d",
7523           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, xoffset, x, y,
7524           width);
7525 
7526     if (context)
7527     {
7528         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7529         bool isCallValid =
7530             (context->skipValidation() ||
7531              ValidateCopyTexSubImage1D(context, angle::EntryPoint::GLCopyTexSubImage1D, target,
7532                                        level, xoffset, x, y, width));
7533         if (isCallValid)
7534         {
7535             context->copyTexSubImage1D(target, level, xoffset, x, y, width);
7536         }
7537         ANGLE_CAPTURE(CopyTexSubImage1D, isCallValid, context, target, level, xoffset, x, y, width);
7538     }
7539     else
7540     {
7541         GenerateContextLostErrorOnCurrentGlobalContext();
7542     }
7543 }
7544 
GL_CopyTexSubImage2D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint x,GLint y,GLsizei width,GLsizei height)7545 void GL_APIENTRY GL_CopyTexSubImage2D(GLenum target,
7546                                       GLint level,
7547                                       GLint xoffset,
7548                                       GLint yoffset,
7549                                       GLint x,
7550                                       GLint y,
7551                                       GLsizei width,
7552                                       GLsizei height)
7553 {
7554     Context *context = GetValidGlobalContext();
7555     EVENT(context, GLCopyTexSubImage2D,
7556           "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, x = %d, y = %d, "
7557           "width = %d, height = %d",
7558           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, xoffset, yoffset,
7559           x, y, width, height);
7560 
7561     if (context)
7562     {
7563         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
7564         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7565         bool isCallValid =
7566             (context->skipValidation() ||
7567              ValidateCopyTexSubImage2D(context, angle::EntryPoint::GLCopyTexSubImage2D,
7568                                        targetPacked, level, xoffset, yoffset, x, y, width, height));
7569         if (isCallValid)
7570         {
7571             context->copyTexSubImage2D(targetPacked, level, xoffset, yoffset, x, y, width, height);
7572         }
7573         ANGLE_CAPTURE(CopyTexSubImage2D, isCallValid, context, targetPacked, level, xoffset,
7574                       yoffset, x, y, width, height);
7575     }
7576     else
7577     {
7578         GenerateContextLostErrorOnCurrentGlobalContext();
7579     }
7580 }
7581 
GL_DeleteTextures(GLsizei n,const GLuint * textures)7582 void GL_APIENTRY GL_DeleteTextures(GLsizei n, const GLuint *textures)
7583 {
7584     Context *context = GetValidGlobalContext();
7585     EVENT(context, GLDeleteTextures, "context = %d, n = %d, textures = 0x%016" PRIxPTR "",
7586           CID(context), n, (uintptr_t)textures);
7587 
7588     if (context)
7589     {
7590         const TextureID *texturesPacked = PackParam<const TextureID *>(textures);
7591         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7592         bool isCallValid                                      = (context->skipValidation() ||
7593                             ValidateDeleteTextures(context, angle::EntryPoint::GLDeleteTextures, n,
7594                                                    texturesPacked));
7595         if (isCallValid)
7596         {
7597             context->deleteTextures(n, texturesPacked);
7598         }
7599         ANGLE_CAPTURE(DeleteTextures, isCallValid, context, n, texturesPacked);
7600     }
7601     else
7602     {
7603         GenerateContextLostErrorOnCurrentGlobalContext();
7604     }
7605 }
7606 
GL_DisableClientState(GLenum array)7607 void GL_APIENTRY GL_DisableClientState(GLenum array)
7608 {
7609     Context *context = GetValidGlobalContext();
7610     EVENT(context, GLDisableClientState, "context = %d, array = %s", CID(context),
7611           GLenumToString(GLenumGroup::EnableCap, array));
7612 
7613     if (context)
7614     {
7615         ClientVertexArrayType arrayPacked = PackParam<ClientVertexArrayType>(array);
7616         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7617         bool isCallValid                                      = (context->skipValidation() ||
7618                             ValidateDisableClientState(
7619                                 context, angle::EntryPoint::GLDisableClientState, arrayPacked));
7620         if (isCallValid)
7621         {
7622             context->disableClientState(arrayPacked);
7623         }
7624         ANGLE_CAPTURE(DisableClientState, isCallValid, context, arrayPacked);
7625     }
7626     else
7627     {
7628         GenerateContextLostErrorOnCurrentGlobalContext();
7629     }
7630 }
7631 
GL_DrawArrays(GLenum mode,GLint first,GLsizei count)7632 void GL_APIENTRY GL_DrawArrays(GLenum mode, GLint first, GLsizei count)
7633 {
7634     Context *context = GetValidGlobalContext();
7635     EVENT(context, GLDrawArrays, "context = %d, mode = %s, first = %d, count = %d", CID(context),
7636           GLenumToString(GLenumGroup::PrimitiveType, mode), first, count);
7637 
7638     if (context)
7639     {
7640         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
7641         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7642         bool isCallValid                                      = (context->skipValidation() ||
7643                             ValidateDrawArrays(context, angle::EntryPoint::GLDrawArrays, modePacked,
7644                                                first, count));
7645         if (isCallValid)
7646         {
7647             context->drawArrays(modePacked, first, count);
7648         }
7649         ANGLE_CAPTURE(DrawArrays, isCallValid, context, modePacked, first, count);
7650     }
7651     else
7652     {
7653         GenerateContextLostErrorOnCurrentGlobalContext();
7654     }
7655 }
7656 
GL_DrawElements(GLenum mode,GLsizei count,GLenum type,const void * indices)7657 void GL_APIENTRY GL_DrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices)
7658 {
7659     Context *context = GetValidGlobalContext();
7660     EVENT(context, GLDrawElements,
7661           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR "",
7662           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), count,
7663           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices);
7664 
7665     if (context)
7666     {
7667         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
7668         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
7669         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7670         bool isCallValid                                      = (context->skipValidation() ||
7671                             ValidateDrawElements(context, angle::EntryPoint::GLDrawElements,
7672                                                  modePacked, count, typePacked, indices));
7673         if (isCallValid)
7674         {
7675             context->drawElements(modePacked, count, typePacked, indices);
7676         }
7677         ANGLE_CAPTURE(DrawElements, isCallValid, context, modePacked, count, typePacked, indices);
7678     }
7679     else
7680     {
7681         GenerateContextLostErrorOnCurrentGlobalContext();
7682     }
7683 }
7684 
GL_EdgeFlagPointer(GLsizei stride,const void * pointer)7685 void GL_APIENTRY GL_EdgeFlagPointer(GLsizei stride, const void *pointer)
7686 {
7687     Context *context = GetValidGlobalContext();
7688     EVENT(context, GLEdgeFlagPointer, "context = %d, stride = %d, pointer = 0x%016" PRIxPTR "",
7689           CID(context), stride, (uintptr_t)pointer);
7690 
7691     if (context)
7692     {
7693         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7694         bool isCallValid                                      = (context->skipValidation() ||
7695                             ValidateEdgeFlagPointer(context, angle::EntryPoint::GLEdgeFlagPointer,
7696                                                     stride, pointer));
7697         if (isCallValid)
7698         {
7699             context->edgeFlagPointer(stride, pointer);
7700         }
7701         ANGLE_CAPTURE(EdgeFlagPointer, isCallValid, context, stride, pointer);
7702     }
7703     else
7704     {
7705         GenerateContextLostErrorOnCurrentGlobalContext();
7706     }
7707 }
7708 
GL_EnableClientState(GLenum array)7709 void GL_APIENTRY GL_EnableClientState(GLenum array)
7710 {
7711     Context *context = GetValidGlobalContext();
7712     EVENT(context, GLEnableClientState, "context = %d, array = %s", CID(context),
7713           GLenumToString(GLenumGroup::EnableCap, array));
7714 
7715     if (context)
7716     {
7717         ClientVertexArrayType arrayPacked = PackParam<ClientVertexArrayType>(array);
7718         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7719         bool isCallValid                                      = (context->skipValidation() ||
7720                             ValidateEnableClientState(
7721                                 context, angle::EntryPoint::GLEnableClientState, arrayPacked));
7722         if (isCallValid)
7723         {
7724             context->enableClientState(arrayPacked);
7725         }
7726         ANGLE_CAPTURE(EnableClientState, isCallValid, context, arrayPacked);
7727     }
7728     else
7729     {
7730         GenerateContextLostErrorOnCurrentGlobalContext();
7731     }
7732 }
7733 
GL_GenTextures(GLsizei n,GLuint * textures)7734 void GL_APIENTRY GL_GenTextures(GLsizei n, GLuint *textures)
7735 {
7736     Context *context = GetValidGlobalContext();
7737     EVENT(context, GLGenTextures, "context = %d, n = %d, textures = 0x%016" PRIxPTR "",
7738           CID(context), n, (uintptr_t)textures);
7739 
7740     if (context)
7741     {
7742         TextureID *texturesPacked                             = PackParam<TextureID *>(textures);
7743         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7744         bool isCallValid =
7745             (context->skipValidation() ||
7746              ValidateGenTextures(context, angle::EntryPoint::GLGenTextures, n, texturesPacked));
7747         if (isCallValid)
7748         {
7749             context->genTextures(n, texturesPacked);
7750         }
7751         ANGLE_CAPTURE(GenTextures, isCallValid, context, n, texturesPacked);
7752     }
7753     else
7754     {
7755         GenerateContextLostErrorOnCurrentGlobalContext();
7756     }
7757 }
7758 
GL_GetPointerv(GLenum pname,void ** params)7759 void GL_APIENTRY GL_GetPointerv(GLenum pname, void **params)
7760 {
7761     Context *context = GetValidGlobalContext();
7762     EVENT(context, GLGetPointerv, "context = %d, pname = %s, params = 0x%016" PRIxPTR "",
7763           CID(context), GLenumToString(GLenumGroup::GetPointervPName, pname), (uintptr_t)params);
7764 
7765     if (context)
7766     {
7767         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7768         bool isCallValid =
7769             (context->skipValidation() ||
7770              ValidateGetPointerv(context, angle::EntryPoint::GLGetPointerv, pname, params));
7771         if (isCallValid)
7772         {
7773             context->getPointerv(pname, params);
7774         }
7775         ANGLE_CAPTURE(GetPointerv, isCallValid, context, pname, params);
7776     }
7777     else
7778     {
7779         GenerateContextLostErrorOnCurrentGlobalContext();
7780     }
7781 }
7782 
GL_IndexPointer(GLenum type,GLsizei stride,const void * pointer)7783 void GL_APIENTRY GL_IndexPointer(GLenum type, GLsizei stride, const void *pointer)
7784 {
7785     Context *context = GetValidGlobalContext();
7786     EVENT(context, GLIndexPointer,
7787           "context = %d, type = %s, stride = %d, pointer = 0x%016" PRIxPTR "", CID(context),
7788           GLenumToString(GLenumGroup::IndexPointerType, type), stride, (uintptr_t)pointer);
7789 
7790     if (context)
7791     {
7792         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7793         bool isCallValid                                      = (context->skipValidation() ||
7794                             ValidateIndexPointer(context, angle::EntryPoint::GLIndexPointer, type,
7795                                                  stride, pointer));
7796         if (isCallValid)
7797         {
7798             context->indexPointer(type, stride, pointer);
7799         }
7800         ANGLE_CAPTURE(IndexPointer, isCallValid, context, type, stride, pointer);
7801     }
7802     else
7803     {
7804         GenerateContextLostErrorOnCurrentGlobalContext();
7805     }
7806 }
7807 
GL_Indexub(GLubyte c)7808 void GL_APIENTRY GL_Indexub(GLubyte c)
7809 {
7810     Context *context = GetValidGlobalContext();
7811     EVENT(context, GLIndexub, "context = %d, c = %d", CID(context), c);
7812 
7813     if (context)
7814     {
7815         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7816         bool isCallValid                                      = (context->skipValidation() ||
7817                             ValidateIndexub(context, angle::EntryPoint::GLIndexub, c));
7818         if (isCallValid)
7819         {
7820             context->indexub(c);
7821         }
7822         ANGLE_CAPTURE(Indexub, isCallValid, context, c);
7823     }
7824     else
7825     {
7826         GenerateContextLostErrorOnCurrentGlobalContext();
7827     }
7828 }
7829 
GL_Indexubv(const GLubyte * c)7830 void GL_APIENTRY GL_Indexubv(const GLubyte *c)
7831 {
7832     Context *context = GetValidGlobalContext();
7833     EVENT(context, GLIndexubv, "context = %d, c = 0x%016" PRIxPTR "", CID(context), (uintptr_t)c);
7834 
7835     if (context)
7836     {
7837         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7838         bool isCallValid                                      = (context->skipValidation() ||
7839                             ValidateIndexubv(context, angle::EntryPoint::GLIndexubv, c));
7840         if (isCallValid)
7841         {
7842             context->indexubv(c);
7843         }
7844         ANGLE_CAPTURE(Indexubv, isCallValid, context, c);
7845     }
7846     else
7847     {
7848         GenerateContextLostErrorOnCurrentGlobalContext();
7849     }
7850 }
7851 
GL_InterleavedArrays(GLenum format,GLsizei stride,const void * pointer)7852 void GL_APIENTRY GL_InterleavedArrays(GLenum format, GLsizei stride, const void *pointer)
7853 {
7854     Context *context = GetValidGlobalContext();
7855     EVENT(context, GLInterleavedArrays,
7856           "context = %d, format = %s, stride = %d, pointer = 0x%016" PRIxPTR "", CID(context),
7857           GLenumToString(GLenumGroup::InterleavedArrayFormat, format), stride, (uintptr_t)pointer);
7858 
7859     if (context)
7860     {
7861         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7862         bool isCallValid =
7863             (context->skipValidation() ||
7864              ValidateInterleavedArrays(context, angle::EntryPoint::GLInterleavedArrays, format,
7865                                        stride, pointer));
7866         if (isCallValid)
7867         {
7868             context->interleavedArrays(format, stride, pointer);
7869         }
7870         ANGLE_CAPTURE(InterleavedArrays, isCallValid, context, format, stride, pointer);
7871     }
7872     else
7873     {
7874         GenerateContextLostErrorOnCurrentGlobalContext();
7875     }
7876 }
7877 
GL_IsTexture(GLuint texture)7878 GLboolean GL_APIENTRY GL_IsTexture(GLuint texture)
7879 {
7880     Context *context = GetValidGlobalContext();
7881     EVENT(context, GLIsTexture, "context = %d, texture = %u", CID(context), texture);
7882 
7883     GLboolean returnValue;
7884     if (context)
7885     {
7886         TextureID texturePacked                               = PackParam<TextureID>(texture);
7887         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7888         bool isCallValid =
7889             (context->skipValidation() ||
7890              ValidateIsTexture(context, angle::EntryPoint::GLIsTexture, texturePacked));
7891         if (isCallValid)
7892         {
7893             returnValue = context->isTexture(texturePacked);
7894         }
7895         else
7896         {
7897             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsTexture, GLboolean>();
7898         }
7899         ANGLE_CAPTURE(IsTexture, isCallValid, context, texturePacked, returnValue);
7900     }
7901     else
7902     {
7903         GenerateContextLostErrorOnCurrentGlobalContext();
7904         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsTexture, GLboolean>();
7905     }
7906     return returnValue;
7907 }
7908 
GL_NormalPointer(GLenum type,GLsizei stride,const void * pointer)7909 void GL_APIENTRY GL_NormalPointer(GLenum type, GLsizei stride, const void *pointer)
7910 {
7911     Context *context = GetValidGlobalContext();
7912     EVENT(context, GLNormalPointer,
7913           "context = %d, type = %s, stride = %d, pointer = 0x%016" PRIxPTR "", CID(context),
7914           GLenumToString(GLenumGroup::NormalPointerType, type), stride, (uintptr_t)pointer);
7915 
7916     if (context)
7917     {
7918         VertexAttribType typePacked                           = PackParam<VertexAttribType>(type);
7919         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7920         bool isCallValid                                      = (context->skipValidation() ||
7921                             ValidateNormalPointer(context, angle::EntryPoint::GLNormalPointer,
7922                                                   typePacked, stride, pointer));
7923         if (isCallValid)
7924         {
7925             context->normalPointer(typePacked, stride, pointer);
7926         }
7927         ANGLE_CAPTURE(NormalPointer, isCallValid, context, typePacked, stride, pointer);
7928     }
7929     else
7930     {
7931         GenerateContextLostErrorOnCurrentGlobalContext();
7932     }
7933 }
7934 
GL_PolygonOffset(GLfloat factor,GLfloat units)7935 void GL_APIENTRY GL_PolygonOffset(GLfloat factor, GLfloat units)
7936 {
7937     Context *context = GetValidGlobalContext();
7938     EVENT(context, GLPolygonOffset, "context = %d, factor = %f, units = %f", CID(context), factor,
7939           units);
7940 
7941     if (context)
7942     {
7943         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7944         bool isCallValid =
7945             (context->skipValidation() ||
7946              ValidatePolygonOffset(context, angle::EntryPoint::GLPolygonOffset, factor, units));
7947         if (isCallValid)
7948         {
7949             context->polygonOffset(factor, units);
7950         }
7951         ANGLE_CAPTURE(PolygonOffset, isCallValid, context, factor, units);
7952     }
7953     else
7954     {
7955         GenerateContextLostErrorOnCurrentGlobalContext();
7956     }
7957 }
7958 
GL_PopClientAttrib()7959 void GL_APIENTRY GL_PopClientAttrib()
7960 {
7961     Context *context = GetValidGlobalContext();
7962     EVENT(context, GLPopClientAttrib, "context = %d", CID(context));
7963 
7964     if (context)
7965     {
7966         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7967         bool isCallValid                                      = (context->skipValidation() ||
7968                             ValidatePopClientAttrib(context, angle::EntryPoint::GLPopClientAttrib));
7969         if (isCallValid)
7970         {
7971             context->popClientAttrib();
7972         }
7973         ANGLE_CAPTURE(PopClientAttrib, isCallValid, context);
7974     }
7975     else
7976     {
7977         GenerateContextLostErrorOnCurrentGlobalContext();
7978     }
7979 }
7980 
GL_PrioritizeTextures(GLsizei n,const GLuint * textures,const GLfloat * priorities)7981 void GL_APIENTRY GL_PrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities)
7982 {
7983     Context *context = GetValidGlobalContext();
7984     EVENT(context, GLPrioritizeTextures,
7985           "context = %d, n = %d, textures = 0x%016" PRIxPTR ", priorities = 0x%016" PRIxPTR "",
7986           CID(context), n, (uintptr_t)textures, (uintptr_t)priorities);
7987 
7988     if (context)
7989     {
7990         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7991         bool isCallValid =
7992             (context->skipValidation() ||
7993              ValidatePrioritizeTextures(context, angle::EntryPoint::GLPrioritizeTextures, n,
7994                                         textures, priorities));
7995         if (isCallValid)
7996         {
7997             context->prioritizeTextures(n, textures, priorities);
7998         }
7999         ANGLE_CAPTURE(PrioritizeTextures, isCallValid, context, n, textures, priorities);
8000     }
8001     else
8002     {
8003         GenerateContextLostErrorOnCurrentGlobalContext();
8004     }
8005 }
8006 
GL_PushClientAttrib(GLbitfield mask)8007 void GL_APIENTRY GL_PushClientAttrib(GLbitfield mask)
8008 {
8009     Context *context = GetValidGlobalContext();
8010     EVENT(context, GLPushClientAttrib, "context = %d, mask = %s", CID(context),
8011           GLbitfieldToString(GLenumGroup::ClientAttribMask, mask).c_str());
8012 
8013     if (context)
8014     {
8015         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8016         bool isCallValid =
8017             (context->skipValidation() ||
8018              ValidatePushClientAttrib(context, angle::EntryPoint::GLPushClientAttrib, mask));
8019         if (isCallValid)
8020         {
8021             context->pushClientAttrib(mask);
8022         }
8023         ANGLE_CAPTURE(PushClientAttrib, isCallValid, context, mask);
8024     }
8025     else
8026     {
8027         GenerateContextLostErrorOnCurrentGlobalContext();
8028     }
8029 }
8030 
GL_TexCoordPointer(GLint size,GLenum type,GLsizei stride,const void * pointer)8031 void GL_APIENTRY GL_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
8032 {
8033     Context *context = GetValidGlobalContext();
8034     EVENT(context, GLTexCoordPointer,
8035           "context = %d, size = %d, type = %s, stride = %d, pointer = 0x%016" PRIxPTR "",
8036           CID(context), size, GLenumToString(GLenumGroup::TexCoordPointerType, type), stride,
8037           (uintptr_t)pointer);
8038 
8039     if (context)
8040     {
8041         VertexAttribType typePacked                           = PackParam<VertexAttribType>(type);
8042         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8043         bool isCallValid                                      = (context->skipValidation() ||
8044                             ValidateTexCoordPointer(context, angle::EntryPoint::GLTexCoordPointer,
8045                                                     size, typePacked, stride, pointer));
8046         if (isCallValid)
8047         {
8048             context->texCoordPointer(size, typePacked, stride, pointer);
8049         }
8050         ANGLE_CAPTURE(TexCoordPointer, isCallValid, context, size, typePacked, stride, pointer);
8051     }
8052     else
8053     {
8054         GenerateContextLostErrorOnCurrentGlobalContext();
8055     }
8056 }
8057 
GL_TexSubImage1D(GLenum target,GLint level,GLint xoffset,GLsizei width,GLenum format,GLenum type,const void * pixels)8058 void GL_APIENTRY GL_TexSubImage1D(GLenum target,
8059                                   GLint level,
8060                                   GLint xoffset,
8061                                   GLsizei width,
8062                                   GLenum format,
8063                                   GLenum type,
8064                                   const void *pixels)
8065 {
8066     Context *context = GetValidGlobalContext();
8067     EVENT(context, GLTexSubImage1D,
8068           "context = %d, target = %s, level = %d, xoffset = %d, width = %d, format = %s, type = "
8069           "%s, pixels = 0x%016" PRIxPTR "",
8070           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, xoffset, width,
8071           GLenumToString(GLenumGroup::PixelFormat, format),
8072           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
8073 
8074     if (context)
8075     {
8076         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8077         bool isCallValid =
8078             (context->skipValidation() ||
8079              ValidateTexSubImage1D(context, angle::EntryPoint::GLTexSubImage1D, target, level,
8080                                    xoffset, width, format, type, pixels));
8081         if (isCallValid)
8082         {
8083             context->texSubImage1D(target, level, xoffset, width, format, type, pixels);
8084         }
8085         ANGLE_CAPTURE(TexSubImage1D, isCallValid, context, target, level, xoffset, width, format,
8086                       type, pixels);
8087     }
8088     else
8089     {
8090         GenerateContextLostErrorOnCurrentGlobalContext();
8091     }
8092 }
8093 
GL_TexSubImage2D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLenum type,const void * pixels)8094 void GL_APIENTRY GL_TexSubImage2D(GLenum target,
8095                                   GLint level,
8096                                   GLint xoffset,
8097                                   GLint yoffset,
8098                                   GLsizei width,
8099                                   GLsizei height,
8100                                   GLenum format,
8101                                   GLenum type,
8102                                   const void *pixels)
8103 {
8104     Context *context = GetValidGlobalContext();
8105     EVENT(context, GLTexSubImage2D,
8106           "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, width = %d, height = "
8107           "%d, format = %s, type = %s, pixels = 0x%016" PRIxPTR "",
8108           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, xoffset, yoffset,
8109           width, height, GLenumToString(GLenumGroup::PixelFormat, format),
8110           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
8111 
8112     if (context)
8113     {
8114         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
8115         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8116         bool isCallValid =
8117             (context->skipValidation() ||
8118              ValidateTexSubImage2D(context, angle::EntryPoint::GLTexSubImage2D, targetPacked, level,
8119                                    xoffset, yoffset, width, height, format, type, pixels));
8120         if (isCallValid)
8121         {
8122             context->texSubImage2D(targetPacked, level, xoffset, yoffset, width, height, format,
8123                                    type, pixels);
8124         }
8125         ANGLE_CAPTURE(TexSubImage2D, isCallValid, context, targetPacked, level, xoffset, yoffset,
8126                       width, height, format, type, pixels);
8127     }
8128     else
8129     {
8130         GenerateContextLostErrorOnCurrentGlobalContext();
8131     }
8132 }
8133 
GL_VertexPointer(GLint size,GLenum type,GLsizei stride,const void * pointer)8134 void GL_APIENTRY GL_VertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
8135 {
8136     Context *context = GetValidGlobalContext();
8137     EVENT(context, GLVertexPointer,
8138           "context = %d, size = %d, type = %s, stride = %d, pointer = 0x%016" PRIxPTR "",
8139           CID(context), size, GLenumToString(GLenumGroup::VertexPointerType, type), stride,
8140           (uintptr_t)pointer);
8141 
8142     if (context)
8143     {
8144         VertexAttribType typePacked                           = PackParam<VertexAttribType>(type);
8145         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8146         bool isCallValid                                      = (context->skipValidation() ||
8147                             ValidateVertexPointer(context, angle::EntryPoint::GLVertexPointer, size,
8148                                                   typePacked, stride, pointer));
8149         if (isCallValid)
8150         {
8151             context->vertexPointer(size, typePacked, stride, pointer);
8152         }
8153         ANGLE_CAPTURE(VertexPointer, isCallValid, context, size, typePacked, stride, pointer);
8154     }
8155     else
8156     {
8157         GenerateContextLostErrorOnCurrentGlobalContext();
8158     }
8159 }
8160 
8161 // GL 1.2
GL_CopyTexSubImage3D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLint x,GLint y,GLsizei width,GLsizei height)8162 void GL_APIENTRY GL_CopyTexSubImage3D(GLenum target,
8163                                       GLint level,
8164                                       GLint xoffset,
8165                                       GLint yoffset,
8166                                       GLint zoffset,
8167                                       GLint x,
8168                                       GLint y,
8169                                       GLsizei width,
8170                                       GLsizei height)
8171 {
8172     Context *context = GetValidGlobalContext();
8173     EVENT(context, GLCopyTexSubImage3D,
8174           "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, x = "
8175           "%d, y = %d, width = %d, height = %d",
8176           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, xoffset, yoffset,
8177           zoffset, x, y, width, height);
8178 
8179     if (context)
8180     {
8181         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
8182         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8183         bool isCallValid                                      = (context->skipValidation() ||
8184                             ValidateCopyTexSubImage3D(
8185                                 context, angle::EntryPoint::GLCopyTexSubImage3D, targetPacked,
8186                                 level, xoffset, yoffset, zoffset, x, y, width, height));
8187         if (isCallValid)
8188         {
8189             context->copyTexSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, x, y, width,
8190                                        height);
8191         }
8192         ANGLE_CAPTURE(CopyTexSubImage3D, isCallValid, context, targetPacked, level, xoffset,
8193                       yoffset, zoffset, x, y, width, height);
8194     }
8195     else
8196     {
8197         GenerateContextLostErrorOnCurrentGlobalContext();
8198     }
8199 }
8200 
GL_DrawRangeElements(GLenum mode,GLuint start,GLuint end,GLsizei count,GLenum type,const void * indices)8201 void GL_APIENTRY GL_DrawRangeElements(GLenum mode,
8202                                       GLuint start,
8203                                       GLuint end,
8204                                       GLsizei count,
8205                                       GLenum type,
8206                                       const void *indices)
8207 {
8208     Context *context = GetValidGlobalContext();
8209     EVENT(context, GLDrawRangeElements,
8210           "context = %d, mode = %s, start = %u, end = %u, count = %d, type = %s, indices = "
8211           "0x%016" PRIxPTR "",
8212           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), start, end, count,
8213           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices);
8214 
8215     if (context)
8216     {
8217         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
8218         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
8219         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8220         bool isCallValid =
8221             (context->skipValidation() ||
8222              ValidateDrawRangeElements(context, angle::EntryPoint::GLDrawRangeElements, modePacked,
8223                                        start, end, count, typePacked, indices));
8224         if (isCallValid)
8225         {
8226             context->drawRangeElements(modePacked, start, end, count, typePacked, indices);
8227         }
8228         ANGLE_CAPTURE(DrawRangeElements, isCallValid, context, modePacked, start, end, count,
8229                       typePacked, indices);
8230     }
8231     else
8232     {
8233         GenerateContextLostErrorOnCurrentGlobalContext();
8234     }
8235 }
8236 
GL_TexImage3D(GLenum target,GLint level,GLint internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLenum format,GLenum type,const void * pixels)8237 void GL_APIENTRY GL_TexImage3D(GLenum target,
8238                                GLint level,
8239                                GLint internalformat,
8240                                GLsizei width,
8241                                GLsizei height,
8242                                GLsizei depth,
8243                                GLint border,
8244                                GLenum format,
8245                                GLenum type,
8246                                const void *pixels)
8247 {
8248     Context *context = GetValidGlobalContext();
8249     EVENT(context, GLTexImage3D,
8250           "context = %d, target = %s, level = %d, internalformat = %d, width = %d, height = %d, "
8251           "depth = %d, border = %d, format = %s, type = %s, pixels = 0x%016" PRIxPTR "",
8252           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, internalformat,
8253           width, height, depth, border, GLenumToString(GLenumGroup::PixelFormat, format),
8254           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
8255 
8256     if (context)
8257     {
8258         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
8259         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8260         bool isCallValid                                      = (context->skipValidation() ||
8261                             ValidateTexImage3D(context, angle::EntryPoint::GLTexImage3D,
8262                                                targetPacked, level, internalformat, width, height,
8263                                                depth, border, format, type, pixels));
8264         if (isCallValid)
8265         {
8266             context->texImage3D(targetPacked, level, internalformat, width, height, depth, border,
8267                                 format, type, pixels);
8268         }
8269         ANGLE_CAPTURE(TexImage3D, isCallValid, context, targetPacked, level, internalformat, width,
8270                       height, depth, border, format, type, pixels);
8271     }
8272     else
8273     {
8274         GenerateContextLostErrorOnCurrentGlobalContext();
8275     }
8276 }
8277 
GL_TexSubImage3D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLenum type,const void * pixels)8278 void GL_APIENTRY GL_TexSubImage3D(GLenum target,
8279                                   GLint level,
8280                                   GLint xoffset,
8281                                   GLint yoffset,
8282                                   GLint zoffset,
8283                                   GLsizei width,
8284                                   GLsizei height,
8285                                   GLsizei depth,
8286                                   GLenum format,
8287                                   GLenum type,
8288                                   const void *pixels)
8289 {
8290     Context *context = GetValidGlobalContext();
8291     EVENT(context, GLTexSubImage3D,
8292           "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width "
8293           "= %d, height = %d, depth = %d, format = %s, type = %s, pixels = 0x%016" PRIxPTR "",
8294           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, xoffset, yoffset,
8295           zoffset, width, height, depth, GLenumToString(GLenumGroup::PixelFormat, format),
8296           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
8297 
8298     if (context)
8299     {
8300         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
8301         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8302         bool isCallValid                                      = (context->skipValidation() ||
8303                             ValidateTexSubImage3D(context, angle::EntryPoint::GLTexSubImage3D,
8304                                                   targetPacked, level, xoffset, yoffset, zoffset,
8305                                                   width, height, depth, format, type, pixels));
8306         if (isCallValid)
8307         {
8308             context->texSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, width, height,
8309                                    depth, format, type, pixels);
8310         }
8311         ANGLE_CAPTURE(TexSubImage3D, isCallValid, context, targetPacked, level, xoffset, yoffset,
8312                       zoffset, width, height, depth, format, type, pixels);
8313     }
8314     else
8315     {
8316         GenerateContextLostErrorOnCurrentGlobalContext();
8317     }
8318 }
8319 
8320 // GL 1.3
GL_ActiveTexture(GLenum texture)8321 void GL_APIENTRY GL_ActiveTexture(GLenum texture)
8322 {
8323     Context *context = GetValidGlobalContext();
8324     EVENT(context, GLActiveTexture, "context = %d, texture = %s", CID(context),
8325           GLenumToString(GLenumGroup::TextureUnit, texture));
8326 
8327     if (context)
8328     {
8329         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8330         bool isCallValid =
8331             (context->skipValidation() ||
8332              ValidateActiveTexture(context, angle::EntryPoint::GLActiveTexture, texture));
8333         if (isCallValid)
8334         {
8335             context->activeTexture(texture);
8336         }
8337         ANGLE_CAPTURE(ActiveTexture, isCallValid, context, texture);
8338     }
8339     else
8340     {
8341         GenerateContextLostErrorOnCurrentGlobalContext();
8342     }
8343 }
8344 
GL_ClientActiveTexture(GLenum texture)8345 void GL_APIENTRY GL_ClientActiveTexture(GLenum texture)
8346 {
8347     Context *context = GetValidGlobalContext();
8348     EVENT(context, GLClientActiveTexture, "context = %d, texture = %s", CID(context),
8349           GLenumToString(GLenumGroup::TextureUnit, texture));
8350 
8351     if (context)
8352     {
8353         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8354         bool isCallValid                                      = (context->skipValidation() ||
8355                             ValidateClientActiveTexture(
8356                                 context, angle::EntryPoint::GLClientActiveTexture, texture));
8357         if (isCallValid)
8358         {
8359             context->clientActiveTexture(texture);
8360         }
8361         ANGLE_CAPTURE(ClientActiveTexture, isCallValid, context, texture);
8362     }
8363     else
8364     {
8365         GenerateContextLostErrorOnCurrentGlobalContext();
8366     }
8367 }
8368 
GL_CompressedTexImage1D(GLenum target,GLint level,GLenum internalformat,GLsizei width,GLint border,GLsizei imageSize,const void * data)8369 void GL_APIENTRY GL_CompressedTexImage1D(GLenum target,
8370                                          GLint level,
8371                                          GLenum internalformat,
8372                                          GLsizei width,
8373                                          GLint border,
8374                                          GLsizei imageSize,
8375                                          const void *data)
8376 {
8377     Context *context = GetValidGlobalContext();
8378     EVENT(context, GLCompressedTexImage1D,
8379           "context = %d, target = %s, level = %d, internalformat = %s, width = %d, border = %d, "
8380           "imageSize = %d, data = 0x%016" PRIxPTR "",
8381           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level,
8382           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, border, imageSize,
8383           (uintptr_t)data);
8384 
8385     if (context)
8386     {
8387         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8388         bool isCallValid                                      = (context->skipValidation() ||
8389                             ValidateCompressedTexImage1D(
8390                                 context, angle::EntryPoint::GLCompressedTexImage1D, target, level,
8391                                 internalformat, width, border, imageSize, data));
8392         if (isCallValid)
8393         {
8394             context->compressedTexImage1D(target, level, internalformat, width, border, imageSize,
8395                                           data);
8396         }
8397         ANGLE_CAPTURE(CompressedTexImage1D, isCallValid, context, target, level, internalformat,
8398                       width, border, imageSize, data);
8399     }
8400     else
8401     {
8402         GenerateContextLostErrorOnCurrentGlobalContext();
8403     }
8404 }
8405 
GL_CompressedTexImage2D(GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLint border,GLsizei imageSize,const void * data)8406 void GL_APIENTRY GL_CompressedTexImage2D(GLenum target,
8407                                          GLint level,
8408                                          GLenum internalformat,
8409                                          GLsizei width,
8410                                          GLsizei height,
8411                                          GLint border,
8412                                          GLsizei imageSize,
8413                                          const void *data)
8414 {
8415     Context *context = GetValidGlobalContext();
8416     EVENT(context, GLCompressedTexImage2D,
8417           "context = %d, target = %s, level = %d, internalformat = %s, width = %d, height = %d, "
8418           "border = %d, imageSize = %d, data = 0x%016" PRIxPTR "",
8419           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level,
8420           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height, border,
8421           imageSize, (uintptr_t)data);
8422 
8423     if (context)
8424     {
8425         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
8426         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8427         bool isCallValid                                      = (context->skipValidation() ||
8428                             ValidateCompressedTexImage2D(
8429                                 context, angle::EntryPoint::GLCompressedTexImage2D, targetPacked,
8430                                 level, internalformat, width, height, border, imageSize, data));
8431         if (isCallValid)
8432         {
8433             context->compressedTexImage2D(targetPacked, level, internalformat, width, height,
8434                                           border, imageSize, data);
8435         }
8436         ANGLE_CAPTURE(CompressedTexImage2D, isCallValid, context, targetPacked, level,
8437                       internalformat, width, height, border, imageSize, data);
8438     }
8439     else
8440     {
8441         GenerateContextLostErrorOnCurrentGlobalContext();
8442     }
8443 }
8444 
GL_CompressedTexImage3D(GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLsizei imageSize,const void * data)8445 void GL_APIENTRY GL_CompressedTexImage3D(GLenum target,
8446                                          GLint level,
8447                                          GLenum internalformat,
8448                                          GLsizei width,
8449                                          GLsizei height,
8450                                          GLsizei depth,
8451                                          GLint border,
8452                                          GLsizei imageSize,
8453                                          const void *data)
8454 {
8455     Context *context = GetValidGlobalContext();
8456     EVENT(context, GLCompressedTexImage3D,
8457           "context = %d, target = %s, level = %d, internalformat = %s, width = %d, height = %d, "
8458           "depth = %d, border = %d, imageSize = %d, data = 0x%016" PRIxPTR "",
8459           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level,
8460           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height, depth, border,
8461           imageSize, (uintptr_t)data);
8462 
8463     if (context)
8464     {
8465         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
8466         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8467         bool isCallValid =
8468             (context->skipValidation() ||
8469              ValidateCompressedTexImage3D(context, angle::EntryPoint::GLCompressedTexImage3D,
8470                                           targetPacked, level, internalformat, width, height, depth,
8471                                           border, imageSize, data));
8472         if (isCallValid)
8473         {
8474             context->compressedTexImage3D(targetPacked, level, internalformat, width, height, depth,
8475                                           border, imageSize, data);
8476         }
8477         ANGLE_CAPTURE(CompressedTexImage3D, isCallValid, context, targetPacked, level,
8478                       internalformat, width, height, depth, border, imageSize, data);
8479     }
8480     else
8481     {
8482         GenerateContextLostErrorOnCurrentGlobalContext();
8483     }
8484 }
8485 
GL_CompressedTexSubImage1D(GLenum target,GLint level,GLint xoffset,GLsizei width,GLenum format,GLsizei imageSize,const void * data)8486 void GL_APIENTRY GL_CompressedTexSubImage1D(GLenum target,
8487                                             GLint level,
8488                                             GLint xoffset,
8489                                             GLsizei width,
8490                                             GLenum format,
8491                                             GLsizei imageSize,
8492                                             const void *data)
8493 {
8494     Context *context = GetValidGlobalContext();
8495     EVENT(context, GLCompressedTexSubImage1D,
8496           "context = %d, target = %s, level = %d, xoffset = %d, width = %d, format = %s, imageSize "
8497           "= %d, data = 0x%016" PRIxPTR "",
8498           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, xoffset, width,
8499           GLenumToString(GLenumGroup::PixelFormat, format), imageSize, (uintptr_t)data);
8500 
8501     if (context)
8502     {
8503         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8504         bool isCallValid                                      = (context->skipValidation() ||
8505                             ValidateCompressedTexSubImage1D(
8506                                 context, angle::EntryPoint::GLCompressedTexSubImage1D, target,
8507                                 level, xoffset, width, format, imageSize, data));
8508         if (isCallValid)
8509         {
8510             context->compressedTexSubImage1D(target, level, xoffset, width, format, imageSize,
8511                                              data);
8512         }
8513         ANGLE_CAPTURE(CompressedTexSubImage1D, isCallValid, context, target, level, xoffset, width,
8514                       format, imageSize, data);
8515     }
8516     else
8517     {
8518         GenerateContextLostErrorOnCurrentGlobalContext();
8519     }
8520 }
8521 
GL_CompressedTexSubImage2D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLsizei imageSize,const void * data)8522 void GL_APIENTRY GL_CompressedTexSubImage2D(GLenum target,
8523                                             GLint level,
8524                                             GLint xoffset,
8525                                             GLint yoffset,
8526                                             GLsizei width,
8527                                             GLsizei height,
8528                                             GLenum format,
8529                                             GLsizei imageSize,
8530                                             const void *data)
8531 {
8532     Context *context = GetValidGlobalContext();
8533     EVENT(context, GLCompressedTexSubImage2D,
8534           "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, width = %d, height = "
8535           "%d, format = %s, imageSize = %d, data = 0x%016" PRIxPTR "",
8536           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, xoffset, yoffset,
8537           width, height, GLenumToString(GLenumGroup::PixelFormat, format), imageSize,
8538           (uintptr_t)data);
8539 
8540     if (context)
8541     {
8542         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
8543         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8544         bool isCallValid                                      = (context->skipValidation() ||
8545                             ValidateCompressedTexSubImage2D(
8546                                 context, angle::EntryPoint::GLCompressedTexSubImage2D, targetPacked,
8547                                 level, xoffset, yoffset, width, height, format, imageSize, data));
8548         if (isCallValid)
8549         {
8550             context->compressedTexSubImage2D(targetPacked, level, xoffset, yoffset, width, height,
8551                                              format, imageSize, data);
8552         }
8553         ANGLE_CAPTURE(CompressedTexSubImage2D, isCallValid, context, targetPacked, level, xoffset,
8554                       yoffset, width, height, format, imageSize, data);
8555     }
8556     else
8557     {
8558         GenerateContextLostErrorOnCurrentGlobalContext();
8559     }
8560 }
8561 
GL_CompressedTexSubImage3D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLsizei imageSize,const void * data)8562 void GL_APIENTRY GL_CompressedTexSubImage3D(GLenum target,
8563                                             GLint level,
8564                                             GLint xoffset,
8565                                             GLint yoffset,
8566                                             GLint zoffset,
8567                                             GLsizei width,
8568                                             GLsizei height,
8569                                             GLsizei depth,
8570                                             GLenum format,
8571                                             GLsizei imageSize,
8572                                             const void *data)
8573 {
8574     Context *context = GetValidGlobalContext();
8575     EVENT(context, GLCompressedTexSubImage3D,
8576           "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width "
8577           "= %d, height = %d, depth = %d, format = %s, imageSize = %d, data = 0x%016" PRIxPTR "",
8578           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, xoffset, yoffset,
8579           zoffset, width, height, depth, GLenumToString(GLenumGroup::PixelFormat, format),
8580           imageSize, (uintptr_t)data);
8581 
8582     if (context)
8583     {
8584         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
8585         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8586         bool isCallValid =
8587             (context->skipValidation() ||
8588              ValidateCompressedTexSubImage3D(context, angle::EntryPoint::GLCompressedTexSubImage3D,
8589                                              targetPacked, level, xoffset, yoffset, zoffset, width,
8590                                              height, depth, format, imageSize, data));
8591         if (isCallValid)
8592         {
8593             context->compressedTexSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, width,
8594                                              height, depth, format, imageSize, data);
8595         }
8596         ANGLE_CAPTURE(CompressedTexSubImage3D, isCallValid, context, targetPacked, level, xoffset,
8597                       yoffset, zoffset, width, height, depth, format, imageSize, data);
8598     }
8599     else
8600     {
8601         GenerateContextLostErrorOnCurrentGlobalContext();
8602     }
8603 }
8604 
GL_GetCompressedTexImage(GLenum target,GLint level,void * img)8605 void GL_APIENTRY GL_GetCompressedTexImage(GLenum target, GLint level, void *img)
8606 {
8607     Context *context = GetValidGlobalContext();
8608     EVENT(context, GLGetCompressedTexImage,
8609           "context = %d, target = %s, level = %d, img = 0x%016" PRIxPTR "", CID(context),
8610           GLenumToString(GLenumGroup::TextureTarget, target), level, (uintptr_t)img);
8611 
8612     if (context)
8613     {
8614         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
8615         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8616         bool isCallValid =
8617             (context->skipValidation() ||
8618              ValidateGetCompressedTexImage(context, angle::EntryPoint::GLGetCompressedTexImage,
8619                                            targetPacked, level, img));
8620         if (isCallValid)
8621         {
8622             context->getCompressedTexImage(targetPacked, level, img);
8623         }
8624         ANGLE_CAPTURE(GetCompressedTexImage, isCallValid, context, targetPacked, level, img);
8625     }
8626     else
8627     {
8628         GenerateContextLostErrorOnCurrentGlobalContext();
8629     }
8630 }
8631 
GL_LoadTransposeMatrixd(const GLdouble * m)8632 void GL_APIENTRY GL_LoadTransposeMatrixd(const GLdouble *m)
8633 {
8634     Context *context = GetValidGlobalContext();
8635     EVENT(context, GLLoadTransposeMatrixd, "context = %d, m = 0x%016" PRIxPTR "", CID(context),
8636           (uintptr_t)m);
8637 
8638     if (context)
8639     {
8640         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8641         bool isCallValid =
8642             (context->skipValidation() ||
8643              ValidateLoadTransposeMatrixd(context, angle::EntryPoint::GLLoadTransposeMatrixd, m));
8644         if (isCallValid)
8645         {
8646             context->loadTransposeMatrixd(m);
8647         }
8648         ANGLE_CAPTURE(LoadTransposeMatrixd, isCallValid, context, m);
8649     }
8650     else
8651     {
8652         GenerateContextLostErrorOnCurrentGlobalContext();
8653     }
8654 }
8655 
GL_LoadTransposeMatrixf(const GLfloat * m)8656 void GL_APIENTRY GL_LoadTransposeMatrixf(const GLfloat *m)
8657 {
8658     Context *context = GetValidGlobalContext();
8659     EVENT(context, GLLoadTransposeMatrixf, "context = %d, m = 0x%016" PRIxPTR "", CID(context),
8660           (uintptr_t)m);
8661 
8662     if (context)
8663     {
8664         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8665         bool isCallValid =
8666             (context->skipValidation() ||
8667              ValidateLoadTransposeMatrixf(context, angle::EntryPoint::GLLoadTransposeMatrixf, m));
8668         if (isCallValid)
8669         {
8670             context->loadTransposeMatrixf(m);
8671         }
8672         ANGLE_CAPTURE(LoadTransposeMatrixf, isCallValid, context, m);
8673     }
8674     else
8675     {
8676         GenerateContextLostErrorOnCurrentGlobalContext();
8677     }
8678 }
8679 
GL_MultTransposeMatrixd(const GLdouble * m)8680 void GL_APIENTRY GL_MultTransposeMatrixd(const GLdouble *m)
8681 {
8682     Context *context = GetValidGlobalContext();
8683     EVENT(context, GLMultTransposeMatrixd, "context = %d, m = 0x%016" PRIxPTR "", CID(context),
8684           (uintptr_t)m);
8685 
8686     if (context)
8687     {
8688         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8689         bool isCallValid =
8690             (context->skipValidation() ||
8691              ValidateMultTransposeMatrixd(context, angle::EntryPoint::GLMultTransposeMatrixd, m));
8692         if (isCallValid)
8693         {
8694             context->multTransposeMatrixd(m);
8695         }
8696         ANGLE_CAPTURE(MultTransposeMatrixd, isCallValid, context, m);
8697     }
8698     else
8699     {
8700         GenerateContextLostErrorOnCurrentGlobalContext();
8701     }
8702 }
8703 
GL_MultTransposeMatrixf(const GLfloat * m)8704 void GL_APIENTRY GL_MultTransposeMatrixf(const GLfloat *m)
8705 {
8706     Context *context = GetValidGlobalContext();
8707     EVENT(context, GLMultTransposeMatrixf, "context = %d, m = 0x%016" PRIxPTR "", CID(context),
8708           (uintptr_t)m);
8709 
8710     if (context)
8711     {
8712         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8713         bool isCallValid =
8714             (context->skipValidation() ||
8715              ValidateMultTransposeMatrixf(context, angle::EntryPoint::GLMultTransposeMatrixf, m));
8716         if (isCallValid)
8717         {
8718             context->multTransposeMatrixf(m);
8719         }
8720         ANGLE_CAPTURE(MultTransposeMatrixf, isCallValid, context, m);
8721     }
8722     else
8723     {
8724         GenerateContextLostErrorOnCurrentGlobalContext();
8725     }
8726 }
8727 
GL_MultiTexCoord1d(GLenum target,GLdouble s)8728 void GL_APIENTRY GL_MultiTexCoord1d(GLenum target, GLdouble s)
8729 {
8730     Context *context = GetValidGlobalContext();
8731     EVENT(context, GLMultiTexCoord1d, "context = %d, target = %s, s = %f", CID(context),
8732           GLenumToString(GLenumGroup::TextureUnit, target), s);
8733 
8734     if (context)
8735     {
8736         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8737         bool isCallValid =
8738             (context->skipValidation() ||
8739              ValidateMultiTexCoord1d(context, angle::EntryPoint::GLMultiTexCoord1d, target, s));
8740         if (isCallValid)
8741         {
8742             context->multiTexCoord1d(target, s);
8743         }
8744         ANGLE_CAPTURE(MultiTexCoord1d, isCallValid, context, target, s);
8745     }
8746     else
8747     {
8748         GenerateContextLostErrorOnCurrentGlobalContext();
8749     }
8750 }
8751 
GL_MultiTexCoord1dv(GLenum target,const GLdouble * v)8752 void GL_APIENTRY GL_MultiTexCoord1dv(GLenum target, const GLdouble *v)
8753 {
8754     Context *context = GetValidGlobalContext();
8755     EVENT(context, GLMultiTexCoord1dv, "context = %d, target = %s, v = 0x%016" PRIxPTR "",
8756           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), (uintptr_t)v);
8757 
8758     if (context)
8759     {
8760         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8761         bool isCallValid =
8762             (context->skipValidation() ||
8763              ValidateMultiTexCoord1dv(context, angle::EntryPoint::GLMultiTexCoord1dv, target, v));
8764         if (isCallValid)
8765         {
8766             context->multiTexCoord1dv(target, v);
8767         }
8768         ANGLE_CAPTURE(MultiTexCoord1dv, isCallValid, context, target, v);
8769     }
8770     else
8771     {
8772         GenerateContextLostErrorOnCurrentGlobalContext();
8773     }
8774 }
8775 
GL_MultiTexCoord1f(GLenum target,GLfloat s)8776 void GL_APIENTRY GL_MultiTexCoord1f(GLenum target, GLfloat s)
8777 {
8778     Context *context = GetValidGlobalContext();
8779     EVENT(context, GLMultiTexCoord1f, "context = %d, target = %s, s = %f", CID(context),
8780           GLenumToString(GLenumGroup::TextureUnit, target), s);
8781 
8782     if (context)
8783     {
8784         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8785         bool isCallValid =
8786             (context->skipValidation() ||
8787              ValidateMultiTexCoord1f(context, angle::EntryPoint::GLMultiTexCoord1f, target, s));
8788         if (isCallValid)
8789         {
8790             context->multiTexCoord1f(target, s);
8791         }
8792         ANGLE_CAPTURE(MultiTexCoord1f, isCallValid, context, target, s);
8793     }
8794     else
8795     {
8796         GenerateContextLostErrorOnCurrentGlobalContext();
8797     }
8798 }
8799 
GL_MultiTexCoord1fv(GLenum target,const GLfloat * v)8800 void GL_APIENTRY GL_MultiTexCoord1fv(GLenum target, const GLfloat *v)
8801 {
8802     Context *context = GetValidGlobalContext();
8803     EVENT(context, GLMultiTexCoord1fv, "context = %d, target = %s, v = 0x%016" PRIxPTR "",
8804           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), (uintptr_t)v);
8805 
8806     if (context)
8807     {
8808         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8809         bool isCallValid =
8810             (context->skipValidation() ||
8811              ValidateMultiTexCoord1fv(context, angle::EntryPoint::GLMultiTexCoord1fv, target, v));
8812         if (isCallValid)
8813         {
8814             context->multiTexCoord1fv(target, v);
8815         }
8816         ANGLE_CAPTURE(MultiTexCoord1fv, isCallValid, context, target, v);
8817     }
8818     else
8819     {
8820         GenerateContextLostErrorOnCurrentGlobalContext();
8821     }
8822 }
8823 
GL_MultiTexCoord1i(GLenum target,GLint s)8824 void GL_APIENTRY GL_MultiTexCoord1i(GLenum target, GLint s)
8825 {
8826     Context *context = GetValidGlobalContext();
8827     EVENT(context, GLMultiTexCoord1i, "context = %d, target = %s, s = %d", CID(context),
8828           GLenumToString(GLenumGroup::TextureUnit, target), s);
8829 
8830     if (context)
8831     {
8832         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8833         bool isCallValid =
8834             (context->skipValidation() ||
8835              ValidateMultiTexCoord1i(context, angle::EntryPoint::GLMultiTexCoord1i, target, s));
8836         if (isCallValid)
8837         {
8838             context->multiTexCoord1i(target, s);
8839         }
8840         ANGLE_CAPTURE(MultiTexCoord1i, isCallValid, context, target, s);
8841     }
8842     else
8843     {
8844         GenerateContextLostErrorOnCurrentGlobalContext();
8845     }
8846 }
8847 
GL_MultiTexCoord1iv(GLenum target,const GLint * v)8848 void GL_APIENTRY GL_MultiTexCoord1iv(GLenum target, const GLint *v)
8849 {
8850     Context *context = GetValidGlobalContext();
8851     EVENT(context, GLMultiTexCoord1iv, "context = %d, target = %s, v = 0x%016" PRIxPTR "",
8852           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), (uintptr_t)v);
8853 
8854     if (context)
8855     {
8856         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8857         bool isCallValid =
8858             (context->skipValidation() ||
8859              ValidateMultiTexCoord1iv(context, angle::EntryPoint::GLMultiTexCoord1iv, target, v));
8860         if (isCallValid)
8861         {
8862             context->multiTexCoord1iv(target, v);
8863         }
8864         ANGLE_CAPTURE(MultiTexCoord1iv, isCallValid, context, target, v);
8865     }
8866     else
8867     {
8868         GenerateContextLostErrorOnCurrentGlobalContext();
8869     }
8870 }
8871 
GL_MultiTexCoord1s(GLenum target,GLshort s)8872 void GL_APIENTRY GL_MultiTexCoord1s(GLenum target, GLshort s)
8873 {
8874     Context *context = GetValidGlobalContext();
8875     EVENT(context, GLMultiTexCoord1s, "context = %d, target = %s, s = %d", CID(context),
8876           GLenumToString(GLenumGroup::TextureUnit, target), s);
8877 
8878     if (context)
8879     {
8880         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8881         bool isCallValid =
8882             (context->skipValidation() ||
8883              ValidateMultiTexCoord1s(context, angle::EntryPoint::GLMultiTexCoord1s, target, s));
8884         if (isCallValid)
8885         {
8886             context->multiTexCoord1s(target, s);
8887         }
8888         ANGLE_CAPTURE(MultiTexCoord1s, isCallValid, context, target, s);
8889     }
8890     else
8891     {
8892         GenerateContextLostErrorOnCurrentGlobalContext();
8893     }
8894 }
8895 
GL_MultiTexCoord1sv(GLenum target,const GLshort * v)8896 void GL_APIENTRY GL_MultiTexCoord1sv(GLenum target, const GLshort *v)
8897 {
8898     Context *context = GetValidGlobalContext();
8899     EVENT(context, GLMultiTexCoord1sv, "context = %d, target = %s, v = 0x%016" PRIxPTR "",
8900           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), (uintptr_t)v);
8901 
8902     if (context)
8903     {
8904         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8905         bool isCallValid =
8906             (context->skipValidation() ||
8907              ValidateMultiTexCoord1sv(context, angle::EntryPoint::GLMultiTexCoord1sv, target, v));
8908         if (isCallValid)
8909         {
8910             context->multiTexCoord1sv(target, v);
8911         }
8912         ANGLE_CAPTURE(MultiTexCoord1sv, isCallValid, context, target, v);
8913     }
8914     else
8915     {
8916         GenerateContextLostErrorOnCurrentGlobalContext();
8917     }
8918 }
8919 
GL_MultiTexCoord2d(GLenum target,GLdouble s,GLdouble t)8920 void GL_APIENTRY GL_MultiTexCoord2d(GLenum target, GLdouble s, GLdouble t)
8921 {
8922     Context *context = GetValidGlobalContext();
8923     EVENT(context, GLMultiTexCoord2d, "context = %d, target = %s, s = %f, t = %f", CID(context),
8924           GLenumToString(GLenumGroup::TextureUnit, target), s, t);
8925 
8926     if (context)
8927     {
8928         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8929         bool isCallValid =
8930             (context->skipValidation() ||
8931              ValidateMultiTexCoord2d(context, angle::EntryPoint::GLMultiTexCoord2d, target, s, t));
8932         if (isCallValid)
8933         {
8934             context->multiTexCoord2d(target, s, t);
8935         }
8936         ANGLE_CAPTURE(MultiTexCoord2d, isCallValid, context, target, s, t);
8937     }
8938     else
8939     {
8940         GenerateContextLostErrorOnCurrentGlobalContext();
8941     }
8942 }
8943 
GL_MultiTexCoord2dv(GLenum target,const GLdouble * v)8944 void GL_APIENTRY GL_MultiTexCoord2dv(GLenum target, const GLdouble *v)
8945 {
8946     Context *context = GetValidGlobalContext();
8947     EVENT(context, GLMultiTexCoord2dv, "context = %d, target = %s, v = 0x%016" PRIxPTR "",
8948           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), (uintptr_t)v);
8949 
8950     if (context)
8951     {
8952         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8953         bool isCallValid =
8954             (context->skipValidation() ||
8955              ValidateMultiTexCoord2dv(context, angle::EntryPoint::GLMultiTexCoord2dv, target, v));
8956         if (isCallValid)
8957         {
8958             context->multiTexCoord2dv(target, v);
8959         }
8960         ANGLE_CAPTURE(MultiTexCoord2dv, isCallValid, context, target, v);
8961     }
8962     else
8963     {
8964         GenerateContextLostErrorOnCurrentGlobalContext();
8965     }
8966 }
8967 
GL_MultiTexCoord2f(GLenum target,GLfloat s,GLfloat t)8968 void GL_APIENTRY GL_MultiTexCoord2f(GLenum target, GLfloat s, GLfloat t)
8969 {
8970     Context *context = GetValidGlobalContext();
8971     EVENT(context, GLMultiTexCoord2f, "context = %d, target = %s, s = %f, t = %f", CID(context),
8972           GLenumToString(GLenumGroup::TextureUnit, target), s, t);
8973 
8974     if (context)
8975     {
8976         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8977         bool isCallValid =
8978             (context->skipValidation() ||
8979              ValidateMultiTexCoord2f(context, angle::EntryPoint::GLMultiTexCoord2f, target, s, t));
8980         if (isCallValid)
8981         {
8982             context->multiTexCoord2f(target, s, t);
8983         }
8984         ANGLE_CAPTURE(MultiTexCoord2f, isCallValid, context, target, s, t);
8985     }
8986     else
8987     {
8988         GenerateContextLostErrorOnCurrentGlobalContext();
8989     }
8990 }
8991 
GL_MultiTexCoord2fv(GLenum target,const GLfloat * v)8992 void GL_APIENTRY GL_MultiTexCoord2fv(GLenum target, const GLfloat *v)
8993 {
8994     Context *context = GetValidGlobalContext();
8995     EVENT(context, GLMultiTexCoord2fv, "context = %d, target = %s, v = 0x%016" PRIxPTR "",
8996           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), (uintptr_t)v);
8997 
8998     if (context)
8999     {
9000         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9001         bool isCallValid =
9002             (context->skipValidation() ||
9003              ValidateMultiTexCoord2fv(context, angle::EntryPoint::GLMultiTexCoord2fv, target, v));
9004         if (isCallValid)
9005         {
9006             context->multiTexCoord2fv(target, v);
9007         }
9008         ANGLE_CAPTURE(MultiTexCoord2fv, isCallValid, context, target, v);
9009     }
9010     else
9011     {
9012         GenerateContextLostErrorOnCurrentGlobalContext();
9013     }
9014 }
9015 
GL_MultiTexCoord2i(GLenum target,GLint s,GLint t)9016 void GL_APIENTRY GL_MultiTexCoord2i(GLenum target, GLint s, GLint t)
9017 {
9018     Context *context = GetValidGlobalContext();
9019     EVENT(context, GLMultiTexCoord2i, "context = %d, target = %s, s = %d, t = %d", CID(context),
9020           GLenumToString(GLenumGroup::TextureUnit, target), s, t);
9021 
9022     if (context)
9023     {
9024         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9025         bool isCallValid =
9026             (context->skipValidation() ||
9027              ValidateMultiTexCoord2i(context, angle::EntryPoint::GLMultiTexCoord2i, target, s, t));
9028         if (isCallValid)
9029         {
9030             context->multiTexCoord2i(target, s, t);
9031         }
9032         ANGLE_CAPTURE(MultiTexCoord2i, isCallValid, context, target, s, t);
9033     }
9034     else
9035     {
9036         GenerateContextLostErrorOnCurrentGlobalContext();
9037     }
9038 }
9039 
GL_MultiTexCoord2iv(GLenum target,const GLint * v)9040 void GL_APIENTRY GL_MultiTexCoord2iv(GLenum target, const GLint *v)
9041 {
9042     Context *context = GetValidGlobalContext();
9043     EVENT(context, GLMultiTexCoord2iv, "context = %d, target = %s, v = 0x%016" PRIxPTR "",
9044           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), (uintptr_t)v);
9045 
9046     if (context)
9047     {
9048         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9049         bool isCallValid =
9050             (context->skipValidation() ||
9051              ValidateMultiTexCoord2iv(context, angle::EntryPoint::GLMultiTexCoord2iv, target, v));
9052         if (isCallValid)
9053         {
9054             context->multiTexCoord2iv(target, v);
9055         }
9056         ANGLE_CAPTURE(MultiTexCoord2iv, isCallValid, context, target, v);
9057     }
9058     else
9059     {
9060         GenerateContextLostErrorOnCurrentGlobalContext();
9061     }
9062 }
9063 
GL_MultiTexCoord2s(GLenum target,GLshort s,GLshort t)9064 void GL_APIENTRY GL_MultiTexCoord2s(GLenum target, GLshort s, GLshort t)
9065 {
9066     Context *context = GetValidGlobalContext();
9067     EVENT(context, GLMultiTexCoord2s, "context = %d, target = %s, s = %d, t = %d", CID(context),
9068           GLenumToString(GLenumGroup::TextureUnit, target), s, t);
9069 
9070     if (context)
9071     {
9072         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9073         bool isCallValid =
9074             (context->skipValidation() ||
9075              ValidateMultiTexCoord2s(context, angle::EntryPoint::GLMultiTexCoord2s, target, s, t));
9076         if (isCallValid)
9077         {
9078             context->multiTexCoord2s(target, s, t);
9079         }
9080         ANGLE_CAPTURE(MultiTexCoord2s, isCallValid, context, target, s, t);
9081     }
9082     else
9083     {
9084         GenerateContextLostErrorOnCurrentGlobalContext();
9085     }
9086 }
9087 
GL_MultiTexCoord2sv(GLenum target,const GLshort * v)9088 void GL_APIENTRY GL_MultiTexCoord2sv(GLenum target, const GLshort *v)
9089 {
9090     Context *context = GetValidGlobalContext();
9091     EVENT(context, GLMultiTexCoord2sv, "context = %d, target = %s, v = 0x%016" PRIxPTR "",
9092           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), (uintptr_t)v);
9093 
9094     if (context)
9095     {
9096         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9097         bool isCallValid =
9098             (context->skipValidation() ||
9099              ValidateMultiTexCoord2sv(context, angle::EntryPoint::GLMultiTexCoord2sv, target, v));
9100         if (isCallValid)
9101         {
9102             context->multiTexCoord2sv(target, v);
9103         }
9104         ANGLE_CAPTURE(MultiTexCoord2sv, isCallValid, context, target, v);
9105     }
9106     else
9107     {
9108         GenerateContextLostErrorOnCurrentGlobalContext();
9109     }
9110 }
9111 
GL_MultiTexCoord3d(GLenum target,GLdouble s,GLdouble t,GLdouble r)9112 void GL_APIENTRY GL_MultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r)
9113 {
9114     Context *context = GetValidGlobalContext();
9115     EVENT(context, GLMultiTexCoord3d, "context = %d, target = %s, s = %f, t = %f, r = %f",
9116           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), s, t, r);
9117 
9118     if (context)
9119     {
9120         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9121         bool isCallValid                                      = (context->skipValidation() ||
9122                             ValidateMultiTexCoord3d(context, angle::EntryPoint::GLMultiTexCoord3d,
9123                                                     target, s, t, r));
9124         if (isCallValid)
9125         {
9126             context->multiTexCoord3d(target, s, t, r);
9127         }
9128         ANGLE_CAPTURE(MultiTexCoord3d, isCallValid, context, target, s, t, r);
9129     }
9130     else
9131     {
9132         GenerateContextLostErrorOnCurrentGlobalContext();
9133     }
9134 }
9135 
GL_MultiTexCoord3dv(GLenum target,const GLdouble * v)9136 void GL_APIENTRY GL_MultiTexCoord3dv(GLenum target, const GLdouble *v)
9137 {
9138     Context *context = GetValidGlobalContext();
9139     EVENT(context, GLMultiTexCoord3dv, "context = %d, target = %s, v = 0x%016" PRIxPTR "",
9140           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), (uintptr_t)v);
9141 
9142     if (context)
9143     {
9144         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9145         bool isCallValid =
9146             (context->skipValidation() ||
9147              ValidateMultiTexCoord3dv(context, angle::EntryPoint::GLMultiTexCoord3dv, target, v));
9148         if (isCallValid)
9149         {
9150             context->multiTexCoord3dv(target, v);
9151         }
9152         ANGLE_CAPTURE(MultiTexCoord3dv, isCallValid, context, target, v);
9153     }
9154     else
9155     {
9156         GenerateContextLostErrorOnCurrentGlobalContext();
9157     }
9158 }
9159 
GL_MultiTexCoord3f(GLenum target,GLfloat s,GLfloat t,GLfloat r)9160 void GL_APIENTRY GL_MultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r)
9161 {
9162     Context *context = GetValidGlobalContext();
9163     EVENT(context, GLMultiTexCoord3f, "context = %d, target = %s, s = %f, t = %f, r = %f",
9164           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), s, t, r);
9165 
9166     if (context)
9167     {
9168         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9169         bool isCallValid                                      = (context->skipValidation() ||
9170                             ValidateMultiTexCoord3f(context, angle::EntryPoint::GLMultiTexCoord3f,
9171                                                     target, s, t, r));
9172         if (isCallValid)
9173         {
9174             context->multiTexCoord3f(target, s, t, r);
9175         }
9176         ANGLE_CAPTURE(MultiTexCoord3f, isCallValid, context, target, s, t, r);
9177     }
9178     else
9179     {
9180         GenerateContextLostErrorOnCurrentGlobalContext();
9181     }
9182 }
9183 
GL_MultiTexCoord3fv(GLenum target,const GLfloat * v)9184 void GL_APIENTRY GL_MultiTexCoord3fv(GLenum target, const GLfloat *v)
9185 {
9186     Context *context = GetValidGlobalContext();
9187     EVENT(context, GLMultiTexCoord3fv, "context = %d, target = %s, v = 0x%016" PRIxPTR "",
9188           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), (uintptr_t)v);
9189 
9190     if (context)
9191     {
9192         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9193         bool isCallValid =
9194             (context->skipValidation() ||
9195              ValidateMultiTexCoord3fv(context, angle::EntryPoint::GLMultiTexCoord3fv, target, v));
9196         if (isCallValid)
9197         {
9198             context->multiTexCoord3fv(target, v);
9199         }
9200         ANGLE_CAPTURE(MultiTexCoord3fv, isCallValid, context, target, v);
9201     }
9202     else
9203     {
9204         GenerateContextLostErrorOnCurrentGlobalContext();
9205     }
9206 }
9207 
GL_MultiTexCoord3i(GLenum target,GLint s,GLint t,GLint r)9208 void GL_APIENTRY GL_MultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r)
9209 {
9210     Context *context = GetValidGlobalContext();
9211     EVENT(context, GLMultiTexCoord3i, "context = %d, target = %s, s = %d, t = %d, r = %d",
9212           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), s, t, r);
9213 
9214     if (context)
9215     {
9216         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9217         bool isCallValid                                      = (context->skipValidation() ||
9218                             ValidateMultiTexCoord3i(context, angle::EntryPoint::GLMultiTexCoord3i,
9219                                                     target, s, t, r));
9220         if (isCallValid)
9221         {
9222             context->multiTexCoord3i(target, s, t, r);
9223         }
9224         ANGLE_CAPTURE(MultiTexCoord3i, isCallValid, context, target, s, t, r);
9225     }
9226     else
9227     {
9228         GenerateContextLostErrorOnCurrentGlobalContext();
9229     }
9230 }
9231 
GL_MultiTexCoord3iv(GLenum target,const GLint * v)9232 void GL_APIENTRY GL_MultiTexCoord3iv(GLenum target, const GLint *v)
9233 {
9234     Context *context = GetValidGlobalContext();
9235     EVENT(context, GLMultiTexCoord3iv, "context = %d, target = %s, v = 0x%016" PRIxPTR "",
9236           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), (uintptr_t)v);
9237 
9238     if (context)
9239     {
9240         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9241         bool isCallValid =
9242             (context->skipValidation() ||
9243              ValidateMultiTexCoord3iv(context, angle::EntryPoint::GLMultiTexCoord3iv, target, v));
9244         if (isCallValid)
9245         {
9246             context->multiTexCoord3iv(target, v);
9247         }
9248         ANGLE_CAPTURE(MultiTexCoord3iv, isCallValid, context, target, v);
9249     }
9250     else
9251     {
9252         GenerateContextLostErrorOnCurrentGlobalContext();
9253     }
9254 }
9255 
GL_MultiTexCoord3s(GLenum target,GLshort s,GLshort t,GLshort r)9256 void GL_APIENTRY GL_MultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r)
9257 {
9258     Context *context = GetValidGlobalContext();
9259     EVENT(context, GLMultiTexCoord3s, "context = %d, target = %s, s = %d, t = %d, r = %d",
9260           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), s, t, r);
9261 
9262     if (context)
9263     {
9264         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9265         bool isCallValid                                      = (context->skipValidation() ||
9266                             ValidateMultiTexCoord3s(context, angle::EntryPoint::GLMultiTexCoord3s,
9267                                                     target, s, t, r));
9268         if (isCallValid)
9269         {
9270             context->multiTexCoord3s(target, s, t, r);
9271         }
9272         ANGLE_CAPTURE(MultiTexCoord3s, isCallValid, context, target, s, t, r);
9273     }
9274     else
9275     {
9276         GenerateContextLostErrorOnCurrentGlobalContext();
9277     }
9278 }
9279 
GL_MultiTexCoord3sv(GLenum target,const GLshort * v)9280 void GL_APIENTRY GL_MultiTexCoord3sv(GLenum target, const GLshort *v)
9281 {
9282     Context *context = GetValidGlobalContext();
9283     EVENT(context, GLMultiTexCoord3sv, "context = %d, target = %s, v = 0x%016" PRIxPTR "",
9284           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), (uintptr_t)v);
9285 
9286     if (context)
9287     {
9288         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9289         bool isCallValid =
9290             (context->skipValidation() ||
9291              ValidateMultiTexCoord3sv(context, angle::EntryPoint::GLMultiTexCoord3sv, target, v));
9292         if (isCallValid)
9293         {
9294             context->multiTexCoord3sv(target, v);
9295         }
9296         ANGLE_CAPTURE(MultiTexCoord3sv, isCallValid, context, target, v);
9297     }
9298     else
9299     {
9300         GenerateContextLostErrorOnCurrentGlobalContext();
9301     }
9302 }
9303 
GL_MultiTexCoord4d(GLenum target,GLdouble s,GLdouble t,GLdouble r,GLdouble q)9304 void GL_APIENTRY GL_MultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)
9305 {
9306     Context *context = GetValidGlobalContext();
9307     EVENT(context, GLMultiTexCoord4d, "context = %d, target = %s, s = %f, t = %f, r = %f, q = %f",
9308           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), s, t, r, q);
9309 
9310     if (context)
9311     {
9312         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9313         bool isCallValid                                      = (context->skipValidation() ||
9314                             ValidateMultiTexCoord4d(context, angle::EntryPoint::GLMultiTexCoord4d,
9315                                                     target, s, t, r, q));
9316         if (isCallValid)
9317         {
9318             context->multiTexCoord4d(target, s, t, r, q);
9319         }
9320         ANGLE_CAPTURE(MultiTexCoord4d, isCallValid, context, target, s, t, r, q);
9321     }
9322     else
9323     {
9324         GenerateContextLostErrorOnCurrentGlobalContext();
9325     }
9326 }
9327 
GL_MultiTexCoord4dv(GLenum target,const GLdouble * v)9328 void GL_APIENTRY GL_MultiTexCoord4dv(GLenum target, const GLdouble *v)
9329 {
9330     Context *context = GetValidGlobalContext();
9331     EVENT(context, GLMultiTexCoord4dv, "context = %d, target = %s, v = 0x%016" PRIxPTR "",
9332           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), (uintptr_t)v);
9333 
9334     if (context)
9335     {
9336         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9337         bool isCallValid =
9338             (context->skipValidation() ||
9339              ValidateMultiTexCoord4dv(context, angle::EntryPoint::GLMultiTexCoord4dv, target, v));
9340         if (isCallValid)
9341         {
9342             context->multiTexCoord4dv(target, v);
9343         }
9344         ANGLE_CAPTURE(MultiTexCoord4dv, isCallValid, context, target, v);
9345     }
9346     else
9347     {
9348         GenerateContextLostErrorOnCurrentGlobalContext();
9349     }
9350 }
9351 
GL_MultiTexCoord4f(GLenum target,GLfloat s,GLfloat t,GLfloat r,GLfloat q)9352 void GL_APIENTRY GL_MultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
9353 {
9354     Context *context = GetValidGlobalContext();
9355     EVENT(context, GLMultiTexCoord4f, "context = %d, target = %s, s = %f, t = %f, r = %f, q = %f",
9356           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), s, t, r, q);
9357 
9358     if (context)
9359     {
9360         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9361         bool isCallValid                                      = (context->skipValidation() ||
9362                             ValidateMultiTexCoord4f(context, angle::EntryPoint::GLMultiTexCoord4f,
9363                                                     target, s, t, r, q));
9364         if (isCallValid)
9365         {
9366             context->multiTexCoord4f(target, s, t, r, q);
9367         }
9368         ANGLE_CAPTURE(MultiTexCoord4f, isCallValid, context, target, s, t, r, q);
9369     }
9370     else
9371     {
9372         GenerateContextLostErrorOnCurrentGlobalContext();
9373     }
9374 }
9375 
GL_MultiTexCoord4fv(GLenum target,const GLfloat * v)9376 void GL_APIENTRY GL_MultiTexCoord4fv(GLenum target, const GLfloat *v)
9377 {
9378     Context *context = GetValidGlobalContext();
9379     EVENT(context, GLMultiTexCoord4fv, "context = %d, target = %s, v = 0x%016" PRIxPTR "",
9380           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), (uintptr_t)v);
9381 
9382     if (context)
9383     {
9384         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9385         bool isCallValid =
9386             (context->skipValidation() ||
9387              ValidateMultiTexCoord4fv(context, angle::EntryPoint::GLMultiTexCoord4fv, target, v));
9388         if (isCallValid)
9389         {
9390             context->multiTexCoord4fv(target, v);
9391         }
9392         ANGLE_CAPTURE(MultiTexCoord4fv, isCallValid, context, target, v);
9393     }
9394     else
9395     {
9396         GenerateContextLostErrorOnCurrentGlobalContext();
9397     }
9398 }
9399 
GL_MultiTexCoord4i(GLenum target,GLint s,GLint t,GLint r,GLint q)9400 void GL_APIENTRY GL_MultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q)
9401 {
9402     Context *context = GetValidGlobalContext();
9403     EVENT(context, GLMultiTexCoord4i, "context = %d, target = %s, s = %d, t = %d, r = %d, q = %d",
9404           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), s, t, r, q);
9405 
9406     if (context)
9407     {
9408         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9409         bool isCallValid                                      = (context->skipValidation() ||
9410                             ValidateMultiTexCoord4i(context, angle::EntryPoint::GLMultiTexCoord4i,
9411                                                     target, s, t, r, q));
9412         if (isCallValid)
9413         {
9414             context->multiTexCoord4i(target, s, t, r, q);
9415         }
9416         ANGLE_CAPTURE(MultiTexCoord4i, isCallValid, context, target, s, t, r, q);
9417     }
9418     else
9419     {
9420         GenerateContextLostErrorOnCurrentGlobalContext();
9421     }
9422 }
9423 
GL_MultiTexCoord4iv(GLenum target,const GLint * v)9424 void GL_APIENTRY GL_MultiTexCoord4iv(GLenum target, const GLint *v)
9425 {
9426     Context *context = GetValidGlobalContext();
9427     EVENT(context, GLMultiTexCoord4iv, "context = %d, target = %s, v = 0x%016" PRIxPTR "",
9428           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), (uintptr_t)v);
9429 
9430     if (context)
9431     {
9432         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9433         bool isCallValid =
9434             (context->skipValidation() ||
9435              ValidateMultiTexCoord4iv(context, angle::EntryPoint::GLMultiTexCoord4iv, target, v));
9436         if (isCallValid)
9437         {
9438             context->multiTexCoord4iv(target, v);
9439         }
9440         ANGLE_CAPTURE(MultiTexCoord4iv, isCallValid, context, target, v);
9441     }
9442     else
9443     {
9444         GenerateContextLostErrorOnCurrentGlobalContext();
9445     }
9446 }
9447 
GL_MultiTexCoord4s(GLenum target,GLshort s,GLshort t,GLshort r,GLshort q)9448 void GL_APIENTRY GL_MultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)
9449 {
9450     Context *context = GetValidGlobalContext();
9451     EVENT(context, GLMultiTexCoord4s, "context = %d, target = %s, s = %d, t = %d, r = %d, q = %d",
9452           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), s, t, r, q);
9453 
9454     if (context)
9455     {
9456         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9457         bool isCallValid                                      = (context->skipValidation() ||
9458                             ValidateMultiTexCoord4s(context, angle::EntryPoint::GLMultiTexCoord4s,
9459                                                     target, s, t, r, q));
9460         if (isCallValid)
9461         {
9462             context->multiTexCoord4s(target, s, t, r, q);
9463         }
9464         ANGLE_CAPTURE(MultiTexCoord4s, isCallValid, context, target, s, t, r, q);
9465     }
9466     else
9467     {
9468         GenerateContextLostErrorOnCurrentGlobalContext();
9469     }
9470 }
9471 
GL_MultiTexCoord4sv(GLenum target,const GLshort * v)9472 void GL_APIENTRY GL_MultiTexCoord4sv(GLenum target, const GLshort *v)
9473 {
9474     Context *context = GetValidGlobalContext();
9475     EVENT(context, GLMultiTexCoord4sv, "context = %d, target = %s, v = 0x%016" PRIxPTR "",
9476           CID(context), GLenumToString(GLenumGroup::TextureUnit, target), (uintptr_t)v);
9477 
9478     if (context)
9479     {
9480         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9481         bool isCallValid =
9482             (context->skipValidation() ||
9483              ValidateMultiTexCoord4sv(context, angle::EntryPoint::GLMultiTexCoord4sv, target, v));
9484         if (isCallValid)
9485         {
9486             context->multiTexCoord4sv(target, v);
9487         }
9488         ANGLE_CAPTURE(MultiTexCoord4sv, isCallValid, context, target, v);
9489     }
9490     else
9491     {
9492         GenerateContextLostErrorOnCurrentGlobalContext();
9493     }
9494 }
9495 
GL_SampleCoverage(GLfloat value,GLboolean invert)9496 void GL_APIENTRY GL_SampleCoverage(GLfloat value, GLboolean invert)
9497 {
9498     Context *context = GetValidGlobalContext();
9499     EVENT(context, GLSampleCoverage, "context = %d, value = %f, invert = %s", CID(context), value,
9500           GLbooleanToString(invert));
9501 
9502     if (context)
9503     {
9504         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9505         bool isCallValid =
9506             (context->skipValidation() ||
9507              ValidateSampleCoverage(context, angle::EntryPoint::GLSampleCoverage, value, invert));
9508         if (isCallValid)
9509         {
9510             context->sampleCoverage(value, invert);
9511         }
9512         ANGLE_CAPTURE(SampleCoverage, isCallValid, context, value, invert);
9513     }
9514     else
9515     {
9516         GenerateContextLostErrorOnCurrentGlobalContext();
9517     }
9518 }
9519 
9520 // GL 1.4
GL_BlendColor(GLfloat red,GLfloat green,GLfloat blue,GLfloat alpha)9521 void GL_APIENTRY GL_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
9522 {
9523     Context *context = GetValidGlobalContext();
9524     EVENT(context, GLBlendColor, "context = %d, red = %f, green = %f, blue = %f, alpha = %f",
9525           CID(context), red, green, blue, alpha);
9526 
9527     if (context)
9528     {
9529         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9530         bool isCallValid =
9531             (context->skipValidation() ||
9532              ValidateBlendColor(context, angle::EntryPoint::GLBlendColor, red, green, blue, alpha));
9533         if (isCallValid)
9534         {
9535             context->blendColor(red, green, blue, alpha);
9536         }
9537         ANGLE_CAPTURE(BlendColor, isCallValid, context, red, green, blue, alpha);
9538     }
9539     else
9540     {
9541         GenerateContextLostErrorOnCurrentGlobalContext();
9542     }
9543 }
9544 
GL_BlendEquation(GLenum mode)9545 void GL_APIENTRY GL_BlendEquation(GLenum mode)
9546 {
9547     Context *context = GetValidGlobalContext();
9548     EVENT(context, GLBlendEquation, "context = %d, mode = %s", CID(context),
9549           GLenumToString(GLenumGroup::BlendEquationModeEXT, mode));
9550 
9551     if (context)
9552     {
9553         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9554         bool isCallValid =
9555             (context->skipValidation() ||
9556              ValidateBlendEquation(context, angle::EntryPoint::GLBlendEquation, mode));
9557         if (isCallValid)
9558         {
9559             context->blendEquation(mode);
9560         }
9561         ANGLE_CAPTURE(BlendEquation, isCallValid, context, mode);
9562     }
9563     else
9564     {
9565         GenerateContextLostErrorOnCurrentGlobalContext();
9566     }
9567 }
9568 
GL_BlendFuncSeparate(GLenum sfactorRGB,GLenum dfactorRGB,GLenum sfactorAlpha,GLenum dfactorAlpha)9569 void GL_APIENTRY GL_BlendFuncSeparate(GLenum sfactorRGB,
9570                                       GLenum dfactorRGB,
9571                                       GLenum sfactorAlpha,
9572                                       GLenum dfactorAlpha)
9573 {
9574     Context *context = GetValidGlobalContext();
9575     EVENT(context, GLBlendFuncSeparate,
9576           "context = %d, sfactorRGB = %s, dfactorRGB = %s, sfactorAlpha = %s, dfactorAlpha = %s",
9577           CID(context), GLenumToString(GLenumGroup::BlendingFactor, sfactorRGB),
9578           GLenumToString(GLenumGroup::BlendingFactor, dfactorRGB),
9579           GLenumToString(GLenumGroup::BlendingFactor, sfactorAlpha),
9580           GLenumToString(GLenumGroup::BlendingFactor, dfactorAlpha));
9581 
9582     if (context)
9583     {
9584         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9585         bool isCallValid =
9586             (context->skipValidation() ||
9587              ValidateBlendFuncSeparate(context, angle::EntryPoint::GLBlendFuncSeparate, sfactorRGB,
9588                                        dfactorRGB, sfactorAlpha, dfactorAlpha));
9589         if (isCallValid)
9590         {
9591             context->blendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
9592         }
9593         ANGLE_CAPTURE(BlendFuncSeparate, isCallValid, context, sfactorRGB, dfactorRGB, sfactorAlpha,
9594                       dfactorAlpha);
9595     }
9596     else
9597     {
9598         GenerateContextLostErrorOnCurrentGlobalContext();
9599     }
9600 }
9601 
GL_FogCoordPointer(GLenum type,GLsizei stride,const void * pointer)9602 void GL_APIENTRY GL_FogCoordPointer(GLenum type, GLsizei stride, const void *pointer)
9603 {
9604     Context *context = GetValidGlobalContext();
9605     EVENT(context, GLFogCoordPointer,
9606           "context = %d, type = %s, stride = %d, pointer = 0x%016" PRIxPTR "", CID(context),
9607           GLenumToString(GLenumGroup::FogPointerTypeEXT, type), stride, (uintptr_t)pointer);
9608 
9609     if (context)
9610     {
9611         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9612         bool isCallValid                                      = (context->skipValidation() ||
9613                             ValidateFogCoordPointer(context, angle::EntryPoint::GLFogCoordPointer,
9614                                                     type, stride, pointer));
9615         if (isCallValid)
9616         {
9617             context->fogCoordPointer(type, stride, pointer);
9618         }
9619         ANGLE_CAPTURE(FogCoordPointer, isCallValid, context, type, stride, pointer);
9620     }
9621     else
9622     {
9623         GenerateContextLostErrorOnCurrentGlobalContext();
9624     }
9625 }
9626 
GL_FogCoordd(GLdouble coord)9627 void GL_APIENTRY GL_FogCoordd(GLdouble coord)
9628 {
9629     Context *context = GetValidGlobalContext();
9630     EVENT(context, GLFogCoordd, "context = %d, coord = %f", CID(context), coord);
9631 
9632     if (context)
9633     {
9634         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9635         bool isCallValid                                      = (context->skipValidation() ||
9636                             ValidateFogCoordd(context, angle::EntryPoint::GLFogCoordd, coord));
9637         if (isCallValid)
9638         {
9639             context->fogCoordd(coord);
9640         }
9641         ANGLE_CAPTURE(FogCoordd, isCallValid, context, coord);
9642     }
9643     else
9644     {
9645         GenerateContextLostErrorOnCurrentGlobalContext();
9646     }
9647 }
9648 
GL_FogCoorddv(const GLdouble * coord)9649 void GL_APIENTRY GL_FogCoorddv(const GLdouble *coord)
9650 {
9651     Context *context = GetValidGlobalContext();
9652     EVENT(context, GLFogCoorddv, "context = %d, coord = 0x%016" PRIxPTR "", CID(context),
9653           (uintptr_t)coord);
9654 
9655     if (context)
9656     {
9657         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9658         bool isCallValid                                      = (context->skipValidation() ||
9659                             ValidateFogCoorddv(context, angle::EntryPoint::GLFogCoorddv, coord));
9660         if (isCallValid)
9661         {
9662             context->fogCoorddv(coord);
9663         }
9664         ANGLE_CAPTURE(FogCoorddv, isCallValid, context, coord);
9665     }
9666     else
9667     {
9668         GenerateContextLostErrorOnCurrentGlobalContext();
9669     }
9670 }
9671 
GL_FogCoordf(GLfloat coord)9672 void GL_APIENTRY GL_FogCoordf(GLfloat coord)
9673 {
9674     Context *context = GetValidGlobalContext();
9675     EVENT(context, GLFogCoordf, "context = %d, coord = %f", CID(context), coord);
9676 
9677     if (context)
9678     {
9679         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9680         bool isCallValid                                      = (context->skipValidation() ||
9681                             ValidateFogCoordf(context, angle::EntryPoint::GLFogCoordf, coord));
9682         if (isCallValid)
9683         {
9684             context->fogCoordf(coord);
9685         }
9686         ANGLE_CAPTURE(FogCoordf, isCallValid, context, coord);
9687     }
9688     else
9689     {
9690         GenerateContextLostErrorOnCurrentGlobalContext();
9691     }
9692 }
9693 
GL_FogCoordfv(const GLfloat * coord)9694 void GL_APIENTRY GL_FogCoordfv(const GLfloat *coord)
9695 {
9696     Context *context = GetValidGlobalContext();
9697     EVENT(context, GLFogCoordfv, "context = %d, coord = 0x%016" PRIxPTR "", CID(context),
9698           (uintptr_t)coord);
9699 
9700     if (context)
9701     {
9702         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9703         bool isCallValid                                      = (context->skipValidation() ||
9704                             ValidateFogCoordfv(context, angle::EntryPoint::GLFogCoordfv, coord));
9705         if (isCallValid)
9706         {
9707             context->fogCoordfv(coord);
9708         }
9709         ANGLE_CAPTURE(FogCoordfv, isCallValid, context, coord);
9710     }
9711     else
9712     {
9713         GenerateContextLostErrorOnCurrentGlobalContext();
9714     }
9715 }
9716 
GL_MultiDrawArrays(GLenum mode,const GLint * first,const GLsizei * count,GLsizei drawcount)9717 void GL_APIENTRY GL_MultiDrawArrays(GLenum mode,
9718                                     const GLint *first,
9719                                     const GLsizei *count,
9720                                     GLsizei drawcount)
9721 {
9722     Context *context = GetValidGlobalContext();
9723     EVENT(context, GLMultiDrawArrays,
9724           "context = %d, mode = %s, first = 0x%016" PRIxPTR ", count = 0x%016" PRIxPTR
9725           ", drawcount = %d",
9726           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), (uintptr_t)first,
9727           (uintptr_t)count, drawcount);
9728 
9729     if (context)
9730     {
9731         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
9732         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9733         bool isCallValid                                      = (context->skipValidation() ||
9734                             ValidateMultiDrawArrays(context, angle::EntryPoint::GLMultiDrawArrays,
9735                                                     modePacked, first, count, drawcount));
9736         if (isCallValid)
9737         {
9738             context->multiDrawArrays(modePacked, first, count, drawcount);
9739         }
9740         ANGLE_CAPTURE(MultiDrawArrays, isCallValid, context, modePacked, first, count, drawcount);
9741     }
9742     else
9743     {
9744         GenerateContextLostErrorOnCurrentGlobalContext();
9745     }
9746 }
9747 
GL_MultiDrawElements(GLenum mode,const GLsizei * count,GLenum type,const void * const * indices,GLsizei drawcount)9748 void GL_APIENTRY GL_MultiDrawElements(GLenum mode,
9749                                       const GLsizei *count,
9750                                       GLenum type,
9751                                       const void *const *indices,
9752                                       GLsizei drawcount)
9753 {
9754     Context *context = GetValidGlobalContext();
9755     EVENT(context, GLMultiDrawElements,
9756           "context = %d, mode = %s, count = 0x%016" PRIxPTR ", type = %s, indices = 0x%016" PRIxPTR
9757           ", drawcount = %d",
9758           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), (uintptr_t)count,
9759           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices, drawcount);
9760 
9761     if (context)
9762     {
9763         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
9764         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
9765         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9766         bool isCallValid =
9767             (context->skipValidation() ||
9768              ValidateMultiDrawElements(context, angle::EntryPoint::GLMultiDrawElements, modePacked,
9769                                        count, typePacked, indices, drawcount));
9770         if (isCallValid)
9771         {
9772             context->multiDrawElements(modePacked, count, typePacked, indices, drawcount);
9773         }
9774         ANGLE_CAPTURE(MultiDrawElements, isCallValid, context, modePacked, count, typePacked,
9775                       indices, drawcount);
9776     }
9777     else
9778     {
9779         GenerateContextLostErrorOnCurrentGlobalContext();
9780     }
9781 }
9782 
GL_PointParameterf(GLenum pname,GLfloat param)9783 void GL_APIENTRY GL_PointParameterf(GLenum pname, GLfloat param)
9784 {
9785     Context *context = GetValidGlobalContext();
9786     EVENT(context, GLPointParameterf, "context = %d, pname = %s, param = %f", CID(context),
9787           GLenumToString(GLenumGroup::DefaultGroup, pname), param);
9788 
9789     if (context)
9790     {
9791         PointParameter pnamePacked                            = PackParam<PointParameter>(pname);
9792         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9793         bool isCallValid                                      = (context->skipValidation() ||
9794                             ValidatePointParameterf(context, angle::EntryPoint::GLPointParameterf,
9795                                                     pnamePacked, param));
9796         if (isCallValid)
9797         {
9798             context->pointParameterf(pnamePacked, param);
9799         }
9800         ANGLE_CAPTURE(PointParameterf, isCallValid, context, pnamePacked, param);
9801     }
9802     else
9803     {
9804         GenerateContextLostErrorOnCurrentGlobalContext();
9805     }
9806 }
9807 
GL_PointParameterfv(GLenum pname,const GLfloat * params)9808 void GL_APIENTRY GL_PointParameterfv(GLenum pname, const GLfloat *params)
9809 {
9810     Context *context = GetValidGlobalContext();
9811     EVENT(context, GLPointParameterfv, "context = %d, pname = %s, params = 0x%016" PRIxPTR "",
9812           CID(context), GLenumToString(GLenumGroup::DefaultGroup, pname), (uintptr_t)params);
9813 
9814     if (context)
9815     {
9816         PointParameter pnamePacked                            = PackParam<PointParameter>(pname);
9817         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9818         bool isCallValid                                      = (context->skipValidation() ||
9819                             ValidatePointParameterfv(context, angle::EntryPoint::GLPointParameterfv,
9820                                                      pnamePacked, params));
9821         if (isCallValid)
9822         {
9823             context->pointParameterfv(pnamePacked, params);
9824         }
9825         ANGLE_CAPTURE(PointParameterfv, isCallValid, context, pnamePacked, params);
9826     }
9827     else
9828     {
9829         GenerateContextLostErrorOnCurrentGlobalContext();
9830     }
9831 }
9832 
GL_PointParameteri(GLenum pname,GLint param)9833 void GL_APIENTRY GL_PointParameteri(GLenum pname, GLint param)
9834 {
9835     Context *context = GetValidGlobalContext();
9836     EVENT(context, GLPointParameteri, "context = %d, pname = %s, param = %d", CID(context),
9837           GLenumToString(GLenumGroup::DefaultGroup, pname), param);
9838 
9839     if (context)
9840     {
9841         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9842         bool isCallValid =
9843             (context->skipValidation() ||
9844              ValidatePointParameteri(context, angle::EntryPoint::GLPointParameteri, pname, param));
9845         if (isCallValid)
9846         {
9847             context->pointParameteri(pname, param);
9848         }
9849         ANGLE_CAPTURE(PointParameteri, isCallValid, context, pname, param);
9850     }
9851     else
9852     {
9853         GenerateContextLostErrorOnCurrentGlobalContext();
9854     }
9855 }
9856 
GL_PointParameteriv(GLenum pname,const GLint * params)9857 void GL_APIENTRY GL_PointParameteriv(GLenum pname, const GLint *params)
9858 {
9859     Context *context = GetValidGlobalContext();
9860     EVENT(context, GLPointParameteriv, "context = %d, pname = %s, params = 0x%016" PRIxPTR "",
9861           CID(context), GLenumToString(GLenumGroup::DefaultGroup, pname), (uintptr_t)params);
9862 
9863     if (context)
9864     {
9865         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9866         bool isCallValid                                      = (context->skipValidation() ||
9867                             ValidatePointParameteriv(context, angle::EntryPoint::GLPointParameteriv,
9868                                                      pname, params));
9869         if (isCallValid)
9870         {
9871             context->pointParameteriv(pname, params);
9872         }
9873         ANGLE_CAPTURE(PointParameteriv, isCallValid, context, pname, params);
9874     }
9875     else
9876     {
9877         GenerateContextLostErrorOnCurrentGlobalContext();
9878     }
9879 }
9880 
GL_SecondaryColor3b(GLbyte red,GLbyte green,GLbyte blue)9881 void GL_APIENTRY GL_SecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue)
9882 {
9883     Context *context = GetValidGlobalContext();
9884     EVENT(context, GLSecondaryColor3b, "context = %d, red = %d, green = %d, blue = %d",
9885           CID(context), red, green, blue);
9886 
9887     if (context)
9888     {
9889         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9890         bool isCallValid                                      = (context->skipValidation() ||
9891                             ValidateSecondaryColor3b(context, angle::EntryPoint::GLSecondaryColor3b,
9892                                                      red, green, blue));
9893         if (isCallValid)
9894         {
9895             context->secondaryColor3b(red, green, blue);
9896         }
9897         ANGLE_CAPTURE(SecondaryColor3b, isCallValid, context, red, green, blue);
9898     }
9899     else
9900     {
9901         GenerateContextLostErrorOnCurrentGlobalContext();
9902     }
9903 }
9904 
GL_SecondaryColor3bv(const GLbyte * v)9905 void GL_APIENTRY GL_SecondaryColor3bv(const GLbyte *v)
9906 {
9907     Context *context = GetValidGlobalContext();
9908     EVENT(context, GLSecondaryColor3bv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
9909           (uintptr_t)v);
9910 
9911     if (context)
9912     {
9913         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9914         bool isCallValid =
9915             (context->skipValidation() ||
9916              ValidateSecondaryColor3bv(context, angle::EntryPoint::GLSecondaryColor3bv, v));
9917         if (isCallValid)
9918         {
9919             context->secondaryColor3bv(v);
9920         }
9921         ANGLE_CAPTURE(SecondaryColor3bv, isCallValid, context, v);
9922     }
9923     else
9924     {
9925         GenerateContextLostErrorOnCurrentGlobalContext();
9926     }
9927 }
9928 
GL_SecondaryColor3d(GLdouble red,GLdouble green,GLdouble blue)9929 void GL_APIENTRY GL_SecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue)
9930 {
9931     Context *context = GetValidGlobalContext();
9932     EVENT(context, GLSecondaryColor3d, "context = %d, red = %f, green = %f, blue = %f",
9933           CID(context), red, green, blue);
9934 
9935     if (context)
9936     {
9937         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9938         bool isCallValid                                      = (context->skipValidation() ||
9939                             ValidateSecondaryColor3d(context, angle::EntryPoint::GLSecondaryColor3d,
9940                                                      red, green, blue));
9941         if (isCallValid)
9942         {
9943             context->secondaryColor3d(red, green, blue);
9944         }
9945         ANGLE_CAPTURE(SecondaryColor3d, isCallValid, context, red, green, blue);
9946     }
9947     else
9948     {
9949         GenerateContextLostErrorOnCurrentGlobalContext();
9950     }
9951 }
9952 
GL_SecondaryColor3dv(const GLdouble * v)9953 void GL_APIENTRY GL_SecondaryColor3dv(const GLdouble *v)
9954 {
9955     Context *context = GetValidGlobalContext();
9956     EVENT(context, GLSecondaryColor3dv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
9957           (uintptr_t)v);
9958 
9959     if (context)
9960     {
9961         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9962         bool isCallValid =
9963             (context->skipValidation() ||
9964              ValidateSecondaryColor3dv(context, angle::EntryPoint::GLSecondaryColor3dv, v));
9965         if (isCallValid)
9966         {
9967             context->secondaryColor3dv(v);
9968         }
9969         ANGLE_CAPTURE(SecondaryColor3dv, isCallValid, context, v);
9970     }
9971     else
9972     {
9973         GenerateContextLostErrorOnCurrentGlobalContext();
9974     }
9975 }
9976 
GL_SecondaryColor3f(GLfloat red,GLfloat green,GLfloat blue)9977 void GL_APIENTRY GL_SecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue)
9978 {
9979     Context *context = GetValidGlobalContext();
9980     EVENT(context, GLSecondaryColor3f, "context = %d, red = %f, green = %f, blue = %f",
9981           CID(context), red, green, blue);
9982 
9983     if (context)
9984     {
9985         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9986         bool isCallValid                                      = (context->skipValidation() ||
9987                             ValidateSecondaryColor3f(context, angle::EntryPoint::GLSecondaryColor3f,
9988                                                      red, green, blue));
9989         if (isCallValid)
9990         {
9991             context->secondaryColor3f(red, green, blue);
9992         }
9993         ANGLE_CAPTURE(SecondaryColor3f, isCallValid, context, red, green, blue);
9994     }
9995     else
9996     {
9997         GenerateContextLostErrorOnCurrentGlobalContext();
9998     }
9999 }
10000 
GL_SecondaryColor3fv(const GLfloat * v)10001 void GL_APIENTRY GL_SecondaryColor3fv(const GLfloat *v)
10002 {
10003     Context *context = GetValidGlobalContext();
10004     EVENT(context, GLSecondaryColor3fv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
10005           (uintptr_t)v);
10006 
10007     if (context)
10008     {
10009         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10010         bool isCallValid =
10011             (context->skipValidation() ||
10012              ValidateSecondaryColor3fv(context, angle::EntryPoint::GLSecondaryColor3fv, v));
10013         if (isCallValid)
10014         {
10015             context->secondaryColor3fv(v);
10016         }
10017         ANGLE_CAPTURE(SecondaryColor3fv, isCallValid, context, v);
10018     }
10019     else
10020     {
10021         GenerateContextLostErrorOnCurrentGlobalContext();
10022     }
10023 }
10024 
GL_SecondaryColor3i(GLint red,GLint green,GLint blue)10025 void GL_APIENTRY GL_SecondaryColor3i(GLint red, GLint green, GLint blue)
10026 {
10027     Context *context = GetValidGlobalContext();
10028     EVENT(context, GLSecondaryColor3i, "context = %d, red = %d, green = %d, blue = %d",
10029           CID(context), red, green, blue);
10030 
10031     if (context)
10032     {
10033         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10034         bool isCallValid                                      = (context->skipValidation() ||
10035                             ValidateSecondaryColor3i(context, angle::EntryPoint::GLSecondaryColor3i,
10036                                                      red, green, blue));
10037         if (isCallValid)
10038         {
10039             context->secondaryColor3i(red, green, blue);
10040         }
10041         ANGLE_CAPTURE(SecondaryColor3i, isCallValid, context, red, green, blue);
10042     }
10043     else
10044     {
10045         GenerateContextLostErrorOnCurrentGlobalContext();
10046     }
10047 }
10048 
GL_SecondaryColor3iv(const GLint * v)10049 void GL_APIENTRY GL_SecondaryColor3iv(const GLint *v)
10050 {
10051     Context *context = GetValidGlobalContext();
10052     EVENT(context, GLSecondaryColor3iv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
10053           (uintptr_t)v);
10054 
10055     if (context)
10056     {
10057         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10058         bool isCallValid =
10059             (context->skipValidation() ||
10060              ValidateSecondaryColor3iv(context, angle::EntryPoint::GLSecondaryColor3iv, v));
10061         if (isCallValid)
10062         {
10063             context->secondaryColor3iv(v);
10064         }
10065         ANGLE_CAPTURE(SecondaryColor3iv, isCallValid, context, v);
10066     }
10067     else
10068     {
10069         GenerateContextLostErrorOnCurrentGlobalContext();
10070     }
10071 }
10072 
GL_SecondaryColor3s(GLshort red,GLshort green,GLshort blue)10073 void GL_APIENTRY GL_SecondaryColor3s(GLshort red, GLshort green, GLshort blue)
10074 {
10075     Context *context = GetValidGlobalContext();
10076     EVENT(context, GLSecondaryColor3s, "context = %d, red = %d, green = %d, blue = %d",
10077           CID(context), red, green, blue);
10078 
10079     if (context)
10080     {
10081         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10082         bool isCallValid                                      = (context->skipValidation() ||
10083                             ValidateSecondaryColor3s(context, angle::EntryPoint::GLSecondaryColor3s,
10084                                                      red, green, blue));
10085         if (isCallValid)
10086         {
10087             context->secondaryColor3s(red, green, blue);
10088         }
10089         ANGLE_CAPTURE(SecondaryColor3s, isCallValid, context, red, green, blue);
10090     }
10091     else
10092     {
10093         GenerateContextLostErrorOnCurrentGlobalContext();
10094     }
10095 }
10096 
GL_SecondaryColor3sv(const GLshort * v)10097 void GL_APIENTRY GL_SecondaryColor3sv(const GLshort *v)
10098 {
10099     Context *context = GetValidGlobalContext();
10100     EVENT(context, GLSecondaryColor3sv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
10101           (uintptr_t)v);
10102 
10103     if (context)
10104     {
10105         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10106         bool isCallValid =
10107             (context->skipValidation() ||
10108              ValidateSecondaryColor3sv(context, angle::EntryPoint::GLSecondaryColor3sv, v));
10109         if (isCallValid)
10110         {
10111             context->secondaryColor3sv(v);
10112         }
10113         ANGLE_CAPTURE(SecondaryColor3sv, isCallValid, context, v);
10114     }
10115     else
10116     {
10117         GenerateContextLostErrorOnCurrentGlobalContext();
10118     }
10119 }
10120 
GL_SecondaryColor3ub(GLubyte red,GLubyte green,GLubyte blue)10121 void GL_APIENTRY GL_SecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue)
10122 {
10123     Context *context = GetValidGlobalContext();
10124     EVENT(context, GLSecondaryColor3ub, "context = %d, red = %d, green = %d, blue = %d",
10125           CID(context), red, green, blue);
10126 
10127     if (context)
10128     {
10129         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10130         bool isCallValid                                      = (context->skipValidation() ||
10131                             ValidateSecondaryColor3ub(
10132                                 context, angle::EntryPoint::GLSecondaryColor3ub, red, green, blue));
10133         if (isCallValid)
10134         {
10135             context->secondaryColor3ub(red, green, blue);
10136         }
10137         ANGLE_CAPTURE(SecondaryColor3ub, isCallValid, context, red, green, blue);
10138     }
10139     else
10140     {
10141         GenerateContextLostErrorOnCurrentGlobalContext();
10142     }
10143 }
10144 
GL_SecondaryColor3ubv(const GLubyte * v)10145 void GL_APIENTRY GL_SecondaryColor3ubv(const GLubyte *v)
10146 {
10147     Context *context = GetValidGlobalContext();
10148     EVENT(context, GLSecondaryColor3ubv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
10149           (uintptr_t)v);
10150 
10151     if (context)
10152     {
10153         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10154         bool isCallValid =
10155             (context->skipValidation() ||
10156              ValidateSecondaryColor3ubv(context, angle::EntryPoint::GLSecondaryColor3ubv, v));
10157         if (isCallValid)
10158         {
10159             context->secondaryColor3ubv(v);
10160         }
10161         ANGLE_CAPTURE(SecondaryColor3ubv, isCallValid, context, v);
10162     }
10163     else
10164     {
10165         GenerateContextLostErrorOnCurrentGlobalContext();
10166     }
10167 }
10168 
GL_SecondaryColor3ui(GLuint red,GLuint green,GLuint blue)10169 void GL_APIENTRY GL_SecondaryColor3ui(GLuint red, GLuint green, GLuint blue)
10170 {
10171     Context *context = GetValidGlobalContext();
10172     EVENT(context, GLSecondaryColor3ui, "context = %d, red = %u, green = %u, blue = %u",
10173           CID(context), red, green, blue);
10174 
10175     if (context)
10176     {
10177         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10178         bool isCallValid                                      = (context->skipValidation() ||
10179                             ValidateSecondaryColor3ui(
10180                                 context, angle::EntryPoint::GLSecondaryColor3ui, red, green, blue));
10181         if (isCallValid)
10182         {
10183             context->secondaryColor3ui(red, green, blue);
10184         }
10185         ANGLE_CAPTURE(SecondaryColor3ui, isCallValid, context, red, green, blue);
10186     }
10187     else
10188     {
10189         GenerateContextLostErrorOnCurrentGlobalContext();
10190     }
10191 }
10192 
GL_SecondaryColor3uiv(const GLuint * v)10193 void GL_APIENTRY GL_SecondaryColor3uiv(const GLuint *v)
10194 {
10195     Context *context = GetValidGlobalContext();
10196     EVENT(context, GLSecondaryColor3uiv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
10197           (uintptr_t)v);
10198 
10199     if (context)
10200     {
10201         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10202         bool isCallValid =
10203             (context->skipValidation() ||
10204              ValidateSecondaryColor3uiv(context, angle::EntryPoint::GLSecondaryColor3uiv, v));
10205         if (isCallValid)
10206         {
10207             context->secondaryColor3uiv(v);
10208         }
10209         ANGLE_CAPTURE(SecondaryColor3uiv, isCallValid, context, v);
10210     }
10211     else
10212     {
10213         GenerateContextLostErrorOnCurrentGlobalContext();
10214     }
10215 }
10216 
GL_SecondaryColor3us(GLushort red,GLushort green,GLushort blue)10217 void GL_APIENTRY GL_SecondaryColor3us(GLushort red, GLushort green, GLushort blue)
10218 {
10219     Context *context = GetValidGlobalContext();
10220     EVENT(context, GLSecondaryColor3us, "context = %d, red = %u, green = %u, blue = %u",
10221           CID(context), red, green, blue);
10222 
10223     if (context)
10224     {
10225         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10226         bool isCallValid                                      = (context->skipValidation() ||
10227                             ValidateSecondaryColor3us(
10228                                 context, angle::EntryPoint::GLSecondaryColor3us, red, green, blue));
10229         if (isCallValid)
10230         {
10231             context->secondaryColor3us(red, green, blue);
10232         }
10233         ANGLE_CAPTURE(SecondaryColor3us, isCallValid, context, red, green, blue);
10234     }
10235     else
10236     {
10237         GenerateContextLostErrorOnCurrentGlobalContext();
10238     }
10239 }
10240 
GL_SecondaryColor3usv(const GLushort * v)10241 void GL_APIENTRY GL_SecondaryColor3usv(const GLushort *v)
10242 {
10243     Context *context = GetValidGlobalContext();
10244     EVENT(context, GLSecondaryColor3usv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
10245           (uintptr_t)v);
10246 
10247     if (context)
10248     {
10249         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10250         bool isCallValid =
10251             (context->skipValidation() ||
10252              ValidateSecondaryColor3usv(context, angle::EntryPoint::GLSecondaryColor3usv, v));
10253         if (isCallValid)
10254         {
10255             context->secondaryColor3usv(v);
10256         }
10257         ANGLE_CAPTURE(SecondaryColor3usv, isCallValid, context, v);
10258     }
10259     else
10260     {
10261         GenerateContextLostErrorOnCurrentGlobalContext();
10262     }
10263 }
10264 
GL_SecondaryColorPointer(GLint size,GLenum type,GLsizei stride,const void * pointer)10265 void GL_APIENTRY GL_SecondaryColorPointer(GLint size,
10266                                           GLenum type,
10267                                           GLsizei stride,
10268                                           const void *pointer)
10269 {
10270     Context *context = GetValidGlobalContext();
10271     EVENT(context, GLSecondaryColorPointer,
10272           "context = %d, size = %d, type = %s, stride = %d, pointer = 0x%016" PRIxPTR "",
10273           CID(context), size, GLenumToString(GLenumGroup::ColorPointerType, type), stride,
10274           (uintptr_t)pointer);
10275 
10276     if (context)
10277     {
10278         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10279         bool isCallValid =
10280             (context->skipValidation() ||
10281              ValidateSecondaryColorPointer(context, angle::EntryPoint::GLSecondaryColorPointer,
10282                                            size, type, stride, pointer));
10283         if (isCallValid)
10284         {
10285             context->secondaryColorPointer(size, type, stride, pointer);
10286         }
10287         ANGLE_CAPTURE(SecondaryColorPointer, isCallValid, context, size, type, stride, pointer);
10288     }
10289     else
10290     {
10291         GenerateContextLostErrorOnCurrentGlobalContext();
10292     }
10293 }
10294 
GL_WindowPos2d(GLdouble x,GLdouble y)10295 void GL_APIENTRY GL_WindowPos2d(GLdouble x, GLdouble y)
10296 {
10297     Context *context = GetValidGlobalContext();
10298     EVENT(context, GLWindowPos2d, "context = %d, x = %f, y = %f", CID(context), x, y);
10299 
10300     if (context)
10301     {
10302         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10303         bool isCallValid                                      = (context->skipValidation() ||
10304                             ValidateWindowPos2d(context, angle::EntryPoint::GLWindowPos2d, x, y));
10305         if (isCallValid)
10306         {
10307             context->windowPos2d(x, y);
10308         }
10309         ANGLE_CAPTURE(WindowPos2d, isCallValid, context, x, y);
10310     }
10311     else
10312     {
10313         GenerateContextLostErrorOnCurrentGlobalContext();
10314     }
10315 }
10316 
GL_WindowPos2dv(const GLdouble * v)10317 void GL_APIENTRY GL_WindowPos2dv(const GLdouble *v)
10318 {
10319     Context *context = GetValidGlobalContext();
10320     EVENT(context, GLWindowPos2dv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
10321           (uintptr_t)v);
10322 
10323     if (context)
10324     {
10325         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10326         bool isCallValid                                      = (context->skipValidation() ||
10327                             ValidateWindowPos2dv(context, angle::EntryPoint::GLWindowPos2dv, v));
10328         if (isCallValid)
10329         {
10330             context->windowPos2dv(v);
10331         }
10332         ANGLE_CAPTURE(WindowPos2dv, isCallValid, context, v);
10333     }
10334     else
10335     {
10336         GenerateContextLostErrorOnCurrentGlobalContext();
10337     }
10338 }
10339 
GL_WindowPos2f(GLfloat x,GLfloat y)10340 void GL_APIENTRY GL_WindowPos2f(GLfloat x, GLfloat y)
10341 {
10342     Context *context = GetValidGlobalContext();
10343     EVENT(context, GLWindowPos2f, "context = %d, x = %f, y = %f", CID(context), x, y);
10344 
10345     if (context)
10346     {
10347         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10348         bool isCallValid                                      = (context->skipValidation() ||
10349                             ValidateWindowPos2f(context, angle::EntryPoint::GLWindowPos2f, x, y));
10350         if (isCallValid)
10351         {
10352             context->windowPos2f(x, y);
10353         }
10354         ANGLE_CAPTURE(WindowPos2f, isCallValid, context, x, y);
10355     }
10356     else
10357     {
10358         GenerateContextLostErrorOnCurrentGlobalContext();
10359     }
10360 }
10361 
GL_WindowPos2fv(const GLfloat * v)10362 void GL_APIENTRY GL_WindowPos2fv(const GLfloat *v)
10363 {
10364     Context *context = GetValidGlobalContext();
10365     EVENT(context, GLWindowPos2fv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
10366           (uintptr_t)v);
10367 
10368     if (context)
10369     {
10370         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10371         bool isCallValid                                      = (context->skipValidation() ||
10372                             ValidateWindowPos2fv(context, angle::EntryPoint::GLWindowPos2fv, v));
10373         if (isCallValid)
10374         {
10375             context->windowPos2fv(v);
10376         }
10377         ANGLE_CAPTURE(WindowPos2fv, isCallValid, context, v);
10378     }
10379     else
10380     {
10381         GenerateContextLostErrorOnCurrentGlobalContext();
10382     }
10383 }
10384 
GL_WindowPos2i(GLint x,GLint y)10385 void GL_APIENTRY GL_WindowPos2i(GLint x, GLint y)
10386 {
10387     Context *context = GetValidGlobalContext();
10388     EVENT(context, GLWindowPos2i, "context = %d, x = %d, y = %d", CID(context), x, y);
10389 
10390     if (context)
10391     {
10392         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10393         bool isCallValid                                      = (context->skipValidation() ||
10394                             ValidateWindowPos2i(context, angle::EntryPoint::GLWindowPos2i, x, y));
10395         if (isCallValid)
10396         {
10397             context->windowPos2i(x, y);
10398         }
10399         ANGLE_CAPTURE(WindowPos2i, isCallValid, context, x, y);
10400     }
10401     else
10402     {
10403         GenerateContextLostErrorOnCurrentGlobalContext();
10404     }
10405 }
10406 
GL_WindowPos2iv(const GLint * v)10407 void GL_APIENTRY GL_WindowPos2iv(const GLint *v)
10408 {
10409     Context *context = GetValidGlobalContext();
10410     EVENT(context, GLWindowPos2iv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
10411           (uintptr_t)v);
10412 
10413     if (context)
10414     {
10415         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10416         bool isCallValid                                      = (context->skipValidation() ||
10417                             ValidateWindowPos2iv(context, angle::EntryPoint::GLWindowPos2iv, v));
10418         if (isCallValid)
10419         {
10420             context->windowPos2iv(v);
10421         }
10422         ANGLE_CAPTURE(WindowPos2iv, isCallValid, context, v);
10423     }
10424     else
10425     {
10426         GenerateContextLostErrorOnCurrentGlobalContext();
10427     }
10428 }
10429 
GL_WindowPos2s(GLshort x,GLshort y)10430 void GL_APIENTRY GL_WindowPos2s(GLshort x, GLshort y)
10431 {
10432     Context *context = GetValidGlobalContext();
10433     EVENT(context, GLWindowPos2s, "context = %d, x = %d, y = %d", CID(context), x, y);
10434 
10435     if (context)
10436     {
10437         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10438         bool isCallValid                                      = (context->skipValidation() ||
10439                             ValidateWindowPos2s(context, angle::EntryPoint::GLWindowPos2s, x, y));
10440         if (isCallValid)
10441         {
10442             context->windowPos2s(x, y);
10443         }
10444         ANGLE_CAPTURE(WindowPos2s, isCallValid, context, x, y);
10445     }
10446     else
10447     {
10448         GenerateContextLostErrorOnCurrentGlobalContext();
10449     }
10450 }
10451 
GL_WindowPos2sv(const GLshort * v)10452 void GL_APIENTRY GL_WindowPos2sv(const GLshort *v)
10453 {
10454     Context *context = GetValidGlobalContext();
10455     EVENT(context, GLWindowPos2sv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
10456           (uintptr_t)v);
10457 
10458     if (context)
10459     {
10460         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10461         bool isCallValid                                      = (context->skipValidation() ||
10462                             ValidateWindowPos2sv(context, angle::EntryPoint::GLWindowPos2sv, v));
10463         if (isCallValid)
10464         {
10465             context->windowPos2sv(v);
10466         }
10467         ANGLE_CAPTURE(WindowPos2sv, isCallValid, context, v);
10468     }
10469     else
10470     {
10471         GenerateContextLostErrorOnCurrentGlobalContext();
10472     }
10473 }
10474 
GL_WindowPos3d(GLdouble x,GLdouble y,GLdouble z)10475 void GL_APIENTRY GL_WindowPos3d(GLdouble x, GLdouble y, GLdouble z)
10476 {
10477     Context *context = GetValidGlobalContext();
10478     EVENT(context, GLWindowPos3d, "context = %d, x = %f, y = %f, z = %f", CID(context), x, y, z);
10479 
10480     if (context)
10481     {
10482         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10483         bool isCallValid =
10484             (context->skipValidation() ||
10485              ValidateWindowPos3d(context, angle::EntryPoint::GLWindowPos3d, x, y, z));
10486         if (isCallValid)
10487         {
10488             context->windowPos3d(x, y, z);
10489         }
10490         ANGLE_CAPTURE(WindowPos3d, isCallValid, context, x, y, z);
10491     }
10492     else
10493     {
10494         GenerateContextLostErrorOnCurrentGlobalContext();
10495     }
10496 }
10497 
GL_WindowPos3dv(const GLdouble * v)10498 void GL_APIENTRY GL_WindowPos3dv(const GLdouble *v)
10499 {
10500     Context *context = GetValidGlobalContext();
10501     EVENT(context, GLWindowPos3dv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
10502           (uintptr_t)v);
10503 
10504     if (context)
10505     {
10506         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10507         bool isCallValid                                      = (context->skipValidation() ||
10508                             ValidateWindowPos3dv(context, angle::EntryPoint::GLWindowPos3dv, v));
10509         if (isCallValid)
10510         {
10511             context->windowPos3dv(v);
10512         }
10513         ANGLE_CAPTURE(WindowPos3dv, isCallValid, context, v);
10514     }
10515     else
10516     {
10517         GenerateContextLostErrorOnCurrentGlobalContext();
10518     }
10519 }
10520 
GL_WindowPos3f(GLfloat x,GLfloat y,GLfloat z)10521 void GL_APIENTRY GL_WindowPos3f(GLfloat x, GLfloat y, GLfloat z)
10522 {
10523     Context *context = GetValidGlobalContext();
10524     EVENT(context, GLWindowPos3f, "context = %d, x = %f, y = %f, z = %f", CID(context), x, y, z);
10525 
10526     if (context)
10527     {
10528         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10529         bool isCallValid =
10530             (context->skipValidation() ||
10531              ValidateWindowPos3f(context, angle::EntryPoint::GLWindowPos3f, x, y, z));
10532         if (isCallValid)
10533         {
10534             context->windowPos3f(x, y, z);
10535         }
10536         ANGLE_CAPTURE(WindowPos3f, isCallValid, context, x, y, z);
10537     }
10538     else
10539     {
10540         GenerateContextLostErrorOnCurrentGlobalContext();
10541     }
10542 }
10543 
GL_WindowPos3fv(const GLfloat * v)10544 void GL_APIENTRY GL_WindowPos3fv(const GLfloat *v)
10545 {
10546     Context *context = GetValidGlobalContext();
10547     EVENT(context, GLWindowPos3fv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
10548           (uintptr_t)v);
10549 
10550     if (context)
10551     {
10552         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10553         bool isCallValid                                      = (context->skipValidation() ||
10554                             ValidateWindowPos3fv(context, angle::EntryPoint::GLWindowPos3fv, v));
10555         if (isCallValid)
10556         {
10557             context->windowPos3fv(v);
10558         }
10559         ANGLE_CAPTURE(WindowPos3fv, isCallValid, context, v);
10560     }
10561     else
10562     {
10563         GenerateContextLostErrorOnCurrentGlobalContext();
10564     }
10565 }
10566 
GL_WindowPos3i(GLint x,GLint y,GLint z)10567 void GL_APIENTRY GL_WindowPos3i(GLint x, GLint y, GLint z)
10568 {
10569     Context *context = GetValidGlobalContext();
10570     EVENT(context, GLWindowPos3i, "context = %d, x = %d, y = %d, z = %d", CID(context), x, y, z);
10571 
10572     if (context)
10573     {
10574         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10575         bool isCallValid =
10576             (context->skipValidation() ||
10577              ValidateWindowPos3i(context, angle::EntryPoint::GLWindowPos3i, x, y, z));
10578         if (isCallValid)
10579         {
10580             context->windowPos3i(x, y, z);
10581         }
10582         ANGLE_CAPTURE(WindowPos3i, isCallValid, context, x, y, z);
10583     }
10584     else
10585     {
10586         GenerateContextLostErrorOnCurrentGlobalContext();
10587     }
10588 }
10589 
GL_WindowPos3iv(const GLint * v)10590 void GL_APIENTRY GL_WindowPos3iv(const GLint *v)
10591 {
10592     Context *context = GetValidGlobalContext();
10593     EVENT(context, GLWindowPos3iv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
10594           (uintptr_t)v);
10595 
10596     if (context)
10597     {
10598         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10599         bool isCallValid                                      = (context->skipValidation() ||
10600                             ValidateWindowPos3iv(context, angle::EntryPoint::GLWindowPos3iv, v));
10601         if (isCallValid)
10602         {
10603             context->windowPos3iv(v);
10604         }
10605         ANGLE_CAPTURE(WindowPos3iv, isCallValid, context, v);
10606     }
10607     else
10608     {
10609         GenerateContextLostErrorOnCurrentGlobalContext();
10610     }
10611 }
10612 
GL_WindowPos3s(GLshort x,GLshort y,GLshort z)10613 void GL_APIENTRY GL_WindowPos3s(GLshort x, GLshort y, GLshort z)
10614 {
10615     Context *context = GetValidGlobalContext();
10616     EVENT(context, GLWindowPos3s, "context = %d, x = %d, y = %d, z = %d", CID(context), x, y, z);
10617 
10618     if (context)
10619     {
10620         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10621         bool isCallValid =
10622             (context->skipValidation() ||
10623              ValidateWindowPos3s(context, angle::EntryPoint::GLWindowPos3s, x, y, z));
10624         if (isCallValid)
10625         {
10626             context->windowPos3s(x, y, z);
10627         }
10628         ANGLE_CAPTURE(WindowPos3s, isCallValid, context, x, y, z);
10629     }
10630     else
10631     {
10632         GenerateContextLostErrorOnCurrentGlobalContext();
10633     }
10634 }
10635 
GL_WindowPos3sv(const GLshort * v)10636 void GL_APIENTRY GL_WindowPos3sv(const GLshort *v)
10637 {
10638     Context *context = GetValidGlobalContext();
10639     EVENT(context, GLWindowPos3sv, "context = %d, v = 0x%016" PRIxPTR "", CID(context),
10640           (uintptr_t)v);
10641 
10642     if (context)
10643     {
10644         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10645         bool isCallValid                                      = (context->skipValidation() ||
10646                             ValidateWindowPos3sv(context, angle::EntryPoint::GLWindowPos3sv, v));
10647         if (isCallValid)
10648         {
10649             context->windowPos3sv(v);
10650         }
10651         ANGLE_CAPTURE(WindowPos3sv, isCallValid, context, v);
10652     }
10653     else
10654     {
10655         GenerateContextLostErrorOnCurrentGlobalContext();
10656     }
10657 }
10658 
10659 // GL 1.5
GL_BeginQuery(GLenum target,GLuint id)10660 void GL_APIENTRY GL_BeginQuery(GLenum target, GLuint id)
10661 {
10662     Context *context = GetValidGlobalContext();
10663     EVENT(context, GLBeginQuery, "context = %d, target = %s, id = %u", CID(context),
10664           GLenumToString(GLenumGroup::QueryTarget, target), id);
10665 
10666     if (context)
10667     {
10668         QueryType targetPacked                                = PackParam<QueryType>(target);
10669         QueryID idPacked                                      = PackParam<QueryID>(id);
10670         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10671         bool isCallValid =
10672             (context->skipValidation() ||
10673              ValidateBeginQuery(context, angle::EntryPoint::GLBeginQuery, targetPacked, idPacked));
10674         if (isCallValid)
10675         {
10676             context->beginQuery(targetPacked, idPacked);
10677         }
10678         ANGLE_CAPTURE(BeginQuery, isCallValid, context, targetPacked, idPacked);
10679     }
10680     else
10681     {
10682         GenerateContextLostErrorOnCurrentGlobalContext();
10683     }
10684 }
10685 
GL_BindBuffer(GLenum target,GLuint buffer)10686 void GL_APIENTRY GL_BindBuffer(GLenum target, GLuint buffer)
10687 {
10688     Context *context = GetValidGlobalContext();
10689     EVENT(context, GLBindBuffer, "context = %d, target = %s, buffer = %u", CID(context),
10690           GLenumToString(GLenumGroup::BufferTargetARB, target), buffer);
10691 
10692     if (context)
10693     {
10694         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
10695         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
10696         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10697         bool isCallValid                                      = (context->skipValidation() ||
10698                             ValidateBindBuffer(context, angle::EntryPoint::GLBindBuffer,
10699                                                targetPacked, bufferPacked));
10700         if (isCallValid)
10701         {
10702             context->bindBuffer(targetPacked, bufferPacked);
10703         }
10704         ANGLE_CAPTURE(BindBuffer, isCallValid, context, targetPacked, bufferPacked);
10705     }
10706     else
10707     {
10708         GenerateContextLostErrorOnCurrentGlobalContext();
10709     }
10710 }
10711 
GL_BufferData(GLenum target,GLsizeiptr size,const void * data,GLenum usage)10712 void GL_APIENTRY GL_BufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage)
10713 {
10714     Context *context = GetValidGlobalContext();
10715     EVENT(context, GLBufferData,
10716           "context = %d, target = %s, size = %llu, data = 0x%016" PRIxPTR ", usage = %s",
10717           CID(context), GLenumToString(GLenumGroup::BufferTargetARB, target),
10718           static_cast<unsigned long long>(size), (uintptr_t)data,
10719           GLenumToString(GLenumGroup::BufferUsageARB, usage));
10720 
10721     if (context)
10722     {
10723         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
10724         BufferUsage usagePacked                               = PackParam<BufferUsage>(usage);
10725         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10726         bool isCallValid                                      = (context->skipValidation() ||
10727                             ValidateBufferData(context, angle::EntryPoint::GLBufferData,
10728                                                targetPacked, size, data, usagePacked));
10729         if (isCallValid)
10730         {
10731             context->bufferData(targetPacked, size, data, usagePacked);
10732         }
10733         ANGLE_CAPTURE(BufferData, isCallValid, context, targetPacked, size, data, usagePacked);
10734     }
10735     else
10736     {
10737         GenerateContextLostErrorOnCurrentGlobalContext();
10738     }
10739 }
10740 
GL_BufferSubData(GLenum target,GLintptr offset,GLsizeiptr size,const void * data)10741 void GL_APIENTRY GL_BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data)
10742 {
10743     Context *context = GetValidGlobalContext();
10744     EVENT(context, GLBufferSubData,
10745           "context = %d, target = %s, offset = %llu, size = %llu, data = 0x%016" PRIxPTR "",
10746           CID(context), GLenumToString(GLenumGroup::BufferTargetARB, target),
10747           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size),
10748           (uintptr_t)data);
10749 
10750     if (context)
10751     {
10752         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
10753         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10754         bool isCallValid                                      = (context->skipValidation() ||
10755                             ValidateBufferSubData(context, angle::EntryPoint::GLBufferSubData,
10756                                                   targetPacked, offset, size, data));
10757         if (isCallValid)
10758         {
10759             context->bufferSubData(targetPacked, offset, size, data);
10760         }
10761         ANGLE_CAPTURE(BufferSubData, isCallValid, context, targetPacked, offset, size, data);
10762     }
10763     else
10764     {
10765         GenerateContextLostErrorOnCurrentGlobalContext();
10766     }
10767 }
10768 
GL_DeleteBuffers(GLsizei n,const GLuint * buffers)10769 void GL_APIENTRY GL_DeleteBuffers(GLsizei n, const GLuint *buffers)
10770 {
10771     Context *context = GetValidGlobalContext();
10772     EVENT(context, GLDeleteBuffers, "context = %d, n = %d, buffers = 0x%016" PRIxPTR "",
10773           CID(context), n, (uintptr_t)buffers);
10774 
10775     if (context)
10776     {
10777         const BufferID *buffersPacked = PackParam<const BufferID *>(buffers);
10778         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10779         bool isCallValid =
10780             (context->skipValidation() ||
10781              ValidateDeleteBuffers(context, angle::EntryPoint::GLDeleteBuffers, n, buffersPacked));
10782         if (isCallValid)
10783         {
10784             context->deleteBuffers(n, buffersPacked);
10785         }
10786         ANGLE_CAPTURE(DeleteBuffers, isCallValid, context, n, buffersPacked);
10787     }
10788     else
10789     {
10790         GenerateContextLostErrorOnCurrentGlobalContext();
10791     }
10792 }
10793 
GL_DeleteQueries(GLsizei n,const GLuint * ids)10794 void GL_APIENTRY GL_DeleteQueries(GLsizei n, const GLuint *ids)
10795 {
10796     Context *context = GetValidGlobalContext();
10797     EVENT(context, GLDeleteQueries, "context = %d, n = %d, ids = 0x%016" PRIxPTR "", CID(context),
10798           n, (uintptr_t)ids);
10799 
10800     if (context)
10801     {
10802         const QueryID *idsPacked                              = PackParam<const QueryID *>(ids);
10803         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10804         bool isCallValid =
10805             (context->skipValidation() ||
10806              ValidateDeleteQueries(context, angle::EntryPoint::GLDeleteQueries, n, idsPacked));
10807         if (isCallValid)
10808         {
10809             context->deleteQueries(n, idsPacked);
10810         }
10811         ANGLE_CAPTURE(DeleteQueries, isCallValid, context, n, idsPacked);
10812     }
10813     else
10814     {
10815         GenerateContextLostErrorOnCurrentGlobalContext();
10816     }
10817 }
10818 
GL_EndQuery(GLenum target)10819 void GL_APIENTRY GL_EndQuery(GLenum target)
10820 {
10821     Context *context = GetValidGlobalContext();
10822     EVENT(context, GLEndQuery, "context = %d, target = %s", CID(context),
10823           GLenumToString(GLenumGroup::QueryTarget, target));
10824 
10825     if (context)
10826     {
10827         QueryType targetPacked                                = PackParam<QueryType>(target);
10828         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10829         bool isCallValid                                      = (context->skipValidation() ||
10830                             ValidateEndQuery(context, angle::EntryPoint::GLEndQuery, targetPacked));
10831         if (isCallValid)
10832         {
10833             context->endQuery(targetPacked);
10834         }
10835         ANGLE_CAPTURE(EndQuery, isCallValid, context, targetPacked);
10836     }
10837     else
10838     {
10839         GenerateContextLostErrorOnCurrentGlobalContext();
10840     }
10841 }
10842 
GL_GenBuffers(GLsizei n,GLuint * buffers)10843 void GL_APIENTRY GL_GenBuffers(GLsizei n, GLuint *buffers)
10844 {
10845     Context *context = GetValidGlobalContext();
10846     EVENT(context, GLGenBuffers, "context = %d, n = %d, buffers = 0x%016" PRIxPTR "", CID(context),
10847           n, (uintptr_t)buffers);
10848 
10849     if (context)
10850     {
10851         BufferID *buffersPacked                               = PackParam<BufferID *>(buffers);
10852         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10853         bool isCallValid =
10854             (context->skipValidation() ||
10855              ValidateGenBuffers(context, angle::EntryPoint::GLGenBuffers, n, buffersPacked));
10856         if (isCallValid)
10857         {
10858             context->genBuffers(n, buffersPacked);
10859         }
10860         ANGLE_CAPTURE(GenBuffers, isCallValid, context, n, buffersPacked);
10861     }
10862     else
10863     {
10864         GenerateContextLostErrorOnCurrentGlobalContext();
10865     }
10866 }
10867 
GL_GenQueries(GLsizei n,GLuint * ids)10868 void GL_APIENTRY GL_GenQueries(GLsizei n, GLuint *ids)
10869 {
10870     Context *context = GetValidGlobalContext();
10871     EVENT(context, GLGenQueries, "context = %d, n = %d, ids = 0x%016" PRIxPTR "", CID(context), n,
10872           (uintptr_t)ids);
10873 
10874     if (context)
10875     {
10876         QueryID *idsPacked                                    = PackParam<QueryID *>(ids);
10877         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10878         bool isCallValid =
10879             (context->skipValidation() ||
10880              ValidateGenQueries(context, angle::EntryPoint::GLGenQueries, n, idsPacked));
10881         if (isCallValid)
10882         {
10883             context->genQueries(n, idsPacked);
10884         }
10885         ANGLE_CAPTURE(GenQueries, isCallValid, context, n, idsPacked);
10886     }
10887     else
10888     {
10889         GenerateContextLostErrorOnCurrentGlobalContext();
10890     }
10891 }
10892 
GL_GetBufferParameteriv(GLenum target,GLenum pname,GLint * params)10893 void GL_APIENTRY GL_GetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
10894 {
10895     Context *context = GetValidGlobalContext();
10896     EVENT(context, GLGetBufferParameteriv,
10897           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
10898           GLenumToString(GLenumGroup::BufferTargetARB, target),
10899           GLenumToString(GLenumGroup::DefaultGroup, pname), (uintptr_t)params);
10900 
10901     if (context)
10902     {
10903         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
10904         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10905         bool isCallValid =
10906             (context->skipValidation() ||
10907              ValidateGetBufferParameteriv(context, angle::EntryPoint::GLGetBufferParameteriv,
10908                                           targetPacked, pname, params));
10909         if (isCallValid)
10910         {
10911             context->getBufferParameteriv(targetPacked, pname, params);
10912         }
10913         ANGLE_CAPTURE(GetBufferParameteriv, isCallValid, context, targetPacked, pname, params);
10914     }
10915     else
10916     {
10917         GenerateContextLostErrorOnCurrentGlobalContext();
10918     }
10919 }
10920 
GL_GetBufferPointerv(GLenum target,GLenum pname,void ** params)10921 void GL_APIENTRY GL_GetBufferPointerv(GLenum target, GLenum pname, void **params)
10922 {
10923     Context *context = GetValidGlobalContext();
10924     EVENT(context, GLGetBufferPointerv,
10925           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
10926           GLenumToString(GLenumGroup::BufferTargetARB, target),
10927           GLenumToString(GLenumGroup::DefaultGroup, pname), (uintptr_t)params);
10928 
10929     if (context)
10930     {
10931         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
10932         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10933         bool isCallValid =
10934             (context->skipValidation() ||
10935              ValidateGetBufferPointerv(context, angle::EntryPoint::GLGetBufferPointerv,
10936                                        targetPacked, pname, params));
10937         if (isCallValid)
10938         {
10939             context->getBufferPointerv(targetPacked, pname, params);
10940         }
10941         ANGLE_CAPTURE(GetBufferPointerv, isCallValid, context, targetPacked, pname, params);
10942     }
10943     else
10944     {
10945         GenerateContextLostErrorOnCurrentGlobalContext();
10946     }
10947 }
10948 
GL_GetBufferSubData(GLenum target,GLintptr offset,GLsizeiptr size,void * data)10949 void GL_APIENTRY GL_GetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, void *data)
10950 {
10951     Context *context = GetValidGlobalContext();
10952     EVENT(context, GLGetBufferSubData,
10953           "context = %d, target = %s, offset = %llu, size = %llu, data = 0x%016" PRIxPTR "",
10954           CID(context), GLenumToString(GLenumGroup::BufferTargetARB, target),
10955           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size),
10956           (uintptr_t)data);
10957 
10958     if (context)
10959     {
10960         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10961         bool isCallValid                                      = (context->skipValidation() ||
10962                             ValidateGetBufferSubData(context, angle::EntryPoint::GLGetBufferSubData,
10963                                                      target, offset, size, data));
10964         if (isCallValid)
10965         {
10966             context->getBufferSubData(target, offset, size, data);
10967         }
10968         ANGLE_CAPTURE(GetBufferSubData, isCallValid, context, target, offset, size, data);
10969     }
10970     else
10971     {
10972         GenerateContextLostErrorOnCurrentGlobalContext();
10973     }
10974 }
10975 
GL_GetQueryObjectiv(GLuint id,GLenum pname,GLint * params)10976 void GL_APIENTRY GL_GetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
10977 {
10978     Context *context = GetGlobalContext();
10979     EVENT(context, GLGetQueryObjectiv,
10980           "context = %d, id = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), id,
10981           GLenumToString(GLenumGroup::QueryObjectParameterName, pname), (uintptr_t)params);
10982 
10983     if (context)
10984     {
10985         QueryID idPacked                                      = PackParam<QueryID>(id);
10986         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10987         bool isCallValid                                      = (context->skipValidation() ||
10988                             ValidateGetQueryObjectiv(context, angle::EntryPoint::GLGetQueryObjectiv,
10989                                                      idPacked, pname, params));
10990         if (isCallValid)
10991         {
10992             context->getQueryObjectiv(idPacked, pname, params);
10993         }
10994         ANGLE_CAPTURE(GetQueryObjectiv, isCallValid, context, idPacked, pname, params);
10995     }
10996     else
10997     {}
10998 }
10999 
GL_GetQueryObjectuiv(GLuint id,GLenum pname,GLuint * params)11000 void GL_APIENTRY GL_GetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
11001 {
11002     Context *context = GetValidGlobalContext();
11003     EVENT(context, GLGetQueryObjectuiv,
11004           "context = %d, id = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), id,
11005           GLenumToString(GLenumGroup::QueryObjectParameterName, pname), (uintptr_t)params);
11006 
11007     if (context)
11008     {
11009         QueryID idPacked                                      = PackParam<QueryID>(id);
11010         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
11011         bool isCallValid =
11012             (context->skipValidation() ||
11013              ValidateGetQueryObjectuiv(context, angle::EntryPoint::GLGetQueryObjectuiv, idPacked,
11014                                        pname, params));
11015         if (isCallValid)
11016         {
11017             context->getQueryObjectuiv(idPacked, pname, params);
11018         }
11019         ANGLE_CAPTURE(GetQueryObjectuiv, isCallValid, context, idPacked, pname, params);
11020     }
11021     else
11022     {
11023         GenerateContextLostErrorOnCurrentGlobalContext();
11024     }
11025 }
11026 
GL_GetQueryiv(GLenum target,GLenum pname,GLint * params)11027 void GL_APIENTRY GL_GetQueryiv(GLenum target, GLenum pname, GLint *params)
11028 {
11029     Context *context = GetValidGlobalContext();
11030     EVENT(context, GLGetQueryiv,
11031           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
11032           GLenumToString(GLenumGroup::QueryTarget, target),
11033           GLenumToString(GLenumGroup::QueryParameterName, pname), (uintptr_t)params);
11034 
11035     if (context)
11036     {
11037         QueryType targetPacked                                = PackParam<QueryType>(target);
11038         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
11039         bool isCallValid                                      = (context->skipValidation() ||
11040                             ValidateGetQueryiv(context, angle::EntryPoint::GLGetQueryiv,
11041                                                targetPacked, pname, params));
11042         if (isCallValid)
11043         {
11044             context->getQueryiv(targetPacked, pname, params);
11045         }
11046         ANGLE_CAPTURE(GetQueryiv, isCallValid, context, targetPacked, pname, params);
11047     }
11048     else
11049     {
11050         GenerateContextLostErrorOnCurrentGlobalContext();
11051     }
11052 }
11053 
GL_IsBuffer(GLuint buffer)11054 GLboolean GL_APIENTRY GL_IsBuffer(GLuint buffer)
11055 {
11056     Context *context = GetValidGlobalContext();
11057     EVENT(context, GLIsBuffer, "context = %d, buffer = %u", CID(context), buffer);
11058 
11059     GLboolean returnValue;
11060     if (context)
11061     {
11062         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
11063         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
11064         bool isCallValid                                      = (context->skipValidation() ||
11065                             ValidateIsBuffer(context, angle::EntryPoint::GLIsBuffer, bufferPacked));
11066         if (isCallValid)
11067         {
11068             returnValue = context->isBuffer(bufferPacked);
11069         }
11070         else
11071         {
11072             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsBuffer, GLboolean>();
11073         }
11074         ANGLE_CAPTURE(IsBuffer, isCallValid, context, bufferPacked, returnValue);
11075     }
11076     else
11077     {
11078         GenerateContextLostErrorOnCurrentGlobalContext();
11079         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsBuffer, GLboolean>();
11080     }
11081     return returnValue;
11082 }
11083 
GL_IsQuery(GLuint id)11084 GLboolean GL_APIENTRY GL_IsQuery(GLuint id)
11085 {
11086     Context *context = GetValidGlobalContext();
11087     EVENT(context, GLIsQuery, "context = %d, id = %u", CID(context), id);
11088 
11089     GLboolean returnValue;
11090     if (context)
11091     {
11092         QueryID idPacked                                      = PackParam<QueryID>(id);
11093         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
11094         bool isCallValid                                      = (context->skipValidation() ||
11095                             ValidateIsQuery(context, angle::EntryPoint::GLIsQuery, idPacked));
11096         if (isCallValid)
11097         {
11098             returnValue = context->isQuery(idPacked);
11099         }
11100         else
11101         {
11102             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsQuery, GLboolean>();
11103         }
11104         ANGLE_CAPTURE(IsQuery, isCallValid, context, idPacked, returnValue);
11105     }
11106     else
11107     {
11108         GenerateContextLostErrorOnCurrentGlobalContext();
11109         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsQuery, GLboolean>();
11110     }
11111     return returnValue;
11112 }
11113 
GL_MapBuffer(GLenum target,GLenum access)11114 void *GL_APIENTRY GL_MapBuffer(GLenum target, GLenum access)
11115 {
11116     Context *context = GetValidGlobalContext();
11117     EVENT(context, GLMapBuffer, "context = %d, target = %s, access = %s", CID(context),
11118           GLenumToString(GLenumGroup::BufferTargetARB, target),
11119           GLenumToString(GLenumGroup::BufferAccessARB, access));
11120 
11121     void *returnValue;
11122     if (context)
11123     {
11124         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
11125         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
11126         bool isCallValid =
11127             (context->skipValidation() ||
11128              ValidateMapBuffer(context, angle::EntryPoint::GLMapBuffer, targetPacked, access));
11129         if (isCallValid)
11130         {
11131             returnValue = context->mapBuffer(targetPacked, access);
11132         }
11133         else
11134         {
11135             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapBuffer, void *>();
11136         }
11137         ANGLE_CAPTURE(MapBuffer, isCallValid, context, targetPacked, access, returnValue);
11138     }
11139     else
11140     {
11141         GenerateContextLostErrorOnCurrentGlobalContext();
11142         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapBuffer, void *>();
11143     }
11144     return returnValue;
11145 }
11146 
GL_UnmapBuffer(GLenum target)11147 GLboolean GL_APIENTRY GL_UnmapBuffer(GLenum target)
11148 {
11149     Context *context = GetValidGlobalContext();
11150     EVENT(context, GLUnmapBuffer, "context = %d, target = %s", CID(context),
11151           GLenumToString(GLenumGroup::BufferTargetARB, target));
11152 
11153     GLboolean returnValue;
11154     if (context)
11155     {
11156         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
11157         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
11158         bool isCallValid =
11159             (context->skipValidation() ||
11160              ValidateUnmapBuffer(context, angle::EntryPoint::GLUnmapBuffer, targetPacked));
11161         if (isCallValid)
11162         {
11163             returnValue = context->unmapBuffer(targetPacked);
11164         }
11165         else
11166         {
11167             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLUnmapBuffer, GLboolean>();
11168         }
11169         ANGLE_CAPTURE(UnmapBuffer, isCallValid, context, targetPacked, returnValue);
11170     }
11171     else
11172     {
11173         GenerateContextLostErrorOnCurrentGlobalContext();
11174         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLUnmapBuffer, GLboolean>();
11175     }
11176     return returnValue;
11177 }
11178 
11179 }  // extern "C"
11180