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