• 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_4_autogen.cpp:
9 //   Defines the Desktop GL 4.x entry points.
10 
11 #include "libGL/entry_points_gl_4_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/validationGL4_autogen.h"
26 #include "libGLESv2/global_state.h"
27 
28 using namespace gl;
29 
30 extern "C" {
31 
32 // GL 4.0
GL_BeginQueryIndexed(GLenum target,GLuint index,GLuint id)33 void GL_APIENTRY GL_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
34 {
35     Context *context = GetValidGlobalContext();
36     EVENT(context, GLBeginQueryIndexed, "context = %d, target = %s, index = %u, id = %u",
37           CID(context), GLenumToString(GLenumGroup::QueryTarget, target), index, id);
38 
39     if (context)
40     {
41         QueryID idPacked                                      = PackParam<QueryID>(id);
42         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
43         bool isCallValid =
44             (context->skipValidation() ||
45              ValidateBeginQueryIndexed(context, angle::EntryPoint::GLBeginQueryIndexed, target,
46                                        index, idPacked));
47         if (isCallValid)
48         {
49             context->beginQueryIndexed(target, index, idPacked);
50         }
51         ANGLE_CAPTURE(BeginQueryIndexed, isCallValid, context, target, index, idPacked);
52     }
53     else
54     {
55         GenerateContextLostErrorOnCurrentGlobalContext();
56     }
57 }
58 
GL_BindTransformFeedback(GLenum target,GLuint id)59 void GL_APIENTRY GL_BindTransformFeedback(GLenum target, GLuint id)
60 {
61     Context *context = GetValidGlobalContext();
62     EVENT(context, GLBindTransformFeedback, "context = %d, target = %s, id = %u", CID(context),
63           GLenumToString(GLenumGroup::BindTransformFeedbackTarget, target), id);
64 
65     if (context)
66     {
67         TransformFeedbackID idPacked                          = PackParam<TransformFeedbackID>(id);
68         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
69         bool isCallValid =
70             (context->skipValidation() ||
71              ValidateBindTransformFeedback(context, angle::EntryPoint::GLBindTransformFeedback,
72                                            target, idPacked));
73         if (isCallValid)
74         {
75             context->bindTransformFeedback(target, idPacked);
76         }
77         ANGLE_CAPTURE(BindTransformFeedback, isCallValid, context, target, idPacked);
78     }
79     else
80     {
81         GenerateContextLostErrorOnCurrentGlobalContext();
82     }
83 }
84 
GL_BlendEquationSeparatei(GLuint buf,GLenum modeRGB,GLenum modeAlpha)85 void GL_APIENTRY GL_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
86 {
87     Context *context = GetValidGlobalContext();
88     EVENT(context, GLBlendEquationSeparatei, "context = %d, buf = %u, modeRGB = %s, modeAlpha = %s",
89           CID(context), buf, GLenumToString(GLenumGroup::BlendEquationModeEXT, modeRGB),
90           GLenumToString(GLenumGroup::BlendEquationModeEXT, modeAlpha));
91 
92     if (context)
93     {
94         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
95         bool isCallValid =
96             (context->skipValidation() ||
97              ValidateBlendEquationSeparatei(context, angle::EntryPoint::GLBlendEquationSeparatei,
98                                             buf, modeRGB, modeAlpha));
99         if (isCallValid)
100         {
101             context->blendEquationSeparatei(buf, modeRGB, modeAlpha);
102         }
103         ANGLE_CAPTURE(BlendEquationSeparatei, isCallValid, context, buf, modeRGB, modeAlpha);
104     }
105     else
106     {
107         GenerateContextLostErrorOnCurrentGlobalContext();
108     }
109 }
110 
GL_BlendEquationi(GLuint buf,GLenum mode)111 void GL_APIENTRY GL_BlendEquationi(GLuint buf, GLenum mode)
112 {
113     Context *context = GetValidGlobalContext();
114     EVENT(context, GLBlendEquationi, "context = %d, buf = %u, mode = %s", CID(context), buf,
115           GLenumToString(GLenumGroup::BlendEquationModeEXT, mode));
116 
117     if (context)
118     {
119         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
120         bool isCallValid =
121             (context->skipValidation() ||
122              ValidateBlendEquationi(context, angle::EntryPoint::GLBlendEquationi, buf, mode));
123         if (isCallValid)
124         {
125             context->blendEquationi(buf, mode);
126         }
127         ANGLE_CAPTURE(BlendEquationi, isCallValid, context, buf, mode);
128     }
129     else
130     {
131         GenerateContextLostErrorOnCurrentGlobalContext();
132     }
133 }
134 
135 void GL_APIENTRY
GL_BlendFuncSeparatei(GLuint buf,GLenum srcRGB,GLenum dstRGB,GLenum srcAlpha,GLenum dstAlpha)136 GL_BlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
137 {
138     Context *context = GetValidGlobalContext();
139     EVENT(context, GLBlendFuncSeparatei,
140           "context = %d, buf = %u, srcRGB = %s, dstRGB = %s, srcAlpha = %s, dstAlpha = %s",
141           CID(context), buf, GLenumToString(GLenumGroup::BlendingFactor, srcRGB),
142           GLenumToString(GLenumGroup::BlendingFactor, dstRGB),
143           GLenumToString(GLenumGroup::BlendingFactor, srcAlpha),
144           GLenumToString(GLenumGroup::BlendingFactor, dstAlpha));
145 
146     if (context)
147     {
148         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
149         bool isCallValid =
150             (context->skipValidation() ||
151              ValidateBlendFuncSeparatei(context, angle::EntryPoint::GLBlendFuncSeparatei, buf,
152                                         srcRGB, dstRGB, srcAlpha, dstAlpha));
153         if (isCallValid)
154         {
155             context->blendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
156         }
157         ANGLE_CAPTURE(BlendFuncSeparatei, isCallValid, context, buf, srcRGB, dstRGB, srcAlpha,
158                       dstAlpha);
159     }
160     else
161     {
162         GenerateContextLostErrorOnCurrentGlobalContext();
163     }
164 }
165 
GL_BlendFunci(GLuint buf,GLenum src,GLenum dst)166 void GL_APIENTRY GL_BlendFunci(GLuint buf, GLenum src, GLenum dst)
167 {
168     Context *context = GetValidGlobalContext();
169     EVENT(context, GLBlendFunci, "context = %d, buf = %u, src = %s, dst = %s", CID(context), buf,
170           GLenumToString(GLenumGroup::BlendingFactor, src),
171           GLenumToString(GLenumGroup::BlendingFactor, dst));
172 
173     if (context)
174     {
175         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
176         bool isCallValid =
177             (context->skipValidation() ||
178              ValidateBlendFunci(context, angle::EntryPoint::GLBlendFunci, buf, src, dst));
179         if (isCallValid)
180         {
181             context->blendFunci(buf, src, dst);
182         }
183         ANGLE_CAPTURE(BlendFunci, isCallValid, context, buf, src, dst);
184     }
185     else
186     {
187         GenerateContextLostErrorOnCurrentGlobalContext();
188     }
189 }
190 
GL_DeleteTransformFeedbacks(GLsizei n,const GLuint * ids)191 void GL_APIENTRY GL_DeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
192 {
193     Context *context = GetValidGlobalContext();
194     EVENT(context, GLDeleteTransformFeedbacks, "context = %d, n = %d, ids = 0x%016" PRIxPTR "",
195           CID(context), n, (uintptr_t)ids);
196 
197     if (context)
198     {
199         const TransformFeedbackID *idsPacked = PackParam<const TransformFeedbackID *>(ids);
200         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
201         bool isCallValid =
202             (context->skipValidation() ||
203              ValidateDeleteTransformFeedbacks(
204                  context, angle::EntryPoint::GLDeleteTransformFeedbacks, n, idsPacked));
205         if (isCallValid)
206         {
207             context->deleteTransformFeedbacks(n, idsPacked);
208         }
209         ANGLE_CAPTURE(DeleteTransformFeedbacks, isCallValid, context, n, idsPacked);
210     }
211     else
212     {
213         GenerateContextLostErrorOnCurrentGlobalContext();
214     }
215 }
216 
GL_DrawArraysIndirect(GLenum mode,const void * indirect)217 void GL_APIENTRY GL_DrawArraysIndirect(GLenum mode, const void *indirect)
218 {
219     Context *context = GetValidGlobalContext();
220     EVENT(context, GLDrawArraysIndirect, "context = %d, mode = %s, indirect = 0x%016" PRIxPTR "",
221           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), (uintptr_t)indirect);
222 
223     if (context)
224     {
225         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
226         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
227         bool isCallValid =
228             (context->skipValidation() ||
229              ValidateDrawArraysIndirect(context, angle::EntryPoint::GLDrawArraysIndirect,
230                                         modePacked, indirect));
231         if (isCallValid)
232         {
233             context->drawArraysIndirect(modePacked, indirect);
234         }
235         ANGLE_CAPTURE(DrawArraysIndirect, isCallValid, context, modePacked, indirect);
236     }
237     else
238     {
239         GenerateContextLostErrorOnCurrentGlobalContext();
240     }
241 }
242 
GL_DrawElementsIndirect(GLenum mode,GLenum type,const void * indirect)243 void GL_APIENTRY GL_DrawElementsIndirect(GLenum mode, GLenum type, const void *indirect)
244 {
245     Context *context = GetValidGlobalContext();
246     EVENT(context, GLDrawElementsIndirect,
247           "context = %d, mode = %s, type = %s, indirect = 0x%016" PRIxPTR "", CID(context),
248           GLenumToString(GLenumGroup::PrimitiveType, mode),
249           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indirect);
250 
251     if (context)
252     {
253         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
254         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
255         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
256         bool isCallValid =
257             (context->skipValidation() ||
258              ValidateDrawElementsIndirect(context, angle::EntryPoint::GLDrawElementsIndirect,
259                                           modePacked, typePacked, indirect));
260         if (isCallValid)
261         {
262             context->drawElementsIndirect(modePacked, typePacked, indirect);
263         }
264         ANGLE_CAPTURE(DrawElementsIndirect, isCallValid, context, modePacked, typePacked, indirect);
265     }
266     else
267     {
268         GenerateContextLostErrorOnCurrentGlobalContext();
269     }
270 }
271 
GL_DrawTransformFeedback(GLenum mode,GLuint id)272 void GL_APIENTRY GL_DrawTransformFeedback(GLenum mode, GLuint id)
273 {
274     Context *context = GetValidGlobalContext();
275     EVENT(context, GLDrawTransformFeedback, "context = %d, mode = %s, id = %u", CID(context),
276           GLenumToString(GLenumGroup::PrimitiveType, mode), id);
277 
278     if (context)
279     {
280         TransformFeedbackID idPacked                          = PackParam<TransformFeedbackID>(id);
281         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
282         bool isCallValid =
283             (context->skipValidation() ||
284              ValidateDrawTransformFeedback(context, angle::EntryPoint::GLDrawTransformFeedback,
285                                            mode, idPacked));
286         if (isCallValid)
287         {
288             context->drawTransformFeedback(mode, idPacked);
289         }
290         ANGLE_CAPTURE(DrawTransformFeedback, isCallValid, context, mode, idPacked);
291     }
292     else
293     {
294         GenerateContextLostErrorOnCurrentGlobalContext();
295     }
296 }
297 
GL_DrawTransformFeedbackStream(GLenum mode,GLuint id,GLuint stream)298 void GL_APIENTRY GL_DrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream)
299 {
300     Context *context = GetValidGlobalContext();
301     EVENT(context, GLDrawTransformFeedbackStream, "context = %d, mode = %s, id = %u, stream = %u",
302           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), id, stream);
303 
304     if (context)
305     {
306         TransformFeedbackID idPacked                          = PackParam<TransformFeedbackID>(id);
307         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
308         bool isCallValid                                      = (context->skipValidation() ||
309                             ValidateDrawTransformFeedbackStream(
310                                 context, angle::EntryPoint::GLDrawTransformFeedbackStream, mode,
311                                 idPacked, stream));
312         if (isCallValid)
313         {
314             context->drawTransformFeedbackStream(mode, idPacked, stream);
315         }
316         ANGLE_CAPTURE(DrawTransformFeedbackStream, isCallValid, context, mode, idPacked, stream);
317     }
318     else
319     {
320         GenerateContextLostErrorOnCurrentGlobalContext();
321     }
322 }
323 
GL_EndQueryIndexed(GLenum target,GLuint index)324 void GL_APIENTRY GL_EndQueryIndexed(GLenum target, GLuint index)
325 {
326     Context *context = GetValidGlobalContext();
327     EVENT(context, GLEndQueryIndexed, "context = %d, target = %s, index = %u", CID(context),
328           GLenumToString(GLenumGroup::QueryTarget, target), index);
329 
330     if (context)
331     {
332         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
333         bool isCallValid =
334             (context->skipValidation() ||
335              ValidateEndQueryIndexed(context, angle::EntryPoint::GLEndQueryIndexed, target, index));
336         if (isCallValid)
337         {
338             context->endQueryIndexed(target, index);
339         }
340         ANGLE_CAPTURE(EndQueryIndexed, isCallValid, context, target, index);
341     }
342     else
343     {
344         GenerateContextLostErrorOnCurrentGlobalContext();
345     }
346 }
347 
GL_GenTransformFeedbacks(GLsizei n,GLuint * ids)348 void GL_APIENTRY GL_GenTransformFeedbacks(GLsizei n, GLuint *ids)
349 {
350     Context *context = GetValidGlobalContext();
351     EVENT(context, GLGenTransformFeedbacks, "context = %d, n = %d, ids = 0x%016" PRIxPTR "",
352           CID(context), n, (uintptr_t)ids);
353 
354     if (context)
355     {
356         TransformFeedbackID *idsPacked = PackParam<TransformFeedbackID *>(ids);
357         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
358         bool isCallValid                                      = (context->skipValidation() ||
359                             ValidateGenTransformFeedbacks(
360                                 context, angle::EntryPoint::GLGenTransformFeedbacks, n, idsPacked));
361         if (isCallValid)
362         {
363             context->genTransformFeedbacks(n, idsPacked);
364         }
365         ANGLE_CAPTURE(GenTransformFeedbacks, isCallValid, context, n, idsPacked);
366     }
367     else
368     {
369         GenerateContextLostErrorOnCurrentGlobalContext();
370     }
371 }
372 
GL_GetActiveSubroutineName(GLuint program,GLenum shadertype,GLuint index,GLsizei bufsize,GLsizei * length,GLchar * name)373 void GL_APIENTRY GL_GetActiveSubroutineName(GLuint program,
374                                             GLenum shadertype,
375                                             GLuint index,
376                                             GLsizei bufsize,
377                                             GLsizei *length,
378                                             GLchar *name)
379 {
380     Context *context = GetValidGlobalContext();
381     EVENT(context, GLGetActiveSubroutineName,
382           "context = %d, program = %u, shadertype = %s, index = %u, bufsize = %d, length = "
383           "0x%016" PRIxPTR ", name = 0x%016" PRIxPTR "",
384           CID(context), program, GLenumToString(GLenumGroup::ShaderType, shadertype), index,
385           bufsize, (uintptr_t)length, (uintptr_t)name);
386 
387     if (context)
388     {
389         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
390         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
391         bool isCallValid                                      = (context->skipValidation() ||
392                             ValidateGetActiveSubroutineName(
393                                 context, angle::EntryPoint::GLGetActiveSubroutineName,
394                                 programPacked, shadertype, index, bufsize, length, name));
395         if (isCallValid)
396         {
397             context->getActiveSubroutineName(programPacked, shadertype, index, bufsize, length,
398                                              name);
399         }
400         ANGLE_CAPTURE(GetActiveSubroutineName, isCallValid, context, programPacked, shadertype,
401                       index, bufsize, length, name);
402     }
403     else
404     {
405         GenerateContextLostErrorOnCurrentGlobalContext();
406     }
407 }
408 
GL_GetActiveSubroutineUniformName(GLuint program,GLenum shadertype,GLuint index,GLsizei bufsize,GLsizei * length,GLchar * name)409 void GL_APIENTRY GL_GetActiveSubroutineUniformName(GLuint program,
410                                                    GLenum shadertype,
411                                                    GLuint index,
412                                                    GLsizei bufsize,
413                                                    GLsizei *length,
414                                                    GLchar *name)
415 {
416     Context *context = GetValidGlobalContext();
417     EVENT(context, GLGetActiveSubroutineUniformName,
418           "context = %d, program = %u, shadertype = %s, index = %u, bufsize = %d, length = "
419           "0x%016" PRIxPTR ", name = 0x%016" PRIxPTR "",
420           CID(context), program, GLenumToString(GLenumGroup::ShaderType, shadertype), index,
421           bufsize, (uintptr_t)length, (uintptr_t)name);
422 
423     if (context)
424     {
425         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
426         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
427         bool isCallValid                                      = (context->skipValidation() ||
428                             ValidateGetActiveSubroutineUniformName(
429                                 context, angle::EntryPoint::GLGetActiveSubroutineUniformName,
430                                 programPacked, shadertype, index, bufsize, length, name));
431         if (isCallValid)
432         {
433             context->getActiveSubroutineUniformName(programPacked, shadertype, index, bufsize,
434                                                     length, name);
435         }
436         ANGLE_CAPTURE(GetActiveSubroutineUniformName, isCallValid, context, programPacked,
437                       shadertype, index, bufsize, length, name);
438     }
439     else
440     {
441         GenerateContextLostErrorOnCurrentGlobalContext();
442     }
443 }
444 
GL_GetActiveSubroutineUniformiv(GLuint program,GLenum shadertype,GLuint index,GLenum pname,GLint * values)445 void GL_APIENTRY GL_GetActiveSubroutineUniformiv(GLuint program,
446                                                  GLenum shadertype,
447                                                  GLuint index,
448                                                  GLenum pname,
449                                                  GLint *values)
450 {
451     Context *context = GetValidGlobalContext();
452     EVENT(context, GLGetActiveSubroutineUniformiv,
453           "context = %d, program = %u, shadertype = %s, index = %u, pname = %s, values = "
454           "0x%016" PRIxPTR "",
455           CID(context), program, GLenumToString(GLenumGroup::ShaderType, shadertype), index,
456           GLenumToString(GLenumGroup::SubroutineParameterName, pname), (uintptr_t)values);
457 
458     if (context)
459     {
460         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
461         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
462         bool isCallValid                                      = (context->skipValidation() ||
463                             ValidateGetActiveSubroutineUniformiv(
464                                 context, angle::EntryPoint::GLGetActiveSubroutineUniformiv,
465                                 programPacked, shadertype, index, pname, values));
466         if (isCallValid)
467         {
468             context->getActiveSubroutineUniformiv(programPacked, shadertype, index, pname, values);
469         }
470         ANGLE_CAPTURE(GetActiveSubroutineUniformiv, isCallValid, context, programPacked, shadertype,
471                       index, pname, values);
472     }
473     else
474     {
475         GenerateContextLostErrorOnCurrentGlobalContext();
476     }
477 }
478 
GL_GetProgramStageiv(GLuint program,GLenum shadertype,GLenum pname,GLint * values)479 void GL_APIENTRY GL_GetProgramStageiv(GLuint program,
480                                       GLenum shadertype,
481                                       GLenum pname,
482                                       GLint *values)
483 {
484     Context *context = GetValidGlobalContext();
485     EVENT(context, GLGetProgramStageiv,
486           "context = %d, program = %u, shadertype = %s, pname = %s, values = 0x%016" PRIxPTR "",
487           CID(context), program, GLenumToString(GLenumGroup::ShaderType, shadertype),
488           GLenumToString(GLenumGroup::ProgramStagePName, pname), (uintptr_t)values);
489 
490     if (context)
491     {
492         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
493         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
494         bool isCallValid =
495             (context->skipValidation() ||
496              ValidateGetProgramStageiv(context, angle::EntryPoint::GLGetProgramStageiv,
497                                        programPacked, shadertype, pname, values));
498         if (isCallValid)
499         {
500             context->getProgramStageiv(programPacked, shadertype, pname, values);
501         }
502         ANGLE_CAPTURE(GetProgramStageiv, isCallValid, context, programPacked, shadertype, pname,
503                       values);
504     }
505     else
506     {
507         GenerateContextLostErrorOnCurrentGlobalContext();
508     }
509 }
510 
GL_GetQueryIndexediv(GLenum target,GLuint index,GLenum pname,GLint * params)511 void GL_APIENTRY GL_GetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params)
512 {
513     Context *context = GetValidGlobalContext();
514     EVENT(context, GLGetQueryIndexediv,
515           "context = %d, target = %s, index = %u, pname = %s, params = 0x%016" PRIxPTR "",
516           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target), index,
517           GLenumToString(GLenumGroup::QueryParameterName, pname), (uintptr_t)params);
518 
519     if (context)
520     {
521         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
522         bool isCallValid =
523             (context->skipValidation() ||
524              ValidateGetQueryIndexediv(context, angle::EntryPoint::GLGetQueryIndexediv, target,
525                                        index, pname, params));
526         if (isCallValid)
527         {
528             context->getQueryIndexediv(target, index, pname, params);
529         }
530         ANGLE_CAPTURE(GetQueryIndexediv, isCallValid, context, target, index, pname, params);
531     }
532     else
533     {
534         GenerateContextLostErrorOnCurrentGlobalContext();
535     }
536 }
537 
GL_GetSubroutineIndex(GLuint program,GLenum shadertype,const GLchar * name)538 GLuint GL_APIENTRY GL_GetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name)
539 {
540     Context *context = GetValidGlobalContext();
541     EVENT(context, GLGetSubroutineIndex,
542           "context = %d, program = %u, shadertype = %s, name = 0x%016" PRIxPTR "", CID(context),
543           program, GLenumToString(GLenumGroup::ShaderType, shadertype), (uintptr_t)name);
544 
545     GLuint returnValue;
546     if (context)
547     {
548         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
549         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
550         bool isCallValid =
551             (context->skipValidation() ||
552              ValidateGetSubroutineIndex(context, angle::EntryPoint::GLGetSubroutineIndex,
553                                         programPacked, shadertype, name));
554         if (isCallValid)
555         {
556             returnValue = context->getSubroutineIndex(programPacked, shadertype, name);
557         }
558         else
559         {
560             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetSubroutineIndex, GLuint>();
561         }
562         ANGLE_CAPTURE(GetSubroutineIndex, isCallValid, context, programPacked, shadertype, name,
563                       returnValue);
564     }
565     else
566     {
567         GenerateContextLostErrorOnCurrentGlobalContext();
568         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetSubroutineIndex, GLuint>();
569     }
570     return returnValue;
571 }
572 
GL_GetSubroutineUniformLocation(GLuint program,GLenum shadertype,const GLchar * name)573 GLint GL_APIENTRY GL_GetSubroutineUniformLocation(GLuint program,
574                                                   GLenum shadertype,
575                                                   const GLchar *name)
576 {
577     Context *context = GetValidGlobalContext();
578     EVENT(context, GLGetSubroutineUniformLocation,
579           "context = %d, program = %u, shadertype = %s, name = 0x%016" PRIxPTR "", CID(context),
580           program, GLenumToString(GLenumGroup::ShaderType, shadertype), (uintptr_t)name);
581 
582     GLint returnValue;
583     if (context)
584     {
585         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
586         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
587         bool isCallValid                                      = (context->skipValidation() ||
588                             ValidateGetSubroutineUniformLocation(
589                                 context, angle::EntryPoint::GLGetSubroutineUniformLocation,
590                                 programPacked, shadertype, name));
591         if (isCallValid)
592         {
593             returnValue = context->getSubroutineUniformLocation(programPacked, shadertype, name);
594         }
595         else
596         {
597             returnValue =
598                 GetDefaultReturnValue<angle::EntryPoint::GLGetSubroutineUniformLocation, GLint>();
599         }
600         ANGLE_CAPTURE(GetSubroutineUniformLocation, isCallValid, context, programPacked, shadertype,
601                       name, returnValue);
602     }
603     else
604     {
605         GenerateContextLostErrorOnCurrentGlobalContext();
606         returnValue =
607             GetDefaultReturnValue<angle::EntryPoint::GLGetSubroutineUniformLocation, GLint>();
608     }
609     return returnValue;
610 }
611 
GL_GetUniformSubroutineuiv(GLenum shadertype,GLint location,GLuint * params)612 void GL_APIENTRY GL_GetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params)
613 {
614     Context *context = GetValidGlobalContext();
615     EVENT(context, GLGetUniformSubroutineuiv,
616           "context = %d, shadertype = %s, location = %d, params = 0x%016" PRIxPTR "", CID(context),
617           GLenumToString(GLenumGroup::ShaderType, shadertype), location, (uintptr_t)params);
618 
619     if (context)
620     {
621         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
622         bool isCallValid =
623             (context->skipValidation() ||
624              ValidateGetUniformSubroutineuiv(context, angle::EntryPoint::GLGetUniformSubroutineuiv,
625                                              shadertype, location, params));
626         if (isCallValid)
627         {
628             context->getUniformSubroutineuiv(shadertype, location, params);
629         }
630         ANGLE_CAPTURE(GetUniformSubroutineuiv, isCallValid, context, shadertype, location, params);
631     }
632     else
633     {
634         GenerateContextLostErrorOnCurrentGlobalContext();
635     }
636 }
637 
GL_GetUniformdv(GLuint program,GLint location,GLdouble * params)638 void GL_APIENTRY GL_GetUniformdv(GLuint program, GLint location, GLdouble *params)
639 {
640     Context *context = GetValidGlobalContext();
641     EVENT(context, GLGetUniformdv,
642           "context = %d, program = %u, location = %d, params = 0x%016" PRIxPTR "", CID(context),
643           program, location, (uintptr_t)params);
644 
645     if (context)
646     {
647         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
648         UniformLocation locationPacked = PackParam<UniformLocation>(location);
649         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
650         bool isCallValid                                      = (context->skipValidation() ||
651                             ValidateGetUniformdv(context, angle::EntryPoint::GLGetUniformdv,
652                                                  programPacked, locationPacked, params));
653         if (isCallValid)
654         {
655             context->getUniformdv(programPacked, locationPacked, params);
656         }
657         ANGLE_CAPTURE(GetUniformdv, isCallValid, context, programPacked, locationPacked, params);
658     }
659     else
660     {
661         GenerateContextLostErrorOnCurrentGlobalContext();
662     }
663 }
664 
GL_IsTransformFeedback(GLuint id)665 GLboolean GL_APIENTRY GL_IsTransformFeedback(GLuint id)
666 {
667     Context *context = GetValidGlobalContext();
668     EVENT(context, GLIsTransformFeedback, "context = %d, id = %u", CID(context), id);
669 
670     GLboolean returnValue;
671     if (context)
672     {
673         TransformFeedbackID idPacked                          = PackParam<TransformFeedbackID>(id);
674         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
675         bool isCallValid                                      = (context->skipValidation() ||
676                             ValidateIsTransformFeedback(
677                                 context, angle::EntryPoint::GLIsTransformFeedback, idPacked));
678         if (isCallValid)
679         {
680             returnValue = context->isTransformFeedback(idPacked);
681         }
682         else
683         {
684             returnValue =
685                 GetDefaultReturnValue<angle::EntryPoint::GLIsTransformFeedback, GLboolean>();
686         }
687         ANGLE_CAPTURE(IsTransformFeedback, isCallValid, context, idPacked, returnValue);
688     }
689     else
690     {
691         GenerateContextLostErrorOnCurrentGlobalContext();
692         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsTransformFeedback, GLboolean>();
693     }
694     return returnValue;
695 }
696 
GL_MinSampleShading(GLfloat value)697 void GL_APIENTRY GL_MinSampleShading(GLfloat value)
698 {
699     Context *context = GetValidGlobalContext();
700     EVENT(context, GLMinSampleShading, "context = %d, value = %f", CID(context), value);
701 
702     if (context)
703     {
704         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
705         bool isCallValid =
706             (context->skipValidation() ||
707              ValidateMinSampleShading(context, angle::EntryPoint::GLMinSampleShading, value));
708         if (isCallValid)
709         {
710             context->minSampleShading(value);
711         }
712         ANGLE_CAPTURE(MinSampleShading, isCallValid, context, value);
713     }
714     else
715     {
716         GenerateContextLostErrorOnCurrentGlobalContext();
717     }
718 }
719 
GL_PatchParameterfv(GLenum pname,const GLfloat * values)720 void GL_APIENTRY GL_PatchParameterfv(GLenum pname, const GLfloat *values)
721 {
722     Context *context = GetValidGlobalContext();
723     EVENT(context, GLPatchParameterfv, "context = %d, pname = %s, values = 0x%016" PRIxPTR "",
724           CID(context), GLenumToString(GLenumGroup::PatchParameterName, pname), (uintptr_t)values);
725 
726     if (context)
727     {
728         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
729         bool isCallValid                                      = (context->skipValidation() ||
730                             ValidatePatchParameterfv(context, angle::EntryPoint::GLPatchParameterfv,
731                                                      pname, values));
732         if (isCallValid)
733         {
734             context->patchParameterfv(pname, values);
735         }
736         ANGLE_CAPTURE(PatchParameterfv, isCallValid, context, pname, values);
737     }
738     else
739     {
740         GenerateContextLostErrorOnCurrentGlobalContext();
741     }
742 }
743 
GL_PatchParameteri(GLenum pname,GLint value)744 void GL_APIENTRY GL_PatchParameteri(GLenum pname, GLint value)
745 {
746     Context *context = GetValidGlobalContext();
747     EVENT(context, GLPatchParameteri, "context = %d, pname = %s, value = %d", CID(context),
748           GLenumToString(GLenumGroup::PatchParameterName, pname), value);
749 
750     if (context)
751     {
752         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
753         bool isCallValid =
754             (context->skipValidation() ||
755              ValidatePatchParameteri(context, angle::EntryPoint::GLPatchParameteri, pname, value));
756         if (isCallValid)
757         {
758             context->patchParameteri(pname, value);
759         }
760         ANGLE_CAPTURE(PatchParameteri, isCallValid, context, pname, value);
761     }
762     else
763     {
764         GenerateContextLostErrorOnCurrentGlobalContext();
765     }
766 }
767 
GL_PauseTransformFeedback()768 void GL_APIENTRY GL_PauseTransformFeedback()
769 {
770     Context *context = GetValidGlobalContext();
771     EVENT(context, GLPauseTransformFeedback, "context = %d", CID(context));
772 
773     if (context)
774     {
775         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
776         bool isCallValid =
777             (context->skipValidation() ||
778              ValidatePauseTransformFeedback(context, angle::EntryPoint::GLPauseTransformFeedback));
779         if (isCallValid)
780         {
781             context->pauseTransformFeedback();
782         }
783         ANGLE_CAPTURE(PauseTransformFeedback, isCallValid, context);
784     }
785     else
786     {
787         GenerateContextLostErrorOnCurrentGlobalContext();
788     }
789 }
790 
GL_ResumeTransformFeedback()791 void GL_APIENTRY GL_ResumeTransformFeedback()
792 {
793     Context *context = GetValidGlobalContext();
794     EVENT(context, GLResumeTransformFeedback, "context = %d", CID(context));
795 
796     if (context)
797     {
798         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
799         bool isCallValid                                      = (context->skipValidation() ||
800                             ValidateResumeTransformFeedback(
801                                 context, angle::EntryPoint::GLResumeTransformFeedback));
802         if (isCallValid)
803         {
804             context->resumeTransformFeedback();
805         }
806         ANGLE_CAPTURE(ResumeTransformFeedback, isCallValid, context);
807     }
808     else
809     {
810         GenerateContextLostErrorOnCurrentGlobalContext();
811     }
812 }
813 
GL_Uniform1d(GLint location,GLdouble x)814 void GL_APIENTRY GL_Uniform1d(GLint location, GLdouble x)
815 {
816     Context *context = GetValidGlobalContext();
817     EVENT(context, GLUniform1d, "context = %d, location = %d, x = %f", CID(context), location, x);
818 
819     if (context)
820     {
821         UniformLocation locationPacked = PackParam<UniformLocation>(location);
822         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
823         bool isCallValid =
824             (context->skipValidation() ||
825              ValidateUniform1d(context, angle::EntryPoint::GLUniform1d, locationPacked, x));
826         if (isCallValid)
827         {
828             context->uniform1d(locationPacked, x);
829         }
830         ANGLE_CAPTURE(Uniform1d, isCallValid, context, locationPacked, x);
831     }
832     else
833     {
834         GenerateContextLostErrorOnCurrentGlobalContext();
835     }
836 }
837 
GL_Uniform1dv(GLint location,GLsizei count,const GLdouble * value)838 void GL_APIENTRY GL_Uniform1dv(GLint location, GLsizei count, const GLdouble *value)
839 {
840     Context *context = GetValidGlobalContext();
841     EVENT(context, GLUniform1dv,
842           "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
843           location, count, (uintptr_t)value);
844 
845     if (context)
846     {
847         UniformLocation locationPacked = PackParam<UniformLocation>(location);
848         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
849         bool isCallValid                                      = (context->skipValidation() ||
850                             ValidateUniform1dv(context, angle::EntryPoint::GLUniform1dv,
851                                                locationPacked, count, value));
852         if (isCallValid)
853         {
854             context->uniform1dv(locationPacked, count, value);
855         }
856         ANGLE_CAPTURE(Uniform1dv, isCallValid, context, locationPacked, count, value);
857     }
858     else
859     {
860         GenerateContextLostErrorOnCurrentGlobalContext();
861     }
862 }
863 
GL_Uniform2d(GLint location,GLdouble x,GLdouble y)864 void GL_APIENTRY GL_Uniform2d(GLint location, GLdouble x, GLdouble y)
865 {
866     Context *context = GetValidGlobalContext();
867     EVENT(context, GLUniform2d, "context = %d, location = %d, x = %f, y = %f", CID(context),
868           location, x, y);
869 
870     if (context)
871     {
872         UniformLocation locationPacked = PackParam<UniformLocation>(location);
873         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
874         bool isCallValid =
875             (context->skipValidation() ||
876              ValidateUniform2d(context, angle::EntryPoint::GLUniform2d, locationPacked, x, y));
877         if (isCallValid)
878         {
879             context->uniform2d(locationPacked, x, y);
880         }
881         ANGLE_CAPTURE(Uniform2d, isCallValid, context, locationPacked, x, y);
882     }
883     else
884     {
885         GenerateContextLostErrorOnCurrentGlobalContext();
886     }
887 }
888 
GL_Uniform2dv(GLint location,GLsizei count,const GLdouble * value)889 void GL_APIENTRY GL_Uniform2dv(GLint location, GLsizei count, const GLdouble *value)
890 {
891     Context *context = GetValidGlobalContext();
892     EVENT(context, GLUniform2dv,
893           "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
894           location, count, (uintptr_t)value);
895 
896     if (context)
897     {
898         UniformLocation locationPacked = PackParam<UniformLocation>(location);
899         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
900         bool isCallValid                                      = (context->skipValidation() ||
901                             ValidateUniform2dv(context, angle::EntryPoint::GLUniform2dv,
902                                                locationPacked, count, value));
903         if (isCallValid)
904         {
905             context->uniform2dv(locationPacked, count, value);
906         }
907         ANGLE_CAPTURE(Uniform2dv, isCallValid, context, locationPacked, count, value);
908     }
909     else
910     {
911         GenerateContextLostErrorOnCurrentGlobalContext();
912     }
913 }
914 
GL_Uniform3d(GLint location,GLdouble x,GLdouble y,GLdouble z)915 void GL_APIENTRY GL_Uniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
916 {
917     Context *context = GetValidGlobalContext();
918     EVENT(context, GLUniform3d, "context = %d, location = %d, x = %f, y = %f, z = %f", CID(context),
919           location, x, y, z);
920 
921     if (context)
922     {
923         UniformLocation locationPacked = PackParam<UniformLocation>(location);
924         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
925         bool isCallValid =
926             (context->skipValidation() ||
927              ValidateUniform3d(context, angle::EntryPoint::GLUniform3d, locationPacked, x, y, z));
928         if (isCallValid)
929         {
930             context->uniform3d(locationPacked, x, y, z);
931         }
932         ANGLE_CAPTURE(Uniform3d, isCallValid, context, locationPacked, x, y, z);
933     }
934     else
935     {
936         GenerateContextLostErrorOnCurrentGlobalContext();
937     }
938 }
939 
GL_Uniform3dv(GLint location,GLsizei count,const GLdouble * value)940 void GL_APIENTRY GL_Uniform3dv(GLint location, GLsizei count, const GLdouble *value)
941 {
942     Context *context = GetValidGlobalContext();
943     EVENT(context, GLUniform3dv,
944           "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
945           location, count, (uintptr_t)value);
946 
947     if (context)
948     {
949         UniformLocation locationPacked = PackParam<UniformLocation>(location);
950         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
951         bool isCallValid                                      = (context->skipValidation() ||
952                             ValidateUniform3dv(context, angle::EntryPoint::GLUniform3dv,
953                                                locationPacked, count, value));
954         if (isCallValid)
955         {
956             context->uniform3dv(locationPacked, count, value);
957         }
958         ANGLE_CAPTURE(Uniform3dv, isCallValid, context, locationPacked, count, value);
959     }
960     else
961     {
962         GenerateContextLostErrorOnCurrentGlobalContext();
963     }
964 }
965 
GL_Uniform4d(GLint location,GLdouble x,GLdouble y,GLdouble z,GLdouble w)966 void GL_APIENTRY GL_Uniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
967 {
968     Context *context = GetValidGlobalContext();
969     EVENT(context, GLUniform4d, "context = %d, location = %d, x = %f, y = %f, z = %f, w = %f",
970           CID(context), location, x, y, z, w);
971 
972     if (context)
973     {
974         UniformLocation locationPacked = PackParam<UniformLocation>(location);
975         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
976         bool isCallValid =
977             (context->skipValidation() || ValidateUniform4d(context, angle::EntryPoint::GLUniform4d,
978                                                             locationPacked, x, y, z, w));
979         if (isCallValid)
980         {
981             context->uniform4d(locationPacked, x, y, z, w);
982         }
983         ANGLE_CAPTURE(Uniform4d, isCallValid, context, locationPacked, x, y, z, w);
984     }
985     else
986     {
987         GenerateContextLostErrorOnCurrentGlobalContext();
988     }
989 }
990 
GL_Uniform4dv(GLint location,GLsizei count,const GLdouble * value)991 void GL_APIENTRY GL_Uniform4dv(GLint location, GLsizei count, const GLdouble *value)
992 {
993     Context *context = GetValidGlobalContext();
994     EVENT(context, GLUniform4dv,
995           "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
996           location, count, (uintptr_t)value);
997 
998     if (context)
999     {
1000         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1001         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1002         bool isCallValid                                      = (context->skipValidation() ||
1003                             ValidateUniform4dv(context, angle::EntryPoint::GLUniform4dv,
1004                                                locationPacked, count, value));
1005         if (isCallValid)
1006         {
1007             context->uniform4dv(locationPacked, count, value);
1008         }
1009         ANGLE_CAPTURE(Uniform4dv, isCallValid, context, locationPacked, count, value);
1010     }
1011     else
1012     {
1013         GenerateContextLostErrorOnCurrentGlobalContext();
1014     }
1015 }
1016 
GL_UniformMatrix2dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)1017 void GL_APIENTRY GL_UniformMatrix2dv(GLint location,
1018                                      GLsizei count,
1019                                      GLboolean transpose,
1020                                      const GLdouble *value)
1021 {
1022     Context *context = GetValidGlobalContext();
1023     EVENT(context, GLUniformMatrix2dv,
1024           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
1025           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
1026 
1027     if (context)
1028     {
1029         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1030         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1031         bool isCallValid                                      = (context->skipValidation() ||
1032                             ValidateUniformMatrix2dv(context, angle::EntryPoint::GLUniformMatrix2dv,
1033                                                      locationPacked, count, transpose, value));
1034         if (isCallValid)
1035         {
1036             context->uniformMatrix2dv(locationPacked, count, transpose, value);
1037         }
1038         ANGLE_CAPTURE(UniformMatrix2dv, isCallValid, context, locationPacked, count, transpose,
1039                       value);
1040     }
1041     else
1042     {
1043         GenerateContextLostErrorOnCurrentGlobalContext();
1044     }
1045 }
1046 
GL_UniformMatrix2x3dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)1047 void GL_APIENTRY GL_UniformMatrix2x3dv(GLint location,
1048                                        GLsizei count,
1049                                        GLboolean transpose,
1050                                        const GLdouble *value)
1051 {
1052     Context *context = GetValidGlobalContext();
1053     EVENT(context, GLUniformMatrix2x3dv,
1054           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
1055           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
1056 
1057     if (context)
1058     {
1059         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1060         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1061         bool isCallValid =
1062             (context->skipValidation() ||
1063              ValidateUniformMatrix2x3dv(context, angle::EntryPoint::GLUniformMatrix2x3dv,
1064                                         locationPacked, count, transpose, value));
1065         if (isCallValid)
1066         {
1067             context->uniformMatrix2x3dv(locationPacked, count, transpose, value);
1068         }
1069         ANGLE_CAPTURE(UniformMatrix2x3dv, isCallValid, context, locationPacked, count, transpose,
1070                       value);
1071     }
1072     else
1073     {
1074         GenerateContextLostErrorOnCurrentGlobalContext();
1075     }
1076 }
1077 
GL_UniformMatrix2x4dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)1078 void GL_APIENTRY GL_UniformMatrix2x4dv(GLint location,
1079                                        GLsizei count,
1080                                        GLboolean transpose,
1081                                        const GLdouble *value)
1082 {
1083     Context *context = GetValidGlobalContext();
1084     EVENT(context, GLUniformMatrix2x4dv,
1085           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
1086           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
1087 
1088     if (context)
1089     {
1090         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1091         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1092         bool isCallValid =
1093             (context->skipValidation() ||
1094              ValidateUniformMatrix2x4dv(context, angle::EntryPoint::GLUniformMatrix2x4dv,
1095                                         locationPacked, count, transpose, value));
1096         if (isCallValid)
1097         {
1098             context->uniformMatrix2x4dv(locationPacked, count, transpose, value);
1099         }
1100         ANGLE_CAPTURE(UniformMatrix2x4dv, isCallValid, context, locationPacked, count, transpose,
1101                       value);
1102     }
1103     else
1104     {
1105         GenerateContextLostErrorOnCurrentGlobalContext();
1106     }
1107 }
1108 
GL_UniformMatrix3dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)1109 void GL_APIENTRY GL_UniformMatrix3dv(GLint location,
1110                                      GLsizei count,
1111                                      GLboolean transpose,
1112                                      const GLdouble *value)
1113 {
1114     Context *context = GetValidGlobalContext();
1115     EVENT(context, GLUniformMatrix3dv,
1116           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
1117           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
1118 
1119     if (context)
1120     {
1121         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1122         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1123         bool isCallValid                                      = (context->skipValidation() ||
1124                             ValidateUniformMatrix3dv(context, angle::EntryPoint::GLUniformMatrix3dv,
1125                                                      locationPacked, count, transpose, value));
1126         if (isCallValid)
1127         {
1128             context->uniformMatrix3dv(locationPacked, count, transpose, value);
1129         }
1130         ANGLE_CAPTURE(UniformMatrix3dv, isCallValid, context, locationPacked, count, transpose,
1131                       value);
1132     }
1133     else
1134     {
1135         GenerateContextLostErrorOnCurrentGlobalContext();
1136     }
1137 }
1138 
GL_UniformMatrix3x2dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)1139 void GL_APIENTRY GL_UniformMatrix3x2dv(GLint location,
1140                                        GLsizei count,
1141                                        GLboolean transpose,
1142                                        const GLdouble *value)
1143 {
1144     Context *context = GetValidGlobalContext();
1145     EVENT(context, GLUniformMatrix3x2dv,
1146           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
1147           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
1148 
1149     if (context)
1150     {
1151         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1152         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1153         bool isCallValid =
1154             (context->skipValidation() ||
1155              ValidateUniformMatrix3x2dv(context, angle::EntryPoint::GLUniformMatrix3x2dv,
1156                                         locationPacked, count, transpose, value));
1157         if (isCallValid)
1158         {
1159             context->uniformMatrix3x2dv(locationPacked, count, transpose, value);
1160         }
1161         ANGLE_CAPTURE(UniformMatrix3x2dv, isCallValid, context, locationPacked, count, transpose,
1162                       value);
1163     }
1164     else
1165     {
1166         GenerateContextLostErrorOnCurrentGlobalContext();
1167     }
1168 }
1169 
GL_UniformMatrix3x4dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)1170 void GL_APIENTRY GL_UniformMatrix3x4dv(GLint location,
1171                                        GLsizei count,
1172                                        GLboolean transpose,
1173                                        const GLdouble *value)
1174 {
1175     Context *context = GetValidGlobalContext();
1176     EVENT(context, GLUniformMatrix3x4dv,
1177           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
1178           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
1179 
1180     if (context)
1181     {
1182         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1183         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1184         bool isCallValid =
1185             (context->skipValidation() ||
1186              ValidateUniformMatrix3x4dv(context, angle::EntryPoint::GLUniformMatrix3x4dv,
1187                                         locationPacked, count, transpose, value));
1188         if (isCallValid)
1189         {
1190             context->uniformMatrix3x4dv(locationPacked, count, transpose, value);
1191         }
1192         ANGLE_CAPTURE(UniformMatrix3x4dv, isCallValid, context, locationPacked, count, transpose,
1193                       value);
1194     }
1195     else
1196     {
1197         GenerateContextLostErrorOnCurrentGlobalContext();
1198     }
1199 }
1200 
GL_UniformMatrix4dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)1201 void GL_APIENTRY GL_UniformMatrix4dv(GLint location,
1202                                      GLsizei count,
1203                                      GLboolean transpose,
1204                                      const GLdouble *value)
1205 {
1206     Context *context = GetValidGlobalContext();
1207     EVENT(context, GLUniformMatrix4dv,
1208           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
1209           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
1210 
1211     if (context)
1212     {
1213         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1214         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1215         bool isCallValid                                      = (context->skipValidation() ||
1216                             ValidateUniformMatrix4dv(context, angle::EntryPoint::GLUniformMatrix4dv,
1217                                                      locationPacked, count, transpose, value));
1218         if (isCallValid)
1219         {
1220             context->uniformMatrix4dv(locationPacked, count, transpose, value);
1221         }
1222         ANGLE_CAPTURE(UniformMatrix4dv, isCallValid, context, locationPacked, count, transpose,
1223                       value);
1224     }
1225     else
1226     {
1227         GenerateContextLostErrorOnCurrentGlobalContext();
1228     }
1229 }
1230 
GL_UniformMatrix4x2dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)1231 void GL_APIENTRY GL_UniformMatrix4x2dv(GLint location,
1232                                        GLsizei count,
1233                                        GLboolean transpose,
1234                                        const GLdouble *value)
1235 {
1236     Context *context = GetValidGlobalContext();
1237     EVENT(context, GLUniformMatrix4x2dv,
1238           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
1239           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
1240 
1241     if (context)
1242     {
1243         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1244         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1245         bool isCallValid =
1246             (context->skipValidation() ||
1247              ValidateUniformMatrix4x2dv(context, angle::EntryPoint::GLUniformMatrix4x2dv,
1248                                         locationPacked, count, transpose, value));
1249         if (isCallValid)
1250         {
1251             context->uniformMatrix4x2dv(locationPacked, count, transpose, value);
1252         }
1253         ANGLE_CAPTURE(UniformMatrix4x2dv, isCallValid, context, locationPacked, count, transpose,
1254                       value);
1255     }
1256     else
1257     {
1258         GenerateContextLostErrorOnCurrentGlobalContext();
1259     }
1260 }
1261 
GL_UniformMatrix4x3dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)1262 void GL_APIENTRY GL_UniformMatrix4x3dv(GLint location,
1263                                        GLsizei count,
1264                                        GLboolean transpose,
1265                                        const GLdouble *value)
1266 {
1267     Context *context = GetValidGlobalContext();
1268     EVENT(context, GLUniformMatrix4x3dv,
1269           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
1270           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
1271 
1272     if (context)
1273     {
1274         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1275         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1276         bool isCallValid =
1277             (context->skipValidation() ||
1278              ValidateUniformMatrix4x3dv(context, angle::EntryPoint::GLUniformMatrix4x3dv,
1279                                         locationPacked, count, transpose, value));
1280         if (isCallValid)
1281         {
1282             context->uniformMatrix4x3dv(locationPacked, count, transpose, value);
1283         }
1284         ANGLE_CAPTURE(UniformMatrix4x3dv, isCallValid, context, locationPacked, count, transpose,
1285                       value);
1286     }
1287     else
1288     {
1289         GenerateContextLostErrorOnCurrentGlobalContext();
1290     }
1291 }
1292 
GL_UniformSubroutinesuiv(GLenum shadertype,GLsizei count,const GLuint * indices)1293 void GL_APIENTRY GL_UniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices)
1294 {
1295     Context *context = GetValidGlobalContext();
1296     EVENT(context, GLUniformSubroutinesuiv,
1297           "context = %d, shadertype = %s, count = %d, indices = 0x%016" PRIxPTR "", CID(context),
1298           GLenumToString(GLenumGroup::ShaderType, shadertype), count, (uintptr_t)indices);
1299 
1300     if (context)
1301     {
1302         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1303         bool isCallValid =
1304             (context->skipValidation() ||
1305              ValidateUniformSubroutinesuiv(context, angle::EntryPoint::GLUniformSubroutinesuiv,
1306                                            shadertype, count, indices));
1307         if (isCallValid)
1308         {
1309             context->uniformSubroutinesuiv(shadertype, count, indices);
1310         }
1311         ANGLE_CAPTURE(UniformSubroutinesuiv, isCallValid, context, shadertype, count, indices);
1312     }
1313     else
1314     {
1315         GenerateContextLostErrorOnCurrentGlobalContext();
1316     }
1317 }
1318 
1319 // GL 4.1
GL_ActiveShaderProgram(GLuint pipeline,GLuint program)1320 void GL_APIENTRY GL_ActiveShaderProgram(GLuint pipeline, GLuint program)
1321 {
1322     Context *context = GetValidGlobalContext();
1323     EVENT(context, GLActiveShaderProgram, "context = %d, pipeline = %u, program = %u", CID(context),
1324           pipeline, program);
1325 
1326     if (context)
1327     {
1328         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
1329         ShaderProgramID programPacked    = PackParam<ShaderProgramID>(program);
1330         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1331         bool isCallValid =
1332             (context->skipValidation() ||
1333              ValidateActiveShaderProgram(context, angle::EntryPoint::GLActiveShaderProgram,
1334                                          pipelinePacked, programPacked));
1335         if (isCallValid)
1336         {
1337             context->activeShaderProgram(pipelinePacked, programPacked);
1338         }
1339         ANGLE_CAPTURE(ActiveShaderProgram, isCallValid, context, pipelinePacked, programPacked);
1340     }
1341     else
1342     {
1343         GenerateContextLostErrorOnCurrentGlobalContext();
1344     }
1345 }
1346 
GL_BindProgramPipeline(GLuint pipeline)1347 void GL_APIENTRY GL_BindProgramPipeline(GLuint pipeline)
1348 {
1349     Context *context = GetValidGlobalContext();
1350     EVENT(context, GLBindProgramPipeline, "context = %d, pipeline = %u", CID(context), pipeline);
1351 
1352     if (context)
1353     {
1354         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
1355         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1356         bool isCallValid                                      = (context->skipValidation() ||
1357                             ValidateBindProgramPipeline(
1358                                 context, angle::EntryPoint::GLBindProgramPipeline, pipelinePacked));
1359         if (isCallValid)
1360         {
1361             context->bindProgramPipeline(pipelinePacked);
1362         }
1363         ANGLE_CAPTURE(BindProgramPipeline, isCallValid, context, pipelinePacked);
1364     }
1365     else
1366     {
1367         GenerateContextLostErrorOnCurrentGlobalContext();
1368     }
1369 }
1370 
GL_ClearDepthf(GLfloat d)1371 void GL_APIENTRY GL_ClearDepthf(GLfloat d)
1372 {
1373     Context *context = GetValidGlobalContext();
1374     EVENT(context, GLClearDepthf, "context = %d, d = %f", CID(context), d);
1375 
1376     if (context)
1377     {
1378         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1379         bool isCallValid                                      = (context->skipValidation() ||
1380                             ValidateClearDepthf(context, angle::EntryPoint::GLClearDepthf, d));
1381         if (isCallValid)
1382         {
1383             context->clearDepthf(d);
1384         }
1385         ANGLE_CAPTURE(ClearDepthf, isCallValid, context, d);
1386     }
1387     else
1388     {
1389         GenerateContextLostErrorOnCurrentGlobalContext();
1390     }
1391 }
1392 
GL_CreateShaderProgramv(GLenum type,GLsizei count,const GLchar * const * strings)1393 GLuint GL_APIENTRY GL_CreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const *strings)
1394 {
1395     Context *context = GetValidGlobalContext();
1396     EVENT(context, GLCreateShaderProgramv,
1397           "context = %d, type = %s, count = %d, strings = 0x%016" PRIxPTR "", CID(context),
1398           GLenumToString(GLenumGroup::ShaderType, type), count, (uintptr_t)strings);
1399 
1400     GLuint returnValue;
1401     if (context)
1402     {
1403         ShaderType typePacked                                 = PackParam<ShaderType>(type);
1404         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1405         bool isCallValid =
1406             (context->skipValidation() ||
1407              ValidateCreateShaderProgramv(context, angle::EntryPoint::GLCreateShaderProgramv,
1408                                           typePacked, count, strings));
1409         if (isCallValid)
1410         {
1411             returnValue = context->createShaderProgramv(typePacked, count, strings);
1412         }
1413         else
1414         {
1415             returnValue =
1416                 GetDefaultReturnValue<angle::EntryPoint::GLCreateShaderProgramv, GLuint>();
1417         }
1418         ANGLE_CAPTURE(CreateShaderProgramv, isCallValid, context, typePacked, count, strings,
1419                       returnValue);
1420     }
1421     else
1422     {
1423         GenerateContextLostErrorOnCurrentGlobalContext();
1424         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLCreateShaderProgramv, GLuint>();
1425     }
1426     return returnValue;
1427 }
1428 
GL_DeleteProgramPipelines(GLsizei n,const GLuint * pipelines)1429 void GL_APIENTRY GL_DeleteProgramPipelines(GLsizei n, const GLuint *pipelines)
1430 {
1431     Context *context = GetValidGlobalContext();
1432     EVENT(context, GLDeleteProgramPipelines, "context = %d, n = %d, pipelines = 0x%016" PRIxPTR "",
1433           CID(context), n, (uintptr_t)pipelines);
1434 
1435     if (context)
1436     {
1437         const ProgramPipelineID *pipelinesPacked = PackParam<const ProgramPipelineID *>(pipelines);
1438         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1439         bool isCallValid =
1440             (context->skipValidation() ||
1441              ValidateDeleteProgramPipelines(context, angle::EntryPoint::GLDeleteProgramPipelines, n,
1442                                             pipelinesPacked));
1443         if (isCallValid)
1444         {
1445             context->deleteProgramPipelines(n, pipelinesPacked);
1446         }
1447         ANGLE_CAPTURE(DeleteProgramPipelines, isCallValid, context, n, pipelinesPacked);
1448     }
1449     else
1450     {
1451         GenerateContextLostErrorOnCurrentGlobalContext();
1452     }
1453 }
1454 
GL_DepthRangeArrayv(GLuint first,GLsizei count,const GLdouble * v)1455 void GL_APIENTRY GL_DepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v)
1456 {
1457     Context *context = GetValidGlobalContext();
1458     EVENT(context, GLDepthRangeArrayv,
1459           "context = %d, first = %u, count = %d, v = 0x%016" PRIxPTR "", CID(context), first, count,
1460           (uintptr_t)v);
1461 
1462     if (context)
1463     {
1464         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1465         bool isCallValid                                      = (context->skipValidation() ||
1466                             ValidateDepthRangeArrayv(context, angle::EntryPoint::GLDepthRangeArrayv,
1467                                                      first, count, v));
1468         if (isCallValid)
1469         {
1470             context->depthRangeArrayv(first, count, v);
1471         }
1472         ANGLE_CAPTURE(DepthRangeArrayv, isCallValid, context, first, count, v);
1473     }
1474     else
1475     {
1476         GenerateContextLostErrorOnCurrentGlobalContext();
1477     }
1478 }
1479 
GL_DepthRangeIndexed(GLuint index,GLdouble n,GLdouble f)1480 void GL_APIENTRY GL_DepthRangeIndexed(GLuint index, GLdouble n, GLdouble f)
1481 {
1482     Context *context = GetValidGlobalContext();
1483     EVENT(context, GLDepthRangeIndexed, "context = %d, index = %u, n = %f, f = %f", CID(context),
1484           index, n, f);
1485 
1486     if (context)
1487     {
1488         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1489         bool isCallValid                                      = (context->skipValidation() ||
1490                             ValidateDepthRangeIndexed(
1491                                 context, angle::EntryPoint::GLDepthRangeIndexed, index, n, f));
1492         if (isCallValid)
1493         {
1494             context->depthRangeIndexed(index, n, f);
1495         }
1496         ANGLE_CAPTURE(DepthRangeIndexed, isCallValid, context, index, n, f);
1497     }
1498     else
1499     {
1500         GenerateContextLostErrorOnCurrentGlobalContext();
1501     }
1502 }
1503 
GL_DepthRangef(GLfloat n,GLfloat f)1504 void GL_APIENTRY GL_DepthRangef(GLfloat n, GLfloat f)
1505 {
1506     Context *context = GetValidGlobalContext();
1507     EVENT(context, GLDepthRangef, "context = %d, n = %f, f = %f", CID(context), n, f);
1508 
1509     if (context)
1510     {
1511         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1512         bool isCallValid                                      = (context->skipValidation() ||
1513                             ValidateDepthRangef(context, angle::EntryPoint::GLDepthRangef, n, f));
1514         if (isCallValid)
1515         {
1516             context->depthRangef(n, f);
1517         }
1518         ANGLE_CAPTURE(DepthRangef, isCallValid, context, n, f);
1519     }
1520     else
1521     {
1522         GenerateContextLostErrorOnCurrentGlobalContext();
1523     }
1524 }
1525 
GL_GenProgramPipelines(GLsizei n,GLuint * pipelines)1526 void GL_APIENTRY GL_GenProgramPipelines(GLsizei n, GLuint *pipelines)
1527 {
1528     Context *context = GetValidGlobalContext();
1529     EVENT(context, GLGenProgramPipelines, "context = %d, n = %d, pipelines = 0x%016" PRIxPTR "",
1530           CID(context), n, (uintptr_t)pipelines);
1531 
1532     if (context)
1533     {
1534         ProgramPipelineID *pipelinesPacked = PackParam<ProgramPipelineID *>(pipelines);
1535         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1536         bool isCallValid =
1537             (context->skipValidation() ||
1538              ValidateGenProgramPipelines(context, angle::EntryPoint::GLGenProgramPipelines, n,
1539                                          pipelinesPacked));
1540         if (isCallValid)
1541         {
1542             context->genProgramPipelines(n, pipelinesPacked);
1543         }
1544         ANGLE_CAPTURE(GenProgramPipelines, isCallValid, context, n, pipelinesPacked);
1545     }
1546     else
1547     {
1548         GenerateContextLostErrorOnCurrentGlobalContext();
1549     }
1550 }
1551 
GL_GetDoublei_v(GLenum target,GLuint index,GLdouble * data)1552 void GL_APIENTRY GL_GetDoublei_v(GLenum target, GLuint index, GLdouble *data)
1553 {
1554     Context *context = GetValidGlobalContext();
1555     EVENT(context, GLGetDoublei_v,
1556           "context = %d, target = %s, index = %u, data = 0x%016" PRIxPTR "", CID(context),
1557           GLenumToString(GLenumGroup::TypeEnum, target), index, (uintptr_t)data);
1558 
1559     if (context)
1560     {
1561         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1562         bool isCallValid =
1563             (context->skipValidation() ||
1564              ValidateGetDoublei_v(context, angle::EntryPoint::GLGetDoublei_v, target, index, data));
1565         if (isCallValid)
1566         {
1567             context->getDoublei_v(target, index, data);
1568         }
1569         ANGLE_CAPTURE(GetDoublei_v, isCallValid, context, target, index, data);
1570     }
1571     else
1572     {
1573         GenerateContextLostErrorOnCurrentGlobalContext();
1574     }
1575 }
1576 
GL_GetFloati_v(GLenum target,GLuint index,GLfloat * data)1577 void GL_APIENTRY GL_GetFloati_v(GLenum target, GLuint index, GLfloat *data)
1578 {
1579     Context *context = GetValidGlobalContext();
1580     EVENT(context, GLGetFloati_v, "context = %d, target = %s, index = %u, data = 0x%016" PRIxPTR "",
1581           CID(context), GLenumToString(GLenumGroup::TypeEnum, target), index, (uintptr_t)data);
1582 
1583     if (context)
1584     {
1585         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1586         bool isCallValid =
1587             (context->skipValidation() ||
1588              ValidateGetFloati_v(context, angle::EntryPoint::GLGetFloati_v, target, index, data));
1589         if (isCallValid)
1590         {
1591             context->getFloati_v(target, index, data);
1592         }
1593         ANGLE_CAPTURE(GetFloati_v, isCallValid, context, target, index, data);
1594     }
1595     else
1596     {
1597         GenerateContextLostErrorOnCurrentGlobalContext();
1598     }
1599 }
1600 
GL_GetProgramBinary(GLuint program,GLsizei bufSize,GLsizei * length,GLenum * binaryFormat,void * binary)1601 void GL_APIENTRY GL_GetProgramBinary(GLuint program,
1602                                      GLsizei bufSize,
1603                                      GLsizei *length,
1604                                      GLenum *binaryFormat,
1605                                      void *binary)
1606 {
1607     Context *context = GetValidGlobalContext();
1608     EVENT(context, GLGetProgramBinary,
1609           "context = %d, program = %u, bufSize = %d, length = 0x%016" PRIxPTR
1610           ", binaryFormat = 0x%016" PRIxPTR ", binary = 0x%016" PRIxPTR "",
1611           CID(context), program, bufSize, (uintptr_t)length, (uintptr_t)binaryFormat,
1612           (uintptr_t)binary);
1613 
1614     if (context)
1615     {
1616         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
1617         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1618         bool isCallValid =
1619             (context->skipValidation() ||
1620              ValidateGetProgramBinary(context, angle::EntryPoint::GLGetProgramBinary, programPacked,
1621                                       bufSize, length, binaryFormat, binary));
1622         if (isCallValid)
1623         {
1624             context->getProgramBinary(programPacked, bufSize, length, binaryFormat, binary);
1625         }
1626         ANGLE_CAPTURE(GetProgramBinary, isCallValid, context, programPacked, bufSize, length,
1627                       binaryFormat, binary);
1628     }
1629     else
1630     {
1631         GenerateContextLostErrorOnCurrentGlobalContext();
1632     }
1633 }
1634 
GL_GetProgramPipelineInfoLog(GLuint pipeline,GLsizei bufSize,GLsizei * length,GLchar * infoLog)1635 void GL_APIENTRY GL_GetProgramPipelineInfoLog(GLuint pipeline,
1636                                               GLsizei bufSize,
1637                                               GLsizei *length,
1638                                               GLchar *infoLog)
1639 {
1640     Context *context = GetValidGlobalContext();
1641     EVENT(context, GLGetProgramPipelineInfoLog,
1642           "context = %d, pipeline = %u, bufSize = %d, length = 0x%016" PRIxPTR
1643           ", infoLog = 0x%016" PRIxPTR "",
1644           CID(context), pipeline, bufSize, (uintptr_t)length, (uintptr_t)infoLog);
1645 
1646     if (context)
1647     {
1648         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
1649         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1650         bool isCallValid                                      = (context->skipValidation() ||
1651                             ValidateGetProgramPipelineInfoLog(
1652                                 context, angle::EntryPoint::GLGetProgramPipelineInfoLog,
1653                                 pipelinePacked, bufSize, length, infoLog));
1654         if (isCallValid)
1655         {
1656             context->getProgramPipelineInfoLog(pipelinePacked, bufSize, length, infoLog);
1657         }
1658         ANGLE_CAPTURE(GetProgramPipelineInfoLog, isCallValid, context, pipelinePacked, bufSize,
1659                       length, infoLog);
1660     }
1661     else
1662     {
1663         GenerateContextLostErrorOnCurrentGlobalContext();
1664     }
1665 }
1666 
GL_GetProgramPipelineiv(GLuint pipeline,GLenum pname,GLint * params)1667 void GL_APIENTRY GL_GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
1668 {
1669     Context *context = GetValidGlobalContext();
1670     EVENT(context, GLGetProgramPipelineiv,
1671           "context = %d, pipeline = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
1672           pipeline, GLenumToString(GLenumGroup::PipelineParameterName, pname), (uintptr_t)params);
1673 
1674     if (context)
1675     {
1676         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
1677         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1678         bool isCallValid =
1679             (context->skipValidation() ||
1680              ValidateGetProgramPipelineiv(context, angle::EntryPoint::GLGetProgramPipelineiv,
1681                                           pipelinePacked, pname, params));
1682         if (isCallValid)
1683         {
1684             context->getProgramPipelineiv(pipelinePacked, pname, params);
1685         }
1686         ANGLE_CAPTURE(GetProgramPipelineiv, isCallValid, context, pipelinePacked, pname, params);
1687     }
1688     else
1689     {
1690         GenerateContextLostErrorOnCurrentGlobalContext();
1691     }
1692 }
1693 
GL_GetShaderPrecisionFormat(GLenum shadertype,GLenum precisiontype,GLint * range,GLint * precision)1694 void GL_APIENTRY GL_GetShaderPrecisionFormat(GLenum shadertype,
1695                                              GLenum precisiontype,
1696                                              GLint *range,
1697                                              GLint *precision)
1698 {
1699     Context *context = GetValidGlobalContext();
1700     EVENT(context, GLGetShaderPrecisionFormat,
1701           "context = %d, shadertype = %s, precisiontype = %s, range = 0x%016" PRIxPTR
1702           ", precision = 0x%016" PRIxPTR "",
1703           CID(context), GLenumToString(GLenumGroup::ShaderType, shadertype),
1704           GLenumToString(GLenumGroup::PrecisionType, precisiontype), (uintptr_t)range,
1705           (uintptr_t)precision);
1706 
1707     if (context)
1708     {
1709         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1710         bool isCallValid                                      = (context->skipValidation() ||
1711                             ValidateGetShaderPrecisionFormat(
1712                                 context, angle::EntryPoint::GLGetShaderPrecisionFormat, shadertype,
1713                                 precisiontype, range, precision));
1714         if (isCallValid)
1715         {
1716             context->getShaderPrecisionFormat(shadertype, precisiontype, range, precision);
1717         }
1718         ANGLE_CAPTURE(GetShaderPrecisionFormat, isCallValid, context, shadertype, precisiontype,
1719                       range, precision);
1720     }
1721     else
1722     {
1723         GenerateContextLostErrorOnCurrentGlobalContext();
1724     }
1725 }
1726 
GL_GetVertexAttribLdv(GLuint index,GLenum pname,GLdouble * params)1727 void GL_APIENTRY GL_GetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params)
1728 {
1729     Context *context = GetValidGlobalContext();
1730     EVENT(context, GLGetVertexAttribLdv,
1731           "context = %d, index = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), index,
1732           GLenumToString(GLenumGroup::VertexAttribEnum, pname), (uintptr_t)params);
1733 
1734     if (context)
1735     {
1736         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1737         bool isCallValid =
1738             (context->skipValidation() ||
1739              ValidateGetVertexAttribLdv(context, angle::EntryPoint::GLGetVertexAttribLdv, index,
1740                                         pname, params));
1741         if (isCallValid)
1742         {
1743             context->getVertexAttribLdv(index, pname, params);
1744         }
1745         ANGLE_CAPTURE(GetVertexAttribLdv, isCallValid, context, index, pname, params);
1746     }
1747     else
1748     {
1749         GenerateContextLostErrorOnCurrentGlobalContext();
1750     }
1751 }
1752 
GL_IsProgramPipeline(GLuint pipeline)1753 GLboolean GL_APIENTRY GL_IsProgramPipeline(GLuint pipeline)
1754 {
1755     Context *context = GetValidGlobalContext();
1756     EVENT(context, GLIsProgramPipeline, "context = %d, pipeline = %u", CID(context), pipeline);
1757 
1758     GLboolean returnValue;
1759     if (context)
1760     {
1761         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
1762         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1763         bool isCallValid                                      = (context->skipValidation() ||
1764                             ValidateIsProgramPipeline(
1765                                 context, angle::EntryPoint::GLIsProgramPipeline, pipelinePacked));
1766         if (isCallValid)
1767         {
1768             returnValue = context->isProgramPipeline(pipelinePacked);
1769         }
1770         else
1771         {
1772             returnValue =
1773                 GetDefaultReturnValue<angle::EntryPoint::GLIsProgramPipeline, GLboolean>();
1774         }
1775         ANGLE_CAPTURE(IsProgramPipeline, isCallValid, context, pipelinePacked, returnValue);
1776     }
1777     else
1778     {
1779         GenerateContextLostErrorOnCurrentGlobalContext();
1780         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsProgramPipeline, GLboolean>();
1781     }
1782     return returnValue;
1783 }
1784 
GL_ProgramBinary(GLuint program,GLenum binaryFormat,const void * binary,GLsizei length)1785 void GL_APIENTRY GL_ProgramBinary(GLuint program,
1786                                   GLenum binaryFormat,
1787                                   const void *binary,
1788                                   GLsizei length)
1789 {
1790     Context *context = GetValidGlobalContext();
1791     EVENT(context, GLProgramBinary,
1792           "context = %d, program = %u, binaryFormat = %s, binary = 0x%016" PRIxPTR ", length = %d",
1793           CID(context), program, GLenumToString(GLenumGroup::DefaultGroup, binaryFormat),
1794           (uintptr_t)binary, length);
1795 
1796     if (context)
1797     {
1798         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
1799         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1800         bool isCallValid                                      = (context->skipValidation() ||
1801                             ValidateProgramBinary(context, angle::EntryPoint::GLProgramBinary,
1802                                                   programPacked, binaryFormat, binary, length));
1803         if (isCallValid)
1804         {
1805             context->programBinary(programPacked, binaryFormat, binary, length);
1806         }
1807         ANGLE_CAPTURE(ProgramBinary, isCallValid, context, programPacked, binaryFormat, binary,
1808                       length);
1809     }
1810     else
1811     {
1812         GenerateContextLostErrorOnCurrentGlobalContext();
1813     }
1814 }
1815 
GL_ProgramParameteri(GLuint program,GLenum pname,GLint value)1816 void GL_APIENTRY GL_ProgramParameteri(GLuint program, GLenum pname, GLint value)
1817 {
1818     Context *context = GetValidGlobalContext();
1819     EVENT(context, GLProgramParameteri, "context = %d, program = %u, pname = %s, value = %d",
1820           CID(context), program, GLenumToString(GLenumGroup::ProgramParameterPName, pname), value);
1821 
1822     if (context)
1823     {
1824         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
1825         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1826         bool isCallValid =
1827             (context->skipValidation() ||
1828              ValidateProgramParameteri(context, angle::EntryPoint::GLProgramParameteri,
1829                                        programPacked, pname, value));
1830         if (isCallValid)
1831         {
1832             context->programParameteri(programPacked, pname, value);
1833         }
1834         ANGLE_CAPTURE(ProgramParameteri, isCallValid, context, programPacked, pname, value);
1835     }
1836     else
1837     {
1838         GenerateContextLostErrorOnCurrentGlobalContext();
1839     }
1840 }
1841 
GL_ProgramUniform1d(GLuint program,GLint location,GLdouble v0)1842 void GL_APIENTRY GL_ProgramUniform1d(GLuint program, GLint location, GLdouble v0)
1843 {
1844     Context *context = GetValidGlobalContext();
1845     EVENT(context, GLProgramUniform1d, "context = %d, program = %u, location = %d, v0 = %f",
1846           CID(context), program, location, v0);
1847 
1848     if (context)
1849     {
1850         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1851         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1852         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1853         bool isCallValid                                      = (context->skipValidation() ||
1854                             ValidateProgramUniform1d(context, angle::EntryPoint::GLProgramUniform1d,
1855                                                      programPacked, locationPacked, v0));
1856         if (isCallValid)
1857         {
1858             context->programUniform1d(programPacked, locationPacked, v0);
1859         }
1860         ANGLE_CAPTURE(ProgramUniform1d, isCallValid, context, programPacked, locationPacked, v0);
1861     }
1862     else
1863     {
1864         GenerateContextLostErrorOnCurrentGlobalContext();
1865     }
1866 }
1867 
GL_ProgramUniform1dv(GLuint program,GLint location,GLsizei count,const GLdouble * value)1868 void GL_APIENTRY GL_ProgramUniform1dv(GLuint program,
1869                                       GLint location,
1870                                       GLsizei count,
1871                                       const GLdouble *value)
1872 {
1873     Context *context = GetValidGlobalContext();
1874     EVENT(context, GLProgramUniform1dv,
1875           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
1876           CID(context), program, location, count, (uintptr_t)value);
1877 
1878     if (context)
1879     {
1880         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1881         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1882         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1883         bool isCallValid =
1884             (context->skipValidation() ||
1885              ValidateProgramUniform1dv(context, angle::EntryPoint::GLProgramUniform1dv,
1886                                        programPacked, locationPacked, count, value));
1887         if (isCallValid)
1888         {
1889             context->programUniform1dv(programPacked, locationPacked, count, value);
1890         }
1891         ANGLE_CAPTURE(ProgramUniform1dv, isCallValid, context, programPacked, locationPacked, count,
1892                       value);
1893     }
1894     else
1895     {
1896         GenerateContextLostErrorOnCurrentGlobalContext();
1897     }
1898 }
1899 
GL_ProgramUniform1f(GLuint program,GLint location,GLfloat v0)1900 void GL_APIENTRY GL_ProgramUniform1f(GLuint program, GLint location, GLfloat v0)
1901 {
1902     Context *context = GetValidGlobalContext();
1903     EVENT(context, GLProgramUniform1f, "context = %d, program = %u, location = %d, v0 = %f",
1904           CID(context), program, location, v0);
1905 
1906     if (context)
1907     {
1908         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1909         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1910         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1911         bool isCallValid                                      = (context->skipValidation() ||
1912                             ValidateProgramUniform1f(context, angle::EntryPoint::GLProgramUniform1f,
1913                                                      programPacked, locationPacked, v0));
1914         if (isCallValid)
1915         {
1916             context->programUniform1f(programPacked, locationPacked, v0);
1917         }
1918         ANGLE_CAPTURE(ProgramUniform1f, isCallValid, context, programPacked, locationPacked, v0);
1919     }
1920     else
1921     {
1922         GenerateContextLostErrorOnCurrentGlobalContext();
1923     }
1924 }
1925 
GL_ProgramUniform1fv(GLuint program,GLint location,GLsizei count,const GLfloat * value)1926 void GL_APIENTRY GL_ProgramUniform1fv(GLuint program,
1927                                       GLint location,
1928                                       GLsizei count,
1929                                       const GLfloat *value)
1930 {
1931     Context *context = GetValidGlobalContext();
1932     EVENT(context, GLProgramUniform1fv,
1933           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
1934           CID(context), program, location, count, (uintptr_t)value);
1935 
1936     if (context)
1937     {
1938         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1939         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1940         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1941         bool isCallValid =
1942             (context->skipValidation() ||
1943              ValidateProgramUniform1fv(context, angle::EntryPoint::GLProgramUniform1fv,
1944                                        programPacked, locationPacked, count, value));
1945         if (isCallValid)
1946         {
1947             context->programUniform1fv(programPacked, locationPacked, count, value);
1948         }
1949         ANGLE_CAPTURE(ProgramUniform1fv, isCallValid, context, programPacked, locationPacked, count,
1950                       value);
1951     }
1952     else
1953     {
1954         GenerateContextLostErrorOnCurrentGlobalContext();
1955     }
1956 }
1957 
GL_ProgramUniform1i(GLuint program,GLint location,GLint v0)1958 void GL_APIENTRY GL_ProgramUniform1i(GLuint program, GLint location, GLint v0)
1959 {
1960     Context *context = GetValidGlobalContext();
1961     EVENT(context, GLProgramUniform1i, "context = %d, program = %u, location = %d, v0 = %d",
1962           CID(context), program, location, v0);
1963 
1964     if (context)
1965     {
1966         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1967         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1968         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1969         bool isCallValid                                      = (context->skipValidation() ||
1970                             ValidateProgramUniform1i(context, angle::EntryPoint::GLProgramUniform1i,
1971                                                      programPacked, locationPacked, v0));
1972         if (isCallValid)
1973         {
1974             context->programUniform1i(programPacked, locationPacked, v0);
1975         }
1976         ANGLE_CAPTURE(ProgramUniform1i, isCallValid, context, programPacked, locationPacked, v0);
1977     }
1978     else
1979     {
1980         GenerateContextLostErrorOnCurrentGlobalContext();
1981     }
1982 }
1983 
GL_ProgramUniform1iv(GLuint program,GLint location,GLsizei count,const GLint * value)1984 void GL_APIENTRY GL_ProgramUniform1iv(GLuint program,
1985                                       GLint location,
1986                                       GLsizei count,
1987                                       const GLint *value)
1988 {
1989     Context *context = GetValidGlobalContext();
1990     EVENT(context, GLProgramUniform1iv,
1991           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
1992           CID(context), program, location, count, (uintptr_t)value);
1993 
1994     if (context)
1995     {
1996         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1997         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1998         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1999         bool isCallValid =
2000             (context->skipValidation() ||
2001              ValidateProgramUniform1iv(context, angle::EntryPoint::GLProgramUniform1iv,
2002                                        programPacked, locationPacked, count, value));
2003         if (isCallValid)
2004         {
2005             context->programUniform1iv(programPacked, locationPacked, count, value);
2006         }
2007         ANGLE_CAPTURE(ProgramUniform1iv, isCallValid, context, programPacked, locationPacked, count,
2008                       value);
2009     }
2010     else
2011     {
2012         GenerateContextLostErrorOnCurrentGlobalContext();
2013     }
2014 }
2015 
GL_ProgramUniform1ui(GLuint program,GLint location,GLuint v0)2016 void GL_APIENTRY GL_ProgramUniform1ui(GLuint program, GLint location, GLuint v0)
2017 {
2018     Context *context = GetValidGlobalContext();
2019     EVENT(context, GLProgramUniform1ui, "context = %d, program = %u, location = %d, v0 = %u",
2020           CID(context), program, location, v0);
2021 
2022     if (context)
2023     {
2024         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2025         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2026         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2027         bool isCallValid =
2028             (context->skipValidation() ||
2029              ValidateProgramUniform1ui(context, angle::EntryPoint::GLProgramUniform1ui,
2030                                        programPacked, locationPacked, v0));
2031         if (isCallValid)
2032         {
2033             context->programUniform1ui(programPacked, locationPacked, v0);
2034         }
2035         ANGLE_CAPTURE(ProgramUniform1ui, isCallValid, context, programPacked, locationPacked, v0);
2036     }
2037     else
2038     {
2039         GenerateContextLostErrorOnCurrentGlobalContext();
2040     }
2041 }
2042 
GL_ProgramUniform1uiv(GLuint program,GLint location,GLsizei count,const GLuint * value)2043 void GL_APIENTRY GL_ProgramUniform1uiv(GLuint program,
2044                                        GLint location,
2045                                        GLsizei count,
2046                                        const GLuint *value)
2047 {
2048     Context *context = GetValidGlobalContext();
2049     EVENT(context, GLProgramUniform1uiv,
2050           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
2051           CID(context), program, location, count, (uintptr_t)value);
2052 
2053     if (context)
2054     {
2055         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2056         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2057         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2058         bool isCallValid =
2059             (context->skipValidation() ||
2060              ValidateProgramUniform1uiv(context, angle::EntryPoint::GLProgramUniform1uiv,
2061                                         programPacked, locationPacked, count, value));
2062         if (isCallValid)
2063         {
2064             context->programUniform1uiv(programPacked, locationPacked, count, value);
2065         }
2066         ANGLE_CAPTURE(ProgramUniform1uiv, isCallValid, context, programPacked, locationPacked,
2067                       count, value);
2068     }
2069     else
2070     {
2071         GenerateContextLostErrorOnCurrentGlobalContext();
2072     }
2073 }
2074 
GL_ProgramUniform2d(GLuint program,GLint location,GLdouble v0,GLdouble v1)2075 void GL_APIENTRY GL_ProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1)
2076 {
2077     Context *context = GetValidGlobalContext();
2078     EVENT(context, GLProgramUniform2d,
2079           "context = %d, program = %u, location = %d, v0 = %f, v1 = %f", CID(context), program,
2080           location, v0, v1);
2081 
2082     if (context)
2083     {
2084         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2085         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2086         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2087         bool isCallValid                                      = (context->skipValidation() ||
2088                             ValidateProgramUniform2d(context, angle::EntryPoint::GLProgramUniform2d,
2089                                                      programPacked, locationPacked, v0, v1));
2090         if (isCallValid)
2091         {
2092             context->programUniform2d(programPacked, locationPacked, v0, v1);
2093         }
2094         ANGLE_CAPTURE(ProgramUniform2d, isCallValid, context, programPacked, locationPacked, v0,
2095                       v1);
2096     }
2097     else
2098     {
2099         GenerateContextLostErrorOnCurrentGlobalContext();
2100     }
2101 }
2102 
GL_ProgramUniform2dv(GLuint program,GLint location,GLsizei count,const GLdouble * value)2103 void GL_APIENTRY GL_ProgramUniform2dv(GLuint program,
2104                                       GLint location,
2105                                       GLsizei count,
2106                                       const GLdouble *value)
2107 {
2108     Context *context = GetValidGlobalContext();
2109     EVENT(context, GLProgramUniform2dv,
2110           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
2111           CID(context), program, location, count, (uintptr_t)value);
2112 
2113     if (context)
2114     {
2115         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2116         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2117         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2118         bool isCallValid =
2119             (context->skipValidation() ||
2120              ValidateProgramUniform2dv(context, angle::EntryPoint::GLProgramUniform2dv,
2121                                        programPacked, locationPacked, count, value));
2122         if (isCallValid)
2123         {
2124             context->programUniform2dv(programPacked, locationPacked, count, value);
2125         }
2126         ANGLE_CAPTURE(ProgramUniform2dv, isCallValid, context, programPacked, locationPacked, count,
2127                       value);
2128     }
2129     else
2130     {
2131         GenerateContextLostErrorOnCurrentGlobalContext();
2132     }
2133 }
2134 
GL_ProgramUniform2f(GLuint program,GLint location,GLfloat v0,GLfloat v1)2135 void GL_APIENTRY GL_ProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
2136 {
2137     Context *context = GetValidGlobalContext();
2138     EVENT(context, GLProgramUniform2f,
2139           "context = %d, program = %u, location = %d, v0 = %f, v1 = %f", CID(context), program,
2140           location, v0, v1);
2141 
2142     if (context)
2143     {
2144         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2145         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2146         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2147         bool isCallValid                                      = (context->skipValidation() ||
2148                             ValidateProgramUniform2f(context, angle::EntryPoint::GLProgramUniform2f,
2149                                                      programPacked, locationPacked, v0, v1));
2150         if (isCallValid)
2151         {
2152             context->programUniform2f(programPacked, locationPacked, v0, v1);
2153         }
2154         ANGLE_CAPTURE(ProgramUniform2f, isCallValid, context, programPacked, locationPacked, v0,
2155                       v1);
2156     }
2157     else
2158     {
2159         GenerateContextLostErrorOnCurrentGlobalContext();
2160     }
2161 }
2162 
GL_ProgramUniform2fv(GLuint program,GLint location,GLsizei count,const GLfloat * value)2163 void GL_APIENTRY GL_ProgramUniform2fv(GLuint program,
2164                                       GLint location,
2165                                       GLsizei count,
2166                                       const GLfloat *value)
2167 {
2168     Context *context = GetValidGlobalContext();
2169     EVENT(context, GLProgramUniform2fv,
2170           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
2171           CID(context), program, location, count, (uintptr_t)value);
2172 
2173     if (context)
2174     {
2175         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2176         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2177         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2178         bool isCallValid =
2179             (context->skipValidation() ||
2180              ValidateProgramUniform2fv(context, angle::EntryPoint::GLProgramUniform2fv,
2181                                        programPacked, locationPacked, count, value));
2182         if (isCallValid)
2183         {
2184             context->programUniform2fv(programPacked, locationPacked, count, value);
2185         }
2186         ANGLE_CAPTURE(ProgramUniform2fv, isCallValid, context, programPacked, locationPacked, count,
2187                       value);
2188     }
2189     else
2190     {
2191         GenerateContextLostErrorOnCurrentGlobalContext();
2192     }
2193 }
2194 
GL_ProgramUniform2i(GLuint program,GLint location,GLint v0,GLint v1)2195 void GL_APIENTRY GL_ProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
2196 {
2197     Context *context = GetValidGlobalContext();
2198     EVENT(context, GLProgramUniform2i,
2199           "context = %d, program = %u, location = %d, v0 = %d, v1 = %d", CID(context), program,
2200           location, v0, v1);
2201 
2202     if (context)
2203     {
2204         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2205         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2206         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2207         bool isCallValid                                      = (context->skipValidation() ||
2208                             ValidateProgramUniform2i(context, angle::EntryPoint::GLProgramUniform2i,
2209                                                      programPacked, locationPacked, v0, v1));
2210         if (isCallValid)
2211         {
2212             context->programUniform2i(programPacked, locationPacked, v0, v1);
2213         }
2214         ANGLE_CAPTURE(ProgramUniform2i, isCallValid, context, programPacked, locationPacked, v0,
2215                       v1);
2216     }
2217     else
2218     {
2219         GenerateContextLostErrorOnCurrentGlobalContext();
2220     }
2221 }
2222 
GL_ProgramUniform2iv(GLuint program,GLint location,GLsizei count,const GLint * value)2223 void GL_APIENTRY GL_ProgramUniform2iv(GLuint program,
2224                                       GLint location,
2225                                       GLsizei count,
2226                                       const GLint *value)
2227 {
2228     Context *context = GetValidGlobalContext();
2229     EVENT(context, GLProgramUniform2iv,
2230           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
2231           CID(context), program, location, count, (uintptr_t)value);
2232 
2233     if (context)
2234     {
2235         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2236         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2237         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2238         bool isCallValid =
2239             (context->skipValidation() ||
2240              ValidateProgramUniform2iv(context, angle::EntryPoint::GLProgramUniform2iv,
2241                                        programPacked, locationPacked, count, value));
2242         if (isCallValid)
2243         {
2244             context->programUniform2iv(programPacked, locationPacked, count, value);
2245         }
2246         ANGLE_CAPTURE(ProgramUniform2iv, isCallValid, context, programPacked, locationPacked, count,
2247                       value);
2248     }
2249     else
2250     {
2251         GenerateContextLostErrorOnCurrentGlobalContext();
2252     }
2253 }
2254 
GL_ProgramUniform2ui(GLuint program,GLint location,GLuint v0,GLuint v1)2255 void GL_APIENTRY GL_ProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
2256 {
2257     Context *context = GetValidGlobalContext();
2258     EVENT(context, GLProgramUniform2ui,
2259           "context = %d, program = %u, location = %d, v0 = %u, v1 = %u", CID(context), program,
2260           location, v0, v1);
2261 
2262     if (context)
2263     {
2264         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2265         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2266         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2267         bool isCallValid =
2268             (context->skipValidation() ||
2269              ValidateProgramUniform2ui(context, angle::EntryPoint::GLProgramUniform2ui,
2270                                        programPacked, locationPacked, v0, v1));
2271         if (isCallValid)
2272         {
2273             context->programUniform2ui(programPacked, locationPacked, v0, v1);
2274         }
2275         ANGLE_CAPTURE(ProgramUniform2ui, isCallValid, context, programPacked, locationPacked, v0,
2276                       v1);
2277     }
2278     else
2279     {
2280         GenerateContextLostErrorOnCurrentGlobalContext();
2281     }
2282 }
2283 
GL_ProgramUniform2uiv(GLuint program,GLint location,GLsizei count,const GLuint * value)2284 void GL_APIENTRY GL_ProgramUniform2uiv(GLuint program,
2285                                        GLint location,
2286                                        GLsizei count,
2287                                        const GLuint *value)
2288 {
2289     Context *context = GetValidGlobalContext();
2290     EVENT(context, GLProgramUniform2uiv,
2291           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
2292           CID(context), program, location, count, (uintptr_t)value);
2293 
2294     if (context)
2295     {
2296         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2297         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2298         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2299         bool isCallValid =
2300             (context->skipValidation() ||
2301              ValidateProgramUniform2uiv(context, angle::EntryPoint::GLProgramUniform2uiv,
2302                                         programPacked, locationPacked, count, value));
2303         if (isCallValid)
2304         {
2305             context->programUniform2uiv(programPacked, locationPacked, count, value);
2306         }
2307         ANGLE_CAPTURE(ProgramUniform2uiv, isCallValid, context, programPacked, locationPacked,
2308                       count, value);
2309     }
2310     else
2311     {
2312         GenerateContextLostErrorOnCurrentGlobalContext();
2313     }
2314 }
2315 
2316 void GL_APIENTRY
GL_ProgramUniform3d(GLuint program,GLint location,GLdouble v0,GLdouble v1,GLdouble v2)2317 GL_ProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2)
2318 {
2319     Context *context = GetValidGlobalContext();
2320     EVENT(context, GLProgramUniform3d,
2321           "context = %d, program = %u, location = %d, v0 = %f, v1 = %f, v2 = %f", CID(context),
2322           program, location, v0, v1, v2);
2323 
2324     if (context)
2325     {
2326         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2327         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2328         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2329         bool isCallValid                                      = (context->skipValidation() ||
2330                             ValidateProgramUniform3d(context, angle::EntryPoint::GLProgramUniform3d,
2331                                                      programPacked, locationPacked, v0, v1, v2));
2332         if (isCallValid)
2333         {
2334             context->programUniform3d(programPacked, locationPacked, v0, v1, v2);
2335         }
2336         ANGLE_CAPTURE(ProgramUniform3d, isCallValid, context, programPacked, locationPacked, v0, v1,
2337                       v2);
2338     }
2339     else
2340     {
2341         GenerateContextLostErrorOnCurrentGlobalContext();
2342     }
2343 }
2344 
GL_ProgramUniform3dv(GLuint program,GLint location,GLsizei count,const GLdouble * value)2345 void GL_APIENTRY GL_ProgramUniform3dv(GLuint program,
2346                                       GLint location,
2347                                       GLsizei count,
2348                                       const GLdouble *value)
2349 {
2350     Context *context = GetValidGlobalContext();
2351     EVENT(context, GLProgramUniform3dv,
2352           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
2353           CID(context), program, location, count, (uintptr_t)value);
2354 
2355     if (context)
2356     {
2357         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2358         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2359         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2360         bool isCallValid =
2361             (context->skipValidation() ||
2362              ValidateProgramUniform3dv(context, angle::EntryPoint::GLProgramUniform3dv,
2363                                        programPacked, locationPacked, count, value));
2364         if (isCallValid)
2365         {
2366             context->programUniform3dv(programPacked, locationPacked, count, value);
2367         }
2368         ANGLE_CAPTURE(ProgramUniform3dv, isCallValid, context, programPacked, locationPacked, count,
2369                       value);
2370     }
2371     else
2372     {
2373         GenerateContextLostErrorOnCurrentGlobalContext();
2374     }
2375 }
2376 
2377 void GL_APIENTRY
GL_ProgramUniform3f(GLuint program,GLint location,GLfloat v0,GLfloat v1,GLfloat v2)2378 GL_ProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
2379 {
2380     Context *context = GetValidGlobalContext();
2381     EVENT(context, GLProgramUniform3f,
2382           "context = %d, program = %u, location = %d, v0 = %f, v1 = %f, v2 = %f", CID(context),
2383           program, location, v0, v1, v2);
2384 
2385     if (context)
2386     {
2387         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2388         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2389         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2390         bool isCallValid                                      = (context->skipValidation() ||
2391                             ValidateProgramUniform3f(context, angle::EntryPoint::GLProgramUniform3f,
2392                                                      programPacked, locationPacked, v0, v1, v2));
2393         if (isCallValid)
2394         {
2395             context->programUniform3f(programPacked, locationPacked, v0, v1, v2);
2396         }
2397         ANGLE_CAPTURE(ProgramUniform3f, isCallValid, context, programPacked, locationPacked, v0, v1,
2398                       v2);
2399     }
2400     else
2401     {
2402         GenerateContextLostErrorOnCurrentGlobalContext();
2403     }
2404 }
2405 
GL_ProgramUniform3fv(GLuint program,GLint location,GLsizei count,const GLfloat * value)2406 void GL_APIENTRY GL_ProgramUniform3fv(GLuint program,
2407                                       GLint location,
2408                                       GLsizei count,
2409                                       const GLfloat *value)
2410 {
2411     Context *context = GetValidGlobalContext();
2412     EVENT(context, GLProgramUniform3fv,
2413           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
2414           CID(context), program, location, count, (uintptr_t)value);
2415 
2416     if (context)
2417     {
2418         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2419         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2420         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2421         bool isCallValid =
2422             (context->skipValidation() ||
2423              ValidateProgramUniform3fv(context, angle::EntryPoint::GLProgramUniform3fv,
2424                                        programPacked, locationPacked, count, value));
2425         if (isCallValid)
2426         {
2427             context->programUniform3fv(programPacked, locationPacked, count, value);
2428         }
2429         ANGLE_CAPTURE(ProgramUniform3fv, isCallValid, context, programPacked, locationPacked, count,
2430                       value);
2431     }
2432     else
2433     {
2434         GenerateContextLostErrorOnCurrentGlobalContext();
2435     }
2436 }
2437 
GL_ProgramUniform3i(GLuint program,GLint location,GLint v0,GLint v1,GLint v2)2438 void GL_APIENTRY GL_ProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
2439 {
2440     Context *context = GetValidGlobalContext();
2441     EVENT(context, GLProgramUniform3i,
2442           "context = %d, program = %u, location = %d, v0 = %d, v1 = %d, v2 = %d", CID(context),
2443           program, location, v0, v1, v2);
2444 
2445     if (context)
2446     {
2447         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2448         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2449         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2450         bool isCallValid                                      = (context->skipValidation() ||
2451                             ValidateProgramUniform3i(context, angle::EntryPoint::GLProgramUniform3i,
2452                                                      programPacked, locationPacked, v0, v1, v2));
2453         if (isCallValid)
2454         {
2455             context->programUniform3i(programPacked, locationPacked, v0, v1, v2);
2456         }
2457         ANGLE_CAPTURE(ProgramUniform3i, isCallValid, context, programPacked, locationPacked, v0, v1,
2458                       v2);
2459     }
2460     else
2461     {
2462         GenerateContextLostErrorOnCurrentGlobalContext();
2463     }
2464 }
2465 
GL_ProgramUniform3iv(GLuint program,GLint location,GLsizei count,const GLint * value)2466 void GL_APIENTRY GL_ProgramUniform3iv(GLuint program,
2467                                       GLint location,
2468                                       GLsizei count,
2469                                       const GLint *value)
2470 {
2471     Context *context = GetValidGlobalContext();
2472     EVENT(context, GLProgramUniform3iv,
2473           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
2474           CID(context), program, location, count, (uintptr_t)value);
2475 
2476     if (context)
2477     {
2478         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2479         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2480         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2481         bool isCallValid =
2482             (context->skipValidation() ||
2483              ValidateProgramUniform3iv(context, angle::EntryPoint::GLProgramUniform3iv,
2484                                        programPacked, locationPacked, count, value));
2485         if (isCallValid)
2486         {
2487             context->programUniform3iv(programPacked, locationPacked, count, value);
2488         }
2489         ANGLE_CAPTURE(ProgramUniform3iv, isCallValid, context, programPacked, locationPacked, count,
2490                       value);
2491     }
2492     else
2493     {
2494         GenerateContextLostErrorOnCurrentGlobalContext();
2495     }
2496 }
2497 
2498 void GL_APIENTRY
GL_ProgramUniform3ui(GLuint program,GLint location,GLuint v0,GLuint v1,GLuint v2)2499 GL_ProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)
2500 {
2501     Context *context = GetValidGlobalContext();
2502     EVENT(context, GLProgramUniform3ui,
2503           "context = %d, program = %u, location = %d, v0 = %u, v1 = %u, v2 = %u", CID(context),
2504           program, location, v0, v1, v2);
2505 
2506     if (context)
2507     {
2508         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2509         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2510         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2511         bool isCallValid =
2512             (context->skipValidation() ||
2513              ValidateProgramUniform3ui(context, angle::EntryPoint::GLProgramUniform3ui,
2514                                        programPacked, locationPacked, v0, v1, v2));
2515         if (isCallValid)
2516         {
2517             context->programUniform3ui(programPacked, locationPacked, v0, v1, v2);
2518         }
2519         ANGLE_CAPTURE(ProgramUniform3ui, isCallValid, context, programPacked, locationPacked, v0,
2520                       v1, v2);
2521     }
2522     else
2523     {
2524         GenerateContextLostErrorOnCurrentGlobalContext();
2525     }
2526 }
2527 
GL_ProgramUniform3uiv(GLuint program,GLint location,GLsizei count,const GLuint * value)2528 void GL_APIENTRY GL_ProgramUniform3uiv(GLuint program,
2529                                        GLint location,
2530                                        GLsizei count,
2531                                        const GLuint *value)
2532 {
2533     Context *context = GetValidGlobalContext();
2534     EVENT(context, GLProgramUniform3uiv,
2535           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
2536           CID(context), program, location, count, (uintptr_t)value);
2537 
2538     if (context)
2539     {
2540         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2541         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2542         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2543         bool isCallValid =
2544             (context->skipValidation() ||
2545              ValidateProgramUniform3uiv(context, angle::EntryPoint::GLProgramUniform3uiv,
2546                                         programPacked, locationPacked, count, value));
2547         if (isCallValid)
2548         {
2549             context->programUniform3uiv(programPacked, locationPacked, count, value);
2550         }
2551         ANGLE_CAPTURE(ProgramUniform3uiv, isCallValid, context, programPacked, locationPacked,
2552                       count, value);
2553     }
2554     else
2555     {
2556         GenerateContextLostErrorOnCurrentGlobalContext();
2557     }
2558 }
2559 
GL_ProgramUniform4d(GLuint program,GLint location,GLdouble v0,GLdouble v1,GLdouble v2,GLdouble v3)2560 void GL_APIENTRY GL_ProgramUniform4d(GLuint program,
2561                                      GLint location,
2562                                      GLdouble v0,
2563                                      GLdouble v1,
2564                                      GLdouble v2,
2565                                      GLdouble v3)
2566 {
2567     Context *context = GetValidGlobalContext();
2568     EVENT(context, GLProgramUniform4d,
2569           "context = %d, program = %u, location = %d, v0 = %f, v1 = %f, v2 = %f, v3 = %f",
2570           CID(context), program, location, v0, v1, v2, v3);
2571 
2572     if (context)
2573     {
2574         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2575         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2576         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2577         bool isCallValid =
2578             (context->skipValidation() ||
2579              ValidateProgramUniform4d(context, angle::EntryPoint::GLProgramUniform4d, programPacked,
2580                                       locationPacked, v0, v1, v2, v3));
2581         if (isCallValid)
2582         {
2583             context->programUniform4d(programPacked, locationPacked, v0, v1, v2, v3);
2584         }
2585         ANGLE_CAPTURE(ProgramUniform4d, isCallValid, context, programPacked, locationPacked, v0, v1,
2586                       v2, v3);
2587     }
2588     else
2589     {
2590         GenerateContextLostErrorOnCurrentGlobalContext();
2591     }
2592 }
2593 
GL_ProgramUniform4dv(GLuint program,GLint location,GLsizei count,const GLdouble * value)2594 void GL_APIENTRY GL_ProgramUniform4dv(GLuint program,
2595                                       GLint location,
2596                                       GLsizei count,
2597                                       const GLdouble *value)
2598 {
2599     Context *context = GetValidGlobalContext();
2600     EVENT(context, GLProgramUniform4dv,
2601           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
2602           CID(context), program, location, count, (uintptr_t)value);
2603 
2604     if (context)
2605     {
2606         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2607         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2608         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2609         bool isCallValid =
2610             (context->skipValidation() ||
2611              ValidateProgramUniform4dv(context, angle::EntryPoint::GLProgramUniform4dv,
2612                                        programPacked, locationPacked, count, value));
2613         if (isCallValid)
2614         {
2615             context->programUniform4dv(programPacked, locationPacked, count, value);
2616         }
2617         ANGLE_CAPTURE(ProgramUniform4dv, isCallValid, context, programPacked, locationPacked, count,
2618                       value);
2619     }
2620     else
2621     {
2622         GenerateContextLostErrorOnCurrentGlobalContext();
2623     }
2624 }
2625 
2626 void GL_APIENTRY
GL_ProgramUniform4f(GLuint program,GLint location,GLfloat v0,GLfloat v1,GLfloat v2,GLfloat v3)2627 GL_ProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
2628 {
2629     Context *context = GetValidGlobalContext();
2630     EVENT(context, GLProgramUniform4f,
2631           "context = %d, program = %u, location = %d, v0 = %f, v1 = %f, v2 = %f, v3 = %f",
2632           CID(context), program, location, v0, v1, v2, v3);
2633 
2634     if (context)
2635     {
2636         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2637         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2638         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2639         bool isCallValid =
2640             (context->skipValidation() ||
2641              ValidateProgramUniform4f(context, angle::EntryPoint::GLProgramUniform4f, programPacked,
2642                                       locationPacked, v0, v1, v2, v3));
2643         if (isCallValid)
2644         {
2645             context->programUniform4f(programPacked, locationPacked, v0, v1, v2, v3);
2646         }
2647         ANGLE_CAPTURE(ProgramUniform4f, isCallValid, context, programPacked, locationPacked, v0, v1,
2648                       v2, v3);
2649     }
2650     else
2651     {
2652         GenerateContextLostErrorOnCurrentGlobalContext();
2653     }
2654 }
2655 
GL_ProgramUniform4fv(GLuint program,GLint location,GLsizei count,const GLfloat * value)2656 void GL_APIENTRY GL_ProgramUniform4fv(GLuint program,
2657                                       GLint location,
2658                                       GLsizei count,
2659                                       const GLfloat *value)
2660 {
2661     Context *context = GetValidGlobalContext();
2662     EVENT(context, GLProgramUniform4fv,
2663           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
2664           CID(context), program, location, count, (uintptr_t)value);
2665 
2666     if (context)
2667     {
2668         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2669         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2670         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2671         bool isCallValid =
2672             (context->skipValidation() ||
2673              ValidateProgramUniform4fv(context, angle::EntryPoint::GLProgramUniform4fv,
2674                                        programPacked, locationPacked, count, value));
2675         if (isCallValid)
2676         {
2677             context->programUniform4fv(programPacked, locationPacked, count, value);
2678         }
2679         ANGLE_CAPTURE(ProgramUniform4fv, isCallValid, context, programPacked, locationPacked, count,
2680                       value);
2681     }
2682     else
2683     {
2684         GenerateContextLostErrorOnCurrentGlobalContext();
2685     }
2686 }
2687 
2688 void GL_APIENTRY
GL_ProgramUniform4i(GLuint program,GLint location,GLint v0,GLint v1,GLint v2,GLint v3)2689 GL_ProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
2690 {
2691     Context *context = GetValidGlobalContext();
2692     EVENT(context, GLProgramUniform4i,
2693           "context = %d, program = %u, location = %d, v0 = %d, v1 = %d, v2 = %d, v3 = %d",
2694           CID(context), program, location, v0, v1, v2, v3);
2695 
2696     if (context)
2697     {
2698         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2699         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2700         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2701         bool isCallValid =
2702             (context->skipValidation() ||
2703              ValidateProgramUniform4i(context, angle::EntryPoint::GLProgramUniform4i, programPacked,
2704                                       locationPacked, v0, v1, v2, v3));
2705         if (isCallValid)
2706         {
2707             context->programUniform4i(programPacked, locationPacked, v0, v1, v2, v3);
2708         }
2709         ANGLE_CAPTURE(ProgramUniform4i, isCallValid, context, programPacked, locationPacked, v0, v1,
2710                       v2, v3);
2711     }
2712     else
2713     {
2714         GenerateContextLostErrorOnCurrentGlobalContext();
2715     }
2716 }
2717 
GL_ProgramUniform4iv(GLuint program,GLint location,GLsizei count,const GLint * value)2718 void GL_APIENTRY GL_ProgramUniform4iv(GLuint program,
2719                                       GLint location,
2720                                       GLsizei count,
2721                                       const GLint *value)
2722 {
2723     Context *context = GetValidGlobalContext();
2724     EVENT(context, GLProgramUniform4iv,
2725           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
2726           CID(context), program, location, count, (uintptr_t)value);
2727 
2728     if (context)
2729     {
2730         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2731         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2732         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2733         bool isCallValid =
2734             (context->skipValidation() ||
2735              ValidateProgramUniform4iv(context, angle::EntryPoint::GLProgramUniform4iv,
2736                                        programPacked, locationPacked, count, value));
2737         if (isCallValid)
2738         {
2739             context->programUniform4iv(programPacked, locationPacked, count, value);
2740         }
2741         ANGLE_CAPTURE(ProgramUniform4iv, isCallValid, context, programPacked, locationPacked, count,
2742                       value);
2743     }
2744     else
2745     {
2746         GenerateContextLostErrorOnCurrentGlobalContext();
2747     }
2748 }
2749 
2750 void GL_APIENTRY
GL_ProgramUniform4ui(GLuint program,GLint location,GLuint v0,GLuint v1,GLuint v2,GLuint v3)2751 GL_ProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
2752 {
2753     Context *context = GetValidGlobalContext();
2754     EVENT(context, GLProgramUniform4ui,
2755           "context = %d, program = %u, location = %d, v0 = %u, v1 = %u, v2 = %u, v3 = %u",
2756           CID(context), program, location, v0, v1, v2, v3);
2757 
2758     if (context)
2759     {
2760         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2761         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2762         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2763         bool isCallValid =
2764             (context->skipValidation() ||
2765              ValidateProgramUniform4ui(context, angle::EntryPoint::GLProgramUniform4ui,
2766                                        programPacked, locationPacked, v0, v1, v2, v3));
2767         if (isCallValid)
2768         {
2769             context->programUniform4ui(programPacked, locationPacked, v0, v1, v2, v3);
2770         }
2771         ANGLE_CAPTURE(ProgramUniform4ui, isCallValid, context, programPacked, locationPacked, v0,
2772                       v1, v2, v3);
2773     }
2774     else
2775     {
2776         GenerateContextLostErrorOnCurrentGlobalContext();
2777     }
2778 }
2779 
GL_ProgramUniform4uiv(GLuint program,GLint location,GLsizei count,const GLuint * value)2780 void GL_APIENTRY GL_ProgramUniform4uiv(GLuint program,
2781                                        GLint location,
2782                                        GLsizei count,
2783                                        const GLuint *value)
2784 {
2785     Context *context = GetValidGlobalContext();
2786     EVENT(context, GLProgramUniform4uiv,
2787           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
2788           CID(context), program, location, count, (uintptr_t)value);
2789 
2790     if (context)
2791     {
2792         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2793         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2794         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2795         bool isCallValid =
2796             (context->skipValidation() ||
2797              ValidateProgramUniform4uiv(context, angle::EntryPoint::GLProgramUniform4uiv,
2798                                         programPacked, locationPacked, count, value));
2799         if (isCallValid)
2800         {
2801             context->programUniform4uiv(programPacked, locationPacked, count, value);
2802         }
2803         ANGLE_CAPTURE(ProgramUniform4uiv, isCallValid, context, programPacked, locationPacked,
2804                       count, value);
2805     }
2806     else
2807     {
2808         GenerateContextLostErrorOnCurrentGlobalContext();
2809     }
2810 }
2811 
GL_ProgramUniformMatrix2dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)2812 void GL_APIENTRY GL_ProgramUniformMatrix2dv(GLuint program,
2813                                             GLint location,
2814                                             GLsizei count,
2815                                             GLboolean transpose,
2816                                             const GLdouble *value)
2817 {
2818     Context *context = GetValidGlobalContext();
2819     EVENT(context, GLProgramUniformMatrix2dv,
2820           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
2821           "0x%016" PRIxPTR "",
2822           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
2823 
2824     if (context)
2825     {
2826         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2827         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2828         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2829         bool isCallValid                                      = (context->skipValidation() ||
2830                             ValidateProgramUniformMatrix2dv(
2831                                 context, angle::EntryPoint::GLProgramUniformMatrix2dv,
2832                                 programPacked, locationPacked, count, transpose, value));
2833         if (isCallValid)
2834         {
2835             context->programUniformMatrix2dv(programPacked, locationPacked, count, transpose,
2836                                              value);
2837         }
2838         ANGLE_CAPTURE(ProgramUniformMatrix2dv, isCallValid, context, programPacked, locationPacked,
2839                       count, transpose, value);
2840     }
2841     else
2842     {
2843         GenerateContextLostErrorOnCurrentGlobalContext();
2844     }
2845 }
2846 
GL_ProgramUniformMatrix2fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)2847 void GL_APIENTRY GL_ProgramUniformMatrix2fv(GLuint program,
2848                                             GLint location,
2849                                             GLsizei count,
2850                                             GLboolean transpose,
2851                                             const GLfloat *value)
2852 {
2853     Context *context = GetValidGlobalContext();
2854     EVENT(context, GLProgramUniformMatrix2fv,
2855           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
2856           "0x%016" PRIxPTR "",
2857           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
2858 
2859     if (context)
2860     {
2861         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2862         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2863         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2864         bool isCallValid                                      = (context->skipValidation() ||
2865                             ValidateProgramUniformMatrix2fv(
2866                                 context, angle::EntryPoint::GLProgramUniformMatrix2fv,
2867                                 programPacked, locationPacked, count, transpose, value));
2868         if (isCallValid)
2869         {
2870             context->programUniformMatrix2fv(programPacked, locationPacked, count, transpose,
2871                                              value);
2872         }
2873         ANGLE_CAPTURE(ProgramUniformMatrix2fv, isCallValid, context, programPacked, locationPacked,
2874                       count, transpose, value);
2875     }
2876     else
2877     {
2878         GenerateContextLostErrorOnCurrentGlobalContext();
2879     }
2880 }
2881 
GL_ProgramUniformMatrix2x3dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)2882 void GL_APIENTRY GL_ProgramUniformMatrix2x3dv(GLuint program,
2883                                               GLint location,
2884                                               GLsizei count,
2885                                               GLboolean transpose,
2886                                               const GLdouble *value)
2887 {
2888     Context *context = GetValidGlobalContext();
2889     EVENT(context, GLProgramUniformMatrix2x3dv,
2890           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
2891           "0x%016" PRIxPTR "",
2892           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
2893 
2894     if (context)
2895     {
2896         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2897         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2898         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2899         bool isCallValid                                      = (context->skipValidation() ||
2900                             ValidateProgramUniformMatrix2x3dv(
2901                                 context, angle::EntryPoint::GLProgramUniformMatrix2x3dv,
2902                                 programPacked, locationPacked, count, transpose, value));
2903         if (isCallValid)
2904         {
2905             context->programUniformMatrix2x3dv(programPacked, locationPacked, count, transpose,
2906                                                value);
2907         }
2908         ANGLE_CAPTURE(ProgramUniformMatrix2x3dv, isCallValid, context, programPacked,
2909                       locationPacked, count, transpose, value);
2910     }
2911     else
2912     {
2913         GenerateContextLostErrorOnCurrentGlobalContext();
2914     }
2915 }
2916 
GL_ProgramUniformMatrix2x3fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)2917 void GL_APIENTRY GL_ProgramUniformMatrix2x3fv(GLuint program,
2918                                               GLint location,
2919                                               GLsizei count,
2920                                               GLboolean transpose,
2921                                               const GLfloat *value)
2922 {
2923     Context *context = GetValidGlobalContext();
2924     EVENT(context, GLProgramUniformMatrix2x3fv,
2925           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
2926           "0x%016" PRIxPTR "",
2927           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
2928 
2929     if (context)
2930     {
2931         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2932         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2933         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2934         bool isCallValid                                      = (context->skipValidation() ||
2935                             ValidateProgramUniformMatrix2x3fv(
2936                                 context, angle::EntryPoint::GLProgramUniformMatrix2x3fv,
2937                                 programPacked, locationPacked, count, transpose, value));
2938         if (isCallValid)
2939         {
2940             context->programUniformMatrix2x3fv(programPacked, locationPacked, count, transpose,
2941                                                value);
2942         }
2943         ANGLE_CAPTURE(ProgramUniformMatrix2x3fv, isCallValid, context, programPacked,
2944                       locationPacked, count, transpose, value);
2945     }
2946     else
2947     {
2948         GenerateContextLostErrorOnCurrentGlobalContext();
2949     }
2950 }
2951 
GL_ProgramUniformMatrix2x4dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)2952 void GL_APIENTRY GL_ProgramUniformMatrix2x4dv(GLuint program,
2953                                               GLint location,
2954                                               GLsizei count,
2955                                               GLboolean transpose,
2956                                               const GLdouble *value)
2957 {
2958     Context *context = GetValidGlobalContext();
2959     EVENT(context, GLProgramUniformMatrix2x4dv,
2960           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
2961           "0x%016" PRIxPTR "",
2962           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
2963 
2964     if (context)
2965     {
2966         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2967         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2968         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2969         bool isCallValid                                      = (context->skipValidation() ||
2970                             ValidateProgramUniformMatrix2x4dv(
2971                                 context, angle::EntryPoint::GLProgramUniformMatrix2x4dv,
2972                                 programPacked, locationPacked, count, transpose, value));
2973         if (isCallValid)
2974         {
2975             context->programUniformMatrix2x4dv(programPacked, locationPacked, count, transpose,
2976                                                value);
2977         }
2978         ANGLE_CAPTURE(ProgramUniformMatrix2x4dv, isCallValid, context, programPacked,
2979                       locationPacked, count, transpose, value);
2980     }
2981     else
2982     {
2983         GenerateContextLostErrorOnCurrentGlobalContext();
2984     }
2985 }
2986 
GL_ProgramUniformMatrix2x4fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)2987 void GL_APIENTRY GL_ProgramUniformMatrix2x4fv(GLuint program,
2988                                               GLint location,
2989                                               GLsizei count,
2990                                               GLboolean transpose,
2991                                               const GLfloat *value)
2992 {
2993     Context *context = GetValidGlobalContext();
2994     EVENT(context, GLProgramUniformMatrix2x4fv,
2995           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
2996           "0x%016" PRIxPTR "",
2997           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
2998 
2999     if (context)
3000     {
3001         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
3002         UniformLocation locationPacked = PackParam<UniformLocation>(location);
3003         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3004         bool isCallValid                                      = (context->skipValidation() ||
3005                             ValidateProgramUniformMatrix2x4fv(
3006                                 context, angle::EntryPoint::GLProgramUniformMatrix2x4fv,
3007                                 programPacked, locationPacked, count, transpose, value));
3008         if (isCallValid)
3009         {
3010             context->programUniformMatrix2x4fv(programPacked, locationPacked, count, transpose,
3011                                                value);
3012         }
3013         ANGLE_CAPTURE(ProgramUniformMatrix2x4fv, isCallValid, context, programPacked,
3014                       locationPacked, count, transpose, value);
3015     }
3016     else
3017     {
3018         GenerateContextLostErrorOnCurrentGlobalContext();
3019     }
3020 }
3021 
GL_ProgramUniformMatrix3dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)3022 void GL_APIENTRY GL_ProgramUniformMatrix3dv(GLuint program,
3023                                             GLint location,
3024                                             GLsizei count,
3025                                             GLboolean transpose,
3026                                             const GLdouble *value)
3027 {
3028     Context *context = GetValidGlobalContext();
3029     EVENT(context, GLProgramUniformMatrix3dv,
3030           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
3031           "0x%016" PRIxPTR "",
3032           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
3033 
3034     if (context)
3035     {
3036         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
3037         UniformLocation locationPacked = PackParam<UniformLocation>(location);
3038         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3039         bool isCallValid                                      = (context->skipValidation() ||
3040                             ValidateProgramUniformMatrix3dv(
3041                                 context, angle::EntryPoint::GLProgramUniformMatrix3dv,
3042                                 programPacked, locationPacked, count, transpose, value));
3043         if (isCallValid)
3044         {
3045             context->programUniformMatrix3dv(programPacked, locationPacked, count, transpose,
3046                                              value);
3047         }
3048         ANGLE_CAPTURE(ProgramUniformMatrix3dv, isCallValid, context, programPacked, locationPacked,
3049                       count, transpose, value);
3050     }
3051     else
3052     {
3053         GenerateContextLostErrorOnCurrentGlobalContext();
3054     }
3055 }
3056 
GL_ProgramUniformMatrix3fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)3057 void GL_APIENTRY GL_ProgramUniformMatrix3fv(GLuint program,
3058                                             GLint location,
3059                                             GLsizei count,
3060                                             GLboolean transpose,
3061                                             const GLfloat *value)
3062 {
3063     Context *context = GetValidGlobalContext();
3064     EVENT(context, GLProgramUniformMatrix3fv,
3065           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
3066           "0x%016" PRIxPTR "",
3067           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
3068 
3069     if (context)
3070     {
3071         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
3072         UniformLocation locationPacked = PackParam<UniformLocation>(location);
3073         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3074         bool isCallValid                                      = (context->skipValidation() ||
3075                             ValidateProgramUniformMatrix3fv(
3076                                 context, angle::EntryPoint::GLProgramUniformMatrix3fv,
3077                                 programPacked, locationPacked, count, transpose, value));
3078         if (isCallValid)
3079         {
3080             context->programUniformMatrix3fv(programPacked, locationPacked, count, transpose,
3081                                              value);
3082         }
3083         ANGLE_CAPTURE(ProgramUniformMatrix3fv, isCallValid, context, programPacked, locationPacked,
3084                       count, transpose, value);
3085     }
3086     else
3087     {
3088         GenerateContextLostErrorOnCurrentGlobalContext();
3089     }
3090 }
3091 
GL_ProgramUniformMatrix3x2dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)3092 void GL_APIENTRY GL_ProgramUniformMatrix3x2dv(GLuint program,
3093                                               GLint location,
3094                                               GLsizei count,
3095                                               GLboolean transpose,
3096                                               const GLdouble *value)
3097 {
3098     Context *context = GetValidGlobalContext();
3099     EVENT(context, GLProgramUniformMatrix3x2dv,
3100           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
3101           "0x%016" PRIxPTR "",
3102           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
3103 
3104     if (context)
3105     {
3106         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
3107         UniformLocation locationPacked = PackParam<UniformLocation>(location);
3108         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3109         bool isCallValid                                      = (context->skipValidation() ||
3110                             ValidateProgramUniformMatrix3x2dv(
3111                                 context, angle::EntryPoint::GLProgramUniformMatrix3x2dv,
3112                                 programPacked, locationPacked, count, transpose, value));
3113         if (isCallValid)
3114         {
3115             context->programUniformMatrix3x2dv(programPacked, locationPacked, count, transpose,
3116                                                value);
3117         }
3118         ANGLE_CAPTURE(ProgramUniformMatrix3x2dv, isCallValid, context, programPacked,
3119                       locationPacked, count, transpose, value);
3120     }
3121     else
3122     {
3123         GenerateContextLostErrorOnCurrentGlobalContext();
3124     }
3125 }
3126 
GL_ProgramUniformMatrix3x2fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)3127 void GL_APIENTRY GL_ProgramUniformMatrix3x2fv(GLuint program,
3128                                               GLint location,
3129                                               GLsizei count,
3130                                               GLboolean transpose,
3131                                               const GLfloat *value)
3132 {
3133     Context *context = GetValidGlobalContext();
3134     EVENT(context, GLProgramUniformMatrix3x2fv,
3135           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
3136           "0x%016" PRIxPTR "",
3137           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
3138 
3139     if (context)
3140     {
3141         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
3142         UniformLocation locationPacked = PackParam<UniformLocation>(location);
3143         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3144         bool isCallValid                                      = (context->skipValidation() ||
3145                             ValidateProgramUniformMatrix3x2fv(
3146                                 context, angle::EntryPoint::GLProgramUniformMatrix3x2fv,
3147                                 programPacked, locationPacked, count, transpose, value));
3148         if (isCallValid)
3149         {
3150             context->programUniformMatrix3x2fv(programPacked, locationPacked, count, transpose,
3151                                                value);
3152         }
3153         ANGLE_CAPTURE(ProgramUniformMatrix3x2fv, isCallValid, context, programPacked,
3154                       locationPacked, count, transpose, value);
3155     }
3156     else
3157     {
3158         GenerateContextLostErrorOnCurrentGlobalContext();
3159     }
3160 }
3161 
GL_ProgramUniformMatrix3x4dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)3162 void GL_APIENTRY GL_ProgramUniformMatrix3x4dv(GLuint program,
3163                                               GLint location,
3164                                               GLsizei count,
3165                                               GLboolean transpose,
3166                                               const GLdouble *value)
3167 {
3168     Context *context = GetValidGlobalContext();
3169     EVENT(context, GLProgramUniformMatrix3x4dv,
3170           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
3171           "0x%016" PRIxPTR "",
3172           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
3173 
3174     if (context)
3175     {
3176         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
3177         UniformLocation locationPacked = PackParam<UniformLocation>(location);
3178         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3179         bool isCallValid                                      = (context->skipValidation() ||
3180                             ValidateProgramUniformMatrix3x4dv(
3181                                 context, angle::EntryPoint::GLProgramUniformMatrix3x4dv,
3182                                 programPacked, locationPacked, count, transpose, value));
3183         if (isCallValid)
3184         {
3185             context->programUniformMatrix3x4dv(programPacked, locationPacked, count, transpose,
3186                                                value);
3187         }
3188         ANGLE_CAPTURE(ProgramUniformMatrix3x4dv, isCallValid, context, programPacked,
3189                       locationPacked, count, transpose, value);
3190     }
3191     else
3192     {
3193         GenerateContextLostErrorOnCurrentGlobalContext();
3194     }
3195 }
3196 
GL_ProgramUniformMatrix3x4fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)3197 void GL_APIENTRY GL_ProgramUniformMatrix3x4fv(GLuint program,
3198                                               GLint location,
3199                                               GLsizei count,
3200                                               GLboolean transpose,
3201                                               const GLfloat *value)
3202 {
3203     Context *context = GetValidGlobalContext();
3204     EVENT(context, GLProgramUniformMatrix3x4fv,
3205           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
3206           "0x%016" PRIxPTR "",
3207           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
3208 
3209     if (context)
3210     {
3211         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
3212         UniformLocation locationPacked = PackParam<UniformLocation>(location);
3213         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3214         bool isCallValid                                      = (context->skipValidation() ||
3215                             ValidateProgramUniformMatrix3x4fv(
3216                                 context, angle::EntryPoint::GLProgramUniformMatrix3x4fv,
3217                                 programPacked, locationPacked, count, transpose, value));
3218         if (isCallValid)
3219         {
3220             context->programUniformMatrix3x4fv(programPacked, locationPacked, count, transpose,
3221                                                value);
3222         }
3223         ANGLE_CAPTURE(ProgramUniformMatrix3x4fv, isCallValid, context, programPacked,
3224                       locationPacked, count, transpose, value);
3225     }
3226     else
3227     {
3228         GenerateContextLostErrorOnCurrentGlobalContext();
3229     }
3230 }
3231 
GL_ProgramUniformMatrix4dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)3232 void GL_APIENTRY GL_ProgramUniformMatrix4dv(GLuint program,
3233                                             GLint location,
3234                                             GLsizei count,
3235                                             GLboolean transpose,
3236                                             const GLdouble *value)
3237 {
3238     Context *context = GetValidGlobalContext();
3239     EVENT(context, GLProgramUniformMatrix4dv,
3240           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
3241           "0x%016" PRIxPTR "",
3242           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
3243 
3244     if (context)
3245     {
3246         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
3247         UniformLocation locationPacked = PackParam<UniformLocation>(location);
3248         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3249         bool isCallValid                                      = (context->skipValidation() ||
3250                             ValidateProgramUniformMatrix4dv(
3251                                 context, angle::EntryPoint::GLProgramUniformMatrix4dv,
3252                                 programPacked, locationPacked, count, transpose, value));
3253         if (isCallValid)
3254         {
3255             context->programUniformMatrix4dv(programPacked, locationPacked, count, transpose,
3256                                              value);
3257         }
3258         ANGLE_CAPTURE(ProgramUniformMatrix4dv, isCallValid, context, programPacked, locationPacked,
3259                       count, transpose, value);
3260     }
3261     else
3262     {
3263         GenerateContextLostErrorOnCurrentGlobalContext();
3264     }
3265 }
3266 
GL_ProgramUniformMatrix4fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)3267 void GL_APIENTRY GL_ProgramUniformMatrix4fv(GLuint program,
3268                                             GLint location,
3269                                             GLsizei count,
3270                                             GLboolean transpose,
3271                                             const GLfloat *value)
3272 {
3273     Context *context = GetValidGlobalContext();
3274     EVENT(context, GLProgramUniformMatrix4fv,
3275           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
3276           "0x%016" PRIxPTR "",
3277           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
3278 
3279     if (context)
3280     {
3281         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
3282         UniformLocation locationPacked = PackParam<UniformLocation>(location);
3283         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3284         bool isCallValid                                      = (context->skipValidation() ||
3285                             ValidateProgramUniformMatrix4fv(
3286                                 context, angle::EntryPoint::GLProgramUniformMatrix4fv,
3287                                 programPacked, locationPacked, count, transpose, value));
3288         if (isCallValid)
3289         {
3290             context->programUniformMatrix4fv(programPacked, locationPacked, count, transpose,
3291                                              value);
3292         }
3293         ANGLE_CAPTURE(ProgramUniformMatrix4fv, isCallValid, context, programPacked, locationPacked,
3294                       count, transpose, value);
3295     }
3296     else
3297     {
3298         GenerateContextLostErrorOnCurrentGlobalContext();
3299     }
3300 }
3301 
GL_ProgramUniformMatrix4x2dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)3302 void GL_APIENTRY GL_ProgramUniformMatrix4x2dv(GLuint program,
3303                                               GLint location,
3304                                               GLsizei count,
3305                                               GLboolean transpose,
3306                                               const GLdouble *value)
3307 {
3308     Context *context = GetValidGlobalContext();
3309     EVENT(context, GLProgramUniformMatrix4x2dv,
3310           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
3311           "0x%016" PRIxPTR "",
3312           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
3313 
3314     if (context)
3315     {
3316         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
3317         UniformLocation locationPacked = PackParam<UniformLocation>(location);
3318         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3319         bool isCallValid                                      = (context->skipValidation() ||
3320                             ValidateProgramUniformMatrix4x2dv(
3321                                 context, angle::EntryPoint::GLProgramUniformMatrix4x2dv,
3322                                 programPacked, locationPacked, count, transpose, value));
3323         if (isCallValid)
3324         {
3325             context->programUniformMatrix4x2dv(programPacked, locationPacked, count, transpose,
3326                                                value);
3327         }
3328         ANGLE_CAPTURE(ProgramUniformMatrix4x2dv, isCallValid, context, programPacked,
3329                       locationPacked, count, transpose, value);
3330     }
3331     else
3332     {
3333         GenerateContextLostErrorOnCurrentGlobalContext();
3334     }
3335 }
3336 
GL_ProgramUniformMatrix4x2fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)3337 void GL_APIENTRY GL_ProgramUniformMatrix4x2fv(GLuint program,
3338                                               GLint location,
3339                                               GLsizei count,
3340                                               GLboolean transpose,
3341                                               const GLfloat *value)
3342 {
3343     Context *context = GetValidGlobalContext();
3344     EVENT(context, GLProgramUniformMatrix4x2fv,
3345           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
3346           "0x%016" PRIxPTR "",
3347           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
3348 
3349     if (context)
3350     {
3351         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
3352         UniformLocation locationPacked = PackParam<UniformLocation>(location);
3353         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3354         bool isCallValid                                      = (context->skipValidation() ||
3355                             ValidateProgramUniformMatrix4x2fv(
3356                                 context, angle::EntryPoint::GLProgramUniformMatrix4x2fv,
3357                                 programPacked, locationPacked, count, transpose, value));
3358         if (isCallValid)
3359         {
3360             context->programUniformMatrix4x2fv(programPacked, locationPacked, count, transpose,
3361                                                value);
3362         }
3363         ANGLE_CAPTURE(ProgramUniformMatrix4x2fv, isCallValid, context, programPacked,
3364                       locationPacked, count, transpose, value);
3365     }
3366     else
3367     {
3368         GenerateContextLostErrorOnCurrentGlobalContext();
3369     }
3370 }
3371 
GL_ProgramUniformMatrix4x3dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)3372 void GL_APIENTRY GL_ProgramUniformMatrix4x3dv(GLuint program,
3373                                               GLint location,
3374                                               GLsizei count,
3375                                               GLboolean transpose,
3376                                               const GLdouble *value)
3377 {
3378     Context *context = GetValidGlobalContext();
3379     EVENT(context, GLProgramUniformMatrix4x3dv,
3380           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
3381           "0x%016" PRIxPTR "",
3382           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
3383 
3384     if (context)
3385     {
3386         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
3387         UniformLocation locationPacked = PackParam<UniformLocation>(location);
3388         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3389         bool isCallValid                                      = (context->skipValidation() ||
3390                             ValidateProgramUniformMatrix4x3dv(
3391                                 context, angle::EntryPoint::GLProgramUniformMatrix4x3dv,
3392                                 programPacked, locationPacked, count, transpose, value));
3393         if (isCallValid)
3394         {
3395             context->programUniformMatrix4x3dv(programPacked, locationPacked, count, transpose,
3396                                                value);
3397         }
3398         ANGLE_CAPTURE(ProgramUniformMatrix4x3dv, isCallValid, context, programPacked,
3399                       locationPacked, count, transpose, value);
3400     }
3401     else
3402     {
3403         GenerateContextLostErrorOnCurrentGlobalContext();
3404     }
3405 }
3406 
GL_ProgramUniformMatrix4x3fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)3407 void GL_APIENTRY GL_ProgramUniformMatrix4x3fv(GLuint program,
3408                                               GLint location,
3409                                               GLsizei count,
3410                                               GLboolean transpose,
3411                                               const GLfloat *value)
3412 {
3413     Context *context = GetValidGlobalContext();
3414     EVENT(context, GLProgramUniformMatrix4x3fv,
3415           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
3416           "0x%016" PRIxPTR "",
3417           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
3418 
3419     if (context)
3420     {
3421         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
3422         UniformLocation locationPacked = PackParam<UniformLocation>(location);
3423         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3424         bool isCallValid                                      = (context->skipValidation() ||
3425                             ValidateProgramUniformMatrix4x3fv(
3426                                 context, angle::EntryPoint::GLProgramUniformMatrix4x3fv,
3427                                 programPacked, locationPacked, count, transpose, value));
3428         if (isCallValid)
3429         {
3430             context->programUniformMatrix4x3fv(programPacked, locationPacked, count, transpose,
3431                                                value);
3432         }
3433         ANGLE_CAPTURE(ProgramUniformMatrix4x3fv, isCallValid, context, programPacked,
3434                       locationPacked, count, transpose, value);
3435     }
3436     else
3437     {
3438         GenerateContextLostErrorOnCurrentGlobalContext();
3439     }
3440 }
3441 
GL_ReleaseShaderCompiler()3442 void GL_APIENTRY GL_ReleaseShaderCompiler()
3443 {
3444     Context *context = GetValidGlobalContext();
3445     EVENT(context, GLReleaseShaderCompiler, "context = %d", CID(context));
3446 
3447     if (context)
3448     {
3449         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3450         bool isCallValid =
3451             (context->skipValidation() ||
3452              ValidateReleaseShaderCompiler(context, angle::EntryPoint::GLReleaseShaderCompiler));
3453         if (isCallValid)
3454         {
3455             context->releaseShaderCompiler();
3456         }
3457         ANGLE_CAPTURE(ReleaseShaderCompiler, isCallValid, context);
3458     }
3459     else
3460     {
3461         GenerateContextLostErrorOnCurrentGlobalContext();
3462     }
3463 }
3464 
GL_ScissorArrayv(GLuint first,GLsizei count,const GLint * v)3465 void GL_APIENTRY GL_ScissorArrayv(GLuint first, GLsizei count, const GLint *v)
3466 {
3467     Context *context = GetValidGlobalContext();
3468     EVENT(context, GLScissorArrayv, "context = %d, first = %u, count = %d, v = 0x%016" PRIxPTR "",
3469           CID(context), first, count, (uintptr_t)v);
3470 
3471     if (context)
3472     {
3473         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3474         bool isCallValid =
3475             (context->skipValidation() ||
3476              ValidateScissorArrayv(context, angle::EntryPoint::GLScissorArrayv, first, count, v));
3477         if (isCallValid)
3478         {
3479             context->scissorArrayv(first, count, v);
3480         }
3481         ANGLE_CAPTURE(ScissorArrayv, isCallValid, context, first, count, v);
3482     }
3483     else
3484     {
3485         GenerateContextLostErrorOnCurrentGlobalContext();
3486     }
3487 }
3488 
3489 void GL_APIENTRY
GL_ScissorIndexed(GLuint index,GLint left,GLint bottom,GLsizei width,GLsizei height)3490 GL_ScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height)
3491 {
3492     Context *context = GetValidGlobalContext();
3493     EVENT(context, GLScissorIndexed,
3494           "context = %d, index = %u, left = %d, bottom = %d, width = %d, height = %d", CID(context),
3495           index, left, bottom, width, height);
3496 
3497     if (context)
3498     {
3499         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3500         bool isCallValid                                      = (context->skipValidation() ||
3501                             ValidateScissorIndexed(context, angle::EntryPoint::GLScissorIndexed,
3502                                                    index, left, bottom, width, height));
3503         if (isCallValid)
3504         {
3505             context->scissorIndexed(index, left, bottom, width, height);
3506         }
3507         ANGLE_CAPTURE(ScissorIndexed, isCallValid, context, index, left, bottom, width, height);
3508     }
3509     else
3510     {
3511         GenerateContextLostErrorOnCurrentGlobalContext();
3512     }
3513 }
3514 
GL_ScissorIndexedv(GLuint index,const GLint * v)3515 void GL_APIENTRY GL_ScissorIndexedv(GLuint index, const GLint *v)
3516 {
3517     Context *context = GetValidGlobalContext();
3518     EVENT(context, GLScissorIndexedv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
3519           CID(context), index, (uintptr_t)v);
3520 
3521     if (context)
3522     {
3523         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3524         bool isCallValid =
3525             (context->skipValidation() ||
3526              ValidateScissorIndexedv(context, angle::EntryPoint::GLScissorIndexedv, index, v));
3527         if (isCallValid)
3528         {
3529             context->scissorIndexedv(index, v);
3530         }
3531         ANGLE_CAPTURE(ScissorIndexedv, isCallValid, context, index, v);
3532     }
3533     else
3534     {
3535         GenerateContextLostErrorOnCurrentGlobalContext();
3536     }
3537 }
3538 
GL_ShaderBinary(GLsizei count,const GLuint * shaders,GLenum binaryformat,const void * binary,GLsizei length)3539 void GL_APIENTRY GL_ShaderBinary(GLsizei count,
3540                                  const GLuint *shaders,
3541                                  GLenum binaryformat,
3542                                  const void *binary,
3543                                  GLsizei length)
3544 {
3545     Context *context = GetValidGlobalContext();
3546     EVENT(context, GLShaderBinary,
3547           "context = %d, count = %d, shaders = 0x%016" PRIxPTR
3548           ", binaryformat = %s, binary = 0x%016" PRIxPTR ", length = %d",
3549           CID(context), count, (uintptr_t)shaders,
3550           GLenumToString(GLenumGroup::DefaultGroup, binaryformat), (uintptr_t)binary, length);
3551 
3552     if (context)
3553     {
3554         const ShaderProgramID *shadersPacked = PackParam<const ShaderProgramID *>(shaders);
3555         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3556         bool isCallValid                                      = (context->skipValidation() ||
3557                             ValidateShaderBinary(context, angle::EntryPoint::GLShaderBinary, count,
3558                                                  shadersPacked, binaryformat, binary, length));
3559         if (isCallValid)
3560         {
3561             context->shaderBinary(count, shadersPacked, binaryformat, binary, length);
3562         }
3563         ANGLE_CAPTURE(ShaderBinary, isCallValid, context, count, shadersPacked, binaryformat,
3564                       binary, length);
3565     }
3566     else
3567     {
3568         GenerateContextLostErrorOnCurrentGlobalContext();
3569     }
3570 }
3571 
GL_UseProgramStages(GLuint pipeline,GLbitfield stages,GLuint program)3572 void GL_APIENTRY GL_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
3573 {
3574     Context *context = GetValidGlobalContext();
3575     EVENT(context, GLUseProgramStages, "context = %d, pipeline = %u, stages = %s, program = %u",
3576           CID(context), pipeline,
3577           GLbitfieldToString(GLenumGroup::UseProgramStageMask, stages).c_str(), program);
3578 
3579     if (context)
3580     {
3581         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
3582         ShaderProgramID programPacked    = PackParam<ShaderProgramID>(program);
3583         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3584         bool isCallValid                                      = (context->skipValidation() ||
3585                             ValidateUseProgramStages(context, angle::EntryPoint::GLUseProgramStages,
3586                                                      pipelinePacked, stages, programPacked));
3587         if (isCallValid)
3588         {
3589             context->useProgramStages(pipelinePacked, stages, programPacked);
3590         }
3591         ANGLE_CAPTURE(UseProgramStages, isCallValid, context, pipelinePacked, stages,
3592                       programPacked);
3593     }
3594     else
3595     {
3596         GenerateContextLostErrorOnCurrentGlobalContext();
3597     }
3598 }
3599 
GL_ValidateProgramPipeline(GLuint pipeline)3600 void GL_APIENTRY GL_ValidateProgramPipeline(GLuint pipeline)
3601 {
3602     Context *context = GetValidGlobalContext();
3603     EVENT(context, GLValidateProgramPipeline, "context = %d, pipeline = %u", CID(context),
3604           pipeline);
3605 
3606     if (context)
3607     {
3608         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
3609         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3610         bool isCallValid =
3611             (context->skipValidation() ||
3612              ValidateValidateProgramPipeline(context, angle::EntryPoint::GLValidateProgramPipeline,
3613                                              pipelinePacked));
3614         if (isCallValid)
3615         {
3616             context->validateProgramPipeline(pipelinePacked);
3617         }
3618         ANGLE_CAPTURE(ValidateProgramPipeline, isCallValid, context, pipelinePacked);
3619     }
3620     else
3621     {
3622         GenerateContextLostErrorOnCurrentGlobalContext();
3623     }
3624 }
3625 
GL_VertexAttribL1d(GLuint index,GLdouble x)3626 void GL_APIENTRY GL_VertexAttribL1d(GLuint index, GLdouble x)
3627 {
3628     Context *context = GetValidGlobalContext();
3629     EVENT(context, GLVertexAttribL1d, "context = %d, index = %u, x = %f", CID(context), index, x);
3630 
3631     if (context)
3632     {
3633         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3634         bool isCallValid =
3635             (context->skipValidation() ||
3636              ValidateVertexAttribL1d(context, angle::EntryPoint::GLVertexAttribL1d, index, x));
3637         if (isCallValid)
3638         {
3639             context->vertexAttribL1d(index, x);
3640         }
3641         ANGLE_CAPTURE(VertexAttribL1d, isCallValid, context, index, x);
3642     }
3643     else
3644     {
3645         GenerateContextLostErrorOnCurrentGlobalContext();
3646     }
3647 }
3648 
GL_VertexAttribL1dv(GLuint index,const GLdouble * v)3649 void GL_APIENTRY GL_VertexAttribL1dv(GLuint index, const GLdouble *v)
3650 {
3651     Context *context = GetValidGlobalContext();
3652     EVENT(context, GLVertexAttribL1dv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
3653           CID(context), index, (uintptr_t)v);
3654 
3655     if (context)
3656     {
3657         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3658         bool isCallValid =
3659             (context->skipValidation() ||
3660              ValidateVertexAttribL1dv(context, angle::EntryPoint::GLVertexAttribL1dv, index, v));
3661         if (isCallValid)
3662         {
3663             context->vertexAttribL1dv(index, v);
3664         }
3665         ANGLE_CAPTURE(VertexAttribL1dv, isCallValid, context, index, v);
3666     }
3667     else
3668     {
3669         GenerateContextLostErrorOnCurrentGlobalContext();
3670     }
3671 }
3672 
GL_VertexAttribL2d(GLuint index,GLdouble x,GLdouble y)3673 void GL_APIENTRY GL_VertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
3674 {
3675     Context *context = GetValidGlobalContext();
3676     EVENT(context, GLVertexAttribL2d, "context = %d, index = %u, x = %f, y = %f", CID(context),
3677           index, x, y);
3678 
3679     if (context)
3680     {
3681         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3682         bool isCallValid =
3683             (context->skipValidation() ||
3684              ValidateVertexAttribL2d(context, angle::EntryPoint::GLVertexAttribL2d, index, x, y));
3685         if (isCallValid)
3686         {
3687             context->vertexAttribL2d(index, x, y);
3688         }
3689         ANGLE_CAPTURE(VertexAttribL2d, isCallValid, context, index, x, y);
3690     }
3691     else
3692     {
3693         GenerateContextLostErrorOnCurrentGlobalContext();
3694     }
3695 }
3696 
GL_VertexAttribL2dv(GLuint index,const GLdouble * v)3697 void GL_APIENTRY GL_VertexAttribL2dv(GLuint index, const GLdouble *v)
3698 {
3699     Context *context = GetValidGlobalContext();
3700     EVENT(context, GLVertexAttribL2dv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
3701           CID(context), index, (uintptr_t)v);
3702 
3703     if (context)
3704     {
3705         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3706         bool isCallValid =
3707             (context->skipValidation() ||
3708              ValidateVertexAttribL2dv(context, angle::EntryPoint::GLVertexAttribL2dv, index, v));
3709         if (isCallValid)
3710         {
3711             context->vertexAttribL2dv(index, v);
3712         }
3713         ANGLE_CAPTURE(VertexAttribL2dv, isCallValid, context, index, v);
3714     }
3715     else
3716     {
3717         GenerateContextLostErrorOnCurrentGlobalContext();
3718     }
3719 }
3720 
GL_VertexAttribL3d(GLuint index,GLdouble x,GLdouble y,GLdouble z)3721 void GL_APIENTRY GL_VertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
3722 {
3723     Context *context = GetValidGlobalContext();
3724     EVENT(context, GLVertexAttribL3d, "context = %d, index = %u, x = %f, y = %f, z = %f",
3725           CID(context), index, x, y, z);
3726 
3727     if (context)
3728     {
3729         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3730         bool isCallValid                                      = (context->skipValidation() ||
3731                             ValidateVertexAttribL3d(context, angle::EntryPoint::GLVertexAttribL3d,
3732                                                     index, x, y, z));
3733         if (isCallValid)
3734         {
3735             context->vertexAttribL3d(index, x, y, z);
3736         }
3737         ANGLE_CAPTURE(VertexAttribL3d, isCallValid, context, index, x, y, z);
3738     }
3739     else
3740     {
3741         GenerateContextLostErrorOnCurrentGlobalContext();
3742     }
3743 }
3744 
GL_VertexAttribL3dv(GLuint index,const GLdouble * v)3745 void GL_APIENTRY GL_VertexAttribL3dv(GLuint index, const GLdouble *v)
3746 {
3747     Context *context = GetValidGlobalContext();
3748     EVENT(context, GLVertexAttribL3dv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
3749           CID(context), index, (uintptr_t)v);
3750 
3751     if (context)
3752     {
3753         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3754         bool isCallValid =
3755             (context->skipValidation() ||
3756              ValidateVertexAttribL3dv(context, angle::EntryPoint::GLVertexAttribL3dv, index, v));
3757         if (isCallValid)
3758         {
3759             context->vertexAttribL3dv(index, v);
3760         }
3761         ANGLE_CAPTURE(VertexAttribL3dv, isCallValid, context, index, v);
3762     }
3763     else
3764     {
3765         GenerateContextLostErrorOnCurrentGlobalContext();
3766     }
3767 }
3768 
GL_VertexAttribL4d(GLuint index,GLdouble x,GLdouble y,GLdouble z,GLdouble w)3769 void GL_APIENTRY GL_VertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
3770 {
3771     Context *context = GetValidGlobalContext();
3772     EVENT(context, GLVertexAttribL4d, "context = %d, index = %u, x = %f, y = %f, z = %f, w = %f",
3773           CID(context), index, x, y, z, w);
3774 
3775     if (context)
3776     {
3777         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3778         bool isCallValid                                      = (context->skipValidation() ||
3779                             ValidateVertexAttribL4d(context, angle::EntryPoint::GLVertexAttribL4d,
3780                                                     index, x, y, z, w));
3781         if (isCallValid)
3782         {
3783             context->vertexAttribL4d(index, x, y, z, w);
3784         }
3785         ANGLE_CAPTURE(VertexAttribL4d, isCallValid, context, index, x, y, z, w);
3786     }
3787     else
3788     {
3789         GenerateContextLostErrorOnCurrentGlobalContext();
3790     }
3791 }
3792 
GL_VertexAttribL4dv(GLuint index,const GLdouble * v)3793 void GL_APIENTRY GL_VertexAttribL4dv(GLuint index, const GLdouble *v)
3794 {
3795     Context *context = GetValidGlobalContext();
3796     EVENT(context, GLVertexAttribL4dv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
3797           CID(context), index, (uintptr_t)v);
3798 
3799     if (context)
3800     {
3801         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3802         bool isCallValid =
3803             (context->skipValidation() ||
3804              ValidateVertexAttribL4dv(context, angle::EntryPoint::GLVertexAttribL4dv, index, v));
3805         if (isCallValid)
3806         {
3807             context->vertexAttribL4dv(index, v);
3808         }
3809         ANGLE_CAPTURE(VertexAttribL4dv, isCallValid, context, index, v);
3810     }
3811     else
3812     {
3813         GenerateContextLostErrorOnCurrentGlobalContext();
3814     }
3815 }
3816 
3817 void GL_APIENTRY
GL_VertexAttribLPointer(GLuint index,GLint size,GLenum type,GLsizei stride,const void * pointer)3818 GL_VertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer)
3819 {
3820     Context *context = GetValidGlobalContext();
3821     EVENT(context, GLVertexAttribLPointer,
3822           "context = %d, index = %u, size = %d, type = %s, stride = %d, pointer = 0x%016" PRIxPTR
3823           "",
3824           CID(context), index, size, GLenumToString(GLenumGroup::VertexAttribPointerType, type),
3825           stride, (uintptr_t)pointer);
3826 
3827     if (context)
3828     {
3829         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3830         bool isCallValid =
3831             (context->skipValidation() ||
3832              ValidateVertexAttribLPointer(context, angle::EntryPoint::GLVertexAttribLPointer, index,
3833                                           size, type, stride, pointer));
3834         if (isCallValid)
3835         {
3836             context->vertexAttribLPointer(index, size, type, stride, pointer);
3837         }
3838         ANGLE_CAPTURE(VertexAttribLPointer, isCallValid, context, index, size, type, stride,
3839                       pointer);
3840     }
3841     else
3842     {
3843         GenerateContextLostErrorOnCurrentGlobalContext();
3844     }
3845 }
3846 
GL_ViewportArrayv(GLuint first,GLsizei count,const GLfloat * v)3847 void GL_APIENTRY GL_ViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
3848 {
3849     Context *context = GetValidGlobalContext();
3850     EVENT(context, GLViewportArrayv, "context = %d, first = %u, count = %d, v = 0x%016" PRIxPTR "",
3851           CID(context), first, count, (uintptr_t)v);
3852 
3853     if (context)
3854     {
3855         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3856         bool isCallValid =
3857             (context->skipValidation() ||
3858              ValidateViewportArrayv(context, angle::EntryPoint::GLViewportArrayv, first, count, v));
3859         if (isCallValid)
3860         {
3861             context->viewportArrayv(first, count, v);
3862         }
3863         ANGLE_CAPTURE(ViewportArrayv, isCallValid, context, first, count, v);
3864     }
3865     else
3866     {
3867         GenerateContextLostErrorOnCurrentGlobalContext();
3868     }
3869 }
3870 
GL_ViewportIndexedf(GLuint index,GLfloat x,GLfloat y,GLfloat w,GLfloat h)3871 void GL_APIENTRY GL_ViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h)
3872 {
3873     Context *context = GetValidGlobalContext();
3874     EVENT(context, GLViewportIndexedf, "context = %d, index = %u, x = %f, y = %f, w = %f, h = %f",
3875           CID(context), index, x, y, w, h);
3876 
3877     if (context)
3878     {
3879         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3880         bool isCallValid                                      = (context->skipValidation() ||
3881                             ValidateViewportIndexedf(context, angle::EntryPoint::GLViewportIndexedf,
3882                                                      index, x, y, w, h));
3883         if (isCallValid)
3884         {
3885             context->viewportIndexedf(index, x, y, w, h);
3886         }
3887         ANGLE_CAPTURE(ViewportIndexedf, isCallValid, context, index, x, y, w, h);
3888     }
3889     else
3890     {
3891         GenerateContextLostErrorOnCurrentGlobalContext();
3892     }
3893 }
3894 
GL_ViewportIndexedfv(GLuint index,const GLfloat * v)3895 void GL_APIENTRY GL_ViewportIndexedfv(GLuint index, const GLfloat *v)
3896 {
3897     Context *context = GetValidGlobalContext();
3898     EVENT(context, GLViewportIndexedfv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
3899           CID(context), index, (uintptr_t)v);
3900 
3901     if (context)
3902     {
3903         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3904         bool isCallValid =
3905             (context->skipValidation() ||
3906              ValidateViewportIndexedfv(context, angle::EntryPoint::GLViewportIndexedfv, index, v));
3907         if (isCallValid)
3908         {
3909             context->viewportIndexedfv(index, v);
3910         }
3911         ANGLE_CAPTURE(ViewportIndexedfv, isCallValid, context, index, v);
3912     }
3913     else
3914     {
3915         GenerateContextLostErrorOnCurrentGlobalContext();
3916     }
3917 }
3918 
3919 // GL 4.2
GL_BindImageTexture(GLuint unit,GLuint texture,GLint level,GLboolean layered,GLint layer,GLenum access,GLenum format)3920 void GL_APIENTRY GL_BindImageTexture(GLuint unit,
3921                                      GLuint texture,
3922                                      GLint level,
3923                                      GLboolean layered,
3924                                      GLint layer,
3925                                      GLenum access,
3926                                      GLenum format)
3927 {
3928     Context *context = GetValidGlobalContext();
3929     EVENT(context, GLBindImageTexture,
3930           "context = %d, unit = %u, texture = %u, level = %d, layered = %s, layer = %d, access = "
3931           "%s, format = %s",
3932           CID(context), unit, texture, level, GLbooleanToString(layered), layer,
3933           GLenumToString(GLenumGroup::BufferAccessARB, access),
3934           GLenumToString(GLenumGroup::InternalFormat, format));
3935 
3936     if (context)
3937     {
3938         TextureID texturePacked                               = PackParam<TextureID>(texture);
3939         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3940         bool isCallValid =
3941             (context->skipValidation() ||
3942              ValidateBindImageTexture(context, angle::EntryPoint::GLBindImageTexture, unit,
3943                                       texturePacked, level, layered, layer, access, format));
3944         if (isCallValid)
3945         {
3946             context->bindImageTexture(unit, texturePacked, level, layered, layer, access, format);
3947         }
3948         ANGLE_CAPTURE(BindImageTexture, isCallValid, context, unit, texturePacked, level, layered,
3949                       layer, access, format);
3950     }
3951     else
3952     {
3953         GenerateContextLostErrorOnCurrentGlobalContext();
3954     }
3955 }
3956 
GL_DrawArraysInstancedBaseInstance(GLenum mode,GLint first,GLsizei count,GLsizei instancecount,GLuint baseinstance)3957 void GL_APIENTRY GL_DrawArraysInstancedBaseInstance(GLenum mode,
3958                                                     GLint first,
3959                                                     GLsizei count,
3960                                                     GLsizei instancecount,
3961                                                     GLuint baseinstance)
3962 {
3963     Context *context = GetValidGlobalContext();
3964     EVENT(context, GLDrawArraysInstancedBaseInstance,
3965           "context = %d, mode = %s, first = %d, count = %d, instancecount = %d, baseinstance = %u",
3966           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), first, count,
3967           instancecount, baseinstance);
3968 
3969     if (context)
3970     {
3971         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
3972         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3973         bool isCallValid                                      = (context->skipValidation() ||
3974                             ValidateDrawArraysInstancedBaseInstance(
3975                                 context, angle::EntryPoint::GLDrawArraysInstancedBaseInstance,
3976                                 modePacked, first, count, instancecount, baseinstance));
3977         if (isCallValid)
3978         {
3979             context->drawArraysInstancedBaseInstance(modePacked, first, count, instancecount,
3980                                                      baseinstance);
3981         }
3982         ANGLE_CAPTURE(DrawArraysInstancedBaseInstance, isCallValid, context, modePacked, first,
3983                       count, instancecount, baseinstance);
3984     }
3985     else
3986     {
3987         GenerateContextLostErrorOnCurrentGlobalContext();
3988     }
3989 }
3990 
GL_DrawElementsInstancedBaseInstance(GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei instancecount,GLuint baseinstance)3991 void GL_APIENTRY GL_DrawElementsInstancedBaseInstance(GLenum mode,
3992                                                       GLsizei count,
3993                                                       GLenum type,
3994                                                       const void *indices,
3995                                                       GLsizei instancecount,
3996                                                       GLuint baseinstance)
3997 {
3998     Context *context = GetValidGlobalContext();
3999     EVENT(context, GLDrawElementsInstancedBaseInstance,
4000           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
4001           ", instancecount = %d, baseinstance = %u",
4002           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), count,
4003           GLenumToString(GLenumGroup::PrimitiveType, type), (uintptr_t)indices, instancecount,
4004           baseinstance);
4005 
4006     if (context)
4007     {
4008         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4009         bool isCallValid                                      = (context->skipValidation() ||
4010                             ValidateDrawElementsInstancedBaseInstance(
4011                                 context, angle::EntryPoint::GLDrawElementsInstancedBaseInstance,
4012                                 mode, count, type, indices, instancecount, baseinstance));
4013         if (isCallValid)
4014         {
4015             context->drawElementsInstancedBaseInstance(mode, count, type, indices, instancecount,
4016                                                        baseinstance);
4017         }
4018         ANGLE_CAPTURE(DrawElementsInstancedBaseInstance, isCallValid, context, mode, count, type,
4019                       indices, instancecount, baseinstance);
4020     }
4021     else
4022     {
4023         GenerateContextLostErrorOnCurrentGlobalContext();
4024     }
4025 }
4026 
GL_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei instancecount,GLint basevertex,GLuint baseinstance)4027 void GL_APIENTRY GL_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode,
4028                                                                 GLsizei count,
4029                                                                 GLenum type,
4030                                                                 const void *indices,
4031                                                                 GLsizei instancecount,
4032                                                                 GLint basevertex,
4033                                                                 GLuint baseinstance)
4034 {
4035     Context *context = GetValidGlobalContext();
4036     EVENT(context, GLDrawElementsInstancedBaseVertexBaseInstance,
4037           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
4038           ", instancecount = %d, basevertex = %d, baseinstance = %u",
4039           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), count,
4040           GLenumToString(GLenumGroup::PrimitiveType, type), (uintptr_t)indices, instancecount,
4041           basevertex, baseinstance);
4042 
4043     if (context)
4044     {
4045         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
4046         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
4047         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4048         bool isCallValid =
4049             (context->skipValidation() ||
4050              ValidateDrawElementsInstancedBaseVertexBaseInstance(
4051                  context, angle::EntryPoint::GLDrawElementsInstancedBaseVertexBaseInstance,
4052                  modePacked, count, typePacked, indices, instancecount, basevertex, baseinstance));
4053         if (isCallValid)
4054         {
4055             context->drawElementsInstancedBaseVertexBaseInstance(
4056                 modePacked, count, typePacked, indices, instancecount, basevertex, baseinstance);
4057         }
4058         ANGLE_CAPTURE(DrawElementsInstancedBaseVertexBaseInstance, isCallValid, context, modePacked,
4059                       count, typePacked, indices, instancecount, basevertex, baseinstance);
4060     }
4061     else
4062     {
4063         GenerateContextLostErrorOnCurrentGlobalContext();
4064     }
4065 }
4066 
GL_DrawTransformFeedbackInstanced(GLenum mode,GLuint id,GLsizei instancecount)4067 void GL_APIENTRY GL_DrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount)
4068 {
4069     Context *context = GetValidGlobalContext();
4070     EVENT(context, GLDrawTransformFeedbackInstanced,
4071           "context = %d, mode = %s, id = %u, instancecount = %d", CID(context),
4072           GLenumToString(GLenumGroup::PrimitiveType, mode), id, instancecount);
4073 
4074     if (context)
4075     {
4076         TransformFeedbackID idPacked                          = PackParam<TransformFeedbackID>(id);
4077         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4078         bool isCallValid                                      = (context->skipValidation() ||
4079                             ValidateDrawTransformFeedbackInstanced(
4080                                 context, angle::EntryPoint::GLDrawTransformFeedbackInstanced, mode,
4081                                 idPacked, instancecount));
4082         if (isCallValid)
4083         {
4084             context->drawTransformFeedbackInstanced(mode, idPacked, instancecount);
4085         }
4086         ANGLE_CAPTURE(DrawTransformFeedbackInstanced, isCallValid, context, mode, idPacked,
4087                       instancecount);
4088     }
4089     else
4090     {
4091         GenerateContextLostErrorOnCurrentGlobalContext();
4092     }
4093 }
4094 
GL_DrawTransformFeedbackStreamInstanced(GLenum mode,GLuint id,GLuint stream,GLsizei instancecount)4095 void GL_APIENTRY GL_DrawTransformFeedbackStreamInstanced(GLenum mode,
4096                                                          GLuint id,
4097                                                          GLuint stream,
4098                                                          GLsizei instancecount)
4099 {
4100     Context *context = GetValidGlobalContext();
4101     EVENT(context, GLDrawTransformFeedbackStreamInstanced,
4102           "context = %d, mode = %s, id = %u, stream = %u, instancecount = %d", CID(context),
4103           GLenumToString(GLenumGroup::PrimitiveType, mode), id, stream, instancecount);
4104 
4105     if (context)
4106     {
4107         TransformFeedbackID idPacked                          = PackParam<TransformFeedbackID>(id);
4108         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4109         bool isCallValid                                      = (context->skipValidation() ||
4110                             ValidateDrawTransformFeedbackStreamInstanced(
4111                                 context, angle::EntryPoint::GLDrawTransformFeedbackStreamInstanced,
4112                                 mode, idPacked, stream, instancecount));
4113         if (isCallValid)
4114         {
4115             context->drawTransformFeedbackStreamInstanced(mode, idPacked, stream, instancecount);
4116         }
4117         ANGLE_CAPTURE(DrawTransformFeedbackStreamInstanced, isCallValid, context, mode, idPacked,
4118                       stream, instancecount);
4119     }
4120     else
4121     {
4122         GenerateContextLostErrorOnCurrentGlobalContext();
4123     }
4124 }
4125 
GL_GetActiveAtomicCounterBufferiv(GLuint program,GLuint bufferIndex,GLenum pname,GLint * params)4126 void GL_APIENTRY GL_GetActiveAtomicCounterBufferiv(GLuint program,
4127                                                    GLuint bufferIndex,
4128                                                    GLenum pname,
4129                                                    GLint *params)
4130 {
4131     Context *context = GetValidGlobalContext();
4132     EVENT(context, GLGetActiveAtomicCounterBufferiv,
4133           "context = %d, program = %u, bufferIndex = %u, pname = %s, params = 0x%016" PRIxPTR "",
4134           CID(context), program, bufferIndex,
4135           GLenumToString(GLenumGroup::AtomicCounterBufferPName, pname), (uintptr_t)params);
4136 
4137     if (context)
4138     {
4139         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
4140         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4141         bool isCallValid                                      = (context->skipValidation() ||
4142                             ValidateGetActiveAtomicCounterBufferiv(
4143                                 context, angle::EntryPoint::GLGetActiveAtomicCounterBufferiv,
4144                                 programPacked, bufferIndex, pname, params));
4145         if (isCallValid)
4146         {
4147             context->getActiveAtomicCounterBufferiv(programPacked, bufferIndex, pname, params);
4148         }
4149         ANGLE_CAPTURE(GetActiveAtomicCounterBufferiv, isCallValid, context, programPacked,
4150                       bufferIndex, pname, params);
4151     }
4152     else
4153     {
4154         GenerateContextLostErrorOnCurrentGlobalContext();
4155     }
4156 }
4157 
GL_GetInternalformativ(GLenum target,GLenum internalformat,GLenum pname,GLsizei bufSize,GLint * params)4158 void GL_APIENTRY GL_GetInternalformativ(GLenum target,
4159                                         GLenum internalformat,
4160                                         GLenum pname,
4161                                         GLsizei bufSize,
4162                                         GLint *params)
4163 {
4164     Context *context = GetValidGlobalContext();
4165     EVENT(context, GLGetInternalformativ,
4166           "context = %d, target = %s, internalformat = %s, pname = %s, bufSize = %d, params = "
4167           "0x%016" PRIxPTR "",
4168           CID(context), GLenumToString(GLenumGroup::TextureTarget, target),
4169           GLenumToString(GLenumGroup::InternalFormat, internalformat),
4170           GLenumToString(GLenumGroup::InternalFormatPName, pname), bufSize, (uintptr_t)params);
4171 
4172     if (context)
4173     {
4174         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4175         bool isCallValid =
4176             (context->skipValidation() ||
4177              ValidateGetInternalformativ(context, angle::EntryPoint::GLGetInternalformativ, target,
4178                                          internalformat, pname, bufSize, params));
4179         if (isCallValid)
4180         {
4181             context->getInternalformativ(target, internalformat, pname, bufSize, params);
4182         }
4183         ANGLE_CAPTURE(GetInternalformativ, isCallValid, context, target, internalformat, pname,
4184                       bufSize, params);
4185     }
4186     else
4187     {
4188         GenerateContextLostErrorOnCurrentGlobalContext();
4189     }
4190 }
4191 
GL_MemoryBarrier(GLbitfield barriers)4192 void GL_APIENTRY GL_MemoryBarrier(GLbitfield barriers)
4193 {
4194     Context *context = GetValidGlobalContext();
4195     EVENT(context, GLMemoryBarrier, "context = %d, barriers = %s", CID(context),
4196           GLbitfieldToString(GLenumGroup::MemoryBarrierMask, barriers).c_str());
4197 
4198     if (context)
4199     {
4200         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4201         bool isCallValid =
4202             (context->skipValidation() ||
4203              ValidateMemoryBarrier(context, angle::EntryPoint::GLMemoryBarrier, barriers));
4204         if (isCallValid)
4205         {
4206             context->memoryBarrier(barriers);
4207         }
4208         ANGLE_CAPTURE(MemoryBarrier, isCallValid, context, barriers);
4209     }
4210     else
4211     {
4212         GenerateContextLostErrorOnCurrentGlobalContext();
4213     }
4214 }
4215 
GL_TexStorage1D(GLenum target,GLsizei levels,GLenum internalformat,GLsizei width)4216 void GL_APIENTRY GL_TexStorage1D(GLenum target,
4217                                  GLsizei levels,
4218                                  GLenum internalformat,
4219                                  GLsizei width)
4220 {
4221     Context *context = GetValidGlobalContext();
4222     EVENT(context, GLTexStorage1D,
4223           "context = %d, target = %s, levels = %d, internalformat = %s, width = %d", CID(context),
4224           GLenumToString(GLenumGroup::TextureTarget, target), levels,
4225           GLenumToString(GLenumGroup::InternalFormat, internalformat), width);
4226 
4227     if (context)
4228     {
4229         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4230         bool isCallValid                                      = (context->skipValidation() ||
4231                             ValidateTexStorage1D(context, angle::EntryPoint::GLTexStorage1D, target,
4232                                                  levels, internalformat, width));
4233         if (isCallValid)
4234         {
4235             context->texStorage1D(target, levels, internalformat, width);
4236         }
4237         ANGLE_CAPTURE(TexStorage1D, isCallValid, context, target, levels, internalformat, width);
4238     }
4239     else
4240     {
4241         GenerateContextLostErrorOnCurrentGlobalContext();
4242     }
4243 }
4244 
4245 void GL_APIENTRY
GL_TexStorage2D(GLenum target,GLsizei levels,GLenum internalformat,GLsizei width,GLsizei height)4246 GL_TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
4247 {
4248     Context *context = GetValidGlobalContext();
4249     EVENT(context, GLTexStorage2D,
4250           "context = %d, target = %s, levels = %d, internalformat = %s, width = %d, height = %d",
4251           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), levels,
4252           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height);
4253 
4254     if (context)
4255     {
4256         TextureType targetPacked                              = PackParam<TextureType>(target);
4257         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4258         bool isCallValid =
4259             (context->skipValidation() ||
4260              ValidateTexStorage2D(context, angle::EntryPoint::GLTexStorage2D, targetPacked, levels,
4261                                   internalformat, width, height));
4262         if (isCallValid)
4263         {
4264             context->texStorage2D(targetPacked, levels, internalformat, width, height);
4265         }
4266         ANGLE_CAPTURE(TexStorage2D, isCallValid, context, targetPacked, levels, internalformat,
4267                       width, height);
4268     }
4269     else
4270     {
4271         GenerateContextLostErrorOnCurrentGlobalContext();
4272     }
4273 }
4274 
GL_TexStorage3D(GLenum target,GLsizei levels,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth)4275 void GL_APIENTRY GL_TexStorage3D(GLenum target,
4276                                  GLsizei levels,
4277                                  GLenum internalformat,
4278                                  GLsizei width,
4279                                  GLsizei height,
4280                                  GLsizei depth)
4281 {
4282     Context *context = GetValidGlobalContext();
4283     EVENT(context, GLTexStorage3D,
4284           "context = %d, target = %s, levels = %d, internalformat = %s, width = %d, height = %d, "
4285           "depth = %d",
4286           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), levels,
4287           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height, depth);
4288 
4289     if (context)
4290     {
4291         TextureType targetPacked                              = PackParam<TextureType>(target);
4292         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4293         bool isCallValid =
4294             (context->skipValidation() ||
4295              ValidateTexStorage3D(context, angle::EntryPoint::GLTexStorage3D, targetPacked, levels,
4296                                   internalformat, width, height, depth));
4297         if (isCallValid)
4298         {
4299             context->texStorage3D(targetPacked, levels, internalformat, width, height, depth);
4300         }
4301         ANGLE_CAPTURE(TexStorage3D, isCallValid, context, targetPacked, levels, internalformat,
4302                       width, height, depth);
4303     }
4304     else
4305     {
4306         GenerateContextLostErrorOnCurrentGlobalContext();
4307     }
4308 }
4309 
4310 // GL 4.3
GL_BindVertexBuffer(GLuint bindingindex,GLuint buffer,GLintptr offset,GLsizei stride)4311 void GL_APIENTRY GL_BindVertexBuffer(GLuint bindingindex,
4312                                      GLuint buffer,
4313                                      GLintptr offset,
4314                                      GLsizei stride)
4315 {
4316     Context *context = GetValidGlobalContext();
4317     EVENT(context, GLBindVertexBuffer,
4318           "context = %d, bindingindex = %u, buffer = %u, offset = %llu, stride = %d", CID(context),
4319           bindingindex, buffer, static_cast<unsigned long long>(offset), stride);
4320 
4321     if (context)
4322     {
4323         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
4324         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4325         bool isCallValid                                      = (context->skipValidation() ||
4326                             ValidateBindVertexBuffer(context, angle::EntryPoint::GLBindVertexBuffer,
4327                                                      bindingindex, bufferPacked, offset, stride));
4328         if (isCallValid)
4329         {
4330             context->bindVertexBuffer(bindingindex, bufferPacked, offset, stride);
4331         }
4332         ANGLE_CAPTURE(BindVertexBuffer, isCallValid, context, bindingindex, bufferPacked, offset,
4333                       stride);
4334     }
4335     else
4336     {
4337         GenerateContextLostErrorOnCurrentGlobalContext();
4338     }
4339 }
4340 
GL_ClearBufferData(GLenum target,GLenum internalformat,GLenum format,GLenum type,const void * data)4341 void GL_APIENTRY GL_ClearBufferData(GLenum target,
4342                                     GLenum internalformat,
4343                                     GLenum format,
4344                                     GLenum type,
4345                                     const void *data)
4346 {
4347     Context *context = GetValidGlobalContext();
4348     EVENT(context, GLClearBufferData,
4349           "context = %d, target = %s, internalformat = %s, format = %s, type = %s, data = "
4350           "0x%016" PRIxPTR "",
4351           CID(context), GLenumToString(GLenumGroup::BufferStorageTarget, target),
4352           GLenumToString(GLenumGroup::InternalFormat, internalformat),
4353           GLenumToString(GLenumGroup::PixelFormat, format),
4354           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)data);
4355 
4356     if (context)
4357     {
4358         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4359         bool isCallValid                                      = (context->skipValidation() ||
4360                             ValidateClearBufferData(context, angle::EntryPoint::GLClearBufferData,
4361                                                     target, internalformat, format, type, data));
4362         if (isCallValid)
4363         {
4364             context->clearBufferData(target, internalformat, format, type, data);
4365         }
4366         ANGLE_CAPTURE(ClearBufferData, isCallValid, context, target, internalformat, format, type,
4367                       data);
4368     }
4369     else
4370     {
4371         GenerateContextLostErrorOnCurrentGlobalContext();
4372     }
4373 }
4374 
GL_ClearBufferSubData(GLenum target,GLenum internalformat,GLintptr offset,GLsizeiptr size,GLenum format,GLenum type,const void * data)4375 void GL_APIENTRY GL_ClearBufferSubData(GLenum target,
4376                                        GLenum internalformat,
4377                                        GLintptr offset,
4378                                        GLsizeiptr size,
4379                                        GLenum format,
4380                                        GLenum type,
4381                                        const void *data)
4382 {
4383     Context *context = GetValidGlobalContext();
4384     EVENT(context, GLClearBufferSubData,
4385           "context = %d, target = %s, internalformat = %s, offset = %llu, size = %llu, format = "
4386           "%s, type = %s, data = 0x%016" PRIxPTR "",
4387           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target),
4388           GLenumToString(GLenumGroup::InternalFormat, internalformat),
4389           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size),
4390           GLenumToString(GLenumGroup::PixelFormat, format),
4391           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)data);
4392 
4393     if (context)
4394     {
4395         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4396         bool isCallValid =
4397             (context->skipValidation() ||
4398              ValidateClearBufferSubData(context, angle::EntryPoint::GLClearBufferSubData, target,
4399                                         internalformat, offset, size, format, type, data));
4400         if (isCallValid)
4401         {
4402             context->clearBufferSubData(target, internalformat, offset, size, format, type, data);
4403         }
4404         ANGLE_CAPTURE(ClearBufferSubData, isCallValid, context, target, internalformat, offset,
4405                       size, format, type, data);
4406     }
4407     else
4408     {
4409         GenerateContextLostErrorOnCurrentGlobalContext();
4410     }
4411 }
4412 
GL_CopyImageSubData(GLuint srcName,GLenum srcTarget,GLint srcLevel,GLint srcX,GLint srcY,GLint srcZ,GLuint dstName,GLenum dstTarget,GLint dstLevel,GLint dstX,GLint dstY,GLint dstZ,GLsizei srcWidth,GLsizei srcHeight,GLsizei srcDepth)4413 void GL_APIENTRY GL_CopyImageSubData(GLuint srcName,
4414                                      GLenum srcTarget,
4415                                      GLint srcLevel,
4416                                      GLint srcX,
4417                                      GLint srcY,
4418                                      GLint srcZ,
4419                                      GLuint dstName,
4420                                      GLenum dstTarget,
4421                                      GLint dstLevel,
4422                                      GLint dstX,
4423                                      GLint dstY,
4424                                      GLint dstZ,
4425                                      GLsizei srcWidth,
4426                                      GLsizei srcHeight,
4427                                      GLsizei srcDepth)
4428 {
4429     Context *context = GetValidGlobalContext();
4430     EVENT(context, GLCopyImageSubData,
4431           "context = %d, srcName = %u, srcTarget = %s, srcLevel = %d, srcX = %d, srcY = %d, srcZ = "
4432           "%d, dstName = %u, dstTarget = %s, dstLevel = %d, dstX = %d, dstY = %d, dstZ = %d, "
4433           "srcWidth = %d, srcHeight = %d, srcDepth = %d",
4434           CID(context), srcName, GLenumToString(GLenumGroup::CopyBufferSubDataTarget, srcTarget),
4435           srcLevel, srcX, srcY, srcZ, dstName,
4436           GLenumToString(GLenumGroup::CopyBufferSubDataTarget, dstTarget), dstLevel, dstX, dstY,
4437           dstZ, srcWidth, srcHeight, srcDepth);
4438 
4439     if (context)
4440     {
4441         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4442         bool isCallValid =
4443             (context->skipValidation() ||
4444              ValidateCopyImageSubData(context, angle::EntryPoint::GLCopyImageSubData, srcName,
4445                                       srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget,
4446                                       dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth));
4447         if (isCallValid)
4448         {
4449             context->copyImageSubData(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName,
4450                                       dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight,
4451                                       srcDepth);
4452         }
4453         ANGLE_CAPTURE(CopyImageSubData, isCallValid, context, srcName, srcTarget, srcLevel, srcX,
4454                       srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth,
4455                       srcHeight, srcDepth);
4456     }
4457     else
4458     {
4459         GenerateContextLostErrorOnCurrentGlobalContext();
4460     }
4461 }
4462 
GL_DebugMessageCallback(GLDEBUGPROC callback,const void * userParam)4463 void GL_APIENTRY GL_DebugMessageCallback(GLDEBUGPROC callback, const void *userParam)
4464 {
4465     Context *context = GetValidGlobalContext();
4466     EVENT(context, GLDebugMessageCallback,
4467           "context = %d, callback = 0x%016" PRIxPTR ", userParam = 0x%016" PRIxPTR "", CID(context),
4468           (uintptr_t)callback, (uintptr_t)userParam);
4469 
4470     if (context)
4471     {
4472         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4473         bool isCallValid =
4474             (context->skipValidation() ||
4475              ValidateDebugMessageCallback(context, angle::EntryPoint::GLDebugMessageCallback,
4476                                           callback, userParam));
4477         if (isCallValid)
4478         {
4479             context->debugMessageCallback(callback, userParam);
4480         }
4481         ANGLE_CAPTURE(DebugMessageCallback, isCallValid, context, callback, userParam);
4482     }
4483     else
4484     {
4485         GenerateContextLostErrorOnCurrentGlobalContext();
4486     }
4487 }
4488 
GL_DebugMessageControl(GLenum source,GLenum type,GLenum severity,GLsizei count,const GLuint * ids,GLboolean enabled)4489 void GL_APIENTRY GL_DebugMessageControl(GLenum source,
4490                                         GLenum type,
4491                                         GLenum severity,
4492                                         GLsizei count,
4493                                         const GLuint *ids,
4494                                         GLboolean enabled)
4495 {
4496     Context *context = GetValidGlobalContext();
4497     EVENT(context, GLDebugMessageControl,
4498           "context = %d, source = %s, type = %s, severity = %s, count = %d, ids = 0x%016" PRIxPTR
4499           ", enabled = %s",
4500           CID(context), GLenumToString(GLenumGroup::DebugSource, source),
4501           GLenumToString(GLenumGroup::DebugType, type),
4502           GLenumToString(GLenumGroup::DebugSeverity, severity), count, (uintptr_t)ids,
4503           GLbooleanToString(enabled));
4504 
4505     if (context)
4506     {
4507         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4508         bool isCallValid =
4509             (context->skipValidation() ||
4510              ValidateDebugMessageControl(context, angle::EntryPoint::GLDebugMessageControl, source,
4511                                          type, severity, count, ids, enabled));
4512         if (isCallValid)
4513         {
4514             context->debugMessageControl(source, type, severity, count, ids, enabled);
4515         }
4516         ANGLE_CAPTURE(DebugMessageControl, isCallValid, context, source, type, severity, count, ids,
4517                       enabled);
4518     }
4519     else
4520     {
4521         GenerateContextLostErrorOnCurrentGlobalContext();
4522     }
4523 }
4524 
GL_DebugMessageInsert(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar * buf)4525 void GL_APIENTRY GL_DebugMessageInsert(GLenum source,
4526                                        GLenum type,
4527                                        GLuint id,
4528                                        GLenum severity,
4529                                        GLsizei length,
4530                                        const GLchar *buf)
4531 {
4532     Context *context = GetValidGlobalContext();
4533     EVENT(context, GLDebugMessageInsert,
4534           "context = %d, source = %s, type = %s, id = %u, severity = %s, length = %d, buf = "
4535           "0x%016" PRIxPTR "",
4536           CID(context), GLenumToString(GLenumGroup::DebugSource, source),
4537           GLenumToString(GLenumGroup::DebugType, type), id,
4538           GLenumToString(GLenumGroup::DebugSeverity, severity), length, (uintptr_t)buf);
4539 
4540     if (context)
4541     {
4542         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4543         bool isCallValid =
4544             (context->skipValidation() ||
4545              ValidateDebugMessageInsert(context, angle::EntryPoint::GLDebugMessageInsert, source,
4546                                         type, id, severity, length, buf));
4547         if (isCallValid)
4548         {
4549             context->debugMessageInsert(source, type, id, severity, length, buf);
4550         }
4551         ANGLE_CAPTURE(DebugMessageInsert, isCallValid, context, source, type, id, severity, length,
4552                       buf);
4553     }
4554     else
4555     {
4556         GenerateContextLostErrorOnCurrentGlobalContext();
4557     }
4558 }
4559 
GL_DispatchCompute(GLuint num_groups_x,GLuint num_groups_y,GLuint num_groups_z)4560 void GL_APIENTRY GL_DispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z)
4561 {
4562     Context *context = GetValidGlobalContext();
4563     EVENT(context, GLDispatchCompute,
4564           "context = %d, num_groups_x = %u, num_groups_y = %u, num_groups_z = %u", CID(context),
4565           num_groups_x, num_groups_y, num_groups_z);
4566 
4567     if (context)
4568     {
4569         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4570         bool isCallValid                                      = (context->skipValidation() ||
4571                             ValidateDispatchCompute(context, angle::EntryPoint::GLDispatchCompute,
4572                                                     num_groups_x, num_groups_y, num_groups_z));
4573         if (isCallValid)
4574         {
4575             context->dispatchCompute(num_groups_x, num_groups_y, num_groups_z);
4576         }
4577         ANGLE_CAPTURE(DispatchCompute, isCallValid, context, num_groups_x, num_groups_y,
4578                       num_groups_z);
4579     }
4580     else
4581     {
4582         GenerateContextLostErrorOnCurrentGlobalContext();
4583     }
4584 }
4585 
GL_DispatchComputeIndirect(GLintptr indirect)4586 void GL_APIENTRY GL_DispatchComputeIndirect(GLintptr indirect)
4587 {
4588     Context *context = GetValidGlobalContext();
4589     EVENT(context, GLDispatchComputeIndirect, "context = %d, indirect = %llu", CID(context),
4590           static_cast<unsigned long long>(indirect));
4591 
4592     if (context)
4593     {
4594         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4595         bool isCallValid                                      = (context->skipValidation() ||
4596                             ValidateDispatchComputeIndirect(
4597                                 context, angle::EntryPoint::GLDispatchComputeIndirect, indirect));
4598         if (isCallValid)
4599         {
4600             context->dispatchComputeIndirect(indirect);
4601         }
4602         ANGLE_CAPTURE(DispatchComputeIndirect, isCallValid, context, indirect);
4603     }
4604     else
4605     {
4606         GenerateContextLostErrorOnCurrentGlobalContext();
4607     }
4608 }
4609 
GL_FramebufferParameteri(GLenum target,GLenum pname,GLint param)4610 void GL_APIENTRY GL_FramebufferParameteri(GLenum target, GLenum pname, GLint param)
4611 {
4612     Context *context = GetValidGlobalContext();
4613     EVENT(context, GLFramebufferParameteri, "context = %d, target = %s, pname = %s, param = %d",
4614           CID(context), GLenumToString(GLenumGroup::FramebufferTarget, target),
4615           GLenumToString(GLenumGroup::FramebufferParameterName, pname), param);
4616 
4617     if (context)
4618     {
4619         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4620         bool isCallValid =
4621             (context->skipValidation() ||
4622              ValidateFramebufferParameteri(context, angle::EntryPoint::GLFramebufferParameteri,
4623                                            target, pname, param));
4624         if (isCallValid)
4625         {
4626             context->framebufferParameteri(target, pname, param);
4627         }
4628         ANGLE_CAPTURE(FramebufferParameteri, isCallValid, context, target, pname, param);
4629     }
4630     else
4631     {
4632         GenerateContextLostErrorOnCurrentGlobalContext();
4633     }
4634 }
4635 
GL_GetDebugMessageLog(GLuint count,GLsizei bufSize,GLenum * sources,GLenum * types,GLuint * ids,GLenum * severities,GLsizei * lengths,GLchar * messageLog)4636 GLuint GL_APIENTRY GL_GetDebugMessageLog(GLuint count,
4637                                          GLsizei bufSize,
4638                                          GLenum *sources,
4639                                          GLenum *types,
4640                                          GLuint *ids,
4641                                          GLenum *severities,
4642                                          GLsizei *lengths,
4643                                          GLchar *messageLog)
4644 {
4645     Context *context = GetValidGlobalContext();
4646     EVENT(context, GLGetDebugMessageLog,
4647           "context = %d, count = %u, bufSize = %d, sources = 0x%016" PRIxPTR
4648           ", types = 0x%016" PRIxPTR ", ids = 0x%016" PRIxPTR ", severities = 0x%016" PRIxPTR
4649           ", lengths = 0x%016" PRIxPTR ", messageLog = 0x%016" PRIxPTR "",
4650           CID(context), count, bufSize, (uintptr_t)sources, (uintptr_t)types, (uintptr_t)ids,
4651           (uintptr_t)severities, (uintptr_t)lengths, (uintptr_t)messageLog);
4652 
4653     GLuint returnValue;
4654     if (context)
4655     {
4656         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4657         bool isCallValid                                      = (context->skipValidation() ||
4658                             ValidateGetDebugMessageLog(
4659                                 context, angle::EntryPoint::GLGetDebugMessageLog, count, bufSize,
4660                                 sources, types, ids, severities, lengths, messageLog));
4661         if (isCallValid)
4662         {
4663             returnValue = context->getDebugMessageLog(count, bufSize, sources, types, ids,
4664                                                       severities, lengths, messageLog);
4665         }
4666         else
4667         {
4668             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetDebugMessageLog, GLuint>();
4669         }
4670         ANGLE_CAPTURE(GetDebugMessageLog, isCallValid, context, count, bufSize, sources, types, ids,
4671                       severities, lengths, messageLog, returnValue);
4672     }
4673     else
4674     {
4675         GenerateContextLostErrorOnCurrentGlobalContext();
4676         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetDebugMessageLog, GLuint>();
4677     }
4678     return returnValue;
4679 }
4680 
GL_GetFramebufferParameteriv(GLenum target,GLenum pname,GLint * params)4681 void GL_APIENTRY GL_GetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params)
4682 {
4683     Context *context = GetValidGlobalContext();
4684     EVENT(context, GLGetFramebufferParameteriv,
4685           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
4686           GLenumToString(GLenumGroup::FramebufferTarget, target),
4687           GLenumToString(GLenumGroup::FramebufferAttachmentParameterName, pname),
4688           (uintptr_t)params);
4689 
4690     if (context)
4691     {
4692         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4693         bool isCallValid =
4694             (context->skipValidation() ||
4695              ValidateGetFramebufferParameteriv(
4696                  context, angle::EntryPoint::GLGetFramebufferParameteriv, target, pname, params));
4697         if (isCallValid)
4698         {
4699             context->getFramebufferParameteriv(target, pname, params);
4700         }
4701         ANGLE_CAPTURE(GetFramebufferParameteriv, isCallValid, context, target, pname, params);
4702     }
4703     else
4704     {
4705         GenerateContextLostErrorOnCurrentGlobalContext();
4706     }
4707 }
4708 
GL_GetInternalformati64v(GLenum target,GLenum internalformat,GLenum pname,GLsizei bufSize,GLint64 * params)4709 void GL_APIENTRY GL_GetInternalformati64v(GLenum target,
4710                                           GLenum internalformat,
4711                                           GLenum pname,
4712                                           GLsizei bufSize,
4713                                           GLint64 *params)
4714 {
4715     Context *context = GetValidGlobalContext();
4716     EVENT(context, GLGetInternalformati64v,
4717           "context = %d, target = %s, internalformat = %s, pname = %s, bufSize = %d, params = "
4718           "0x%016" PRIxPTR "",
4719           CID(context), GLenumToString(GLenumGroup::TextureTarget, target),
4720           GLenumToString(GLenumGroup::InternalFormat, internalformat),
4721           GLenumToString(GLenumGroup::InternalFormatPName, pname), bufSize, (uintptr_t)params);
4722 
4723     if (context)
4724     {
4725         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4726         bool isCallValid =
4727             (context->skipValidation() ||
4728              ValidateGetInternalformati64v(context, angle::EntryPoint::GLGetInternalformati64v,
4729                                            target, internalformat, pname, bufSize, params));
4730         if (isCallValid)
4731         {
4732             context->getInternalformati64v(target, internalformat, pname, bufSize, params);
4733         }
4734         ANGLE_CAPTURE(GetInternalformati64v, isCallValid, context, target, internalformat, pname,
4735                       bufSize, params);
4736     }
4737     else
4738     {
4739         GenerateContextLostErrorOnCurrentGlobalContext();
4740     }
4741 }
4742 
4743 void GL_APIENTRY
GL_GetObjectLabel(GLenum identifier,GLuint name,GLsizei bufSize,GLsizei * length,GLchar * label)4744 GL_GetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label)
4745 {
4746     Context *context = GetValidGlobalContext();
4747     EVENT(context, GLGetObjectLabel,
4748           "context = %d, identifier = %s, name = %u, bufSize = %d, length = 0x%016" PRIxPTR
4749           ", label = 0x%016" PRIxPTR "",
4750           CID(context), GLenumToString(GLenumGroup::DefaultGroup, identifier), name, bufSize,
4751           (uintptr_t)length, (uintptr_t)label);
4752 
4753     if (context)
4754     {
4755         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4756         bool isCallValid                                      = (context->skipValidation() ||
4757                             ValidateGetObjectLabel(context, angle::EntryPoint::GLGetObjectLabel,
4758                                                    identifier, name, bufSize, length, label));
4759         if (isCallValid)
4760         {
4761             context->getObjectLabel(identifier, name, bufSize, length, label);
4762         }
4763         ANGLE_CAPTURE(GetObjectLabel, isCallValid, context, identifier, name, bufSize, length,
4764                       label);
4765     }
4766     else
4767     {
4768         GenerateContextLostErrorOnCurrentGlobalContext();
4769     }
4770 }
4771 
GL_GetObjectPtrLabel(const void * ptr,GLsizei bufSize,GLsizei * length,GLchar * label)4772 void GL_APIENTRY GL_GetObjectPtrLabel(const void *ptr,
4773                                       GLsizei bufSize,
4774                                       GLsizei *length,
4775                                       GLchar *label)
4776 {
4777     Context *context = GetValidGlobalContext();
4778     EVENT(context, GLGetObjectPtrLabel,
4779           "context = %d, ptr = 0x%016" PRIxPTR ", bufSize = %d, length = 0x%016" PRIxPTR
4780           ", label = 0x%016" PRIxPTR "",
4781           CID(context), (uintptr_t)ptr, bufSize, (uintptr_t)length, (uintptr_t)label);
4782 
4783     if (context)
4784     {
4785         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4786         bool isCallValid =
4787             (context->skipValidation() ||
4788              ValidateGetObjectPtrLabel(context, angle::EntryPoint::GLGetObjectPtrLabel, ptr,
4789                                        bufSize, length, label));
4790         if (isCallValid)
4791         {
4792             context->getObjectPtrLabel(ptr, bufSize, length, label);
4793         }
4794         ANGLE_CAPTURE(GetObjectPtrLabel, isCallValid, context, ptr, bufSize, length, label);
4795     }
4796     else
4797     {
4798         GenerateContextLostErrorOnCurrentGlobalContext();
4799     }
4800 }
4801 
GL_GetProgramInterfaceiv(GLuint program,GLenum programInterface,GLenum pname,GLint * params)4802 void GL_APIENTRY GL_GetProgramInterfaceiv(GLuint program,
4803                                           GLenum programInterface,
4804                                           GLenum pname,
4805                                           GLint *params)
4806 {
4807     Context *context = GetValidGlobalContext();
4808     EVENT(context, GLGetProgramInterfaceiv,
4809           "context = %d, program = %u, programInterface = %s, pname = %s, params = 0x%016" PRIxPTR
4810           "",
4811           CID(context), program, GLenumToString(GLenumGroup::ProgramInterface, programInterface),
4812           GLenumToString(GLenumGroup::ProgramInterfacePName, pname), (uintptr_t)params);
4813 
4814     if (context)
4815     {
4816         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
4817         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4818         bool isCallValid =
4819             (context->skipValidation() ||
4820              ValidateGetProgramInterfaceiv(context, angle::EntryPoint::GLGetProgramInterfaceiv,
4821                                            programPacked, programInterface, pname, params));
4822         if (isCallValid)
4823         {
4824             context->getProgramInterfaceiv(programPacked, programInterface, pname, params);
4825         }
4826         ANGLE_CAPTURE(GetProgramInterfaceiv, isCallValid, context, programPacked, programInterface,
4827                       pname, params);
4828     }
4829     else
4830     {
4831         GenerateContextLostErrorOnCurrentGlobalContext();
4832     }
4833 }
4834 
GL_GetProgramResourceIndex(GLuint program,GLenum programInterface,const GLchar * name)4835 GLuint GL_APIENTRY GL_GetProgramResourceIndex(GLuint program,
4836                                               GLenum programInterface,
4837                                               const GLchar *name)
4838 {
4839     Context *context = GetValidGlobalContext();
4840     EVENT(context, GLGetProgramResourceIndex,
4841           "context = %d, program = %u, programInterface = %s, name = 0x%016" PRIxPTR "",
4842           CID(context), program, GLenumToString(GLenumGroup::ProgramInterface, programInterface),
4843           (uintptr_t)name);
4844 
4845     GLuint returnValue;
4846     if (context)
4847     {
4848         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
4849         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4850         bool isCallValid =
4851             (context->skipValidation() ||
4852              ValidateGetProgramResourceIndex(context, angle::EntryPoint::GLGetProgramResourceIndex,
4853                                              programPacked, programInterface, name));
4854         if (isCallValid)
4855         {
4856             returnValue = context->getProgramResourceIndex(programPacked, programInterface, name);
4857         }
4858         else
4859         {
4860             returnValue =
4861                 GetDefaultReturnValue<angle::EntryPoint::GLGetProgramResourceIndex, GLuint>();
4862         }
4863         ANGLE_CAPTURE(GetProgramResourceIndex, isCallValid, context, programPacked,
4864                       programInterface, name, returnValue);
4865     }
4866     else
4867     {
4868         GenerateContextLostErrorOnCurrentGlobalContext();
4869         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetProgramResourceIndex, GLuint>();
4870     }
4871     return returnValue;
4872 }
4873 
GL_GetProgramResourceLocation(GLuint program,GLenum programInterface,const GLchar * name)4874 GLint GL_APIENTRY GL_GetProgramResourceLocation(GLuint program,
4875                                                 GLenum programInterface,
4876                                                 const GLchar *name)
4877 {
4878     Context *context = GetValidGlobalContext();
4879     EVENT(context, GLGetProgramResourceLocation,
4880           "context = %d, program = %u, programInterface = %s, name = 0x%016" PRIxPTR "",
4881           CID(context), program, GLenumToString(GLenumGroup::ProgramInterface, programInterface),
4882           (uintptr_t)name);
4883 
4884     GLint returnValue;
4885     if (context)
4886     {
4887         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
4888         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4889         bool isCallValid                                      = (context->skipValidation() ||
4890                             ValidateGetProgramResourceLocation(
4891                                 context, angle::EntryPoint::GLGetProgramResourceLocation,
4892                                 programPacked, programInterface, name));
4893         if (isCallValid)
4894         {
4895             returnValue =
4896                 context->getProgramResourceLocation(programPacked, programInterface, name);
4897         }
4898         else
4899         {
4900             returnValue =
4901                 GetDefaultReturnValue<angle::EntryPoint::GLGetProgramResourceLocation, GLint>();
4902         }
4903         ANGLE_CAPTURE(GetProgramResourceLocation, isCallValid, context, programPacked,
4904                       programInterface, name, returnValue);
4905     }
4906     else
4907     {
4908         GenerateContextLostErrorOnCurrentGlobalContext();
4909         returnValue =
4910             GetDefaultReturnValue<angle::EntryPoint::GLGetProgramResourceLocation, GLint>();
4911     }
4912     return returnValue;
4913 }
4914 
GL_GetProgramResourceLocationIndex(GLuint program,GLenum programInterface,const GLchar * name)4915 GLint GL_APIENTRY GL_GetProgramResourceLocationIndex(GLuint program,
4916                                                      GLenum programInterface,
4917                                                      const GLchar *name)
4918 {
4919     Context *context = GetValidGlobalContext();
4920     EVENT(context, GLGetProgramResourceLocationIndex,
4921           "context = %d, program = %u, programInterface = %s, name = 0x%016" PRIxPTR "",
4922           CID(context), program, GLenumToString(GLenumGroup::ProgramInterface, programInterface),
4923           (uintptr_t)name);
4924 
4925     GLint returnValue;
4926     if (context)
4927     {
4928         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
4929         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4930         bool isCallValid                                      = (context->skipValidation() ||
4931                             ValidateGetProgramResourceLocationIndex(
4932                                 context, angle::EntryPoint::GLGetProgramResourceLocationIndex,
4933                                 programPacked, programInterface, name));
4934         if (isCallValid)
4935         {
4936             returnValue =
4937                 context->getProgramResourceLocationIndex(programPacked, programInterface, name);
4938         }
4939         else
4940         {
4941             returnValue =
4942                 GetDefaultReturnValue<angle::EntryPoint::GLGetProgramResourceLocationIndex,
4943                                       GLint>();
4944         }
4945         ANGLE_CAPTURE(GetProgramResourceLocationIndex, isCallValid, context, programPacked,
4946                       programInterface, name, returnValue);
4947     }
4948     else
4949     {
4950         GenerateContextLostErrorOnCurrentGlobalContext();
4951         returnValue =
4952             GetDefaultReturnValue<angle::EntryPoint::GLGetProgramResourceLocationIndex, GLint>();
4953     }
4954     return returnValue;
4955 }
4956 
GL_GetProgramResourceName(GLuint program,GLenum programInterface,GLuint index,GLsizei bufSize,GLsizei * length,GLchar * name)4957 void GL_APIENTRY GL_GetProgramResourceName(GLuint program,
4958                                            GLenum programInterface,
4959                                            GLuint index,
4960                                            GLsizei bufSize,
4961                                            GLsizei *length,
4962                                            GLchar *name)
4963 {
4964     Context *context = GetValidGlobalContext();
4965     EVENT(context, GLGetProgramResourceName,
4966           "context = %d, program = %u, programInterface = %s, index = %u, bufSize = %d, length = "
4967           "0x%016" PRIxPTR ", name = 0x%016" PRIxPTR "",
4968           CID(context), program, GLenumToString(GLenumGroup::ProgramInterface, programInterface),
4969           index, bufSize, (uintptr_t)length, (uintptr_t)name);
4970 
4971     if (context)
4972     {
4973         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
4974         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4975         bool isCallValid                                      = (context->skipValidation() ||
4976                             ValidateGetProgramResourceName(
4977                                 context, angle::EntryPoint::GLGetProgramResourceName, programPacked,
4978                                 programInterface, index, bufSize, length, name));
4979         if (isCallValid)
4980         {
4981             context->getProgramResourceName(programPacked, programInterface, index, bufSize, length,
4982                                             name);
4983         }
4984         ANGLE_CAPTURE(GetProgramResourceName, isCallValid, context, programPacked, programInterface,
4985                       index, bufSize, length, name);
4986     }
4987     else
4988     {
4989         GenerateContextLostErrorOnCurrentGlobalContext();
4990     }
4991 }
4992 
GL_GetProgramResourceiv(GLuint program,GLenum programInterface,GLuint index,GLsizei propCount,const GLenum * props,GLsizei bufSize,GLsizei * length,GLint * params)4993 void GL_APIENTRY GL_GetProgramResourceiv(GLuint program,
4994                                          GLenum programInterface,
4995                                          GLuint index,
4996                                          GLsizei propCount,
4997                                          const GLenum *props,
4998                                          GLsizei bufSize,
4999                                          GLsizei *length,
5000                                          GLint *params)
5001 {
5002     Context *context = GetValidGlobalContext();
5003     EVENT(context, GLGetProgramResourceiv,
5004           "context = %d, program = %u, programInterface = %s, index = %u, propCount = %d, props = "
5005           "0x%016" PRIxPTR ", bufSize = %d, length = 0x%016" PRIxPTR ", params = 0x%016" PRIxPTR "",
5006           CID(context), program, GLenumToString(GLenumGroup::ProgramInterface, programInterface),
5007           index, propCount, (uintptr_t)props, bufSize, (uintptr_t)length, (uintptr_t)params);
5008 
5009     if (context)
5010     {
5011         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
5012         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5013         bool isCallValid =
5014             (context->skipValidation() ||
5015              ValidateGetProgramResourceiv(context, angle::EntryPoint::GLGetProgramResourceiv,
5016                                           programPacked, programInterface, index, propCount, props,
5017                                           bufSize, length, params));
5018         if (isCallValid)
5019         {
5020             context->getProgramResourceiv(programPacked, programInterface, index, propCount, props,
5021                                           bufSize, length, params);
5022         }
5023         ANGLE_CAPTURE(GetProgramResourceiv, isCallValid, context, programPacked, programInterface,
5024                       index, propCount, props, bufSize, length, params);
5025     }
5026     else
5027     {
5028         GenerateContextLostErrorOnCurrentGlobalContext();
5029     }
5030 }
5031 
GL_InvalidateBufferData(GLuint buffer)5032 void GL_APIENTRY GL_InvalidateBufferData(GLuint buffer)
5033 {
5034     Context *context = GetValidGlobalContext();
5035     EVENT(context, GLInvalidateBufferData, "context = %d, buffer = %u", CID(context), buffer);
5036 
5037     if (context)
5038     {
5039         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
5040         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5041         bool isCallValid                                      = (context->skipValidation() ||
5042                             ValidateInvalidateBufferData(
5043                                 context, angle::EntryPoint::GLInvalidateBufferData, bufferPacked));
5044         if (isCallValid)
5045         {
5046             context->invalidateBufferData(bufferPacked);
5047         }
5048         ANGLE_CAPTURE(InvalidateBufferData, isCallValid, context, bufferPacked);
5049     }
5050     else
5051     {
5052         GenerateContextLostErrorOnCurrentGlobalContext();
5053     }
5054 }
5055 
GL_InvalidateBufferSubData(GLuint buffer,GLintptr offset,GLsizeiptr length)5056 void GL_APIENTRY GL_InvalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length)
5057 {
5058     Context *context = GetValidGlobalContext();
5059     EVENT(context, GLInvalidateBufferSubData,
5060           "context = %d, buffer = %u, offset = %llu, length = %llu", CID(context), buffer,
5061           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length));
5062 
5063     if (context)
5064     {
5065         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
5066         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5067         bool isCallValid =
5068             (context->skipValidation() ||
5069              ValidateInvalidateBufferSubData(context, angle::EntryPoint::GLInvalidateBufferSubData,
5070                                              bufferPacked, offset, length));
5071         if (isCallValid)
5072         {
5073             context->invalidateBufferSubData(bufferPacked, offset, length);
5074         }
5075         ANGLE_CAPTURE(InvalidateBufferSubData, isCallValid, context, bufferPacked, offset, length);
5076     }
5077     else
5078     {
5079         GenerateContextLostErrorOnCurrentGlobalContext();
5080     }
5081 }
5082 
GL_InvalidateFramebuffer(GLenum target,GLsizei numAttachments,const GLenum * attachments)5083 void GL_APIENTRY GL_InvalidateFramebuffer(GLenum target,
5084                                           GLsizei numAttachments,
5085                                           const GLenum *attachments)
5086 {
5087     Context *context = GetValidGlobalContext();
5088     EVENT(context, GLInvalidateFramebuffer,
5089           "context = %d, target = %s, numAttachments = %d, attachments = 0x%016" PRIxPTR "",
5090           CID(context), GLenumToString(GLenumGroup::FramebufferTarget, target), numAttachments,
5091           (uintptr_t)attachments);
5092 
5093     if (context)
5094     {
5095         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5096         bool isCallValid =
5097             (context->skipValidation() ||
5098              ValidateInvalidateFramebuffer(context, angle::EntryPoint::GLInvalidateFramebuffer,
5099                                            target, numAttachments, attachments));
5100         if (isCallValid)
5101         {
5102             context->invalidateFramebuffer(target, numAttachments, attachments);
5103         }
5104         ANGLE_CAPTURE(InvalidateFramebuffer, isCallValid, context, target, numAttachments,
5105                       attachments);
5106     }
5107     else
5108     {
5109         GenerateContextLostErrorOnCurrentGlobalContext();
5110     }
5111 }
5112 
GL_InvalidateSubFramebuffer(GLenum target,GLsizei numAttachments,const GLenum * attachments,GLint x,GLint y,GLsizei width,GLsizei height)5113 void GL_APIENTRY GL_InvalidateSubFramebuffer(GLenum target,
5114                                              GLsizei numAttachments,
5115                                              const GLenum *attachments,
5116                                              GLint x,
5117                                              GLint y,
5118                                              GLsizei width,
5119                                              GLsizei height)
5120 {
5121     Context *context = GetValidGlobalContext();
5122     EVENT(context, GLInvalidateSubFramebuffer,
5123           "context = %d, target = %s, numAttachments = %d, attachments = 0x%016" PRIxPTR
5124           ", x = %d, y = %d, width = %d, height = %d",
5125           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target), numAttachments,
5126           (uintptr_t)attachments, x, y, width, height);
5127 
5128     if (context)
5129     {
5130         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5131         bool isCallValid                                      = (context->skipValidation() ||
5132                             ValidateInvalidateSubFramebuffer(
5133                                 context, angle::EntryPoint::GLInvalidateSubFramebuffer, target,
5134                                 numAttachments, attachments, x, y, width, height));
5135         if (isCallValid)
5136         {
5137             context->invalidateSubFramebuffer(target, numAttachments, attachments, x, y, width,
5138                                               height);
5139         }
5140         ANGLE_CAPTURE(InvalidateSubFramebuffer, isCallValid, context, target, numAttachments,
5141                       attachments, x, y, width, height);
5142     }
5143     else
5144     {
5145         GenerateContextLostErrorOnCurrentGlobalContext();
5146     }
5147 }
5148 
GL_InvalidateTexImage(GLuint texture,GLint level)5149 void GL_APIENTRY GL_InvalidateTexImage(GLuint texture, GLint level)
5150 {
5151     Context *context = GetValidGlobalContext();
5152     EVENT(context, GLInvalidateTexImage, "context = %d, texture = %u, level = %d", CID(context),
5153           texture, level);
5154 
5155     if (context)
5156     {
5157         TextureID texturePacked                               = PackParam<TextureID>(texture);
5158         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5159         bool isCallValid =
5160             (context->skipValidation() ||
5161              ValidateInvalidateTexImage(context, angle::EntryPoint::GLInvalidateTexImage,
5162                                         texturePacked, level));
5163         if (isCallValid)
5164         {
5165             context->invalidateTexImage(texturePacked, level);
5166         }
5167         ANGLE_CAPTURE(InvalidateTexImage, isCallValid, context, texturePacked, level);
5168     }
5169     else
5170     {
5171         GenerateContextLostErrorOnCurrentGlobalContext();
5172     }
5173 }
5174 
GL_InvalidateTexSubImage(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth)5175 void GL_APIENTRY GL_InvalidateTexSubImage(GLuint texture,
5176                                           GLint level,
5177                                           GLint xoffset,
5178                                           GLint yoffset,
5179                                           GLint zoffset,
5180                                           GLsizei width,
5181                                           GLsizei height,
5182                                           GLsizei depth)
5183 {
5184     Context *context = GetValidGlobalContext();
5185     EVENT(context, GLInvalidateTexSubImage,
5186           "context = %d, texture = %u, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width "
5187           "= %d, height = %d, depth = %d",
5188           CID(context), texture, level, xoffset, yoffset, zoffset, width, height, depth);
5189 
5190     if (context)
5191     {
5192         TextureID texturePacked                               = PackParam<TextureID>(texture);
5193         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5194         bool isCallValid                                      = (context->skipValidation() ||
5195                             ValidateInvalidateTexSubImage(
5196                                 context, angle::EntryPoint::GLInvalidateTexSubImage, texturePacked,
5197                                 level, xoffset, yoffset, zoffset, width, height, depth));
5198         if (isCallValid)
5199         {
5200             context->invalidateTexSubImage(texturePacked, level, xoffset, yoffset, zoffset, width,
5201                                            height, depth);
5202         }
5203         ANGLE_CAPTURE(InvalidateTexSubImage, isCallValid, context, texturePacked, level, xoffset,
5204                       yoffset, zoffset, width, height, depth);
5205     }
5206     else
5207     {
5208         GenerateContextLostErrorOnCurrentGlobalContext();
5209     }
5210 }
5211 
GL_MultiDrawArraysIndirect(GLenum mode,const void * indirect,GLsizei drawcount,GLsizei stride)5212 void GL_APIENTRY GL_MultiDrawArraysIndirect(GLenum mode,
5213                                             const void *indirect,
5214                                             GLsizei drawcount,
5215                                             GLsizei stride)
5216 {
5217     Context *context = GetValidGlobalContext();
5218     EVENT(context, GLMultiDrawArraysIndirect,
5219           "context = %d, mode = %s, indirect = 0x%016" PRIxPTR ", drawcount = %d, stride = %d",
5220           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), (uintptr_t)indirect,
5221           drawcount, stride);
5222 
5223     if (context)
5224     {
5225         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5226         bool isCallValid =
5227             (context->skipValidation() ||
5228              ValidateMultiDrawArraysIndirect(context, angle::EntryPoint::GLMultiDrawArraysIndirect,
5229                                              mode, indirect, drawcount, stride));
5230         if (isCallValid)
5231         {
5232             context->multiDrawArraysIndirect(mode, indirect, drawcount, stride);
5233         }
5234         ANGLE_CAPTURE(MultiDrawArraysIndirect, isCallValid, context, mode, indirect, drawcount,
5235                       stride);
5236     }
5237     else
5238     {
5239         GenerateContextLostErrorOnCurrentGlobalContext();
5240     }
5241 }
5242 
GL_MultiDrawElementsIndirect(GLenum mode,GLenum type,const void * indirect,GLsizei drawcount,GLsizei stride)5243 void GL_APIENTRY GL_MultiDrawElementsIndirect(GLenum mode,
5244                                               GLenum type,
5245                                               const void *indirect,
5246                                               GLsizei drawcount,
5247                                               GLsizei stride)
5248 {
5249     Context *context = GetValidGlobalContext();
5250     EVENT(context, GLMultiDrawElementsIndirect,
5251           "context = %d, mode = %s, type = %s, indirect = 0x%016" PRIxPTR
5252           ", drawcount = %d, stride = %d",
5253           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode),
5254           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indirect, drawcount,
5255           stride);
5256 
5257     if (context)
5258     {
5259         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5260         bool isCallValid                                      = (context->skipValidation() ||
5261                             ValidateMultiDrawElementsIndirect(
5262                                 context, angle::EntryPoint::GLMultiDrawElementsIndirect, mode, type,
5263                                 indirect, drawcount, stride));
5264         if (isCallValid)
5265         {
5266             context->multiDrawElementsIndirect(mode, type, indirect, drawcount, stride);
5267         }
5268         ANGLE_CAPTURE(MultiDrawElementsIndirect, isCallValid, context, mode, type, indirect,
5269                       drawcount, stride);
5270     }
5271     else
5272     {
5273         GenerateContextLostErrorOnCurrentGlobalContext();
5274     }
5275 }
5276 
GL_ObjectLabel(GLenum identifier,GLuint name,GLsizei length,const GLchar * label)5277 void GL_APIENTRY GL_ObjectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label)
5278 {
5279     Context *context = GetValidGlobalContext();
5280     EVENT(context, GLObjectLabel,
5281           "context = %d, identifier = %s, name = %u, length = %d, label = 0x%016" PRIxPTR "",
5282           CID(context), GLenumToString(GLenumGroup::ObjectIdentifier, identifier), name, length,
5283           (uintptr_t)label);
5284 
5285     if (context)
5286     {
5287         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5288         bool isCallValid                                      = (context->skipValidation() ||
5289                             ValidateObjectLabel(context, angle::EntryPoint::GLObjectLabel,
5290                                                 identifier, name, length, label));
5291         if (isCallValid)
5292         {
5293             context->objectLabel(identifier, name, length, label);
5294         }
5295         ANGLE_CAPTURE(ObjectLabel, isCallValid, context, identifier, name, length, label);
5296     }
5297     else
5298     {
5299         GenerateContextLostErrorOnCurrentGlobalContext();
5300     }
5301 }
5302 
GL_ObjectPtrLabel(const void * ptr,GLsizei length,const GLchar * label)5303 void GL_APIENTRY GL_ObjectPtrLabel(const void *ptr, GLsizei length, const GLchar *label)
5304 {
5305     Context *context = GetValidGlobalContext();
5306     EVENT(context, GLObjectPtrLabel,
5307           "context = %d, ptr = 0x%016" PRIxPTR ", length = %d, label = 0x%016" PRIxPTR "",
5308           CID(context), (uintptr_t)ptr, length, (uintptr_t)label);
5309 
5310     if (context)
5311     {
5312         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5313         bool isCallValid                                      = (context->skipValidation() ||
5314                             ValidateObjectPtrLabel(context, angle::EntryPoint::GLObjectPtrLabel,
5315                                                    ptr, length, label));
5316         if (isCallValid)
5317         {
5318             context->objectPtrLabel(ptr, length, label);
5319         }
5320         ANGLE_CAPTURE(ObjectPtrLabel, isCallValid, context, ptr, length, label);
5321     }
5322     else
5323     {
5324         GenerateContextLostErrorOnCurrentGlobalContext();
5325     }
5326 }
5327 
GL_PopDebugGroup()5328 void GL_APIENTRY GL_PopDebugGroup()
5329 {
5330     Context *context = GetValidGlobalContext();
5331     EVENT(context, GLPopDebugGroup, "context = %d", CID(context));
5332 
5333     if (context)
5334     {
5335         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5336         bool isCallValid                                      = (context->skipValidation() ||
5337                             ValidatePopDebugGroup(context, angle::EntryPoint::GLPopDebugGroup));
5338         if (isCallValid)
5339         {
5340             context->popDebugGroup();
5341         }
5342         ANGLE_CAPTURE(PopDebugGroup, isCallValid, context);
5343     }
5344     else
5345     {
5346         GenerateContextLostErrorOnCurrentGlobalContext();
5347     }
5348 }
5349 
GL_PushDebugGroup(GLenum source,GLuint id,GLsizei length,const GLchar * message)5350 void GL_APIENTRY GL_PushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message)
5351 {
5352     Context *context = GetValidGlobalContext();
5353     EVENT(context, GLPushDebugGroup,
5354           "context = %d, source = %s, id = %u, length = %d, message = 0x%016" PRIxPTR "",
5355           CID(context), GLenumToString(GLenumGroup::DebugSource, source), id, length,
5356           (uintptr_t)message);
5357 
5358     if (context)
5359     {
5360         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5361         bool isCallValid                                      = (context->skipValidation() ||
5362                             ValidatePushDebugGroup(context, angle::EntryPoint::GLPushDebugGroup,
5363                                                    source, id, length, message));
5364         if (isCallValid)
5365         {
5366             context->pushDebugGroup(source, id, length, message);
5367         }
5368         ANGLE_CAPTURE(PushDebugGroup, isCallValid, context, source, id, length, message);
5369     }
5370     else
5371     {
5372         GenerateContextLostErrorOnCurrentGlobalContext();
5373     }
5374 }
5375 
GL_ShaderStorageBlockBinding(GLuint program,GLuint storageBlockIndex,GLuint storageBlockBinding)5376 void GL_APIENTRY GL_ShaderStorageBlockBinding(GLuint program,
5377                                               GLuint storageBlockIndex,
5378                                               GLuint storageBlockBinding)
5379 {
5380     Context *context = GetValidGlobalContext();
5381     EVENT(context, GLShaderStorageBlockBinding,
5382           "context = %d, program = %u, storageBlockIndex = %u, storageBlockBinding = %u",
5383           CID(context), program, storageBlockIndex, storageBlockBinding);
5384 
5385     if (context)
5386     {
5387         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
5388         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5389         bool isCallValid                                      = (context->skipValidation() ||
5390                             ValidateShaderStorageBlockBinding(
5391                                 context, angle::EntryPoint::GLShaderStorageBlockBinding,
5392                                 programPacked, storageBlockIndex, storageBlockBinding));
5393         if (isCallValid)
5394         {
5395             context->shaderStorageBlockBinding(programPacked, storageBlockIndex,
5396                                                storageBlockBinding);
5397         }
5398         ANGLE_CAPTURE(ShaderStorageBlockBinding, isCallValid, context, programPacked,
5399                       storageBlockIndex, storageBlockBinding);
5400     }
5401     else
5402     {
5403         GenerateContextLostErrorOnCurrentGlobalContext();
5404     }
5405 }
5406 
GL_TexBufferRange(GLenum target,GLenum internalformat,GLuint buffer,GLintptr offset,GLsizeiptr size)5407 void GL_APIENTRY GL_TexBufferRange(GLenum target,
5408                                    GLenum internalformat,
5409                                    GLuint buffer,
5410                                    GLintptr offset,
5411                                    GLsizeiptr size)
5412 {
5413     Context *context = GetValidGlobalContext();
5414     EVENT(context, GLTexBufferRange,
5415           "context = %d, target = %s, internalformat = %s, buffer = %u, offset = %llu, size = %llu",
5416           CID(context), GLenumToString(GLenumGroup::TextureTarget, target),
5417           GLenumToString(GLenumGroup::InternalFormat, internalformat), buffer,
5418           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size));
5419 
5420     if (context)
5421     {
5422         TextureType targetPacked                              = PackParam<TextureType>(target);
5423         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
5424         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5425         bool isCallValid =
5426             (context->skipValidation() ||
5427              ValidateTexBufferRange(context, angle::EntryPoint::GLTexBufferRange, targetPacked,
5428                                     internalformat, bufferPacked, offset, size));
5429         if (isCallValid)
5430         {
5431             context->texBufferRange(targetPacked, internalformat, bufferPacked, offset, size);
5432         }
5433         ANGLE_CAPTURE(TexBufferRange, isCallValid, context, targetPacked, internalformat,
5434                       bufferPacked, offset, size);
5435     }
5436     else
5437     {
5438         GenerateContextLostErrorOnCurrentGlobalContext();
5439     }
5440 }
5441 
GL_TexStorage2DMultisample(GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height,GLboolean fixedsamplelocations)5442 void GL_APIENTRY GL_TexStorage2DMultisample(GLenum target,
5443                                             GLsizei samples,
5444                                             GLenum internalformat,
5445                                             GLsizei width,
5446                                             GLsizei height,
5447                                             GLboolean fixedsamplelocations)
5448 {
5449     Context *context = GetValidGlobalContext();
5450     EVENT(context, GLTexStorage2DMultisample,
5451           "context = %d, target = %s, samples = %d, internalformat = %s, width = %d, height = %d, "
5452           "fixedsamplelocations = %s",
5453           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), samples,
5454           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height,
5455           GLbooleanToString(fixedsamplelocations));
5456 
5457     if (context)
5458     {
5459         TextureType targetPacked                              = PackParam<TextureType>(target);
5460         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5461         bool isCallValid                                      = (context->skipValidation() ||
5462                             ValidateTexStorage2DMultisample(
5463                                 context, angle::EntryPoint::GLTexStorage2DMultisample, targetPacked,
5464                                 samples, internalformat, width, height, fixedsamplelocations));
5465         if (isCallValid)
5466         {
5467             context->texStorage2DMultisample(targetPacked, samples, internalformat, width, height,
5468                                              fixedsamplelocations);
5469         }
5470         ANGLE_CAPTURE(TexStorage2DMultisample, isCallValid, context, targetPacked, samples,
5471                       internalformat, width, height, fixedsamplelocations);
5472     }
5473     else
5474     {
5475         GenerateContextLostErrorOnCurrentGlobalContext();
5476     }
5477 }
5478 
GL_TexStorage3DMultisample(GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLboolean fixedsamplelocations)5479 void GL_APIENTRY GL_TexStorage3DMultisample(GLenum target,
5480                                             GLsizei samples,
5481                                             GLenum internalformat,
5482                                             GLsizei width,
5483                                             GLsizei height,
5484                                             GLsizei depth,
5485                                             GLboolean fixedsamplelocations)
5486 {
5487     Context *context = GetValidGlobalContext();
5488     EVENT(context, GLTexStorage3DMultisample,
5489           "context = %d, target = %s, samples = %d, internalformat = %s, width = %d, height = %d, "
5490           "depth = %d, fixedsamplelocations = %s",
5491           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), samples,
5492           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height, depth,
5493           GLbooleanToString(fixedsamplelocations));
5494 
5495     if (context)
5496     {
5497         TextureType targetPacked                              = PackParam<TextureType>(target);
5498         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5499         bool isCallValid =
5500             (context->skipValidation() ||
5501              ValidateTexStorage3DMultisample(context, angle::EntryPoint::GLTexStorage3DMultisample,
5502                                              targetPacked, samples, internalformat, width, height,
5503                                              depth, fixedsamplelocations));
5504         if (isCallValid)
5505         {
5506             context->texStorage3DMultisample(targetPacked, samples, internalformat, width, height,
5507                                              depth, fixedsamplelocations);
5508         }
5509         ANGLE_CAPTURE(TexStorage3DMultisample, isCallValid, context, targetPacked, samples,
5510                       internalformat, width, height, depth, fixedsamplelocations);
5511     }
5512     else
5513     {
5514         GenerateContextLostErrorOnCurrentGlobalContext();
5515     }
5516 }
5517 
GL_TextureView(GLuint texture,GLenum target,GLuint origtexture,GLenum internalformat,GLuint minlevel,GLuint numlevels,GLuint minlayer,GLuint numlayers)5518 void GL_APIENTRY GL_TextureView(GLuint texture,
5519                                 GLenum target,
5520                                 GLuint origtexture,
5521                                 GLenum internalformat,
5522                                 GLuint minlevel,
5523                                 GLuint numlevels,
5524                                 GLuint minlayer,
5525                                 GLuint numlayers)
5526 {
5527     Context *context = GetValidGlobalContext();
5528     EVENT(context, GLTextureView,
5529           "context = %d, texture = %u, target = %s, origtexture = %u, internalformat = %s, "
5530           "minlevel = %u, numlevels = %u, minlayer = %u, numlayers = %u",
5531           CID(context), texture, GLenumToString(GLenumGroup::TextureTarget, target), origtexture,
5532           GLenumToString(GLenumGroup::InternalFormat, internalformat), minlevel, numlevels,
5533           minlayer, numlayers);
5534 
5535     if (context)
5536     {
5537         TextureID texturePacked                               = PackParam<TextureID>(texture);
5538         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5539         bool isCallValid                                      = (context->skipValidation() ||
5540                             ValidateTextureView(context, angle::EntryPoint::GLTextureView,
5541                                                 texturePacked, target, origtexture, internalformat,
5542                                                 minlevel, numlevels, minlayer, numlayers));
5543         if (isCallValid)
5544         {
5545             context->textureView(texturePacked, target, origtexture, internalformat, minlevel,
5546                                  numlevels, minlayer, numlayers);
5547         }
5548         ANGLE_CAPTURE(TextureView, isCallValid, context, texturePacked, target, origtexture,
5549                       internalformat, minlevel, numlevels, minlayer, numlayers);
5550     }
5551     else
5552     {
5553         GenerateContextLostErrorOnCurrentGlobalContext();
5554     }
5555 }
5556 
GL_VertexAttribBinding(GLuint attribindex,GLuint bindingindex)5557 void GL_APIENTRY GL_VertexAttribBinding(GLuint attribindex, GLuint bindingindex)
5558 {
5559     Context *context = GetValidGlobalContext();
5560     EVENT(context, GLVertexAttribBinding, "context = %d, attribindex = %u, bindingindex = %u",
5561           CID(context), attribindex, bindingindex);
5562 
5563     if (context)
5564     {
5565         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5566         bool isCallValid =
5567             (context->skipValidation() ||
5568              ValidateVertexAttribBinding(context, angle::EntryPoint::GLVertexAttribBinding,
5569                                          attribindex, bindingindex));
5570         if (isCallValid)
5571         {
5572             context->vertexAttribBinding(attribindex, bindingindex);
5573         }
5574         ANGLE_CAPTURE(VertexAttribBinding, isCallValid, context, attribindex, bindingindex);
5575     }
5576     else
5577     {
5578         GenerateContextLostErrorOnCurrentGlobalContext();
5579     }
5580 }
5581 
GL_VertexAttribFormat(GLuint attribindex,GLint size,GLenum type,GLboolean normalized,GLuint relativeoffset)5582 void GL_APIENTRY GL_VertexAttribFormat(GLuint attribindex,
5583                                        GLint size,
5584                                        GLenum type,
5585                                        GLboolean normalized,
5586                                        GLuint relativeoffset)
5587 {
5588     Context *context = GetValidGlobalContext();
5589     EVENT(context, GLVertexAttribFormat,
5590           "context = %d, attribindex = %u, size = %d, type = %s, normalized = %s, relativeoffset = "
5591           "%u",
5592           CID(context), attribindex, size, GLenumToString(GLenumGroup::DefaultGroup, type),
5593           GLbooleanToString(normalized), relativeoffset);
5594 
5595     if (context)
5596     {
5597         VertexAttribType typePacked                           = PackParam<VertexAttribType>(type);
5598         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5599         bool isCallValid =
5600             (context->skipValidation() ||
5601              ValidateVertexAttribFormat(context, angle::EntryPoint::GLVertexAttribFormat,
5602                                         attribindex, size, typePacked, normalized, relativeoffset));
5603         if (isCallValid)
5604         {
5605             context->vertexAttribFormat(attribindex, size, typePacked, normalized, relativeoffset);
5606         }
5607         ANGLE_CAPTURE(VertexAttribFormat, isCallValid, context, attribindex, size, typePacked,
5608                       normalized, relativeoffset);
5609     }
5610     else
5611     {
5612         GenerateContextLostErrorOnCurrentGlobalContext();
5613     }
5614 }
5615 
GL_VertexAttribIFormat(GLuint attribindex,GLint size,GLenum type,GLuint relativeoffset)5616 void GL_APIENTRY GL_VertexAttribIFormat(GLuint attribindex,
5617                                         GLint size,
5618                                         GLenum type,
5619                                         GLuint relativeoffset)
5620 {
5621     Context *context = GetValidGlobalContext();
5622     EVENT(context, GLVertexAttribIFormat,
5623           "context = %d, attribindex = %u, size = %d, type = %s, relativeoffset = %u", CID(context),
5624           attribindex, size, GLenumToString(GLenumGroup::DefaultGroup, type), relativeoffset);
5625 
5626     if (context)
5627     {
5628         VertexAttribType typePacked                           = PackParam<VertexAttribType>(type);
5629         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5630         bool isCallValid =
5631             (context->skipValidation() ||
5632              ValidateVertexAttribIFormat(context, angle::EntryPoint::GLVertexAttribIFormat,
5633                                          attribindex, size, typePacked, relativeoffset));
5634         if (isCallValid)
5635         {
5636             context->vertexAttribIFormat(attribindex, size, typePacked, relativeoffset);
5637         }
5638         ANGLE_CAPTURE(VertexAttribIFormat, isCallValid, context, attribindex, size, typePacked,
5639                       relativeoffset);
5640     }
5641     else
5642     {
5643         GenerateContextLostErrorOnCurrentGlobalContext();
5644     }
5645 }
5646 
GL_VertexAttribLFormat(GLuint attribindex,GLint size,GLenum type,GLuint relativeoffset)5647 void GL_APIENTRY GL_VertexAttribLFormat(GLuint attribindex,
5648                                         GLint size,
5649                                         GLenum type,
5650                                         GLuint relativeoffset)
5651 {
5652     Context *context = GetValidGlobalContext();
5653     EVENT(context, GLVertexAttribLFormat,
5654           "context = %d, attribindex = %u, size = %d, type = %s, relativeoffset = %u", CID(context),
5655           attribindex, size, GLenumToString(GLenumGroup::VertexAttribType, type), relativeoffset);
5656 
5657     if (context)
5658     {
5659         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5660         bool isCallValid =
5661             (context->skipValidation() ||
5662              ValidateVertexAttribLFormat(context, angle::EntryPoint::GLVertexAttribLFormat,
5663                                          attribindex, size, type, relativeoffset));
5664         if (isCallValid)
5665         {
5666             context->vertexAttribLFormat(attribindex, size, type, relativeoffset);
5667         }
5668         ANGLE_CAPTURE(VertexAttribLFormat, isCallValid, context, attribindex, size, type,
5669                       relativeoffset);
5670     }
5671     else
5672     {
5673         GenerateContextLostErrorOnCurrentGlobalContext();
5674     }
5675 }
5676 
GL_VertexBindingDivisor(GLuint bindingindex,GLuint divisor)5677 void GL_APIENTRY GL_VertexBindingDivisor(GLuint bindingindex, GLuint divisor)
5678 {
5679     Context *context = GetValidGlobalContext();
5680     EVENT(context, GLVertexBindingDivisor, "context = %d, bindingindex = %u, divisor = %u",
5681           CID(context), bindingindex, divisor);
5682 
5683     if (context)
5684     {
5685         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5686         bool isCallValid =
5687             (context->skipValidation() ||
5688              ValidateVertexBindingDivisor(context, angle::EntryPoint::GLVertexBindingDivisor,
5689                                           bindingindex, divisor));
5690         if (isCallValid)
5691         {
5692             context->vertexBindingDivisor(bindingindex, divisor);
5693         }
5694         ANGLE_CAPTURE(VertexBindingDivisor, isCallValid, context, bindingindex, divisor);
5695     }
5696     else
5697     {
5698         GenerateContextLostErrorOnCurrentGlobalContext();
5699     }
5700 }
5701 
5702 // GL 4.4
GL_BindBuffersBase(GLenum target,GLuint first,GLsizei count,const GLuint * buffers)5703 void GL_APIENTRY GL_BindBuffersBase(GLenum target,
5704                                     GLuint first,
5705                                     GLsizei count,
5706                                     const GLuint *buffers)
5707 {
5708     Context *context = GetValidGlobalContext();
5709     EVENT(context, GLBindBuffersBase,
5710           "context = %d, target = %s, first = %u, count = %d, buffers = 0x%016" PRIxPTR "",
5711           CID(context), GLenumToString(GLenumGroup::BufferTargetARB, target), first, count,
5712           (uintptr_t)buffers);
5713 
5714     if (context)
5715     {
5716         const BufferID *buffersPacked = PackParam<const BufferID *>(buffers);
5717         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5718         bool isCallValid                                      = (context->skipValidation() ||
5719                             ValidateBindBuffersBase(context, angle::EntryPoint::GLBindBuffersBase,
5720                                                     target, first, count, buffersPacked));
5721         if (isCallValid)
5722         {
5723             context->bindBuffersBase(target, first, count, buffersPacked);
5724         }
5725         ANGLE_CAPTURE(BindBuffersBase, isCallValid, context, target, first, count, buffersPacked);
5726     }
5727     else
5728     {
5729         GenerateContextLostErrorOnCurrentGlobalContext();
5730     }
5731 }
5732 
GL_BindBuffersRange(GLenum target,GLuint first,GLsizei count,const GLuint * buffers,const GLintptr * offsets,const GLsizeiptr * sizes)5733 void GL_APIENTRY GL_BindBuffersRange(GLenum target,
5734                                      GLuint first,
5735                                      GLsizei count,
5736                                      const GLuint *buffers,
5737                                      const GLintptr *offsets,
5738                                      const GLsizeiptr *sizes)
5739 {
5740     Context *context = GetValidGlobalContext();
5741     EVENT(context, GLBindBuffersRange,
5742           "context = %d, target = %s, first = %u, count = %d, buffers = 0x%016" PRIxPTR
5743           ", offsets = 0x%016" PRIxPTR ", sizes = 0x%016" PRIxPTR "",
5744           CID(context), GLenumToString(GLenumGroup::BufferTargetARB, target), first, count,
5745           (uintptr_t)buffers, (uintptr_t)offsets, (uintptr_t)sizes);
5746 
5747     if (context)
5748     {
5749         const BufferID *buffersPacked = PackParam<const BufferID *>(buffers);
5750         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5751         bool isCallValid =
5752             (context->skipValidation() ||
5753              ValidateBindBuffersRange(context, angle::EntryPoint::GLBindBuffersRange, target, first,
5754                                       count, buffersPacked, offsets, sizes));
5755         if (isCallValid)
5756         {
5757             context->bindBuffersRange(target, first, count, buffersPacked, offsets, sizes);
5758         }
5759         ANGLE_CAPTURE(BindBuffersRange, isCallValid, context, target, first, count, buffersPacked,
5760                       offsets, sizes);
5761     }
5762     else
5763     {
5764         GenerateContextLostErrorOnCurrentGlobalContext();
5765     }
5766 }
5767 
GL_BindImageTextures(GLuint first,GLsizei count,const GLuint * textures)5768 void GL_APIENTRY GL_BindImageTextures(GLuint first, GLsizei count, const GLuint *textures)
5769 {
5770     Context *context = GetValidGlobalContext();
5771     EVENT(context, GLBindImageTextures,
5772           "context = %d, first = %u, count = %d, textures = 0x%016" PRIxPTR "", CID(context), first,
5773           count, (uintptr_t)textures);
5774 
5775     if (context)
5776     {
5777         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5778         bool isCallValid =
5779             (context->skipValidation() ||
5780              ValidateBindImageTextures(context, angle::EntryPoint::GLBindImageTextures, first,
5781                                        count, textures));
5782         if (isCallValid)
5783         {
5784             context->bindImageTextures(first, count, textures);
5785         }
5786         ANGLE_CAPTURE(BindImageTextures, isCallValid, context, first, count, textures);
5787     }
5788     else
5789     {
5790         GenerateContextLostErrorOnCurrentGlobalContext();
5791     }
5792 }
5793 
GL_BindSamplers(GLuint first,GLsizei count,const GLuint * samplers)5794 void GL_APIENTRY GL_BindSamplers(GLuint first, GLsizei count, const GLuint *samplers)
5795 {
5796     Context *context = GetValidGlobalContext();
5797     EVENT(context, GLBindSamplers,
5798           "context = %d, first = %u, count = %d, samplers = 0x%016" PRIxPTR "", CID(context), first,
5799           count, (uintptr_t)samplers);
5800 
5801     if (context)
5802     {
5803         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5804         bool isCallValid                                      = (context->skipValidation() ||
5805                             ValidateBindSamplers(context, angle::EntryPoint::GLBindSamplers, first,
5806                                                  count, samplers));
5807         if (isCallValid)
5808         {
5809             context->bindSamplers(first, count, samplers);
5810         }
5811         ANGLE_CAPTURE(BindSamplers, isCallValid, context, first, count, samplers);
5812     }
5813     else
5814     {
5815         GenerateContextLostErrorOnCurrentGlobalContext();
5816     }
5817 }
5818 
GL_BindTextures(GLuint first,GLsizei count,const GLuint * textures)5819 void GL_APIENTRY GL_BindTextures(GLuint first, GLsizei count, const GLuint *textures)
5820 {
5821     Context *context = GetValidGlobalContext();
5822     EVENT(context, GLBindTextures,
5823           "context = %d, first = %u, count = %d, textures = 0x%016" PRIxPTR "", CID(context), first,
5824           count, (uintptr_t)textures);
5825 
5826     if (context)
5827     {
5828         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5829         bool isCallValid                                      = (context->skipValidation() ||
5830                             ValidateBindTextures(context, angle::EntryPoint::GLBindTextures, first,
5831                                                  count, textures));
5832         if (isCallValid)
5833         {
5834             context->bindTextures(first, count, textures);
5835         }
5836         ANGLE_CAPTURE(BindTextures, isCallValid, context, first, count, textures);
5837     }
5838     else
5839     {
5840         GenerateContextLostErrorOnCurrentGlobalContext();
5841     }
5842 }
5843 
GL_BindVertexBuffers(GLuint first,GLsizei count,const GLuint * buffers,const GLintptr * offsets,const GLsizei * strides)5844 void GL_APIENTRY GL_BindVertexBuffers(GLuint first,
5845                                       GLsizei count,
5846                                       const GLuint *buffers,
5847                                       const GLintptr *offsets,
5848                                       const GLsizei *strides)
5849 {
5850     Context *context = GetValidGlobalContext();
5851     EVENT(context, GLBindVertexBuffers,
5852           "context = %d, first = %u, count = %d, buffers = 0x%016" PRIxPTR
5853           ", offsets = 0x%016" PRIxPTR ", strides = 0x%016" PRIxPTR "",
5854           CID(context), first, count, (uintptr_t)buffers, (uintptr_t)offsets, (uintptr_t)strides);
5855 
5856     if (context)
5857     {
5858         const BufferID *buffersPacked = PackParam<const BufferID *>(buffers);
5859         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5860         bool isCallValid =
5861             (context->skipValidation() ||
5862              ValidateBindVertexBuffers(context, angle::EntryPoint::GLBindVertexBuffers, first,
5863                                        count, buffersPacked, offsets, strides));
5864         if (isCallValid)
5865         {
5866             context->bindVertexBuffers(first, count, buffersPacked, offsets, strides);
5867         }
5868         ANGLE_CAPTURE(BindVertexBuffers, isCallValid, context, first, count, buffersPacked, offsets,
5869                       strides);
5870     }
5871     else
5872     {
5873         GenerateContextLostErrorOnCurrentGlobalContext();
5874     }
5875 }
5876 
GL_BufferStorage(GLenum target,GLsizeiptr size,const void * data,GLbitfield flags)5877 void GL_APIENTRY GL_BufferStorage(GLenum target,
5878                                   GLsizeiptr size,
5879                                   const void *data,
5880                                   GLbitfield flags)
5881 {
5882     Context *context = GetValidGlobalContext();
5883     EVENT(context, GLBufferStorage,
5884           "context = %d, target = %s, size = %llu, data = 0x%016" PRIxPTR ", flags = %s",
5885           CID(context), GLenumToString(GLenumGroup::BufferStorageTarget, target),
5886           static_cast<unsigned long long>(size), (uintptr_t)data,
5887           GLbitfieldToString(GLenumGroup::MapBufferUsageMask, flags).c_str());
5888 
5889     if (context)
5890     {
5891         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
5892         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5893         bool isCallValid                                      = (context->skipValidation() ||
5894                             ValidateBufferStorage(context, angle::EntryPoint::GLBufferStorage,
5895                                                   targetPacked, size, data, flags));
5896         if (isCallValid)
5897         {
5898             context->bufferStorage(targetPacked, size, data, flags);
5899         }
5900         ANGLE_CAPTURE(BufferStorage, isCallValid, context, targetPacked, size, data, flags);
5901     }
5902     else
5903     {
5904         GenerateContextLostErrorOnCurrentGlobalContext();
5905     }
5906 }
5907 
5908 void GL_APIENTRY
GL_ClearTexImage(GLuint texture,GLint level,GLenum format,GLenum type,const void * data)5909 GL_ClearTexImage(GLuint texture, GLint level, GLenum format, GLenum type, const void *data)
5910 {
5911     Context *context = GetValidGlobalContext();
5912     EVENT(context, GLClearTexImage,
5913           "context = %d, texture = %u, level = %d, format = %s, type = %s, data = 0x%016" PRIxPTR
5914           "",
5915           CID(context), texture, level, GLenumToString(GLenumGroup::PixelFormat, format),
5916           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)data);
5917 
5918     if (context)
5919     {
5920         TextureID texturePacked                               = PackParam<TextureID>(texture);
5921         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5922         bool isCallValid                                      = (context->skipValidation() ||
5923                             ValidateClearTexImage(context, angle::EntryPoint::GLClearTexImage,
5924                                                   texturePacked, level, format, type, data));
5925         if (isCallValid)
5926         {
5927             context->clearTexImage(texturePacked, level, format, type, data);
5928         }
5929         ANGLE_CAPTURE(ClearTexImage, isCallValid, context, texturePacked, level, format, type,
5930                       data);
5931     }
5932     else
5933     {
5934         GenerateContextLostErrorOnCurrentGlobalContext();
5935     }
5936 }
5937 
GL_ClearTexSubImage(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLenum type,const void * data)5938 void GL_APIENTRY GL_ClearTexSubImage(GLuint texture,
5939                                      GLint level,
5940                                      GLint xoffset,
5941                                      GLint yoffset,
5942                                      GLint zoffset,
5943                                      GLsizei width,
5944                                      GLsizei height,
5945                                      GLsizei depth,
5946                                      GLenum format,
5947                                      GLenum type,
5948                                      const void *data)
5949 {
5950     Context *context = GetValidGlobalContext();
5951     EVENT(context, GLClearTexSubImage,
5952           "context = %d, texture = %u, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width "
5953           "= %d, height = %d, depth = %d, format = %s, type = %s, data = 0x%016" PRIxPTR "",
5954           CID(context), texture, level, xoffset, yoffset, zoffset, width, height, depth,
5955           GLenumToString(GLenumGroup::PixelFormat, format),
5956           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)data);
5957 
5958     if (context)
5959     {
5960         TextureID texturePacked                               = PackParam<TextureID>(texture);
5961         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5962         bool isCallValid =
5963             (context->skipValidation() ||
5964              ValidateClearTexSubImage(context, angle::EntryPoint::GLClearTexSubImage, texturePacked,
5965                                       level, xoffset, yoffset, zoffset, width, height, depth,
5966                                       format, type, data));
5967         if (isCallValid)
5968         {
5969             context->clearTexSubImage(texturePacked, level, xoffset, yoffset, zoffset, width,
5970                                       height, depth, format, type, data);
5971         }
5972         ANGLE_CAPTURE(ClearTexSubImage, isCallValid, context, texturePacked, level, xoffset,
5973                       yoffset, zoffset, width, height, depth, format, type, data);
5974     }
5975     else
5976     {
5977         GenerateContextLostErrorOnCurrentGlobalContext();
5978     }
5979 }
5980 
5981 // GL 4.5
GL_BindTextureUnit(GLuint unit,GLuint texture)5982 void GL_APIENTRY GL_BindTextureUnit(GLuint unit, GLuint texture)
5983 {
5984     Context *context = GetValidGlobalContext();
5985     EVENT(context, GLBindTextureUnit, "context = %d, unit = %u, texture = %u", CID(context), unit,
5986           texture);
5987 
5988     if (context)
5989     {
5990         TextureID texturePacked                               = PackParam<TextureID>(texture);
5991         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5992         bool isCallValid                                      = (context->skipValidation() ||
5993                             ValidateBindTextureUnit(context, angle::EntryPoint::GLBindTextureUnit,
5994                                                     unit, texturePacked));
5995         if (isCallValid)
5996         {
5997             context->bindTextureUnit(unit, texturePacked);
5998         }
5999         ANGLE_CAPTURE(BindTextureUnit, isCallValid, context, unit, texturePacked);
6000     }
6001     else
6002     {
6003         GenerateContextLostErrorOnCurrentGlobalContext();
6004     }
6005 }
6006 
GL_BlitNamedFramebuffer(GLuint readFramebuffer,GLuint drawFramebuffer,GLint srcX0,GLint srcY0,GLint srcX1,GLint srcY1,GLint dstX0,GLint dstY0,GLint dstX1,GLint dstY1,GLbitfield mask,GLenum filter)6007 void GL_APIENTRY GL_BlitNamedFramebuffer(GLuint readFramebuffer,
6008                                          GLuint drawFramebuffer,
6009                                          GLint srcX0,
6010                                          GLint srcY0,
6011                                          GLint srcX1,
6012                                          GLint srcY1,
6013                                          GLint dstX0,
6014                                          GLint dstY0,
6015                                          GLint dstX1,
6016                                          GLint dstY1,
6017                                          GLbitfield mask,
6018                                          GLenum filter)
6019 {
6020     Context *context = GetValidGlobalContext();
6021     EVENT(
6022         context, GLBlitNamedFramebuffer,
6023         "context = %d, readFramebuffer = %u, drawFramebuffer = %u, srcX0 = %d, srcY0 = %d, srcX1 = "
6024         "%d, srcY1 = %d, dstX0 = %d, dstY0 = %d, dstX1 = %d, dstY1 = %d, mask = %s, filter = %s",
6025         CID(context), readFramebuffer, drawFramebuffer, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0,
6026         dstX1, dstY1, GLbitfieldToString(GLenumGroup::ClearBufferMask, mask).c_str(),
6027         GLenumToString(GLenumGroup::BlitFramebufferFilter, filter));
6028 
6029     if (context)
6030     {
6031         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6032         bool isCallValid =
6033             (context->skipValidation() ||
6034              ValidateBlitNamedFramebuffer(context, angle::EntryPoint::GLBlitNamedFramebuffer,
6035                                           readFramebuffer, drawFramebuffer, srcX0, srcY0, srcX1,
6036                                           srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter));
6037         if (isCallValid)
6038         {
6039             context->blitNamedFramebuffer(readFramebuffer, drawFramebuffer, srcX0, srcY0, srcX1,
6040                                           srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
6041         }
6042         ANGLE_CAPTURE(BlitNamedFramebuffer, isCallValid, context, readFramebuffer, drawFramebuffer,
6043                       srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
6044     }
6045     else
6046     {
6047         GenerateContextLostErrorOnCurrentGlobalContext();
6048     }
6049 }
6050 
GL_CheckNamedFramebufferStatus(GLuint framebuffer,GLenum target)6051 GLenum GL_APIENTRY GL_CheckNamedFramebufferStatus(GLuint framebuffer, GLenum target)
6052 {
6053     Context *context = GetValidGlobalContext();
6054     EVENT(context, GLCheckNamedFramebufferStatus, "context = %d, framebuffer = %u, target = %s",
6055           CID(context), framebuffer, GLenumToString(GLenumGroup::FramebufferTarget, target));
6056 
6057     GLenum returnValue;
6058     if (context)
6059     {
6060         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
6061         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6062         bool isCallValid                                      = (context->skipValidation() ||
6063                             ValidateCheckNamedFramebufferStatus(
6064                                 context, angle::EntryPoint::GLCheckNamedFramebufferStatus,
6065                                 framebufferPacked, target));
6066         if (isCallValid)
6067         {
6068             returnValue = context->checkNamedFramebufferStatus(framebufferPacked, target);
6069         }
6070         else
6071         {
6072             returnValue =
6073                 GetDefaultReturnValue<angle::EntryPoint::GLCheckNamedFramebufferStatus, GLenum>();
6074         }
6075         ANGLE_CAPTURE(CheckNamedFramebufferStatus, isCallValid, context, framebufferPacked, target,
6076                       returnValue);
6077     }
6078     else
6079     {
6080         GenerateContextLostErrorOnCurrentGlobalContext();
6081         returnValue =
6082             GetDefaultReturnValue<angle::EntryPoint::GLCheckNamedFramebufferStatus, GLenum>();
6083     }
6084     return returnValue;
6085 }
6086 
GL_ClearNamedBufferData(GLuint buffer,GLenum internalformat,GLenum format,GLenum type,const void * data)6087 void GL_APIENTRY GL_ClearNamedBufferData(GLuint buffer,
6088                                          GLenum internalformat,
6089                                          GLenum format,
6090                                          GLenum type,
6091                                          const void *data)
6092 {
6093     Context *context = GetValidGlobalContext();
6094     EVENT(context, GLClearNamedBufferData,
6095           "context = %d, buffer = %u, internalformat = %s, format = %s, type = %s, data = "
6096           "0x%016" PRIxPTR "",
6097           CID(context), buffer, GLenumToString(GLenumGroup::InternalFormat, internalformat),
6098           GLenumToString(GLenumGroup::PixelFormat, format),
6099           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)data);
6100 
6101     if (context)
6102     {
6103         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
6104         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6105         bool isCallValid =
6106             (context->skipValidation() ||
6107              ValidateClearNamedBufferData(context, angle::EntryPoint::GLClearNamedBufferData,
6108                                           bufferPacked, internalformat, format, type, data));
6109         if (isCallValid)
6110         {
6111             context->clearNamedBufferData(bufferPacked, internalformat, format, type, data);
6112         }
6113         ANGLE_CAPTURE(ClearNamedBufferData, isCallValid, context, bufferPacked, internalformat,
6114                       format, type, data);
6115     }
6116     else
6117     {
6118         GenerateContextLostErrorOnCurrentGlobalContext();
6119     }
6120 }
6121 
GL_ClearNamedBufferSubData(GLuint buffer,GLenum internalformat,GLintptr offset,GLsizeiptr size,GLenum format,GLenum type,const void * data)6122 void GL_APIENTRY GL_ClearNamedBufferSubData(GLuint buffer,
6123                                             GLenum internalformat,
6124                                             GLintptr offset,
6125                                             GLsizeiptr size,
6126                                             GLenum format,
6127                                             GLenum type,
6128                                             const void *data)
6129 {
6130     Context *context = GetValidGlobalContext();
6131     EVENT(context, GLClearNamedBufferSubData,
6132           "context = %d, buffer = %u, internalformat = %s, offset = %llu, size = %llu, format = "
6133           "%s, type = %s, data = 0x%016" PRIxPTR "",
6134           CID(context), buffer, GLenumToString(GLenumGroup::InternalFormat, internalformat),
6135           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size),
6136           GLenumToString(GLenumGroup::PixelFormat, format),
6137           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)data);
6138 
6139     if (context)
6140     {
6141         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
6142         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6143         bool isCallValid                                      = (context->skipValidation() ||
6144                             ValidateClearNamedBufferSubData(
6145                                 context, angle::EntryPoint::GLClearNamedBufferSubData, bufferPacked,
6146                                 internalformat, offset, size, format, type, data));
6147         if (isCallValid)
6148         {
6149             context->clearNamedBufferSubData(bufferPacked, internalformat, offset, size, format,
6150                                              type, data);
6151         }
6152         ANGLE_CAPTURE(ClearNamedBufferSubData, isCallValid, context, bufferPacked, internalformat,
6153                       offset, size, format, type, data);
6154     }
6155     else
6156     {
6157         GenerateContextLostErrorOnCurrentGlobalContext();
6158     }
6159 }
6160 
GL_ClearNamedFramebufferfi(GLuint framebuffer,GLenum buffer,GLint drawbuffer,GLfloat depth,GLint stencil)6161 void GL_APIENTRY GL_ClearNamedFramebufferfi(GLuint framebuffer,
6162                                             GLenum buffer,
6163                                             GLint drawbuffer,
6164                                             GLfloat depth,
6165                                             GLint stencil)
6166 {
6167     Context *context = GetValidGlobalContext();
6168     EVENT(context, GLClearNamedFramebufferfi,
6169           "context = %d, framebuffer = %u, buffer = %s, drawbuffer = %d, depth = %f, stencil = %d",
6170           CID(context), framebuffer, GLenumToString(GLenumGroup::Buffer, buffer), drawbuffer, depth,
6171           stencil);
6172 
6173     if (context)
6174     {
6175         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
6176         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6177         bool isCallValid                                      = (context->skipValidation() ||
6178                             ValidateClearNamedFramebufferfi(
6179                                 context, angle::EntryPoint::GLClearNamedFramebufferfi,
6180                                 framebufferPacked, buffer, drawbuffer, depth, stencil));
6181         if (isCallValid)
6182         {
6183             context->clearNamedFramebufferfi(framebufferPacked, buffer, drawbuffer, depth, stencil);
6184         }
6185         ANGLE_CAPTURE(ClearNamedFramebufferfi, isCallValid, context, framebufferPacked, buffer,
6186                       drawbuffer, depth, stencil);
6187     }
6188     else
6189     {
6190         GenerateContextLostErrorOnCurrentGlobalContext();
6191     }
6192 }
6193 
GL_ClearNamedFramebufferfv(GLuint framebuffer,GLenum buffer,GLint drawbuffer,const GLfloat * value)6194 void GL_APIENTRY GL_ClearNamedFramebufferfv(GLuint framebuffer,
6195                                             GLenum buffer,
6196                                             GLint drawbuffer,
6197                                             const GLfloat *value)
6198 {
6199     Context *context = GetValidGlobalContext();
6200     EVENT(context, GLClearNamedFramebufferfv,
6201           "context = %d, framebuffer = %u, buffer = %s, drawbuffer = %d, value = 0x%016" PRIxPTR "",
6202           CID(context), framebuffer, GLenumToString(GLenumGroup::Buffer, buffer), drawbuffer,
6203           (uintptr_t)value);
6204 
6205     if (context)
6206     {
6207         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
6208         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6209         bool isCallValid =
6210             (context->skipValidation() ||
6211              ValidateClearNamedFramebufferfv(context, angle::EntryPoint::GLClearNamedFramebufferfv,
6212                                              framebufferPacked, buffer, drawbuffer, value));
6213         if (isCallValid)
6214         {
6215             context->clearNamedFramebufferfv(framebufferPacked, buffer, drawbuffer, value);
6216         }
6217         ANGLE_CAPTURE(ClearNamedFramebufferfv, isCallValid, context, framebufferPacked, buffer,
6218                       drawbuffer, value);
6219     }
6220     else
6221     {
6222         GenerateContextLostErrorOnCurrentGlobalContext();
6223     }
6224 }
6225 
GL_ClearNamedFramebufferiv(GLuint framebuffer,GLenum buffer,GLint drawbuffer,const GLint * value)6226 void GL_APIENTRY GL_ClearNamedFramebufferiv(GLuint framebuffer,
6227                                             GLenum buffer,
6228                                             GLint drawbuffer,
6229                                             const GLint *value)
6230 {
6231     Context *context = GetValidGlobalContext();
6232     EVENT(context, GLClearNamedFramebufferiv,
6233           "context = %d, framebuffer = %u, buffer = %s, drawbuffer = %d, value = 0x%016" PRIxPTR "",
6234           CID(context), framebuffer, GLenumToString(GLenumGroup::Buffer, buffer), drawbuffer,
6235           (uintptr_t)value);
6236 
6237     if (context)
6238     {
6239         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
6240         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6241         bool isCallValid =
6242             (context->skipValidation() ||
6243              ValidateClearNamedFramebufferiv(context, angle::EntryPoint::GLClearNamedFramebufferiv,
6244                                              framebufferPacked, buffer, drawbuffer, value));
6245         if (isCallValid)
6246         {
6247             context->clearNamedFramebufferiv(framebufferPacked, buffer, drawbuffer, value);
6248         }
6249         ANGLE_CAPTURE(ClearNamedFramebufferiv, isCallValid, context, framebufferPacked, buffer,
6250                       drawbuffer, value);
6251     }
6252     else
6253     {
6254         GenerateContextLostErrorOnCurrentGlobalContext();
6255     }
6256 }
6257 
GL_ClearNamedFramebufferuiv(GLuint framebuffer,GLenum buffer,GLint drawbuffer,const GLuint * value)6258 void GL_APIENTRY GL_ClearNamedFramebufferuiv(GLuint framebuffer,
6259                                              GLenum buffer,
6260                                              GLint drawbuffer,
6261                                              const GLuint *value)
6262 {
6263     Context *context = GetValidGlobalContext();
6264     EVENT(context, GLClearNamedFramebufferuiv,
6265           "context = %d, framebuffer = %u, buffer = %s, drawbuffer = %d, value = 0x%016" PRIxPTR "",
6266           CID(context), framebuffer, GLenumToString(GLenumGroup::Buffer, buffer), drawbuffer,
6267           (uintptr_t)value);
6268 
6269     if (context)
6270     {
6271         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
6272         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6273         bool isCallValid                                      = (context->skipValidation() ||
6274                             ValidateClearNamedFramebufferuiv(
6275                                 context, angle::EntryPoint::GLClearNamedFramebufferuiv,
6276                                 framebufferPacked, buffer, drawbuffer, value));
6277         if (isCallValid)
6278         {
6279             context->clearNamedFramebufferuiv(framebufferPacked, buffer, drawbuffer, value);
6280         }
6281         ANGLE_CAPTURE(ClearNamedFramebufferuiv, isCallValid, context, framebufferPacked, buffer,
6282                       drawbuffer, value);
6283     }
6284     else
6285     {
6286         GenerateContextLostErrorOnCurrentGlobalContext();
6287     }
6288 }
6289 
GL_ClipControl(GLenum origin,GLenum depth)6290 void GL_APIENTRY GL_ClipControl(GLenum origin, GLenum depth)
6291 {
6292     Context *context = GetValidGlobalContext();
6293     EVENT(context, GLClipControl, "context = %d, origin = %s, depth = %s", CID(context),
6294           GLenumToString(GLenumGroup::ClipControlOrigin, origin),
6295           GLenumToString(GLenumGroup::ClipControlDepth, depth));
6296 
6297     if (context)
6298     {
6299         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6300         bool isCallValid =
6301             (context->skipValidation() ||
6302              ValidateClipControl(context, angle::EntryPoint::GLClipControl, origin, depth));
6303         if (isCallValid)
6304         {
6305             context->clipControl(origin, depth);
6306         }
6307         ANGLE_CAPTURE(ClipControl, isCallValid, context, origin, depth);
6308     }
6309     else
6310     {
6311         GenerateContextLostErrorOnCurrentGlobalContext();
6312     }
6313 }
6314 
GL_CompressedTextureSubImage1D(GLuint texture,GLint level,GLint xoffset,GLsizei width,GLenum format,GLsizei imageSize,const void * data)6315 void GL_APIENTRY GL_CompressedTextureSubImage1D(GLuint texture,
6316                                                 GLint level,
6317                                                 GLint xoffset,
6318                                                 GLsizei width,
6319                                                 GLenum format,
6320                                                 GLsizei imageSize,
6321                                                 const void *data)
6322 {
6323     Context *context = GetValidGlobalContext();
6324     EVENT(context, GLCompressedTextureSubImage1D,
6325           "context = %d, texture = %u, level = %d, xoffset = %d, width = %d, format = %s, "
6326           "imageSize = %d, data = 0x%016" PRIxPTR "",
6327           CID(context), texture, level, xoffset, width,
6328           GLenumToString(GLenumGroup::PixelFormat, format), imageSize, (uintptr_t)data);
6329 
6330     if (context)
6331     {
6332         TextureID texturePacked                               = PackParam<TextureID>(texture);
6333         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6334         bool isCallValid                                      = (context->skipValidation() ||
6335                             ValidateCompressedTextureSubImage1D(
6336                                 context, angle::EntryPoint::GLCompressedTextureSubImage1D,
6337                                 texturePacked, level, xoffset, width, format, imageSize, data));
6338         if (isCallValid)
6339         {
6340             context->compressedTextureSubImage1D(texturePacked, level, xoffset, width, format,
6341                                                  imageSize, data);
6342         }
6343         ANGLE_CAPTURE(CompressedTextureSubImage1D, isCallValid, context, texturePacked, level,
6344                       xoffset, width, format, imageSize, data);
6345     }
6346     else
6347     {
6348         GenerateContextLostErrorOnCurrentGlobalContext();
6349     }
6350 }
6351 
GL_CompressedTextureSubImage2D(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLsizei imageSize,const void * data)6352 void GL_APIENTRY GL_CompressedTextureSubImage2D(GLuint texture,
6353                                                 GLint level,
6354                                                 GLint xoffset,
6355                                                 GLint yoffset,
6356                                                 GLsizei width,
6357                                                 GLsizei height,
6358                                                 GLenum format,
6359                                                 GLsizei imageSize,
6360                                                 const void *data)
6361 {
6362     Context *context = GetValidGlobalContext();
6363     EVENT(context, GLCompressedTextureSubImage2D,
6364           "context = %d, texture = %u, level = %d, xoffset = %d, yoffset = %d, width = %d, height "
6365           "= %d, format = %s, imageSize = %d, data = 0x%016" PRIxPTR "",
6366           CID(context), texture, level, xoffset, yoffset, width, height,
6367           GLenumToString(GLenumGroup::PixelFormat, format), imageSize, (uintptr_t)data);
6368 
6369     if (context)
6370     {
6371         TextureID texturePacked                               = PackParam<TextureID>(texture);
6372         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6373         bool isCallValid =
6374             (context->skipValidation() ||
6375              ValidateCompressedTextureSubImage2D(
6376                  context, angle::EntryPoint::GLCompressedTextureSubImage2D, texturePacked, level,
6377                  xoffset, yoffset, width, height, format, imageSize, data));
6378         if (isCallValid)
6379         {
6380             context->compressedTextureSubImage2D(texturePacked, level, xoffset, yoffset, width,
6381                                                  height, format, imageSize, data);
6382         }
6383         ANGLE_CAPTURE(CompressedTextureSubImage2D, isCallValid, context, texturePacked, level,
6384                       xoffset, yoffset, width, height, format, imageSize, data);
6385     }
6386     else
6387     {
6388         GenerateContextLostErrorOnCurrentGlobalContext();
6389     }
6390 }
6391 
GL_CompressedTextureSubImage3D(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLsizei imageSize,const void * data)6392 void GL_APIENTRY GL_CompressedTextureSubImage3D(GLuint texture,
6393                                                 GLint level,
6394                                                 GLint xoffset,
6395                                                 GLint yoffset,
6396                                                 GLint zoffset,
6397                                                 GLsizei width,
6398                                                 GLsizei height,
6399                                                 GLsizei depth,
6400                                                 GLenum format,
6401                                                 GLsizei imageSize,
6402                                                 const void *data)
6403 {
6404     Context *context = GetValidGlobalContext();
6405     EVENT(context, GLCompressedTextureSubImage3D,
6406           "context = %d, texture = %u, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width "
6407           "= %d, height = %d, depth = %d, format = %s, imageSize = %d, data = 0x%016" PRIxPTR "",
6408           CID(context), texture, level, xoffset, yoffset, zoffset, width, height, depth,
6409           GLenumToString(GLenumGroup::PixelFormat, format), imageSize, (uintptr_t)data);
6410 
6411     if (context)
6412     {
6413         TextureID texturePacked                               = PackParam<TextureID>(texture);
6414         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6415         bool isCallValid =
6416             (context->skipValidation() ||
6417              ValidateCompressedTextureSubImage3D(
6418                  context, angle::EntryPoint::GLCompressedTextureSubImage3D, texturePacked, level,
6419                  xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data));
6420         if (isCallValid)
6421         {
6422             context->compressedTextureSubImage3D(texturePacked, level, xoffset, yoffset, zoffset,
6423                                                  width, height, depth, format, imageSize, data);
6424         }
6425         ANGLE_CAPTURE(CompressedTextureSubImage3D, isCallValid, context, texturePacked, level,
6426                       xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
6427     }
6428     else
6429     {
6430         GenerateContextLostErrorOnCurrentGlobalContext();
6431     }
6432 }
6433 
GL_CopyNamedBufferSubData(GLuint readBuffer,GLuint writeBuffer,GLintptr readOffset,GLintptr writeOffset,GLsizeiptr size)6434 void GL_APIENTRY GL_CopyNamedBufferSubData(GLuint readBuffer,
6435                                            GLuint writeBuffer,
6436                                            GLintptr readOffset,
6437                                            GLintptr writeOffset,
6438                                            GLsizeiptr size)
6439 {
6440     Context *context = GetValidGlobalContext();
6441     EVENT(context, GLCopyNamedBufferSubData,
6442           "context = %d, readBuffer = %u, writeBuffer = %u, readOffset = %llu, writeOffset = %llu, "
6443           "size = %llu",
6444           CID(context), readBuffer, writeBuffer, static_cast<unsigned long long>(readOffset),
6445           static_cast<unsigned long long>(writeOffset), static_cast<unsigned long long>(size));
6446 
6447     if (context)
6448     {
6449         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6450         bool isCallValid                                      = (context->skipValidation() ||
6451                             ValidateCopyNamedBufferSubData(
6452                                 context, angle::EntryPoint::GLCopyNamedBufferSubData, readBuffer,
6453                                 writeBuffer, readOffset, writeOffset, size));
6454         if (isCallValid)
6455         {
6456             context->copyNamedBufferSubData(readBuffer, writeBuffer, readOffset, writeOffset, size);
6457         }
6458         ANGLE_CAPTURE(CopyNamedBufferSubData, isCallValid, context, readBuffer, writeBuffer,
6459                       readOffset, writeOffset, size);
6460     }
6461     else
6462     {
6463         GenerateContextLostErrorOnCurrentGlobalContext();
6464     }
6465 }
6466 
GL_CopyTextureSubImage1D(GLuint texture,GLint level,GLint xoffset,GLint x,GLint y,GLsizei width)6467 void GL_APIENTRY GL_CopyTextureSubImage1D(GLuint texture,
6468                                           GLint level,
6469                                           GLint xoffset,
6470                                           GLint x,
6471                                           GLint y,
6472                                           GLsizei width)
6473 {
6474     Context *context = GetValidGlobalContext();
6475     EVENT(context, GLCopyTextureSubImage1D,
6476           "context = %d, texture = %u, level = %d, xoffset = %d, x = %d, y = %d, width = %d",
6477           CID(context), texture, level, xoffset, x, y, width);
6478 
6479     if (context)
6480     {
6481         TextureID texturePacked                               = PackParam<TextureID>(texture);
6482         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6483         bool isCallValid =
6484             (context->skipValidation() ||
6485              ValidateCopyTextureSubImage1D(context, angle::EntryPoint::GLCopyTextureSubImage1D,
6486                                            texturePacked, level, xoffset, x, y, width));
6487         if (isCallValid)
6488         {
6489             context->copyTextureSubImage1D(texturePacked, level, xoffset, x, y, width);
6490         }
6491         ANGLE_CAPTURE(CopyTextureSubImage1D, isCallValid, context, texturePacked, level, xoffset, x,
6492                       y, width);
6493     }
6494     else
6495     {
6496         GenerateContextLostErrorOnCurrentGlobalContext();
6497     }
6498 }
6499 
GL_CopyTextureSubImage2D(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLint x,GLint y,GLsizei width,GLsizei height)6500 void GL_APIENTRY GL_CopyTextureSubImage2D(GLuint texture,
6501                                           GLint level,
6502                                           GLint xoffset,
6503                                           GLint yoffset,
6504                                           GLint x,
6505                                           GLint y,
6506                                           GLsizei width,
6507                                           GLsizei height)
6508 {
6509     Context *context = GetValidGlobalContext();
6510     EVENT(context, GLCopyTextureSubImage2D,
6511           "context = %d, texture = %u, level = %d, xoffset = %d, yoffset = %d, x = %d, y = %d, "
6512           "width = %d, height = %d",
6513           CID(context), texture, level, xoffset, yoffset, x, y, width, height);
6514 
6515     if (context)
6516     {
6517         TextureID texturePacked                               = PackParam<TextureID>(texture);
6518         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6519         bool isCallValid                                      = (context->skipValidation() ||
6520                             ValidateCopyTextureSubImage2D(
6521                                 context, angle::EntryPoint::GLCopyTextureSubImage2D, texturePacked,
6522                                 level, xoffset, yoffset, x, y, width, height));
6523         if (isCallValid)
6524         {
6525             context->copyTextureSubImage2D(texturePacked, level, xoffset, yoffset, x, y, width,
6526                                            height);
6527         }
6528         ANGLE_CAPTURE(CopyTextureSubImage2D, isCallValid, context, texturePacked, level, xoffset,
6529                       yoffset, x, y, width, height);
6530     }
6531     else
6532     {
6533         GenerateContextLostErrorOnCurrentGlobalContext();
6534     }
6535 }
6536 
GL_CopyTextureSubImage3D(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLint x,GLint y,GLsizei width,GLsizei height)6537 void GL_APIENTRY GL_CopyTextureSubImage3D(GLuint texture,
6538                                           GLint level,
6539                                           GLint xoffset,
6540                                           GLint yoffset,
6541                                           GLint zoffset,
6542                                           GLint x,
6543                                           GLint y,
6544                                           GLsizei width,
6545                                           GLsizei height)
6546 {
6547     Context *context = GetValidGlobalContext();
6548     EVENT(context, GLCopyTextureSubImage3D,
6549           "context = %d, texture = %u, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, x = "
6550           "%d, y = %d, width = %d, height = %d",
6551           CID(context), texture, level, xoffset, yoffset, zoffset, x, y, width, height);
6552 
6553     if (context)
6554     {
6555         TextureID texturePacked                               = PackParam<TextureID>(texture);
6556         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6557         bool isCallValid                                      = (context->skipValidation() ||
6558                             ValidateCopyTextureSubImage3D(
6559                                 context, angle::EntryPoint::GLCopyTextureSubImage3D, texturePacked,
6560                                 level, xoffset, yoffset, zoffset, x, y, width, height));
6561         if (isCallValid)
6562         {
6563             context->copyTextureSubImage3D(texturePacked, level, xoffset, yoffset, zoffset, x, y,
6564                                            width, height);
6565         }
6566         ANGLE_CAPTURE(CopyTextureSubImage3D, isCallValid, context, texturePacked, level, xoffset,
6567                       yoffset, zoffset, x, y, width, height);
6568     }
6569     else
6570     {
6571         GenerateContextLostErrorOnCurrentGlobalContext();
6572     }
6573 }
6574 
GL_CreateBuffers(GLsizei n,GLuint * buffers)6575 void GL_APIENTRY GL_CreateBuffers(GLsizei n, GLuint *buffers)
6576 {
6577     Context *context = GetValidGlobalContext();
6578     EVENT(context, GLCreateBuffers, "context = %d, n = %d, buffers = 0x%016" PRIxPTR "",
6579           CID(context), n, (uintptr_t)buffers);
6580 
6581     if (context)
6582     {
6583         BufferID *buffersPacked                               = PackParam<BufferID *>(buffers);
6584         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6585         bool isCallValid =
6586             (context->skipValidation() ||
6587              ValidateCreateBuffers(context, angle::EntryPoint::GLCreateBuffers, n, buffersPacked));
6588         if (isCallValid)
6589         {
6590             context->createBuffers(n, buffersPacked);
6591         }
6592         ANGLE_CAPTURE(CreateBuffers, isCallValid, context, n, buffersPacked);
6593     }
6594     else
6595     {
6596         GenerateContextLostErrorOnCurrentGlobalContext();
6597     }
6598 }
6599 
GL_CreateFramebuffers(GLsizei n,GLuint * framebuffers)6600 void GL_APIENTRY GL_CreateFramebuffers(GLsizei n, GLuint *framebuffers)
6601 {
6602     Context *context = GetValidGlobalContext();
6603     EVENT(context, GLCreateFramebuffers, "context = %d, n = %d, framebuffers = 0x%016" PRIxPTR "",
6604           CID(context), n, (uintptr_t)framebuffers);
6605 
6606     if (context)
6607     {
6608         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6609         bool isCallValid                                      = (context->skipValidation() ||
6610                             ValidateCreateFramebuffers(
6611                                 context, angle::EntryPoint::GLCreateFramebuffers, n, framebuffers));
6612         if (isCallValid)
6613         {
6614             context->createFramebuffers(n, framebuffers);
6615         }
6616         ANGLE_CAPTURE(CreateFramebuffers, isCallValid, context, n, framebuffers);
6617     }
6618     else
6619     {
6620         GenerateContextLostErrorOnCurrentGlobalContext();
6621     }
6622 }
6623 
GL_CreateProgramPipelines(GLsizei n,GLuint * pipelines)6624 void GL_APIENTRY GL_CreateProgramPipelines(GLsizei n, GLuint *pipelines)
6625 {
6626     Context *context = GetValidGlobalContext();
6627     EVENT(context, GLCreateProgramPipelines, "context = %d, n = %d, pipelines = 0x%016" PRIxPTR "",
6628           CID(context), n, (uintptr_t)pipelines);
6629 
6630     if (context)
6631     {
6632         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6633         bool isCallValid =
6634             (context->skipValidation() ||
6635              ValidateCreateProgramPipelines(context, angle::EntryPoint::GLCreateProgramPipelines, n,
6636                                             pipelines));
6637         if (isCallValid)
6638         {
6639             context->createProgramPipelines(n, pipelines);
6640         }
6641         ANGLE_CAPTURE(CreateProgramPipelines, isCallValid, context, n, pipelines);
6642     }
6643     else
6644     {
6645         GenerateContextLostErrorOnCurrentGlobalContext();
6646     }
6647 }
6648 
GL_CreateQueries(GLenum target,GLsizei n,GLuint * ids)6649 void GL_APIENTRY GL_CreateQueries(GLenum target, GLsizei n, GLuint *ids)
6650 {
6651     Context *context = GetValidGlobalContext();
6652     EVENT(context, GLCreateQueries, "context = %d, target = %s, n = %d, ids = 0x%016" PRIxPTR "",
6653           CID(context), GLenumToString(GLenumGroup::QueryTarget, target), n, (uintptr_t)ids);
6654 
6655     if (context)
6656     {
6657         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6658         bool isCallValid =
6659             (context->skipValidation() ||
6660              ValidateCreateQueries(context, angle::EntryPoint::GLCreateQueries, target, n, ids));
6661         if (isCallValid)
6662         {
6663             context->createQueries(target, n, ids);
6664         }
6665         ANGLE_CAPTURE(CreateQueries, isCallValid, context, target, n, ids);
6666     }
6667     else
6668     {
6669         GenerateContextLostErrorOnCurrentGlobalContext();
6670     }
6671 }
6672 
GL_CreateRenderbuffers(GLsizei n,GLuint * renderbuffers)6673 void GL_APIENTRY GL_CreateRenderbuffers(GLsizei n, GLuint *renderbuffers)
6674 {
6675     Context *context = GetValidGlobalContext();
6676     EVENT(context, GLCreateRenderbuffers, "context = %d, n = %d, renderbuffers = 0x%016" PRIxPTR "",
6677           CID(context), n, (uintptr_t)renderbuffers);
6678 
6679     if (context)
6680     {
6681         RenderbufferID *renderbuffersPacked = PackParam<RenderbufferID *>(renderbuffers);
6682         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6683         bool isCallValid =
6684             (context->skipValidation() ||
6685              ValidateCreateRenderbuffers(context, angle::EntryPoint::GLCreateRenderbuffers, n,
6686                                          renderbuffersPacked));
6687         if (isCallValid)
6688         {
6689             context->createRenderbuffers(n, renderbuffersPacked);
6690         }
6691         ANGLE_CAPTURE(CreateRenderbuffers, isCallValid, context, n, renderbuffersPacked);
6692     }
6693     else
6694     {
6695         GenerateContextLostErrorOnCurrentGlobalContext();
6696     }
6697 }
6698 
GL_CreateSamplers(GLsizei n,GLuint * samplers)6699 void GL_APIENTRY GL_CreateSamplers(GLsizei n, GLuint *samplers)
6700 {
6701     Context *context = GetValidGlobalContext();
6702     EVENT(context, GLCreateSamplers, "context = %d, n = %d, samplers = 0x%016" PRIxPTR "",
6703           CID(context), n, (uintptr_t)samplers);
6704 
6705     if (context)
6706     {
6707         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6708         bool isCallValid =
6709             (context->skipValidation() ||
6710              ValidateCreateSamplers(context, angle::EntryPoint::GLCreateSamplers, n, samplers));
6711         if (isCallValid)
6712         {
6713             context->createSamplers(n, samplers);
6714         }
6715         ANGLE_CAPTURE(CreateSamplers, isCallValid, context, n, samplers);
6716     }
6717     else
6718     {
6719         GenerateContextLostErrorOnCurrentGlobalContext();
6720     }
6721 }
6722 
GL_CreateTextures(GLenum target,GLsizei n,GLuint * textures)6723 void GL_APIENTRY GL_CreateTextures(GLenum target, GLsizei n, GLuint *textures)
6724 {
6725     Context *context = GetValidGlobalContext();
6726     EVENT(context, GLCreateTextures,
6727           "context = %d, target = %s, n = %d, textures = 0x%016" PRIxPTR "", CID(context),
6728           GLenumToString(GLenumGroup::TextureTarget, target), n, (uintptr_t)textures);
6729 
6730     if (context)
6731     {
6732         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6733         bool isCallValid                                      = (context->skipValidation() ||
6734                             ValidateCreateTextures(context, angle::EntryPoint::GLCreateTextures,
6735                                                    target, n, textures));
6736         if (isCallValid)
6737         {
6738             context->createTextures(target, n, textures);
6739         }
6740         ANGLE_CAPTURE(CreateTextures, isCallValid, context, target, n, textures);
6741     }
6742     else
6743     {
6744         GenerateContextLostErrorOnCurrentGlobalContext();
6745     }
6746 }
6747 
GL_CreateTransformFeedbacks(GLsizei n,GLuint * ids)6748 void GL_APIENTRY GL_CreateTransformFeedbacks(GLsizei n, GLuint *ids)
6749 {
6750     Context *context = GetValidGlobalContext();
6751     EVENT(context, GLCreateTransformFeedbacks, "context = %d, n = %d, ids = 0x%016" PRIxPTR "",
6752           CID(context), n, (uintptr_t)ids);
6753 
6754     if (context)
6755     {
6756         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6757         bool isCallValid                                      = (context->skipValidation() ||
6758                             ValidateCreateTransformFeedbacks(
6759                                 context, angle::EntryPoint::GLCreateTransformFeedbacks, n, ids));
6760         if (isCallValid)
6761         {
6762             context->createTransformFeedbacks(n, ids);
6763         }
6764         ANGLE_CAPTURE(CreateTransformFeedbacks, isCallValid, context, n, ids);
6765     }
6766     else
6767     {
6768         GenerateContextLostErrorOnCurrentGlobalContext();
6769     }
6770 }
6771 
GL_CreateVertexArrays(GLsizei n,GLuint * arrays)6772 void GL_APIENTRY GL_CreateVertexArrays(GLsizei n, GLuint *arrays)
6773 {
6774     Context *context = GetValidGlobalContext();
6775     EVENT(context, GLCreateVertexArrays, "context = %d, n = %d, arrays = 0x%016" PRIxPTR "",
6776           CID(context), n, (uintptr_t)arrays);
6777 
6778     if (context)
6779     {
6780         VertexArrayID *arraysPacked                           = PackParam<VertexArrayID *>(arrays);
6781         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6782         bool isCallValid                                      = (context->skipValidation() ||
6783                             ValidateCreateVertexArrays(
6784                                 context, angle::EntryPoint::GLCreateVertexArrays, n, arraysPacked));
6785         if (isCallValid)
6786         {
6787             context->createVertexArrays(n, arraysPacked);
6788         }
6789         ANGLE_CAPTURE(CreateVertexArrays, isCallValid, context, n, arraysPacked);
6790     }
6791     else
6792     {
6793         GenerateContextLostErrorOnCurrentGlobalContext();
6794     }
6795 }
6796 
GL_DisableVertexArrayAttrib(GLuint vaobj,GLuint index)6797 void GL_APIENTRY GL_DisableVertexArrayAttrib(GLuint vaobj, GLuint index)
6798 {
6799     Context *context = GetValidGlobalContext();
6800     EVENT(context, GLDisableVertexArrayAttrib, "context = %d, vaobj = %u, index = %u", CID(context),
6801           vaobj, index);
6802 
6803     if (context)
6804     {
6805         VertexArrayID vaobjPacked                             = PackParam<VertexArrayID>(vaobj);
6806         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6807         bool isCallValid =
6808             (context->skipValidation() ||
6809              ValidateDisableVertexArrayAttrib(
6810                  context, angle::EntryPoint::GLDisableVertexArrayAttrib, vaobjPacked, index));
6811         if (isCallValid)
6812         {
6813             context->disableVertexArrayAttrib(vaobjPacked, index);
6814         }
6815         ANGLE_CAPTURE(DisableVertexArrayAttrib, isCallValid, context, vaobjPacked, index);
6816     }
6817     else
6818     {
6819         GenerateContextLostErrorOnCurrentGlobalContext();
6820     }
6821 }
6822 
GL_EnableVertexArrayAttrib(GLuint vaobj,GLuint index)6823 void GL_APIENTRY GL_EnableVertexArrayAttrib(GLuint vaobj, GLuint index)
6824 {
6825     Context *context = GetValidGlobalContext();
6826     EVENT(context, GLEnableVertexArrayAttrib, "context = %d, vaobj = %u, index = %u", CID(context),
6827           vaobj, index);
6828 
6829     if (context)
6830     {
6831         VertexArrayID vaobjPacked                             = PackParam<VertexArrayID>(vaobj);
6832         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6833         bool isCallValid =
6834             (context->skipValidation() ||
6835              ValidateEnableVertexArrayAttrib(context, angle::EntryPoint::GLEnableVertexArrayAttrib,
6836                                              vaobjPacked, index));
6837         if (isCallValid)
6838         {
6839             context->enableVertexArrayAttrib(vaobjPacked, index);
6840         }
6841         ANGLE_CAPTURE(EnableVertexArrayAttrib, isCallValid, context, vaobjPacked, index);
6842     }
6843     else
6844     {
6845         GenerateContextLostErrorOnCurrentGlobalContext();
6846     }
6847 }
6848 
GL_FlushMappedNamedBufferRange(GLuint buffer,GLintptr offset,GLsizeiptr length)6849 void GL_APIENTRY GL_FlushMappedNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length)
6850 {
6851     Context *context = GetValidGlobalContext();
6852     EVENT(context, GLFlushMappedNamedBufferRange,
6853           "context = %d, buffer = %u, offset = %llu, length = %llu", CID(context), buffer,
6854           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length));
6855 
6856     if (context)
6857     {
6858         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
6859         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6860         bool isCallValid                                      = (context->skipValidation() ||
6861                             ValidateFlushMappedNamedBufferRange(
6862                                 context, angle::EntryPoint::GLFlushMappedNamedBufferRange,
6863                                 bufferPacked, offset, length));
6864         if (isCallValid)
6865         {
6866             context->flushMappedNamedBufferRange(bufferPacked, offset, length);
6867         }
6868         ANGLE_CAPTURE(FlushMappedNamedBufferRange, isCallValid, context, bufferPacked, offset,
6869                       length);
6870     }
6871     else
6872     {
6873         GenerateContextLostErrorOnCurrentGlobalContext();
6874     }
6875 }
6876 
GL_GenerateTextureMipmap(GLuint texture)6877 void GL_APIENTRY GL_GenerateTextureMipmap(GLuint texture)
6878 {
6879     Context *context = GetValidGlobalContext();
6880     EVENT(context, GLGenerateTextureMipmap, "context = %d, texture = %u", CID(context), texture);
6881 
6882     if (context)
6883     {
6884         TextureID texturePacked                               = PackParam<TextureID>(texture);
6885         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6886         bool isCallValid =
6887             (context->skipValidation() ||
6888              ValidateGenerateTextureMipmap(context, angle::EntryPoint::GLGenerateTextureMipmap,
6889                                            texturePacked));
6890         if (isCallValid)
6891         {
6892             context->generateTextureMipmap(texturePacked);
6893         }
6894         ANGLE_CAPTURE(GenerateTextureMipmap, isCallValid, context, texturePacked);
6895     }
6896     else
6897     {
6898         GenerateContextLostErrorOnCurrentGlobalContext();
6899     }
6900 }
6901 
GL_GetCompressedTextureImage(GLuint texture,GLint level,GLsizei bufSize,void * pixels)6902 void GL_APIENTRY GL_GetCompressedTextureImage(GLuint texture,
6903                                               GLint level,
6904                                               GLsizei bufSize,
6905                                               void *pixels)
6906 {
6907     Context *context = GetValidGlobalContext();
6908     EVENT(context, GLGetCompressedTextureImage,
6909           "context = %d, texture = %u, level = %d, bufSize = %d, pixels = 0x%016" PRIxPTR "",
6910           CID(context), texture, level, bufSize, (uintptr_t)pixels);
6911 
6912     if (context)
6913     {
6914         TextureID texturePacked                               = PackParam<TextureID>(texture);
6915         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6916         bool isCallValid                                      = (context->skipValidation() ||
6917                             ValidateGetCompressedTextureImage(
6918                                 context, angle::EntryPoint::GLGetCompressedTextureImage,
6919                                 texturePacked, level, bufSize, pixels));
6920         if (isCallValid)
6921         {
6922             context->getCompressedTextureImage(texturePacked, level, bufSize, pixels);
6923         }
6924         ANGLE_CAPTURE(GetCompressedTextureImage, isCallValid, context, texturePacked, level,
6925                       bufSize, pixels);
6926     }
6927     else
6928     {
6929         GenerateContextLostErrorOnCurrentGlobalContext();
6930     }
6931 }
6932 
GL_GetCompressedTextureSubImage(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLsizei bufSize,void * pixels)6933 void GL_APIENTRY GL_GetCompressedTextureSubImage(GLuint texture,
6934                                                  GLint level,
6935                                                  GLint xoffset,
6936                                                  GLint yoffset,
6937                                                  GLint zoffset,
6938                                                  GLsizei width,
6939                                                  GLsizei height,
6940                                                  GLsizei depth,
6941                                                  GLsizei bufSize,
6942                                                  void *pixels)
6943 {
6944     Context *context = GetValidGlobalContext();
6945     EVENT(context, GLGetCompressedTextureSubImage,
6946           "context = %d, texture = %u, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width "
6947           "= %d, height = %d, depth = %d, bufSize = %d, pixels = 0x%016" PRIxPTR "",
6948           CID(context), texture, level, xoffset, yoffset, zoffset, width, height, depth, bufSize,
6949           (uintptr_t)pixels);
6950 
6951     if (context)
6952     {
6953         TextureID texturePacked                               = PackParam<TextureID>(texture);
6954         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6955         bool isCallValid =
6956             (context->skipValidation() ||
6957              ValidateGetCompressedTextureSubImage(
6958                  context, angle::EntryPoint::GLGetCompressedTextureSubImage, texturePacked, level,
6959                  xoffset, yoffset, zoffset, width, height, depth, bufSize, pixels));
6960         if (isCallValid)
6961         {
6962             context->getCompressedTextureSubImage(texturePacked, level, xoffset, yoffset, zoffset,
6963                                                   width, height, depth, bufSize, pixels);
6964         }
6965         ANGLE_CAPTURE(GetCompressedTextureSubImage, isCallValid, context, texturePacked, level,
6966                       xoffset, yoffset, zoffset, width, height, depth, bufSize, pixels);
6967     }
6968     else
6969     {
6970         GenerateContextLostErrorOnCurrentGlobalContext();
6971     }
6972 }
6973 
GL_GetGraphicsResetStatus()6974 GLenum GL_APIENTRY GL_GetGraphicsResetStatus()
6975 {
6976     Context *context = GetGlobalContext();
6977     EVENT(context, GLGetGraphicsResetStatus, "context = %d", CID(context));
6978 
6979     GLenum returnValue;
6980     if (context)
6981     {
6982         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6983         bool isCallValid =
6984             (context->skipValidation() ||
6985              ValidateGetGraphicsResetStatus(context, angle::EntryPoint::GLGetGraphicsResetStatus));
6986         if (isCallValid)
6987         {
6988             returnValue = context->getGraphicsResetStatus();
6989         }
6990         else
6991         {
6992             returnValue =
6993                 GetDefaultReturnValue<angle::EntryPoint::GLGetGraphicsResetStatus, GLenum>();
6994         }
6995         ANGLE_CAPTURE(GetGraphicsResetStatus, isCallValid, context, returnValue);
6996     }
6997     else
6998     {
6999 
7000         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetGraphicsResetStatus, GLenum>();
7001     }
7002     return returnValue;
7003 }
7004 
GL_GetNamedBufferParameteri64v(GLuint buffer,GLenum pname,GLint64 * params)7005 void GL_APIENTRY GL_GetNamedBufferParameteri64v(GLuint buffer, GLenum pname, GLint64 *params)
7006 {
7007     Context *context = GetValidGlobalContext();
7008     EVENT(context, GLGetNamedBufferParameteri64v,
7009           "context = %d, buffer = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), buffer,
7010           GLenumToString(GLenumGroup::VertexBufferObjectParameter, pname), (uintptr_t)params);
7011 
7012     if (context)
7013     {
7014         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
7015         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7016         bool isCallValid                                      = (context->skipValidation() ||
7017                             ValidateGetNamedBufferParameteri64v(
7018                                 context, angle::EntryPoint::GLGetNamedBufferParameteri64v,
7019                                 bufferPacked, pname, params));
7020         if (isCallValid)
7021         {
7022             context->getNamedBufferParameteri64v(bufferPacked, pname, params);
7023         }
7024         ANGLE_CAPTURE(GetNamedBufferParameteri64v, isCallValid, context, bufferPacked, pname,
7025                       params);
7026     }
7027     else
7028     {
7029         GenerateContextLostErrorOnCurrentGlobalContext();
7030     }
7031 }
7032 
GL_GetNamedBufferParameteriv(GLuint buffer,GLenum pname,GLint * params)7033 void GL_APIENTRY GL_GetNamedBufferParameteriv(GLuint buffer, GLenum pname, GLint *params)
7034 {
7035     Context *context = GetValidGlobalContext();
7036     EVENT(context, GLGetNamedBufferParameteriv,
7037           "context = %d, buffer = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), buffer,
7038           GLenumToString(GLenumGroup::VertexBufferObjectParameter, pname), (uintptr_t)params);
7039 
7040     if (context)
7041     {
7042         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
7043         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7044         bool isCallValid                                      = (context->skipValidation() ||
7045                             ValidateGetNamedBufferParameteriv(
7046                                 context, angle::EntryPoint::GLGetNamedBufferParameteriv,
7047                                 bufferPacked, pname, params));
7048         if (isCallValid)
7049         {
7050             context->getNamedBufferParameteriv(bufferPacked, pname, params);
7051         }
7052         ANGLE_CAPTURE(GetNamedBufferParameteriv, isCallValid, context, bufferPacked, pname, params);
7053     }
7054     else
7055     {
7056         GenerateContextLostErrorOnCurrentGlobalContext();
7057     }
7058 }
7059 
GL_GetNamedBufferPointerv(GLuint buffer,GLenum pname,void ** params)7060 void GL_APIENTRY GL_GetNamedBufferPointerv(GLuint buffer, GLenum pname, void **params)
7061 {
7062     Context *context = GetValidGlobalContext();
7063     EVENT(context, GLGetNamedBufferPointerv,
7064           "context = %d, buffer = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), buffer,
7065           GLenumToString(GLenumGroup::VertexBufferObjectParameter, pname), (uintptr_t)params);
7066 
7067     if (context)
7068     {
7069         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
7070         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7071         bool isCallValid =
7072             (context->skipValidation() ||
7073              ValidateGetNamedBufferPointerv(context, angle::EntryPoint::GLGetNamedBufferPointerv,
7074                                             bufferPacked, pname, params));
7075         if (isCallValid)
7076         {
7077             context->getNamedBufferPointerv(bufferPacked, pname, params);
7078         }
7079         ANGLE_CAPTURE(GetNamedBufferPointerv, isCallValid, context, bufferPacked, pname, params);
7080     }
7081     else
7082     {
7083         GenerateContextLostErrorOnCurrentGlobalContext();
7084     }
7085 }
7086 
GL_GetNamedBufferSubData(GLuint buffer,GLintptr offset,GLsizeiptr size,void * data)7087 void GL_APIENTRY GL_GetNamedBufferSubData(GLuint buffer,
7088                                           GLintptr offset,
7089                                           GLsizeiptr size,
7090                                           void *data)
7091 {
7092     Context *context = GetValidGlobalContext();
7093     EVENT(context, GLGetNamedBufferSubData,
7094           "context = %d, buffer = %u, offset = %llu, size = %llu, data = 0x%016" PRIxPTR "",
7095           CID(context), buffer, static_cast<unsigned long long>(offset),
7096           static_cast<unsigned long long>(size), (uintptr_t)data);
7097 
7098     if (context)
7099     {
7100         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
7101         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7102         bool isCallValid =
7103             (context->skipValidation() ||
7104              ValidateGetNamedBufferSubData(context, angle::EntryPoint::GLGetNamedBufferSubData,
7105                                            bufferPacked, offset, size, data));
7106         if (isCallValid)
7107         {
7108             context->getNamedBufferSubData(bufferPacked, offset, size, data);
7109         }
7110         ANGLE_CAPTURE(GetNamedBufferSubData, isCallValid, context, bufferPacked, offset, size,
7111                       data);
7112     }
7113     else
7114     {
7115         GenerateContextLostErrorOnCurrentGlobalContext();
7116     }
7117 }
7118 
GL_GetNamedFramebufferAttachmentParameteriv(GLuint framebuffer,GLenum attachment,GLenum pname,GLint * params)7119 void GL_APIENTRY GL_GetNamedFramebufferAttachmentParameteriv(GLuint framebuffer,
7120                                                              GLenum attachment,
7121                                                              GLenum pname,
7122                                                              GLint *params)
7123 {
7124     Context *context = GetValidGlobalContext();
7125     EVENT(context, GLGetNamedFramebufferAttachmentParameteriv,
7126           "context = %d, framebuffer = %u, attachment = %s, pname = %s, params = 0x%016" PRIxPTR "",
7127           CID(context), framebuffer, GLenumToString(GLenumGroup::FramebufferAttachment, attachment),
7128           GLenumToString(GLenumGroup::FramebufferAttachmentParameterName, pname),
7129           (uintptr_t)params);
7130 
7131     if (context)
7132     {
7133         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
7134         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7135         bool isCallValid =
7136             (context->skipValidation() ||
7137              ValidateGetNamedFramebufferAttachmentParameteriv(
7138                  context, angle::EntryPoint::GLGetNamedFramebufferAttachmentParameteriv,
7139                  framebufferPacked, attachment, pname, params));
7140         if (isCallValid)
7141         {
7142             context->getNamedFramebufferAttachmentParameteriv(framebufferPacked, attachment, pname,
7143                                                               params);
7144         }
7145         ANGLE_CAPTURE(GetNamedFramebufferAttachmentParameteriv, isCallValid, context,
7146                       framebufferPacked, attachment, pname, params);
7147     }
7148     else
7149     {
7150         GenerateContextLostErrorOnCurrentGlobalContext();
7151     }
7152 }
7153 
GL_GetNamedFramebufferParameteriv(GLuint framebuffer,GLenum pname,GLint * param)7154 void GL_APIENTRY GL_GetNamedFramebufferParameteriv(GLuint framebuffer, GLenum pname, GLint *param)
7155 {
7156     Context *context = GetValidGlobalContext();
7157     EVENT(context, GLGetNamedFramebufferParameteriv,
7158           "context = %d, framebuffer = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
7159           framebuffer, GLenumToString(GLenumGroup::GetFramebufferParameter, pname),
7160           (uintptr_t)param);
7161 
7162     if (context)
7163     {
7164         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
7165         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7166         bool isCallValid                                      = (context->skipValidation() ||
7167                             ValidateGetNamedFramebufferParameteriv(
7168                                 context, angle::EntryPoint::GLGetNamedFramebufferParameteriv,
7169                                 framebufferPacked, pname, param));
7170         if (isCallValid)
7171         {
7172             context->getNamedFramebufferParameteriv(framebufferPacked, pname, param);
7173         }
7174         ANGLE_CAPTURE(GetNamedFramebufferParameteriv, isCallValid, context, framebufferPacked,
7175                       pname, param);
7176     }
7177     else
7178     {
7179         GenerateContextLostErrorOnCurrentGlobalContext();
7180     }
7181 }
7182 
GL_GetNamedRenderbufferParameteriv(GLuint renderbuffer,GLenum pname,GLint * params)7183 void GL_APIENTRY GL_GetNamedRenderbufferParameteriv(GLuint renderbuffer,
7184                                                     GLenum pname,
7185                                                     GLint *params)
7186 {
7187     Context *context = GetValidGlobalContext();
7188     EVENT(context, GLGetNamedRenderbufferParameteriv,
7189           "context = %d, renderbuffer = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
7190           renderbuffer, GLenumToString(GLenumGroup::RenderbufferParameterName, pname),
7191           (uintptr_t)params);
7192 
7193     if (context)
7194     {
7195         RenderbufferID renderbufferPacked = PackParam<RenderbufferID>(renderbuffer);
7196         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7197         bool isCallValid                                      = (context->skipValidation() ||
7198                             ValidateGetNamedRenderbufferParameteriv(
7199                                 context, angle::EntryPoint::GLGetNamedRenderbufferParameteriv,
7200                                 renderbufferPacked, pname, params));
7201         if (isCallValid)
7202         {
7203             context->getNamedRenderbufferParameteriv(renderbufferPacked, pname, params);
7204         }
7205         ANGLE_CAPTURE(GetNamedRenderbufferParameteriv, isCallValid, context, renderbufferPacked,
7206                       pname, params);
7207     }
7208     else
7209     {
7210         GenerateContextLostErrorOnCurrentGlobalContext();
7211     }
7212 }
7213 
GL_GetQueryBufferObjecti64v(GLuint id,GLuint buffer,GLenum pname,GLintptr offset)7214 void GL_APIENTRY GL_GetQueryBufferObjecti64v(GLuint id,
7215                                              GLuint buffer,
7216                                              GLenum pname,
7217                                              GLintptr offset)
7218 {
7219     Context *context = GetValidGlobalContext();
7220     EVENT(context, GLGetQueryBufferObjecti64v,
7221           "context = %d, id = %u, buffer = %u, pname = %s, offset = %llu", CID(context), id, buffer,
7222           GLenumToString(GLenumGroup::QueryObjectParameterName, pname),
7223           static_cast<unsigned long long>(offset));
7224 
7225     if (context)
7226     {
7227         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
7228         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7229         bool isCallValid                                      = (context->skipValidation() ||
7230                             ValidateGetQueryBufferObjecti64v(
7231                                 context, angle::EntryPoint::GLGetQueryBufferObjecti64v, id,
7232                                 bufferPacked, pname, offset));
7233         if (isCallValid)
7234         {
7235             context->getQueryBufferObjecti64v(id, bufferPacked, pname, offset);
7236         }
7237         ANGLE_CAPTURE(GetQueryBufferObjecti64v, isCallValid, context, id, bufferPacked, pname,
7238                       offset);
7239     }
7240     else
7241     {
7242         GenerateContextLostErrorOnCurrentGlobalContext();
7243     }
7244 }
7245 
GL_GetQueryBufferObjectiv(GLuint id,GLuint buffer,GLenum pname,GLintptr offset)7246 void GL_APIENTRY GL_GetQueryBufferObjectiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset)
7247 {
7248     Context *context = GetValidGlobalContext();
7249     EVENT(context, GLGetQueryBufferObjectiv,
7250           "context = %d, id = %u, buffer = %u, pname = %s, offset = %llu", CID(context), id, buffer,
7251           GLenumToString(GLenumGroup::QueryObjectParameterName, pname),
7252           static_cast<unsigned long long>(offset));
7253 
7254     if (context)
7255     {
7256         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
7257         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7258         bool isCallValid =
7259             (context->skipValidation() ||
7260              ValidateGetQueryBufferObjectiv(context, angle::EntryPoint::GLGetQueryBufferObjectiv,
7261                                             id, bufferPacked, pname, offset));
7262         if (isCallValid)
7263         {
7264             context->getQueryBufferObjectiv(id, bufferPacked, pname, offset);
7265         }
7266         ANGLE_CAPTURE(GetQueryBufferObjectiv, isCallValid, context, id, bufferPacked, pname,
7267                       offset);
7268     }
7269     else
7270     {
7271         GenerateContextLostErrorOnCurrentGlobalContext();
7272     }
7273 }
7274 
GL_GetQueryBufferObjectui64v(GLuint id,GLuint buffer,GLenum pname,GLintptr offset)7275 void GL_APIENTRY GL_GetQueryBufferObjectui64v(GLuint id,
7276                                               GLuint buffer,
7277                                               GLenum pname,
7278                                               GLintptr offset)
7279 {
7280     Context *context = GetValidGlobalContext();
7281     EVENT(context, GLGetQueryBufferObjectui64v,
7282           "context = %d, id = %u, buffer = %u, pname = %s, offset = %llu", CID(context), id, buffer,
7283           GLenumToString(GLenumGroup::QueryObjectParameterName, pname),
7284           static_cast<unsigned long long>(offset));
7285 
7286     if (context)
7287     {
7288         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
7289         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7290         bool isCallValid                                      = (context->skipValidation() ||
7291                             ValidateGetQueryBufferObjectui64v(
7292                                 context, angle::EntryPoint::GLGetQueryBufferObjectui64v, id,
7293                                 bufferPacked, pname, offset));
7294         if (isCallValid)
7295         {
7296             context->getQueryBufferObjectui64v(id, bufferPacked, pname, offset);
7297         }
7298         ANGLE_CAPTURE(GetQueryBufferObjectui64v, isCallValid, context, id, bufferPacked, pname,
7299                       offset);
7300     }
7301     else
7302     {
7303         GenerateContextLostErrorOnCurrentGlobalContext();
7304     }
7305 }
7306 
GL_GetQueryBufferObjectuiv(GLuint id,GLuint buffer,GLenum pname,GLintptr offset)7307 void GL_APIENTRY GL_GetQueryBufferObjectuiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset)
7308 {
7309     Context *context = GetValidGlobalContext();
7310     EVENT(context, GLGetQueryBufferObjectuiv,
7311           "context = %d, id = %u, buffer = %u, pname = %s, offset = %llu", CID(context), id, buffer,
7312           GLenumToString(GLenumGroup::QueryObjectParameterName, pname),
7313           static_cast<unsigned long long>(offset));
7314 
7315     if (context)
7316     {
7317         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
7318         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7319         bool isCallValid =
7320             (context->skipValidation() ||
7321              ValidateGetQueryBufferObjectuiv(context, angle::EntryPoint::GLGetQueryBufferObjectuiv,
7322                                              id, bufferPacked, pname, offset));
7323         if (isCallValid)
7324         {
7325             context->getQueryBufferObjectuiv(id, bufferPacked, pname, offset);
7326         }
7327         ANGLE_CAPTURE(GetQueryBufferObjectuiv, isCallValid, context, id, bufferPacked, pname,
7328                       offset);
7329     }
7330     else
7331     {
7332         GenerateContextLostErrorOnCurrentGlobalContext();
7333     }
7334 }
7335 
GL_GetTextureImage(GLuint texture,GLint level,GLenum format,GLenum type,GLsizei bufSize,void * pixels)7336 void GL_APIENTRY GL_GetTextureImage(GLuint texture,
7337                                     GLint level,
7338                                     GLenum format,
7339                                     GLenum type,
7340                                     GLsizei bufSize,
7341                                     void *pixels)
7342 {
7343     Context *context = GetValidGlobalContext();
7344     EVENT(context, GLGetTextureImage,
7345           "context = %d, texture = %u, level = %d, format = %s, type = %s, bufSize = %d, pixels = "
7346           "0x%016" PRIxPTR "",
7347           CID(context), texture, level, GLenumToString(GLenumGroup::PixelFormat, format),
7348           GLenumToString(GLenumGroup::PixelType, type), bufSize, (uintptr_t)pixels);
7349 
7350     if (context)
7351     {
7352         TextureID texturePacked                               = PackParam<TextureID>(texture);
7353         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7354         bool isCallValid =
7355             (context->skipValidation() ||
7356              ValidateGetTextureImage(context, angle::EntryPoint::GLGetTextureImage, texturePacked,
7357                                      level, format, type, bufSize, pixels));
7358         if (isCallValid)
7359         {
7360             context->getTextureImage(texturePacked, level, format, type, bufSize, pixels);
7361         }
7362         ANGLE_CAPTURE(GetTextureImage, isCallValid, context, texturePacked, level, format, type,
7363                       bufSize, pixels);
7364     }
7365     else
7366     {
7367         GenerateContextLostErrorOnCurrentGlobalContext();
7368     }
7369 }
7370 
GL_GetTextureLevelParameterfv(GLuint texture,GLint level,GLenum pname,GLfloat * params)7371 void GL_APIENTRY GL_GetTextureLevelParameterfv(GLuint texture,
7372                                                GLint level,
7373                                                GLenum pname,
7374                                                GLfloat *params)
7375 {
7376     Context *context = GetValidGlobalContext();
7377     EVENT(context, GLGetTextureLevelParameterfv,
7378           "context = %d, texture = %u, level = %d, pname = %s, params = 0x%016" PRIxPTR "",
7379           CID(context), texture, level, GLenumToString(GLenumGroup::GetTextureParameter, pname),
7380           (uintptr_t)params);
7381 
7382     if (context)
7383     {
7384         TextureID texturePacked                               = PackParam<TextureID>(texture);
7385         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7386         bool isCallValid                                      = (context->skipValidation() ||
7387                             ValidateGetTextureLevelParameterfv(
7388                                 context, angle::EntryPoint::GLGetTextureLevelParameterfv,
7389                                 texturePacked, level, pname, params));
7390         if (isCallValid)
7391         {
7392             context->getTextureLevelParameterfv(texturePacked, level, pname, params);
7393         }
7394         ANGLE_CAPTURE(GetTextureLevelParameterfv, isCallValid, context, texturePacked, level, pname,
7395                       params);
7396     }
7397     else
7398     {
7399         GenerateContextLostErrorOnCurrentGlobalContext();
7400     }
7401 }
7402 
GL_GetTextureLevelParameteriv(GLuint texture,GLint level,GLenum pname,GLint * params)7403 void GL_APIENTRY GL_GetTextureLevelParameteriv(GLuint texture,
7404                                                GLint level,
7405                                                GLenum pname,
7406                                                GLint *params)
7407 {
7408     Context *context = GetValidGlobalContext();
7409     EVENT(context, GLGetTextureLevelParameteriv,
7410           "context = %d, texture = %u, level = %d, pname = %s, params = 0x%016" PRIxPTR "",
7411           CID(context), texture, level, GLenumToString(GLenumGroup::GetTextureParameter, pname),
7412           (uintptr_t)params);
7413 
7414     if (context)
7415     {
7416         TextureID texturePacked                               = PackParam<TextureID>(texture);
7417         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7418         bool isCallValid                                      = (context->skipValidation() ||
7419                             ValidateGetTextureLevelParameteriv(
7420                                 context, angle::EntryPoint::GLGetTextureLevelParameteriv,
7421                                 texturePacked, level, pname, params));
7422         if (isCallValid)
7423         {
7424             context->getTextureLevelParameteriv(texturePacked, level, pname, params);
7425         }
7426         ANGLE_CAPTURE(GetTextureLevelParameteriv, isCallValid, context, texturePacked, level, pname,
7427                       params);
7428     }
7429     else
7430     {
7431         GenerateContextLostErrorOnCurrentGlobalContext();
7432     }
7433 }
7434 
GL_GetTextureParameterIiv(GLuint texture,GLenum pname,GLint * params)7435 void GL_APIENTRY GL_GetTextureParameterIiv(GLuint texture, GLenum pname, GLint *params)
7436 {
7437     Context *context = GetValidGlobalContext();
7438     EVENT(context, GLGetTextureParameterIiv,
7439           "context = %d, texture = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
7440           texture, GLenumToString(GLenumGroup::GetTextureParameter, pname), (uintptr_t)params);
7441 
7442     if (context)
7443     {
7444         TextureID texturePacked                               = PackParam<TextureID>(texture);
7445         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7446         bool isCallValid =
7447             (context->skipValidation() ||
7448              ValidateGetTextureParameterIiv(context, angle::EntryPoint::GLGetTextureParameterIiv,
7449                                             texturePacked, pname, params));
7450         if (isCallValid)
7451         {
7452             context->getTextureParameterIiv(texturePacked, pname, params);
7453         }
7454         ANGLE_CAPTURE(GetTextureParameterIiv, isCallValid, context, texturePacked, pname, params);
7455     }
7456     else
7457     {
7458         GenerateContextLostErrorOnCurrentGlobalContext();
7459     }
7460 }
7461 
GL_GetTextureParameterIuiv(GLuint texture,GLenum pname,GLuint * params)7462 void GL_APIENTRY GL_GetTextureParameterIuiv(GLuint texture, GLenum pname, GLuint *params)
7463 {
7464     Context *context = GetValidGlobalContext();
7465     EVENT(context, GLGetTextureParameterIuiv,
7466           "context = %d, texture = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
7467           texture, GLenumToString(GLenumGroup::GetTextureParameter, pname), (uintptr_t)params);
7468 
7469     if (context)
7470     {
7471         TextureID texturePacked                               = PackParam<TextureID>(texture);
7472         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7473         bool isCallValid =
7474             (context->skipValidation() ||
7475              ValidateGetTextureParameterIuiv(context, angle::EntryPoint::GLGetTextureParameterIuiv,
7476                                              texturePacked, pname, params));
7477         if (isCallValid)
7478         {
7479             context->getTextureParameterIuiv(texturePacked, pname, params);
7480         }
7481         ANGLE_CAPTURE(GetTextureParameterIuiv, isCallValid, context, texturePacked, pname, params);
7482     }
7483     else
7484     {
7485         GenerateContextLostErrorOnCurrentGlobalContext();
7486     }
7487 }
7488 
GL_GetTextureParameterfv(GLuint texture,GLenum pname,GLfloat * params)7489 void GL_APIENTRY GL_GetTextureParameterfv(GLuint texture, GLenum pname, GLfloat *params)
7490 {
7491     Context *context = GetValidGlobalContext();
7492     EVENT(context, GLGetTextureParameterfv,
7493           "context = %d, texture = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
7494           texture, GLenumToString(GLenumGroup::GetTextureParameter, pname), (uintptr_t)params);
7495 
7496     if (context)
7497     {
7498         TextureID texturePacked                               = PackParam<TextureID>(texture);
7499         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7500         bool isCallValid =
7501             (context->skipValidation() ||
7502              ValidateGetTextureParameterfv(context, angle::EntryPoint::GLGetTextureParameterfv,
7503                                            texturePacked, pname, params));
7504         if (isCallValid)
7505         {
7506             context->getTextureParameterfv(texturePacked, pname, params);
7507         }
7508         ANGLE_CAPTURE(GetTextureParameterfv, isCallValid, context, texturePacked, pname, params);
7509     }
7510     else
7511     {
7512         GenerateContextLostErrorOnCurrentGlobalContext();
7513     }
7514 }
7515 
GL_GetTextureParameteriv(GLuint texture,GLenum pname,GLint * params)7516 void GL_APIENTRY GL_GetTextureParameteriv(GLuint texture, GLenum pname, GLint *params)
7517 {
7518     Context *context = GetValidGlobalContext();
7519     EVENT(context, GLGetTextureParameteriv,
7520           "context = %d, texture = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
7521           texture, GLenumToString(GLenumGroup::GetTextureParameter, pname), (uintptr_t)params);
7522 
7523     if (context)
7524     {
7525         TextureID texturePacked                               = PackParam<TextureID>(texture);
7526         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7527         bool isCallValid =
7528             (context->skipValidation() ||
7529              ValidateGetTextureParameteriv(context, angle::EntryPoint::GLGetTextureParameteriv,
7530                                            texturePacked, pname, params));
7531         if (isCallValid)
7532         {
7533             context->getTextureParameteriv(texturePacked, pname, params);
7534         }
7535         ANGLE_CAPTURE(GetTextureParameteriv, isCallValid, context, texturePacked, pname, params);
7536     }
7537     else
7538     {
7539         GenerateContextLostErrorOnCurrentGlobalContext();
7540     }
7541 }
7542 
GL_GetTextureSubImage(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLenum type,GLsizei bufSize,void * pixels)7543 void GL_APIENTRY GL_GetTextureSubImage(GLuint texture,
7544                                        GLint level,
7545                                        GLint xoffset,
7546                                        GLint yoffset,
7547                                        GLint zoffset,
7548                                        GLsizei width,
7549                                        GLsizei height,
7550                                        GLsizei depth,
7551                                        GLenum format,
7552                                        GLenum type,
7553                                        GLsizei bufSize,
7554                                        void *pixels)
7555 {
7556     Context *context = GetValidGlobalContext();
7557     EVENT(
7558         context, GLGetTextureSubImage,
7559         "context = %d, texture = %u, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width = "
7560         "%d, height = %d, depth = %d, format = %s, type = %s, bufSize = %d, pixels = 0x%016" PRIxPTR
7561         "",
7562         CID(context), texture, level, xoffset, yoffset, zoffset, width, height, depth,
7563         GLenumToString(GLenumGroup::PixelFormat, format),
7564         GLenumToString(GLenumGroup::PixelType, type), bufSize, (uintptr_t)pixels);
7565 
7566     if (context)
7567     {
7568         TextureID texturePacked                               = PackParam<TextureID>(texture);
7569         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7570         bool isCallValid =
7571             (context->skipValidation() ||
7572              ValidateGetTextureSubImage(context, angle::EntryPoint::GLGetTextureSubImage,
7573                                         texturePacked, level, xoffset, yoffset, zoffset, width,
7574                                         height, depth, format, type, bufSize, pixels));
7575         if (isCallValid)
7576         {
7577             context->getTextureSubImage(texturePacked, level, xoffset, yoffset, zoffset, width,
7578                                         height, depth, format, type, bufSize, pixels);
7579         }
7580         ANGLE_CAPTURE(GetTextureSubImage, isCallValid, context, texturePacked, level, xoffset,
7581                       yoffset, zoffset, width, height, depth, format, type, bufSize, pixels);
7582     }
7583     else
7584     {
7585         GenerateContextLostErrorOnCurrentGlobalContext();
7586     }
7587 }
7588 
GL_GetTransformFeedbacki64_v(GLuint xfb,GLenum pname,GLuint index,GLint64 * param)7589 void GL_APIENTRY GL_GetTransformFeedbacki64_v(GLuint xfb,
7590                                               GLenum pname,
7591                                               GLuint index,
7592                                               GLint64 *param)
7593 {
7594     Context *context = GetValidGlobalContext();
7595     EVENT(context, GLGetTransformFeedbacki64_v,
7596           "context = %d, xfb = %u, pname = %s, index = %u, param = 0x%016" PRIxPTR "", CID(context),
7597           xfb, GLenumToString(GLenumGroup::TransformFeedbackPName, pname), index, (uintptr_t)param);
7598 
7599     if (context)
7600     {
7601         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7602         bool isCallValid                                      = (context->skipValidation() ||
7603                             ValidateGetTransformFeedbacki64_v(
7604                                 context, angle::EntryPoint::GLGetTransformFeedbacki64_v, xfb, pname,
7605                                 index, param));
7606         if (isCallValid)
7607         {
7608             context->getTransformFeedbacki64_v(xfb, pname, index, param);
7609         }
7610         ANGLE_CAPTURE(GetTransformFeedbacki64_v, isCallValid, context, xfb, pname, index, param);
7611     }
7612     else
7613     {
7614         GenerateContextLostErrorOnCurrentGlobalContext();
7615     }
7616 }
7617 
GL_GetTransformFeedbacki_v(GLuint xfb,GLenum pname,GLuint index,GLint * param)7618 void GL_APIENTRY GL_GetTransformFeedbacki_v(GLuint xfb, GLenum pname, GLuint index, GLint *param)
7619 {
7620     Context *context = GetValidGlobalContext();
7621     EVENT(context, GLGetTransformFeedbacki_v,
7622           "context = %d, xfb = %u, pname = %s, index = %u, param = 0x%016" PRIxPTR "", CID(context),
7623           xfb, GLenumToString(GLenumGroup::TransformFeedbackPName, pname), index, (uintptr_t)param);
7624 
7625     if (context)
7626     {
7627         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7628         bool isCallValid =
7629             (context->skipValidation() ||
7630              ValidateGetTransformFeedbacki_v(context, angle::EntryPoint::GLGetTransformFeedbacki_v,
7631                                              xfb, pname, index, param));
7632         if (isCallValid)
7633         {
7634             context->getTransformFeedbacki_v(xfb, pname, index, param);
7635         }
7636         ANGLE_CAPTURE(GetTransformFeedbacki_v, isCallValid, context, xfb, pname, index, param);
7637     }
7638     else
7639     {
7640         GenerateContextLostErrorOnCurrentGlobalContext();
7641     }
7642 }
7643 
GL_GetTransformFeedbackiv(GLuint xfb,GLenum pname,GLint * param)7644 void GL_APIENTRY GL_GetTransformFeedbackiv(GLuint xfb, GLenum pname, GLint *param)
7645 {
7646     Context *context = GetValidGlobalContext();
7647     EVENT(context, GLGetTransformFeedbackiv,
7648           "context = %d, xfb = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context), xfb,
7649           GLenumToString(GLenumGroup::TransformFeedbackPName, pname), (uintptr_t)param);
7650 
7651     if (context)
7652     {
7653         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7654         bool isCallValid =
7655             (context->skipValidation() ||
7656              ValidateGetTransformFeedbackiv(context, angle::EntryPoint::GLGetTransformFeedbackiv,
7657                                             xfb, pname, param));
7658         if (isCallValid)
7659         {
7660             context->getTransformFeedbackiv(xfb, pname, param);
7661         }
7662         ANGLE_CAPTURE(GetTransformFeedbackiv, isCallValid, context, xfb, pname, param);
7663     }
7664     else
7665     {
7666         GenerateContextLostErrorOnCurrentGlobalContext();
7667     }
7668 }
7669 
GL_GetVertexArrayIndexed64iv(GLuint vaobj,GLuint index,GLenum pname,GLint64 * param)7670 void GL_APIENTRY GL_GetVertexArrayIndexed64iv(GLuint vaobj,
7671                                               GLuint index,
7672                                               GLenum pname,
7673                                               GLint64 *param)
7674 {
7675     Context *context = GetValidGlobalContext();
7676     EVENT(context, GLGetVertexArrayIndexed64iv,
7677           "context = %d, vaobj = %u, index = %u, pname = %s, param = 0x%016" PRIxPTR "",
7678           CID(context), vaobj, index, GLenumToString(GLenumGroup::VertexArrayPName, pname),
7679           (uintptr_t)param);
7680 
7681     if (context)
7682     {
7683         VertexArrayID vaobjPacked                             = PackParam<VertexArrayID>(vaobj);
7684         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7685         bool isCallValid                                      = (context->skipValidation() ||
7686                             ValidateGetVertexArrayIndexed64iv(
7687                                 context, angle::EntryPoint::GLGetVertexArrayIndexed64iv,
7688                                 vaobjPacked, index, pname, param));
7689         if (isCallValid)
7690         {
7691             context->getVertexArrayIndexed64iv(vaobjPacked, index, pname, param);
7692         }
7693         ANGLE_CAPTURE(GetVertexArrayIndexed64iv, isCallValid, context, vaobjPacked, index, pname,
7694                       param);
7695     }
7696     else
7697     {
7698         GenerateContextLostErrorOnCurrentGlobalContext();
7699     }
7700 }
7701 
GL_GetVertexArrayIndexediv(GLuint vaobj,GLuint index,GLenum pname,GLint * param)7702 void GL_APIENTRY GL_GetVertexArrayIndexediv(GLuint vaobj, GLuint index, GLenum pname, GLint *param)
7703 {
7704     Context *context = GetValidGlobalContext();
7705     EVENT(context, GLGetVertexArrayIndexediv,
7706           "context = %d, vaobj = %u, index = %u, pname = %s, param = 0x%016" PRIxPTR "",
7707           CID(context), vaobj, index, GLenumToString(GLenumGroup::VertexArrayPName, pname),
7708           (uintptr_t)param);
7709 
7710     if (context)
7711     {
7712         VertexArrayID vaobjPacked                             = PackParam<VertexArrayID>(vaobj);
7713         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7714         bool isCallValid =
7715             (context->skipValidation() ||
7716              ValidateGetVertexArrayIndexediv(context, angle::EntryPoint::GLGetVertexArrayIndexediv,
7717                                              vaobjPacked, index, pname, param));
7718         if (isCallValid)
7719         {
7720             context->getVertexArrayIndexediv(vaobjPacked, index, pname, param);
7721         }
7722         ANGLE_CAPTURE(GetVertexArrayIndexediv, isCallValid, context, vaobjPacked, index, pname,
7723                       param);
7724     }
7725     else
7726     {
7727         GenerateContextLostErrorOnCurrentGlobalContext();
7728     }
7729 }
7730 
GL_GetVertexArrayiv(GLuint vaobj,GLenum pname,GLint * param)7731 void GL_APIENTRY GL_GetVertexArrayiv(GLuint vaobj, GLenum pname, GLint *param)
7732 {
7733     Context *context = GetValidGlobalContext();
7734     EVENT(context, GLGetVertexArrayiv,
7735           "context = %d, vaobj = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context), vaobj,
7736           GLenumToString(GLenumGroup::VertexArrayPName, pname), (uintptr_t)param);
7737 
7738     if (context)
7739     {
7740         VertexArrayID vaobjPacked                             = PackParam<VertexArrayID>(vaobj);
7741         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7742         bool isCallValid                                      = (context->skipValidation() ||
7743                             ValidateGetVertexArrayiv(context, angle::EntryPoint::GLGetVertexArrayiv,
7744                                                      vaobjPacked, pname, param));
7745         if (isCallValid)
7746         {
7747             context->getVertexArrayiv(vaobjPacked, pname, param);
7748         }
7749         ANGLE_CAPTURE(GetVertexArrayiv, isCallValid, context, vaobjPacked, pname, param);
7750     }
7751     else
7752     {
7753         GenerateContextLostErrorOnCurrentGlobalContext();
7754     }
7755 }
7756 
7757 void GL_APIENTRY
GL_GetnColorTable(GLenum target,GLenum format,GLenum type,GLsizei bufSize,void * table)7758 GL_GetnColorTable(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table)
7759 {
7760     Context *context = GetValidGlobalContext();
7761     EVENT(context, GLGetnColorTable,
7762           "context = %d, target = %s, format = %s, type = %s, bufSize = %d, table = 0x%016" PRIxPTR
7763           "",
7764           CID(context), GLenumToString(GLenumGroup::ColorTableTarget, target),
7765           GLenumToString(GLenumGroup::PixelFormat, format),
7766           GLenumToString(GLenumGroup::PixelType, type), bufSize, (uintptr_t)table);
7767 
7768     if (context)
7769     {
7770         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7771         bool isCallValid                                      = (context->skipValidation() ||
7772                             ValidateGetnColorTable(context, angle::EntryPoint::GLGetnColorTable,
7773                                                    target, format, type, bufSize, table));
7774         if (isCallValid)
7775         {
7776             context->getnColorTable(target, format, type, bufSize, table);
7777         }
7778         ANGLE_CAPTURE(GetnColorTable, isCallValid, context, target, format, type, bufSize, table);
7779     }
7780     else
7781     {
7782         GenerateContextLostErrorOnCurrentGlobalContext();
7783     }
7784 }
7785 
GL_GetnCompressedTexImage(GLenum target,GLint lod,GLsizei bufSize,void * pixels)7786 void GL_APIENTRY GL_GetnCompressedTexImage(GLenum target, GLint lod, GLsizei bufSize, void *pixels)
7787 {
7788     Context *context = GetValidGlobalContext();
7789     EVENT(context, GLGetnCompressedTexImage,
7790           "context = %d, target = %s, lod = %d, bufSize = %d, pixels = 0x%016" PRIxPTR "",
7791           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), lod, bufSize,
7792           (uintptr_t)pixels);
7793 
7794     if (context)
7795     {
7796         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7797         bool isCallValid =
7798             (context->skipValidation() ||
7799              ValidateGetnCompressedTexImage(context, angle::EntryPoint::GLGetnCompressedTexImage,
7800                                             target, lod, bufSize, pixels));
7801         if (isCallValid)
7802         {
7803             context->getnCompressedTexImage(target, lod, bufSize, pixels);
7804         }
7805         ANGLE_CAPTURE(GetnCompressedTexImage, isCallValid, context, target, lod, bufSize, pixels);
7806     }
7807     else
7808     {
7809         GenerateContextLostErrorOnCurrentGlobalContext();
7810     }
7811 }
7812 
7813 void GL_APIENTRY
GL_GetnConvolutionFilter(GLenum target,GLenum format,GLenum type,GLsizei bufSize,void * image)7814 GL_GetnConvolutionFilter(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image)
7815 {
7816     Context *context = GetValidGlobalContext();
7817     EVENT(context, GLGetnConvolutionFilter,
7818           "context = %d, target = %s, format = %s, type = %s, bufSize = %d, image = 0x%016" PRIxPTR
7819           "",
7820           CID(context), GLenumToString(GLenumGroup::ConvolutionTarget, target),
7821           GLenumToString(GLenumGroup::PixelFormat, format),
7822           GLenumToString(GLenumGroup::PixelType, type), bufSize, (uintptr_t)image);
7823 
7824     if (context)
7825     {
7826         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7827         bool isCallValid =
7828             (context->skipValidation() ||
7829              ValidateGetnConvolutionFilter(context, angle::EntryPoint::GLGetnConvolutionFilter,
7830                                            target, format, type, bufSize, image));
7831         if (isCallValid)
7832         {
7833             context->getnConvolutionFilter(target, format, type, bufSize, image);
7834         }
7835         ANGLE_CAPTURE(GetnConvolutionFilter, isCallValid, context, target, format, type, bufSize,
7836                       image);
7837     }
7838     else
7839     {
7840         GenerateContextLostErrorOnCurrentGlobalContext();
7841     }
7842 }
7843 
GL_GetnHistogram(GLenum target,GLboolean reset,GLenum format,GLenum type,GLsizei bufSize,void * values)7844 void GL_APIENTRY GL_GetnHistogram(GLenum target,
7845                                   GLboolean reset,
7846                                   GLenum format,
7847                                   GLenum type,
7848                                   GLsizei bufSize,
7849                                   void *values)
7850 {
7851     Context *context = GetValidGlobalContext();
7852     EVENT(context, GLGetnHistogram,
7853           "context = %d, target = %s, reset = %s, format = %s, type = %s, bufSize = %d, values = "
7854           "0x%016" PRIxPTR "",
7855           CID(context), GLenumToString(GLenumGroup::HistogramTargetEXT, target),
7856           GLbooleanToString(reset), GLenumToString(GLenumGroup::PixelFormat, format),
7857           GLenumToString(GLenumGroup::PixelType, type), bufSize, (uintptr_t)values);
7858 
7859     if (context)
7860     {
7861         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7862         bool isCallValid                                      = (context->skipValidation() ||
7863                             ValidateGetnHistogram(context, angle::EntryPoint::GLGetnHistogram,
7864                                                   target, reset, format, type, bufSize, values));
7865         if (isCallValid)
7866         {
7867             context->getnHistogram(target, reset, format, type, bufSize, values);
7868         }
7869         ANGLE_CAPTURE(GetnHistogram, isCallValid, context, target, reset, format, type, bufSize,
7870                       values);
7871     }
7872     else
7873     {
7874         GenerateContextLostErrorOnCurrentGlobalContext();
7875     }
7876 }
7877 
GL_GetnMapdv(GLenum target,GLenum query,GLsizei bufSize,GLdouble * v)7878 void GL_APIENTRY GL_GetnMapdv(GLenum target, GLenum query, GLsizei bufSize, GLdouble *v)
7879 {
7880     Context *context = GetValidGlobalContext();
7881     EVENT(context, GLGetnMapdv,
7882           "context = %d, target = %s, query = %s, bufSize = %d, v = 0x%016" PRIxPTR "",
7883           CID(context), GLenumToString(GLenumGroup::MapTarget, target),
7884           GLenumToString(GLenumGroup::MapQuery, query), bufSize, (uintptr_t)v);
7885 
7886     if (context)
7887     {
7888         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7889         bool isCallValid =
7890             (context->skipValidation() ||
7891              ValidateGetnMapdv(context, angle::EntryPoint::GLGetnMapdv, target, query, bufSize, v));
7892         if (isCallValid)
7893         {
7894             context->getnMapdv(target, query, bufSize, v);
7895         }
7896         ANGLE_CAPTURE(GetnMapdv, isCallValid, context, target, query, bufSize, v);
7897     }
7898     else
7899     {
7900         GenerateContextLostErrorOnCurrentGlobalContext();
7901     }
7902 }
7903 
GL_GetnMapfv(GLenum target,GLenum query,GLsizei bufSize,GLfloat * v)7904 void GL_APIENTRY GL_GetnMapfv(GLenum target, GLenum query, GLsizei bufSize, GLfloat *v)
7905 {
7906     Context *context = GetValidGlobalContext();
7907     EVENT(context, GLGetnMapfv,
7908           "context = %d, target = %s, query = %s, bufSize = %d, v = 0x%016" PRIxPTR "",
7909           CID(context), GLenumToString(GLenumGroup::MapTarget, target),
7910           GLenumToString(GLenumGroup::MapQuery, query), bufSize, (uintptr_t)v);
7911 
7912     if (context)
7913     {
7914         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7915         bool isCallValid =
7916             (context->skipValidation() ||
7917              ValidateGetnMapfv(context, angle::EntryPoint::GLGetnMapfv, target, query, bufSize, v));
7918         if (isCallValid)
7919         {
7920             context->getnMapfv(target, query, bufSize, v);
7921         }
7922         ANGLE_CAPTURE(GetnMapfv, isCallValid, context, target, query, bufSize, v);
7923     }
7924     else
7925     {
7926         GenerateContextLostErrorOnCurrentGlobalContext();
7927     }
7928 }
7929 
GL_GetnMapiv(GLenum target,GLenum query,GLsizei bufSize,GLint * v)7930 void GL_APIENTRY GL_GetnMapiv(GLenum target, GLenum query, GLsizei bufSize, GLint *v)
7931 {
7932     Context *context = GetValidGlobalContext();
7933     EVENT(context, GLGetnMapiv,
7934           "context = %d, target = %s, query = %s, bufSize = %d, v = 0x%016" PRIxPTR "",
7935           CID(context), GLenumToString(GLenumGroup::MapTarget, target),
7936           GLenumToString(GLenumGroup::MapQuery, query), bufSize, (uintptr_t)v);
7937 
7938     if (context)
7939     {
7940         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7941         bool isCallValid =
7942             (context->skipValidation() ||
7943              ValidateGetnMapiv(context, angle::EntryPoint::GLGetnMapiv, target, query, bufSize, v));
7944         if (isCallValid)
7945         {
7946             context->getnMapiv(target, query, bufSize, v);
7947         }
7948         ANGLE_CAPTURE(GetnMapiv, isCallValid, context, target, query, bufSize, v);
7949     }
7950     else
7951     {
7952         GenerateContextLostErrorOnCurrentGlobalContext();
7953     }
7954 }
7955 
GL_GetnMinmax(GLenum target,GLboolean reset,GLenum format,GLenum type,GLsizei bufSize,void * values)7956 void GL_APIENTRY GL_GetnMinmax(GLenum target,
7957                                GLboolean reset,
7958                                GLenum format,
7959                                GLenum type,
7960                                GLsizei bufSize,
7961                                void *values)
7962 {
7963     Context *context = GetValidGlobalContext();
7964     EVENT(context, GLGetnMinmax,
7965           "context = %d, target = %s, reset = %s, format = %s, type = %s, bufSize = %d, values = "
7966           "0x%016" PRIxPTR "",
7967           CID(context), GLenumToString(GLenumGroup::MinmaxTargetEXT, target),
7968           GLbooleanToString(reset), GLenumToString(GLenumGroup::PixelFormat, format),
7969           GLenumToString(GLenumGroup::PixelType, type), bufSize, (uintptr_t)values);
7970 
7971     if (context)
7972     {
7973         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7974         bool isCallValid                                      = (context->skipValidation() ||
7975                             ValidateGetnMinmax(context, angle::EntryPoint::GLGetnMinmax, target,
7976                                                reset, format, type, bufSize, values));
7977         if (isCallValid)
7978         {
7979             context->getnMinmax(target, reset, format, type, bufSize, values);
7980         }
7981         ANGLE_CAPTURE(GetnMinmax, isCallValid, context, target, reset, format, type, bufSize,
7982                       values);
7983     }
7984     else
7985     {
7986         GenerateContextLostErrorOnCurrentGlobalContext();
7987     }
7988 }
7989 
GL_GetnPixelMapfv(GLenum map,GLsizei bufSize,GLfloat * values)7990 void GL_APIENTRY GL_GetnPixelMapfv(GLenum map, GLsizei bufSize, GLfloat *values)
7991 {
7992     Context *context = GetValidGlobalContext();
7993     EVENT(context, GLGetnPixelMapfv,
7994           "context = %d, map = %s, bufSize = %d, values = 0x%016" PRIxPTR "", CID(context),
7995           GLenumToString(GLenumGroup::PixelMap, map), bufSize, (uintptr_t)values);
7996 
7997     if (context)
7998     {
7999         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8000         bool isCallValid                                      = (context->skipValidation() ||
8001                             ValidateGetnPixelMapfv(context, angle::EntryPoint::GLGetnPixelMapfv,
8002                                                    map, bufSize, values));
8003         if (isCallValid)
8004         {
8005             context->getnPixelMapfv(map, bufSize, values);
8006         }
8007         ANGLE_CAPTURE(GetnPixelMapfv, isCallValid, context, map, bufSize, values);
8008     }
8009     else
8010     {
8011         GenerateContextLostErrorOnCurrentGlobalContext();
8012     }
8013 }
8014 
GL_GetnPixelMapuiv(GLenum map,GLsizei bufSize,GLuint * values)8015 void GL_APIENTRY GL_GetnPixelMapuiv(GLenum map, GLsizei bufSize, GLuint *values)
8016 {
8017     Context *context = GetValidGlobalContext();
8018     EVENT(context, GLGetnPixelMapuiv,
8019           "context = %d, map = %s, bufSize = %d, values = 0x%016" PRIxPTR "", CID(context),
8020           GLenumToString(GLenumGroup::PixelMap, map), bufSize, (uintptr_t)values);
8021 
8022     if (context)
8023     {
8024         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8025         bool isCallValid                                      = (context->skipValidation() ||
8026                             ValidateGetnPixelMapuiv(context, angle::EntryPoint::GLGetnPixelMapuiv,
8027                                                     map, bufSize, values));
8028         if (isCallValid)
8029         {
8030             context->getnPixelMapuiv(map, bufSize, values);
8031         }
8032         ANGLE_CAPTURE(GetnPixelMapuiv, isCallValid, context, map, bufSize, values);
8033     }
8034     else
8035     {
8036         GenerateContextLostErrorOnCurrentGlobalContext();
8037     }
8038 }
8039 
GL_GetnPixelMapusv(GLenum map,GLsizei bufSize,GLushort * values)8040 void GL_APIENTRY GL_GetnPixelMapusv(GLenum map, GLsizei bufSize, GLushort *values)
8041 {
8042     Context *context = GetValidGlobalContext();
8043     EVENT(context, GLGetnPixelMapusv,
8044           "context = %d, map = %s, bufSize = %d, values = 0x%016" PRIxPTR "", CID(context),
8045           GLenumToString(GLenumGroup::PixelMap, map), bufSize, (uintptr_t)values);
8046 
8047     if (context)
8048     {
8049         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8050         bool isCallValid                                      = (context->skipValidation() ||
8051                             ValidateGetnPixelMapusv(context, angle::EntryPoint::GLGetnPixelMapusv,
8052                                                     map, bufSize, values));
8053         if (isCallValid)
8054         {
8055             context->getnPixelMapusv(map, bufSize, values);
8056         }
8057         ANGLE_CAPTURE(GetnPixelMapusv, isCallValid, context, map, bufSize, values);
8058     }
8059     else
8060     {
8061         GenerateContextLostErrorOnCurrentGlobalContext();
8062     }
8063 }
8064 
GL_GetnPolygonStipple(GLsizei bufSize,GLubyte * pattern)8065 void GL_APIENTRY GL_GetnPolygonStipple(GLsizei bufSize, GLubyte *pattern)
8066 {
8067     Context *context = GetValidGlobalContext();
8068     EVENT(context, GLGetnPolygonStipple, "context = %d, bufSize = %d, pattern = 0x%016" PRIxPTR "",
8069           CID(context), bufSize, (uintptr_t)pattern);
8070 
8071     if (context)
8072     {
8073         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8074         bool isCallValid =
8075             (context->skipValidation() ||
8076              ValidateGetnPolygonStipple(context, angle::EntryPoint::GLGetnPolygonStipple, bufSize,
8077                                         pattern));
8078         if (isCallValid)
8079         {
8080             context->getnPolygonStipple(bufSize, pattern);
8081         }
8082         ANGLE_CAPTURE(GetnPolygonStipple, isCallValid, context, bufSize, pattern);
8083     }
8084     else
8085     {
8086         GenerateContextLostErrorOnCurrentGlobalContext();
8087     }
8088 }
8089 
GL_GetnSeparableFilter(GLenum target,GLenum format,GLenum type,GLsizei rowBufSize,void * row,GLsizei columnBufSize,void * column,void * span)8090 void GL_APIENTRY GL_GetnSeparableFilter(GLenum target,
8091                                         GLenum format,
8092                                         GLenum type,
8093                                         GLsizei rowBufSize,
8094                                         void *row,
8095                                         GLsizei columnBufSize,
8096                                         void *column,
8097                                         void *span)
8098 {
8099     Context *context = GetValidGlobalContext();
8100     EVENT(context, GLGetnSeparableFilter,
8101           "context = %d, target = %s, format = %s, type = %s, rowBufSize = %d, row = 0x%016" PRIxPTR
8102           ", columnBufSize = %d, column = 0x%016" PRIxPTR ", span = 0x%016" PRIxPTR "",
8103           CID(context), GLenumToString(GLenumGroup::SeparableTargetEXT, target),
8104           GLenumToString(GLenumGroup::PixelFormat, format),
8105           GLenumToString(GLenumGroup::PixelType, type), rowBufSize, (uintptr_t)row, columnBufSize,
8106           (uintptr_t)column, (uintptr_t)span);
8107 
8108     if (context)
8109     {
8110         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8111         bool isCallValid                                      = (context->skipValidation() ||
8112                             ValidateGetnSeparableFilter(
8113                                 context, angle::EntryPoint::GLGetnSeparableFilter, target, format,
8114                                 type, rowBufSize, row, columnBufSize, column, span));
8115         if (isCallValid)
8116         {
8117             context->getnSeparableFilter(target, format, type, rowBufSize, row, columnBufSize,
8118                                          column, span);
8119         }
8120         ANGLE_CAPTURE(GetnSeparableFilter, isCallValid, context, target, format, type, rowBufSize,
8121                       row, columnBufSize, column, span);
8122     }
8123     else
8124     {
8125         GenerateContextLostErrorOnCurrentGlobalContext();
8126     }
8127 }
8128 
GL_GetnTexImage(GLenum target,GLint level,GLenum format,GLenum type,GLsizei bufSize,void * pixels)8129 void GL_APIENTRY GL_GetnTexImage(GLenum target,
8130                                  GLint level,
8131                                  GLenum format,
8132                                  GLenum type,
8133                                  GLsizei bufSize,
8134                                  void *pixels)
8135 {
8136     Context *context = GetValidGlobalContext();
8137     EVENT(context, GLGetnTexImage,
8138           "context = %d, target = %s, level = %d, format = %s, type = %s, bufSize = %d, pixels = "
8139           "0x%016" PRIxPTR "",
8140           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level,
8141           GLenumToString(GLenumGroup::PixelFormat, format),
8142           GLenumToString(GLenumGroup::PixelType, type), bufSize, (uintptr_t)pixels);
8143 
8144     if (context)
8145     {
8146         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8147         bool isCallValid                                      = (context->skipValidation() ||
8148                             ValidateGetnTexImage(context, angle::EntryPoint::GLGetnTexImage, target,
8149                                                  level, format, type, bufSize, pixels));
8150         if (isCallValid)
8151         {
8152             context->getnTexImage(target, level, format, type, bufSize, pixels);
8153         }
8154         ANGLE_CAPTURE(GetnTexImage, isCallValid, context, target, level, format, type, bufSize,
8155                       pixels);
8156     }
8157     else
8158     {
8159         GenerateContextLostErrorOnCurrentGlobalContext();
8160     }
8161 }
8162 
GL_GetnUniformdv(GLuint program,GLint location,GLsizei bufSize,GLdouble * params)8163 void GL_APIENTRY GL_GetnUniformdv(GLuint program, GLint location, GLsizei bufSize, GLdouble *params)
8164 {
8165     Context *context = GetValidGlobalContext();
8166     EVENT(context, GLGetnUniformdv,
8167           "context = %d, program = %u, location = %d, bufSize = %d, params = 0x%016" PRIxPTR "",
8168           CID(context), program, location, bufSize, (uintptr_t)params);
8169 
8170     if (context)
8171     {
8172         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8173         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8174         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8175         bool isCallValid                                      = (context->skipValidation() ||
8176                             ValidateGetnUniformdv(context, angle::EntryPoint::GLGetnUniformdv,
8177                                                   programPacked, locationPacked, bufSize, params));
8178         if (isCallValid)
8179         {
8180             context->getnUniformdv(programPacked, locationPacked, bufSize, params);
8181         }
8182         ANGLE_CAPTURE(GetnUniformdv, isCallValid, context, programPacked, locationPacked, bufSize,
8183                       params);
8184     }
8185     else
8186     {
8187         GenerateContextLostErrorOnCurrentGlobalContext();
8188     }
8189 }
8190 
GL_GetnUniformfv(GLuint program,GLint location,GLsizei bufSize,GLfloat * params)8191 void GL_APIENTRY GL_GetnUniformfv(GLuint program, GLint location, GLsizei bufSize, GLfloat *params)
8192 {
8193     Context *context = GetValidGlobalContext();
8194     EVENT(context, GLGetnUniformfv,
8195           "context = %d, program = %u, location = %d, bufSize = %d, params = 0x%016" PRIxPTR "",
8196           CID(context), program, location, bufSize, (uintptr_t)params);
8197 
8198     if (context)
8199     {
8200         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8201         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8202         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8203         bool isCallValid                                      = (context->skipValidation() ||
8204                             ValidateGetnUniformfv(context, angle::EntryPoint::GLGetnUniformfv,
8205                                                   programPacked, locationPacked, bufSize, params));
8206         if (isCallValid)
8207         {
8208             context->getnUniformfv(programPacked, locationPacked, bufSize, params);
8209         }
8210         ANGLE_CAPTURE(GetnUniformfv, isCallValid, context, programPacked, locationPacked, bufSize,
8211                       params);
8212     }
8213     else
8214     {
8215         GenerateContextLostErrorOnCurrentGlobalContext();
8216     }
8217 }
8218 
GL_GetnUniformiv(GLuint program,GLint location,GLsizei bufSize,GLint * params)8219 void GL_APIENTRY GL_GetnUniformiv(GLuint program, GLint location, GLsizei bufSize, GLint *params)
8220 {
8221     Context *context = GetValidGlobalContext();
8222     EVENT(context, GLGetnUniformiv,
8223           "context = %d, program = %u, location = %d, bufSize = %d, params = 0x%016" PRIxPTR "",
8224           CID(context), program, location, bufSize, (uintptr_t)params);
8225 
8226     if (context)
8227     {
8228         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8229         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8230         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8231         bool isCallValid                                      = (context->skipValidation() ||
8232                             ValidateGetnUniformiv(context, angle::EntryPoint::GLGetnUniformiv,
8233                                                   programPacked, locationPacked, bufSize, params));
8234         if (isCallValid)
8235         {
8236             context->getnUniformiv(programPacked, locationPacked, bufSize, params);
8237         }
8238         ANGLE_CAPTURE(GetnUniformiv, isCallValid, context, programPacked, locationPacked, bufSize,
8239                       params);
8240     }
8241     else
8242     {
8243         GenerateContextLostErrorOnCurrentGlobalContext();
8244     }
8245 }
8246 
GL_GetnUniformuiv(GLuint program,GLint location,GLsizei bufSize,GLuint * params)8247 void GL_APIENTRY GL_GetnUniformuiv(GLuint program, GLint location, GLsizei bufSize, GLuint *params)
8248 {
8249     Context *context = GetValidGlobalContext();
8250     EVENT(context, GLGetnUniformuiv,
8251           "context = %d, program = %u, location = %d, bufSize = %d, params = 0x%016" PRIxPTR "",
8252           CID(context), program, location, bufSize, (uintptr_t)params);
8253 
8254     if (context)
8255     {
8256         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8257         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8258         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8259         bool isCallValid                                      = (context->skipValidation() ||
8260                             ValidateGetnUniformuiv(context, angle::EntryPoint::GLGetnUniformuiv,
8261                                                    programPacked, locationPacked, bufSize, params));
8262         if (isCallValid)
8263         {
8264             context->getnUniformuiv(programPacked, locationPacked, bufSize, params);
8265         }
8266         ANGLE_CAPTURE(GetnUniformuiv, isCallValid, context, programPacked, locationPacked, bufSize,
8267                       params);
8268     }
8269     else
8270     {
8271         GenerateContextLostErrorOnCurrentGlobalContext();
8272     }
8273 }
8274 
GL_InvalidateNamedFramebufferData(GLuint framebuffer,GLsizei numAttachments,const GLenum * attachments)8275 void GL_APIENTRY GL_InvalidateNamedFramebufferData(GLuint framebuffer,
8276                                                    GLsizei numAttachments,
8277                                                    const GLenum *attachments)
8278 {
8279     Context *context = GetValidGlobalContext();
8280     EVENT(context, GLInvalidateNamedFramebufferData,
8281           "context = %d, framebuffer = %u, numAttachments = %d, attachments = 0x%016" PRIxPTR "",
8282           CID(context), framebuffer, numAttachments, (uintptr_t)attachments);
8283 
8284     if (context)
8285     {
8286         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
8287         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8288         bool isCallValid                                      = (context->skipValidation() ||
8289                             ValidateInvalidateNamedFramebufferData(
8290                                 context, angle::EntryPoint::GLInvalidateNamedFramebufferData,
8291                                 framebufferPacked, numAttachments, attachments));
8292         if (isCallValid)
8293         {
8294             context->invalidateNamedFramebufferData(framebufferPacked, numAttachments, attachments);
8295         }
8296         ANGLE_CAPTURE(InvalidateNamedFramebufferData, isCallValid, context, framebufferPacked,
8297                       numAttachments, attachments);
8298     }
8299     else
8300     {
8301         GenerateContextLostErrorOnCurrentGlobalContext();
8302     }
8303 }
8304 
GL_InvalidateNamedFramebufferSubData(GLuint framebuffer,GLsizei numAttachments,const GLenum * attachments,GLint x,GLint y,GLsizei width,GLsizei height)8305 void GL_APIENTRY GL_InvalidateNamedFramebufferSubData(GLuint framebuffer,
8306                                                       GLsizei numAttachments,
8307                                                       const GLenum *attachments,
8308                                                       GLint x,
8309                                                       GLint y,
8310                                                       GLsizei width,
8311                                                       GLsizei height)
8312 {
8313     Context *context = GetValidGlobalContext();
8314     EVENT(context, GLInvalidateNamedFramebufferSubData,
8315           "context = %d, framebuffer = %u, numAttachments = %d, attachments = 0x%016" PRIxPTR
8316           ", x = %d, y = %d, width = %d, height = %d",
8317           CID(context), framebuffer, numAttachments, (uintptr_t)attachments, x, y, width, height);
8318 
8319     if (context)
8320     {
8321         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
8322         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8323         bool isCallValid =
8324             (context->skipValidation() ||
8325              ValidateInvalidateNamedFramebufferSubData(
8326                  context, angle::EntryPoint::GLInvalidateNamedFramebufferSubData, framebufferPacked,
8327                  numAttachments, attachments, x, y, width, height));
8328         if (isCallValid)
8329         {
8330             context->invalidateNamedFramebufferSubData(framebufferPacked, numAttachments,
8331                                                        attachments, x, y, width, height);
8332         }
8333         ANGLE_CAPTURE(InvalidateNamedFramebufferSubData, isCallValid, context, framebufferPacked,
8334                       numAttachments, attachments, x, y, width, height);
8335     }
8336     else
8337     {
8338         GenerateContextLostErrorOnCurrentGlobalContext();
8339     }
8340 }
8341 
GL_MapNamedBuffer(GLuint buffer,GLenum access)8342 void *GL_APIENTRY GL_MapNamedBuffer(GLuint buffer, GLenum access)
8343 {
8344     Context *context = GetValidGlobalContext();
8345     EVENT(context, GLMapNamedBuffer, "context = %d, buffer = %u, access = %s", CID(context), buffer,
8346           GLenumToString(GLenumGroup::BufferAccessARB, access));
8347 
8348     void *returnValue;
8349     if (context)
8350     {
8351         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
8352         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8353         bool isCallValid                                      = (context->skipValidation() ||
8354                             ValidateMapNamedBuffer(context, angle::EntryPoint::GLMapNamedBuffer,
8355                                                    bufferPacked, access));
8356         if (isCallValid)
8357         {
8358             returnValue = context->mapNamedBuffer(bufferPacked, access);
8359         }
8360         else
8361         {
8362             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapNamedBuffer, void *>();
8363         }
8364         ANGLE_CAPTURE(MapNamedBuffer, isCallValid, context, bufferPacked, access, returnValue);
8365     }
8366     else
8367     {
8368         GenerateContextLostErrorOnCurrentGlobalContext();
8369         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapNamedBuffer, void *>();
8370     }
8371     return returnValue;
8372 }
8373 
GL_MapNamedBufferRange(GLuint buffer,GLintptr offset,GLsizeiptr length,GLbitfield access)8374 void *GL_APIENTRY GL_MapNamedBufferRange(GLuint buffer,
8375                                          GLintptr offset,
8376                                          GLsizeiptr length,
8377                                          GLbitfield access)
8378 {
8379     Context *context = GetValidGlobalContext();
8380     EVENT(context, GLMapNamedBufferRange,
8381           "context = %d, buffer = %u, offset = %llu, length = %llu, access = %s", CID(context),
8382           buffer, static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length),
8383           GLbitfieldToString(GLenumGroup::BufferAccessMask, access).c_str());
8384 
8385     void *returnValue;
8386     if (context)
8387     {
8388         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
8389         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8390         bool isCallValid =
8391             (context->skipValidation() ||
8392              ValidateMapNamedBufferRange(context, angle::EntryPoint::GLMapNamedBufferRange,
8393                                          bufferPacked, offset, length, access));
8394         if (isCallValid)
8395         {
8396             returnValue = context->mapNamedBufferRange(bufferPacked, offset, length, access);
8397         }
8398         else
8399         {
8400             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapNamedBufferRange, void *>();
8401         }
8402         ANGLE_CAPTURE(MapNamedBufferRange, isCallValid, context, bufferPacked, offset, length,
8403                       access, returnValue);
8404     }
8405     else
8406     {
8407         GenerateContextLostErrorOnCurrentGlobalContext();
8408         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapNamedBufferRange, void *>();
8409     }
8410     return returnValue;
8411 }
8412 
GL_MemoryBarrierByRegion(GLbitfield barriers)8413 void GL_APIENTRY GL_MemoryBarrierByRegion(GLbitfield barriers)
8414 {
8415     Context *context = GetValidGlobalContext();
8416     EVENT(context, GLMemoryBarrierByRegion, "context = %d, barriers = %s", CID(context),
8417           GLbitfieldToString(GLenumGroup::MemoryBarrierMask, barriers).c_str());
8418 
8419     if (context)
8420     {
8421         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8422         bool isCallValid                                      = (context->skipValidation() ||
8423                             ValidateMemoryBarrierByRegion(
8424                                 context, angle::EntryPoint::GLMemoryBarrierByRegion, barriers));
8425         if (isCallValid)
8426         {
8427             context->memoryBarrierByRegion(barriers);
8428         }
8429         ANGLE_CAPTURE(MemoryBarrierByRegion, isCallValid, context, barriers);
8430     }
8431     else
8432     {
8433         GenerateContextLostErrorOnCurrentGlobalContext();
8434     }
8435 }
8436 
GL_NamedBufferData(GLuint buffer,GLsizeiptr size,const void * data,GLenum usage)8437 void GL_APIENTRY GL_NamedBufferData(GLuint buffer, GLsizeiptr size, const void *data, GLenum usage)
8438 {
8439     Context *context = GetValidGlobalContext();
8440     EVENT(context, GLNamedBufferData,
8441           "context = %d, buffer = %u, size = %llu, data = 0x%016" PRIxPTR ", usage = %s",
8442           CID(context), buffer, static_cast<unsigned long long>(size), (uintptr_t)data,
8443           GLenumToString(GLenumGroup::VertexBufferObjectUsage, usage));
8444 
8445     if (context)
8446     {
8447         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
8448         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8449         bool isCallValid                                      = (context->skipValidation() ||
8450                             ValidateNamedBufferData(context, angle::EntryPoint::GLNamedBufferData,
8451                                                     bufferPacked, size, data, usage));
8452         if (isCallValid)
8453         {
8454             context->namedBufferData(bufferPacked, size, data, usage);
8455         }
8456         ANGLE_CAPTURE(NamedBufferData, isCallValid, context, bufferPacked, size, data, usage);
8457     }
8458     else
8459     {
8460         GenerateContextLostErrorOnCurrentGlobalContext();
8461     }
8462 }
8463 
GL_NamedBufferStorage(GLuint buffer,GLsizeiptr size,const void * data,GLbitfield flags)8464 void GL_APIENTRY GL_NamedBufferStorage(GLuint buffer,
8465                                        GLsizeiptr size,
8466                                        const void *data,
8467                                        GLbitfield flags)
8468 {
8469     Context *context = GetValidGlobalContext();
8470     EVENT(context, GLNamedBufferStorage,
8471           "context = %d, buffer = %u, size = %llu, data = 0x%016" PRIxPTR ", flags = %s",
8472           CID(context), buffer, static_cast<unsigned long long>(size), (uintptr_t)data,
8473           GLbitfieldToString(GLenumGroup::MapBufferUsageMask, flags).c_str());
8474 
8475     if (context)
8476     {
8477         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
8478         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8479         bool isCallValid =
8480             (context->skipValidation() ||
8481              ValidateNamedBufferStorage(context, angle::EntryPoint::GLNamedBufferStorage,
8482                                         bufferPacked, size, data, flags));
8483         if (isCallValid)
8484         {
8485             context->namedBufferStorage(bufferPacked, size, data, flags);
8486         }
8487         ANGLE_CAPTURE(NamedBufferStorage, isCallValid, context, bufferPacked, size, data, flags);
8488     }
8489     else
8490     {
8491         GenerateContextLostErrorOnCurrentGlobalContext();
8492     }
8493 }
8494 
GL_NamedBufferSubData(GLuint buffer,GLintptr offset,GLsizeiptr size,const void * data)8495 void GL_APIENTRY GL_NamedBufferSubData(GLuint buffer,
8496                                        GLintptr offset,
8497                                        GLsizeiptr size,
8498                                        const void *data)
8499 {
8500     Context *context = GetValidGlobalContext();
8501     EVENT(context, GLNamedBufferSubData,
8502           "context = %d, buffer = %u, offset = %llu, size = %llu, data = 0x%016" PRIxPTR "",
8503           CID(context), buffer, static_cast<unsigned long long>(offset),
8504           static_cast<unsigned long long>(size), (uintptr_t)data);
8505 
8506     if (context)
8507     {
8508         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
8509         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8510         bool isCallValid =
8511             (context->skipValidation() ||
8512              ValidateNamedBufferSubData(context, angle::EntryPoint::GLNamedBufferSubData,
8513                                         bufferPacked, offset, size, data));
8514         if (isCallValid)
8515         {
8516             context->namedBufferSubData(bufferPacked, offset, size, data);
8517         }
8518         ANGLE_CAPTURE(NamedBufferSubData, isCallValid, context, bufferPacked, offset, size, data);
8519     }
8520     else
8521     {
8522         GenerateContextLostErrorOnCurrentGlobalContext();
8523     }
8524 }
8525 
GL_NamedFramebufferDrawBuffer(GLuint framebuffer,GLenum buf)8526 void GL_APIENTRY GL_NamedFramebufferDrawBuffer(GLuint framebuffer, GLenum buf)
8527 {
8528     Context *context = GetValidGlobalContext();
8529     EVENT(context, GLNamedFramebufferDrawBuffer, "context = %d, framebuffer = %u, buf = %s",
8530           CID(context), framebuffer, GLenumToString(GLenumGroup::ColorBuffer, buf));
8531 
8532     if (context)
8533     {
8534         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
8535         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8536         bool isCallValid =
8537             (context->skipValidation() ||
8538              ValidateNamedFramebufferDrawBuffer(
8539                  context, angle::EntryPoint::GLNamedFramebufferDrawBuffer, framebufferPacked, buf));
8540         if (isCallValid)
8541         {
8542             context->namedFramebufferDrawBuffer(framebufferPacked, buf);
8543         }
8544         ANGLE_CAPTURE(NamedFramebufferDrawBuffer, isCallValid, context, framebufferPacked, buf);
8545     }
8546     else
8547     {
8548         GenerateContextLostErrorOnCurrentGlobalContext();
8549     }
8550 }
8551 
GL_NamedFramebufferDrawBuffers(GLuint framebuffer,GLsizei n,const GLenum * bufs)8552 void GL_APIENTRY GL_NamedFramebufferDrawBuffers(GLuint framebuffer, GLsizei n, const GLenum *bufs)
8553 {
8554     Context *context = GetValidGlobalContext();
8555     EVENT(context, GLNamedFramebufferDrawBuffers,
8556           "context = %d, framebuffer = %u, n = %d, bufs = 0x%016" PRIxPTR "", CID(context),
8557           framebuffer, n, (uintptr_t)bufs);
8558 
8559     if (context)
8560     {
8561         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
8562         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8563         bool isCallValid                                      = (context->skipValidation() ||
8564                             ValidateNamedFramebufferDrawBuffers(
8565                                 context, angle::EntryPoint::GLNamedFramebufferDrawBuffers,
8566                                 framebufferPacked, n, bufs));
8567         if (isCallValid)
8568         {
8569             context->namedFramebufferDrawBuffers(framebufferPacked, n, bufs);
8570         }
8571         ANGLE_CAPTURE(NamedFramebufferDrawBuffers, isCallValid, context, framebufferPacked, n,
8572                       bufs);
8573     }
8574     else
8575     {
8576         GenerateContextLostErrorOnCurrentGlobalContext();
8577     }
8578 }
8579 
GL_NamedFramebufferParameteri(GLuint framebuffer,GLenum pname,GLint param)8580 void GL_APIENTRY GL_NamedFramebufferParameteri(GLuint framebuffer, GLenum pname, GLint param)
8581 {
8582     Context *context = GetValidGlobalContext();
8583     EVENT(context, GLNamedFramebufferParameteri,
8584           "context = %d, framebuffer = %u, pname = %s, param = %d", CID(context), framebuffer,
8585           GLenumToString(GLenumGroup::FramebufferParameterName, pname), param);
8586 
8587     if (context)
8588     {
8589         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
8590         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8591         bool isCallValid                                      = (context->skipValidation() ||
8592                             ValidateNamedFramebufferParameteri(
8593                                 context, angle::EntryPoint::GLNamedFramebufferParameteri,
8594                                 framebufferPacked, pname, param));
8595         if (isCallValid)
8596         {
8597             context->namedFramebufferParameteri(framebufferPacked, pname, param);
8598         }
8599         ANGLE_CAPTURE(NamedFramebufferParameteri, isCallValid, context, framebufferPacked, pname,
8600                       param);
8601     }
8602     else
8603     {
8604         GenerateContextLostErrorOnCurrentGlobalContext();
8605     }
8606 }
8607 
GL_NamedFramebufferReadBuffer(GLuint framebuffer,GLenum src)8608 void GL_APIENTRY GL_NamedFramebufferReadBuffer(GLuint framebuffer, GLenum src)
8609 {
8610     Context *context = GetValidGlobalContext();
8611     EVENT(context, GLNamedFramebufferReadBuffer, "context = %d, framebuffer = %u, src = %s",
8612           CID(context), framebuffer, GLenumToString(GLenumGroup::ColorBuffer, src));
8613 
8614     if (context)
8615     {
8616         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
8617         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8618         bool isCallValid =
8619             (context->skipValidation() ||
8620              ValidateNamedFramebufferReadBuffer(
8621                  context, angle::EntryPoint::GLNamedFramebufferReadBuffer, framebufferPacked, src));
8622         if (isCallValid)
8623         {
8624             context->namedFramebufferReadBuffer(framebufferPacked, src);
8625         }
8626         ANGLE_CAPTURE(NamedFramebufferReadBuffer, isCallValid, context, framebufferPacked, src);
8627     }
8628     else
8629     {
8630         GenerateContextLostErrorOnCurrentGlobalContext();
8631     }
8632 }
8633 
GL_NamedFramebufferRenderbuffer(GLuint framebuffer,GLenum attachment,GLenum renderbuffertarget,GLuint renderbuffer)8634 void GL_APIENTRY GL_NamedFramebufferRenderbuffer(GLuint framebuffer,
8635                                                  GLenum attachment,
8636                                                  GLenum renderbuffertarget,
8637                                                  GLuint renderbuffer)
8638 {
8639     Context *context = GetValidGlobalContext();
8640     EVENT(context, GLNamedFramebufferRenderbuffer,
8641           "context = %d, framebuffer = %u, attachment = %s, renderbuffertarget = %s, renderbuffer "
8642           "= %u",
8643           CID(context), framebuffer, GLenumToString(GLenumGroup::FramebufferAttachment, attachment),
8644           GLenumToString(GLenumGroup::RenderbufferTarget, renderbuffertarget), renderbuffer);
8645 
8646     if (context)
8647     {
8648         FramebufferID framebufferPacked   = PackParam<FramebufferID>(framebuffer);
8649         RenderbufferID renderbufferPacked = PackParam<RenderbufferID>(renderbuffer);
8650         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8651         bool isCallValid =
8652             (context->skipValidation() ||
8653              ValidateNamedFramebufferRenderbuffer(
8654                  context, angle::EntryPoint::GLNamedFramebufferRenderbuffer, framebufferPacked,
8655                  attachment, renderbuffertarget, renderbufferPacked));
8656         if (isCallValid)
8657         {
8658             context->namedFramebufferRenderbuffer(framebufferPacked, attachment, renderbuffertarget,
8659                                                   renderbufferPacked);
8660         }
8661         ANGLE_CAPTURE(NamedFramebufferRenderbuffer, isCallValid, context, framebufferPacked,
8662                       attachment, renderbuffertarget, renderbufferPacked);
8663     }
8664     else
8665     {
8666         GenerateContextLostErrorOnCurrentGlobalContext();
8667     }
8668 }
8669 
GL_NamedFramebufferTexture(GLuint framebuffer,GLenum attachment,GLuint texture,GLint level)8670 void GL_APIENTRY GL_NamedFramebufferTexture(GLuint framebuffer,
8671                                             GLenum attachment,
8672                                             GLuint texture,
8673                                             GLint level)
8674 {
8675     Context *context = GetValidGlobalContext();
8676     EVENT(context, GLNamedFramebufferTexture,
8677           "context = %d, framebuffer = %u, attachment = %s, texture = %u, level = %d", CID(context),
8678           framebuffer, GLenumToString(GLenumGroup::FramebufferAttachment, attachment), texture,
8679           level);
8680 
8681     if (context)
8682     {
8683         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
8684         TextureID texturePacked         = PackParam<TextureID>(texture);
8685         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8686         bool isCallValid =
8687             (context->skipValidation() ||
8688              ValidateNamedFramebufferTexture(context, angle::EntryPoint::GLNamedFramebufferTexture,
8689                                              framebufferPacked, attachment, texturePacked, level));
8690         if (isCallValid)
8691         {
8692             context->namedFramebufferTexture(framebufferPacked, attachment, texturePacked, level);
8693         }
8694         ANGLE_CAPTURE(NamedFramebufferTexture, isCallValid, context, framebufferPacked, attachment,
8695                       texturePacked, level);
8696     }
8697     else
8698     {
8699         GenerateContextLostErrorOnCurrentGlobalContext();
8700     }
8701 }
8702 
GL_NamedFramebufferTextureLayer(GLuint framebuffer,GLenum attachment,GLuint texture,GLint level,GLint layer)8703 void GL_APIENTRY GL_NamedFramebufferTextureLayer(GLuint framebuffer,
8704                                                  GLenum attachment,
8705                                                  GLuint texture,
8706                                                  GLint level,
8707                                                  GLint layer)
8708 {
8709     Context *context = GetValidGlobalContext();
8710     EVENT(context, GLNamedFramebufferTextureLayer,
8711           "context = %d, framebuffer = %u, attachment = %s, texture = %u, level = %d, layer = %d",
8712           CID(context), framebuffer, GLenumToString(GLenumGroup::FramebufferAttachment, attachment),
8713           texture, level, layer);
8714 
8715     if (context)
8716     {
8717         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
8718         TextureID texturePacked         = PackParam<TextureID>(texture);
8719         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8720         bool isCallValid                                      = (context->skipValidation() ||
8721                             ValidateNamedFramebufferTextureLayer(
8722                                 context, angle::EntryPoint::GLNamedFramebufferTextureLayer,
8723                                 framebufferPacked, attachment, texturePacked, level, layer));
8724         if (isCallValid)
8725         {
8726             context->namedFramebufferTextureLayer(framebufferPacked, attachment, texturePacked,
8727                                                   level, layer);
8728         }
8729         ANGLE_CAPTURE(NamedFramebufferTextureLayer, isCallValid, context, framebufferPacked,
8730                       attachment, texturePacked, level, layer);
8731     }
8732     else
8733     {
8734         GenerateContextLostErrorOnCurrentGlobalContext();
8735     }
8736 }
8737 
GL_NamedRenderbufferStorage(GLuint renderbuffer,GLenum internalformat,GLsizei width,GLsizei height)8738 void GL_APIENTRY GL_NamedRenderbufferStorage(GLuint renderbuffer,
8739                                              GLenum internalformat,
8740                                              GLsizei width,
8741                                              GLsizei height)
8742 {
8743     Context *context = GetValidGlobalContext();
8744     EVENT(context, GLNamedRenderbufferStorage,
8745           "context = %d, renderbuffer = %u, internalformat = %s, width = %d, height = %d",
8746           CID(context), renderbuffer, GLenumToString(GLenumGroup::InternalFormat, internalformat),
8747           width, height);
8748 
8749     if (context)
8750     {
8751         RenderbufferID renderbufferPacked = PackParam<RenderbufferID>(renderbuffer);
8752         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8753         bool isCallValid                                      = (context->skipValidation() ||
8754                             ValidateNamedRenderbufferStorage(
8755                                 context, angle::EntryPoint::GLNamedRenderbufferStorage,
8756                                 renderbufferPacked, internalformat, width, height));
8757         if (isCallValid)
8758         {
8759             context->namedRenderbufferStorage(renderbufferPacked, internalformat, width, height);
8760         }
8761         ANGLE_CAPTURE(NamedRenderbufferStorage, isCallValid, context, renderbufferPacked,
8762                       internalformat, width, height);
8763     }
8764     else
8765     {
8766         GenerateContextLostErrorOnCurrentGlobalContext();
8767     }
8768 }
8769 
GL_NamedRenderbufferStorageMultisample(GLuint renderbuffer,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height)8770 void GL_APIENTRY GL_NamedRenderbufferStorageMultisample(GLuint renderbuffer,
8771                                                         GLsizei samples,
8772                                                         GLenum internalformat,
8773                                                         GLsizei width,
8774                                                         GLsizei height)
8775 {
8776     Context *context = GetValidGlobalContext();
8777     EVENT(context, GLNamedRenderbufferStorageMultisample,
8778           "context = %d, renderbuffer = %u, samples = %d, internalformat = %s, width = %d, height "
8779           "= %d",
8780           CID(context), renderbuffer, samples,
8781           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height);
8782 
8783     if (context)
8784     {
8785         RenderbufferID renderbufferPacked = PackParam<RenderbufferID>(renderbuffer);
8786         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8787         bool isCallValid                                      = (context->skipValidation() ||
8788                             ValidateNamedRenderbufferStorageMultisample(
8789                                 context, angle::EntryPoint::GLNamedRenderbufferStorageMultisample,
8790                                 renderbufferPacked, samples, internalformat, width, height));
8791         if (isCallValid)
8792         {
8793             context->namedRenderbufferStorageMultisample(renderbufferPacked, samples,
8794                                                          internalformat, width, height);
8795         }
8796         ANGLE_CAPTURE(NamedRenderbufferStorageMultisample, isCallValid, context, renderbufferPacked,
8797                       samples, internalformat, width, height);
8798     }
8799     else
8800     {
8801         GenerateContextLostErrorOnCurrentGlobalContext();
8802     }
8803 }
8804 
GL_ReadnPixels(GLint x,GLint y,GLsizei width,GLsizei height,GLenum format,GLenum type,GLsizei bufSize,void * data)8805 void GL_APIENTRY GL_ReadnPixels(GLint x,
8806                                 GLint y,
8807                                 GLsizei width,
8808                                 GLsizei height,
8809                                 GLenum format,
8810                                 GLenum type,
8811                                 GLsizei bufSize,
8812                                 void *data)
8813 {
8814     Context *context = GetValidGlobalContext();
8815     EVENT(context, GLReadnPixels,
8816           "context = %d, x = %d, y = %d, width = %d, height = %d, format = %s, type = %s, bufSize "
8817           "= %d, data = 0x%016" PRIxPTR "",
8818           CID(context), x, y, width, height, GLenumToString(GLenumGroup::PixelFormat, format),
8819           GLenumToString(GLenumGroup::PixelType, type), bufSize, (uintptr_t)data);
8820 
8821     if (context)
8822     {
8823         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8824         bool isCallValid                                      = (context->skipValidation() ||
8825                             ValidateReadnPixels(context, angle::EntryPoint::GLReadnPixels, x, y,
8826                                                 width, height, format, type, bufSize, data));
8827         if (isCallValid)
8828         {
8829             context->readnPixels(x, y, width, height, format, type, bufSize, data);
8830         }
8831         ANGLE_CAPTURE(ReadnPixels, isCallValid, context, x, y, width, height, format, type, bufSize,
8832                       data);
8833     }
8834     else
8835     {
8836         GenerateContextLostErrorOnCurrentGlobalContext();
8837     }
8838 }
8839 
GL_TextureBarrier()8840 void GL_APIENTRY GL_TextureBarrier()
8841 {
8842     Context *context = GetValidGlobalContext();
8843     EVENT(context, GLTextureBarrier, "context = %d", CID(context));
8844 
8845     if (context)
8846     {
8847         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8848         bool isCallValid                                      = (context->skipValidation() ||
8849                             ValidateTextureBarrier(context, angle::EntryPoint::GLTextureBarrier));
8850         if (isCallValid)
8851         {
8852             context->textureBarrier();
8853         }
8854         ANGLE_CAPTURE(TextureBarrier, isCallValid, context);
8855     }
8856     else
8857     {
8858         GenerateContextLostErrorOnCurrentGlobalContext();
8859     }
8860 }
8861 
GL_TextureBuffer(GLuint texture,GLenum internalformat,GLuint buffer)8862 void GL_APIENTRY GL_TextureBuffer(GLuint texture, GLenum internalformat, GLuint buffer)
8863 {
8864     Context *context = GetValidGlobalContext();
8865     EVENT(context, GLTextureBuffer, "context = %d, texture = %u, internalformat = %s, buffer = %u",
8866           CID(context), texture, GLenumToString(GLenumGroup::InternalFormat, internalformat),
8867           buffer);
8868 
8869     if (context)
8870     {
8871         TextureID texturePacked                               = PackParam<TextureID>(texture);
8872         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
8873         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8874         bool isCallValid                                      = (context->skipValidation() ||
8875                             ValidateTextureBuffer(context, angle::EntryPoint::GLTextureBuffer,
8876                                                   texturePacked, internalformat, bufferPacked));
8877         if (isCallValid)
8878         {
8879             context->textureBuffer(texturePacked, internalformat, bufferPacked);
8880         }
8881         ANGLE_CAPTURE(TextureBuffer, isCallValid, context, texturePacked, internalformat,
8882                       bufferPacked);
8883     }
8884     else
8885     {
8886         GenerateContextLostErrorOnCurrentGlobalContext();
8887     }
8888 }
8889 
GL_TextureBufferRange(GLuint texture,GLenum internalformat,GLuint buffer,GLintptr offset,GLsizeiptr size)8890 void GL_APIENTRY GL_TextureBufferRange(GLuint texture,
8891                                        GLenum internalformat,
8892                                        GLuint buffer,
8893                                        GLintptr offset,
8894                                        GLsizeiptr size)
8895 {
8896     Context *context = GetValidGlobalContext();
8897     EVENT(
8898         context, GLTextureBufferRange,
8899         "context = %d, texture = %u, internalformat = %s, buffer = %u, offset = %llu, size = %llu",
8900         CID(context), texture, GLenumToString(GLenumGroup::InternalFormat, internalformat), buffer,
8901         static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size));
8902 
8903     if (context)
8904     {
8905         TextureID texturePacked                               = PackParam<TextureID>(texture);
8906         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
8907         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8908         bool isCallValid =
8909             (context->skipValidation() ||
8910              ValidateTextureBufferRange(context, angle::EntryPoint::GLTextureBufferRange,
8911                                         texturePacked, internalformat, bufferPacked, offset, size));
8912         if (isCallValid)
8913         {
8914             context->textureBufferRange(texturePacked, internalformat, bufferPacked, offset, size);
8915         }
8916         ANGLE_CAPTURE(TextureBufferRange, isCallValid, context, texturePacked, internalformat,
8917                       bufferPacked, offset, size);
8918     }
8919     else
8920     {
8921         GenerateContextLostErrorOnCurrentGlobalContext();
8922     }
8923 }
8924 
GL_TextureParameterIiv(GLuint texture,GLenum pname,const GLint * params)8925 void GL_APIENTRY GL_TextureParameterIiv(GLuint texture, GLenum pname, const GLint *params)
8926 {
8927     Context *context = GetValidGlobalContext();
8928     EVENT(context, GLTextureParameterIiv,
8929           "context = %d, texture = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
8930           texture, GLenumToString(GLenumGroup::TextureParameterName, pname), (uintptr_t)params);
8931 
8932     if (context)
8933     {
8934         TextureID texturePacked                               = PackParam<TextureID>(texture);
8935         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8936         bool isCallValid =
8937             (context->skipValidation() ||
8938              ValidateTextureParameterIiv(context, angle::EntryPoint::GLTextureParameterIiv,
8939                                          texturePacked, pname, params));
8940         if (isCallValid)
8941         {
8942             context->textureParameterIiv(texturePacked, pname, params);
8943         }
8944         ANGLE_CAPTURE(TextureParameterIiv, isCallValid, context, texturePacked, pname, params);
8945     }
8946     else
8947     {
8948         GenerateContextLostErrorOnCurrentGlobalContext();
8949     }
8950 }
8951 
GL_TextureParameterIuiv(GLuint texture,GLenum pname,const GLuint * params)8952 void GL_APIENTRY GL_TextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params)
8953 {
8954     Context *context = GetValidGlobalContext();
8955     EVENT(context, GLTextureParameterIuiv,
8956           "context = %d, texture = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
8957           texture, GLenumToString(GLenumGroup::TextureParameterName, pname), (uintptr_t)params);
8958 
8959     if (context)
8960     {
8961         TextureID texturePacked                               = PackParam<TextureID>(texture);
8962         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8963         bool isCallValid =
8964             (context->skipValidation() ||
8965              ValidateTextureParameterIuiv(context, angle::EntryPoint::GLTextureParameterIuiv,
8966                                           texturePacked, pname, params));
8967         if (isCallValid)
8968         {
8969             context->textureParameterIuiv(texturePacked, pname, params);
8970         }
8971         ANGLE_CAPTURE(TextureParameterIuiv, isCallValid, context, texturePacked, pname, params);
8972     }
8973     else
8974     {
8975         GenerateContextLostErrorOnCurrentGlobalContext();
8976     }
8977 }
8978 
GL_TextureParameterf(GLuint texture,GLenum pname,GLfloat param)8979 void GL_APIENTRY GL_TextureParameterf(GLuint texture, GLenum pname, GLfloat param)
8980 {
8981     Context *context = GetValidGlobalContext();
8982     EVENT(context, GLTextureParameterf, "context = %d, texture = %u, pname = %s, param = %f",
8983           CID(context), texture, GLenumToString(GLenumGroup::TextureParameterName, pname), param);
8984 
8985     if (context)
8986     {
8987         TextureID texturePacked                               = PackParam<TextureID>(texture);
8988         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8989         bool isCallValid =
8990             (context->skipValidation() ||
8991              ValidateTextureParameterf(context, angle::EntryPoint::GLTextureParameterf,
8992                                        texturePacked, pname, param));
8993         if (isCallValid)
8994         {
8995             context->textureParameterf(texturePacked, pname, param);
8996         }
8997         ANGLE_CAPTURE(TextureParameterf, isCallValid, context, texturePacked, pname, param);
8998     }
8999     else
9000     {
9001         GenerateContextLostErrorOnCurrentGlobalContext();
9002     }
9003 }
9004 
GL_TextureParameterfv(GLuint texture,GLenum pname,const GLfloat * param)9005 void GL_APIENTRY GL_TextureParameterfv(GLuint texture, GLenum pname, const GLfloat *param)
9006 {
9007     Context *context = GetValidGlobalContext();
9008     EVENT(context, GLTextureParameterfv,
9009           "context = %d, texture = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
9010           texture, GLenumToString(GLenumGroup::TextureParameterName, pname), (uintptr_t)param);
9011 
9012     if (context)
9013     {
9014         TextureID texturePacked                               = PackParam<TextureID>(texture);
9015         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9016         bool isCallValid =
9017             (context->skipValidation() ||
9018              ValidateTextureParameterfv(context, angle::EntryPoint::GLTextureParameterfv,
9019                                         texturePacked, pname, param));
9020         if (isCallValid)
9021         {
9022             context->textureParameterfv(texturePacked, pname, param);
9023         }
9024         ANGLE_CAPTURE(TextureParameterfv, isCallValid, context, texturePacked, pname, param);
9025     }
9026     else
9027     {
9028         GenerateContextLostErrorOnCurrentGlobalContext();
9029     }
9030 }
9031 
GL_TextureParameteri(GLuint texture,GLenum pname,GLint param)9032 void GL_APIENTRY GL_TextureParameteri(GLuint texture, GLenum pname, GLint param)
9033 {
9034     Context *context = GetValidGlobalContext();
9035     EVENT(context, GLTextureParameteri, "context = %d, texture = %u, pname = %s, param = %d",
9036           CID(context), texture, GLenumToString(GLenumGroup::TextureParameterName, pname), param);
9037 
9038     if (context)
9039     {
9040         TextureID texturePacked                               = PackParam<TextureID>(texture);
9041         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9042         bool isCallValid =
9043             (context->skipValidation() ||
9044              ValidateTextureParameteri(context, angle::EntryPoint::GLTextureParameteri,
9045                                        texturePacked, pname, param));
9046         if (isCallValid)
9047         {
9048             context->textureParameteri(texturePacked, pname, param);
9049         }
9050         ANGLE_CAPTURE(TextureParameteri, isCallValid, context, texturePacked, pname, param);
9051     }
9052     else
9053     {
9054         GenerateContextLostErrorOnCurrentGlobalContext();
9055     }
9056 }
9057 
GL_TextureParameteriv(GLuint texture,GLenum pname,const GLint * param)9058 void GL_APIENTRY GL_TextureParameteriv(GLuint texture, GLenum pname, const GLint *param)
9059 {
9060     Context *context = GetValidGlobalContext();
9061     EVENT(context, GLTextureParameteriv,
9062           "context = %d, texture = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
9063           texture, GLenumToString(GLenumGroup::TextureParameterName, pname), (uintptr_t)param);
9064 
9065     if (context)
9066     {
9067         TextureID texturePacked                               = PackParam<TextureID>(texture);
9068         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9069         bool isCallValid =
9070             (context->skipValidation() ||
9071              ValidateTextureParameteriv(context, angle::EntryPoint::GLTextureParameteriv,
9072                                         texturePacked, pname, param));
9073         if (isCallValid)
9074         {
9075             context->textureParameteriv(texturePacked, pname, param);
9076         }
9077         ANGLE_CAPTURE(TextureParameteriv, isCallValid, context, texturePacked, pname, param);
9078     }
9079     else
9080     {
9081         GenerateContextLostErrorOnCurrentGlobalContext();
9082     }
9083 }
9084 
GL_TextureStorage1D(GLuint texture,GLsizei levels,GLenum internalformat,GLsizei width)9085 void GL_APIENTRY GL_TextureStorage1D(GLuint texture,
9086                                      GLsizei levels,
9087                                      GLenum internalformat,
9088                                      GLsizei width)
9089 {
9090     Context *context = GetValidGlobalContext();
9091     EVENT(context, GLTextureStorage1D,
9092           "context = %d, texture = %u, levels = %d, internalformat = %s, width = %d", CID(context),
9093           texture, levels, GLenumToString(GLenumGroup::InternalFormat, internalformat), width);
9094 
9095     if (context)
9096     {
9097         TextureID texturePacked                               = PackParam<TextureID>(texture);
9098         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9099         bool isCallValid                                      = (context->skipValidation() ||
9100                             ValidateTextureStorage1D(context, angle::EntryPoint::GLTextureStorage1D,
9101                                                      texturePacked, levels, internalformat, width));
9102         if (isCallValid)
9103         {
9104             context->textureStorage1D(texturePacked, levels, internalformat, width);
9105         }
9106         ANGLE_CAPTURE(TextureStorage1D, isCallValid, context, texturePacked, levels, internalformat,
9107                       width);
9108     }
9109     else
9110     {
9111         GenerateContextLostErrorOnCurrentGlobalContext();
9112     }
9113 }
9114 
GL_TextureStorage2D(GLuint texture,GLsizei levels,GLenum internalformat,GLsizei width,GLsizei height)9115 void GL_APIENTRY GL_TextureStorage2D(GLuint texture,
9116                                      GLsizei levels,
9117                                      GLenum internalformat,
9118                                      GLsizei width,
9119                                      GLsizei height)
9120 {
9121     Context *context = GetValidGlobalContext();
9122     EVENT(context, GLTextureStorage2D,
9123           "context = %d, texture = %u, levels = %d, internalformat = %s, width = %d, height = %d",
9124           CID(context), texture, levels,
9125           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height);
9126 
9127     if (context)
9128     {
9129         TextureID texturePacked                               = PackParam<TextureID>(texture);
9130         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9131         bool isCallValid =
9132             (context->skipValidation() ||
9133              ValidateTextureStorage2D(context, angle::EntryPoint::GLTextureStorage2D, texturePacked,
9134                                       levels, internalformat, width, height));
9135         if (isCallValid)
9136         {
9137             context->textureStorage2D(texturePacked, levels, internalformat, width, height);
9138         }
9139         ANGLE_CAPTURE(TextureStorage2D, isCallValid, context, texturePacked, levels, internalformat,
9140                       width, height);
9141     }
9142     else
9143     {
9144         GenerateContextLostErrorOnCurrentGlobalContext();
9145     }
9146 }
9147 
GL_TextureStorage2DMultisample(GLuint texture,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height,GLboolean fixedsamplelocations)9148 void GL_APIENTRY GL_TextureStorage2DMultisample(GLuint texture,
9149                                                 GLsizei samples,
9150                                                 GLenum internalformat,
9151                                                 GLsizei width,
9152                                                 GLsizei height,
9153                                                 GLboolean fixedsamplelocations)
9154 {
9155     Context *context = GetValidGlobalContext();
9156     EVENT(context, GLTextureStorage2DMultisample,
9157           "context = %d, texture = %u, samples = %d, internalformat = %s, width = %d, height = %d, "
9158           "fixedsamplelocations = %s",
9159           CID(context), texture, samples,
9160           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height,
9161           GLbooleanToString(fixedsamplelocations));
9162 
9163     if (context)
9164     {
9165         TextureID texturePacked                               = PackParam<TextureID>(texture);
9166         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9167         bool isCallValid =
9168             (context->skipValidation() ||
9169              ValidateTextureStorage2DMultisample(
9170                  context, angle::EntryPoint::GLTextureStorage2DMultisample, texturePacked, samples,
9171                  internalformat, width, height, fixedsamplelocations));
9172         if (isCallValid)
9173         {
9174             context->textureStorage2DMultisample(texturePacked, samples, internalformat, width,
9175                                                  height, fixedsamplelocations);
9176         }
9177         ANGLE_CAPTURE(TextureStorage2DMultisample, isCallValid, context, texturePacked, samples,
9178                       internalformat, width, height, fixedsamplelocations);
9179     }
9180     else
9181     {
9182         GenerateContextLostErrorOnCurrentGlobalContext();
9183     }
9184 }
9185 
GL_TextureStorage3D(GLuint texture,GLsizei levels,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth)9186 void GL_APIENTRY GL_TextureStorage3D(GLuint texture,
9187                                      GLsizei levels,
9188                                      GLenum internalformat,
9189                                      GLsizei width,
9190                                      GLsizei height,
9191                                      GLsizei depth)
9192 {
9193     Context *context = GetValidGlobalContext();
9194     EVENT(context, GLTextureStorage3D,
9195           "context = %d, texture = %u, levels = %d, internalformat = %s, width = %d, height = %d, "
9196           "depth = %d",
9197           CID(context), texture, levels,
9198           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height, depth);
9199 
9200     if (context)
9201     {
9202         TextureID texturePacked                               = PackParam<TextureID>(texture);
9203         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9204         bool isCallValid =
9205             (context->skipValidation() ||
9206              ValidateTextureStorage3D(context, angle::EntryPoint::GLTextureStorage3D, texturePacked,
9207                                       levels, internalformat, width, height, depth));
9208         if (isCallValid)
9209         {
9210             context->textureStorage3D(texturePacked, levels, internalformat, width, height, depth);
9211         }
9212         ANGLE_CAPTURE(TextureStorage3D, isCallValid, context, texturePacked, levels, internalformat,
9213                       width, height, depth);
9214     }
9215     else
9216     {
9217         GenerateContextLostErrorOnCurrentGlobalContext();
9218     }
9219 }
9220 
GL_TextureStorage3DMultisample(GLuint texture,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLboolean fixedsamplelocations)9221 void GL_APIENTRY GL_TextureStorage3DMultisample(GLuint texture,
9222                                                 GLsizei samples,
9223                                                 GLenum internalformat,
9224                                                 GLsizei width,
9225                                                 GLsizei height,
9226                                                 GLsizei depth,
9227                                                 GLboolean fixedsamplelocations)
9228 {
9229     Context *context = GetValidGlobalContext();
9230     EVENT(context, GLTextureStorage3DMultisample,
9231           "context = %d, texture = %u, samples = %d, internalformat = %s, width = %d, height = %d, "
9232           "depth = %d, fixedsamplelocations = %s",
9233           CID(context), texture, samples,
9234           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height, depth,
9235           GLbooleanToString(fixedsamplelocations));
9236 
9237     if (context)
9238     {
9239         TextureID texturePacked                               = PackParam<TextureID>(texture);
9240         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9241         bool isCallValid =
9242             (context->skipValidation() ||
9243              ValidateTextureStorage3DMultisample(
9244                  context, angle::EntryPoint::GLTextureStorage3DMultisample, texturePacked, samples,
9245                  internalformat, width, height, depth, fixedsamplelocations));
9246         if (isCallValid)
9247         {
9248             context->textureStorage3DMultisample(texturePacked, samples, internalformat, width,
9249                                                  height, depth, fixedsamplelocations);
9250         }
9251         ANGLE_CAPTURE(TextureStorage3DMultisample, isCallValid, context, texturePacked, samples,
9252                       internalformat, width, height, depth, fixedsamplelocations);
9253     }
9254     else
9255     {
9256         GenerateContextLostErrorOnCurrentGlobalContext();
9257     }
9258 }
9259 
GL_TextureSubImage1D(GLuint texture,GLint level,GLint xoffset,GLsizei width,GLenum format,GLenum type,const void * pixels)9260 void GL_APIENTRY GL_TextureSubImage1D(GLuint texture,
9261                                       GLint level,
9262                                       GLint xoffset,
9263                                       GLsizei width,
9264                                       GLenum format,
9265                                       GLenum type,
9266                                       const void *pixels)
9267 {
9268     Context *context = GetValidGlobalContext();
9269     EVENT(context, GLTextureSubImage1D,
9270           "context = %d, texture = %u, level = %d, xoffset = %d, width = %d, format = %s, type = "
9271           "%s, pixels = 0x%016" PRIxPTR "",
9272           CID(context), texture, level, xoffset, width,
9273           GLenumToString(GLenumGroup::PixelFormat, format),
9274           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
9275 
9276     if (context)
9277     {
9278         TextureID texturePacked                               = PackParam<TextureID>(texture);
9279         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9280         bool isCallValid =
9281             (context->skipValidation() ||
9282              ValidateTextureSubImage1D(context, angle::EntryPoint::GLTextureSubImage1D,
9283                                        texturePacked, level, xoffset, width, format, type, pixels));
9284         if (isCallValid)
9285         {
9286             context->textureSubImage1D(texturePacked, level, xoffset, width, format, type, pixels);
9287         }
9288         ANGLE_CAPTURE(TextureSubImage1D, isCallValid, context, texturePacked, level, xoffset, width,
9289                       format, type, pixels);
9290     }
9291     else
9292     {
9293         GenerateContextLostErrorOnCurrentGlobalContext();
9294     }
9295 }
9296 
GL_TextureSubImage2D(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLenum type,const void * pixels)9297 void GL_APIENTRY GL_TextureSubImage2D(GLuint texture,
9298                                       GLint level,
9299                                       GLint xoffset,
9300                                       GLint yoffset,
9301                                       GLsizei width,
9302                                       GLsizei height,
9303                                       GLenum format,
9304                                       GLenum type,
9305                                       const void *pixels)
9306 {
9307     Context *context = GetValidGlobalContext();
9308     EVENT(context, GLTextureSubImage2D,
9309           "context = %d, texture = %u, level = %d, xoffset = %d, yoffset = %d, width = %d, height "
9310           "= %d, format = %s, type = %s, pixels = 0x%016" PRIxPTR "",
9311           CID(context), texture, level, xoffset, yoffset, width, height,
9312           GLenumToString(GLenumGroup::PixelFormat, format),
9313           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
9314 
9315     if (context)
9316     {
9317         TextureID texturePacked                               = PackParam<TextureID>(texture);
9318         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9319         bool isCallValid                                      = (context->skipValidation() ||
9320                             ValidateTextureSubImage2D(
9321                                 context, angle::EntryPoint::GLTextureSubImage2D, texturePacked,
9322                                 level, xoffset, yoffset, width, height, format, type, pixels));
9323         if (isCallValid)
9324         {
9325             context->textureSubImage2D(texturePacked, level, xoffset, yoffset, width, height,
9326                                        format, type, pixels);
9327         }
9328         ANGLE_CAPTURE(TextureSubImage2D, isCallValid, context, texturePacked, level, xoffset,
9329                       yoffset, width, height, format, type, pixels);
9330     }
9331     else
9332     {
9333         GenerateContextLostErrorOnCurrentGlobalContext();
9334     }
9335 }
9336 
GL_TextureSubImage3D(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLenum type,const void * pixels)9337 void GL_APIENTRY GL_TextureSubImage3D(GLuint texture,
9338                                       GLint level,
9339                                       GLint xoffset,
9340                                       GLint yoffset,
9341                                       GLint zoffset,
9342                                       GLsizei width,
9343                                       GLsizei height,
9344                                       GLsizei depth,
9345                                       GLenum format,
9346                                       GLenum type,
9347                                       const void *pixels)
9348 {
9349     Context *context = GetValidGlobalContext();
9350     EVENT(context, GLTextureSubImage3D,
9351           "context = %d, texture = %u, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width "
9352           "= %d, height = %d, depth = %d, format = %s, type = %s, pixels = 0x%016" PRIxPTR "",
9353           CID(context), texture, level, xoffset, yoffset, zoffset, width, height, depth,
9354           GLenumToString(GLenumGroup::PixelFormat, format),
9355           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
9356 
9357     if (context)
9358     {
9359         TextureID texturePacked                               = PackParam<TextureID>(texture);
9360         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9361         bool isCallValid =
9362             (context->skipValidation() ||
9363              ValidateTextureSubImage3D(context, angle::EntryPoint::GLTextureSubImage3D,
9364                                        texturePacked, level, xoffset, yoffset, zoffset, width,
9365                                        height, depth, format, type, pixels));
9366         if (isCallValid)
9367         {
9368             context->textureSubImage3D(texturePacked, level, xoffset, yoffset, zoffset, width,
9369                                        height, depth, format, type, pixels);
9370         }
9371         ANGLE_CAPTURE(TextureSubImage3D, isCallValid, context, texturePacked, level, xoffset,
9372                       yoffset, zoffset, width, height, depth, format, type, pixels);
9373     }
9374     else
9375     {
9376         GenerateContextLostErrorOnCurrentGlobalContext();
9377     }
9378 }
9379 
GL_TransformFeedbackBufferBase(GLuint xfb,GLuint index,GLuint buffer)9380 void GL_APIENTRY GL_TransformFeedbackBufferBase(GLuint xfb, GLuint index, GLuint buffer)
9381 {
9382     Context *context = GetValidGlobalContext();
9383     EVENT(context, GLTransformFeedbackBufferBase, "context = %d, xfb = %u, index = %u, buffer = %u",
9384           CID(context), xfb, index, buffer);
9385 
9386     if (context)
9387     {
9388         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
9389         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9390         bool isCallValid                                      = (context->skipValidation() ||
9391                             ValidateTransformFeedbackBufferBase(
9392                                 context, angle::EntryPoint::GLTransformFeedbackBufferBase, xfb,
9393                                 index, bufferPacked));
9394         if (isCallValid)
9395         {
9396             context->transformFeedbackBufferBase(xfb, index, bufferPacked);
9397         }
9398         ANGLE_CAPTURE(TransformFeedbackBufferBase, isCallValid, context, xfb, index, bufferPacked);
9399     }
9400     else
9401     {
9402         GenerateContextLostErrorOnCurrentGlobalContext();
9403     }
9404 }
9405 
GL_TransformFeedbackBufferRange(GLuint xfb,GLuint index,GLuint buffer,GLintptr offset,GLsizeiptr size)9406 void GL_APIENTRY GL_TransformFeedbackBufferRange(GLuint xfb,
9407                                                  GLuint index,
9408                                                  GLuint buffer,
9409                                                  GLintptr offset,
9410                                                  GLsizeiptr size)
9411 {
9412     Context *context = GetValidGlobalContext();
9413     EVENT(context, GLTransformFeedbackBufferRange,
9414           "context = %d, xfb = %u, index = %u, buffer = %u, offset = %llu, size = %llu",
9415           CID(context), xfb, index, buffer, static_cast<unsigned long long>(offset),
9416           static_cast<unsigned long long>(size));
9417 
9418     if (context)
9419     {
9420         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
9421         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9422         bool isCallValid                                      = (context->skipValidation() ||
9423                             ValidateTransformFeedbackBufferRange(
9424                                 context, angle::EntryPoint::GLTransformFeedbackBufferRange, xfb,
9425                                 index, bufferPacked, offset, size));
9426         if (isCallValid)
9427         {
9428             context->transformFeedbackBufferRange(xfb, index, bufferPacked, offset, size);
9429         }
9430         ANGLE_CAPTURE(TransformFeedbackBufferRange, isCallValid, context, xfb, index, bufferPacked,
9431                       offset, size);
9432     }
9433     else
9434     {
9435         GenerateContextLostErrorOnCurrentGlobalContext();
9436     }
9437 }
9438 
GL_UnmapNamedBuffer(GLuint buffer)9439 GLboolean GL_APIENTRY GL_UnmapNamedBuffer(GLuint buffer)
9440 {
9441     Context *context = GetValidGlobalContext();
9442     EVENT(context, GLUnmapNamedBuffer, "context = %d, buffer = %u", CID(context), buffer);
9443 
9444     GLboolean returnValue;
9445     if (context)
9446     {
9447         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
9448         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9449         bool isCallValid                                      = (context->skipValidation() ||
9450                             ValidateUnmapNamedBuffer(context, angle::EntryPoint::GLUnmapNamedBuffer,
9451                                                      bufferPacked));
9452         if (isCallValid)
9453         {
9454             returnValue = context->unmapNamedBuffer(bufferPacked);
9455         }
9456         else
9457         {
9458             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLUnmapNamedBuffer, GLboolean>();
9459         }
9460         ANGLE_CAPTURE(UnmapNamedBuffer, isCallValid, context, bufferPacked, returnValue);
9461     }
9462     else
9463     {
9464         GenerateContextLostErrorOnCurrentGlobalContext();
9465         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLUnmapNamedBuffer, GLboolean>();
9466     }
9467     return returnValue;
9468 }
9469 
GL_VertexArrayAttribBinding(GLuint vaobj,GLuint attribindex,GLuint bindingindex)9470 void GL_APIENTRY GL_VertexArrayAttribBinding(GLuint vaobj, GLuint attribindex, GLuint bindingindex)
9471 {
9472     Context *context = GetValidGlobalContext();
9473     EVENT(context, GLVertexArrayAttribBinding,
9474           "context = %d, vaobj = %u, attribindex = %u, bindingindex = %u", CID(context), vaobj,
9475           attribindex, bindingindex);
9476 
9477     if (context)
9478     {
9479         VertexArrayID vaobjPacked                             = PackParam<VertexArrayID>(vaobj);
9480         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9481         bool isCallValid                                      = (context->skipValidation() ||
9482                             ValidateVertexArrayAttribBinding(
9483                                 context, angle::EntryPoint::GLVertexArrayAttribBinding, vaobjPacked,
9484                                 attribindex, bindingindex));
9485         if (isCallValid)
9486         {
9487             context->vertexArrayAttribBinding(vaobjPacked, attribindex, bindingindex);
9488         }
9489         ANGLE_CAPTURE(VertexArrayAttribBinding, isCallValid, context, vaobjPacked, attribindex,
9490                       bindingindex);
9491     }
9492     else
9493     {
9494         GenerateContextLostErrorOnCurrentGlobalContext();
9495     }
9496 }
9497 
GL_VertexArrayAttribFormat(GLuint vaobj,GLuint attribindex,GLint size,GLenum type,GLboolean normalized,GLuint relativeoffset)9498 void GL_APIENTRY GL_VertexArrayAttribFormat(GLuint vaobj,
9499                                             GLuint attribindex,
9500                                             GLint size,
9501                                             GLenum type,
9502                                             GLboolean normalized,
9503                                             GLuint relativeoffset)
9504 {
9505     Context *context = GetValidGlobalContext();
9506     EVENT(context, GLVertexArrayAttribFormat,
9507           "context = %d, vaobj = %u, attribindex = %u, size = %d, type = %s, normalized = %s, "
9508           "relativeoffset = %u",
9509           CID(context), vaobj, attribindex, size,
9510           GLenumToString(GLenumGroup::VertexAttribType, type), GLbooleanToString(normalized),
9511           relativeoffset);
9512 
9513     if (context)
9514     {
9515         VertexArrayID vaobjPacked                             = PackParam<VertexArrayID>(vaobj);
9516         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9517         bool isCallValid                                      = (context->skipValidation() ||
9518                             ValidateVertexArrayAttribFormat(
9519                                 context, angle::EntryPoint::GLVertexArrayAttribFormat, vaobjPacked,
9520                                 attribindex, size, type, normalized, relativeoffset));
9521         if (isCallValid)
9522         {
9523             context->vertexArrayAttribFormat(vaobjPacked, attribindex, size, type, normalized,
9524                                              relativeoffset);
9525         }
9526         ANGLE_CAPTURE(VertexArrayAttribFormat, isCallValid, context, vaobjPacked, attribindex, size,
9527                       type, normalized, relativeoffset);
9528     }
9529     else
9530     {
9531         GenerateContextLostErrorOnCurrentGlobalContext();
9532     }
9533 }
9534 
GL_VertexArrayAttribIFormat(GLuint vaobj,GLuint attribindex,GLint size,GLenum type,GLuint relativeoffset)9535 void GL_APIENTRY GL_VertexArrayAttribIFormat(GLuint vaobj,
9536                                              GLuint attribindex,
9537                                              GLint size,
9538                                              GLenum type,
9539                                              GLuint relativeoffset)
9540 {
9541     Context *context = GetValidGlobalContext();
9542     EVENT(context, GLVertexArrayAttribIFormat,
9543           "context = %d, vaobj = %u, attribindex = %u, size = %d, type = %s, relativeoffset = %u",
9544           CID(context), vaobj, attribindex, size,
9545           GLenumToString(GLenumGroup::VertexAttribType, type), relativeoffset);
9546 
9547     if (context)
9548     {
9549         VertexArrayID vaobjPacked                             = PackParam<VertexArrayID>(vaobj);
9550         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9551         bool isCallValid                                      = (context->skipValidation() ||
9552                             ValidateVertexArrayAttribIFormat(
9553                                 context, angle::EntryPoint::GLVertexArrayAttribIFormat, vaobjPacked,
9554                                 attribindex, size, type, relativeoffset));
9555         if (isCallValid)
9556         {
9557             context->vertexArrayAttribIFormat(vaobjPacked, attribindex, size, type, relativeoffset);
9558         }
9559         ANGLE_CAPTURE(VertexArrayAttribIFormat, isCallValid, context, vaobjPacked, attribindex,
9560                       size, type, relativeoffset);
9561     }
9562     else
9563     {
9564         GenerateContextLostErrorOnCurrentGlobalContext();
9565     }
9566 }
9567 
GL_VertexArrayAttribLFormat(GLuint vaobj,GLuint attribindex,GLint size,GLenum type,GLuint relativeoffset)9568 void GL_APIENTRY GL_VertexArrayAttribLFormat(GLuint vaobj,
9569                                              GLuint attribindex,
9570                                              GLint size,
9571                                              GLenum type,
9572                                              GLuint relativeoffset)
9573 {
9574     Context *context = GetValidGlobalContext();
9575     EVENT(context, GLVertexArrayAttribLFormat,
9576           "context = %d, vaobj = %u, attribindex = %u, size = %d, type = %s, relativeoffset = %u",
9577           CID(context), vaobj, attribindex, size,
9578           GLenumToString(GLenumGroup::VertexAttribType, type), relativeoffset);
9579 
9580     if (context)
9581     {
9582         VertexArrayID vaobjPacked                             = PackParam<VertexArrayID>(vaobj);
9583         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9584         bool isCallValid                                      = (context->skipValidation() ||
9585                             ValidateVertexArrayAttribLFormat(
9586                                 context, angle::EntryPoint::GLVertexArrayAttribLFormat, vaobjPacked,
9587                                 attribindex, size, type, relativeoffset));
9588         if (isCallValid)
9589         {
9590             context->vertexArrayAttribLFormat(vaobjPacked, attribindex, size, type, relativeoffset);
9591         }
9592         ANGLE_CAPTURE(VertexArrayAttribLFormat, isCallValid, context, vaobjPacked, attribindex,
9593                       size, type, relativeoffset);
9594     }
9595     else
9596     {
9597         GenerateContextLostErrorOnCurrentGlobalContext();
9598     }
9599 }
9600 
GL_VertexArrayBindingDivisor(GLuint vaobj,GLuint bindingindex,GLuint divisor)9601 void GL_APIENTRY GL_VertexArrayBindingDivisor(GLuint vaobj, GLuint bindingindex, GLuint divisor)
9602 {
9603     Context *context = GetValidGlobalContext();
9604     EVENT(context, GLVertexArrayBindingDivisor,
9605           "context = %d, vaobj = %u, bindingindex = %u, divisor = %u", CID(context), vaobj,
9606           bindingindex, divisor);
9607 
9608     if (context)
9609     {
9610         VertexArrayID vaobjPacked                             = PackParam<VertexArrayID>(vaobj);
9611         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9612         bool isCallValid                                      = (context->skipValidation() ||
9613                             ValidateVertexArrayBindingDivisor(
9614                                 context, angle::EntryPoint::GLVertexArrayBindingDivisor,
9615                                 vaobjPacked, bindingindex, divisor));
9616         if (isCallValid)
9617         {
9618             context->vertexArrayBindingDivisor(vaobjPacked, bindingindex, divisor);
9619         }
9620         ANGLE_CAPTURE(VertexArrayBindingDivisor, isCallValid, context, vaobjPacked, bindingindex,
9621                       divisor);
9622     }
9623     else
9624     {
9625         GenerateContextLostErrorOnCurrentGlobalContext();
9626     }
9627 }
9628 
GL_VertexArrayElementBuffer(GLuint vaobj,GLuint buffer)9629 void GL_APIENTRY GL_VertexArrayElementBuffer(GLuint vaobj, GLuint buffer)
9630 {
9631     Context *context = GetValidGlobalContext();
9632     EVENT(context, GLVertexArrayElementBuffer, "context = %d, vaobj = %u, buffer = %u",
9633           CID(context), vaobj, buffer);
9634 
9635     if (context)
9636     {
9637         VertexArrayID vaobjPacked                             = PackParam<VertexArrayID>(vaobj);
9638         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
9639         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9640         bool isCallValid                                      = (context->skipValidation() ||
9641                             ValidateVertexArrayElementBuffer(
9642                                 context, angle::EntryPoint::GLVertexArrayElementBuffer, vaobjPacked,
9643                                 bufferPacked));
9644         if (isCallValid)
9645         {
9646             context->vertexArrayElementBuffer(vaobjPacked, bufferPacked);
9647         }
9648         ANGLE_CAPTURE(VertexArrayElementBuffer, isCallValid, context, vaobjPacked, bufferPacked);
9649     }
9650     else
9651     {
9652         GenerateContextLostErrorOnCurrentGlobalContext();
9653     }
9654 }
9655 
GL_VertexArrayVertexBuffer(GLuint vaobj,GLuint bindingindex,GLuint buffer,GLintptr offset,GLsizei stride)9656 void GL_APIENTRY GL_VertexArrayVertexBuffer(GLuint vaobj,
9657                                             GLuint bindingindex,
9658                                             GLuint buffer,
9659                                             GLintptr offset,
9660                                             GLsizei stride)
9661 {
9662     Context *context = GetValidGlobalContext();
9663     EVENT(context, GLVertexArrayVertexBuffer,
9664           "context = %d, vaobj = %u, bindingindex = %u, buffer = %u, offset = %llu, stride = %d",
9665           CID(context), vaobj, bindingindex, buffer, static_cast<unsigned long long>(offset),
9666           stride);
9667 
9668     if (context)
9669     {
9670         VertexArrayID vaobjPacked                             = PackParam<VertexArrayID>(vaobj);
9671         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
9672         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9673         bool isCallValid                                      = (context->skipValidation() ||
9674                             ValidateVertexArrayVertexBuffer(
9675                                 context, angle::EntryPoint::GLVertexArrayVertexBuffer, vaobjPacked,
9676                                 bindingindex, bufferPacked, offset, stride));
9677         if (isCallValid)
9678         {
9679             context->vertexArrayVertexBuffer(vaobjPacked, bindingindex, bufferPacked, offset,
9680                                              stride);
9681         }
9682         ANGLE_CAPTURE(VertexArrayVertexBuffer, isCallValid, context, vaobjPacked, bindingindex,
9683                       bufferPacked, offset, stride);
9684     }
9685     else
9686     {
9687         GenerateContextLostErrorOnCurrentGlobalContext();
9688     }
9689 }
9690 
GL_VertexArrayVertexBuffers(GLuint vaobj,GLuint first,GLsizei count,const GLuint * buffers,const GLintptr * offsets,const GLsizei * strides)9691 void GL_APIENTRY GL_VertexArrayVertexBuffers(GLuint vaobj,
9692                                              GLuint first,
9693                                              GLsizei count,
9694                                              const GLuint *buffers,
9695                                              const GLintptr *offsets,
9696                                              const GLsizei *strides)
9697 {
9698     Context *context = GetValidGlobalContext();
9699     EVENT(context, GLVertexArrayVertexBuffers,
9700           "context = %d, vaobj = %u, first = %u, count = %d, buffers = 0x%016" PRIxPTR
9701           ", offsets = 0x%016" PRIxPTR ", strides = 0x%016" PRIxPTR "",
9702           CID(context), vaobj, first, count, (uintptr_t)buffers, (uintptr_t)offsets,
9703           (uintptr_t)strides);
9704 
9705     if (context)
9706     {
9707         VertexArrayID vaobjPacked     = PackParam<VertexArrayID>(vaobj);
9708         const BufferID *buffersPacked = PackParam<const BufferID *>(buffers);
9709         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9710         bool isCallValid                                      = (context->skipValidation() ||
9711                             ValidateVertexArrayVertexBuffers(
9712                                 context, angle::EntryPoint::GLVertexArrayVertexBuffers, vaobjPacked,
9713                                 first, count, buffersPacked, offsets, strides));
9714         if (isCallValid)
9715         {
9716             context->vertexArrayVertexBuffers(vaobjPacked, first, count, buffersPacked, offsets,
9717                                               strides);
9718         }
9719         ANGLE_CAPTURE(VertexArrayVertexBuffers, isCallValid, context, vaobjPacked, first, count,
9720                       buffersPacked, offsets, strides);
9721     }
9722     else
9723     {
9724         GenerateContextLostErrorOnCurrentGlobalContext();
9725     }
9726 }
9727 
9728 // GL 4.6
GL_MultiDrawArraysIndirectCount(GLenum mode,const void * indirect,GLintptr drawcount,GLsizei maxdrawcount,GLsizei stride)9729 void GL_APIENTRY GL_MultiDrawArraysIndirectCount(GLenum mode,
9730                                                  const void *indirect,
9731                                                  GLintptr drawcount,
9732                                                  GLsizei maxdrawcount,
9733                                                  GLsizei stride)
9734 {
9735     Context *context = GetValidGlobalContext();
9736     EVENT(context, GLMultiDrawArraysIndirectCount,
9737           "context = %d, mode = %s, indirect = 0x%016" PRIxPTR
9738           ", drawcount = %llu, maxdrawcount = %d, stride = %d",
9739           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), (uintptr_t)indirect,
9740           static_cast<unsigned long long>(drawcount), maxdrawcount, stride);
9741 
9742     if (context)
9743     {
9744         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9745         bool isCallValid                                      = (context->skipValidation() ||
9746                             ValidateMultiDrawArraysIndirectCount(
9747                                 context, angle::EntryPoint::GLMultiDrawArraysIndirectCount, mode,
9748                                 indirect, drawcount, maxdrawcount, stride));
9749         if (isCallValid)
9750         {
9751             context->multiDrawArraysIndirectCount(mode, indirect, drawcount, maxdrawcount, stride);
9752         }
9753         ANGLE_CAPTURE(MultiDrawArraysIndirectCount, isCallValid, context, mode, indirect, drawcount,
9754                       maxdrawcount, stride);
9755     }
9756     else
9757     {
9758         GenerateContextLostErrorOnCurrentGlobalContext();
9759     }
9760 }
9761 
GL_MultiDrawElementsIndirectCount(GLenum mode,GLenum type,const void * indirect,GLintptr drawcount,GLsizei maxdrawcount,GLsizei stride)9762 void GL_APIENTRY GL_MultiDrawElementsIndirectCount(GLenum mode,
9763                                                    GLenum type,
9764                                                    const void *indirect,
9765                                                    GLintptr drawcount,
9766                                                    GLsizei maxdrawcount,
9767                                                    GLsizei stride)
9768 {
9769     Context *context = GetValidGlobalContext();
9770     EVENT(context, GLMultiDrawElementsIndirectCount,
9771           "context = %d, mode = %s, type = %s, indirect = 0x%016" PRIxPTR
9772           ", drawcount = %llu, maxdrawcount = %d, stride = %d",
9773           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode),
9774           GLenumToString(GLenumGroup::DefaultGroup, type), (uintptr_t)indirect,
9775           static_cast<unsigned long long>(drawcount), maxdrawcount, stride);
9776 
9777     if (context)
9778     {
9779         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9780         bool isCallValid                                      = (context->skipValidation() ||
9781                             ValidateMultiDrawElementsIndirectCount(
9782                                 context, angle::EntryPoint::GLMultiDrawElementsIndirectCount, mode,
9783                                 type, indirect, drawcount, maxdrawcount, stride));
9784         if (isCallValid)
9785         {
9786             context->multiDrawElementsIndirectCount(mode, type, indirect, drawcount, maxdrawcount,
9787                                                     stride);
9788         }
9789         ANGLE_CAPTURE(MultiDrawElementsIndirectCount, isCallValid, context, mode, type, indirect,
9790                       drawcount, maxdrawcount, stride);
9791     }
9792     else
9793     {
9794         GenerateContextLostErrorOnCurrentGlobalContext();
9795     }
9796 }
9797 
GL_PolygonOffsetClamp(GLfloat factor,GLfloat units,GLfloat clamp)9798 void GL_APIENTRY GL_PolygonOffsetClamp(GLfloat factor, GLfloat units, GLfloat clamp)
9799 {
9800     Context *context = GetValidGlobalContext();
9801     EVENT(context, GLPolygonOffsetClamp, "context = %d, factor = %f, units = %f, clamp = %f",
9802           CID(context), factor, units, clamp);
9803 
9804     if (context)
9805     {
9806         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9807         bool isCallValid =
9808             (context->skipValidation() ||
9809              ValidatePolygonOffsetClamp(context, angle::EntryPoint::GLPolygonOffsetClamp, factor,
9810                                         units, clamp));
9811         if (isCallValid)
9812         {
9813             context->polygonOffsetClamp(factor, units, clamp);
9814         }
9815         ANGLE_CAPTURE(PolygonOffsetClamp, isCallValid, context, factor, units, clamp);
9816     }
9817     else
9818     {
9819         GenerateContextLostErrorOnCurrentGlobalContext();
9820     }
9821 }
9822 
GL_SpecializeShader(GLuint shader,const GLchar * pEntryPoint,GLuint numSpecializationConstants,const GLuint * pConstantIndex,const GLuint * pConstantValue)9823 void GL_APIENTRY GL_SpecializeShader(GLuint shader,
9824                                      const GLchar *pEntryPoint,
9825                                      GLuint numSpecializationConstants,
9826                                      const GLuint *pConstantIndex,
9827                                      const GLuint *pConstantValue)
9828 {
9829     Context *context = GetValidGlobalContext();
9830     EVENT(context, GLSpecializeShader,
9831           "context = %d, shader = %u, pEntryPoint = 0x%016" PRIxPTR
9832           ", numSpecializationConstants = %u, pConstantIndex = 0x%016" PRIxPTR
9833           ", pConstantValue = 0x%016" PRIxPTR "",
9834           CID(context), shader, (uintptr_t)pEntryPoint, numSpecializationConstants,
9835           (uintptr_t)pConstantIndex, (uintptr_t)pConstantValue);
9836 
9837     if (context)
9838     {
9839         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9840         bool isCallValid                                      = (context->skipValidation() ||
9841                             ValidateSpecializeShader(
9842                                 context, angle::EntryPoint::GLSpecializeShader, shader, pEntryPoint,
9843                                 numSpecializationConstants, pConstantIndex, pConstantValue));
9844         if (isCallValid)
9845         {
9846             context->specializeShader(shader, pEntryPoint, numSpecializationConstants,
9847                                       pConstantIndex, pConstantValue);
9848         }
9849         ANGLE_CAPTURE(SpecializeShader, isCallValid, context, shader, pEntryPoint,
9850                       numSpecializationConstants, pConstantIndex, pConstantValue);
9851     }
9852     else
9853     {
9854         GenerateContextLostErrorOnCurrentGlobalContext();
9855     }
9856 }
9857 
9858 }  // extern "C"
9859