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_3_autogen.cpp:
9 //   Defines the Desktop GL 3.x entry points.
10 
11 #include "libGL/entry_points_gl_3_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/validationGL3_autogen.h"
26 #include "libGLESv2/global_state.h"
27 
28 using namespace gl;
29 
30 extern "C" {
31 
32 // GL 3.0
GL_BeginConditionalRender(GLuint id,GLenum mode)33 void GL_APIENTRY GL_BeginConditionalRender(GLuint id, GLenum mode)
34 {
35     Context *context = GetValidGlobalContext();
36     EVENT(context, GLBeginConditionalRender, "context = %d, id = %u, mode = %s", CID(context), id,
37           GLenumToString(GLenumGroup::TypeEnum, mode));
38 
39     if (context)
40     {
41         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
42         bool isCallValid =
43             (context->skipValidation() || ValidateBeginConditionalRender(context, id, mode));
44         if (isCallValid)
45         {
46             context->beginConditionalRender(id, mode);
47         }
48         ANGLE_CAPTURE(BeginConditionalRender, isCallValid, context, id, mode);
49     }
50     else
51     {
52         GenerateContextLostErrorOnCurrentGlobalContext();
53     }
54 }
55 
GL_BeginTransformFeedback(GLenum primitiveMode)56 void GL_APIENTRY GL_BeginTransformFeedback(GLenum primitiveMode)
57 {
58     Context *context = GetValidGlobalContext();
59     EVENT(context, GLBeginTransformFeedback, "context = %d, primitiveMode = %s", CID(context),
60           GLenumToString(GLenumGroup::PrimitiveType, primitiveMode));
61 
62     if (context)
63     {
64         PrimitiveMode primitiveModePacked = PackParam<PrimitiveMode>(primitiveMode);
65         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
66         bool isCallValid                                      = (context->skipValidation() ||
67                             ValidateBeginTransformFeedback(context, primitiveModePacked));
68         if (isCallValid)
69         {
70             context->beginTransformFeedback(primitiveModePacked);
71         }
72         ANGLE_CAPTURE(BeginTransformFeedback, isCallValid, context, primitiveModePacked);
73     }
74     else
75     {
76         GenerateContextLostErrorOnCurrentGlobalContext();
77     }
78 }
79 
GL_BindBufferBase(GLenum target,GLuint index,GLuint buffer)80 void GL_APIENTRY GL_BindBufferBase(GLenum target, GLuint index, GLuint buffer)
81 {
82     Context *context = GetValidGlobalContext();
83     EVENT(context, GLBindBufferBase, "context = %d, target = %s, index = %u, buffer = %u",
84           CID(context), GLenumToString(GLenumGroup::BufferTargetARB, target), index, buffer);
85 
86     if (context)
87     {
88         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
89         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
90         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
91         bool isCallValid                                      = (context->skipValidation() ||
92                             ValidateBindBufferBase(context, targetPacked, index, bufferPacked));
93         if (isCallValid)
94         {
95             context->bindBufferBase(targetPacked, index, bufferPacked);
96         }
97         ANGLE_CAPTURE(BindBufferBase, isCallValid, context, targetPacked, index, bufferPacked);
98     }
99     else
100     {
101         GenerateContextLostErrorOnCurrentGlobalContext();
102     }
103 }
104 
105 void GL_APIENTRY
GL_BindBufferRange(GLenum target,GLuint index,GLuint buffer,GLintptr offset,GLsizeiptr size)106 GL_BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
107 {
108     Context *context = GetValidGlobalContext();
109     EVENT(context, GLBindBufferRange,
110           "context = %d, target = %s, index = %u, buffer = %u, offset = %llu, size = %llu",
111           CID(context), GLenumToString(GLenumGroup::BufferTargetARB, target), index, buffer,
112           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size));
113 
114     if (context)
115     {
116         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
117         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
118         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
119         bool isCallValid =
120             (context->skipValidation() ||
121              ValidateBindBufferRange(context, targetPacked, index, bufferPacked, offset, size));
122         if (isCallValid)
123         {
124             context->bindBufferRange(targetPacked, index, bufferPacked, offset, size);
125         }
126         ANGLE_CAPTURE(BindBufferRange, isCallValid, context, targetPacked, index, bufferPacked,
127                       offset, size);
128     }
129     else
130     {
131         GenerateContextLostErrorOnCurrentGlobalContext();
132     }
133 }
134 
GL_BindFragDataLocation(GLuint program,GLuint color,const GLchar * name)135 void GL_APIENTRY GL_BindFragDataLocation(GLuint program, GLuint color, const GLchar *name)
136 {
137     Context *context = GetValidGlobalContext();
138     EVENT(context, GLBindFragDataLocation,
139           "context = %d, program = %u, color = %u, name = 0x%016" PRIxPTR "", CID(context), program,
140           color, (uintptr_t)name);
141 
142     if (context)
143     {
144         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
145         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
146         bool isCallValid                                      = (context->skipValidation() ||
147                             ValidateBindFragDataLocation(context, programPacked, color, name));
148         if (isCallValid)
149         {
150             context->bindFragDataLocation(programPacked, color, name);
151         }
152         ANGLE_CAPTURE(BindFragDataLocation, isCallValid, context, programPacked, color, name);
153     }
154     else
155     {
156         GenerateContextLostErrorOnCurrentGlobalContext();
157     }
158 }
159 
GL_BindFramebuffer(GLenum target,GLuint framebuffer)160 void GL_APIENTRY GL_BindFramebuffer(GLenum target, GLuint framebuffer)
161 {
162     Context *context = GetValidGlobalContext();
163     EVENT(context, GLBindFramebuffer, "context = %d, target = %s, framebuffer = %u", CID(context),
164           GLenumToString(GLenumGroup::FramebufferTarget, target), framebuffer);
165 
166     if (context)
167     {
168         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
169         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
170         bool isCallValid                                      = (context->skipValidation() ||
171                             ValidateBindFramebuffer(context, target, framebufferPacked));
172         if (isCallValid)
173         {
174             context->bindFramebuffer(target, framebufferPacked);
175         }
176         ANGLE_CAPTURE(BindFramebuffer, isCallValid, context, target, framebufferPacked);
177     }
178     else
179     {
180         GenerateContextLostErrorOnCurrentGlobalContext();
181     }
182 }
183 
GL_BindRenderbuffer(GLenum target,GLuint renderbuffer)184 void GL_APIENTRY GL_BindRenderbuffer(GLenum target, GLuint renderbuffer)
185 {
186     Context *context = GetValidGlobalContext();
187     EVENT(context, GLBindRenderbuffer, "context = %d, target = %s, renderbuffer = %u", CID(context),
188           GLenumToString(GLenumGroup::RenderbufferTarget, target), renderbuffer);
189 
190     if (context)
191     {
192         RenderbufferID renderbufferPacked = PackParam<RenderbufferID>(renderbuffer);
193         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
194         bool isCallValid                                      = (context->skipValidation() ||
195                             ValidateBindRenderbuffer(context, target, renderbufferPacked));
196         if (isCallValid)
197         {
198             context->bindRenderbuffer(target, renderbufferPacked);
199         }
200         ANGLE_CAPTURE(BindRenderbuffer, isCallValid, context, target, renderbufferPacked);
201     }
202     else
203     {
204         GenerateContextLostErrorOnCurrentGlobalContext();
205     }
206 }
207 
GL_BindVertexArray(GLuint array)208 void GL_APIENTRY GL_BindVertexArray(GLuint array)
209 {
210     Context *context = GetValidGlobalContext();
211     EVENT(context, GLBindVertexArray, "context = %d, array = %u", CID(context), array);
212 
213     if (context)
214     {
215         VertexArrayID arrayPacked                             = PackParam<VertexArrayID>(array);
216         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
217         bool isCallValid =
218             (context->skipValidation() || ValidateBindVertexArray(context, arrayPacked));
219         if (isCallValid)
220         {
221             context->bindVertexArray(arrayPacked);
222         }
223         ANGLE_CAPTURE(BindVertexArray, isCallValid, context, arrayPacked);
224     }
225     else
226     {
227         GenerateContextLostErrorOnCurrentGlobalContext();
228     }
229 }
230 
GL_BlitFramebuffer(GLint srcX0,GLint srcY0,GLint srcX1,GLint srcY1,GLint dstX0,GLint dstY0,GLint dstX1,GLint dstY1,GLbitfield mask,GLenum filter)231 void GL_APIENTRY GL_BlitFramebuffer(GLint srcX0,
232                                     GLint srcY0,
233                                     GLint srcX1,
234                                     GLint srcY1,
235                                     GLint dstX0,
236                                     GLint dstY0,
237                                     GLint dstX1,
238                                     GLint dstY1,
239                                     GLbitfield mask,
240                                     GLenum filter)
241 {
242     Context *context = GetValidGlobalContext();
243     EVENT(context, GLBlitFramebuffer,
244           "context = %d, srcX0 = %d, srcY0 = %d, srcX1 = %d, srcY1 = %d, dstX0 = %d, dstY0 = %d, "
245           "dstX1 = %d, dstY1 = %d, mask = %s, filter = %s",
246           CID(context), srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
247           GLbitfieldToString(GLenumGroup::ClearBufferMask, mask).c_str(),
248           GLenumToString(GLenumGroup::BlitFramebufferFilter, filter));
249 
250     if (context)
251     {
252         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
253         bool isCallValid                                      = (context->skipValidation() ||
254                             ValidateBlitFramebuffer(context, srcX0, srcY0, srcX1, srcY1, dstX0,
255                                                     dstY0, dstX1, dstY1, mask, filter));
256         if (isCallValid)
257         {
258             context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask,
259                                      filter);
260         }
261         ANGLE_CAPTURE(BlitFramebuffer, isCallValid, context, srcX0, srcY0, srcX1, srcY1, dstX0,
262                       dstY0, dstX1, dstY1, mask, filter);
263     }
264     else
265     {
266         GenerateContextLostErrorOnCurrentGlobalContext();
267     }
268 }
269 
GL_CheckFramebufferStatus(GLenum target)270 GLenum GL_APIENTRY GL_CheckFramebufferStatus(GLenum target)
271 {
272     Context *context = GetValidGlobalContext();
273     EVENT(context, GLCheckFramebufferStatus, "context = %d, target = %s", CID(context),
274           GLenumToString(GLenumGroup::FramebufferTarget, target));
275 
276     GLenum returnValue;
277     if (context)
278     {
279         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
280         bool isCallValid =
281             (context->skipValidation() || ValidateCheckFramebufferStatus(context, target));
282         if (isCallValid)
283         {
284             returnValue = context->checkFramebufferStatus(target);
285         }
286         else
287         {
288             returnValue =
289                 GetDefaultReturnValue<angle::EntryPoint::GLCheckFramebufferStatus, GLenum>();
290         }
291         ANGLE_CAPTURE(CheckFramebufferStatus, isCallValid, context, target, returnValue);
292     }
293     else
294     {
295         GenerateContextLostErrorOnCurrentGlobalContext();
296         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLCheckFramebufferStatus, GLenum>();
297     }
298     return returnValue;
299 }
300 
GL_ClampColor(GLenum target,GLenum clamp)301 void GL_APIENTRY GL_ClampColor(GLenum target, GLenum clamp)
302 {
303     Context *context = GetValidGlobalContext();
304     EVENT(context, GLClampColor, "context = %d, target = %s, clamp = %s", CID(context),
305           GLenumToString(GLenumGroup::DefaultGroup, target),
306           GLenumToString(GLenumGroup::DefaultGroup, clamp));
307 
308     if (context)
309     {
310         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
311         bool isCallValid =
312             (context->skipValidation() || ValidateClampColor(context, target, clamp));
313         if (isCallValid)
314         {
315             context->clampColor(target, clamp);
316         }
317         ANGLE_CAPTURE(ClampColor, isCallValid, context, target, clamp);
318     }
319     else
320     {
321         GenerateContextLostErrorOnCurrentGlobalContext();
322     }
323 }
324 
GL_ClearBufferfi(GLenum buffer,GLint drawbuffer,GLfloat depth,GLint stencil)325 void GL_APIENTRY GL_ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
326 {
327     Context *context = GetValidGlobalContext();
328     EVENT(context, GLClearBufferfi,
329           "context = %d, buffer = %s, drawbuffer = %d, depth = %f, stencil = %d", CID(context),
330           GLenumToString(GLenumGroup::Buffer, buffer), drawbuffer, depth, stencil);
331 
332     if (context)
333     {
334         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
335         bool isCallValid                                      = (context->skipValidation() ||
336                             ValidateClearBufferfi(context, buffer, drawbuffer, depth, stencil));
337         if (isCallValid)
338         {
339             context->clearBufferfi(buffer, drawbuffer, depth, stencil);
340         }
341         ANGLE_CAPTURE(ClearBufferfi, isCallValid, context, buffer, drawbuffer, depth, stencil);
342     }
343     else
344     {
345         GenerateContextLostErrorOnCurrentGlobalContext();
346     }
347 }
348 
GL_ClearBufferfv(GLenum buffer,GLint drawbuffer,const GLfloat * value)349 void GL_APIENTRY GL_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
350 {
351     Context *context = GetValidGlobalContext();
352     EVENT(context, GLClearBufferfv,
353           "context = %d, buffer = %s, drawbuffer = %d, value = 0x%016" PRIxPTR "", CID(context),
354           GLenumToString(GLenumGroup::Buffer, buffer), drawbuffer, (uintptr_t)value);
355 
356     if (context)
357     {
358         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
359         bool isCallValid                                      = (context->skipValidation() ||
360                             ValidateClearBufferfv(context, buffer, drawbuffer, value));
361         if (isCallValid)
362         {
363             context->clearBufferfv(buffer, drawbuffer, value);
364         }
365         ANGLE_CAPTURE(ClearBufferfv, isCallValid, context, buffer, drawbuffer, value);
366     }
367     else
368     {
369         GenerateContextLostErrorOnCurrentGlobalContext();
370     }
371 }
372 
GL_ClearBufferiv(GLenum buffer,GLint drawbuffer,const GLint * value)373 void GL_APIENTRY GL_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
374 {
375     Context *context = GetValidGlobalContext();
376     EVENT(context, GLClearBufferiv,
377           "context = %d, buffer = %s, drawbuffer = %d, value = 0x%016" PRIxPTR "", CID(context),
378           GLenumToString(GLenumGroup::Buffer, buffer), drawbuffer, (uintptr_t)value);
379 
380     if (context)
381     {
382         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
383         bool isCallValid                                      = (context->skipValidation() ||
384                             ValidateClearBufferiv(context, buffer, drawbuffer, value));
385         if (isCallValid)
386         {
387             context->clearBufferiv(buffer, drawbuffer, value);
388         }
389         ANGLE_CAPTURE(ClearBufferiv, isCallValid, context, buffer, drawbuffer, value);
390     }
391     else
392     {
393         GenerateContextLostErrorOnCurrentGlobalContext();
394     }
395 }
396 
GL_ClearBufferuiv(GLenum buffer,GLint drawbuffer,const GLuint * value)397 void GL_APIENTRY GL_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
398 {
399     Context *context = GetValidGlobalContext();
400     EVENT(context, GLClearBufferuiv,
401           "context = %d, buffer = %s, drawbuffer = %d, value = 0x%016" PRIxPTR "", CID(context),
402           GLenumToString(GLenumGroup::Buffer, buffer), drawbuffer, (uintptr_t)value);
403 
404     if (context)
405     {
406         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
407         bool isCallValid                                      = (context->skipValidation() ||
408                             ValidateClearBufferuiv(context, buffer, drawbuffer, value));
409         if (isCallValid)
410         {
411             context->clearBufferuiv(buffer, drawbuffer, value);
412         }
413         ANGLE_CAPTURE(ClearBufferuiv, isCallValid, context, buffer, drawbuffer, value);
414     }
415     else
416     {
417         GenerateContextLostErrorOnCurrentGlobalContext();
418     }
419 }
420 
GL_ColorMaski(GLuint index,GLboolean r,GLboolean g,GLboolean b,GLboolean a)421 void GL_APIENTRY GL_ColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
422 {
423     Context *context = GetValidGlobalContext();
424     EVENT(context, GLColorMaski, "context = %d, index = %u, r = %s, g = %s, b = %s, a = %s",
425           CID(context), index, GLbooleanToString(r), GLbooleanToString(g), GLbooleanToString(b),
426           GLbooleanToString(a));
427 
428     if (context)
429     {
430         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
431         bool isCallValid =
432             (context->skipValidation() || ValidateColorMaski(context, index, r, g, b, a));
433         if (isCallValid)
434         {
435             context->colorMaski(index, r, g, b, a);
436         }
437         ANGLE_CAPTURE(ColorMaski, isCallValid, context, index, r, g, b, a);
438     }
439     else
440     {
441         GenerateContextLostErrorOnCurrentGlobalContext();
442     }
443 }
444 
GL_DeleteFramebuffers(GLsizei n,const GLuint * framebuffers)445 void GL_APIENTRY GL_DeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
446 {
447     Context *context = GetValidGlobalContext();
448     EVENT(context, GLDeleteFramebuffers, "context = %d, n = %d, framebuffers = 0x%016" PRIxPTR "",
449           CID(context), n, (uintptr_t)framebuffers);
450 
451     if (context)
452     {
453         const FramebufferID *framebuffersPacked = PackParam<const FramebufferID *>(framebuffers);
454         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
455         bool isCallValid                                      = (context->skipValidation() ||
456                             ValidateDeleteFramebuffers(context, n, framebuffersPacked));
457         if (isCallValid)
458         {
459             context->deleteFramebuffers(n, framebuffersPacked);
460         }
461         ANGLE_CAPTURE(DeleteFramebuffers, isCallValid, context, n, framebuffersPacked);
462     }
463     else
464     {
465         GenerateContextLostErrorOnCurrentGlobalContext();
466     }
467 }
468 
GL_DeleteRenderbuffers(GLsizei n,const GLuint * renderbuffers)469 void GL_APIENTRY GL_DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
470 {
471     Context *context = GetValidGlobalContext();
472     EVENT(context, GLDeleteRenderbuffers, "context = %d, n = %d, renderbuffers = 0x%016" PRIxPTR "",
473           CID(context), n, (uintptr_t)renderbuffers);
474 
475     if (context)
476     {
477         const RenderbufferID *renderbuffersPacked =
478             PackParam<const RenderbufferID *>(renderbuffers);
479         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
480         bool isCallValid                                      = (context->skipValidation() ||
481                             ValidateDeleteRenderbuffers(context, n, renderbuffersPacked));
482         if (isCallValid)
483         {
484             context->deleteRenderbuffers(n, renderbuffersPacked);
485         }
486         ANGLE_CAPTURE(DeleteRenderbuffers, isCallValid, context, n, renderbuffersPacked);
487     }
488     else
489     {
490         GenerateContextLostErrorOnCurrentGlobalContext();
491     }
492 }
493 
GL_DeleteVertexArrays(GLsizei n,const GLuint * arrays)494 void GL_APIENTRY GL_DeleteVertexArrays(GLsizei n, const GLuint *arrays)
495 {
496     Context *context = GetValidGlobalContext();
497     EVENT(context, GLDeleteVertexArrays, "context = %d, n = %d, arrays = 0x%016" PRIxPTR "",
498           CID(context), n, (uintptr_t)arrays);
499 
500     if (context)
501     {
502         const VertexArrayID *arraysPacked = PackParam<const VertexArrayID *>(arrays);
503         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
504         bool isCallValid =
505             (context->skipValidation() || ValidateDeleteVertexArrays(context, n, arraysPacked));
506         if (isCallValid)
507         {
508             context->deleteVertexArrays(n, arraysPacked);
509         }
510         ANGLE_CAPTURE(DeleteVertexArrays, isCallValid, context, n, arraysPacked);
511     }
512     else
513     {
514         GenerateContextLostErrorOnCurrentGlobalContext();
515     }
516 }
517 
GL_Disablei(GLenum target,GLuint index)518 void GL_APIENTRY GL_Disablei(GLenum target, GLuint index)
519 {
520     Context *context = GetValidGlobalContext();
521     EVENT(context, GLDisablei, "context = %d, target = %s, index = %u", CID(context),
522           GLenumToString(GLenumGroup::EnableCap, target), index);
523 
524     if (context)
525     {
526         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
527         bool isCallValid = (context->skipValidation() || ValidateDisablei(context, target, index));
528         if (isCallValid)
529         {
530             context->disablei(target, index);
531         }
532         ANGLE_CAPTURE(Disablei, isCallValid, context, target, index);
533     }
534     else
535     {
536         GenerateContextLostErrorOnCurrentGlobalContext();
537     }
538 }
539 
GL_Enablei(GLenum target,GLuint index)540 void GL_APIENTRY GL_Enablei(GLenum target, GLuint index)
541 {
542     Context *context = GetValidGlobalContext();
543     EVENT(context, GLEnablei, "context = %d, target = %s, index = %u", CID(context),
544           GLenumToString(GLenumGroup::EnableCap, target), index);
545 
546     if (context)
547     {
548         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
549         bool isCallValid = (context->skipValidation() || ValidateEnablei(context, target, index));
550         if (isCallValid)
551         {
552             context->enablei(target, index);
553         }
554         ANGLE_CAPTURE(Enablei, isCallValid, context, target, index);
555     }
556     else
557     {
558         GenerateContextLostErrorOnCurrentGlobalContext();
559     }
560 }
561 
GL_EndConditionalRender()562 void GL_APIENTRY GL_EndConditionalRender()
563 {
564     Context *context = GetValidGlobalContext();
565     EVENT(context, GLEndConditionalRender, "context = %d", CID(context));
566 
567     if (context)
568     {
569         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
570         bool isCallValid = (context->skipValidation() || ValidateEndConditionalRender(context));
571         if (isCallValid)
572         {
573             context->endConditionalRender();
574         }
575         ANGLE_CAPTURE(EndConditionalRender, isCallValid, context);
576     }
577     else
578     {
579         GenerateContextLostErrorOnCurrentGlobalContext();
580     }
581 }
582 
GL_EndTransformFeedback()583 void GL_APIENTRY GL_EndTransformFeedback()
584 {
585     Context *context = GetValidGlobalContext();
586     EVENT(context, GLEndTransformFeedback, "context = %d", CID(context));
587 
588     if (context)
589     {
590         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
591         bool isCallValid = (context->skipValidation() || ValidateEndTransformFeedback(context));
592         if (isCallValid)
593         {
594             context->endTransformFeedback();
595         }
596         ANGLE_CAPTURE(EndTransformFeedback, isCallValid, context);
597     }
598     else
599     {
600         GenerateContextLostErrorOnCurrentGlobalContext();
601     }
602 }
603 
GL_FlushMappedBufferRange(GLenum target,GLintptr offset,GLsizeiptr length)604 void GL_APIENTRY GL_FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
605 {
606     Context *context = GetValidGlobalContext();
607     EVENT(context, GLFlushMappedBufferRange,
608           "context = %d, target = %s, offset = %llu, length = %llu", CID(context),
609           GLenumToString(GLenumGroup::BufferTargetARB, target),
610           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length));
611 
612     if (context)
613     {
614         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
615         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
616         bool isCallValid                                      = (context->skipValidation() ||
617                             ValidateFlushMappedBufferRange(context, targetPacked, offset, length));
618         if (isCallValid)
619         {
620             context->flushMappedBufferRange(targetPacked, offset, length);
621         }
622         ANGLE_CAPTURE(FlushMappedBufferRange, isCallValid, context, targetPacked, offset, length);
623     }
624     else
625     {
626         GenerateContextLostErrorOnCurrentGlobalContext();
627     }
628 }
629 
GL_FramebufferRenderbuffer(GLenum target,GLenum attachment,GLenum renderbuffertarget,GLuint renderbuffer)630 void GL_APIENTRY GL_FramebufferRenderbuffer(GLenum target,
631                                             GLenum attachment,
632                                             GLenum renderbuffertarget,
633                                             GLuint renderbuffer)
634 {
635     Context *context = GetValidGlobalContext();
636     EVENT(context, GLFramebufferRenderbuffer,
637           "context = %d, target = %s, attachment = %s, renderbuffertarget = %s, renderbuffer = %u",
638           CID(context), GLenumToString(GLenumGroup::FramebufferTarget, target),
639           GLenumToString(GLenumGroup::FramebufferAttachment, attachment),
640           GLenumToString(GLenumGroup::RenderbufferTarget, renderbuffertarget), renderbuffer);
641 
642     if (context)
643     {
644         RenderbufferID renderbufferPacked = PackParam<RenderbufferID>(renderbuffer);
645         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
646         bool isCallValid =
647             (context->skipValidation() ||
648              ValidateFramebufferRenderbuffer(context, target, attachment, renderbuffertarget,
649                                              renderbufferPacked));
650         if (isCallValid)
651         {
652             context->framebufferRenderbuffer(target, attachment, renderbuffertarget,
653                                              renderbufferPacked);
654         }
655         ANGLE_CAPTURE(FramebufferRenderbuffer, isCallValid, context, target, attachment,
656                       renderbuffertarget, renderbufferPacked);
657     }
658     else
659     {
660         GenerateContextLostErrorOnCurrentGlobalContext();
661     }
662 }
663 
GL_FramebufferTexture1D(GLenum target,GLenum attachment,GLenum textarget,GLuint texture,GLint level)664 void GL_APIENTRY GL_FramebufferTexture1D(GLenum target,
665                                          GLenum attachment,
666                                          GLenum textarget,
667                                          GLuint texture,
668                                          GLint level)
669 {
670     Context *context = GetValidGlobalContext();
671     EVENT(context, GLFramebufferTexture1D,
672           "context = %d, target = %s, attachment = %s, textarget = %s, texture = %u, level = %d",
673           CID(context), GLenumToString(GLenumGroup::FramebufferTarget, target),
674           GLenumToString(GLenumGroup::FramebufferAttachment, attachment),
675           GLenumToString(GLenumGroup::TextureTarget, textarget), texture, level);
676 
677     if (context)
678     {
679         TextureTarget textargetPacked                         = PackParam<TextureTarget>(textarget);
680         TextureID texturePacked                               = PackParam<TextureID>(texture);
681         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
682         bool isCallValid                                      = (context->skipValidation() ||
683                             ValidateFramebufferTexture1D(context, target, attachment,
684                                                          textargetPacked, texturePacked, level));
685         if (isCallValid)
686         {
687             context->framebufferTexture1D(target, attachment, textargetPacked, texturePacked,
688                                           level);
689         }
690         ANGLE_CAPTURE(FramebufferTexture1D, isCallValid, context, target, attachment,
691                       textargetPacked, texturePacked, level);
692     }
693     else
694     {
695         GenerateContextLostErrorOnCurrentGlobalContext();
696     }
697 }
698 
GL_FramebufferTexture2D(GLenum target,GLenum attachment,GLenum textarget,GLuint texture,GLint level)699 void GL_APIENTRY GL_FramebufferTexture2D(GLenum target,
700                                          GLenum attachment,
701                                          GLenum textarget,
702                                          GLuint texture,
703                                          GLint level)
704 {
705     Context *context = GetValidGlobalContext();
706     EVENT(context, GLFramebufferTexture2D,
707           "context = %d, target = %s, attachment = %s, textarget = %s, texture = %u, level = %d",
708           CID(context), GLenumToString(GLenumGroup::FramebufferTarget, target),
709           GLenumToString(GLenumGroup::FramebufferAttachment, attachment),
710           GLenumToString(GLenumGroup::TextureTarget, textarget), texture, level);
711 
712     if (context)
713     {
714         TextureTarget textargetPacked                         = PackParam<TextureTarget>(textarget);
715         TextureID texturePacked                               = PackParam<TextureID>(texture);
716         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
717         bool isCallValid                                      = (context->skipValidation() ||
718                             ValidateFramebufferTexture2D(context, target, attachment,
719                                                          textargetPacked, texturePacked, level));
720         if (isCallValid)
721         {
722             context->framebufferTexture2D(target, attachment, textargetPacked, texturePacked,
723                                           level);
724         }
725         ANGLE_CAPTURE(FramebufferTexture2D, isCallValid, context, target, attachment,
726                       textargetPacked, texturePacked, level);
727     }
728     else
729     {
730         GenerateContextLostErrorOnCurrentGlobalContext();
731     }
732 }
733 
GL_FramebufferTexture3D(GLenum target,GLenum attachment,GLenum textarget,GLuint texture,GLint level,GLint zoffset)734 void GL_APIENTRY GL_FramebufferTexture3D(GLenum target,
735                                          GLenum attachment,
736                                          GLenum textarget,
737                                          GLuint texture,
738                                          GLint level,
739                                          GLint zoffset)
740 {
741     Context *context = GetValidGlobalContext();
742     EVENT(context, GLFramebufferTexture3D,
743           "context = %d, target = %s, attachment = %s, textarget = %s, texture = %u, level = %d, "
744           "zoffset = %d",
745           CID(context), GLenumToString(GLenumGroup::FramebufferTarget, target),
746           GLenumToString(GLenumGroup::FramebufferAttachment, attachment),
747           GLenumToString(GLenumGroup::TextureTarget, textarget), texture, level, zoffset);
748 
749     if (context)
750     {
751         TextureTarget textargetPacked                         = PackParam<TextureTarget>(textarget);
752         TextureID texturePacked                               = PackParam<TextureID>(texture);
753         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
754         bool isCallValid =
755             (context->skipValidation() ||
756              ValidateFramebufferTexture3D(context, target, attachment, textargetPacked,
757                                           texturePacked, level, zoffset));
758         if (isCallValid)
759         {
760             context->framebufferTexture3D(target, attachment, textargetPacked, texturePacked, level,
761                                           zoffset);
762         }
763         ANGLE_CAPTURE(FramebufferTexture3D, isCallValid, context, target, attachment,
764                       textargetPacked, texturePacked, level, zoffset);
765     }
766     else
767     {
768         GenerateContextLostErrorOnCurrentGlobalContext();
769     }
770 }
771 
GL_FramebufferTextureLayer(GLenum target,GLenum attachment,GLuint texture,GLint level,GLint layer)772 void GL_APIENTRY GL_FramebufferTextureLayer(GLenum target,
773                                             GLenum attachment,
774                                             GLuint texture,
775                                             GLint level,
776                                             GLint layer)
777 {
778     Context *context = GetValidGlobalContext();
779     EVENT(context, GLFramebufferTextureLayer,
780           "context = %d, target = %s, attachment = %s, texture = %u, level = %d, layer = %d",
781           CID(context), GLenumToString(GLenumGroup::FramebufferTarget, target),
782           GLenumToString(GLenumGroup::FramebufferAttachment, attachment), texture, level, layer);
783 
784     if (context)
785     {
786         TextureID texturePacked                               = PackParam<TextureID>(texture);
787         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
788         bool isCallValid                                      = (context->skipValidation() ||
789                             ValidateFramebufferTextureLayer(context, target, attachment,
790                                                             texturePacked, level, layer));
791         if (isCallValid)
792         {
793             context->framebufferTextureLayer(target, attachment, texturePacked, level, layer);
794         }
795         ANGLE_CAPTURE(FramebufferTextureLayer, isCallValid, context, target, attachment,
796                       texturePacked, level, layer);
797     }
798     else
799     {
800         GenerateContextLostErrorOnCurrentGlobalContext();
801     }
802 }
803 
GL_GenFramebuffers(GLsizei n,GLuint * framebuffers)804 void GL_APIENTRY GL_GenFramebuffers(GLsizei n, GLuint *framebuffers)
805 {
806     Context *context = GetValidGlobalContext();
807     EVENT(context, GLGenFramebuffers, "context = %d, n = %d, framebuffers = 0x%016" PRIxPTR "",
808           CID(context), n, (uintptr_t)framebuffers);
809 
810     if (context)
811     {
812         FramebufferID *framebuffersPacked = PackParam<FramebufferID *>(framebuffers);
813         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
814         bool isCallValid =
815             (context->skipValidation() || ValidateGenFramebuffers(context, n, framebuffersPacked));
816         if (isCallValid)
817         {
818             context->genFramebuffers(n, framebuffersPacked);
819         }
820         ANGLE_CAPTURE(GenFramebuffers, isCallValid, context, n, framebuffersPacked);
821     }
822     else
823     {
824         GenerateContextLostErrorOnCurrentGlobalContext();
825     }
826 }
827 
GL_GenRenderbuffers(GLsizei n,GLuint * renderbuffers)828 void GL_APIENTRY GL_GenRenderbuffers(GLsizei n, GLuint *renderbuffers)
829 {
830     Context *context = GetValidGlobalContext();
831     EVENT(context, GLGenRenderbuffers, "context = %d, n = %d, renderbuffers = 0x%016" PRIxPTR "",
832           CID(context), n, (uintptr_t)renderbuffers);
833 
834     if (context)
835     {
836         RenderbufferID *renderbuffersPacked = PackParam<RenderbufferID *>(renderbuffers);
837         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
838         bool isCallValid                                      = (context->skipValidation() ||
839                             ValidateGenRenderbuffers(context, n, renderbuffersPacked));
840         if (isCallValid)
841         {
842             context->genRenderbuffers(n, renderbuffersPacked);
843         }
844         ANGLE_CAPTURE(GenRenderbuffers, isCallValid, context, n, renderbuffersPacked);
845     }
846     else
847     {
848         GenerateContextLostErrorOnCurrentGlobalContext();
849     }
850 }
851 
GL_GenVertexArrays(GLsizei n,GLuint * arrays)852 void GL_APIENTRY GL_GenVertexArrays(GLsizei n, GLuint *arrays)
853 {
854     Context *context = GetValidGlobalContext();
855     EVENT(context, GLGenVertexArrays, "context = %d, n = %d, arrays = 0x%016" PRIxPTR "",
856           CID(context), n, (uintptr_t)arrays);
857 
858     if (context)
859     {
860         VertexArrayID *arraysPacked                           = PackParam<VertexArrayID *>(arrays);
861         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
862         bool isCallValid =
863             (context->skipValidation() || ValidateGenVertexArrays(context, n, arraysPacked));
864         if (isCallValid)
865         {
866             context->genVertexArrays(n, arraysPacked);
867         }
868         ANGLE_CAPTURE(GenVertexArrays, isCallValid, context, n, arraysPacked);
869     }
870     else
871     {
872         GenerateContextLostErrorOnCurrentGlobalContext();
873     }
874 }
875 
GL_GenerateMipmap(GLenum target)876 void GL_APIENTRY GL_GenerateMipmap(GLenum target)
877 {
878     Context *context = GetValidGlobalContext();
879     EVENT(context, GLGenerateMipmap, "context = %d, target = %s", CID(context),
880           GLenumToString(GLenumGroup::TextureTarget, target));
881 
882     if (context)
883     {
884         TextureType targetPacked                              = PackParam<TextureType>(target);
885         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
886         bool isCallValid =
887             (context->skipValidation() || ValidateGenerateMipmap(context, targetPacked));
888         if (isCallValid)
889         {
890             context->generateMipmap(targetPacked);
891         }
892         ANGLE_CAPTURE(GenerateMipmap, isCallValid, context, targetPacked);
893     }
894     else
895     {
896         GenerateContextLostErrorOnCurrentGlobalContext();
897     }
898 }
899 
GL_GetBooleani_v(GLenum target,GLuint index,GLboolean * data)900 void GL_APIENTRY GL_GetBooleani_v(GLenum target, GLuint index, GLboolean *data)
901 {
902     Context *context = GetValidGlobalContext();
903     EVENT(context, GLGetBooleani_v,
904           "context = %d, target = %s, index = %u, data = 0x%016" PRIxPTR "", CID(context),
905           GLenumToString(GLenumGroup::BufferTargetARB, target), index, (uintptr_t)data);
906 
907     if (context)
908     {
909         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
910         bool isCallValid =
911             (context->skipValidation() || ValidateGetBooleani_v(context, target, index, data));
912         if (isCallValid)
913         {
914             context->getBooleani_v(target, index, data);
915         }
916         ANGLE_CAPTURE(GetBooleani_v, isCallValid, context, target, index, data);
917     }
918     else
919     {
920         GenerateContextLostErrorOnCurrentGlobalContext();
921     }
922 }
923 
GL_GetFragDataLocation(GLuint program,const GLchar * name)924 GLint GL_APIENTRY GL_GetFragDataLocation(GLuint program, const GLchar *name)
925 {
926     Context *context = GetValidGlobalContext();
927     EVENT(context, GLGetFragDataLocation, "context = %d, program = %u, name = 0x%016" PRIxPTR "",
928           CID(context), program, (uintptr_t)name);
929 
930     GLint returnValue;
931     if (context)
932     {
933         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
934         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
935         bool isCallValid                                      = (context->skipValidation() ||
936                             ValidateGetFragDataLocation(context, programPacked, name));
937         if (isCallValid)
938         {
939             returnValue = context->getFragDataLocation(programPacked, name);
940         }
941         else
942         {
943             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetFragDataLocation, GLint>();
944         }
945         ANGLE_CAPTURE(GetFragDataLocation, isCallValid, context, programPacked, name, returnValue);
946     }
947     else
948     {
949         GenerateContextLostErrorOnCurrentGlobalContext();
950         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetFragDataLocation, GLint>();
951     }
952     return returnValue;
953 }
954 
GL_GetFramebufferAttachmentParameteriv(GLenum target,GLenum attachment,GLenum pname,GLint * params)955 void GL_APIENTRY GL_GetFramebufferAttachmentParameteriv(GLenum target,
956                                                         GLenum attachment,
957                                                         GLenum pname,
958                                                         GLint *params)
959 {
960     Context *context = GetValidGlobalContext();
961     EVENT(context, GLGetFramebufferAttachmentParameteriv,
962           "context = %d, target = %s, attachment = %s, pname = %s, params = 0x%016" PRIxPTR "",
963           CID(context), GLenumToString(GLenumGroup::FramebufferTarget, target),
964           GLenumToString(GLenumGroup::FramebufferAttachment, attachment),
965           GLenumToString(GLenumGroup::FramebufferAttachmentParameterName, pname),
966           (uintptr_t)params);
967 
968     if (context)
969     {
970         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
971         bool isCallValid =
972             (context->skipValidation() || ValidateGetFramebufferAttachmentParameteriv(
973                                               context, target, attachment, pname, params));
974         if (isCallValid)
975         {
976             context->getFramebufferAttachmentParameteriv(target, attachment, pname, params);
977         }
978         ANGLE_CAPTURE(GetFramebufferAttachmentParameteriv, isCallValid, context, target, attachment,
979                       pname, params);
980     }
981     else
982     {
983         GenerateContextLostErrorOnCurrentGlobalContext();
984     }
985 }
986 
GL_GetIntegeri_v(GLenum target,GLuint index,GLint * data)987 void GL_APIENTRY GL_GetIntegeri_v(GLenum target, GLuint index, GLint *data)
988 {
989     Context *context = GetValidGlobalContext();
990     EVENT(context, GLGetIntegeri_v,
991           "context = %d, target = %s, index = %u, data = 0x%016" PRIxPTR "", CID(context),
992           GLenumToString(GLenumGroup::TypeEnum, target), index, (uintptr_t)data);
993 
994     if (context)
995     {
996         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
997         bool isCallValid =
998             (context->skipValidation() || ValidateGetIntegeri_v(context, target, index, data));
999         if (isCallValid)
1000         {
1001             context->getIntegeri_v(target, index, data);
1002         }
1003         ANGLE_CAPTURE(GetIntegeri_v, isCallValid, context, target, index, data);
1004     }
1005     else
1006     {
1007         GenerateContextLostErrorOnCurrentGlobalContext();
1008     }
1009 }
1010 
GL_GetRenderbufferParameteriv(GLenum target,GLenum pname,GLint * params)1011 void GL_APIENTRY GL_GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
1012 {
1013     Context *context = GetValidGlobalContext();
1014     EVENT(context, GLGetRenderbufferParameteriv,
1015           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
1016           GLenumToString(GLenumGroup::RenderbufferTarget, target),
1017           GLenumToString(GLenumGroup::RenderbufferParameterName, pname), (uintptr_t)params);
1018 
1019     if (context)
1020     {
1021         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1022         bool isCallValid                                      = (context->skipValidation() ||
1023                             ValidateGetRenderbufferParameteriv(context, target, pname, params));
1024         if (isCallValid)
1025         {
1026             context->getRenderbufferParameteriv(target, pname, params);
1027         }
1028         ANGLE_CAPTURE(GetRenderbufferParameteriv, isCallValid, context, target, pname, params);
1029     }
1030     else
1031     {
1032         GenerateContextLostErrorOnCurrentGlobalContext();
1033     }
1034 }
1035 
GL_GetStringi(GLenum name,GLuint index)1036 const GLubyte *GL_APIENTRY GL_GetStringi(GLenum name, GLuint index)
1037 {
1038     Context *context = GetValidGlobalContext();
1039     EVENT(context, GLGetStringi, "context = %d, name = %s, index = %u", CID(context),
1040           GLenumToString(GLenumGroup::StringName, name), index);
1041 
1042     const GLubyte *returnValue;
1043     if (context)
1044     {
1045         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1046         bool isCallValid = (context->skipValidation() || ValidateGetStringi(context, name, index));
1047         if (isCallValid)
1048         {
1049             returnValue = context->getStringi(name, index);
1050         }
1051         else
1052         {
1053             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetStringi, const GLubyte *>();
1054         }
1055         ANGLE_CAPTURE(GetStringi, isCallValid, context, name, index, returnValue);
1056     }
1057     else
1058     {
1059         GenerateContextLostErrorOnCurrentGlobalContext();
1060         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetStringi, const GLubyte *>();
1061     }
1062     return returnValue;
1063 }
1064 
GL_GetTexParameterIiv(GLenum target,GLenum pname,GLint * params)1065 void GL_APIENTRY GL_GetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
1066 {
1067     Context *context = GetValidGlobalContext();
1068     EVENT(context, GLGetTexParameterIiv,
1069           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
1070           GLenumToString(GLenumGroup::TextureTarget, target),
1071           GLenumToString(GLenumGroup::GetTextureParameter, pname), (uintptr_t)params);
1072 
1073     if (context)
1074     {
1075         TextureType targetPacked                              = PackParam<TextureType>(target);
1076         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1077         bool isCallValid                                      = (context->skipValidation() ||
1078                             ValidateGetTexParameterIiv(context, targetPacked, pname, params));
1079         if (isCallValid)
1080         {
1081             context->getTexParameterIiv(targetPacked, pname, params);
1082         }
1083         ANGLE_CAPTURE(GetTexParameterIiv, isCallValid, context, targetPacked, pname, params);
1084     }
1085     else
1086     {
1087         GenerateContextLostErrorOnCurrentGlobalContext();
1088     }
1089 }
1090 
GL_GetTexParameterIuiv(GLenum target,GLenum pname,GLuint * params)1091 void GL_APIENTRY GL_GetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
1092 {
1093     Context *context = GetValidGlobalContext();
1094     EVENT(context, GLGetTexParameterIuiv,
1095           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
1096           GLenumToString(GLenumGroup::TextureTarget, target),
1097           GLenumToString(GLenumGroup::GetTextureParameter, pname), (uintptr_t)params);
1098 
1099     if (context)
1100     {
1101         TextureType targetPacked                              = PackParam<TextureType>(target);
1102         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1103         bool isCallValid                                      = (context->skipValidation() ||
1104                             ValidateGetTexParameterIuiv(context, targetPacked, pname, params));
1105         if (isCallValid)
1106         {
1107             context->getTexParameterIuiv(targetPacked, pname, params);
1108         }
1109         ANGLE_CAPTURE(GetTexParameterIuiv, isCallValid, context, targetPacked, pname, params);
1110     }
1111     else
1112     {
1113         GenerateContextLostErrorOnCurrentGlobalContext();
1114     }
1115 }
1116 
GL_GetTransformFeedbackVarying(GLuint program,GLuint index,GLsizei bufSize,GLsizei * length,GLsizei * size,GLenum * type,GLchar * name)1117 void GL_APIENTRY GL_GetTransformFeedbackVarying(GLuint program,
1118                                                 GLuint index,
1119                                                 GLsizei bufSize,
1120                                                 GLsizei *length,
1121                                                 GLsizei *size,
1122                                                 GLenum *type,
1123                                                 GLchar *name)
1124 {
1125     Context *context = GetValidGlobalContext();
1126     EVENT(context, GLGetTransformFeedbackVarying,
1127           "context = %d, program = %u, index = %u, bufSize = %d, length = 0x%016" PRIxPTR
1128           ", size = 0x%016" PRIxPTR ", type = 0x%016" PRIxPTR ", name = 0x%016" PRIxPTR "",
1129           CID(context), program, index, bufSize, (uintptr_t)length, (uintptr_t)size,
1130           (uintptr_t)type, (uintptr_t)name);
1131 
1132     if (context)
1133     {
1134         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
1135         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1136         bool isCallValid                                      = (context->skipValidation() ||
1137                             ValidateGetTransformFeedbackVarying(context, programPacked, index,
1138                                                                 bufSize, length, size, type, name));
1139         if (isCallValid)
1140         {
1141             context->getTransformFeedbackVarying(programPacked, index, bufSize, length, size, type,
1142                                                  name);
1143         }
1144         ANGLE_CAPTURE(GetTransformFeedbackVarying, isCallValid, context, programPacked, index,
1145                       bufSize, length, size, type, name);
1146     }
1147     else
1148     {
1149         GenerateContextLostErrorOnCurrentGlobalContext();
1150     }
1151 }
1152 
GL_GetUniformuiv(GLuint program,GLint location,GLuint * params)1153 void GL_APIENTRY GL_GetUniformuiv(GLuint program, GLint location, GLuint *params)
1154 {
1155     Context *context = GetValidGlobalContext();
1156     EVENT(context, GLGetUniformuiv,
1157           "context = %d, program = %u, location = %d, params = 0x%016" PRIxPTR "", CID(context),
1158           program, location, (uintptr_t)params);
1159 
1160     if (context)
1161     {
1162         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1163         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1164         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1165         bool isCallValid                                      = (context->skipValidation() ||
1166                             ValidateGetUniformuiv(context, programPacked, locationPacked, params));
1167         if (isCallValid)
1168         {
1169             context->getUniformuiv(programPacked, locationPacked, params);
1170         }
1171         ANGLE_CAPTURE(GetUniformuiv, isCallValid, context, programPacked, locationPacked, params);
1172     }
1173     else
1174     {
1175         GenerateContextLostErrorOnCurrentGlobalContext();
1176     }
1177 }
1178 
GL_GetVertexAttribIiv(GLuint index,GLenum pname,GLint * params)1179 void GL_APIENTRY GL_GetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
1180 {
1181     Context *context = GetValidGlobalContext();
1182     EVENT(context, GLGetVertexAttribIiv,
1183           "context = %d, index = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), index,
1184           GLenumToString(GLenumGroup::VertexAttribEnum, pname), (uintptr_t)params);
1185 
1186     if (context)
1187     {
1188         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1189         bool isCallValid                                      = (context->skipValidation() ||
1190                             ValidateGetVertexAttribIiv(context, index, pname, params));
1191         if (isCallValid)
1192         {
1193             context->getVertexAttribIiv(index, pname, params);
1194         }
1195         ANGLE_CAPTURE(GetVertexAttribIiv, isCallValid, context, index, pname, params);
1196     }
1197     else
1198     {
1199         GenerateContextLostErrorOnCurrentGlobalContext();
1200     }
1201 }
1202 
GL_GetVertexAttribIuiv(GLuint index,GLenum pname,GLuint * params)1203 void GL_APIENTRY GL_GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
1204 {
1205     Context *context = GetValidGlobalContext();
1206     EVENT(context, GLGetVertexAttribIuiv,
1207           "context = %d, index = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), index,
1208           GLenumToString(GLenumGroup::VertexAttribEnum, pname), (uintptr_t)params);
1209 
1210     if (context)
1211     {
1212         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1213         bool isCallValid                                      = (context->skipValidation() ||
1214                             ValidateGetVertexAttribIuiv(context, index, pname, params));
1215         if (isCallValid)
1216         {
1217             context->getVertexAttribIuiv(index, pname, params);
1218         }
1219         ANGLE_CAPTURE(GetVertexAttribIuiv, isCallValid, context, index, pname, params);
1220     }
1221     else
1222     {
1223         GenerateContextLostErrorOnCurrentGlobalContext();
1224     }
1225 }
1226 
GL_IsEnabledi(GLenum target,GLuint index)1227 GLboolean GL_APIENTRY GL_IsEnabledi(GLenum target, GLuint index)
1228 {
1229     Context *context = GetValidGlobalContext();
1230     EVENT(context, GLIsEnabledi, "context = %d, target = %s, index = %u", CID(context),
1231           GLenumToString(GLenumGroup::EnableCap, target), index);
1232 
1233     GLboolean returnValue;
1234     if (context)
1235     {
1236         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1237         bool isCallValid =
1238             (context->skipValidation() || ValidateIsEnabledi(context, target, index));
1239         if (isCallValid)
1240         {
1241             returnValue = context->isEnabledi(target, index);
1242         }
1243         else
1244         {
1245             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsEnabledi, GLboolean>();
1246         }
1247         ANGLE_CAPTURE(IsEnabledi, isCallValid, context, target, index, returnValue);
1248     }
1249     else
1250     {
1251         GenerateContextLostErrorOnCurrentGlobalContext();
1252         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsEnabledi, GLboolean>();
1253     }
1254     return returnValue;
1255 }
1256 
GL_IsFramebuffer(GLuint framebuffer)1257 GLboolean GL_APIENTRY GL_IsFramebuffer(GLuint framebuffer)
1258 {
1259     Context *context = GetValidGlobalContext();
1260     EVENT(context, GLIsFramebuffer, "context = %d, framebuffer = %u", CID(context), framebuffer);
1261 
1262     GLboolean returnValue;
1263     if (context)
1264     {
1265         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
1266         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1267         bool isCallValid =
1268             (context->skipValidation() || ValidateIsFramebuffer(context, framebufferPacked));
1269         if (isCallValid)
1270         {
1271             returnValue = context->isFramebuffer(framebufferPacked);
1272         }
1273         else
1274         {
1275             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsFramebuffer, GLboolean>();
1276         }
1277         ANGLE_CAPTURE(IsFramebuffer, isCallValid, context, framebufferPacked, returnValue);
1278     }
1279     else
1280     {
1281         GenerateContextLostErrorOnCurrentGlobalContext();
1282         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsFramebuffer, GLboolean>();
1283     }
1284     return returnValue;
1285 }
1286 
GL_IsRenderbuffer(GLuint renderbuffer)1287 GLboolean GL_APIENTRY GL_IsRenderbuffer(GLuint renderbuffer)
1288 {
1289     Context *context = GetValidGlobalContext();
1290     EVENT(context, GLIsRenderbuffer, "context = %d, renderbuffer = %u", CID(context), renderbuffer);
1291 
1292     GLboolean returnValue;
1293     if (context)
1294     {
1295         RenderbufferID renderbufferPacked = PackParam<RenderbufferID>(renderbuffer);
1296         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1297         bool isCallValid =
1298             (context->skipValidation() || ValidateIsRenderbuffer(context, renderbufferPacked));
1299         if (isCallValid)
1300         {
1301             returnValue = context->isRenderbuffer(renderbufferPacked);
1302         }
1303         else
1304         {
1305             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsRenderbuffer, GLboolean>();
1306         }
1307         ANGLE_CAPTURE(IsRenderbuffer, isCallValid, context, renderbufferPacked, returnValue);
1308     }
1309     else
1310     {
1311         GenerateContextLostErrorOnCurrentGlobalContext();
1312         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsRenderbuffer, GLboolean>();
1313     }
1314     return returnValue;
1315 }
1316 
GL_IsVertexArray(GLuint array)1317 GLboolean GL_APIENTRY GL_IsVertexArray(GLuint array)
1318 {
1319     Context *context = GetValidGlobalContext();
1320     EVENT(context, GLIsVertexArray, "context = %d, array = %u", CID(context), array);
1321 
1322     GLboolean returnValue;
1323     if (context)
1324     {
1325         VertexArrayID arrayPacked                             = PackParam<VertexArrayID>(array);
1326         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1327         bool isCallValid =
1328             (context->skipValidation() || ValidateIsVertexArray(context, arrayPacked));
1329         if (isCallValid)
1330         {
1331             returnValue = context->isVertexArray(arrayPacked);
1332         }
1333         else
1334         {
1335             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsVertexArray, GLboolean>();
1336         }
1337         ANGLE_CAPTURE(IsVertexArray, isCallValid, context, arrayPacked, returnValue);
1338     }
1339     else
1340     {
1341         GenerateContextLostErrorOnCurrentGlobalContext();
1342         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsVertexArray, GLboolean>();
1343     }
1344     return returnValue;
1345 }
1346 
GL_MapBufferRange(GLenum target,GLintptr offset,GLsizeiptr length,GLbitfield access)1347 void *GL_APIENTRY GL_MapBufferRange(GLenum target,
1348                                     GLintptr offset,
1349                                     GLsizeiptr length,
1350                                     GLbitfield access)
1351 {
1352     Context *context = GetValidGlobalContext();
1353     EVENT(context, GLMapBufferRange,
1354           "context = %d, target = %s, offset = %llu, length = %llu, access = %s", CID(context),
1355           GLenumToString(GLenumGroup::BufferTargetARB, target),
1356           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length),
1357           GLbitfieldToString(GLenumGroup::BufferAccessMask, access).c_str());
1358 
1359     void *returnValue;
1360     if (context)
1361     {
1362         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
1363         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1364         bool isCallValid                                      = (context->skipValidation() ||
1365                             ValidateMapBufferRange(context, targetPacked, offset, length, access));
1366         if (isCallValid)
1367         {
1368             returnValue = context->mapBufferRange(targetPacked, offset, length, access);
1369         }
1370         else
1371         {
1372             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapBufferRange, void *>();
1373         }
1374         ANGLE_CAPTURE(MapBufferRange, isCallValid, context, targetPacked, offset, length, access,
1375                       returnValue);
1376     }
1377     else
1378     {
1379         GenerateContextLostErrorOnCurrentGlobalContext();
1380         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapBufferRange, void *>();
1381     }
1382     return returnValue;
1383 }
1384 
GL_RenderbufferStorage(GLenum target,GLenum internalformat,GLsizei width,GLsizei height)1385 void GL_APIENTRY GL_RenderbufferStorage(GLenum target,
1386                                         GLenum internalformat,
1387                                         GLsizei width,
1388                                         GLsizei height)
1389 {
1390     Context *context = GetValidGlobalContext();
1391     EVENT(context, GLRenderbufferStorage,
1392           "context = %d, target = %s, internalformat = %s, width = %d, height = %d", CID(context),
1393           GLenumToString(GLenumGroup::RenderbufferTarget, target),
1394           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height);
1395 
1396     if (context)
1397     {
1398         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1399         bool isCallValid =
1400             (context->skipValidation() ||
1401              ValidateRenderbufferStorage(context, target, internalformat, width, height));
1402         if (isCallValid)
1403         {
1404             context->renderbufferStorage(target, internalformat, width, height);
1405         }
1406         ANGLE_CAPTURE(RenderbufferStorage, isCallValid, context, target, internalformat, width,
1407                       height);
1408     }
1409     else
1410     {
1411         GenerateContextLostErrorOnCurrentGlobalContext();
1412     }
1413 }
1414 
GL_RenderbufferStorageMultisample(GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height)1415 void GL_APIENTRY GL_RenderbufferStorageMultisample(GLenum target,
1416                                                    GLsizei samples,
1417                                                    GLenum internalformat,
1418                                                    GLsizei width,
1419                                                    GLsizei height)
1420 {
1421     Context *context = GetValidGlobalContext();
1422     EVENT(context, GLRenderbufferStorageMultisample,
1423           "context = %d, target = %s, samples = %d, internalformat = %s, width = %d, height = %d",
1424           CID(context), GLenumToString(GLenumGroup::RenderbufferTarget, target), samples,
1425           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height);
1426 
1427     if (context)
1428     {
1429         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1430         bool isCallValid                                      = (context->skipValidation() ||
1431                             ValidateRenderbufferStorageMultisample(context, target, samples,
1432                                                                    internalformat, width, height));
1433         if (isCallValid)
1434         {
1435             context->renderbufferStorageMultisample(target, samples, internalformat, width, height);
1436         }
1437         ANGLE_CAPTURE(RenderbufferStorageMultisample, isCallValid, context, target, samples,
1438                       internalformat, width, height);
1439     }
1440     else
1441     {
1442         GenerateContextLostErrorOnCurrentGlobalContext();
1443     }
1444 }
1445 
GL_TexParameterIiv(GLenum target,GLenum pname,const GLint * params)1446 void GL_APIENTRY GL_TexParameterIiv(GLenum target, GLenum pname, const GLint *params)
1447 {
1448     Context *context = GetValidGlobalContext();
1449     EVENT(context, GLTexParameterIiv,
1450           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
1451           GLenumToString(GLenumGroup::TextureTarget, target),
1452           GLenumToString(GLenumGroup::TextureParameterName, pname), (uintptr_t)params);
1453 
1454     if (context)
1455     {
1456         TextureType targetPacked                              = PackParam<TextureType>(target);
1457         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1458         bool isCallValid                                      = (context->skipValidation() ||
1459                             ValidateTexParameterIiv(context, targetPacked, pname, params));
1460         if (isCallValid)
1461         {
1462             context->texParameterIiv(targetPacked, pname, params);
1463         }
1464         ANGLE_CAPTURE(TexParameterIiv, isCallValid, context, targetPacked, pname, params);
1465     }
1466     else
1467     {
1468         GenerateContextLostErrorOnCurrentGlobalContext();
1469     }
1470 }
1471 
GL_TexParameterIuiv(GLenum target,GLenum pname,const GLuint * params)1472 void GL_APIENTRY GL_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
1473 {
1474     Context *context = GetValidGlobalContext();
1475     EVENT(context, GLTexParameterIuiv,
1476           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
1477           GLenumToString(GLenumGroup::TextureTarget, target),
1478           GLenumToString(GLenumGroup::TextureParameterName, pname), (uintptr_t)params);
1479 
1480     if (context)
1481     {
1482         TextureType targetPacked                              = PackParam<TextureType>(target);
1483         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1484         bool isCallValid                                      = (context->skipValidation() ||
1485                             ValidateTexParameterIuiv(context, targetPacked, pname, params));
1486         if (isCallValid)
1487         {
1488             context->texParameterIuiv(targetPacked, pname, params);
1489         }
1490         ANGLE_CAPTURE(TexParameterIuiv, isCallValid, context, targetPacked, pname, params);
1491     }
1492     else
1493     {
1494         GenerateContextLostErrorOnCurrentGlobalContext();
1495     }
1496 }
1497 
GL_TransformFeedbackVaryings(GLuint program,GLsizei count,const GLchar * const * varyings,GLenum bufferMode)1498 void GL_APIENTRY GL_TransformFeedbackVaryings(GLuint program,
1499                                               GLsizei count,
1500                                               const GLchar *const *varyings,
1501                                               GLenum bufferMode)
1502 {
1503     Context *context = GetValidGlobalContext();
1504     EVENT(context, GLTransformFeedbackVaryings,
1505           "context = %d, program = %u, count = %d, varyings = 0x%016" PRIxPTR ", bufferMode = %s",
1506           CID(context), program, count, (uintptr_t)varyings,
1507           GLenumToString(GLenumGroup::DefaultGroup, bufferMode));
1508 
1509     if (context)
1510     {
1511         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
1512         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1513         bool isCallValid =
1514             (context->skipValidation() || ValidateTransformFeedbackVaryings(
1515                                               context, programPacked, count, varyings, bufferMode));
1516         if (isCallValid)
1517         {
1518             context->transformFeedbackVaryings(programPacked, count, varyings, bufferMode);
1519         }
1520         ANGLE_CAPTURE(TransformFeedbackVaryings, isCallValid, context, programPacked, count,
1521                       varyings, bufferMode);
1522     }
1523     else
1524     {
1525         GenerateContextLostErrorOnCurrentGlobalContext();
1526     }
1527 }
1528 
GL_Uniform1ui(GLint location,GLuint v0)1529 void GL_APIENTRY GL_Uniform1ui(GLint location, GLuint v0)
1530 {
1531     Context *context = GetValidGlobalContext();
1532     EVENT(context, GLUniform1ui, "context = %d, location = %d, v0 = %u", CID(context), location,
1533           v0);
1534 
1535     if (context)
1536     {
1537         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1538         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1539         bool isCallValid =
1540             (context->skipValidation() || ValidateUniform1ui(context, locationPacked, v0));
1541         if (isCallValid)
1542         {
1543             context->uniform1ui(locationPacked, v0);
1544         }
1545         ANGLE_CAPTURE(Uniform1ui, isCallValid, context, locationPacked, v0);
1546     }
1547     else
1548     {
1549         GenerateContextLostErrorOnCurrentGlobalContext();
1550     }
1551 }
1552 
GL_Uniform1uiv(GLint location,GLsizei count,const GLuint * value)1553 void GL_APIENTRY GL_Uniform1uiv(GLint location, GLsizei count, const GLuint *value)
1554 {
1555     Context *context = GetValidGlobalContext();
1556     EVENT(context, GLUniform1uiv,
1557           "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
1558           location, count, (uintptr_t)value);
1559 
1560     if (context)
1561     {
1562         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1563         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1564         bool isCallValid                                      = (context->skipValidation() ||
1565                             ValidateUniform1uiv(context, locationPacked, count, value));
1566         if (isCallValid)
1567         {
1568             context->uniform1uiv(locationPacked, count, value);
1569         }
1570         ANGLE_CAPTURE(Uniform1uiv, isCallValid, context, locationPacked, count, value);
1571     }
1572     else
1573     {
1574         GenerateContextLostErrorOnCurrentGlobalContext();
1575     }
1576 }
1577 
GL_Uniform2ui(GLint location,GLuint v0,GLuint v1)1578 void GL_APIENTRY GL_Uniform2ui(GLint location, GLuint v0, GLuint v1)
1579 {
1580     Context *context = GetValidGlobalContext();
1581     EVENT(context, GLUniform2ui, "context = %d, location = %d, v0 = %u, v1 = %u", CID(context),
1582           location, v0, v1);
1583 
1584     if (context)
1585     {
1586         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1587         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1588         bool isCallValid =
1589             (context->skipValidation() || ValidateUniform2ui(context, locationPacked, v0, v1));
1590         if (isCallValid)
1591         {
1592             context->uniform2ui(locationPacked, v0, v1);
1593         }
1594         ANGLE_CAPTURE(Uniform2ui, isCallValid, context, locationPacked, v0, v1);
1595     }
1596     else
1597     {
1598         GenerateContextLostErrorOnCurrentGlobalContext();
1599     }
1600 }
1601 
GL_Uniform2uiv(GLint location,GLsizei count,const GLuint * value)1602 void GL_APIENTRY GL_Uniform2uiv(GLint location, GLsizei count, const GLuint *value)
1603 {
1604     Context *context = GetValidGlobalContext();
1605     EVENT(context, GLUniform2uiv,
1606           "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
1607           location, count, (uintptr_t)value);
1608 
1609     if (context)
1610     {
1611         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1612         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1613         bool isCallValid                                      = (context->skipValidation() ||
1614                             ValidateUniform2uiv(context, locationPacked, count, value));
1615         if (isCallValid)
1616         {
1617             context->uniform2uiv(locationPacked, count, value);
1618         }
1619         ANGLE_CAPTURE(Uniform2uiv, isCallValid, context, locationPacked, count, value);
1620     }
1621     else
1622     {
1623         GenerateContextLostErrorOnCurrentGlobalContext();
1624     }
1625 }
1626 
GL_Uniform3ui(GLint location,GLuint v0,GLuint v1,GLuint v2)1627 void GL_APIENTRY GL_Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
1628 {
1629     Context *context = GetValidGlobalContext();
1630     EVENT(context, GLUniform3ui, "context = %d, location = %d, v0 = %u, v1 = %u, v2 = %u",
1631           CID(context), location, v0, v1, v2);
1632 
1633     if (context)
1634     {
1635         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1636         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1637         bool isCallValid =
1638             (context->skipValidation() || ValidateUniform3ui(context, locationPacked, v0, v1, v2));
1639         if (isCallValid)
1640         {
1641             context->uniform3ui(locationPacked, v0, v1, v2);
1642         }
1643         ANGLE_CAPTURE(Uniform3ui, isCallValid, context, locationPacked, v0, v1, v2);
1644     }
1645     else
1646     {
1647         GenerateContextLostErrorOnCurrentGlobalContext();
1648     }
1649 }
1650 
GL_Uniform3uiv(GLint location,GLsizei count,const GLuint * value)1651 void GL_APIENTRY GL_Uniform3uiv(GLint location, GLsizei count, const GLuint *value)
1652 {
1653     Context *context = GetValidGlobalContext();
1654     EVENT(context, GLUniform3uiv,
1655           "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
1656           location, count, (uintptr_t)value);
1657 
1658     if (context)
1659     {
1660         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1661         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1662         bool isCallValid                                      = (context->skipValidation() ||
1663                             ValidateUniform3uiv(context, locationPacked, count, value));
1664         if (isCallValid)
1665         {
1666             context->uniform3uiv(locationPacked, count, value);
1667         }
1668         ANGLE_CAPTURE(Uniform3uiv, isCallValid, context, locationPacked, count, value);
1669     }
1670     else
1671     {
1672         GenerateContextLostErrorOnCurrentGlobalContext();
1673     }
1674 }
1675 
GL_Uniform4ui(GLint location,GLuint v0,GLuint v1,GLuint v2,GLuint v3)1676 void GL_APIENTRY GL_Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
1677 {
1678     Context *context = GetValidGlobalContext();
1679     EVENT(context, GLUniform4ui, "context = %d, location = %d, v0 = %u, v1 = %u, v2 = %u, v3 = %u",
1680           CID(context), location, v0, v1, v2, v3);
1681 
1682     if (context)
1683     {
1684         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1685         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1686         bool isCallValid                                      = (context->skipValidation() ||
1687                             ValidateUniform4ui(context, locationPacked, v0, v1, v2, v3));
1688         if (isCallValid)
1689         {
1690             context->uniform4ui(locationPacked, v0, v1, v2, v3);
1691         }
1692         ANGLE_CAPTURE(Uniform4ui, isCallValid, context, locationPacked, v0, v1, v2, v3);
1693     }
1694     else
1695     {
1696         GenerateContextLostErrorOnCurrentGlobalContext();
1697     }
1698 }
1699 
GL_Uniform4uiv(GLint location,GLsizei count,const GLuint * value)1700 void GL_APIENTRY GL_Uniform4uiv(GLint location, GLsizei count, const GLuint *value)
1701 {
1702     Context *context = GetValidGlobalContext();
1703     EVENT(context, GLUniform4uiv,
1704           "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
1705           location, count, (uintptr_t)value);
1706 
1707     if (context)
1708     {
1709         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1710         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1711         bool isCallValid                                      = (context->skipValidation() ||
1712                             ValidateUniform4uiv(context, locationPacked, count, value));
1713         if (isCallValid)
1714         {
1715             context->uniform4uiv(locationPacked, count, value);
1716         }
1717         ANGLE_CAPTURE(Uniform4uiv, isCallValid, context, locationPacked, count, value);
1718     }
1719     else
1720     {
1721         GenerateContextLostErrorOnCurrentGlobalContext();
1722     }
1723 }
1724 
GL_VertexAttribI1i(GLuint index,GLint x)1725 void GL_APIENTRY GL_VertexAttribI1i(GLuint index, GLint x)
1726 {
1727     Context *context = GetValidGlobalContext();
1728     EVENT(context, GLVertexAttribI1i, "context = %d, index = %u, x = %d", CID(context), index, x);
1729 
1730     if (context)
1731     {
1732         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1733         bool isCallValid =
1734             (context->skipValidation() || ValidateVertexAttribI1i(context, index, x));
1735         if (isCallValid)
1736         {
1737             context->vertexAttribI1i(index, x);
1738         }
1739         ANGLE_CAPTURE(VertexAttribI1i, isCallValid, context, index, x);
1740     }
1741     else
1742     {
1743         GenerateContextLostErrorOnCurrentGlobalContext();
1744     }
1745 }
1746 
GL_VertexAttribI1iv(GLuint index,const GLint * v)1747 void GL_APIENTRY GL_VertexAttribI1iv(GLuint index, const GLint *v)
1748 {
1749     Context *context = GetValidGlobalContext();
1750     EVENT(context, GLVertexAttribI1iv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1751           CID(context), index, (uintptr_t)v);
1752 
1753     if (context)
1754     {
1755         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1756         bool isCallValid =
1757             (context->skipValidation() || ValidateVertexAttribI1iv(context, index, v));
1758         if (isCallValid)
1759         {
1760             context->vertexAttribI1iv(index, v);
1761         }
1762         ANGLE_CAPTURE(VertexAttribI1iv, isCallValid, context, index, v);
1763     }
1764     else
1765     {
1766         GenerateContextLostErrorOnCurrentGlobalContext();
1767     }
1768 }
1769 
GL_VertexAttribI1ui(GLuint index,GLuint x)1770 void GL_APIENTRY GL_VertexAttribI1ui(GLuint index, GLuint x)
1771 {
1772     Context *context = GetValidGlobalContext();
1773     EVENT(context, GLVertexAttribI1ui, "context = %d, index = %u, x = %u", CID(context), index, x);
1774 
1775     if (context)
1776     {
1777         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1778         bool isCallValid =
1779             (context->skipValidation() || ValidateVertexAttribI1ui(context, index, x));
1780         if (isCallValid)
1781         {
1782             context->vertexAttribI1ui(index, x);
1783         }
1784         ANGLE_CAPTURE(VertexAttribI1ui, isCallValid, context, index, x);
1785     }
1786     else
1787     {
1788         GenerateContextLostErrorOnCurrentGlobalContext();
1789     }
1790 }
1791 
GL_VertexAttribI1uiv(GLuint index,const GLuint * v)1792 void GL_APIENTRY GL_VertexAttribI1uiv(GLuint index, const GLuint *v)
1793 {
1794     Context *context = GetValidGlobalContext();
1795     EVENT(context, GLVertexAttribI1uiv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1796           CID(context), index, (uintptr_t)v);
1797 
1798     if (context)
1799     {
1800         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1801         bool isCallValid =
1802             (context->skipValidation() || ValidateVertexAttribI1uiv(context, index, v));
1803         if (isCallValid)
1804         {
1805             context->vertexAttribI1uiv(index, v);
1806         }
1807         ANGLE_CAPTURE(VertexAttribI1uiv, isCallValid, context, index, v);
1808     }
1809     else
1810     {
1811         GenerateContextLostErrorOnCurrentGlobalContext();
1812     }
1813 }
1814 
GL_VertexAttribI2i(GLuint index,GLint x,GLint y)1815 void GL_APIENTRY GL_VertexAttribI2i(GLuint index, GLint x, GLint y)
1816 {
1817     Context *context = GetValidGlobalContext();
1818     EVENT(context, GLVertexAttribI2i, "context = %d, index = %u, x = %d, y = %d", CID(context),
1819           index, x, y);
1820 
1821     if (context)
1822     {
1823         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1824         bool isCallValid =
1825             (context->skipValidation() || ValidateVertexAttribI2i(context, index, x, y));
1826         if (isCallValid)
1827         {
1828             context->vertexAttribI2i(index, x, y);
1829         }
1830         ANGLE_CAPTURE(VertexAttribI2i, isCallValid, context, index, x, y);
1831     }
1832     else
1833     {
1834         GenerateContextLostErrorOnCurrentGlobalContext();
1835     }
1836 }
1837 
GL_VertexAttribI2iv(GLuint index,const GLint * v)1838 void GL_APIENTRY GL_VertexAttribI2iv(GLuint index, const GLint *v)
1839 {
1840     Context *context = GetValidGlobalContext();
1841     EVENT(context, GLVertexAttribI2iv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1842           CID(context), index, (uintptr_t)v);
1843 
1844     if (context)
1845     {
1846         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1847         bool isCallValid =
1848             (context->skipValidation() || ValidateVertexAttribI2iv(context, index, v));
1849         if (isCallValid)
1850         {
1851             context->vertexAttribI2iv(index, v);
1852         }
1853         ANGLE_CAPTURE(VertexAttribI2iv, isCallValid, context, index, v);
1854     }
1855     else
1856     {
1857         GenerateContextLostErrorOnCurrentGlobalContext();
1858     }
1859 }
1860 
GL_VertexAttribI2ui(GLuint index,GLuint x,GLuint y)1861 void GL_APIENTRY GL_VertexAttribI2ui(GLuint index, GLuint x, GLuint y)
1862 {
1863     Context *context = GetValidGlobalContext();
1864     EVENT(context, GLVertexAttribI2ui, "context = %d, index = %u, x = %u, y = %u", CID(context),
1865           index, x, y);
1866 
1867     if (context)
1868     {
1869         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1870         bool isCallValid =
1871             (context->skipValidation() || ValidateVertexAttribI2ui(context, index, x, y));
1872         if (isCallValid)
1873         {
1874             context->vertexAttribI2ui(index, x, y);
1875         }
1876         ANGLE_CAPTURE(VertexAttribI2ui, isCallValid, context, index, x, y);
1877     }
1878     else
1879     {
1880         GenerateContextLostErrorOnCurrentGlobalContext();
1881     }
1882 }
1883 
GL_VertexAttribI2uiv(GLuint index,const GLuint * v)1884 void GL_APIENTRY GL_VertexAttribI2uiv(GLuint index, const GLuint *v)
1885 {
1886     Context *context = GetValidGlobalContext();
1887     EVENT(context, GLVertexAttribI2uiv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1888           CID(context), index, (uintptr_t)v);
1889 
1890     if (context)
1891     {
1892         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1893         bool isCallValid =
1894             (context->skipValidation() || ValidateVertexAttribI2uiv(context, index, v));
1895         if (isCallValid)
1896         {
1897             context->vertexAttribI2uiv(index, v);
1898         }
1899         ANGLE_CAPTURE(VertexAttribI2uiv, isCallValid, context, index, v);
1900     }
1901     else
1902     {
1903         GenerateContextLostErrorOnCurrentGlobalContext();
1904     }
1905 }
1906 
GL_VertexAttribI3i(GLuint index,GLint x,GLint y,GLint z)1907 void GL_APIENTRY GL_VertexAttribI3i(GLuint index, GLint x, GLint y, GLint z)
1908 {
1909     Context *context = GetValidGlobalContext();
1910     EVENT(context, GLVertexAttribI3i, "context = %d, index = %u, x = %d, y = %d, z = %d",
1911           CID(context), index, x, y, z);
1912 
1913     if (context)
1914     {
1915         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1916         bool isCallValid =
1917             (context->skipValidation() || ValidateVertexAttribI3i(context, index, x, y, z));
1918         if (isCallValid)
1919         {
1920             context->vertexAttribI3i(index, x, y, z);
1921         }
1922         ANGLE_CAPTURE(VertexAttribI3i, isCallValid, context, index, x, y, z);
1923     }
1924     else
1925     {
1926         GenerateContextLostErrorOnCurrentGlobalContext();
1927     }
1928 }
1929 
GL_VertexAttribI3iv(GLuint index,const GLint * v)1930 void GL_APIENTRY GL_VertexAttribI3iv(GLuint index, const GLint *v)
1931 {
1932     Context *context = GetValidGlobalContext();
1933     EVENT(context, GLVertexAttribI3iv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1934           CID(context), index, (uintptr_t)v);
1935 
1936     if (context)
1937     {
1938         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1939         bool isCallValid =
1940             (context->skipValidation() || ValidateVertexAttribI3iv(context, index, v));
1941         if (isCallValid)
1942         {
1943             context->vertexAttribI3iv(index, v);
1944         }
1945         ANGLE_CAPTURE(VertexAttribI3iv, isCallValid, context, index, v);
1946     }
1947     else
1948     {
1949         GenerateContextLostErrorOnCurrentGlobalContext();
1950     }
1951 }
1952 
GL_VertexAttribI3ui(GLuint index,GLuint x,GLuint y,GLuint z)1953 void GL_APIENTRY GL_VertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z)
1954 {
1955     Context *context = GetValidGlobalContext();
1956     EVENT(context, GLVertexAttribI3ui, "context = %d, index = %u, x = %u, y = %u, z = %u",
1957           CID(context), index, x, y, z);
1958 
1959     if (context)
1960     {
1961         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1962         bool isCallValid =
1963             (context->skipValidation() || ValidateVertexAttribI3ui(context, index, x, y, z));
1964         if (isCallValid)
1965         {
1966             context->vertexAttribI3ui(index, x, y, z);
1967         }
1968         ANGLE_CAPTURE(VertexAttribI3ui, isCallValid, context, index, x, y, z);
1969     }
1970     else
1971     {
1972         GenerateContextLostErrorOnCurrentGlobalContext();
1973     }
1974 }
1975 
GL_VertexAttribI3uiv(GLuint index,const GLuint * v)1976 void GL_APIENTRY GL_VertexAttribI3uiv(GLuint index, const GLuint *v)
1977 {
1978     Context *context = GetValidGlobalContext();
1979     EVENT(context, GLVertexAttribI3uiv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1980           CID(context), index, (uintptr_t)v);
1981 
1982     if (context)
1983     {
1984         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1985         bool isCallValid =
1986             (context->skipValidation() || ValidateVertexAttribI3uiv(context, index, v));
1987         if (isCallValid)
1988         {
1989             context->vertexAttribI3uiv(index, v);
1990         }
1991         ANGLE_CAPTURE(VertexAttribI3uiv, isCallValid, context, index, v);
1992     }
1993     else
1994     {
1995         GenerateContextLostErrorOnCurrentGlobalContext();
1996     }
1997 }
1998 
GL_VertexAttribI4bv(GLuint index,const GLbyte * v)1999 void GL_APIENTRY GL_VertexAttribI4bv(GLuint index, const GLbyte *v)
2000 {
2001     Context *context = GetValidGlobalContext();
2002     EVENT(context, GLVertexAttribI4bv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
2003           CID(context), index, (uintptr_t)v);
2004 
2005     if (context)
2006     {
2007         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2008         bool isCallValid =
2009             (context->skipValidation() || ValidateVertexAttribI4bv(context, index, v));
2010         if (isCallValid)
2011         {
2012             context->vertexAttribI4bv(index, v);
2013         }
2014         ANGLE_CAPTURE(VertexAttribI4bv, isCallValid, context, index, v);
2015     }
2016     else
2017     {
2018         GenerateContextLostErrorOnCurrentGlobalContext();
2019     }
2020 }
2021 
GL_VertexAttribI4i(GLuint index,GLint x,GLint y,GLint z,GLint w)2022 void GL_APIENTRY GL_VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
2023 {
2024     Context *context = GetValidGlobalContext();
2025     EVENT(context, GLVertexAttribI4i, "context = %d, index = %u, x = %d, y = %d, z = %d, w = %d",
2026           CID(context), index, x, y, z, w);
2027 
2028     if (context)
2029     {
2030         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2031         bool isCallValid =
2032             (context->skipValidation() || ValidateVertexAttribI4i(context, index, x, y, z, w));
2033         if (isCallValid)
2034         {
2035             context->vertexAttribI4i(index, x, y, z, w);
2036         }
2037         ANGLE_CAPTURE(VertexAttribI4i, isCallValid, context, index, x, y, z, w);
2038     }
2039     else
2040     {
2041         GenerateContextLostErrorOnCurrentGlobalContext();
2042     }
2043 }
2044 
GL_VertexAttribI4iv(GLuint index,const GLint * v)2045 void GL_APIENTRY GL_VertexAttribI4iv(GLuint index, const GLint *v)
2046 {
2047     Context *context = GetValidGlobalContext();
2048     EVENT(context, GLVertexAttribI4iv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
2049           CID(context), index, (uintptr_t)v);
2050 
2051     if (context)
2052     {
2053         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2054         bool isCallValid =
2055             (context->skipValidation() || ValidateVertexAttribI4iv(context, index, v));
2056         if (isCallValid)
2057         {
2058             context->vertexAttribI4iv(index, v);
2059         }
2060         ANGLE_CAPTURE(VertexAttribI4iv, isCallValid, context, index, v);
2061     }
2062     else
2063     {
2064         GenerateContextLostErrorOnCurrentGlobalContext();
2065     }
2066 }
2067 
GL_VertexAttribI4sv(GLuint index,const GLshort * v)2068 void GL_APIENTRY GL_VertexAttribI4sv(GLuint index, const GLshort *v)
2069 {
2070     Context *context = GetValidGlobalContext();
2071     EVENT(context, GLVertexAttribI4sv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
2072           CID(context), index, (uintptr_t)v);
2073 
2074     if (context)
2075     {
2076         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2077         bool isCallValid =
2078             (context->skipValidation() || ValidateVertexAttribI4sv(context, index, v));
2079         if (isCallValid)
2080         {
2081             context->vertexAttribI4sv(index, v);
2082         }
2083         ANGLE_CAPTURE(VertexAttribI4sv, isCallValid, context, index, v);
2084     }
2085     else
2086     {
2087         GenerateContextLostErrorOnCurrentGlobalContext();
2088     }
2089 }
2090 
GL_VertexAttribI4ubv(GLuint index,const GLubyte * v)2091 void GL_APIENTRY GL_VertexAttribI4ubv(GLuint index, const GLubyte *v)
2092 {
2093     Context *context = GetValidGlobalContext();
2094     EVENT(context, GLVertexAttribI4ubv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
2095           CID(context), index, (uintptr_t)v);
2096 
2097     if (context)
2098     {
2099         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2100         bool isCallValid =
2101             (context->skipValidation() || ValidateVertexAttribI4ubv(context, index, v));
2102         if (isCallValid)
2103         {
2104             context->vertexAttribI4ubv(index, v);
2105         }
2106         ANGLE_CAPTURE(VertexAttribI4ubv, isCallValid, context, index, v);
2107     }
2108     else
2109     {
2110         GenerateContextLostErrorOnCurrentGlobalContext();
2111     }
2112 }
2113 
GL_VertexAttribI4ui(GLuint index,GLuint x,GLuint y,GLuint z,GLuint w)2114 void GL_APIENTRY GL_VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
2115 {
2116     Context *context = GetValidGlobalContext();
2117     EVENT(context, GLVertexAttribI4ui, "context = %d, index = %u, x = %u, y = %u, z = %u, w = %u",
2118           CID(context), index, x, y, z, w);
2119 
2120     if (context)
2121     {
2122         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2123         bool isCallValid =
2124             (context->skipValidation() || ValidateVertexAttribI4ui(context, index, x, y, z, w));
2125         if (isCallValid)
2126         {
2127             context->vertexAttribI4ui(index, x, y, z, w);
2128         }
2129         ANGLE_CAPTURE(VertexAttribI4ui, isCallValid, context, index, x, y, z, w);
2130     }
2131     else
2132     {
2133         GenerateContextLostErrorOnCurrentGlobalContext();
2134     }
2135 }
2136 
GL_VertexAttribI4uiv(GLuint index,const GLuint * v)2137 void GL_APIENTRY GL_VertexAttribI4uiv(GLuint index, const GLuint *v)
2138 {
2139     Context *context = GetValidGlobalContext();
2140     EVENT(context, GLVertexAttribI4uiv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
2141           CID(context), index, (uintptr_t)v);
2142 
2143     if (context)
2144     {
2145         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2146         bool isCallValid =
2147             (context->skipValidation() || ValidateVertexAttribI4uiv(context, index, v));
2148         if (isCallValid)
2149         {
2150             context->vertexAttribI4uiv(index, v);
2151         }
2152         ANGLE_CAPTURE(VertexAttribI4uiv, isCallValid, context, index, v);
2153     }
2154     else
2155     {
2156         GenerateContextLostErrorOnCurrentGlobalContext();
2157     }
2158 }
2159 
GL_VertexAttribI4usv(GLuint index,const GLushort * v)2160 void GL_APIENTRY GL_VertexAttribI4usv(GLuint index, const GLushort *v)
2161 {
2162     Context *context = GetValidGlobalContext();
2163     EVENT(context, GLVertexAttribI4usv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
2164           CID(context), index, (uintptr_t)v);
2165 
2166     if (context)
2167     {
2168         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2169         bool isCallValid =
2170             (context->skipValidation() || ValidateVertexAttribI4usv(context, index, v));
2171         if (isCallValid)
2172         {
2173             context->vertexAttribI4usv(index, v);
2174         }
2175         ANGLE_CAPTURE(VertexAttribI4usv, isCallValid, context, index, v);
2176     }
2177     else
2178     {
2179         GenerateContextLostErrorOnCurrentGlobalContext();
2180     }
2181 }
2182 
2183 void GL_APIENTRY
GL_VertexAttribIPointer(GLuint index,GLint size,GLenum type,GLsizei stride,const void * pointer)2184 GL_VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer)
2185 {
2186     Context *context = GetValidGlobalContext();
2187     EVENT(context, GLVertexAttribIPointer,
2188           "context = %d, index = %u, size = %d, type = %s, stride = %d, pointer = 0x%016" PRIxPTR
2189           "",
2190           CID(context), index, size, GLenumToString(GLenumGroup::VertexAttribPointerType, type),
2191           stride, (uintptr_t)pointer);
2192 
2193     if (context)
2194     {
2195         VertexAttribType typePacked                           = PackParam<VertexAttribType>(type);
2196         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2197         bool isCallValid =
2198             (context->skipValidation() ||
2199              ValidateVertexAttribIPointer(context, index, size, typePacked, stride, pointer));
2200         if (isCallValid)
2201         {
2202             context->vertexAttribIPointer(index, size, typePacked, stride, pointer);
2203         }
2204         ANGLE_CAPTURE(VertexAttribIPointer, isCallValid, context, index, size, typePacked, stride,
2205                       pointer);
2206     }
2207     else
2208     {
2209         GenerateContextLostErrorOnCurrentGlobalContext();
2210     }
2211 }
2212 
2213 // GL 3.1
GL_CopyBufferSubData(GLenum readTarget,GLenum writeTarget,GLintptr readOffset,GLintptr writeOffset,GLsizeiptr size)2214 void GL_APIENTRY GL_CopyBufferSubData(GLenum readTarget,
2215                                       GLenum writeTarget,
2216                                       GLintptr readOffset,
2217                                       GLintptr writeOffset,
2218                                       GLsizeiptr size)
2219 {
2220     Context *context = GetValidGlobalContext();
2221     EVENT(context, GLCopyBufferSubData,
2222           "context = %d, readTarget = %s, writeTarget = %s, readOffset = %llu, writeOffset = %llu, "
2223           "size = %llu",
2224           CID(context), GLenumToString(GLenumGroup::CopyBufferSubDataTarget, readTarget),
2225           GLenumToString(GLenumGroup::CopyBufferSubDataTarget, writeTarget),
2226           static_cast<unsigned long long>(readOffset), static_cast<unsigned long long>(writeOffset),
2227           static_cast<unsigned long long>(size));
2228 
2229     if (context)
2230     {
2231         BufferBinding readTargetPacked  = PackParam<BufferBinding>(readTarget);
2232         BufferBinding writeTargetPacked = PackParam<BufferBinding>(writeTarget);
2233         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2234         bool isCallValid                                      = (context->skipValidation() ||
2235                             ValidateCopyBufferSubData(context, readTargetPacked, writeTargetPacked,
2236                                                       readOffset, writeOffset, size));
2237         if (isCallValid)
2238         {
2239             context->copyBufferSubData(readTargetPacked, writeTargetPacked, readOffset, writeOffset,
2240                                        size);
2241         }
2242         ANGLE_CAPTURE(CopyBufferSubData, isCallValid, context, readTargetPacked, writeTargetPacked,
2243                       readOffset, writeOffset, size);
2244     }
2245     else
2246     {
2247         GenerateContextLostErrorOnCurrentGlobalContext();
2248     }
2249 }
2250 
GL_DrawArraysInstanced(GLenum mode,GLint first,GLsizei count,GLsizei instancecount)2251 void GL_APIENTRY GL_DrawArraysInstanced(GLenum mode,
2252                                         GLint first,
2253                                         GLsizei count,
2254                                         GLsizei instancecount)
2255 {
2256     Context *context = GetValidGlobalContext();
2257     EVENT(context, GLDrawArraysInstanced,
2258           "context = %d, mode = %s, first = %d, count = %d, instancecount = %d", CID(context),
2259           GLenumToString(GLenumGroup::PrimitiveType, mode), first, count, instancecount);
2260 
2261     if (context)
2262     {
2263         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
2264         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2265         bool isCallValid =
2266             (context->skipValidation() ||
2267              ValidateDrawArraysInstanced(context, modePacked, first, count, instancecount));
2268         if (isCallValid)
2269         {
2270             context->drawArraysInstanced(modePacked, first, count, instancecount);
2271         }
2272         ANGLE_CAPTURE(DrawArraysInstanced, isCallValid, context, modePacked, first, count,
2273                       instancecount);
2274     }
2275     else
2276     {
2277         GenerateContextLostErrorOnCurrentGlobalContext();
2278     }
2279 }
2280 
GL_DrawElementsInstanced(GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei instancecount)2281 void GL_APIENTRY GL_DrawElementsInstanced(GLenum mode,
2282                                           GLsizei count,
2283                                           GLenum type,
2284                                           const void *indices,
2285                                           GLsizei instancecount)
2286 {
2287     Context *context = GetValidGlobalContext();
2288     EVENT(context, GLDrawElementsInstanced,
2289           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
2290           ", instancecount = %d",
2291           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), count,
2292           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices, instancecount);
2293 
2294     if (context)
2295     {
2296         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
2297         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
2298         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2299         bool isCallValid                                      = (context->skipValidation() ||
2300                             ValidateDrawElementsInstanced(context, modePacked, count, typePacked,
2301                                                           indices, instancecount));
2302         if (isCallValid)
2303         {
2304             context->drawElementsInstanced(modePacked, count, typePacked, indices, instancecount);
2305         }
2306         ANGLE_CAPTURE(DrawElementsInstanced, isCallValid, context, modePacked, count, typePacked,
2307                       indices, instancecount);
2308     }
2309     else
2310     {
2311         GenerateContextLostErrorOnCurrentGlobalContext();
2312     }
2313 }
2314 
GL_GetActiveUniformBlockName(GLuint program,GLuint uniformBlockIndex,GLsizei bufSize,GLsizei * length,GLchar * uniformBlockName)2315 void GL_APIENTRY GL_GetActiveUniformBlockName(GLuint program,
2316                                               GLuint uniformBlockIndex,
2317                                               GLsizei bufSize,
2318                                               GLsizei *length,
2319                                               GLchar *uniformBlockName)
2320 {
2321     Context *context = GetValidGlobalContext();
2322     EVENT(
2323         context, GLGetActiveUniformBlockName,
2324         "context = %d, program = %u, uniformBlockIndex = %u, bufSize = %d, length = 0x%016" PRIxPTR
2325         ", uniformBlockName = 0x%016" PRIxPTR "",
2326         CID(context), program, uniformBlockIndex, bufSize, (uintptr_t)length,
2327         (uintptr_t)uniformBlockName);
2328 
2329     if (context)
2330     {
2331         ShaderProgramID programPacked             = PackParam<ShaderProgramID>(program);
2332         UniformBlockIndex uniformBlockIndexPacked = PackParam<UniformBlockIndex>(uniformBlockIndex);
2333         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2334         bool isCallValid =
2335             (context->skipValidation() ||
2336              ValidateGetActiveUniformBlockName(context, programPacked, uniformBlockIndexPacked,
2337                                                bufSize, length, uniformBlockName));
2338         if (isCallValid)
2339         {
2340             context->getActiveUniformBlockName(programPacked, uniformBlockIndexPacked, bufSize,
2341                                                length, uniformBlockName);
2342         }
2343         ANGLE_CAPTURE(GetActiveUniformBlockName, isCallValid, context, programPacked,
2344                       uniformBlockIndexPacked, bufSize, length, uniformBlockName);
2345     }
2346     else
2347     {
2348         GenerateContextLostErrorOnCurrentGlobalContext();
2349     }
2350 }
2351 
GL_GetActiveUniformBlockiv(GLuint program,GLuint uniformBlockIndex,GLenum pname,GLint * params)2352 void GL_APIENTRY GL_GetActiveUniformBlockiv(GLuint program,
2353                                             GLuint uniformBlockIndex,
2354                                             GLenum pname,
2355                                             GLint *params)
2356 {
2357     Context *context = GetValidGlobalContext();
2358     EVENT(context, GLGetActiveUniformBlockiv,
2359           "context = %d, program = %u, uniformBlockIndex = %u, pname = %s, params = 0x%016" PRIxPTR
2360           "",
2361           CID(context), program, uniformBlockIndex,
2362           GLenumToString(GLenumGroup::UniformBlockPName, pname), (uintptr_t)params);
2363 
2364     if (context)
2365     {
2366         ShaderProgramID programPacked             = PackParam<ShaderProgramID>(program);
2367         UniformBlockIndex uniformBlockIndexPacked = PackParam<UniformBlockIndex>(uniformBlockIndex);
2368         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2369         bool isCallValid                                      = (context->skipValidation() ||
2370                             ValidateGetActiveUniformBlockiv(
2371                                 context, programPacked, uniformBlockIndexPacked, pname, params));
2372         if (isCallValid)
2373         {
2374             context->getActiveUniformBlockiv(programPacked, uniformBlockIndexPacked, pname, params);
2375         }
2376         ANGLE_CAPTURE(GetActiveUniformBlockiv, isCallValid, context, programPacked,
2377                       uniformBlockIndexPacked, pname, params);
2378     }
2379     else
2380     {
2381         GenerateContextLostErrorOnCurrentGlobalContext();
2382     }
2383 }
2384 
GL_GetActiveUniformName(GLuint program,GLuint uniformIndex,GLsizei bufSize,GLsizei * length,GLchar * uniformName)2385 void GL_APIENTRY GL_GetActiveUniformName(GLuint program,
2386                                          GLuint uniformIndex,
2387                                          GLsizei bufSize,
2388                                          GLsizei *length,
2389                                          GLchar *uniformName)
2390 {
2391     Context *context = GetValidGlobalContext();
2392     EVENT(context, GLGetActiveUniformName,
2393           "context = %d, program = %u, uniformIndex = %u, bufSize = %d, length = 0x%016" PRIxPTR
2394           ", uniformName = 0x%016" PRIxPTR "",
2395           CID(context), program, uniformIndex, bufSize, (uintptr_t)length, (uintptr_t)uniformName);
2396 
2397     if (context)
2398     {
2399         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
2400         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2401         bool isCallValid                                      = (context->skipValidation() ||
2402                             ValidateGetActiveUniformName(context, programPacked, uniformIndex,
2403                                                          bufSize, length, uniformName));
2404         if (isCallValid)
2405         {
2406             context->getActiveUniformName(programPacked, uniformIndex, bufSize, length,
2407                                           uniformName);
2408         }
2409         ANGLE_CAPTURE(GetActiveUniformName, isCallValid, context, programPacked, uniformIndex,
2410                       bufSize, length, uniformName);
2411     }
2412     else
2413     {
2414         GenerateContextLostErrorOnCurrentGlobalContext();
2415     }
2416 }
2417 
GL_GetActiveUniformsiv(GLuint program,GLsizei uniformCount,const GLuint * uniformIndices,GLenum pname,GLint * params)2418 void GL_APIENTRY GL_GetActiveUniformsiv(GLuint program,
2419                                         GLsizei uniformCount,
2420                                         const GLuint *uniformIndices,
2421                                         GLenum pname,
2422                                         GLint *params)
2423 {
2424     Context *context = GetValidGlobalContext();
2425     EVENT(context, GLGetActiveUniformsiv,
2426           "context = %d, program = %u, uniformCount = %d, uniformIndices = 0x%016" PRIxPTR
2427           ", pname = %s, params = 0x%016" PRIxPTR "",
2428           CID(context), program, uniformCount, (uintptr_t)uniformIndices,
2429           GLenumToString(GLenumGroup::UniformPName, pname), (uintptr_t)params);
2430 
2431     if (context)
2432     {
2433         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
2434         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2435         bool isCallValid                                      = (context->skipValidation() ||
2436                             ValidateGetActiveUniformsiv(context, programPacked, uniformCount,
2437                                                         uniformIndices, pname, params));
2438         if (isCallValid)
2439         {
2440             context->getActiveUniformsiv(programPacked, uniformCount, uniformIndices, pname,
2441                                          params);
2442         }
2443         ANGLE_CAPTURE(GetActiveUniformsiv, isCallValid, context, programPacked, uniformCount,
2444                       uniformIndices, pname, params);
2445     }
2446     else
2447     {
2448         GenerateContextLostErrorOnCurrentGlobalContext();
2449     }
2450 }
2451 
GL_GetUniformBlockIndex(GLuint program,const GLchar * uniformBlockName)2452 GLuint GL_APIENTRY GL_GetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
2453 {
2454     Context *context = GetValidGlobalContext();
2455     EVENT(context, GLGetUniformBlockIndex,
2456           "context = %d, program = %u, uniformBlockName = 0x%016" PRIxPTR "", CID(context), program,
2457           (uintptr_t)uniformBlockName);
2458 
2459     GLuint returnValue;
2460     if (context)
2461     {
2462         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
2463         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2464         bool isCallValid                                      = (context->skipValidation() ||
2465                             ValidateGetUniformBlockIndex(context, programPacked, uniformBlockName));
2466         if (isCallValid)
2467         {
2468             returnValue = context->getUniformBlockIndex(programPacked, uniformBlockName);
2469         }
2470         else
2471         {
2472             returnValue =
2473                 GetDefaultReturnValue<angle::EntryPoint::GLGetUniformBlockIndex, GLuint>();
2474         }
2475         ANGLE_CAPTURE(GetUniformBlockIndex, isCallValid, context, programPacked, uniformBlockName,
2476                       returnValue);
2477     }
2478     else
2479     {
2480         GenerateContextLostErrorOnCurrentGlobalContext();
2481         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetUniformBlockIndex, GLuint>();
2482     }
2483     return returnValue;
2484 }
2485 
GL_GetUniformIndices(GLuint program,GLsizei uniformCount,const GLchar * const * uniformNames,GLuint * uniformIndices)2486 void GL_APIENTRY GL_GetUniformIndices(GLuint program,
2487                                       GLsizei uniformCount,
2488                                       const GLchar *const *uniformNames,
2489                                       GLuint *uniformIndices)
2490 {
2491     Context *context = GetValidGlobalContext();
2492     EVENT(context, GLGetUniformIndices,
2493           "context = %d, program = %u, uniformCount = %d, uniformNames = 0x%016" PRIxPTR
2494           ", uniformIndices = 0x%016" PRIxPTR "",
2495           CID(context), program, uniformCount, (uintptr_t)uniformNames, (uintptr_t)uniformIndices);
2496 
2497     if (context)
2498     {
2499         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
2500         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2501         bool isCallValid                                      = (context->skipValidation() ||
2502                             ValidateGetUniformIndices(context, programPacked, uniformCount,
2503                                                       uniformNames, uniformIndices));
2504         if (isCallValid)
2505         {
2506             context->getUniformIndices(programPacked, uniformCount, uniformNames, uniformIndices);
2507         }
2508         ANGLE_CAPTURE(GetUniformIndices, isCallValid, context, programPacked, uniformCount,
2509                       uniformNames, uniformIndices);
2510     }
2511     else
2512     {
2513         GenerateContextLostErrorOnCurrentGlobalContext();
2514     }
2515 }
2516 
GL_PrimitiveRestartIndex(GLuint index)2517 void GL_APIENTRY GL_PrimitiveRestartIndex(GLuint index)
2518 {
2519     Context *context = GetValidGlobalContext();
2520     EVENT(context, GLPrimitiveRestartIndex, "context = %d, index = %u", CID(context), index);
2521 
2522     if (context)
2523     {
2524         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2525         bool isCallValid =
2526             (context->skipValidation() || ValidatePrimitiveRestartIndex(context, index));
2527         if (isCallValid)
2528         {
2529             context->primitiveRestartIndex(index);
2530         }
2531         ANGLE_CAPTURE(PrimitiveRestartIndex, isCallValid, context, index);
2532     }
2533     else
2534     {
2535         GenerateContextLostErrorOnCurrentGlobalContext();
2536     }
2537 }
2538 
GL_TexBuffer(GLenum target,GLenum internalformat,GLuint buffer)2539 void GL_APIENTRY GL_TexBuffer(GLenum target, GLenum internalformat, GLuint buffer)
2540 {
2541     Context *context = GetValidGlobalContext();
2542     EVENT(context, GLTexBuffer, "context = %d, target = %s, internalformat = %s, buffer = %u",
2543           CID(context), GLenumToString(GLenumGroup::TextureTarget, target),
2544           GLenumToString(GLenumGroup::InternalFormat, internalformat), buffer);
2545 
2546     if (context)
2547     {
2548         TextureType targetPacked                              = PackParam<TextureType>(target);
2549         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
2550         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2551         bool isCallValid                                      = (context->skipValidation() ||
2552                             ValidateTexBuffer(context, targetPacked, internalformat, bufferPacked));
2553         if (isCallValid)
2554         {
2555             context->texBuffer(targetPacked, internalformat, bufferPacked);
2556         }
2557         ANGLE_CAPTURE(TexBuffer, isCallValid, context, targetPacked, internalformat, bufferPacked);
2558     }
2559     else
2560     {
2561         GenerateContextLostErrorOnCurrentGlobalContext();
2562     }
2563 }
2564 
GL_UniformBlockBinding(GLuint program,GLuint uniformBlockIndex,GLuint uniformBlockBinding)2565 void GL_APIENTRY GL_UniformBlockBinding(GLuint program,
2566                                         GLuint uniformBlockIndex,
2567                                         GLuint uniformBlockBinding)
2568 {
2569     Context *context = GetValidGlobalContext();
2570     EVENT(context, GLUniformBlockBinding,
2571           "context = %d, program = %u, uniformBlockIndex = %u, uniformBlockBinding = %u",
2572           CID(context), program, uniformBlockIndex, uniformBlockBinding);
2573 
2574     if (context)
2575     {
2576         ShaderProgramID programPacked             = PackParam<ShaderProgramID>(program);
2577         UniformBlockIndex uniformBlockIndexPacked = PackParam<UniformBlockIndex>(uniformBlockIndex);
2578         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2579         bool isCallValid =
2580             (context->skipValidation() ||
2581              ValidateUniformBlockBinding(context, programPacked, uniformBlockIndexPacked,
2582                                          uniformBlockBinding));
2583         if (isCallValid)
2584         {
2585             context->uniformBlockBinding(programPacked, uniformBlockIndexPacked,
2586                                          uniformBlockBinding);
2587         }
2588         ANGLE_CAPTURE(UniformBlockBinding, isCallValid, context, programPacked,
2589                       uniformBlockIndexPacked, uniformBlockBinding);
2590     }
2591     else
2592     {
2593         GenerateContextLostErrorOnCurrentGlobalContext();
2594     }
2595 }
2596 
2597 // GL 3.2
GL_ClientWaitSync(GLsync sync,GLbitfield flags,GLuint64 timeout)2598 GLenum GL_APIENTRY GL_ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
2599 {
2600     Context *context = GetValidGlobalContext();
2601     EVENT(context, GLClientWaitSync,
2602           "context = %d, sync = 0x%016" PRIxPTR ", flags = %s, timeout = %llu", CID(context),
2603           (uintptr_t)sync, GLbitfieldToString(GLenumGroup::SyncObjectMask, flags).c_str(),
2604           static_cast<unsigned long long>(timeout));
2605 
2606     GLenum returnValue;
2607     if (context)
2608     {
2609         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2610         bool isCallValid =
2611             (context->skipValidation() || ValidateClientWaitSync(context, sync, flags, timeout));
2612         if (isCallValid)
2613         {
2614             returnValue = context->clientWaitSync(sync, flags, timeout);
2615         }
2616         else
2617         {
2618             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLClientWaitSync, GLenum>();
2619         }
2620         ANGLE_CAPTURE(ClientWaitSync, isCallValid, context, sync, flags, timeout, returnValue);
2621     }
2622     else
2623     {
2624         GenerateContextLostErrorOnCurrentGlobalContext();
2625         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLClientWaitSync, GLenum>();
2626     }
2627     return returnValue;
2628 }
2629 
GL_DeleteSync(GLsync sync)2630 void GL_APIENTRY GL_DeleteSync(GLsync sync)
2631 {
2632     Context *context = GetValidGlobalContext();
2633     EVENT(context, GLDeleteSync, "context = %d, sync = 0x%016" PRIxPTR "", CID(context),
2634           (uintptr_t)sync);
2635 
2636     if (context)
2637     {
2638         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2639         bool isCallValid = (context->skipValidation() || ValidateDeleteSync(context, sync));
2640         if (isCallValid)
2641         {
2642             context->deleteSync(sync);
2643         }
2644         ANGLE_CAPTURE(DeleteSync, isCallValid, context, sync);
2645     }
2646     else
2647     {
2648         GenerateContextLostErrorOnCurrentGlobalContext();
2649     }
2650 }
2651 
GL_DrawElementsBaseVertex(GLenum mode,GLsizei count,GLenum type,const void * indices,GLint basevertex)2652 void GL_APIENTRY GL_DrawElementsBaseVertex(GLenum mode,
2653                                            GLsizei count,
2654                                            GLenum type,
2655                                            const void *indices,
2656                                            GLint basevertex)
2657 {
2658     Context *context = GetValidGlobalContext();
2659     EVENT(context, GLDrawElementsBaseVertex,
2660           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
2661           ", basevertex = %d",
2662           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), count,
2663           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices, basevertex);
2664 
2665     if (context)
2666     {
2667         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
2668         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
2669         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2670         bool isCallValid                                      = (context->skipValidation() ||
2671                             ValidateDrawElementsBaseVertex(context, modePacked, count, typePacked,
2672                                                            indices, basevertex));
2673         if (isCallValid)
2674         {
2675             context->drawElementsBaseVertex(modePacked, count, typePacked, indices, basevertex);
2676         }
2677         ANGLE_CAPTURE(DrawElementsBaseVertex, isCallValid, context, modePacked, count, typePacked,
2678                       indices, basevertex);
2679     }
2680     else
2681     {
2682         GenerateContextLostErrorOnCurrentGlobalContext();
2683     }
2684 }
2685 
GL_DrawElementsInstancedBaseVertex(GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei instancecount,GLint basevertex)2686 void GL_APIENTRY GL_DrawElementsInstancedBaseVertex(GLenum mode,
2687                                                     GLsizei count,
2688                                                     GLenum type,
2689                                                     const void *indices,
2690                                                     GLsizei instancecount,
2691                                                     GLint basevertex)
2692 {
2693     Context *context = GetValidGlobalContext();
2694     EVENT(context, GLDrawElementsInstancedBaseVertex,
2695           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
2696           ", instancecount = %d, basevertex = %d",
2697           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), count,
2698           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices, instancecount,
2699           basevertex);
2700 
2701     if (context)
2702     {
2703         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
2704         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
2705         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2706         bool isCallValid = (context->skipValidation() || ValidateDrawElementsInstancedBaseVertex(
2707                                                              context, modePacked, count, typePacked,
2708                                                              indices, instancecount, basevertex));
2709         if (isCallValid)
2710         {
2711             context->drawElementsInstancedBaseVertex(modePacked, count, typePacked, indices,
2712                                                      instancecount, basevertex);
2713         }
2714         ANGLE_CAPTURE(DrawElementsInstancedBaseVertex, isCallValid, context, modePacked, count,
2715                       typePacked, indices, instancecount, basevertex);
2716     }
2717     else
2718     {
2719         GenerateContextLostErrorOnCurrentGlobalContext();
2720     }
2721 }
2722 
GL_DrawRangeElementsBaseVertex(GLenum mode,GLuint start,GLuint end,GLsizei count,GLenum type,const void * indices,GLint basevertex)2723 void GL_APIENTRY GL_DrawRangeElementsBaseVertex(GLenum mode,
2724                                                 GLuint start,
2725                                                 GLuint end,
2726                                                 GLsizei count,
2727                                                 GLenum type,
2728                                                 const void *indices,
2729                                                 GLint basevertex)
2730 {
2731     Context *context = GetValidGlobalContext();
2732     EVENT(context, GLDrawRangeElementsBaseVertex,
2733           "context = %d, mode = %s, start = %u, end = %u, count = %d, type = %s, indices = "
2734           "0x%016" PRIxPTR ", basevertex = %d",
2735           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), start, end, count,
2736           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices, basevertex);
2737 
2738     if (context)
2739     {
2740         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
2741         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
2742         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2743         bool isCallValid = (context->skipValidation() || ValidateDrawRangeElementsBaseVertex(
2744                                                              context, modePacked, start, end, count,
2745                                                              typePacked, indices, basevertex));
2746         if (isCallValid)
2747         {
2748             context->drawRangeElementsBaseVertex(modePacked, start, end, count, typePacked, indices,
2749                                                  basevertex);
2750         }
2751         ANGLE_CAPTURE(DrawRangeElementsBaseVertex, isCallValid, context, modePacked, start, end,
2752                       count, typePacked, indices, basevertex);
2753     }
2754     else
2755     {
2756         GenerateContextLostErrorOnCurrentGlobalContext();
2757     }
2758 }
2759 
GL_FenceSync(GLenum condition,GLbitfield flags)2760 GLsync GL_APIENTRY GL_FenceSync(GLenum condition, GLbitfield flags)
2761 {
2762     Context *context = GetValidGlobalContext();
2763     EVENT(context, GLFenceSync, "context = %d, condition = %s, flags = %s", CID(context),
2764           GLenumToString(GLenumGroup::SyncCondition, condition),
2765           GLbitfieldToString(GLenumGroup::DefaultGroup, flags).c_str());
2766 
2767     GLsync returnValue;
2768     if (context)
2769     {
2770         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2771         bool isCallValid =
2772             (context->skipValidation() || ValidateFenceSync(context, condition, flags));
2773         if (isCallValid)
2774         {
2775             returnValue = context->fenceSync(condition, flags);
2776         }
2777         else
2778         {
2779             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLFenceSync, GLsync>();
2780         }
2781         ANGLE_CAPTURE(FenceSync, isCallValid, context, condition, flags, returnValue);
2782     }
2783     else
2784     {
2785         GenerateContextLostErrorOnCurrentGlobalContext();
2786         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLFenceSync, GLsync>();
2787     }
2788     return returnValue;
2789 }
2790 
GL_FramebufferTexture(GLenum target,GLenum attachment,GLuint texture,GLint level)2791 void GL_APIENTRY GL_FramebufferTexture(GLenum target,
2792                                        GLenum attachment,
2793                                        GLuint texture,
2794                                        GLint level)
2795 {
2796     Context *context = GetValidGlobalContext();
2797     EVENT(context, GLFramebufferTexture,
2798           "context = %d, target = %s, attachment = %s, texture = %u, level = %d", CID(context),
2799           GLenumToString(GLenumGroup::FramebufferTarget, target),
2800           GLenumToString(GLenumGroup::FramebufferAttachment, attachment), texture, level);
2801 
2802     if (context)
2803     {
2804         TextureID texturePacked                               = PackParam<TextureID>(texture);
2805         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2806         bool isCallValid =
2807             (context->skipValidation() ||
2808              ValidateFramebufferTexture(context, target, attachment, texturePacked, level));
2809         if (isCallValid)
2810         {
2811             context->framebufferTexture(target, attachment, texturePacked, level);
2812         }
2813         ANGLE_CAPTURE(FramebufferTexture, isCallValid, context, target, attachment, texturePacked,
2814                       level);
2815     }
2816     else
2817     {
2818         GenerateContextLostErrorOnCurrentGlobalContext();
2819     }
2820 }
2821 
GL_GetBufferParameteri64v(GLenum target,GLenum pname,GLint64 * params)2822 void GL_APIENTRY GL_GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
2823 {
2824     Context *context = GetValidGlobalContext();
2825     EVENT(context, GLGetBufferParameteri64v,
2826           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
2827           GLenumToString(GLenumGroup::BufferTargetARB, target),
2828           GLenumToString(GLenumGroup::DefaultGroup, pname), (uintptr_t)params);
2829 
2830     if (context)
2831     {
2832         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
2833         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2834         bool isCallValid                                      = (context->skipValidation() ||
2835                             ValidateGetBufferParameteri64v(context, targetPacked, pname, params));
2836         if (isCallValid)
2837         {
2838             context->getBufferParameteri64v(targetPacked, pname, params);
2839         }
2840         ANGLE_CAPTURE(GetBufferParameteri64v, isCallValid, context, targetPacked, pname, params);
2841     }
2842     else
2843     {
2844         GenerateContextLostErrorOnCurrentGlobalContext();
2845     }
2846 }
2847 
GL_GetInteger64i_v(GLenum target,GLuint index,GLint64 * data)2848 void GL_APIENTRY GL_GetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
2849 {
2850     Context *context = GetValidGlobalContext();
2851     EVENT(context, GLGetInteger64i_v,
2852           "context = %d, target = %s, index = %u, data = 0x%016" PRIxPTR "", CID(context),
2853           GLenumToString(GLenumGroup::TypeEnum, target), index, (uintptr_t)data);
2854 
2855     if (context)
2856     {
2857         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2858         bool isCallValid =
2859             (context->skipValidation() || ValidateGetInteger64i_v(context, target, index, data));
2860         if (isCallValid)
2861         {
2862             context->getInteger64i_v(target, index, data);
2863         }
2864         ANGLE_CAPTURE(GetInteger64i_v, isCallValid, context, target, index, data);
2865     }
2866     else
2867     {
2868         GenerateContextLostErrorOnCurrentGlobalContext();
2869     }
2870 }
2871 
GL_GetInteger64v(GLenum pname,GLint64 * data)2872 void GL_APIENTRY GL_GetInteger64v(GLenum pname, GLint64 *data)
2873 {
2874     Context *context = GetValidGlobalContext();
2875     EVENT(context, GLGetInteger64v, "context = %d, pname = %s, data = 0x%016" PRIxPTR "",
2876           CID(context), GLenumToString(GLenumGroup::GetPName, pname), (uintptr_t)data);
2877 
2878     if (context)
2879     {
2880         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2881         bool isCallValid =
2882             (context->skipValidation() || ValidateGetInteger64v(context, pname, data));
2883         if (isCallValid)
2884         {
2885             context->getInteger64v(pname, data);
2886         }
2887         ANGLE_CAPTURE(GetInteger64v, isCallValid, context, pname, data);
2888     }
2889     else
2890     {
2891         GenerateContextLostErrorOnCurrentGlobalContext();
2892     }
2893 }
2894 
GL_GetMultisamplefv(GLenum pname,GLuint index,GLfloat * val)2895 void GL_APIENTRY GL_GetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
2896 {
2897     Context *context = GetValidGlobalContext();
2898     EVENT(context, GLGetMultisamplefv,
2899           "context = %d, pname = %s, index = %u, val = 0x%016" PRIxPTR "", CID(context),
2900           GLenumToString(GLenumGroup::DefaultGroup, pname), index, (uintptr_t)val);
2901 
2902     if (context)
2903     {
2904         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2905         bool isCallValid =
2906             (context->skipValidation() || ValidateGetMultisamplefv(context, pname, index, val));
2907         if (isCallValid)
2908         {
2909             context->getMultisamplefv(pname, index, val);
2910         }
2911         ANGLE_CAPTURE(GetMultisamplefv, isCallValid, context, pname, index, val);
2912     }
2913     else
2914     {
2915         GenerateContextLostErrorOnCurrentGlobalContext();
2916     }
2917 }
2918 
2919 void GL_APIENTRY
GL_GetSynciv(GLsync sync,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * values)2920 GL_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
2921 {
2922     Context *context = GetGlobalContext();
2923     EVENT(context, GLGetSynciv,
2924           "context = %d, sync = 0x%016" PRIxPTR
2925           ", pname = %s, bufSize = %d, length = 0x%016" PRIxPTR ", values = 0x%016" PRIxPTR "",
2926           CID(context), (uintptr_t)sync, GLenumToString(GLenumGroup::SyncParameterName, pname),
2927           bufSize, (uintptr_t)length, (uintptr_t)values);
2928 
2929     if (context)
2930     {
2931         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2932         bool isCallValid                                      = (context->skipValidation() ||
2933                             ValidateGetSynciv(context, sync, pname, bufSize, length, values));
2934         if (isCallValid)
2935         {
2936             context->getSynciv(sync, pname, bufSize, length, values);
2937         }
2938         ANGLE_CAPTURE(GetSynciv, isCallValid, context, sync, pname, bufSize, length, values);
2939     }
2940     else
2941     {}
2942 }
2943 
GL_IsSync(GLsync sync)2944 GLboolean GL_APIENTRY GL_IsSync(GLsync sync)
2945 {
2946     Context *context = GetValidGlobalContext();
2947     EVENT(context, GLIsSync, "context = %d, sync = 0x%016" PRIxPTR "", CID(context),
2948           (uintptr_t)sync);
2949 
2950     GLboolean returnValue;
2951     if (context)
2952     {
2953         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2954         bool isCallValid = (context->skipValidation() || ValidateIsSync(context, sync));
2955         if (isCallValid)
2956         {
2957             returnValue = context->isSync(sync);
2958         }
2959         else
2960         {
2961             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsSync, GLboolean>();
2962         }
2963         ANGLE_CAPTURE(IsSync, isCallValid, context, sync, returnValue);
2964     }
2965     else
2966     {
2967         GenerateContextLostErrorOnCurrentGlobalContext();
2968         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsSync, GLboolean>();
2969     }
2970     return returnValue;
2971 }
2972 
GL_MultiDrawElementsBaseVertex(GLenum mode,const GLsizei * count,GLenum type,const void * const * indices,GLsizei drawcount,const GLint * basevertex)2973 void GL_APIENTRY GL_MultiDrawElementsBaseVertex(GLenum mode,
2974                                                 const GLsizei *count,
2975                                                 GLenum type,
2976                                                 const void *const *indices,
2977                                                 GLsizei drawcount,
2978                                                 const GLint *basevertex)
2979 {
2980     Context *context = GetValidGlobalContext();
2981     EVENT(context, GLMultiDrawElementsBaseVertex,
2982           "context = %d, mode = %s, count = 0x%016" PRIxPTR ", type = %s, indices = 0x%016" PRIxPTR
2983           ", drawcount = %d, basevertex = 0x%016" PRIxPTR "",
2984           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), (uintptr_t)count,
2985           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices, drawcount,
2986           (uintptr_t)basevertex);
2987 
2988     if (context)
2989     {
2990         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
2991         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
2992         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2993         bool isCallValid = (context->skipValidation() || ValidateMultiDrawElementsBaseVertex(
2994                                                              context, modePacked, count, typePacked,
2995                                                              indices, drawcount, basevertex));
2996         if (isCallValid)
2997         {
2998             context->multiDrawElementsBaseVertex(modePacked, count, typePacked, indices, drawcount,
2999                                                  basevertex);
3000         }
3001         ANGLE_CAPTURE(MultiDrawElementsBaseVertex, isCallValid, context, modePacked, count,
3002                       typePacked, indices, drawcount, basevertex);
3003     }
3004     else
3005     {
3006         GenerateContextLostErrorOnCurrentGlobalContext();
3007     }
3008 }
3009 
GL_ProvokingVertex(GLenum mode)3010 void GL_APIENTRY GL_ProvokingVertex(GLenum mode)
3011 {
3012     Context *context = GetValidGlobalContext();
3013     EVENT(context, GLProvokingVertex, "context = %d, mode = %s", CID(context),
3014           GLenumToString(GLenumGroup::VertexProvokingMode, mode));
3015 
3016     if (context)
3017     {
3018         ProvokingVertexConvention modePacked = PackParam<ProvokingVertexConvention>(mode);
3019         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3020         bool isCallValid =
3021             (context->skipValidation() || ValidateProvokingVertex(context, modePacked));
3022         if (isCallValid)
3023         {
3024             context->provokingVertex(modePacked);
3025         }
3026         ANGLE_CAPTURE(ProvokingVertex, isCallValid, context, modePacked);
3027     }
3028     else
3029     {
3030         GenerateContextLostErrorOnCurrentGlobalContext();
3031     }
3032 }
3033 
GL_SampleMaski(GLuint maskNumber,GLbitfield mask)3034 void GL_APIENTRY GL_SampleMaski(GLuint maskNumber, GLbitfield mask)
3035 {
3036     Context *context = GetValidGlobalContext();
3037     EVENT(context, GLSampleMaski, "context = %d, maskNumber = %u, mask = %s", CID(context),
3038           maskNumber, GLbitfieldToString(GLenumGroup::DefaultGroup, mask).c_str());
3039 
3040     if (context)
3041     {
3042         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3043         bool isCallValid =
3044             (context->skipValidation() || ValidateSampleMaski(context, maskNumber, mask));
3045         if (isCallValid)
3046         {
3047             context->sampleMaski(maskNumber, mask);
3048         }
3049         ANGLE_CAPTURE(SampleMaski, isCallValid, context, maskNumber, mask);
3050     }
3051     else
3052     {
3053         GenerateContextLostErrorOnCurrentGlobalContext();
3054     }
3055 }
3056 
GL_TexImage2DMultisample(GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height,GLboolean fixedsamplelocations)3057 void GL_APIENTRY GL_TexImage2DMultisample(GLenum target,
3058                                           GLsizei samples,
3059                                           GLenum internalformat,
3060                                           GLsizei width,
3061                                           GLsizei height,
3062                                           GLboolean fixedsamplelocations)
3063 {
3064     Context *context = GetValidGlobalContext();
3065     EVENT(context, GLTexImage2DMultisample,
3066           "context = %d, target = %s, samples = %d, internalformat = %s, width = %d, height = %d, "
3067           "fixedsamplelocations = %s",
3068           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), samples,
3069           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height,
3070           GLbooleanToString(fixedsamplelocations));
3071 
3072     if (context)
3073     {
3074         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3075         bool isCallValid                                      = (context->skipValidation() ||
3076                             ValidateTexImage2DMultisample(context, target, samples, internalformat,
3077                                                           width, height, fixedsamplelocations));
3078         if (isCallValid)
3079         {
3080             context->texImage2DMultisample(target, samples, internalformat, width, height,
3081                                            fixedsamplelocations);
3082         }
3083         ANGLE_CAPTURE(TexImage2DMultisample, isCallValid, context, target, samples, internalformat,
3084                       width, height, fixedsamplelocations);
3085     }
3086     else
3087     {
3088         GenerateContextLostErrorOnCurrentGlobalContext();
3089     }
3090 }
3091 
GL_TexImage3DMultisample(GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLboolean fixedsamplelocations)3092 void GL_APIENTRY GL_TexImage3DMultisample(GLenum target,
3093                                           GLsizei samples,
3094                                           GLenum internalformat,
3095                                           GLsizei width,
3096                                           GLsizei height,
3097                                           GLsizei depth,
3098                                           GLboolean fixedsamplelocations)
3099 {
3100     Context *context = GetValidGlobalContext();
3101     EVENT(context, GLTexImage3DMultisample,
3102           "context = %d, target = %s, samples = %d, internalformat = %s, width = %d, height = %d, "
3103           "depth = %d, fixedsamplelocations = %s",
3104           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), samples,
3105           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height, depth,
3106           GLbooleanToString(fixedsamplelocations));
3107 
3108     if (context)
3109     {
3110         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3111         bool isCallValid =
3112             (context->skipValidation() ||
3113              ValidateTexImage3DMultisample(context, target, samples, internalformat, width, height,
3114                                            depth, fixedsamplelocations));
3115         if (isCallValid)
3116         {
3117             context->texImage3DMultisample(target, samples, internalformat, width, height, depth,
3118                                            fixedsamplelocations);
3119         }
3120         ANGLE_CAPTURE(TexImage3DMultisample, isCallValid, context, target, samples, internalformat,
3121                       width, height, depth, fixedsamplelocations);
3122     }
3123     else
3124     {
3125         GenerateContextLostErrorOnCurrentGlobalContext();
3126     }
3127 }
3128 
GL_WaitSync(GLsync sync,GLbitfield flags,GLuint64 timeout)3129 void GL_APIENTRY GL_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
3130 {
3131     Context *context = GetValidGlobalContext();
3132     EVENT(context, GLWaitSync, "context = %d, sync = 0x%016" PRIxPTR ", flags = %s, timeout = %llu",
3133           CID(context), (uintptr_t)sync,
3134           GLbitfieldToString(GLenumGroup::DefaultGroup, flags).c_str(),
3135           static_cast<unsigned long long>(timeout));
3136 
3137     if (context)
3138     {
3139         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3140         bool isCallValid =
3141             (context->skipValidation() || ValidateWaitSync(context, sync, flags, timeout));
3142         if (isCallValid)
3143         {
3144             context->waitSync(sync, flags, timeout);
3145         }
3146         ANGLE_CAPTURE(WaitSync, isCallValid, context, sync, flags, timeout);
3147     }
3148     else
3149     {
3150         GenerateContextLostErrorOnCurrentGlobalContext();
3151     }
3152 }
3153 
3154 // GL 3.3
GL_BindFragDataLocationIndexed(GLuint program,GLuint colorNumber,GLuint index,const GLchar * name)3155 void GL_APIENTRY GL_BindFragDataLocationIndexed(GLuint program,
3156                                                 GLuint colorNumber,
3157                                                 GLuint index,
3158                                                 const GLchar *name)
3159 {
3160     Context *context = GetValidGlobalContext();
3161     EVENT(context, GLBindFragDataLocationIndexed,
3162           "context = %d, program = %u, colorNumber = %u, index = %u, name = 0x%016" PRIxPTR "",
3163           CID(context), program, colorNumber, index, (uintptr_t)name);
3164 
3165     if (context)
3166     {
3167         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
3168         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3169         bool isCallValid =
3170             (context->skipValidation() ||
3171              ValidateBindFragDataLocationIndexed(context, programPacked, colorNumber, index, name));
3172         if (isCallValid)
3173         {
3174             context->bindFragDataLocationIndexed(programPacked, colorNumber, index, name);
3175         }
3176         ANGLE_CAPTURE(BindFragDataLocationIndexed, isCallValid, context, programPacked, colorNumber,
3177                       index, name);
3178     }
3179     else
3180     {
3181         GenerateContextLostErrorOnCurrentGlobalContext();
3182     }
3183 }
3184 
GL_BindSampler(GLuint unit,GLuint sampler)3185 void GL_APIENTRY GL_BindSampler(GLuint unit, GLuint sampler)
3186 {
3187     Context *context = GetValidGlobalContext();
3188     EVENT(context, GLBindSampler, "context = %d, unit = %u, sampler = %u", CID(context), unit,
3189           sampler);
3190 
3191     if (context)
3192     {
3193         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
3194         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3195         bool isCallValid =
3196             (context->skipValidation() || ValidateBindSampler(context, unit, samplerPacked));
3197         if (isCallValid)
3198         {
3199             context->bindSampler(unit, samplerPacked);
3200         }
3201         ANGLE_CAPTURE(BindSampler, isCallValid, context, unit, samplerPacked);
3202     }
3203     else
3204     {
3205         GenerateContextLostErrorOnCurrentGlobalContext();
3206     }
3207 }
3208 
GL_ColorP3ui(GLenum type,GLuint color)3209 void GL_APIENTRY GL_ColorP3ui(GLenum type, GLuint color)
3210 {
3211     Context *context = GetValidGlobalContext();
3212     EVENT(context, GLColorP3ui, "context = %d, type = %s, color = %u", CID(context),
3213           GLenumToString(GLenumGroup::ColorPointerType, type), color);
3214 
3215     if (context)
3216     {
3217         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3218         bool isCallValid = (context->skipValidation() || ValidateColorP3ui(context, type, color));
3219         if (isCallValid)
3220         {
3221             context->colorP3ui(type, color);
3222         }
3223         ANGLE_CAPTURE(ColorP3ui, isCallValid, context, type, color);
3224     }
3225     else
3226     {
3227         GenerateContextLostErrorOnCurrentGlobalContext();
3228     }
3229 }
3230 
GL_ColorP3uiv(GLenum type,const GLuint * color)3231 void GL_APIENTRY GL_ColorP3uiv(GLenum type, const GLuint *color)
3232 {
3233     Context *context = GetValidGlobalContext();
3234     EVENT(context, GLColorP3uiv, "context = %d, type = %s, color = 0x%016" PRIxPTR "", CID(context),
3235           GLenumToString(GLenumGroup::ColorPointerType, type), (uintptr_t)color);
3236 
3237     if (context)
3238     {
3239         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3240         bool isCallValid = (context->skipValidation() || ValidateColorP3uiv(context, type, color));
3241         if (isCallValid)
3242         {
3243             context->colorP3uiv(type, color);
3244         }
3245         ANGLE_CAPTURE(ColorP3uiv, isCallValid, context, type, color);
3246     }
3247     else
3248     {
3249         GenerateContextLostErrorOnCurrentGlobalContext();
3250     }
3251 }
3252 
GL_ColorP4ui(GLenum type,GLuint color)3253 void GL_APIENTRY GL_ColorP4ui(GLenum type, GLuint color)
3254 {
3255     Context *context = GetValidGlobalContext();
3256     EVENT(context, GLColorP4ui, "context = %d, type = %s, color = %u", CID(context),
3257           GLenumToString(GLenumGroup::ColorPointerType, type), color);
3258 
3259     if (context)
3260     {
3261         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3262         bool isCallValid = (context->skipValidation() || ValidateColorP4ui(context, type, color));
3263         if (isCallValid)
3264         {
3265             context->colorP4ui(type, color);
3266         }
3267         ANGLE_CAPTURE(ColorP4ui, isCallValid, context, type, color);
3268     }
3269     else
3270     {
3271         GenerateContextLostErrorOnCurrentGlobalContext();
3272     }
3273 }
3274 
GL_ColorP4uiv(GLenum type,const GLuint * color)3275 void GL_APIENTRY GL_ColorP4uiv(GLenum type, const GLuint *color)
3276 {
3277     Context *context = GetValidGlobalContext();
3278     EVENT(context, GLColorP4uiv, "context = %d, type = %s, color = 0x%016" PRIxPTR "", CID(context),
3279           GLenumToString(GLenumGroup::ColorPointerType, type), (uintptr_t)color);
3280 
3281     if (context)
3282     {
3283         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3284         bool isCallValid = (context->skipValidation() || ValidateColorP4uiv(context, type, color));
3285         if (isCallValid)
3286         {
3287             context->colorP4uiv(type, color);
3288         }
3289         ANGLE_CAPTURE(ColorP4uiv, isCallValid, context, type, color);
3290     }
3291     else
3292     {
3293         GenerateContextLostErrorOnCurrentGlobalContext();
3294     }
3295 }
3296 
GL_DeleteSamplers(GLsizei count,const GLuint * samplers)3297 void GL_APIENTRY GL_DeleteSamplers(GLsizei count, const GLuint *samplers)
3298 {
3299     Context *context = GetValidGlobalContext();
3300     EVENT(context, GLDeleteSamplers, "context = %d, count = %d, samplers = 0x%016" PRIxPTR "",
3301           CID(context), count, (uintptr_t)samplers);
3302 
3303     if (context)
3304     {
3305         const SamplerID *samplersPacked = PackParam<const SamplerID *>(samplers);
3306         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3307         bool isCallValid =
3308             (context->skipValidation() || ValidateDeleteSamplers(context, count, samplersPacked));
3309         if (isCallValid)
3310         {
3311             context->deleteSamplers(count, samplersPacked);
3312         }
3313         ANGLE_CAPTURE(DeleteSamplers, isCallValid, context, count, samplersPacked);
3314     }
3315     else
3316     {
3317         GenerateContextLostErrorOnCurrentGlobalContext();
3318     }
3319 }
3320 
GL_GenSamplers(GLsizei count,GLuint * samplers)3321 void GL_APIENTRY GL_GenSamplers(GLsizei count, GLuint *samplers)
3322 {
3323     Context *context = GetValidGlobalContext();
3324     EVENT(context, GLGenSamplers, "context = %d, count = %d, samplers = 0x%016" PRIxPTR "",
3325           CID(context), count, (uintptr_t)samplers);
3326 
3327     if (context)
3328     {
3329         SamplerID *samplersPacked                             = PackParam<SamplerID *>(samplers);
3330         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3331         bool isCallValid =
3332             (context->skipValidation() || ValidateGenSamplers(context, count, samplersPacked));
3333         if (isCallValid)
3334         {
3335             context->genSamplers(count, samplersPacked);
3336         }
3337         ANGLE_CAPTURE(GenSamplers, isCallValid, context, count, samplersPacked);
3338     }
3339     else
3340     {
3341         GenerateContextLostErrorOnCurrentGlobalContext();
3342     }
3343 }
3344 
GL_GetFragDataIndex(GLuint program,const GLchar * name)3345 GLint GL_APIENTRY GL_GetFragDataIndex(GLuint program, const GLchar *name)
3346 {
3347     Context *context = GetValidGlobalContext();
3348     EVENT(context, GLGetFragDataIndex, "context = %d, program = %u, name = 0x%016" PRIxPTR "",
3349           CID(context), program, (uintptr_t)name);
3350 
3351     GLint returnValue;
3352     if (context)
3353     {
3354         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
3355         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3356         bool isCallValid =
3357             (context->skipValidation() || ValidateGetFragDataIndex(context, programPacked, name));
3358         if (isCallValid)
3359         {
3360             returnValue = context->getFragDataIndex(programPacked, name);
3361         }
3362         else
3363         {
3364             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetFragDataIndex, GLint>();
3365         }
3366         ANGLE_CAPTURE(GetFragDataIndex, isCallValid, context, programPacked, name, returnValue);
3367     }
3368     else
3369     {
3370         GenerateContextLostErrorOnCurrentGlobalContext();
3371         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetFragDataIndex, GLint>();
3372     }
3373     return returnValue;
3374 }
3375 
GL_GetQueryObjecti64v(GLuint id,GLenum pname,GLint64 * params)3376 void GL_APIENTRY GL_GetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params)
3377 {
3378     Context *context = GetGlobalContext();
3379     EVENT(context, GLGetQueryObjecti64v,
3380           "context = %d, id = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), id,
3381           GLenumToString(GLenumGroup::QueryObjectParameterName, pname), (uintptr_t)params);
3382 
3383     if (context)
3384     {
3385         QueryID idPacked                                      = PackParam<QueryID>(id);
3386         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3387         bool isCallValid                                      = (context->skipValidation() ||
3388                             ValidateGetQueryObjecti64v(context, idPacked, pname, params));
3389         if (isCallValid)
3390         {
3391             context->getQueryObjecti64v(idPacked, pname, params);
3392         }
3393         ANGLE_CAPTURE(GetQueryObjecti64v, isCallValid, context, idPacked, pname, params);
3394     }
3395     else
3396     {}
3397 }
3398 
GL_GetQueryObjectui64v(GLuint id,GLenum pname,GLuint64 * params)3399 void GL_APIENTRY GL_GetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params)
3400 {
3401     Context *context = GetValidGlobalContext();
3402     EVENT(context, GLGetQueryObjectui64v,
3403           "context = %d, id = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), id,
3404           GLenumToString(GLenumGroup::QueryObjectParameterName, pname), (uintptr_t)params);
3405 
3406     if (context)
3407     {
3408         QueryID idPacked                                      = PackParam<QueryID>(id);
3409         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3410         bool isCallValid                                      = (context->skipValidation() ||
3411                             ValidateGetQueryObjectui64v(context, idPacked, pname, params));
3412         if (isCallValid)
3413         {
3414             context->getQueryObjectui64v(idPacked, pname, params);
3415         }
3416         ANGLE_CAPTURE(GetQueryObjectui64v, isCallValid, context, idPacked, pname, params);
3417     }
3418     else
3419     {
3420         GenerateContextLostErrorOnCurrentGlobalContext();
3421     }
3422 }
3423 
GL_GetSamplerParameterIiv(GLuint sampler,GLenum pname,GLint * params)3424 void GL_APIENTRY GL_GetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
3425 {
3426     Context *context = GetValidGlobalContext();
3427     EVENT(context, GLGetSamplerParameterIiv,
3428           "context = %d, sampler = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
3429           sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname), (uintptr_t)params);
3430 
3431     if (context)
3432     {
3433         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
3434         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3435         bool isCallValid                                      = (context->skipValidation() ||
3436                             ValidateGetSamplerParameterIiv(context, samplerPacked, pname, params));
3437         if (isCallValid)
3438         {
3439             context->getSamplerParameterIiv(samplerPacked, pname, params);
3440         }
3441         ANGLE_CAPTURE(GetSamplerParameterIiv, isCallValid, context, samplerPacked, pname, params);
3442     }
3443     else
3444     {
3445         GenerateContextLostErrorOnCurrentGlobalContext();
3446     }
3447 }
3448 
GL_GetSamplerParameterIuiv(GLuint sampler,GLenum pname,GLuint * params)3449 void GL_APIENTRY GL_GetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
3450 {
3451     Context *context = GetValidGlobalContext();
3452     EVENT(context, GLGetSamplerParameterIuiv,
3453           "context = %d, sampler = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
3454           sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname), (uintptr_t)params);
3455 
3456     if (context)
3457     {
3458         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
3459         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3460         bool isCallValid                                      = (context->skipValidation() ||
3461                             ValidateGetSamplerParameterIuiv(context, samplerPacked, pname, params));
3462         if (isCallValid)
3463         {
3464             context->getSamplerParameterIuiv(samplerPacked, pname, params);
3465         }
3466         ANGLE_CAPTURE(GetSamplerParameterIuiv, isCallValid, context, samplerPacked, pname, params);
3467     }
3468     else
3469     {
3470         GenerateContextLostErrorOnCurrentGlobalContext();
3471     }
3472 }
3473 
GL_GetSamplerParameterfv(GLuint sampler,GLenum pname,GLfloat * params)3474 void GL_APIENTRY GL_GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
3475 {
3476     Context *context = GetValidGlobalContext();
3477     EVENT(context, GLGetSamplerParameterfv,
3478           "context = %d, sampler = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
3479           sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname), (uintptr_t)params);
3480 
3481     if (context)
3482     {
3483         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
3484         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3485         bool isCallValid                                      = (context->skipValidation() ||
3486                             ValidateGetSamplerParameterfv(context, samplerPacked, pname, params));
3487         if (isCallValid)
3488         {
3489             context->getSamplerParameterfv(samplerPacked, pname, params);
3490         }
3491         ANGLE_CAPTURE(GetSamplerParameterfv, isCallValid, context, samplerPacked, pname, params);
3492     }
3493     else
3494     {
3495         GenerateContextLostErrorOnCurrentGlobalContext();
3496     }
3497 }
3498 
GL_GetSamplerParameteriv(GLuint sampler,GLenum pname,GLint * params)3499 void GL_APIENTRY GL_GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
3500 {
3501     Context *context = GetValidGlobalContext();
3502     EVENT(context, GLGetSamplerParameteriv,
3503           "context = %d, sampler = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
3504           sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname), (uintptr_t)params);
3505 
3506     if (context)
3507     {
3508         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
3509         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3510         bool isCallValid                                      = (context->skipValidation() ||
3511                             ValidateGetSamplerParameteriv(context, samplerPacked, pname, params));
3512         if (isCallValid)
3513         {
3514             context->getSamplerParameteriv(samplerPacked, pname, params);
3515         }
3516         ANGLE_CAPTURE(GetSamplerParameteriv, isCallValid, context, samplerPacked, pname, params);
3517     }
3518     else
3519     {
3520         GenerateContextLostErrorOnCurrentGlobalContext();
3521     }
3522 }
3523 
GL_IsSampler(GLuint sampler)3524 GLboolean GL_APIENTRY GL_IsSampler(GLuint sampler)
3525 {
3526     Context *context = GetValidGlobalContext();
3527     EVENT(context, GLIsSampler, "context = %d, sampler = %u", CID(context), sampler);
3528 
3529     GLboolean returnValue;
3530     if (context)
3531     {
3532         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
3533         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3534         bool isCallValid = (context->skipValidation() || ValidateIsSampler(context, samplerPacked));
3535         if (isCallValid)
3536         {
3537             returnValue = context->isSampler(samplerPacked);
3538         }
3539         else
3540         {
3541             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsSampler, GLboolean>();
3542         }
3543         ANGLE_CAPTURE(IsSampler, isCallValid, context, samplerPacked, returnValue);
3544     }
3545     else
3546     {
3547         GenerateContextLostErrorOnCurrentGlobalContext();
3548         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsSampler, GLboolean>();
3549     }
3550     return returnValue;
3551 }
3552 
GL_MultiTexCoordP1ui(GLenum texture,GLenum type,GLuint coords)3553 void GL_APIENTRY GL_MultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords)
3554 {
3555     Context *context = GetValidGlobalContext();
3556     EVENT(context, GLMultiTexCoordP1ui, "context = %d, texture = %s, type = %s, coords = %u",
3557           CID(context), GLenumToString(GLenumGroup::TextureUnit, texture),
3558           GLenumToString(GLenumGroup::TexCoordPointerType, type), coords);
3559 
3560     if (context)
3561     {
3562         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3563         bool isCallValid                                      = (context->skipValidation() ||
3564                             ValidateMultiTexCoordP1ui(context, texture, type, coords));
3565         if (isCallValid)
3566         {
3567             context->multiTexCoordP1ui(texture, type, coords);
3568         }
3569         ANGLE_CAPTURE(MultiTexCoordP1ui, isCallValid, context, texture, type, coords);
3570     }
3571     else
3572     {
3573         GenerateContextLostErrorOnCurrentGlobalContext();
3574     }
3575 }
3576 
GL_MultiTexCoordP1uiv(GLenum texture,GLenum type,const GLuint * coords)3577 void GL_APIENTRY GL_MultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords)
3578 {
3579     Context *context = GetValidGlobalContext();
3580     EVENT(context, GLMultiTexCoordP1uiv,
3581           "context = %d, texture = %s, type = %s, coords = 0x%016" PRIxPTR "", CID(context),
3582           GLenumToString(GLenumGroup::TextureUnit, texture),
3583           GLenumToString(GLenumGroup::TexCoordPointerType, type), (uintptr_t)coords);
3584 
3585     if (context)
3586     {
3587         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3588         bool isCallValid                                      = (context->skipValidation() ||
3589                             ValidateMultiTexCoordP1uiv(context, texture, type, coords));
3590         if (isCallValid)
3591         {
3592             context->multiTexCoordP1uiv(texture, type, coords);
3593         }
3594         ANGLE_CAPTURE(MultiTexCoordP1uiv, isCallValid, context, texture, type, coords);
3595     }
3596     else
3597     {
3598         GenerateContextLostErrorOnCurrentGlobalContext();
3599     }
3600 }
3601 
GL_MultiTexCoordP2ui(GLenum texture,GLenum type,GLuint coords)3602 void GL_APIENTRY GL_MultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords)
3603 {
3604     Context *context = GetValidGlobalContext();
3605     EVENT(context, GLMultiTexCoordP2ui, "context = %d, texture = %s, type = %s, coords = %u",
3606           CID(context), GLenumToString(GLenumGroup::TextureUnit, texture),
3607           GLenumToString(GLenumGroup::TexCoordPointerType, type), coords);
3608 
3609     if (context)
3610     {
3611         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3612         bool isCallValid                                      = (context->skipValidation() ||
3613                             ValidateMultiTexCoordP2ui(context, texture, type, coords));
3614         if (isCallValid)
3615         {
3616             context->multiTexCoordP2ui(texture, type, coords);
3617         }
3618         ANGLE_CAPTURE(MultiTexCoordP2ui, isCallValid, context, texture, type, coords);
3619     }
3620     else
3621     {
3622         GenerateContextLostErrorOnCurrentGlobalContext();
3623     }
3624 }
3625 
GL_MultiTexCoordP2uiv(GLenum texture,GLenum type,const GLuint * coords)3626 void GL_APIENTRY GL_MultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords)
3627 {
3628     Context *context = GetValidGlobalContext();
3629     EVENT(context, GLMultiTexCoordP2uiv,
3630           "context = %d, texture = %s, type = %s, coords = 0x%016" PRIxPTR "", CID(context),
3631           GLenumToString(GLenumGroup::TextureUnit, texture),
3632           GLenumToString(GLenumGroup::TexCoordPointerType, type), (uintptr_t)coords);
3633 
3634     if (context)
3635     {
3636         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3637         bool isCallValid                                      = (context->skipValidation() ||
3638                             ValidateMultiTexCoordP2uiv(context, texture, type, coords));
3639         if (isCallValid)
3640         {
3641             context->multiTexCoordP2uiv(texture, type, coords);
3642         }
3643         ANGLE_CAPTURE(MultiTexCoordP2uiv, isCallValid, context, texture, type, coords);
3644     }
3645     else
3646     {
3647         GenerateContextLostErrorOnCurrentGlobalContext();
3648     }
3649 }
3650 
GL_MultiTexCoordP3ui(GLenum texture,GLenum type,GLuint coords)3651 void GL_APIENTRY GL_MultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords)
3652 {
3653     Context *context = GetValidGlobalContext();
3654     EVENT(context, GLMultiTexCoordP3ui, "context = %d, texture = %s, type = %s, coords = %u",
3655           CID(context), GLenumToString(GLenumGroup::TextureUnit, texture),
3656           GLenumToString(GLenumGroup::TexCoordPointerType, type), coords);
3657 
3658     if (context)
3659     {
3660         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3661         bool isCallValid                                      = (context->skipValidation() ||
3662                             ValidateMultiTexCoordP3ui(context, texture, type, coords));
3663         if (isCallValid)
3664         {
3665             context->multiTexCoordP3ui(texture, type, coords);
3666         }
3667         ANGLE_CAPTURE(MultiTexCoordP3ui, isCallValid, context, texture, type, coords);
3668     }
3669     else
3670     {
3671         GenerateContextLostErrorOnCurrentGlobalContext();
3672     }
3673 }
3674 
GL_MultiTexCoordP3uiv(GLenum texture,GLenum type,const GLuint * coords)3675 void GL_APIENTRY GL_MultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords)
3676 {
3677     Context *context = GetValidGlobalContext();
3678     EVENT(context, GLMultiTexCoordP3uiv,
3679           "context = %d, texture = %s, type = %s, coords = 0x%016" PRIxPTR "", CID(context),
3680           GLenumToString(GLenumGroup::TextureUnit, texture),
3681           GLenumToString(GLenumGroup::TexCoordPointerType, type), (uintptr_t)coords);
3682 
3683     if (context)
3684     {
3685         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3686         bool isCallValid                                      = (context->skipValidation() ||
3687                             ValidateMultiTexCoordP3uiv(context, texture, type, coords));
3688         if (isCallValid)
3689         {
3690             context->multiTexCoordP3uiv(texture, type, coords);
3691         }
3692         ANGLE_CAPTURE(MultiTexCoordP3uiv, isCallValid, context, texture, type, coords);
3693     }
3694     else
3695     {
3696         GenerateContextLostErrorOnCurrentGlobalContext();
3697     }
3698 }
3699 
GL_MultiTexCoordP4ui(GLenum texture,GLenum type,GLuint coords)3700 void GL_APIENTRY GL_MultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords)
3701 {
3702     Context *context = GetValidGlobalContext();
3703     EVENT(context, GLMultiTexCoordP4ui, "context = %d, texture = %s, type = %s, coords = %u",
3704           CID(context), GLenumToString(GLenumGroup::TextureUnit, texture),
3705           GLenumToString(GLenumGroup::TexCoordPointerType, type), coords);
3706 
3707     if (context)
3708     {
3709         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3710         bool isCallValid                                      = (context->skipValidation() ||
3711                             ValidateMultiTexCoordP4ui(context, texture, type, coords));
3712         if (isCallValid)
3713         {
3714             context->multiTexCoordP4ui(texture, type, coords);
3715         }
3716         ANGLE_CAPTURE(MultiTexCoordP4ui, isCallValid, context, texture, type, coords);
3717     }
3718     else
3719     {
3720         GenerateContextLostErrorOnCurrentGlobalContext();
3721     }
3722 }
3723 
GL_MultiTexCoordP4uiv(GLenum texture,GLenum type,const GLuint * coords)3724 void GL_APIENTRY GL_MultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords)
3725 {
3726     Context *context = GetValidGlobalContext();
3727     EVENT(context, GLMultiTexCoordP4uiv,
3728           "context = %d, texture = %s, type = %s, coords = 0x%016" PRIxPTR "", CID(context),
3729           GLenumToString(GLenumGroup::TextureUnit, texture),
3730           GLenumToString(GLenumGroup::TexCoordPointerType, type), (uintptr_t)coords);
3731 
3732     if (context)
3733     {
3734         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3735         bool isCallValid                                      = (context->skipValidation() ||
3736                             ValidateMultiTexCoordP4uiv(context, texture, type, coords));
3737         if (isCallValid)
3738         {
3739             context->multiTexCoordP4uiv(texture, type, coords);
3740         }
3741         ANGLE_CAPTURE(MultiTexCoordP4uiv, isCallValid, context, texture, type, coords);
3742     }
3743     else
3744     {
3745         GenerateContextLostErrorOnCurrentGlobalContext();
3746     }
3747 }
3748 
GL_NormalP3ui(GLenum type,GLuint coords)3749 void GL_APIENTRY GL_NormalP3ui(GLenum type, GLuint coords)
3750 {
3751     Context *context = GetValidGlobalContext();
3752     EVENT(context, GLNormalP3ui, "context = %d, type = %s, coords = %u", CID(context),
3753           GLenumToString(GLenumGroup::NormalPointerType, type), coords);
3754 
3755     if (context)
3756     {
3757         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3758         bool isCallValid = (context->skipValidation() || ValidateNormalP3ui(context, type, coords));
3759         if (isCallValid)
3760         {
3761             context->normalP3ui(type, coords);
3762         }
3763         ANGLE_CAPTURE(NormalP3ui, isCallValid, context, type, coords);
3764     }
3765     else
3766     {
3767         GenerateContextLostErrorOnCurrentGlobalContext();
3768     }
3769 }
3770 
GL_NormalP3uiv(GLenum type,const GLuint * coords)3771 void GL_APIENTRY GL_NormalP3uiv(GLenum type, const GLuint *coords)
3772 {
3773     Context *context = GetValidGlobalContext();
3774     EVENT(context, GLNormalP3uiv, "context = %d, type = %s, coords = 0x%016" PRIxPTR "",
3775           CID(context), GLenumToString(GLenumGroup::NormalPointerType, type), (uintptr_t)coords);
3776 
3777     if (context)
3778     {
3779         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3780         bool isCallValid =
3781             (context->skipValidation() || ValidateNormalP3uiv(context, type, coords));
3782         if (isCallValid)
3783         {
3784             context->normalP3uiv(type, coords);
3785         }
3786         ANGLE_CAPTURE(NormalP3uiv, isCallValid, context, type, coords);
3787     }
3788     else
3789     {
3790         GenerateContextLostErrorOnCurrentGlobalContext();
3791     }
3792 }
3793 
GL_QueryCounter(GLuint id,GLenum target)3794 void GL_APIENTRY GL_QueryCounter(GLuint id, GLenum target)
3795 {
3796     Context *context = GetValidGlobalContext();
3797     EVENT(context, GLQueryCounter, "context = %d, id = %u, target = %s", CID(context), id,
3798           GLenumToString(GLenumGroup::QueryTarget, target));
3799 
3800     if (context)
3801     {
3802         QueryID idPacked                                      = PackParam<QueryID>(id);
3803         QueryType targetPacked                                = PackParam<QueryType>(target);
3804         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3805         bool isCallValid =
3806             (context->skipValidation() || ValidateQueryCounter(context, idPacked, targetPacked));
3807         if (isCallValid)
3808         {
3809             context->queryCounter(idPacked, targetPacked);
3810         }
3811         ANGLE_CAPTURE(QueryCounter, isCallValid, context, idPacked, targetPacked);
3812     }
3813     else
3814     {
3815         GenerateContextLostErrorOnCurrentGlobalContext();
3816     }
3817 }
3818 
GL_SamplerParameterIiv(GLuint sampler,GLenum pname,const GLint * param)3819 void GL_APIENTRY GL_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param)
3820 {
3821     Context *context = GetValidGlobalContext();
3822     EVENT(context, GLSamplerParameterIiv,
3823           "context = %d, sampler = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
3824           sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname), (uintptr_t)param);
3825 
3826     if (context)
3827     {
3828         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
3829         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3830         bool isCallValid                                      = (context->skipValidation() ||
3831                             ValidateSamplerParameterIiv(context, samplerPacked, pname, param));
3832         if (isCallValid)
3833         {
3834             context->samplerParameterIiv(samplerPacked, pname, param);
3835         }
3836         ANGLE_CAPTURE(SamplerParameterIiv, isCallValid, context, samplerPacked, pname, param);
3837     }
3838     else
3839     {
3840         GenerateContextLostErrorOnCurrentGlobalContext();
3841     }
3842 }
3843 
GL_SamplerParameterIuiv(GLuint sampler,GLenum pname,const GLuint * param)3844 void GL_APIENTRY GL_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param)
3845 {
3846     Context *context = GetValidGlobalContext();
3847     EVENT(context, GLSamplerParameterIuiv,
3848           "context = %d, sampler = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
3849           sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname), (uintptr_t)param);
3850 
3851     if (context)
3852     {
3853         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
3854         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3855         bool isCallValid                                      = (context->skipValidation() ||
3856                             ValidateSamplerParameterIuiv(context, samplerPacked, pname, param));
3857         if (isCallValid)
3858         {
3859             context->samplerParameterIuiv(samplerPacked, pname, param);
3860         }
3861         ANGLE_CAPTURE(SamplerParameterIuiv, isCallValid, context, samplerPacked, pname, param);
3862     }
3863     else
3864     {
3865         GenerateContextLostErrorOnCurrentGlobalContext();
3866     }
3867 }
3868 
GL_SamplerParameterf(GLuint sampler,GLenum pname,GLfloat param)3869 void GL_APIENTRY GL_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
3870 {
3871     Context *context = GetValidGlobalContext();
3872     EVENT(context, GLSamplerParameterf, "context = %d, sampler = %u, pname = %s, param = %f",
3873           CID(context), sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname), param);
3874 
3875     if (context)
3876     {
3877         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
3878         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3879         bool isCallValid                                      = (context->skipValidation() ||
3880                             ValidateSamplerParameterf(context, samplerPacked, pname, param));
3881         if (isCallValid)
3882         {
3883             context->samplerParameterf(samplerPacked, pname, param);
3884         }
3885         ANGLE_CAPTURE(SamplerParameterf, isCallValid, context, samplerPacked, pname, param);
3886     }
3887     else
3888     {
3889         GenerateContextLostErrorOnCurrentGlobalContext();
3890     }
3891 }
3892 
GL_SamplerParameterfv(GLuint sampler,GLenum pname,const GLfloat * param)3893 void GL_APIENTRY GL_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
3894 {
3895     Context *context = GetValidGlobalContext();
3896     EVENT(context, GLSamplerParameterfv,
3897           "context = %d, sampler = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
3898           sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname), (uintptr_t)param);
3899 
3900     if (context)
3901     {
3902         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
3903         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3904         bool isCallValid                                      = (context->skipValidation() ||
3905                             ValidateSamplerParameterfv(context, samplerPacked, pname, param));
3906         if (isCallValid)
3907         {
3908             context->samplerParameterfv(samplerPacked, pname, param);
3909         }
3910         ANGLE_CAPTURE(SamplerParameterfv, isCallValid, context, samplerPacked, pname, param);
3911     }
3912     else
3913     {
3914         GenerateContextLostErrorOnCurrentGlobalContext();
3915     }
3916 }
3917 
GL_SamplerParameteri(GLuint sampler,GLenum pname,GLint param)3918 void GL_APIENTRY GL_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
3919 {
3920     Context *context = GetValidGlobalContext();
3921     EVENT(context, GLSamplerParameteri, "context = %d, sampler = %u, pname = %s, param = %d",
3922           CID(context), sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname), param);
3923 
3924     if (context)
3925     {
3926         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
3927         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3928         bool isCallValid                                      = (context->skipValidation() ||
3929                             ValidateSamplerParameteri(context, samplerPacked, pname, param));
3930         if (isCallValid)
3931         {
3932             context->samplerParameteri(samplerPacked, pname, param);
3933         }
3934         ANGLE_CAPTURE(SamplerParameteri, isCallValid, context, samplerPacked, pname, param);
3935     }
3936     else
3937     {
3938         GenerateContextLostErrorOnCurrentGlobalContext();
3939     }
3940 }
3941 
GL_SamplerParameteriv(GLuint sampler,GLenum pname,const GLint * param)3942 void GL_APIENTRY GL_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
3943 {
3944     Context *context = GetValidGlobalContext();
3945     EVENT(context, GLSamplerParameteriv,
3946           "context = %d, sampler = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
3947           sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname), (uintptr_t)param);
3948 
3949     if (context)
3950     {
3951         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
3952         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3953         bool isCallValid                                      = (context->skipValidation() ||
3954                             ValidateSamplerParameteriv(context, samplerPacked, pname, param));
3955         if (isCallValid)
3956         {
3957             context->samplerParameteriv(samplerPacked, pname, param);
3958         }
3959         ANGLE_CAPTURE(SamplerParameteriv, isCallValid, context, samplerPacked, pname, param);
3960     }
3961     else
3962     {
3963         GenerateContextLostErrorOnCurrentGlobalContext();
3964     }
3965 }
3966 
GL_SecondaryColorP3ui(GLenum type,GLuint color)3967 void GL_APIENTRY GL_SecondaryColorP3ui(GLenum type, GLuint color)
3968 {
3969     Context *context = GetValidGlobalContext();
3970     EVENT(context, GLSecondaryColorP3ui, "context = %d, type = %s, color = %u", CID(context),
3971           GLenumToString(GLenumGroup::ColorPointerType, type), color);
3972 
3973     if (context)
3974     {
3975         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3976         bool isCallValid =
3977             (context->skipValidation() || ValidateSecondaryColorP3ui(context, type, color));
3978         if (isCallValid)
3979         {
3980             context->secondaryColorP3ui(type, color);
3981         }
3982         ANGLE_CAPTURE(SecondaryColorP3ui, isCallValid, context, type, color);
3983     }
3984     else
3985     {
3986         GenerateContextLostErrorOnCurrentGlobalContext();
3987     }
3988 }
3989 
GL_SecondaryColorP3uiv(GLenum type,const GLuint * color)3990 void GL_APIENTRY GL_SecondaryColorP3uiv(GLenum type, const GLuint *color)
3991 {
3992     Context *context = GetValidGlobalContext();
3993     EVENT(context, GLSecondaryColorP3uiv, "context = %d, type = %s, color = 0x%016" PRIxPTR "",
3994           CID(context), GLenumToString(GLenumGroup::ColorPointerType, type), (uintptr_t)color);
3995 
3996     if (context)
3997     {
3998         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3999         bool isCallValid =
4000             (context->skipValidation() || ValidateSecondaryColorP3uiv(context, type, color));
4001         if (isCallValid)
4002         {
4003             context->secondaryColorP3uiv(type, color);
4004         }
4005         ANGLE_CAPTURE(SecondaryColorP3uiv, isCallValid, context, type, color);
4006     }
4007     else
4008     {
4009         GenerateContextLostErrorOnCurrentGlobalContext();
4010     }
4011 }
4012 
GL_TexCoordP1ui(GLenum type,GLuint coords)4013 void GL_APIENTRY GL_TexCoordP1ui(GLenum type, GLuint coords)
4014 {
4015     Context *context = GetValidGlobalContext();
4016     EVENT(context, GLTexCoordP1ui, "context = %d, type = %s, coords = %u", CID(context),
4017           GLenumToString(GLenumGroup::TexCoordPointerType, type), coords);
4018 
4019     if (context)
4020     {
4021         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4022         bool isCallValid =
4023             (context->skipValidation() || ValidateTexCoordP1ui(context, type, coords));
4024         if (isCallValid)
4025         {
4026             context->texCoordP1ui(type, coords);
4027         }
4028         ANGLE_CAPTURE(TexCoordP1ui, isCallValid, context, type, coords);
4029     }
4030     else
4031     {
4032         GenerateContextLostErrorOnCurrentGlobalContext();
4033     }
4034 }
4035 
GL_TexCoordP1uiv(GLenum type,const GLuint * coords)4036 void GL_APIENTRY GL_TexCoordP1uiv(GLenum type, const GLuint *coords)
4037 {
4038     Context *context = GetValidGlobalContext();
4039     EVENT(context, GLTexCoordP1uiv, "context = %d, type = %s, coords = 0x%016" PRIxPTR "",
4040           CID(context), GLenumToString(GLenumGroup::TexCoordPointerType, type), (uintptr_t)coords);
4041 
4042     if (context)
4043     {
4044         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4045         bool isCallValid =
4046             (context->skipValidation() || ValidateTexCoordP1uiv(context, type, coords));
4047         if (isCallValid)
4048         {
4049             context->texCoordP1uiv(type, coords);
4050         }
4051         ANGLE_CAPTURE(TexCoordP1uiv, isCallValid, context, type, coords);
4052     }
4053     else
4054     {
4055         GenerateContextLostErrorOnCurrentGlobalContext();
4056     }
4057 }
4058 
GL_TexCoordP2ui(GLenum type,GLuint coords)4059 void GL_APIENTRY GL_TexCoordP2ui(GLenum type, GLuint coords)
4060 {
4061     Context *context = GetValidGlobalContext();
4062     EVENT(context, GLTexCoordP2ui, "context = %d, type = %s, coords = %u", CID(context),
4063           GLenumToString(GLenumGroup::TexCoordPointerType, type), coords);
4064 
4065     if (context)
4066     {
4067         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4068         bool isCallValid =
4069             (context->skipValidation() || ValidateTexCoordP2ui(context, type, coords));
4070         if (isCallValid)
4071         {
4072             context->texCoordP2ui(type, coords);
4073         }
4074         ANGLE_CAPTURE(TexCoordP2ui, isCallValid, context, type, coords);
4075     }
4076     else
4077     {
4078         GenerateContextLostErrorOnCurrentGlobalContext();
4079     }
4080 }
4081 
GL_TexCoordP2uiv(GLenum type,const GLuint * coords)4082 void GL_APIENTRY GL_TexCoordP2uiv(GLenum type, const GLuint *coords)
4083 {
4084     Context *context = GetValidGlobalContext();
4085     EVENT(context, GLTexCoordP2uiv, "context = %d, type = %s, coords = 0x%016" PRIxPTR "",
4086           CID(context), GLenumToString(GLenumGroup::TexCoordPointerType, type), (uintptr_t)coords);
4087 
4088     if (context)
4089     {
4090         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4091         bool isCallValid =
4092             (context->skipValidation() || ValidateTexCoordP2uiv(context, type, coords));
4093         if (isCallValid)
4094         {
4095             context->texCoordP2uiv(type, coords);
4096         }
4097         ANGLE_CAPTURE(TexCoordP2uiv, isCallValid, context, type, coords);
4098     }
4099     else
4100     {
4101         GenerateContextLostErrorOnCurrentGlobalContext();
4102     }
4103 }
4104 
GL_TexCoordP3ui(GLenum type,GLuint coords)4105 void GL_APIENTRY GL_TexCoordP3ui(GLenum type, GLuint coords)
4106 {
4107     Context *context = GetValidGlobalContext();
4108     EVENT(context, GLTexCoordP3ui, "context = %d, type = %s, coords = %u", CID(context),
4109           GLenumToString(GLenumGroup::TexCoordPointerType, type), coords);
4110 
4111     if (context)
4112     {
4113         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4114         bool isCallValid =
4115             (context->skipValidation() || ValidateTexCoordP3ui(context, type, coords));
4116         if (isCallValid)
4117         {
4118             context->texCoordP3ui(type, coords);
4119         }
4120         ANGLE_CAPTURE(TexCoordP3ui, isCallValid, context, type, coords);
4121     }
4122     else
4123     {
4124         GenerateContextLostErrorOnCurrentGlobalContext();
4125     }
4126 }
4127 
GL_TexCoordP3uiv(GLenum type,const GLuint * coords)4128 void GL_APIENTRY GL_TexCoordP3uiv(GLenum type, const GLuint *coords)
4129 {
4130     Context *context = GetValidGlobalContext();
4131     EVENT(context, GLTexCoordP3uiv, "context = %d, type = %s, coords = 0x%016" PRIxPTR "",
4132           CID(context), GLenumToString(GLenumGroup::TexCoordPointerType, type), (uintptr_t)coords);
4133 
4134     if (context)
4135     {
4136         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4137         bool isCallValid =
4138             (context->skipValidation() || ValidateTexCoordP3uiv(context, type, coords));
4139         if (isCallValid)
4140         {
4141             context->texCoordP3uiv(type, coords);
4142         }
4143         ANGLE_CAPTURE(TexCoordP3uiv, isCallValid, context, type, coords);
4144     }
4145     else
4146     {
4147         GenerateContextLostErrorOnCurrentGlobalContext();
4148     }
4149 }
4150 
GL_TexCoordP4ui(GLenum type,GLuint coords)4151 void GL_APIENTRY GL_TexCoordP4ui(GLenum type, GLuint coords)
4152 {
4153     Context *context = GetValidGlobalContext();
4154     EVENT(context, GLTexCoordP4ui, "context = %d, type = %s, coords = %u", CID(context),
4155           GLenumToString(GLenumGroup::TexCoordPointerType, type), coords);
4156 
4157     if (context)
4158     {
4159         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4160         bool isCallValid =
4161             (context->skipValidation() || ValidateTexCoordP4ui(context, type, coords));
4162         if (isCallValid)
4163         {
4164             context->texCoordP4ui(type, coords);
4165         }
4166         ANGLE_CAPTURE(TexCoordP4ui, isCallValid, context, type, coords);
4167     }
4168     else
4169     {
4170         GenerateContextLostErrorOnCurrentGlobalContext();
4171     }
4172 }
4173 
GL_TexCoordP4uiv(GLenum type,const GLuint * coords)4174 void GL_APIENTRY GL_TexCoordP4uiv(GLenum type, const GLuint *coords)
4175 {
4176     Context *context = GetValidGlobalContext();
4177     EVENT(context, GLTexCoordP4uiv, "context = %d, type = %s, coords = 0x%016" PRIxPTR "",
4178           CID(context), GLenumToString(GLenumGroup::TexCoordPointerType, type), (uintptr_t)coords);
4179 
4180     if (context)
4181     {
4182         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4183         bool isCallValid =
4184             (context->skipValidation() || ValidateTexCoordP4uiv(context, type, coords));
4185         if (isCallValid)
4186         {
4187             context->texCoordP4uiv(type, coords);
4188         }
4189         ANGLE_CAPTURE(TexCoordP4uiv, isCallValid, context, type, coords);
4190     }
4191     else
4192     {
4193         GenerateContextLostErrorOnCurrentGlobalContext();
4194     }
4195 }
4196 
GL_VertexAttribDivisor(GLuint index,GLuint divisor)4197 void GL_APIENTRY GL_VertexAttribDivisor(GLuint index, GLuint divisor)
4198 {
4199     Context *context = GetValidGlobalContext();
4200     EVENT(context, GLVertexAttribDivisor, "context = %d, index = %u, divisor = %u", CID(context),
4201           index, divisor);
4202 
4203     if (context)
4204     {
4205         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4206         bool isCallValid =
4207             (context->skipValidation() || ValidateVertexAttribDivisor(context, index, divisor));
4208         if (isCallValid)
4209         {
4210             context->vertexAttribDivisor(index, divisor);
4211         }
4212         ANGLE_CAPTURE(VertexAttribDivisor, isCallValid, context, index, divisor);
4213     }
4214     else
4215     {
4216         GenerateContextLostErrorOnCurrentGlobalContext();
4217     }
4218 }
4219 
GL_VertexAttribP1ui(GLuint index,GLenum type,GLboolean normalized,GLuint value)4220 void GL_APIENTRY GL_VertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
4221 {
4222     Context *context = GetValidGlobalContext();
4223     EVENT(context, GLVertexAttribP1ui,
4224           "context = %d, index = %u, type = %s, normalized = %s, value = %u", CID(context), index,
4225           GLenumToString(GLenumGroup::VertexAttribPointerType, type), GLbooleanToString(normalized),
4226           value);
4227 
4228     if (context)
4229     {
4230         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4231         bool isCallValid                                      = (context->skipValidation() ||
4232                             ValidateVertexAttribP1ui(context, index, type, normalized, value));
4233         if (isCallValid)
4234         {
4235             context->vertexAttribP1ui(index, type, normalized, value);
4236         }
4237         ANGLE_CAPTURE(VertexAttribP1ui, isCallValid, context, index, type, normalized, value);
4238     }
4239     else
4240     {
4241         GenerateContextLostErrorOnCurrentGlobalContext();
4242     }
4243 }
4244 
GL_VertexAttribP1uiv(GLuint index,GLenum type,GLboolean normalized,const GLuint * value)4245 void GL_APIENTRY GL_VertexAttribP1uiv(GLuint index,
4246                                       GLenum type,
4247                                       GLboolean normalized,
4248                                       const GLuint *value)
4249 {
4250     Context *context = GetValidGlobalContext();
4251     EVENT(context, GLVertexAttribP1uiv,
4252           "context = %d, index = %u, type = %s, normalized = %s, value = 0x%016" PRIxPTR "",
4253           CID(context), index, GLenumToString(GLenumGroup::VertexAttribPointerType, type),
4254           GLbooleanToString(normalized), (uintptr_t)value);
4255 
4256     if (context)
4257     {
4258         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4259         bool isCallValid                                      = (context->skipValidation() ||
4260                             ValidateVertexAttribP1uiv(context, index, type, normalized, value));
4261         if (isCallValid)
4262         {
4263             context->vertexAttribP1uiv(index, type, normalized, value);
4264         }
4265         ANGLE_CAPTURE(VertexAttribP1uiv, isCallValid, context, index, type, normalized, value);
4266     }
4267     else
4268     {
4269         GenerateContextLostErrorOnCurrentGlobalContext();
4270     }
4271 }
4272 
GL_VertexAttribP2ui(GLuint index,GLenum type,GLboolean normalized,GLuint value)4273 void GL_APIENTRY GL_VertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
4274 {
4275     Context *context = GetValidGlobalContext();
4276     EVENT(context, GLVertexAttribP2ui,
4277           "context = %d, index = %u, type = %s, normalized = %s, value = %u", CID(context), index,
4278           GLenumToString(GLenumGroup::VertexAttribPointerType, type), GLbooleanToString(normalized),
4279           value);
4280 
4281     if (context)
4282     {
4283         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4284         bool isCallValid                                      = (context->skipValidation() ||
4285                             ValidateVertexAttribP2ui(context, index, type, normalized, value));
4286         if (isCallValid)
4287         {
4288             context->vertexAttribP2ui(index, type, normalized, value);
4289         }
4290         ANGLE_CAPTURE(VertexAttribP2ui, isCallValid, context, index, type, normalized, value);
4291     }
4292     else
4293     {
4294         GenerateContextLostErrorOnCurrentGlobalContext();
4295     }
4296 }
4297 
GL_VertexAttribP2uiv(GLuint index,GLenum type,GLboolean normalized,const GLuint * value)4298 void GL_APIENTRY GL_VertexAttribP2uiv(GLuint index,
4299                                       GLenum type,
4300                                       GLboolean normalized,
4301                                       const GLuint *value)
4302 {
4303     Context *context = GetValidGlobalContext();
4304     EVENT(context, GLVertexAttribP2uiv,
4305           "context = %d, index = %u, type = %s, normalized = %s, value = 0x%016" PRIxPTR "",
4306           CID(context), index, GLenumToString(GLenumGroup::VertexAttribPointerType, type),
4307           GLbooleanToString(normalized), (uintptr_t)value);
4308 
4309     if (context)
4310     {
4311         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4312         bool isCallValid                                      = (context->skipValidation() ||
4313                             ValidateVertexAttribP2uiv(context, index, type, normalized, value));
4314         if (isCallValid)
4315         {
4316             context->vertexAttribP2uiv(index, type, normalized, value);
4317         }
4318         ANGLE_CAPTURE(VertexAttribP2uiv, isCallValid, context, index, type, normalized, value);
4319     }
4320     else
4321     {
4322         GenerateContextLostErrorOnCurrentGlobalContext();
4323     }
4324 }
4325 
GL_VertexAttribP3ui(GLuint index,GLenum type,GLboolean normalized,GLuint value)4326 void GL_APIENTRY GL_VertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
4327 {
4328     Context *context = GetValidGlobalContext();
4329     EVENT(context, GLVertexAttribP3ui,
4330           "context = %d, index = %u, type = %s, normalized = %s, value = %u", CID(context), index,
4331           GLenumToString(GLenumGroup::VertexAttribPointerType, type), GLbooleanToString(normalized),
4332           value);
4333 
4334     if (context)
4335     {
4336         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4337         bool isCallValid                                      = (context->skipValidation() ||
4338                             ValidateVertexAttribP3ui(context, index, type, normalized, value));
4339         if (isCallValid)
4340         {
4341             context->vertexAttribP3ui(index, type, normalized, value);
4342         }
4343         ANGLE_CAPTURE(VertexAttribP3ui, isCallValid, context, index, type, normalized, value);
4344     }
4345     else
4346     {
4347         GenerateContextLostErrorOnCurrentGlobalContext();
4348     }
4349 }
4350 
GL_VertexAttribP3uiv(GLuint index,GLenum type,GLboolean normalized,const GLuint * value)4351 void GL_APIENTRY GL_VertexAttribP3uiv(GLuint index,
4352                                       GLenum type,
4353                                       GLboolean normalized,
4354                                       const GLuint *value)
4355 {
4356     Context *context = GetValidGlobalContext();
4357     EVENT(context, GLVertexAttribP3uiv,
4358           "context = %d, index = %u, type = %s, normalized = %s, value = 0x%016" PRIxPTR "",
4359           CID(context), index, GLenumToString(GLenumGroup::VertexAttribPointerType, type),
4360           GLbooleanToString(normalized), (uintptr_t)value);
4361 
4362     if (context)
4363     {
4364         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4365         bool isCallValid                                      = (context->skipValidation() ||
4366                             ValidateVertexAttribP3uiv(context, index, type, normalized, value));
4367         if (isCallValid)
4368         {
4369             context->vertexAttribP3uiv(index, type, normalized, value);
4370         }
4371         ANGLE_CAPTURE(VertexAttribP3uiv, isCallValid, context, index, type, normalized, value);
4372     }
4373     else
4374     {
4375         GenerateContextLostErrorOnCurrentGlobalContext();
4376     }
4377 }
4378 
GL_VertexAttribP4ui(GLuint index,GLenum type,GLboolean normalized,GLuint value)4379 void GL_APIENTRY GL_VertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
4380 {
4381     Context *context = GetValidGlobalContext();
4382     EVENT(context, GLVertexAttribP4ui,
4383           "context = %d, index = %u, type = %s, normalized = %s, value = %u", CID(context), index,
4384           GLenumToString(GLenumGroup::VertexAttribPointerType, type), GLbooleanToString(normalized),
4385           value);
4386 
4387     if (context)
4388     {
4389         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4390         bool isCallValid                                      = (context->skipValidation() ||
4391                             ValidateVertexAttribP4ui(context, index, type, normalized, value));
4392         if (isCallValid)
4393         {
4394             context->vertexAttribP4ui(index, type, normalized, value);
4395         }
4396         ANGLE_CAPTURE(VertexAttribP4ui, isCallValid, context, index, type, normalized, value);
4397     }
4398     else
4399     {
4400         GenerateContextLostErrorOnCurrentGlobalContext();
4401     }
4402 }
4403 
GL_VertexAttribP4uiv(GLuint index,GLenum type,GLboolean normalized,const GLuint * value)4404 void GL_APIENTRY GL_VertexAttribP4uiv(GLuint index,
4405                                       GLenum type,
4406                                       GLboolean normalized,
4407                                       const GLuint *value)
4408 {
4409     Context *context = GetValidGlobalContext();
4410     EVENT(context, GLVertexAttribP4uiv,
4411           "context = %d, index = %u, type = %s, normalized = %s, value = 0x%016" PRIxPTR "",
4412           CID(context), index, GLenumToString(GLenumGroup::VertexAttribPointerType, type),
4413           GLbooleanToString(normalized), (uintptr_t)value);
4414 
4415     if (context)
4416     {
4417         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4418         bool isCallValid                                      = (context->skipValidation() ||
4419                             ValidateVertexAttribP4uiv(context, index, type, normalized, value));
4420         if (isCallValid)
4421         {
4422             context->vertexAttribP4uiv(index, type, normalized, value);
4423         }
4424         ANGLE_CAPTURE(VertexAttribP4uiv, isCallValid, context, index, type, normalized, value);
4425     }
4426     else
4427     {
4428         GenerateContextLostErrorOnCurrentGlobalContext();
4429     }
4430 }
4431 
GL_VertexP2ui(GLenum type,GLuint value)4432 void GL_APIENTRY GL_VertexP2ui(GLenum type, GLuint value)
4433 {
4434     Context *context = GetValidGlobalContext();
4435     EVENT(context, GLVertexP2ui, "context = %d, type = %s, value = %u", CID(context),
4436           GLenumToString(GLenumGroup::VertexPointerType, type), value);
4437 
4438     if (context)
4439     {
4440         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4441         bool isCallValid = (context->skipValidation() || ValidateVertexP2ui(context, type, value));
4442         if (isCallValid)
4443         {
4444             context->vertexP2ui(type, value);
4445         }
4446         ANGLE_CAPTURE(VertexP2ui, isCallValid, context, type, value);
4447     }
4448     else
4449     {
4450         GenerateContextLostErrorOnCurrentGlobalContext();
4451     }
4452 }
4453 
GL_VertexP2uiv(GLenum type,const GLuint * value)4454 void GL_APIENTRY GL_VertexP2uiv(GLenum type, const GLuint *value)
4455 {
4456     Context *context = GetValidGlobalContext();
4457     EVENT(context, GLVertexP2uiv, "context = %d, type = %s, value = 0x%016" PRIxPTR "",
4458           CID(context), GLenumToString(GLenumGroup::VertexPointerType, type), (uintptr_t)value);
4459 
4460     if (context)
4461     {
4462         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4463         bool isCallValid = (context->skipValidation() || ValidateVertexP2uiv(context, type, value));
4464         if (isCallValid)
4465         {
4466             context->vertexP2uiv(type, value);
4467         }
4468         ANGLE_CAPTURE(VertexP2uiv, isCallValid, context, type, value);
4469     }
4470     else
4471     {
4472         GenerateContextLostErrorOnCurrentGlobalContext();
4473     }
4474 }
4475 
GL_VertexP3ui(GLenum type,GLuint value)4476 void GL_APIENTRY GL_VertexP3ui(GLenum type, GLuint value)
4477 {
4478     Context *context = GetValidGlobalContext();
4479     EVENT(context, GLVertexP3ui, "context = %d, type = %s, value = %u", CID(context),
4480           GLenumToString(GLenumGroup::VertexPointerType, type), value);
4481 
4482     if (context)
4483     {
4484         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4485         bool isCallValid = (context->skipValidation() || ValidateVertexP3ui(context, type, value));
4486         if (isCallValid)
4487         {
4488             context->vertexP3ui(type, value);
4489         }
4490         ANGLE_CAPTURE(VertexP3ui, isCallValid, context, type, value);
4491     }
4492     else
4493     {
4494         GenerateContextLostErrorOnCurrentGlobalContext();
4495     }
4496 }
4497 
GL_VertexP3uiv(GLenum type,const GLuint * value)4498 void GL_APIENTRY GL_VertexP3uiv(GLenum type, const GLuint *value)
4499 {
4500     Context *context = GetValidGlobalContext();
4501     EVENT(context, GLVertexP3uiv, "context = %d, type = %s, value = 0x%016" PRIxPTR "",
4502           CID(context), GLenumToString(GLenumGroup::VertexPointerType, type), (uintptr_t)value);
4503 
4504     if (context)
4505     {
4506         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4507         bool isCallValid = (context->skipValidation() || ValidateVertexP3uiv(context, type, value));
4508         if (isCallValid)
4509         {
4510             context->vertexP3uiv(type, value);
4511         }
4512         ANGLE_CAPTURE(VertexP3uiv, isCallValid, context, type, value);
4513     }
4514     else
4515     {
4516         GenerateContextLostErrorOnCurrentGlobalContext();
4517     }
4518 }
4519 
GL_VertexP4ui(GLenum type,GLuint value)4520 void GL_APIENTRY GL_VertexP4ui(GLenum type, GLuint value)
4521 {
4522     Context *context = GetValidGlobalContext();
4523     EVENT(context, GLVertexP4ui, "context = %d, type = %s, value = %u", CID(context),
4524           GLenumToString(GLenumGroup::VertexPointerType, type), value);
4525 
4526     if (context)
4527     {
4528         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4529         bool isCallValid = (context->skipValidation() || ValidateVertexP4ui(context, type, value));
4530         if (isCallValid)
4531         {
4532             context->vertexP4ui(type, value);
4533         }
4534         ANGLE_CAPTURE(VertexP4ui, isCallValid, context, type, value);
4535     }
4536     else
4537     {
4538         GenerateContextLostErrorOnCurrentGlobalContext();
4539     }
4540 }
4541 
GL_VertexP4uiv(GLenum type,const GLuint * value)4542 void GL_APIENTRY GL_VertexP4uiv(GLenum type, const GLuint *value)
4543 {
4544     Context *context = GetValidGlobalContext();
4545     EVENT(context, GLVertexP4uiv, "context = %d, type = %s, value = 0x%016" PRIxPTR "",
4546           CID(context), GLenumToString(GLenumGroup::VertexPointerType, type), (uintptr_t)value);
4547 
4548     if (context)
4549     {
4550         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4551         bool isCallValid = (context->skipValidation() || ValidateVertexP4uiv(context, type, value));
4552         if (isCallValid)
4553         {
4554             context->vertexP4uiv(type, value);
4555         }
4556         ANGLE_CAPTURE(VertexP4uiv, isCallValid, context, type, value);
4557     }
4558     else
4559     {
4560         GenerateContextLostErrorOnCurrentGlobalContext();
4561     }
4562 }
4563 
4564 }  // extern "C"
4565