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