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