• 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 "libGLESv2/entry_points_gl_4_autogen.h"
12 
13 #include "common/gl_enum_utils.h"
14 #include "libANGLE/Context.h"
15 #include "libANGLE/Context.inl.h"
16 #include "libANGLE/capture/capture_gl_4_autogen.h"
17 #include "libANGLE/context_private_call_gl_autogen.h"
18 #include "libANGLE/context_private_call_gles_autogen.h"
19 #include "libANGLE/entry_points_utils.h"
20 #include "libANGLE/validationEGL.h"
21 #include "libANGLE/validationES.h"
22 #include "libANGLE/validationES1.h"
23 #include "libANGLE/validationES2.h"
24 #include "libANGLE/validationES3.h"
25 #include "libANGLE/validationES31.h"
26 #include "libANGLE/validationES32.h"
27 #include "libANGLE/validationESEXT.h"
28 #include "libANGLE/validationGL4_autogen.h"
29 #include "libGLESv2/global_state.h"
30 
31 using namespace gl;
32 
33 extern "C" {
34 
35 // GL 4.0
GL_BeginQueryIndexed(GLenum target,GLuint index,GLuint id)36 void GL_APIENTRY GL_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
37 {
38     Context *context = GetValidGlobalContext();
39     EVENT(context, GLBeginQueryIndexed, "context = %d, target = %s, index = %u, id = %u",
40           CID(context), GLenumToString(BigGLEnum::QueryTarget, target), index, id);
41 
42     if (context)
43     {
44         QueryID idPacked = PackParam<QueryID>(id);
45         SCOPED_SHARE_CONTEXT_LOCK(context);
46         bool isCallValid =
47             (context->skipValidation() ||
48              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
49                                                 context->getMutableErrorSetForValidation(),
50                                                 angle::EntryPoint::GLBeginQueryIndexed) &&
51               ValidateBeginQueryIndexed(context, angle::EntryPoint::GLBeginQueryIndexed, target,
52                                         index, idPacked)));
53         if (isCallValid)
54         {
55             context->beginQueryIndexed(target, index, idPacked);
56         }
57         ANGLE_CAPTURE_GL(BeginQueryIndexed, isCallValid, context, target, index, idPacked);
58     }
59     else
60     {
61         GenerateContextLostErrorOnCurrentGlobalContext();
62     }
63     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
64 }
65 
GL_DrawTransformFeedback(GLenum mode,GLuint id)66 void GL_APIENTRY GL_DrawTransformFeedback(GLenum mode, GLuint id)
67 {
68     Context *context = GetValidGlobalContext();
69     EVENT(context, GLDrawTransformFeedback, "context = %d, mode = %s, id = %u", CID(context),
70           GLenumToString(BigGLEnum::PrimitiveType, mode), id);
71 
72     if (context)
73     {
74         TransformFeedbackID idPacked = PackParam<TransformFeedbackID>(id);
75         SCOPED_SHARE_CONTEXT_LOCK(context);
76         bool isCallValid =
77             (context->skipValidation() ||
78              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
79                                                 context->getMutableErrorSetForValidation(),
80                                                 angle::EntryPoint::GLDrawTransformFeedback) &&
81               ValidateDrawTransformFeedback(context, angle::EntryPoint::GLDrawTransformFeedback,
82                                             mode, idPacked)));
83         if (isCallValid)
84         {
85             context->drawTransformFeedback(mode, idPacked);
86         }
87         ANGLE_CAPTURE_GL(DrawTransformFeedback, isCallValid, context, mode, idPacked);
88     }
89     else
90     {
91         GenerateContextLostErrorOnCurrentGlobalContext();
92     }
93     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
94 }
95 
GL_DrawTransformFeedbackStream(GLenum mode,GLuint id,GLuint stream)96 void GL_APIENTRY GL_DrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream)
97 {
98     Context *context = GetValidGlobalContext();
99     EVENT(context, GLDrawTransformFeedbackStream, "context = %d, mode = %s, id = %u, stream = %u",
100           CID(context), GLenumToString(BigGLEnum::PrimitiveType, mode), id, stream);
101 
102     if (context)
103     {
104         TransformFeedbackID idPacked = PackParam<TransformFeedbackID>(id);
105         SCOPED_SHARE_CONTEXT_LOCK(context);
106         bool isCallValid =
107             (context->skipValidation() ||
108              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
109                                                 context->getMutableErrorSetForValidation(),
110                                                 angle::EntryPoint::GLDrawTransformFeedbackStream) &&
111               ValidateDrawTransformFeedbackStream(context,
112                                                   angle::EntryPoint::GLDrawTransformFeedbackStream,
113                                                   mode, idPacked, stream)));
114         if (isCallValid)
115         {
116             context->drawTransformFeedbackStream(mode, idPacked, stream);
117         }
118         ANGLE_CAPTURE_GL(DrawTransformFeedbackStream, isCallValid, context, mode, idPacked, stream);
119     }
120     else
121     {
122         GenerateContextLostErrorOnCurrentGlobalContext();
123     }
124     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
125 }
126 
GL_EndQueryIndexed(GLenum target,GLuint index)127 void GL_APIENTRY GL_EndQueryIndexed(GLenum target, GLuint index)
128 {
129     Context *context = GetValidGlobalContext();
130     EVENT(context, GLEndQueryIndexed, "context = %d, target = %s, index = %u", CID(context),
131           GLenumToString(BigGLEnum::QueryTarget, target), index);
132 
133     if (context)
134     {
135         SCOPED_SHARE_CONTEXT_LOCK(context);
136         bool isCallValid =
137             (context->skipValidation() ||
138              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
139                                                 context->getMutableErrorSetForValidation(),
140                                                 angle::EntryPoint::GLEndQueryIndexed) &&
141               ValidateEndQueryIndexed(context, angle::EntryPoint::GLEndQueryIndexed, target,
142                                       index)));
143         if (isCallValid)
144         {
145             context->endQueryIndexed(target, index);
146         }
147         ANGLE_CAPTURE_GL(EndQueryIndexed, isCallValid, context, target, index);
148     }
149     else
150     {
151         GenerateContextLostErrorOnCurrentGlobalContext();
152     }
153     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
154 }
155 
GL_GetActiveSubroutineName(GLuint program,GLenum shadertype,GLuint index,GLsizei bufSize,GLsizei * length,GLchar * name)156 void GL_APIENTRY GL_GetActiveSubroutineName(GLuint program,
157                                             GLenum shadertype,
158                                             GLuint index,
159                                             GLsizei bufSize,
160                                             GLsizei *length,
161                                             GLchar *name)
162 {
163     Context *context = GetValidGlobalContext();
164     EVENT(context, GLGetActiveSubroutineName,
165           "context = %d, program = %u, shadertype = %s, index = %u, bufSize = %d, length = "
166           "0x%016" PRIxPTR ", name = 0x%016" PRIxPTR "",
167           CID(context), program, GLenumToString(BigGLEnum::ShaderType, shadertype), index, bufSize,
168           (uintptr_t)length, (uintptr_t)name);
169 
170     if (context)
171     {
172         ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
173         SCOPED_SHARE_CONTEXT_LOCK(context);
174         bool isCallValid = (context->skipValidation() ||
175                             ValidateGetActiveSubroutineName(
176                                 context, angle::EntryPoint::GLGetActiveSubroutineName,
177                                 programPacked, shadertype, index, bufSize, length, name));
178         if (isCallValid)
179         {
180             context->getActiveSubroutineName(programPacked, shadertype, index, bufSize, length,
181                                              name);
182         }
183         ANGLE_CAPTURE_GL(GetActiveSubroutineName, isCallValid, context, programPacked, shadertype,
184                          index, bufSize, length, name);
185     }
186     else
187     {
188         GenerateContextLostErrorOnCurrentGlobalContext();
189     }
190     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
191 }
192 
GL_GetActiveSubroutineUniformName(GLuint program,GLenum shadertype,GLuint index,GLsizei bufSize,GLsizei * length,GLchar * name)193 void GL_APIENTRY GL_GetActiveSubroutineUniformName(GLuint program,
194                                                    GLenum shadertype,
195                                                    GLuint index,
196                                                    GLsizei bufSize,
197                                                    GLsizei *length,
198                                                    GLchar *name)
199 {
200     Context *context = GetValidGlobalContext();
201     EVENT(context, GLGetActiveSubroutineUniformName,
202           "context = %d, program = %u, shadertype = %s, index = %u, bufSize = %d, length = "
203           "0x%016" PRIxPTR ", name = 0x%016" PRIxPTR "",
204           CID(context), program, GLenumToString(BigGLEnum::ShaderType, shadertype), index, bufSize,
205           (uintptr_t)length, (uintptr_t)name);
206 
207     if (context)
208     {
209         ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
210         SCOPED_SHARE_CONTEXT_LOCK(context);
211         bool isCallValid = (context->skipValidation() ||
212                             ValidateGetActiveSubroutineUniformName(
213                                 context, angle::EntryPoint::GLGetActiveSubroutineUniformName,
214                                 programPacked, shadertype, index, bufSize, length, name));
215         if (isCallValid)
216         {
217             context->getActiveSubroutineUniformName(programPacked, shadertype, index, bufSize,
218                                                     length, name);
219         }
220         ANGLE_CAPTURE_GL(GetActiveSubroutineUniformName, isCallValid, context, programPacked,
221                          shadertype, index, bufSize, length, name);
222     }
223     else
224     {
225         GenerateContextLostErrorOnCurrentGlobalContext();
226     }
227     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
228 }
229 
GL_GetActiveSubroutineUniformiv(GLuint program,GLenum shadertype,GLuint index,GLenum pname,GLint * values)230 void GL_APIENTRY GL_GetActiveSubroutineUniformiv(GLuint program,
231                                                  GLenum shadertype,
232                                                  GLuint index,
233                                                  GLenum pname,
234                                                  GLint *values)
235 {
236     Context *context = GetValidGlobalContext();
237     EVENT(context, GLGetActiveSubroutineUniformiv,
238           "context = %d, program = %u, shadertype = %s, index = %u, pname = %s, values = "
239           "0x%016" PRIxPTR "",
240           CID(context), program, GLenumToString(BigGLEnum::ShaderType, shadertype), index,
241           GLenumToString(BigGLEnum::SubroutineParameterName, pname), (uintptr_t)values);
242 
243     if (context)
244     {
245         ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
246         SCOPED_SHARE_CONTEXT_LOCK(context);
247         bool isCallValid = (context->skipValidation() ||
248                             ValidateGetActiveSubroutineUniformiv(
249                                 context, angle::EntryPoint::GLGetActiveSubroutineUniformiv,
250                                 programPacked, shadertype, index, pname, values));
251         if (isCallValid)
252         {
253             context->getActiveSubroutineUniformiv(programPacked, shadertype, index, pname, values);
254         }
255         ANGLE_CAPTURE_GL(GetActiveSubroutineUniformiv, isCallValid, context, programPacked,
256                          shadertype, index, pname, values);
257     }
258     else
259     {
260         GenerateContextLostErrorOnCurrentGlobalContext();
261     }
262     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
263 }
264 
GL_GetProgramStageiv(GLuint program,GLenum shadertype,GLenum pname,GLint * values)265 void GL_APIENTRY GL_GetProgramStageiv(GLuint program,
266                                       GLenum shadertype,
267                                       GLenum pname,
268                                       GLint *values)
269 {
270     Context *context = GetValidGlobalContext();
271     EVENT(context, GLGetProgramStageiv,
272           "context = %d, program = %u, shadertype = %s, pname = %s, values = 0x%016" PRIxPTR "",
273           CID(context), program, GLenumToString(BigGLEnum::ShaderType, shadertype),
274           GLenumToString(BigGLEnum::ProgramStagePName, pname), (uintptr_t)values);
275 
276     if (context)
277     {
278         ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
279         SCOPED_SHARE_CONTEXT_LOCK(context);
280         bool isCallValid =
281             (context->skipValidation() ||
282              ValidateGetProgramStageiv(context, angle::EntryPoint::GLGetProgramStageiv,
283                                        programPacked, shadertype, pname, values));
284         if (isCallValid)
285         {
286             context->getProgramStageiv(programPacked, shadertype, pname, values);
287         }
288         ANGLE_CAPTURE_GL(GetProgramStageiv, isCallValid, context, programPacked, shadertype, pname,
289                          values);
290     }
291     else
292     {
293         GenerateContextLostErrorOnCurrentGlobalContext();
294     }
295     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
296 }
297 
GL_GetQueryIndexediv(GLenum target,GLuint index,GLenum pname,GLint * params)298 void GL_APIENTRY GL_GetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params)
299 {
300     Context *context = GetValidGlobalContext();
301     EVENT(context, GLGetQueryIndexediv,
302           "context = %d, target = %s, index = %u, pname = %s, params = 0x%016" PRIxPTR "",
303           CID(context), GLenumToString(BigGLEnum::QueryTarget, target), index,
304           GLenumToString(BigGLEnum::QueryParameterName, pname), (uintptr_t)params);
305 
306     if (context)
307     {
308         SCOPED_SHARE_CONTEXT_LOCK(context);
309         bool isCallValid =
310             (context->skipValidation() ||
311              ValidateGetQueryIndexediv(context, angle::EntryPoint::GLGetQueryIndexediv, target,
312                                        index, pname, params));
313         if (isCallValid)
314         {
315             context->getQueryIndexediv(target, index, pname, params);
316         }
317         ANGLE_CAPTURE_GL(GetQueryIndexediv, isCallValid, context, target, index, pname, params);
318     }
319     else
320     {
321         GenerateContextLostErrorOnCurrentGlobalContext();
322     }
323     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
324 }
325 
GL_GetSubroutineIndex(GLuint program,GLenum shadertype,const GLchar * name)326 GLuint GL_APIENTRY GL_GetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name)
327 {
328     Context *context = GetValidGlobalContext();
329     EVENT(context, GLGetSubroutineIndex,
330           "context = %d, program = %u, shadertype = %s, name = 0x%016" PRIxPTR "", CID(context),
331           program, GLenumToString(BigGLEnum::ShaderType, shadertype), (uintptr_t)name);
332 
333     GLuint returnValue;
334     if (context)
335     {
336         ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
337         SCOPED_SHARE_CONTEXT_LOCK(context);
338         bool isCallValid =
339             (context->skipValidation() ||
340              ValidateGetSubroutineIndex(context, angle::EntryPoint::GLGetSubroutineIndex,
341                                         programPacked, shadertype, name));
342         if (isCallValid)
343         {
344             returnValue = context->getSubroutineIndex(programPacked, shadertype, name);
345         }
346         else
347         {
348             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetSubroutineIndex, GLuint>();
349         }
350         ANGLE_CAPTURE_GL(GetSubroutineIndex, isCallValid, context, programPacked, shadertype, name,
351                          returnValue);
352     }
353     else
354     {
355         GenerateContextLostErrorOnCurrentGlobalContext();
356         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetSubroutineIndex, GLuint>();
357     }
358     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
359     return returnValue;
360 }
361 
GL_GetSubroutineUniformLocation(GLuint program,GLenum shadertype,const GLchar * name)362 GLint GL_APIENTRY GL_GetSubroutineUniformLocation(GLuint program,
363                                                   GLenum shadertype,
364                                                   const GLchar *name)
365 {
366     Context *context = GetValidGlobalContext();
367     EVENT(context, GLGetSubroutineUniformLocation,
368           "context = %d, program = %u, shadertype = %s, name = 0x%016" PRIxPTR "", CID(context),
369           program, GLenumToString(BigGLEnum::ShaderType, shadertype), (uintptr_t)name);
370 
371     GLint returnValue;
372     if (context)
373     {
374         ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
375         SCOPED_SHARE_CONTEXT_LOCK(context);
376         bool isCallValid = (context->skipValidation() ||
377                             ValidateGetSubroutineUniformLocation(
378                                 context, angle::EntryPoint::GLGetSubroutineUniformLocation,
379                                 programPacked, shadertype, name));
380         if (isCallValid)
381         {
382             returnValue = context->getSubroutineUniformLocation(programPacked, shadertype, name);
383         }
384         else
385         {
386             returnValue =
387                 GetDefaultReturnValue<angle::EntryPoint::GLGetSubroutineUniformLocation, GLint>();
388         }
389         ANGLE_CAPTURE_GL(GetSubroutineUniformLocation, isCallValid, context, programPacked,
390                          shadertype, name, returnValue);
391     }
392     else
393     {
394         GenerateContextLostErrorOnCurrentGlobalContext();
395         returnValue =
396             GetDefaultReturnValue<angle::EntryPoint::GLGetSubroutineUniformLocation, GLint>();
397     }
398     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
399     return returnValue;
400 }
401 
GL_GetUniformSubroutineuiv(GLenum shadertype,GLint location,GLuint * params)402 void GL_APIENTRY GL_GetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params)
403 {
404     Context *context = GetValidGlobalContext();
405     EVENT(context, GLGetUniformSubroutineuiv,
406           "context = %d, shadertype = %s, location = %d, params = 0x%016" PRIxPTR "", CID(context),
407           GLenumToString(BigGLEnum::ShaderType, shadertype), location, (uintptr_t)params);
408 
409     if (context)
410     {
411         SCOPED_SHARE_CONTEXT_LOCK(context);
412         bool isCallValid =
413             (context->skipValidation() ||
414              ValidateGetUniformSubroutineuiv(context, angle::EntryPoint::GLGetUniformSubroutineuiv,
415                                              shadertype, location, params));
416         if (isCallValid)
417         {
418             context->getUniformSubroutineuiv(shadertype, location, params);
419         }
420         ANGLE_CAPTURE_GL(GetUniformSubroutineuiv, isCallValid, context, shadertype, location,
421                          params);
422     }
423     else
424     {
425         GenerateContextLostErrorOnCurrentGlobalContext();
426     }
427     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
428 }
429 
GL_GetUniformdv(GLuint program,GLint location,GLdouble * params)430 void GL_APIENTRY GL_GetUniformdv(GLuint program, GLint location, GLdouble *params)
431 {
432     Context *context = GetValidGlobalContext();
433     EVENT(context, GLGetUniformdv,
434           "context = %d, program = %u, location = %d, params = 0x%016" PRIxPTR "", CID(context),
435           program, location, (uintptr_t)params);
436 
437     if (context)
438     {
439         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
440         UniformLocation locationPacked = PackParam<UniformLocation>(location);
441         SCOPED_SHARE_CONTEXT_LOCK(context);
442         bool isCallValid = (context->skipValidation() ||
443                             ValidateGetUniformdv(context, angle::EntryPoint::GLGetUniformdv,
444                                                  programPacked, locationPacked, params));
445         if (isCallValid)
446         {
447             context->getUniformdv(programPacked, locationPacked, params);
448         }
449         ANGLE_CAPTURE_GL(GetUniformdv, isCallValid, context, programPacked, locationPacked, params);
450     }
451     else
452     {
453         GenerateContextLostErrorOnCurrentGlobalContext();
454     }
455     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
456 }
457 
GL_PatchParameterfv(GLenum pname,const GLfloat * values)458 void GL_APIENTRY GL_PatchParameterfv(GLenum pname, const GLfloat *values)
459 {
460     Context *context = GetValidGlobalContext();
461     EVENT(context, GLPatchParameterfv, "context = %d, pname = %s, values = 0x%016" PRIxPTR "",
462           CID(context), GLenumToString(BigGLEnum::PatchParameterName, pname), (uintptr_t)values);
463 
464     if (context)
465     {
466         SCOPED_SHARE_CONTEXT_LOCK(context);
467         bool isCallValid =
468             (context->skipValidation() ||
469              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
470                                                 context->getMutableErrorSetForValidation(),
471                                                 angle::EntryPoint::GLPatchParameterfv) &&
472               ValidatePatchParameterfv(context, angle::EntryPoint::GLPatchParameterfv, pname,
473                                        values)));
474         if (isCallValid)
475         {
476             context->patchParameterfv(pname, values);
477         }
478         ANGLE_CAPTURE_GL(PatchParameterfv, isCallValid, context, pname, values);
479     }
480     else
481     {
482         GenerateContextLostErrorOnCurrentGlobalContext();
483     }
484     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
485 }
486 
GL_Uniform1d(GLint location,GLdouble x)487 void GL_APIENTRY GL_Uniform1d(GLint location, GLdouble x)
488 {
489     Context *context = GetValidGlobalContext();
490     EVENT(context, GLUniform1d, "context = %d, location = %d, x = %f", CID(context), location, x);
491 
492     if (context)
493     {
494         UniformLocation locationPacked = PackParam<UniformLocation>(location);
495         SCOPED_SHARE_CONTEXT_LOCK(context);
496         bool isCallValid =
497             (context->skipValidation() ||
498              ValidateUniform1d(context, angle::EntryPoint::GLUniform1d, locationPacked, x));
499         if (isCallValid)
500         {
501             context->uniform1d(locationPacked, x);
502         }
503         ANGLE_CAPTURE_GL(Uniform1d, isCallValid, context, locationPacked, x);
504     }
505     else
506     {
507         GenerateContextLostErrorOnCurrentGlobalContext();
508     }
509     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
510 }
511 
GL_Uniform1dv(GLint location,GLsizei count,const GLdouble * value)512 void GL_APIENTRY GL_Uniform1dv(GLint location, GLsizei count, const GLdouble *value)
513 {
514     Context *context = GetValidGlobalContext();
515     EVENT(context, GLUniform1dv,
516           "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
517           location, count, (uintptr_t)value);
518 
519     if (context)
520     {
521         UniformLocation locationPacked = PackParam<UniformLocation>(location);
522         SCOPED_SHARE_CONTEXT_LOCK(context);
523         bool isCallValid = (context->skipValidation() ||
524                             ValidateUniform1dv(context, angle::EntryPoint::GLUniform1dv,
525                                                locationPacked, count, value));
526         if (isCallValid)
527         {
528             context->uniform1dv(locationPacked, count, value);
529         }
530         ANGLE_CAPTURE_GL(Uniform1dv, isCallValid, context, locationPacked, count, value);
531     }
532     else
533     {
534         GenerateContextLostErrorOnCurrentGlobalContext();
535     }
536     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
537 }
538 
GL_Uniform2d(GLint location,GLdouble x,GLdouble y)539 void GL_APIENTRY GL_Uniform2d(GLint location, GLdouble x, GLdouble y)
540 {
541     Context *context = GetValidGlobalContext();
542     EVENT(context, GLUniform2d, "context = %d, location = %d, x = %f, y = %f", CID(context),
543           location, x, y);
544 
545     if (context)
546     {
547         UniformLocation locationPacked = PackParam<UniformLocation>(location);
548         SCOPED_SHARE_CONTEXT_LOCK(context);
549         bool isCallValid =
550             (context->skipValidation() ||
551              ValidateUniform2d(context, angle::EntryPoint::GLUniform2d, locationPacked, x, y));
552         if (isCallValid)
553         {
554             context->uniform2d(locationPacked, x, y);
555         }
556         ANGLE_CAPTURE_GL(Uniform2d, isCallValid, context, locationPacked, x, y);
557     }
558     else
559     {
560         GenerateContextLostErrorOnCurrentGlobalContext();
561     }
562     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
563 }
564 
GL_Uniform2dv(GLint location,GLsizei count,const GLdouble * value)565 void GL_APIENTRY GL_Uniform2dv(GLint location, GLsizei count, const GLdouble *value)
566 {
567     Context *context = GetValidGlobalContext();
568     EVENT(context, GLUniform2dv,
569           "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
570           location, count, (uintptr_t)value);
571 
572     if (context)
573     {
574         UniformLocation locationPacked = PackParam<UniformLocation>(location);
575         SCOPED_SHARE_CONTEXT_LOCK(context);
576         bool isCallValid = (context->skipValidation() ||
577                             ValidateUniform2dv(context, angle::EntryPoint::GLUniform2dv,
578                                                locationPacked, count, value));
579         if (isCallValid)
580         {
581             context->uniform2dv(locationPacked, count, value);
582         }
583         ANGLE_CAPTURE_GL(Uniform2dv, isCallValid, context, locationPacked, count, value);
584     }
585     else
586     {
587         GenerateContextLostErrorOnCurrentGlobalContext();
588     }
589     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
590 }
591 
GL_Uniform3d(GLint location,GLdouble x,GLdouble y,GLdouble z)592 void GL_APIENTRY GL_Uniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
593 {
594     Context *context = GetValidGlobalContext();
595     EVENT(context, GLUniform3d, "context = %d, location = %d, x = %f, y = %f, z = %f", CID(context),
596           location, x, y, z);
597 
598     if (context)
599     {
600         UniformLocation locationPacked = PackParam<UniformLocation>(location);
601         SCOPED_SHARE_CONTEXT_LOCK(context);
602         bool isCallValid =
603             (context->skipValidation() ||
604              ValidateUniform3d(context, angle::EntryPoint::GLUniform3d, locationPacked, x, y, z));
605         if (isCallValid)
606         {
607             context->uniform3d(locationPacked, x, y, z);
608         }
609         ANGLE_CAPTURE_GL(Uniform3d, isCallValid, context, locationPacked, x, y, z);
610     }
611     else
612     {
613         GenerateContextLostErrorOnCurrentGlobalContext();
614     }
615     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
616 }
617 
GL_Uniform3dv(GLint location,GLsizei count,const GLdouble * value)618 void GL_APIENTRY GL_Uniform3dv(GLint location, GLsizei count, const GLdouble *value)
619 {
620     Context *context = GetValidGlobalContext();
621     EVENT(context, GLUniform3dv,
622           "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
623           location, count, (uintptr_t)value);
624 
625     if (context)
626     {
627         UniformLocation locationPacked = PackParam<UniformLocation>(location);
628         SCOPED_SHARE_CONTEXT_LOCK(context);
629         bool isCallValid = (context->skipValidation() ||
630                             ValidateUniform3dv(context, angle::EntryPoint::GLUniform3dv,
631                                                locationPacked, count, value));
632         if (isCallValid)
633         {
634             context->uniform3dv(locationPacked, count, value);
635         }
636         ANGLE_CAPTURE_GL(Uniform3dv, isCallValid, context, locationPacked, count, value);
637     }
638     else
639     {
640         GenerateContextLostErrorOnCurrentGlobalContext();
641     }
642     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
643 }
644 
GL_Uniform4d(GLint location,GLdouble x,GLdouble y,GLdouble z,GLdouble w)645 void GL_APIENTRY GL_Uniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
646 {
647     Context *context = GetValidGlobalContext();
648     EVENT(context, GLUniform4d, "context = %d, location = %d, x = %f, y = %f, z = %f, w = %f",
649           CID(context), location, x, y, z, w);
650 
651     if (context)
652     {
653         UniformLocation locationPacked = PackParam<UniformLocation>(location);
654         SCOPED_SHARE_CONTEXT_LOCK(context);
655         bool isCallValid =
656             (context->skipValidation() || ValidateUniform4d(context, angle::EntryPoint::GLUniform4d,
657                                                             locationPacked, x, y, z, w));
658         if (isCallValid)
659         {
660             context->uniform4d(locationPacked, x, y, z, w);
661         }
662         ANGLE_CAPTURE_GL(Uniform4d, isCallValid, context, locationPacked, x, y, z, w);
663     }
664     else
665     {
666         GenerateContextLostErrorOnCurrentGlobalContext();
667     }
668     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
669 }
670 
GL_Uniform4dv(GLint location,GLsizei count,const GLdouble * value)671 void GL_APIENTRY GL_Uniform4dv(GLint location, GLsizei count, const GLdouble *value)
672 {
673     Context *context = GetValidGlobalContext();
674     EVENT(context, GLUniform4dv,
675           "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
676           location, count, (uintptr_t)value);
677 
678     if (context)
679     {
680         UniformLocation locationPacked = PackParam<UniformLocation>(location);
681         SCOPED_SHARE_CONTEXT_LOCK(context);
682         bool isCallValid = (context->skipValidation() ||
683                             ValidateUniform4dv(context, angle::EntryPoint::GLUniform4dv,
684                                                locationPacked, count, value));
685         if (isCallValid)
686         {
687             context->uniform4dv(locationPacked, count, value);
688         }
689         ANGLE_CAPTURE_GL(Uniform4dv, isCallValid, context, locationPacked, count, value);
690     }
691     else
692     {
693         GenerateContextLostErrorOnCurrentGlobalContext();
694     }
695     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
696 }
697 
GL_UniformMatrix2dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)698 void GL_APIENTRY GL_UniformMatrix2dv(GLint location,
699                                      GLsizei count,
700                                      GLboolean transpose,
701                                      const GLdouble *value)
702 {
703     Context *context = GetValidGlobalContext();
704     EVENT(context, GLUniformMatrix2dv,
705           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
706           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
707 
708     if (context)
709     {
710         UniformLocation locationPacked = PackParam<UniformLocation>(location);
711         SCOPED_SHARE_CONTEXT_LOCK(context);
712         bool isCallValid = (context->skipValidation() ||
713                             ValidateUniformMatrix2dv(context, angle::EntryPoint::GLUniformMatrix2dv,
714                                                      locationPacked, count, transpose, value));
715         if (isCallValid)
716         {
717             context->uniformMatrix2dv(locationPacked, count, transpose, value);
718         }
719         ANGLE_CAPTURE_GL(UniformMatrix2dv, isCallValid, context, locationPacked, count, transpose,
720                          value);
721     }
722     else
723     {
724         GenerateContextLostErrorOnCurrentGlobalContext();
725     }
726     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
727 }
728 
GL_UniformMatrix2x3dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)729 void GL_APIENTRY GL_UniformMatrix2x3dv(GLint location,
730                                        GLsizei count,
731                                        GLboolean transpose,
732                                        const GLdouble *value)
733 {
734     Context *context = GetValidGlobalContext();
735     EVENT(context, GLUniformMatrix2x3dv,
736           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
737           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
738 
739     if (context)
740     {
741         UniformLocation locationPacked = PackParam<UniformLocation>(location);
742         SCOPED_SHARE_CONTEXT_LOCK(context);
743         bool isCallValid =
744             (context->skipValidation() ||
745              ValidateUniformMatrix2x3dv(context, angle::EntryPoint::GLUniformMatrix2x3dv,
746                                         locationPacked, count, transpose, value));
747         if (isCallValid)
748         {
749             context->uniformMatrix2x3dv(locationPacked, count, transpose, value);
750         }
751         ANGLE_CAPTURE_GL(UniformMatrix2x3dv, isCallValid, context, locationPacked, count, transpose,
752                          value);
753     }
754     else
755     {
756         GenerateContextLostErrorOnCurrentGlobalContext();
757     }
758     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
759 }
760 
GL_UniformMatrix2x4dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)761 void GL_APIENTRY GL_UniformMatrix2x4dv(GLint location,
762                                        GLsizei count,
763                                        GLboolean transpose,
764                                        const GLdouble *value)
765 {
766     Context *context = GetValidGlobalContext();
767     EVENT(context, GLUniformMatrix2x4dv,
768           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
769           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
770 
771     if (context)
772     {
773         UniformLocation locationPacked = PackParam<UniformLocation>(location);
774         SCOPED_SHARE_CONTEXT_LOCK(context);
775         bool isCallValid =
776             (context->skipValidation() ||
777              ValidateUniformMatrix2x4dv(context, angle::EntryPoint::GLUniformMatrix2x4dv,
778                                         locationPacked, count, transpose, value));
779         if (isCallValid)
780         {
781             context->uniformMatrix2x4dv(locationPacked, count, transpose, value);
782         }
783         ANGLE_CAPTURE_GL(UniformMatrix2x4dv, isCallValid, context, locationPacked, count, transpose,
784                          value);
785     }
786     else
787     {
788         GenerateContextLostErrorOnCurrentGlobalContext();
789     }
790     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
791 }
792 
GL_UniformMatrix3dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)793 void GL_APIENTRY GL_UniformMatrix3dv(GLint location,
794                                      GLsizei count,
795                                      GLboolean transpose,
796                                      const GLdouble *value)
797 {
798     Context *context = GetValidGlobalContext();
799     EVENT(context, GLUniformMatrix3dv,
800           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
801           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
802 
803     if (context)
804     {
805         UniformLocation locationPacked = PackParam<UniformLocation>(location);
806         SCOPED_SHARE_CONTEXT_LOCK(context);
807         bool isCallValid = (context->skipValidation() ||
808                             ValidateUniformMatrix3dv(context, angle::EntryPoint::GLUniformMatrix3dv,
809                                                      locationPacked, count, transpose, value));
810         if (isCallValid)
811         {
812             context->uniformMatrix3dv(locationPacked, count, transpose, value);
813         }
814         ANGLE_CAPTURE_GL(UniformMatrix3dv, isCallValid, context, locationPacked, count, transpose,
815                          value);
816     }
817     else
818     {
819         GenerateContextLostErrorOnCurrentGlobalContext();
820     }
821     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
822 }
823 
GL_UniformMatrix3x2dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)824 void GL_APIENTRY GL_UniformMatrix3x2dv(GLint location,
825                                        GLsizei count,
826                                        GLboolean transpose,
827                                        const GLdouble *value)
828 {
829     Context *context = GetValidGlobalContext();
830     EVENT(context, GLUniformMatrix3x2dv,
831           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
832           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
833 
834     if (context)
835     {
836         UniformLocation locationPacked = PackParam<UniformLocation>(location);
837         SCOPED_SHARE_CONTEXT_LOCK(context);
838         bool isCallValid =
839             (context->skipValidation() ||
840              ValidateUniformMatrix3x2dv(context, angle::EntryPoint::GLUniformMatrix3x2dv,
841                                         locationPacked, count, transpose, value));
842         if (isCallValid)
843         {
844             context->uniformMatrix3x2dv(locationPacked, count, transpose, value);
845         }
846         ANGLE_CAPTURE_GL(UniformMatrix3x2dv, isCallValid, context, locationPacked, count, transpose,
847                          value);
848     }
849     else
850     {
851         GenerateContextLostErrorOnCurrentGlobalContext();
852     }
853     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
854 }
855 
GL_UniformMatrix3x4dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)856 void GL_APIENTRY GL_UniformMatrix3x4dv(GLint location,
857                                        GLsizei count,
858                                        GLboolean transpose,
859                                        const GLdouble *value)
860 {
861     Context *context = GetValidGlobalContext();
862     EVENT(context, GLUniformMatrix3x4dv,
863           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
864           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
865 
866     if (context)
867     {
868         UniformLocation locationPacked = PackParam<UniformLocation>(location);
869         SCOPED_SHARE_CONTEXT_LOCK(context);
870         bool isCallValid =
871             (context->skipValidation() ||
872              ValidateUniformMatrix3x4dv(context, angle::EntryPoint::GLUniformMatrix3x4dv,
873                                         locationPacked, count, transpose, value));
874         if (isCallValid)
875         {
876             context->uniformMatrix3x4dv(locationPacked, count, transpose, value);
877         }
878         ANGLE_CAPTURE_GL(UniformMatrix3x4dv, isCallValid, context, locationPacked, count, transpose,
879                          value);
880     }
881     else
882     {
883         GenerateContextLostErrorOnCurrentGlobalContext();
884     }
885     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
886 }
887 
GL_UniformMatrix4dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)888 void GL_APIENTRY GL_UniformMatrix4dv(GLint location,
889                                      GLsizei count,
890                                      GLboolean transpose,
891                                      const GLdouble *value)
892 {
893     Context *context = GetValidGlobalContext();
894     EVENT(context, GLUniformMatrix4dv,
895           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
896           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
897 
898     if (context)
899     {
900         UniformLocation locationPacked = PackParam<UniformLocation>(location);
901         SCOPED_SHARE_CONTEXT_LOCK(context);
902         bool isCallValid = (context->skipValidation() ||
903                             ValidateUniformMatrix4dv(context, angle::EntryPoint::GLUniformMatrix4dv,
904                                                      locationPacked, count, transpose, value));
905         if (isCallValid)
906         {
907             context->uniformMatrix4dv(locationPacked, count, transpose, value);
908         }
909         ANGLE_CAPTURE_GL(UniformMatrix4dv, isCallValid, context, locationPacked, count, transpose,
910                          value);
911     }
912     else
913     {
914         GenerateContextLostErrorOnCurrentGlobalContext();
915     }
916     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
917 }
918 
GL_UniformMatrix4x2dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)919 void GL_APIENTRY GL_UniformMatrix4x2dv(GLint location,
920                                        GLsizei count,
921                                        GLboolean transpose,
922                                        const GLdouble *value)
923 {
924     Context *context = GetValidGlobalContext();
925     EVENT(context, GLUniformMatrix4x2dv,
926           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
927           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
928 
929     if (context)
930     {
931         UniformLocation locationPacked = PackParam<UniformLocation>(location);
932         SCOPED_SHARE_CONTEXT_LOCK(context);
933         bool isCallValid =
934             (context->skipValidation() ||
935              ValidateUniformMatrix4x2dv(context, angle::EntryPoint::GLUniformMatrix4x2dv,
936                                         locationPacked, count, transpose, value));
937         if (isCallValid)
938         {
939             context->uniformMatrix4x2dv(locationPacked, count, transpose, value);
940         }
941         ANGLE_CAPTURE_GL(UniformMatrix4x2dv, isCallValid, context, locationPacked, count, transpose,
942                          value);
943     }
944     else
945     {
946         GenerateContextLostErrorOnCurrentGlobalContext();
947     }
948     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
949 }
950 
GL_UniformMatrix4x3dv(GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)951 void GL_APIENTRY GL_UniformMatrix4x3dv(GLint location,
952                                        GLsizei count,
953                                        GLboolean transpose,
954                                        const GLdouble *value)
955 {
956     Context *context = GetValidGlobalContext();
957     EVENT(context, GLUniformMatrix4x3dv,
958           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
959           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
960 
961     if (context)
962     {
963         UniformLocation locationPacked = PackParam<UniformLocation>(location);
964         SCOPED_SHARE_CONTEXT_LOCK(context);
965         bool isCallValid =
966             (context->skipValidation() ||
967              ValidateUniformMatrix4x3dv(context, angle::EntryPoint::GLUniformMatrix4x3dv,
968                                         locationPacked, count, transpose, value));
969         if (isCallValid)
970         {
971             context->uniformMatrix4x3dv(locationPacked, count, transpose, value);
972         }
973         ANGLE_CAPTURE_GL(UniformMatrix4x3dv, isCallValid, context, locationPacked, count, transpose,
974                          value);
975     }
976     else
977     {
978         GenerateContextLostErrorOnCurrentGlobalContext();
979     }
980     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
981 }
982 
GL_UniformSubroutinesuiv(GLenum shadertype,GLsizei count,const GLuint * indices)983 void GL_APIENTRY GL_UniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices)
984 {
985     Context *context = GetValidGlobalContext();
986     EVENT(context, GLUniformSubroutinesuiv,
987           "context = %d, shadertype = %s, count = %d, indices = 0x%016" PRIxPTR "", CID(context),
988           GLenumToString(BigGLEnum::ShaderType, shadertype), count, (uintptr_t)indices);
989 
990     if (context)
991     {
992         SCOPED_SHARE_CONTEXT_LOCK(context);
993         bool isCallValid =
994             (context->skipValidation() ||
995              ValidateUniformSubroutinesuiv(context, angle::EntryPoint::GLUniformSubroutinesuiv,
996                                            shadertype, count, indices));
997         if (isCallValid)
998         {
999             context->uniformSubroutinesuiv(shadertype, count, indices);
1000         }
1001         ANGLE_CAPTURE_GL(UniformSubroutinesuiv, isCallValid, context, shadertype, count, indices);
1002     }
1003     else
1004     {
1005         GenerateContextLostErrorOnCurrentGlobalContext();
1006     }
1007     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1008 }
1009 
1010 // GL 4.1
GL_DepthRangeArrayv(GLuint first,GLsizei count,const GLdouble * v)1011 void GL_APIENTRY GL_DepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v)
1012 {
1013     Context *context = GetValidGlobalContext();
1014     EVENT(context, GLDepthRangeArrayv,
1015           "context = %d, first = %u, count = %d, v = 0x%016" PRIxPTR "", CID(context), first, count,
1016           (uintptr_t)v);
1017 
1018     if (context)
1019     {
1020         SCOPED_SHARE_CONTEXT_LOCK(context);
1021         bool isCallValid =
1022             (context->skipValidation() ||
1023              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1024                                                 context->getMutableErrorSetForValidation(),
1025                                                 angle::EntryPoint::GLDepthRangeArrayv) &&
1026               ValidateDepthRangeArrayv(context, angle::EntryPoint::GLDepthRangeArrayv, first, count,
1027                                        v)));
1028         if (isCallValid)
1029         {
1030             context->depthRangeArrayv(first, count, v);
1031         }
1032         ANGLE_CAPTURE_GL(DepthRangeArrayv, isCallValid, context, first, count, v);
1033     }
1034     else
1035     {
1036         GenerateContextLostErrorOnCurrentGlobalContext();
1037     }
1038     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1039 }
1040 
GL_DepthRangeIndexed(GLuint index,GLdouble n,GLdouble f)1041 void GL_APIENTRY GL_DepthRangeIndexed(GLuint index, GLdouble n, GLdouble f)
1042 {
1043     Context *context = GetValidGlobalContext();
1044     EVENT(context, GLDepthRangeIndexed, "context = %d, index = %u, n = %f, f = %f", CID(context),
1045           index, n, f);
1046 
1047     if (context)
1048     {
1049         SCOPED_SHARE_CONTEXT_LOCK(context);
1050         bool isCallValid =
1051             (context->skipValidation() ||
1052              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1053                                                 context->getMutableErrorSetForValidation(),
1054                                                 angle::EntryPoint::GLDepthRangeIndexed) &&
1055               ValidateDepthRangeIndexed(context, angle::EntryPoint::GLDepthRangeIndexed, index, n,
1056                                         f)));
1057         if (isCallValid)
1058         {
1059             context->depthRangeIndexed(index, n, f);
1060         }
1061         ANGLE_CAPTURE_GL(DepthRangeIndexed, isCallValid, context, index, n, f);
1062     }
1063     else
1064     {
1065         GenerateContextLostErrorOnCurrentGlobalContext();
1066     }
1067     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1068 }
1069 
GL_GetDoublei_v(GLenum target,GLuint index,GLdouble * data)1070 void GL_APIENTRY GL_GetDoublei_v(GLenum target, GLuint index, GLdouble *data)
1071 {
1072     Context *context = GetValidGlobalContext();
1073     EVENT(context, GLGetDoublei_v,
1074           "context = %d, target = %s, index = %u, data = 0x%016" PRIxPTR "", CID(context),
1075           GLenumToString(BigGLEnum::GetPName, target), index, (uintptr_t)data);
1076 
1077     if (context)
1078     {
1079         SCOPED_SHARE_CONTEXT_LOCK(context);
1080         bool isCallValid =
1081             (context->skipValidation() ||
1082              ValidateGetDoublei_v(context, angle::EntryPoint::GLGetDoublei_v, target, index, data));
1083         if (isCallValid)
1084         {
1085             context->getDoublei_v(target, index, data);
1086         }
1087         ANGLE_CAPTURE_GL(GetDoublei_v, isCallValid, context, target, index, data);
1088     }
1089     else
1090     {
1091         GenerateContextLostErrorOnCurrentGlobalContext();
1092     }
1093     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1094 }
1095 
GL_GetFloati_v(GLenum target,GLuint index,GLfloat * data)1096 void GL_APIENTRY GL_GetFloati_v(GLenum target, GLuint index, GLfloat *data)
1097 {
1098     Context *context = GetValidGlobalContext();
1099     EVENT(context, GLGetFloati_v, "context = %d, target = %s, index = %u, data = 0x%016" PRIxPTR "",
1100           CID(context), GLenumToString(BigGLEnum::GetPName, target), index, (uintptr_t)data);
1101 
1102     if (context)
1103     {
1104         SCOPED_SHARE_CONTEXT_LOCK(context);
1105         bool isCallValid =
1106             (context->skipValidation() ||
1107              ValidateGetFloati_v(context, angle::EntryPoint::GLGetFloati_v, target, index, data));
1108         if (isCallValid)
1109         {
1110             context->getFloati_v(target, index, data);
1111         }
1112         ANGLE_CAPTURE_GL(GetFloati_v, isCallValid, context, target, index, data);
1113     }
1114     else
1115     {
1116         GenerateContextLostErrorOnCurrentGlobalContext();
1117     }
1118     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1119 }
1120 
GL_GetVertexAttribLdv(GLuint index,GLenum pname,GLdouble * params)1121 void GL_APIENTRY GL_GetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params)
1122 {
1123     Context *context = GetValidGlobalContext();
1124     EVENT(context, GLGetVertexAttribLdv,
1125           "context = %d, index = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), index,
1126           GLenumToString(BigGLEnum::VertexAttribEnum, pname), (uintptr_t)params);
1127 
1128     if (context)
1129     {
1130         SCOPED_SHARE_CONTEXT_LOCK(context);
1131         bool isCallValid =
1132             (context->skipValidation() ||
1133              ValidateGetVertexAttribLdv(context, angle::EntryPoint::GLGetVertexAttribLdv, index,
1134                                         pname, params));
1135         if (isCallValid)
1136         {
1137             context->getVertexAttribLdv(index, pname, params);
1138         }
1139         ANGLE_CAPTURE_GL(GetVertexAttribLdv, isCallValid, context, index, pname, params);
1140     }
1141     else
1142     {
1143         GenerateContextLostErrorOnCurrentGlobalContext();
1144     }
1145     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1146 }
1147 
GL_ProgramUniform1d(GLuint program,GLint location,GLdouble v0)1148 void GL_APIENTRY GL_ProgramUniform1d(GLuint program, GLint location, GLdouble v0)
1149 {
1150     Context *context = GetValidGlobalContext();
1151     EVENT(context, GLProgramUniform1d, "context = %d, program = %u, location = %d, v0 = %f",
1152           CID(context), program, location, v0);
1153 
1154     if (context)
1155     {
1156         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1157         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1158         SCOPED_SHARE_CONTEXT_LOCK(context);
1159         bool isCallValid =
1160             (context->skipValidation() ||
1161              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1162                                                 context->getMutableErrorSetForValidation(),
1163                                                 angle::EntryPoint::GLProgramUniform1d) &&
1164               ValidateProgramUniform1d(context, angle::EntryPoint::GLProgramUniform1d,
1165                                        programPacked, locationPacked, v0)));
1166         if (isCallValid)
1167         {
1168             context->programUniform1d(programPacked, locationPacked, v0);
1169         }
1170         ANGLE_CAPTURE_GL(ProgramUniform1d, isCallValid, context, programPacked, locationPacked, v0);
1171     }
1172     else
1173     {
1174         GenerateContextLostErrorOnCurrentGlobalContext();
1175     }
1176     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1177 }
1178 
GL_ProgramUniform1dv(GLuint program,GLint location,GLsizei count,const GLdouble * value)1179 void GL_APIENTRY GL_ProgramUniform1dv(GLuint program,
1180                                       GLint location,
1181                                       GLsizei count,
1182                                       const GLdouble *value)
1183 {
1184     Context *context = GetValidGlobalContext();
1185     EVENT(context, GLProgramUniform1dv,
1186           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
1187           CID(context), program, location, count, (uintptr_t)value);
1188 
1189     if (context)
1190     {
1191         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1192         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1193         SCOPED_SHARE_CONTEXT_LOCK(context);
1194         bool isCallValid =
1195             (context->skipValidation() ||
1196              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1197                                                 context->getMutableErrorSetForValidation(),
1198                                                 angle::EntryPoint::GLProgramUniform1dv) &&
1199               ValidateProgramUniform1dv(context, angle::EntryPoint::GLProgramUniform1dv,
1200                                         programPacked, locationPacked, count, value)));
1201         if (isCallValid)
1202         {
1203             context->programUniform1dv(programPacked, locationPacked, count, value);
1204         }
1205         ANGLE_CAPTURE_GL(ProgramUniform1dv, isCallValid, context, programPacked, locationPacked,
1206                          count, value);
1207     }
1208     else
1209     {
1210         GenerateContextLostErrorOnCurrentGlobalContext();
1211     }
1212     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1213 }
1214 
GL_ProgramUniform2d(GLuint program,GLint location,GLdouble v0,GLdouble v1)1215 void GL_APIENTRY GL_ProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1)
1216 {
1217     Context *context = GetValidGlobalContext();
1218     EVENT(context, GLProgramUniform2d,
1219           "context = %d, program = %u, location = %d, v0 = %f, v1 = %f", CID(context), program,
1220           location, v0, v1);
1221 
1222     if (context)
1223     {
1224         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1225         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1226         SCOPED_SHARE_CONTEXT_LOCK(context);
1227         bool isCallValid =
1228             (context->skipValidation() ||
1229              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1230                                                 context->getMutableErrorSetForValidation(),
1231                                                 angle::EntryPoint::GLProgramUniform2d) &&
1232               ValidateProgramUniform2d(context, angle::EntryPoint::GLProgramUniform2d,
1233                                        programPacked, locationPacked, v0, v1)));
1234         if (isCallValid)
1235         {
1236             context->programUniform2d(programPacked, locationPacked, v0, v1);
1237         }
1238         ANGLE_CAPTURE_GL(ProgramUniform2d, isCallValid, context, programPacked, locationPacked, v0,
1239                          v1);
1240     }
1241     else
1242     {
1243         GenerateContextLostErrorOnCurrentGlobalContext();
1244     }
1245     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1246 }
1247 
GL_ProgramUniform2dv(GLuint program,GLint location,GLsizei count,const GLdouble * value)1248 void GL_APIENTRY GL_ProgramUniform2dv(GLuint program,
1249                                       GLint location,
1250                                       GLsizei count,
1251                                       const GLdouble *value)
1252 {
1253     Context *context = GetValidGlobalContext();
1254     EVENT(context, GLProgramUniform2dv,
1255           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
1256           CID(context), program, location, count, (uintptr_t)value);
1257 
1258     if (context)
1259     {
1260         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1261         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1262         SCOPED_SHARE_CONTEXT_LOCK(context);
1263         bool isCallValid =
1264             (context->skipValidation() ||
1265              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1266                                                 context->getMutableErrorSetForValidation(),
1267                                                 angle::EntryPoint::GLProgramUniform2dv) &&
1268               ValidateProgramUniform2dv(context, angle::EntryPoint::GLProgramUniform2dv,
1269                                         programPacked, locationPacked, count, value)));
1270         if (isCallValid)
1271         {
1272             context->programUniform2dv(programPacked, locationPacked, count, value);
1273         }
1274         ANGLE_CAPTURE_GL(ProgramUniform2dv, isCallValid, context, programPacked, locationPacked,
1275                          count, value);
1276     }
1277     else
1278     {
1279         GenerateContextLostErrorOnCurrentGlobalContext();
1280     }
1281     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1282 }
1283 
1284 void GL_APIENTRY
GL_ProgramUniform3d(GLuint program,GLint location,GLdouble v0,GLdouble v1,GLdouble v2)1285 GL_ProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2)
1286 {
1287     Context *context = GetValidGlobalContext();
1288     EVENT(context, GLProgramUniform3d,
1289           "context = %d, program = %u, location = %d, v0 = %f, v1 = %f, v2 = %f", CID(context),
1290           program, location, v0, v1, v2);
1291 
1292     if (context)
1293     {
1294         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1295         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1296         SCOPED_SHARE_CONTEXT_LOCK(context);
1297         bool isCallValid =
1298             (context->skipValidation() ||
1299              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1300                                                 context->getMutableErrorSetForValidation(),
1301                                                 angle::EntryPoint::GLProgramUniform3d) &&
1302               ValidateProgramUniform3d(context, angle::EntryPoint::GLProgramUniform3d,
1303                                        programPacked, locationPacked, v0, v1, v2)));
1304         if (isCallValid)
1305         {
1306             context->programUniform3d(programPacked, locationPacked, v0, v1, v2);
1307         }
1308         ANGLE_CAPTURE_GL(ProgramUniform3d, isCallValid, context, programPacked, locationPacked, v0,
1309                          v1, v2);
1310     }
1311     else
1312     {
1313         GenerateContextLostErrorOnCurrentGlobalContext();
1314     }
1315     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1316 }
1317 
GL_ProgramUniform3dv(GLuint program,GLint location,GLsizei count,const GLdouble * value)1318 void GL_APIENTRY GL_ProgramUniform3dv(GLuint program,
1319                                       GLint location,
1320                                       GLsizei count,
1321                                       const GLdouble *value)
1322 {
1323     Context *context = GetValidGlobalContext();
1324     EVENT(context, GLProgramUniform3dv,
1325           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
1326           CID(context), program, location, count, (uintptr_t)value);
1327 
1328     if (context)
1329     {
1330         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1331         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1332         SCOPED_SHARE_CONTEXT_LOCK(context);
1333         bool isCallValid =
1334             (context->skipValidation() ||
1335              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1336                                                 context->getMutableErrorSetForValidation(),
1337                                                 angle::EntryPoint::GLProgramUniform3dv) &&
1338               ValidateProgramUniform3dv(context, angle::EntryPoint::GLProgramUniform3dv,
1339                                         programPacked, locationPacked, count, value)));
1340         if (isCallValid)
1341         {
1342             context->programUniform3dv(programPacked, locationPacked, count, value);
1343         }
1344         ANGLE_CAPTURE_GL(ProgramUniform3dv, isCallValid, context, programPacked, locationPacked,
1345                          count, value);
1346     }
1347     else
1348     {
1349         GenerateContextLostErrorOnCurrentGlobalContext();
1350     }
1351     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1352 }
1353 
GL_ProgramUniform4d(GLuint program,GLint location,GLdouble v0,GLdouble v1,GLdouble v2,GLdouble v3)1354 void GL_APIENTRY GL_ProgramUniform4d(GLuint program,
1355                                      GLint location,
1356                                      GLdouble v0,
1357                                      GLdouble v1,
1358                                      GLdouble v2,
1359                                      GLdouble v3)
1360 {
1361     Context *context = GetValidGlobalContext();
1362     EVENT(context, GLProgramUniform4d,
1363           "context = %d, program = %u, location = %d, v0 = %f, v1 = %f, v2 = %f, v3 = %f",
1364           CID(context), program, location, v0, v1, v2, v3);
1365 
1366     if (context)
1367     {
1368         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1369         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1370         SCOPED_SHARE_CONTEXT_LOCK(context);
1371         bool isCallValid =
1372             (context->skipValidation() ||
1373              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1374                                                 context->getMutableErrorSetForValidation(),
1375                                                 angle::EntryPoint::GLProgramUniform4d) &&
1376               ValidateProgramUniform4d(context, angle::EntryPoint::GLProgramUniform4d,
1377                                        programPacked, locationPacked, v0, v1, v2, v3)));
1378         if (isCallValid)
1379         {
1380             context->programUniform4d(programPacked, locationPacked, v0, v1, v2, v3);
1381         }
1382         ANGLE_CAPTURE_GL(ProgramUniform4d, isCallValid, context, programPacked, locationPacked, v0,
1383                          v1, v2, v3);
1384     }
1385     else
1386     {
1387         GenerateContextLostErrorOnCurrentGlobalContext();
1388     }
1389     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1390 }
1391 
GL_ProgramUniform4dv(GLuint program,GLint location,GLsizei count,const GLdouble * value)1392 void GL_APIENTRY GL_ProgramUniform4dv(GLuint program,
1393                                       GLint location,
1394                                       GLsizei count,
1395                                       const GLdouble *value)
1396 {
1397     Context *context = GetValidGlobalContext();
1398     EVENT(context, GLProgramUniform4dv,
1399           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
1400           CID(context), program, location, count, (uintptr_t)value);
1401 
1402     if (context)
1403     {
1404         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1405         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1406         SCOPED_SHARE_CONTEXT_LOCK(context);
1407         bool isCallValid =
1408             (context->skipValidation() ||
1409              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1410                                                 context->getMutableErrorSetForValidation(),
1411                                                 angle::EntryPoint::GLProgramUniform4dv) &&
1412               ValidateProgramUniform4dv(context, angle::EntryPoint::GLProgramUniform4dv,
1413                                         programPacked, locationPacked, count, value)));
1414         if (isCallValid)
1415         {
1416             context->programUniform4dv(programPacked, locationPacked, count, value);
1417         }
1418         ANGLE_CAPTURE_GL(ProgramUniform4dv, isCallValid, context, programPacked, locationPacked,
1419                          count, value);
1420     }
1421     else
1422     {
1423         GenerateContextLostErrorOnCurrentGlobalContext();
1424     }
1425     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1426 }
1427 
GL_ProgramUniformMatrix2dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)1428 void GL_APIENTRY GL_ProgramUniformMatrix2dv(GLuint program,
1429                                             GLint location,
1430                                             GLsizei count,
1431                                             GLboolean transpose,
1432                                             const GLdouble *value)
1433 {
1434     Context *context = GetValidGlobalContext();
1435     EVENT(context, GLProgramUniformMatrix2dv,
1436           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
1437           "0x%016" PRIxPTR "",
1438           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
1439 
1440     if (context)
1441     {
1442         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1443         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1444         SCOPED_SHARE_CONTEXT_LOCK(context);
1445         bool isCallValid =
1446             (context->skipValidation() ||
1447              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1448                                                 context->getMutableErrorSetForValidation(),
1449                                                 angle::EntryPoint::GLProgramUniformMatrix2dv) &&
1450               ValidateProgramUniformMatrix2dv(context, angle::EntryPoint::GLProgramUniformMatrix2dv,
1451                                               programPacked, locationPacked, count, transpose,
1452                                               value)));
1453         if (isCallValid)
1454         {
1455             context->programUniformMatrix2dv(programPacked, locationPacked, count, transpose,
1456                                              value);
1457         }
1458         ANGLE_CAPTURE_GL(ProgramUniformMatrix2dv, isCallValid, context, programPacked,
1459                          locationPacked, count, transpose, value);
1460     }
1461     else
1462     {
1463         GenerateContextLostErrorOnCurrentGlobalContext();
1464     }
1465     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1466 }
1467 
GL_ProgramUniformMatrix2x3dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)1468 void GL_APIENTRY GL_ProgramUniformMatrix2x3dv(GLuint program,
1469                                               GLint location,
1470                                               GLsizei count,
1471                                               GLboolean transpose,
1472                                               const GLdouble *value)
1473 {
1474     Context *context = GetValidGlobalContext();
1475     EVENT(context, GLProgramUniformMatrix2x3dv,
1476           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
1477           "0x%016" PRIxPTR "",
1478           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
1479 
1480     if (context)
1481     {
1482         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1483         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1484         SCOPED_SHARE_CONTEXT_LOCK(context);
1485         bool isCallValid =
1486             (context->skipValidation() ||
1487              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1488                                                 context->getMutableErrorSetForValidation(),
1489                                                 angle::EntryPoint::GLProgramUniformMatrix2x3dv) &&
1490               ValidateProgramUniformMatrix2x3dv(
1491                   context, angle::EntryPoint::GLProgramUniformMatrix2x3dv, programPacked,
1492                   locationPacked, count, transpose, value)));
1493         if (isCallValid)
1494         {
1495             context->programUniformMatrix2x3dv(programPacked, locationPacked, count, transpose,
1496                                                value);
1497         }
1498         ANGLE_CAPTURE_GL(ProgramUniformMatrix2x3dv, isCallValid, context, programPacked,
1499                          locationPacked, count, transpose, value);
1500     }
1501     else
1502     {
1503         GenerateContextLostErrorOnCurrentGlobalContext();
1504     }
1505     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1506 }
1507 
GL_ProgramUniformMatrix2x4dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)1508 void GL_APIENTRY GL_ProgramUniformMatrix2x4dv(GLuint program,
1509                                               GLint location,
1510                                               GLsizei count,
1511                                               GLboolean transpose,
1512                                               const GLdouble *value)
1513 {
1514     Context *context = GetValidGlobalContext();
1515     EVENT(context, GLProgramUniformMatrix2x4dv,
1516           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
1517           "0x%016" PRIxPTR "",
1518           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
1519 
1520     if (context)
1521     {
1522         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1523         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1524         SCOPED_SHARE_CONTEXT_LOCK(context);
1525         bool isCallValid =
1526             (context->skipValidation() ||
1527              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1528                                                 context->getMutableErrorSetForValidation(),
1529                                                 angle::EntryPoint::GLProgramUniformMatrix2x4dv) &&
1530               ValidateProgramUniformMatrix2x4dv(
1531                   context, angle::EntryPoint::GLProgramUniformMatrix2x4dv, programPacked,
1532                   locationPacked, count, transpose, value)));
1533         if (isCallValid)
1534         {
1535             context->programUniformMatrix2x4dv(programPacked, locationPacked, count, transpose,
1536                                                value);
1537         }
1538         ANGLE_CAPTURE_GL(ProgramUniformMatrix2x4dv, isCallValid, context, programPacked,
1539                          locationPacked, count, transpose, value);
1540     }
1541     else
1542     {
1543         GenerateContextLostErrorOnCurrentGlobalContext();
1544     }
1545     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1546 }
1547 
GL_ProgramUniformMatrix3dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)1548 void GL_APIENTRY GL_ProgramUniformMatrix3dv(GLuint program,
1549                                             GLint location,
1550                                             GLsizei count,
1551                                             GLboolean transpose,
1552                                             const GLdouble *value)
1553 {
1554     Context *context = GetValidGlobalContext();
1555     EVENT(context, GLProgramUniformMatrix3dv,
1556           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
1557           "0x%016" PRIxPTR "",
1558           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
1559 
1560     if (context)
1561     {
1562         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1563         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1564         SCOPED_SHARE_CONTEXT_LOCK(context);
1565         bool isCallValid =
1566             (context->skipValidation() ||
1567              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1568                                                 context->getMutableErrorSetForValidation(),
1569                                                 angle::EntryPoint::GLProgramUniformMatrix3dv) &&
1570               ValidateProgramUniformMatrix3dv(context, angle::EntryPoint::GLProgramUniformMatrix3dv,
1571                                               programPacked, locationPacked, count, transpose,
1572                                               value)));
1573         if (isCallValid)
1574         {
1575             context->programUniformMatrix3dv(programPacked, locationPacked, count, transpose,
1576                                              value);
1577         }
1578         ANGLE_CAPTURE_GL(ProgramUniformMatrix3dv, isCallValid, context, programPacked,
1579                          locationPacked, count, transpose, value);
1580     }
1581     else
1582     {
1583         GenerateContextLostErrorOnCurrentGlobalContext();
1584     }
1585     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1586 }
1587 
GL_ProgramUniformMatrix3x2dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)1588 void GL_APIENTRY GL_ProgramUniformMatrix3x2dv(GLuint program,
1589                                               GLint location,
1590                                               GLsizei count,
1591                                               GLboolean transpose,
1592                                               const GLdouble *value)
1593 {
1594     Context *context = GetValidGlobalContext();
1595     EVENT(context, GLProgramUniformMatrix3x2dv,
1596           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
1597           "0x%016" PRIxPTR "",
1598           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
1599 
1600     if (context)
1601     {
1602         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1603         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1604         SCOPED_SHARE_CONTEXT_LOCK(context);
1605         bool isCallValid =
1606             (context->skipValidation() ||
1607              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1608                                                 context->getMutableErrorSetForValidation(),
1609                                                 angle::EntryPoint::GLProgramUniformMatrix3x2dv) &&
1610               ValidateProgramUniformMatrix3x2dv(
1611                   context, angle::EntryPoint::GLProgramUniformMatrix3x2dv, programPacked,
1612                   locationPacked, count, transpose, value)));
1613         if (isCallValid)
1614         {
1615             context->programUniformMatrix3x2dv(programPacked, locationPacked, count, transpose,
1616                                                value);
1617         }
1618         ANGLE_CAPTURE_GL(ProgramUniformMatrix3x2dv, isCallValid, context, programPacked,
1619                          locationPacked, count, transpose, value);
1620     }
1621     else
1622     {
1623         GenerateContextLostErrorOnCurrentGlobalContext();
1624     }
1625     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1626 }
1627 
GL_ProgramUniformMatrix3x4dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)1628 void GL_APIENTRY GL_ProgramUniformMatrix3x4dv(GLuint program,
1629                                               GLint location,
1630                                               GLsizei count,
1631                                               GLboolean transpose,
1632                                               const GLdouble *value)
1633 {
1634     Context *context = GetValidGlobalContext();
1635     EVENT(context, GLProgramUniformMatrix3x4dv,
1636           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
1637           "0x%016" PRIxPTR "",
1638           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
1639 
1640     if (context)
1641     {
1642         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1643         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1644         SCOPED_SHARE_CONTEXT_LOCK(context);
1645         bool isCallValid =
1646             (context->skipValidation() ||
1647              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1648                                                 context->getMutableErrorSetForValidation(),
1649                                                 angle::EntryPoint::GLProgramUniformMatrix3x4dv) &&
1650               ValidateProgramUniformMatrix3x4dv(
1651                   context, angle::EntryPoint::GLProgramUniformMatrix3x4dv, programPacked,
1652                   locationPacked, count, transpose, value)));
1653         if (isCallValid)
1654         {
1655             context->programUniformMatrix3x4dv(programPacked, locationPacked, count, transpose,
1656                                                value);
1657         }
1658         ANGLE_CAPTURE_GL(ProgramUniformMatrix3x4dv, isCallValid, context, programPacked,
1659                          locationPacked, count, transpose, value);
1660     }
1661     else
1662     {
1663         GenerateContextLostErrorOnCurrentGlobalContext();
1664     }
1665     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1666 }
1667 
GL_ProgramUniformMatrix4dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)1668 void GL_APIENTRY GL_ProgramUniformMatrix4dv(GLuint program,
1669                                             GLint location,
1670                                             GLsizei count,
1671                                             GLboolean transpose,
1672                                             const GLdouble *value)
1673 {
1674     Context *context = GetValidGlobalContext();
1675     EVENT(context, GLProgramUniformMatrix4dv,
1676           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
1677           "0x%016" PRIxPTR "",
1678           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
1679 
1680     if (context)
1681     {
1682         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1683         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1684         SCOPED_SHARE_CONTEXT_LOCK(context);
1685         bool isCallValid =
1686             (context->skipValidation() ||
1687              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1688                                                 context->getMutableErrorSetForValidation(),
1689                                                 angle::EntryPoint::GLProgramUniformMatrix4dv) &&
1690               ValidateProgramUniformMatrix4dv(context, angle::EntryPoint::GLProgramUniformMatrix4dv,
1691                                               programPacked, locationPacked, count, transpose,
1692                                               value)));
1693         if (isCallValid)
1694         {
1695             context->programUniformMatrix4dv(programPacked, locationPacked, count, transpose,
1696                                              value);
1697         }
1698         ANGLE_CAPTURE_GL(ProgramUniformMatrix4dv, isCallValid, context, programPacked,
1699                          locationPacked, count, transpose, value);
1700     }
1701     else
1702     {
1703         GenerateContextLostErrorOnCurrentGlobalContext();
1704     }
1705     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1706 }
1707 
GL_ProgramUniformMatrix4x2dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)1708 void GL_APIENTRY GL_ProgramUniformMatrix4x2dv(GLuint program,
1709                                               GLint location,
1710                                               GLsizei count,
1711                                               GLboolean transpose,
1712                                               const GLdouble *value)
1713 {
1714     Context *context = GetValidGlobalContext();
1715     EVENT(context, GLProgramUniformMatrix4x2dv,
1716           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
1717           "0x%016" PRIxPTR "",
1718           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
1719 
1720     if (context)
1721     {
1722         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1723         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1724         SCOPED_SHARE_CONTEXT_LOCK(context);
1725         bool isCallValid =
1726             (context->skipValidation() ||
1727              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1728                                                 context->getMutableErrorSetForValidation(),
1729                                                 angle::EntryPoint::GLProgramUniformMatrix4x2dv) &&
1730               ValidateProgramUniformMatrix4x2dv(
1731                   context, angle::EntryPoint::GLProgramUniformMatrix4x2dv, programPacked,
1732                   locationPacked, count, transpose, value)));
1733         if (isCallValid)
1734         {
1735             context->programUniformMatrix4x2dv(programPacked, locationPacked, count, transpose,
1736                                                value);
1737         }
1738         ANGLE_CAPTURE_GL(ProgramUniformMatrix4x2dv, isCallValid, context, programPacked,
1739                          locationPacked, count, transpose, value);
1740     }
1741     else
1742     {
1743         GenerateContextLostErrorOnCurrentGlobalContext();
1744     }
1745     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1746 }
1747 
GL_ProgramUniformMatrix4x3dv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLdouble * value)1748 void GL_APIENTRY GL_ProgramUniformMatrix4x3dv(GLuint program,
1749                                               GLint location,
1750                                               GLsizei count,
1751                                               GLboolean transpose,
1752                                               const GLdouble *value)
1753 {
1754     Context *context = GetValidGlobalContext();
1755     EVENT(context, GLProgramUniformMatrix4x3dv,
1756           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
1757           "0x%016" PRIxPTR "",
1758           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
1759 
1760     if (context)
1761     {
1762         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1763         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1764         SCOPED_SHARE_CONTEXT_LOCK(context);
1765         bool isCallValid =
1766             (context->skipValidation() ||
1767              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1768                                                 context->getMutableErrorSetForValidation(),
1769                                                 angle::EntryPoint::GLProgramUniformMatrix4x3dv) &&
1770               ValidateProgramUniformMatrix4x3dv(
1771                   context, angle::EntryPoint::GLProgramUniformMatrix4x3dv, programPacked,
1772                   locationPacked, count, transpose, value)));
1773         if (isCallValid)
1774         {
1775             context->programUniformMatrix4x3dv(programPacked, locationPacked, count, transpose,
1776                                                value);
1777         }
1778         ANGLE_CAPTURE_GL(ProgramUniformMatrix4x3dv, isCallValid, context, programPacked,
1779                          locationPacked, count, transpose, value);
1780     }
1781     else
1782     {
1783         GenerateContextLostErrorOnCurrentGlobalContext();
1784     }
1785     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1786 }
1787 
GL_ScissorArrayv(GLuint first,GLsizei count,const GLint * v)1788 void GL_APIENTRY GL_ScissorArrayv(GLuint first, GLsizei count, const GLint *v)
1789 {
1790     Context *context = GetValidGlobalContext();
1791     EVENT(context, GLScissorArrayv, "context = %d, first = %u, count = %d, v = 0x%016" PRIxPTR "",
1792           CID(context), first, count, (uintptr_t)v);
1793 
1794     if (context)
1795     {
1796         SCOPED_SHARE_CONTEXT_LOCK(context);
1797         bool isCallValid =
1798             (context->skipValidation() ||
1799              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1800                                                 context->getMutableErrorSetForValidation(),
1801                                                 angle::EntryPoint::GLScissorArrayv) &&
1802               ValidateScissorArrayv(context, angle::EntryPoint::GLScissorArrayv, first, count, v)));
1803         if (isCallValid)
1804         {
1805             context->scissorArrayv(first, count, v);
1806         }
1807         ANGLE_CAPTURE_GL(ScissorArrayv, isCallValid, context, first, count, v);
1808     }
1809     else
1810     {
1811         GenerateContextLostErrorOnCurrentGlobalContext();
1812     }
1813     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1814 }
1815 
1816 void GL_APIENTRY
GL_ScissorIndexed(GLuint index,GLint left,GLint bottom,GLsizei width,GLsizei height)1817 GL_ScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height)
1818 {
1819     Context *context = GetValidGlobalContext();
1820     EVENT(context, GLScissorIndexed,
1821           "context = %d, index = %u, left = %d, bottom = %d, width = %d, height = %d", CID(context),
1822           index, left, bottom, width, height);
1823 
1824     if (context)
1825     {
1826         SCOPED_SHARE_CONTEXT_LOCK(context);
1827         bool isCallValid =
1828             (context->skipValidation() ||
1829              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1830                                                 context->getMutableErrorSetForValidation(),
1831                                                 angle::EntryPoint::GLScissorIndexed) &&
1832               ValidateScissorIndexed(context, angle::EntryPoint::GLScissorIndexed, index, left,
1833                                      bottom, width, height)));
1834         if (isCallValid)
1835         {
1836             context->scissorIndexed(index, left, bottom, width, height);
1837         }
1838         ANGLE_CAPTURE_GL(ScissorIndexed, isCallValid, context, index, left, bottom, width, height);
1839     }
1840     else
1841     {
1842         GenerateContextLostErrorOnCurrentGlobalContext();
1843     }
1844     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1845 }
1846 
GL_ScissorIndexedv(GLuint index,const GLint * v)1847 void GL_APIENTRY GL_ScissorIndexedv(GLuint index, const GLint *v)
1848 {
1849     Context *context = GetValidGlobalContext();
1850     EVENT(context, GLScissorIndexedv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1851           CID(context), index, (uintptr_t)v);
1852 
1853     if (context)
1854     {
1855         SCOPED_SHARE_CONTEXT_LOCK(context);
1856         bool isCallValid =
1857             (context->skipValidation() ||
1858              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1859                                                 context->getMutableErrorSetForValidation(),
1860                                                 angle::EntryPoint::GLScissorIndexedv) &&
1861               ValidateScissorIndexedv(context, angle::EntryPoint::GLScissorIndexedv, index, v)));
1862         if (isCallValid)
1863         {
1864             context->scissorIndexedv(index, v);
1865         }
1866         ANGLE_CAPTURE_GL(ScissorIndexedv, isCallValid, context, index, v);
1867     }
1868     else
1869     {
1870         GenerateContextLostErrorOnCurrentGlobalContext();
1871     }
1872     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1873 }
1874 
GL_VertexAttribL1d(GLuint index,GLdouble x)1875 void GL_APIENTRY GL_VertexAttribL1d(GLuint index, GLdouble x)
1876 {
1877     Context *context = GetValidGlobalContext();
1878     EVENT(context, GLVertexAttribL1d, "context = %d, index = %u, x = %f", CID(context), index, x);
1879 
1880     if (context)
1881     {
1882         bool isCallValid =
1883             (context->skipValidation() ||
1884              ValidateVertexAttribL1d(context->getPrivateState(),
1885                                      context->getMutableErrorSetForValidation(),
1886                                      angle::EntryPoint::GLVertexAttribL1d, index, x));
1887         if (isCallValid)
1888         {
1889             ContextPrivateVertexAttribL1d(context->getMutablePrivateState(),
1890                                           context->getMutablePrivateStateCache(), index, x);
1891         }
1892         ANGLE_CAPTURE_GL(VertexAttribL1d, isCallValid, context, index, x);
1893     }
1894     else
1895     {
1896         GenerateContextLostErrorOnCurrentGlobalContext();
1897     }
1898     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1899 }
1900 
GL_VertexAttribL1dv(GLuint index,const GLdouble * v)1901 void GL_APIENTRY GL_VertexAttribL1dv(GLuint index, const GLdouble *v)
1902 {
1903     Context *context = GetValidGlobalContext();
1904     EVENT(context, GLVertexAttribL1dv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1905           CID(context), index, (uintptr_t)v);
1906 
1907     if (context)
1908     {
1909         bool isCallValid =
1910             (context->skipValidation() ||
1911              ValidateVertexAttribL1dv(context->getPrivateState(),
1912                                       context->getMutableErrorSetForValidation(),
1913                                       angle::EntryPoint::GLVertexAttribL1dv, index, v));
1914         if (isCallValid)
1915         {
1916             ContextPrivateVertexAttribL1dv(context->getMutablePrivateState(),
1917                                            context->getMutablePrivateStateCache(), index, v);
1918         }
1919         ANGLE_CAPTURE_GL(VertexAttribL1dv, isCallValid, context, index, v);
1920     }
1921     else
1922     {
1923         GenerateContextLostErrorOnCurrentGlobalContext();
1924     }
1925     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1926 }
1927 
GL_VertexAttribL2d(GLuint index,GLdouble x,GLdouble y)1928 void GL_APIENTRY GL_VertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
1929 {
1930     Context *context = GetValidGlobalContext();
1931     EVENT(context, GLVertexAttribL2d, "context = %d, index = %u, x = %f, y = %f", CID(context),
1932           index, x, y);
1933 
1934     if (context)
1935     {
1936         bool isCallValid =
1937             (context->skipValidation() ||
1938              ValidateVertexAttribL2d(context->getPrivateState(),
1939                                      context->getMutableErrorSetForValidation(),
1940                                      angle::EntryPoint::GLVertexAttribL2d, index, x, y));
1941         if (isCallValid)
1942         {
1943             ContextPrivateVertexAttribL2d(context->getMutablePrivateState(),
1944                                           context->getMutablePrivateStateCache(), index, x, y);
1945         }
1946         ANGLE_CAPTURE_GL(VertexAttribL2d, isCallValid, context, index, x, y);
1947     }
1948     else
1949     {
1950         GenerateContextLostErrorOnCurrentGlobalContext();
1951     }
1952     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1953 }
1954 
GL_VertexAttribL2dv(GLuint index,const GLdouble * v)1955 void GL_APIENTRY GL_VertexAttribL2dv(GLuint index, const GLdouble *v)
1956 {
1957     Context *context = GetValidGlobalContext();
1958     EVENT(context, GLVertexAttribL2dv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1959           CID(context), index, (uintptr_t)v);
1960 
1961     if (context)
1962     {
1963         bool isCallValid =
1964             (context->skipValidation() ||
1965              ValidateVertexAttribL2dv(context->getPrivateState(),
1966                                       context->getMutableErrorSetForValidation(),
1967                                       angle::EntryPoint::GLVertexAttribL2dv, index, v));
1968         if (isCallValid)
1969         {
1970             ContextPrivateVertexAttribL2dv(context->getMutablePrivateState(),
1971                                            context->getMutablePrivateStateCache(), index, v);
1972         }
1973         ANGLE_CAPTURE_GL(VertexAttribL2dv, isCallValid, context, index, v);
1974     }
1975     else
1976     {
1977         GenerateContextLostErrorOnCurrentGlobalContext();
1978     }
1979     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1980 }
1981 
GL_VertexAttribL3d(GLuint index,GLdouble x,GLdouble y,GLdouble z)1982 void GL_APIENTRY GL_VertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
1983 {
1984     Context *context = GetValidGlobalContext();
1985     EVENT(context, GLVertexAttribL3d, "context = %d, index = %u, x = %f, y = %f, z = %f",
1986           CID(context), index, x, y, z);
1987 
1988     if (context)
1989     {
1990         bool isCallValid =
1991             (context->skipValidation() ||
1992              ValidateVertexAttribL3d(context->getPrivateState(),
1993                                      context->getMutableErrorSetForValidation(),
1994                                      angle::EntryPoint::GLVertexAttribL3d, index, x, y, z));
1995         if (isCallValid)
1996         {
1997             ContextPrivateVertexAttribL3d(context->getMutablePrivateState(),
1998                                           context->getMutablePrivateStateCache(), index, x, y, z);
1999         }
2000         ANGLE_CAPTURE_GL(VertexAttribL3d, isCallValid, context, index, x, y, z);
2001     }
2002     else
2003     {
2004         GenerateContextLostErrorOnCurrentGlobalContext();
2005     }
2006     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2007 }
2008 
GL_VertexAttribL3dv(GLuint index,const GLdouble * v)2009 void GL_APIENTRY GL_VertexAttribL3dv(GLuint index, const GLdouble *v)
2010 {
2011     Context *context = GetValidGlobalContext();
2012     EVENT(context, GLVertexAttribL3dv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
2013           CID(context), index, (uintptr_t)v);
2014 
2015     if (context)
2016     {
2017         bool isCallValid =
2018             (context->skipValidation() ||
2019              ValidateVertexAttribL3dv(context->getPrivateState(),
2020                                       context->getMutableErrorSetForValidation(),
2021                                       angle::EntryPoint::GLVertexAttribL3dv, index, v));
2022         if (isCallValid)
2023         {
2024             ContextPrivateVertexAttribL3dv(context->getMutablePrivateState(),
2025                                            context->getMutablePrivateStateCache(), index, v);
2026         }
2027         ANGLE_CAPTURE_GL(VertexAttribL3dv, isCallValid, context, index, v);
2028     }
2029     else
2030     {
2031         GenerateContextLostErrorOnCurrentGlobalContext();
2032     }
2033     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2034 }
2035 
GL_VertexAttribL4d(GLuint index,GLdouble x,GLdouble y,GLdouble z,GLdouble w)2036 void GL_APIENTRY GL_VertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
2037 {
2038     Context *context = GetValidGlobalContext();
2039     EVENT(context, GLVertexAttribL4d, "context = %d, index = %u, x = %f, y = %f, z = %f, w = %f",
2040           CID(context), index, x, y, z, w);
2041 
2042     if (context)
2043     {
2044         bool isCallValid =
2045             (context->skipValidation() ||
2046              ValidateVertexAttribL4d(context->getPrivateState(),
2047                                      context->getMutableErrorSetForValidation(),
2048                                      angle::EntryPoint::GLVertexAttribL4d, index, x, y, z, w));
2049         if (isCallValid)
2050         {
2051             ContextPrivateVertexAttribL4d(context->getMutablePrivateState(),
2052                                           context->getMutablePrivateStateCache(), index, x, y, z,
2053                                           w);
2054         }
2055         ANGLE_CAPTURE_GL(VertexAttribL4d, isCallValid, context, index, x, y, z, w);
2056     }
2057     else
2058     {
2059         GenerateContextLostErrorOnCurrentGlobalContext();
2060     }
2061     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2062 }
2063 
GL_VertexAttribL4dv(GLuint index,const GLdouble * v)2064 void GL_APIENTRY GL_VertexAttribL4dv(GLuint index, const GLdouble *v)
2065 {
2066     Context *context = GetValidGlobalContext();
2067     EVENT(context, GLVertexAttribL4dv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
2068           CID(context), index, (uintptr_t)v);
2069 
2070     if (context)
2071     {
2072         bool isCallValid =
2073             (context->skipValidation() ||
2074              ValidateVertexAttribL4dv(context->getPrivateState(),
2075                                       context->getMutableErrorSetForValidation(),
2076                                       angle::EntryPoint::GLVertexAttribL4dv, index, v));
2077         if (isCallValid)
2078         {
2079             ContextPrivateVertexAttribL4dv(context->getMutablePrivateState(),
2080                                            context->getMutablePrivateStateCache(), index, v);
2081         }
2082         ANGLE_CAPTURE_GL(VertexAttribL4dv, isCallValid, context, index, v);
2083     }
2084     else
2085     {
2086         GenerateContextLostErrorOnCurrentGlobalContext();
2087     }
2088     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2089 }
2090 
2091 void GL_APIENTRY
GL_VertexAttribLPointer(GLuint index,GLint size,GLenum type,GLsizei stride,const void * pointer)2092 GL_VertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer)
2093 {
2094     Context *context = GetValidGlobalContext();
2095     EVENT(context, GLVertexAttribLPointer,
2096           "context = %d, index = %u, size = %d, type = %s, stride = %d, pointer = 0x%016" PRIxPTR
2097           "",
2098           CID(context), index, size, GLenumToString(BigGLEnum::VertexAttribLType, type), stride,
2099           (uintptr_t)pointer);
2100 
2101     if (context)
2102     {
2103         SCOPED_SHARE_CONTEXT_LOCK(context);
2104         bool isCallValid =
2105             (context->skipValidation() ||
2106              ValidateVertexAttribLPointer(context, angle::EntryPoint::GLVertexAttribLPointer, index,
2107                                           size, type, stride, pointer));
2108         if (isCallValid)
2109         {
2110             context->vertexAttribLPointer(index, size, type, stride, pointer);
2111         }
2112         ANGLE_CAPTURE_GL(VertexAttribLPointer, isCallValid, context, index, size, type, stride,
2113                          pointer);
2114     }
2115     else
2116     {
2117         GenerateContextLostErrorOnCurrentGlobalContext();
2118     }
2119     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2120 }
2121 
GL_ViewportArrayv(GLuint first,GLsizei count,const GLfloat * v)2122 void GL_APIENTRY GL_ViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
2123 {
2124     Context *context = GetValidGlobalContext();
2125     EVENT(context, GLViewportArrayv, "context = %d, first = %u, count = %d, v = 0x%016" PRIxPTR "",
2126           CID(context), first, count, (uintptr_t)v);
2127 
2128     if (context)
2129     {
2130         SCOPED_SHARE_CONTEXT_LOCK(context);
2131         bool isCallValid =
2132             (context->skipValidation() ||
2133              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
2134                                                 context->getMutableErrorSetForValidation(),
2135                                                 angle::EntryPoint::GLViewportArrayv) &&
2136               ValidateViewportArrayv(context, angle::EntryPoint::GLViewportArrayv, first, count,
2137                                      v)));
2138         if (isCallValid)
2139         {
2140             context->viewportArrayv(first, count, v);
2141         }
2142         ANGLE_CAPTURE_GL(ViewportArrayv, isCallValid, context, first, count, v);
2143     }
2144     else
2145     {
2146         GenerateContextLostErrorOnCurrentGlobalContext();
2147     }
2148     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2149 }
2150 
GL_ViewportIndexedf(GLuint index,GLfloat x,GLfloat y,GLfloat w,GLfloat h)2151 void GL_APIENTRY GL_ViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h)
2152 {
2153     Context *context = GetValidGlobalContext();
2154     EVENT(context, GLViewportIndexedf, "context = %d, index = %u, x = %f, y = %f, w = %f, h = %f",
2155           CID(context), index, x, y, w, h);
2156 
2157     if (context)
2158     {
2159         SCOPED_SHARE_CONTEXT_LOCK(context);
2160         bool isCallValid =
2161             (context->skipValidation() ||
2162              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
2163                                                 context->getMutableErrorSetForValidation(),
2164                                                 angle::EntryPoint::GLViewportIndexedf) &&
2165               ValidateViewportIndexedf(context, angle::EntryPoint::GLViewportIndexedf, index, x, y,
2166                                        w, h)));
2167         if (isCallValid)
2168         {
2169             context->viewportIndexedf(index, x, y, w, h);
2170         }
2171         ANGLE_CAPTURE_GL(ViewportIndexedf, isCallValid, context, index, x, y, w, h);
2172     }
2173     else
2174     {
2175         GenerateContextLostErrorOnCurrentGlobalContext();
2176     }
2177     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2178 }
2179 
GL_ViewportIndexedfv(GLuint index,const GLfloat * v)2180 void GL_APIENTRY GL_ViewportIndexedfv(GLuint index, const GLfloat *v)
2181 {
2182     Context *context = GetValidGlobalContext();
2183     EVENT(context, GLViewportIndexedfv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
2184           CID(context), index, (uintptr_t)v);
2185 
2186     if (context)
2187     {
2188         SCOPED_SHARE_CONTEXT_LOCK(context);
2189         bool isCallValid =
2190             (context->skipValidation() ||
2191              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
2192                                                 context->getMutableErrorSetForValidation(),
2193                                                 angle::EntryPoint::GLViewportIndexedfv) &&
2194               ValidateViewportIndexedfv(context, angle::EntryPoint::GLViewportIndexedfv, index,
2195                                         v)));
2196         if (isCallValid)
2197         {
2198             context->viewportIndexedfv(index, v);
2199         }
2200         ANGLE_CAPTURE_GL(ViewportIndexedfv, isCallValid, context, index, v);
2201     }
2202     else
2203     {
2204         GenerateContextLostErrorOnCurrentGlobalContext();
2205     }
2206     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2207 }
2208 
2209 // GL 4.2
GL_DrawArraysInstancedBaseInstance(GLenum mode,GLint first,GLsizei count,GLsizei instancecount,GLuint baseinstance)2210 void GL_APIENTRY GL_DrawArraysInstancedBaseInstance(GLenum mode,
2211                                                     GLint first,
2212                                                     GLsizei count,
2213                                                     GLsizei instancecount,
2214                                                     GLuint baseinstance)
2215 {
2216     Context *context = GetValidGlobalContext();
2217     EVENT(context, GLDrawArraysInstancedBaseInstance,
2218           "context = %d, mode = %s, first = %d, count = %d, instancecount = %d, baseinstance = %u",
2219           CID(context), GLenumToString(BigGLEnum::PrimitiveType, mode), first, count, instancecount,
2220           baseinstance);
2221 
2222     if (context)
2223     {
2224         PrimitiveMode modePacked = PackParam<PrimitiveMode>(mode);
2225         SCOPED_SHARE_CONTEXT_LOCK(context);
2226         bool isCallValid = (context->skipValidation() ||
2227                             ValidateDrawArraysInstancedBaseInstance(
2228                                 context, angle::EntryPoint::GLDrawArraysInstancedBaseInstance,
2229                                 modePacked, first, count, instancecount, baseinstance));
2230         if (isCallValid)
2231         {
2232             context->drawArraysInstancedBaseInstance(modePacked, first, count, instancecount,
2233                                                      baseinstance);
2234         }
2235         ANGLE_CAPTURE_GL(DrawArraysInstancedBaseInstance, isCallValid, context, modePacked, first,
2236                          count, instancecount, baseinstance);
2237     }
2238     else
2239     {
2240         GenerateContextLostErrorOnCurrentGlobalContext();
2241     }
2242     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2243 }
2244 
GL_DrawElementsInstancedBaseInstance(GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei instancecount,GLuint baseinstance)2245 void GL_APIENTRY GL_DrawElementsInstancedBaseInstance(GLenum mode,
2246                                                       GLsizei count,
2247                                                       GLenum type,
2248                                                       const void *indices,
2249                                                       GLsizei instancecount,
2250                                                       GLuint baseinstance)
2251 {
2252     Context *context = GetValidGlobalContext();
2253     EVENT(context, GLDrawElementsInstancedBaseInstance,
2254           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
2255           ", instancecount = %d, baseinstance = %u",
2256           CID(context), GLenumToString(BigGLEnum::PrimitiveType, mode), count,
2257           GLenumToString(BigGLEnum::PrimitiveType, type), (uintptr_t)indices, instancecount,
2258           baseinstance);
2259 
2260     if (context)
2261     {
2262         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
2263         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
2264         SCOPED_SHARE_CONTEXT_LOCK(context);
2265         bool isCallValid =
2266             (context->skipValidation() ||
2267              ValidateDrawElementsInstancedBaseInstance(
2268                  context, angle::EntryPoint::GLDrawElementsInstancedBaseInstance, modePacked, count,
2269                  typePacked, indices, instancecount, baseinstance));
2270         if (isCallValid)
2271         {
2272             context->drawElementsInstancedBaseInstance(modePacked, count, typePacked, indices,
2273                                                        instancecount, baseinstance);
2274         }
2275         ANGLE_CAPTURE_GL(DrawElementsInstancedBaseInstance, isCallValid, context, modePacked, count,
2276                          typePacked, indices, instancecount, baseinstance);
2277     }
2278     else
2279     {
2280         GenerateContextLostErrorOnCurrentGlobalContext();
2281     }
2282     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2283 }
2284 
GL_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei instancecount,GLint basevertex,GLuint baseinstance)2285 void GL_APIENTRY GL_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode,
2286                                                                 GLsizei count,
2287                                                                 GLenum type,
2288                                                                 const void *indices,
2289                                                                 GLsizei instancecount,
2290                                                                 GLint basevertex,
2291                                                                 GLuint baseinstance)
2292 {
2293     Context *context = GetValidGlobalContext();
2294     EVENT(context, GLDrawElementsInstancedBaseVertexBaseInstance,
2295           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
2296           ", instancecount = %d, basevertex = %d, baseinstance = %u",
2297           CID(context), GLenumToString(BigGLEnum::PrimitiveType, mode), count,
2298           GLenumToString(BigGLEnum::DrawElementsType, type), (uintptr_t)indices, instancecount,
2299           basevertex, baseinstance);
2300 
2301     if (context)
2302     {
2303         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
2304         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
2305         SCOPED_SHARE_CONTEXT_LOCK(context);
2306         bool isCallValid =
2307             (context->skipValidation() ||
2308              ValidateDrawElementsInstancedBaseVertexBaseInstance(
2309                  context, angle::EntryPoint::GLDrawElementsInstancedBaseVertexBaseInstance,
2310                  modePacked, count, typePacked, indices, instancecount, basevertex, baseinstance));
2311         if (isCallValid)
2312         {
2313             context->drawElementsInstancedBaseVertexBaseInstance(
2314                 modePacked, count, typePacked, indices, instancecount, basevertex, baseinstance);
2315         }
2316         ANGLE_CAPTURE_GL(DrawElementsInstancedBaseVertexBaseInstance, isCallValid, context,
2317                          modePacked, count, typePacked, indices, instancecount, basevertex,
2318                          baseinstance);
2319     }
2320     else
2321     {
2322         GenerateContextLostErrorOnCurrentGlobalContext();
2323     }
2324     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2325 }
2326 
GL_DrawTransformFeedbackInstanced(GLenum mode,GLuint id,GLsizei instancecount)2327 void GL_APIENTRY GL_DrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount)
2328 {
2329     Context *context = GetValidGlobalContext();
2330     EVENT(context, GLDrawTransformFeedbackInstanced,
2331           "context = %d, mode = %s, id = %u, instancecount = %d", CID(context),
2332           GLenumToString(BigGLEnum::PrimitiveType, mode), id, instancecount);
2333 
2334     if (context)
2335     {
2336         TransformFeedbackID idPacked = PackParam<TransformFeedbackID>(id);
2337         SCOPED_SHARE_CONTEXT_LOCK(context);
2338         bool isCallValid =
2339             (context->skipValidation() ||
2340              (ValidatePixelLocalStorageInactive(
2341                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
2342                   angle::EntryPoint::GLDrawTransformFeedbackInstanced) &&
2343               ValidateDrawTransformFeedbackInstanced(
2344                   context, angle::EntryPoint::GLDrawTransformFeedbackInstanced, mode, idPacked,
2345                   instancecount)));
2346         if (isCallValid)
2347         {
2348             context->drawTransformFeedbackInstanced(mode, idPacked, instancecount);
2349         }
2350         ANGLE_CAPTURE_GL(DrawTransformFeedbackInstanced, isCallValid, context, mode, idPacked,
2351                          instancecount);
2352     }
2353     else
2354     {
2355         GenerateContextLostErrorOnCurrentGlobalContext();
2356     }
2357     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2358 }
2359 
GL_DrawTransformFeedbackStreamInstanced(GLenum mode,GLuint id,GLuint stream,GLsizei instancecount)2360 void GL_APIENTRY GL_DrawTransformFeedbackStreamInstanced(GLenum mode,
2361                                                          GLuint id,
2362                                                          GLuint stream,
2363                                                          GLsizei instancecount)
2364 {
2365     Context *context = GetValidGlobalContext();
2366     EVENT(context, GLDrawTransformFeedbackStreamInstanced,
2367           "context = %d, mode = %s, id = %u, stream = %u, instancecount = %d", CID(context),
2368           GLenumToString(BigGLEnum::PrimitiveType, mode), id, stream, instancecount);
2369 
2370     if (context)
2371     {
2372         TransformFeedbackID idPacked = PackParam<TransformFeedbackID>(id);
2373         SCOPED_SHARE_CONTEXT_LOCK(context);
2374         bool isCallValid =
2375             (context->skipValidation() ||
2376              (ValidatePixelLocalStorageInactive(
2377                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
2378                   angle::EntryPoint::GLDrawTransformFeedbackStreamInstanced) &&
2379               ValidateDrawTransformFeedbackStreamInstanced(
2380                   context, angle::EntryPoint::GLDrawTransformFeedbackStreamInstanced, mode,
2381                   idPacked, stream, instancecount)));
2382         if (isCallValid)
2383         {
2384             context->drawTransformFeedbackStreamInstanced(mode, idPacked, stream, instancecount);
2385         }
2386         ANGLE_CAPTURE_GL(DrawTransformFeedbackStreamInstanced, isCallValid, context, mode, idPacked,
2387                          stream, instancecount);
2388     }
2389     else
2390     {
2391         GenerateContextLostErrorOnCurrentGlobalContext();
2392     }
2393     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2394 }
2395 
GL_GetActiveAtomicCounterBufferiv(GLuint program,GLuint bufferIndex,GLenum pname,GLint * params)2396 void GL_APIENTRY GL_GetActiveAtomicCounterBufferiv(GLuint program,
2397                                                    GLuint bufferIndex,
2398                                                    GLenum pname,
2399                                                    GLint *params)
2400 {
2401     Context *context = GetValidGlobalContext();
2402     EVENT(context, GLGetActiveAtomicCounterBufferiv,
2403           "context = %d, program = %u, bufferIndex = %u, pname = %s, params = 0x%016" PRIxPTR "",
2404           CID(context), program, bufferIndex,
2405           GLenumToString(BigGLEnum::AtomicCounterBufferPName, pname), (uintptr_t)params);
2406 
2407     if (context)
2408     {
2409         ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
2410         SCOPED_SHARE_CONTEXT_LOCK(context);
2411         bool isCallValid = (context->skipValidation() ||
2412                             ValidateGetActiveAtomicCounterBufferiv(
2413                                 context, angle::EntryPoint::GLGetActiveAtomicCounterBufferiv,
2414                                 programPacked, bufferIndex, pname, params));
2415         if (isCallValid)
2416         {
2417             context->getActiveAtomicCounterBufferiv(programPacked, bufferIndex, pname, params);
2418         }
2419         ANGLE_CAPTURE_GL(GetActiveAtomicCounterBufferiv, isCallValid, context, programPacked,
2420                          bufferIndex, pname, params);
2421     }
2422     else
2423     {
2424         GenerateContextLostErrorOnCurrentGlobalContext();
2425     }
2426     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2427 }
2428 
GL_TexStorage1D(GLenum target,GLsizei levels,GLenum internalformat,GLsizei width)2429 void GL_APIENTRY GL_TexStorage1D(GLenum target,
2430                                  GLsizei levels,
2431                                  GLenum internalformat,
2432                                  GLsizei width)
2433 {
2434     Context *context = GetValidGlobalContext();
2435     EVENT(context, GLTexStorage1D,
2436           "context = %d, target = %s, levels = %d, internalformat = %s, width = %d", CID(context),
2437           GLenumToString(BigGLEnum::TextureTarget, target), levels,
2438           GLenumToString(BigGLEnum::SizedInternalFormat, internalformat), width);
2439 
2440     if (context)
2441     {
2442         SCOPED_SHARE_CONTEXT_LOCK(context);
2443         bool isCallValid =
2444             (context->skipValidation() ||
2445              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
2446                                                 context->getMutableErrorSetForValidation(),
2447                                                 angle::EntryPoint::GLTexStorage1D) &&
2448               ValidateTexStorage1D(context, angle::EntryPoint::GLTexStorage1D, target, levels,
2449                                    internalformat, width)));
2450         if (isCallValid)
2451         {
2452             context->texStorage1D(target, levels, internalformat, width);
2453         }
2454         ANGLE_CAPTURE_GL(TexStorage1D, isCallValid, context, target, levels, internalformat, width);
2455     }
2456     else
2457     {
2458         GenerateContextLostErrorOnCurrentGlobalContext();
2459     }
2460     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2461 }
2462 
2463 // GL 4.3
GL_ClearBufferData(GLenum target,GLenum internalformat,GLenum format,GLenum type,const void * data)2464 void GL_APIENTRY GL_ClearBufferData(GLenum target,
2465                                     GLenum internalformat,
2466                                     GLenum format,
2467                                     GLenum type,
2468                                     const void *data)
2469 {
2470     Context *context = GetValidGlobalContext();
2471     EVENT(context, GLClearBufferData,
2472           "context = %d, target = %s, internalformat = %s, format = %s, type = %s, data = "
2473           "0x%016" PRIxPTR "",
2474           CID(context), GLenumToString(BigGLEnum::BufferStorageTarget, target),
2475           GLenumToString(BigGLEnum::SizedInternalFormat, internalformat),
2476           GLenumToString(BigGLEnum::PixelFormat, format),
2477           GLenumToString(BigGLEnum::PixelType, type), (uintptr_t)data);
2478 
2479     if (context)
2480     {
2481         SCOPED_SHARE_CONTEXT_LOCK(context);
2482         bool isCallValid = (context->skipValidation() ||
2483                             ValidateClearBufferData(context, angle::EntryPoint::GLClearBufferData,
2484                                                     target, internalformat, format, type, data));
2485         if (isCallValid)
2486         {
2487             context->clearBufferData(target, internalformat, format, type, data);
2488         }
2489         ANGLE_CAPTURE_GL(ClearBufferData, isCallValid, context, target, internalformat, format,
2490                          type, data);
2491     }
2492     else
2493     {
2494         GenerateContextLostErrorOnCurrentGlobalContext();
2495     }
2496     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2497 }
2498 
GL_ClearBufferSubData(GLenum target,GLenum internalformat,GLintptr offset,GLsizeiptr size,GLenum format,GLenum type,const void * data)2499 void GL_APIENTRY GL_ClearBufferSubData(GLenum target,
2500                                        GLenum internalformat,
2501                                        GLintptr offset,
2502                                        GLsizeiptr size,
2503                                        GLenum format,
2504                                        GLenum type,
2505                                        const void *data)
2506 {
2507     Context *context = GetValidGlobalContext();
2508     EVENT(context, GLClearBufferSubData,
2509           "context = %d, target = %s, internalformat = %s, offset = %llu, size = %llu, format = "
2510           "%s, type = %s, data = 0x%016" PRIxPTR "",
2511           CID(context), GLenumToString(BigGLEnum::BufferTargetARB, target),
2512           GLenumToString(BigGLEnum::SizedInternalFormat, internalformat),
2513           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size),
2514           GLenumToString(BigGLEnum::PixelFormat, format),
2515           GLenumToString(BigGLEnum::PixelType, type), (uintptr_t)data);
2516 
2517     if (context)
2518     {
2519         SCOPED_SHARE_CONTEXT_LOCK(context);
2520         bool isCallValid =
2521             (context->skipValidation() ||
2522              ValidateClearBufferSubData(context, angle::EntryPoint::GLClearBufferSubData, target,
2523                                         internalformat, offset, size, format, type, data));
2524         if (isCallValid)
2525         {
2526             context->clearBufferSubData(target, internalformat, offset, size, format, type, data);
2527         }
2528         ANGLE_CAPTURE_GL(ClearBufferSubData, isCallValid, context, target, internalformat, offset,
2529                          size, format, type, data);
2530     }
2531     else
2532     {
2533         GenerateContextLostErrorOnCurrentGlobalContext();
2534     }
2535     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2536 }
2537 
GL_GetInternalformati64v(GLenum target,GLenum internalformat,GLenum pname,GLsizei count,GLint64 * params)2538 void GL_APIENTRY GL_GetInternalformati64v(GLenum target,
2539                                           GLenum internalformat,
2540                                           GLenum pname,
2541                                           GLsizei count,
2542                                           GLint64 *params)
2543 {
2544     Context *context = GetValidGlobalContext();
2545     EVENT(context, GLGetInternalformati64v,
2546           "context = %d, target = %s, internalformat = %s, pname = %s, count = %d, params = "
2547           "0x%016" PRIxPTR "",
2548           CID(context), GLenumToString(BigGLEnum::TextureTarget, target),
2549           GLenumToString(BigGLEnum::InternalFormat, internalformat),
2550           GLenumToString(BigGLEnum::InternalFormatPName, pname), count, (uintptr_t)params);
2551 
2552     if (context)
2553     {
2554         SCOPED_SHARE_CONTEXT_LOCK(context);
2555         bool isCallValid =
2556             (context->skipValidation() ||
2557              ValidateGetInternalformati64v(context, angle::EntryPoint::GLGetInternalformati64v,
2558                                            target, internalformat, pname, count, params));
2559         if (isCallValid)
2560         {
2561             context->getInternalformati64v(target, internalformat, pname, count, params);
2562         }
2563         ANGLE_CAPTURE_GL(GetInternalformati64v, isCallValid, context, target, internalformat, pname,
2564                          count, params);
2565     }
2566     else
2567     {
2568         GenerateContextLostErrorOnCurrentGlobalContext();
2569     }
2570     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2571 }
2572 
GL_GetProgramResourceLocationIndex(GLuint program,GLenum programInterface,const GLchar * name)2573 GLint GL_APIENTRY GL_GetProgramResourceLocationIndex(GLuint program,
2574                                                      GLenum programInterface,
2575                                                      const GLchar *name)
2576 {
2577     Context *context = GetValidGlobalContext();
2578     EVENT(context, GLGetProgramResourceLocationIndex,
2579           "context = %d, program = %u, programInterface = %s, name = 0x%016" PRIxPTR "",
2580           CID(context), program, GLenumToString(BigGLEnum::ProgramInterface, programInterface),
2581           (uintptr_t)name);
2582 
2583     GLint returnValue;
2584     if (context)
2585     {
2586         ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
2587         SCOPED_SHARE_CONTEXT_LOCK(context);
2588         bool isCallValid = (context->skipValidation() ||
2589                             ValidateGetProgramResourceLocationIndex(
2590                                 context, angle::EntryPoint::GLGetProgramResourceLocationIndex,
2591                                 programPacked, programInterface, name));
2592         if (isCallValid)
2593         {
2594             returnValue =
2595                 context->getProgramResourceLocationIndex(programPacked, programInterface, name);
2596         }
2597         else
2598         {
2599             returnValue =
2600                 GetDefaultReturnValue<angle::EntryPoint::GLGetProgramResourceLocationIndex,
2601                                       GLint>();
2602         }
2603         ANGLE_CAPTURE_GL(GetProgramResourceLocationIndex, isCallValid, context, programPacked,
2604                          programInterface, name, returnValue);
2605     }
2606     else
2607     {
2608         GenerateContextLostErrorOnCurrentGlobalContext();
2609         returnValue =
2610             GetDefaultReturnValue<angle::EntryPoint::GLGetProgramResourceLocationIndex, GLint>();
2611     }
2612     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2613     return returnValue;
2614 }
2615 
GL_InvalidateBufferData(GLuint buffer)2616 void GL_APIENTRY GL_InvalidateBufferData(GLuint buffer)
2617 {
2618     Context *context = GetValidGlobalContext();
2619     EVENT(context, GLInvalidateBufferData, "context = %d, buffer = %u", CID(context), buffer);
2620 
2621     if (context)
2622     {
2623         BufferID bufferPacked = PackParam<BufferID>(buffer);
2624         SCOPED_SHARE_CONTEXT_LOCK(context);
2625         bool isCallValid =
2626             (context->skipValidation() ||
2627              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
2628                                                 context->getMutableErrorSetForValidation(),
2629                                                 angle::EntryPoint::GLInvalidateBufferData) &&
2630               ValidateInvalidateBufferData(context, angle::EntryPoint::GLInvalidateBufferData,
2631                                            bufferPacked)));
2632         if (isCallValid)
2633         {
2634             context->invalidateBufferData(bufferPacked);
2635         }
2636         ANGLE_CAPTURE_GL(InvalidateBufferData, isCallValid, context, bufferPacked);
2637     }
2638     else
2639     {
2640         GenerateContextLostErrorOnCurrentGlobalContext();
2641     }
2642     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2643 }
2644 
GL_InvalidateBufferSubData(GLuint buffer,GLintptr offset,GLsizeiptr length)2645 void GL_APIENTRY GL_InvalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length)
2646 {
2647     Context *context = GetValidGlobalContext();
2648     EVENT(context, GLInvalidateBufferSubData,
2649           "context = %d, buffer = %u, offset = %llu, length = %llu", CID(context), buffer,
2650           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length));
2651 
2652     if (context)
2653     {
2654         BufferID bufferPacked = PackParam<BufferID>(buffer);
2655         SCOPED_SHARE_CONTEXT_LOCK(context);
2656         bool isCallValid =
2657             (context->skipValidation() ||
2658              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
2659                                                 context->getMutableErrorSetForValidation(),
2660                                                 angle::EntryPoint::GLInvalidateBufferSubData) &&
2661               ValidateInvalidateBufferSubData(context, angle::EntryPoint::GLInvalidateBufferSubData,
2662                                               bufferPacked, offset, length)));
2663         if (isCallValid)
2664         {
2665             context->invalidateBufferSubData(bufferPacked, offset, length);
2666         }
2667         ANGLE_CAPTURE_GL(InvalidateBufferSubData, isCallValid, context, bufferPacked, offset,
2668                          length);
2669     }
2670     else
2671     {
2672         GenerateContextLostErrorOnCurrentGlobalContext();
2673     }
2674     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2675 }
2676 
GL_InvalidateTexImage(GLuint texture,GLint level)2677 void GL_APIENTRY GL_InvalidateTexImage(GLuint texture, GLint level)
2678 {
2679     Context *context = GetValidGlobalContext();
2680     EVENT(context, GLInvalidateTexImage, "context = %d, texture = %u, level = %d", CID(context),
2681           texture, level);
2682 
2683     if (context)
2684     {
2685         TextureID texturePacked = PackParam<TextureID>(texture);
2686         SCOPED_SHARE_CONTEXT_LOCK(context);
2687         bool isCallValid =
2688             (context->skipValidation() ||
2689              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
2690                                                 context->getMutableErrorSetForValidation(),
2691                                                 angle::EntryPoint::GLInvalidateTexImage) &&
2692               ValidateInvalidateTexImage(context, angle::EntryPoint::GLInvalidateTexImage,
2693                                          texturePacked, level)));
2694         if (isCallValid)
2695         {
2696             context->invalidateTexImage(texturePacked, level);
2697         }
2698         ANGLE_CAPTURE_GL(InvalidateTexImage, isCallValid, context, texturePacked, level);
2699     }
2700     else
2701     {
2702         GenerateContextLostErrorOnCurrentGlobalContext();
2703     }
2704     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2705 }
2706 
GL_InvalidateTexSubImage(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth)2707 void GL_APIENTRY GL_InvalidateTexSubImage(GLuint texture,
2708                                           GLint level,
2709                                           GLint xoffset,
2710                                           GLint yoffset,
2711                                           GLint zoffset,
2712                                           GLsizei width,
2713                                           GLsizei height,
2714                                           GLsizei depth)
2715 {
2716     Context *context = GetValidGlobalContext();
2717     EVENT(context, GLInvalidateTexSubImage,
2718           "context = %d, texture = %u, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width "
2719           "= %d, height = %d, depth = %d",
2720           CID(context), texture, level, xoffset, yoffset, zoffset, width, height, depth);
2721 
2722     if (context)
2723     {
2724         TextureID texturePacked = PackParam<TextureID>(texture);
2725         SCOPED_SHARE_CONTEXT_LOCK(context);
2726         bool isCallValid =
2727             (context->skipValidation() ||
2728              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
2729                                                 context->getMutableErrorSetForValidation(),
2730                                                 angle::EntryPoint::GLInvalidateTexSubImage) &&
2731               ValidateInvalidateTexSubImage(context, angle::EntryPoint::GLInvalidateTexSubImage,
2732                                             texturePacked, level, xoffset, yoffset, zoffset, width,
2733                                             height, depth)));
2734         if (isCallValid)
2735         {
2736             context->invalidateTexSubImage(texturePacked, level, xoffset, yoffset, zoffset, width,
2737                                            height, depth);
2738         }
2739         ANGLE_CAPTURE_GL(InvalidateTexSubImage, isCallValid, context, texturePacked, level, xoffset,
2740                          yoffset, zoffset, width, height, depth);
2741     }
2742     else
2743     {
2744         GenerateContextLostErrorOnCurrentGlobalContext();
2745     }
2746     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2747 }
2748 
GL_MultiDrawArraysIndirect(GLenum mode,const void * indirect,GLsizei drawcount,GLsizei stride)2749 void GL_APIENTRY GL_MultiDrawArraysIndirect(GLenum mode,
2750                                             const void *indirect,
2751                                             GLsizei drawcount,
2752                                             GLsizei stride)
2753 {
2754     Context *context = GetValidGlobalContext();
2755     EVENT(context, GLMultiDrawArraysIndirect,
2756           "context = %d, mode = %s, indirect = 0x%016" PRIxPTR ", drawcount = %d, stride = %d",
2757           CID(context), GLenumToString(BigGLEnum::PrimitiveType, mode), (uintptr_t)indirect,
2758           drawcount, stride);
2759 
2760     if (context)
2761     {
2762         PrimitiveMode modePacked = PackParam<PrimitiveMode>(mode);
2763         SCOPED_SHARE_CONTEXT_LOCK(context);
2764         bool isCallValid =
2765             (context->skipValidation() ||
2766              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
2767                                                 context->getMutableErrorSetForValidation(),
2768                                                 angle::EntryPoint::GLMultiDrawArraysIndirect) &&
2769               ValidateMultiDrawArraysIndirect(context, angle::EntryPoint::GLMultiDrawArraysIndirect,
2770                                               modePacked, indirect, drawcount, stride)));
2771         if (isCallValid)
2772         {
2773             context->multiDrawArraysIndirect(modePacked, indirect, drawcount, stride);
2774         }
2775         ANGLE_CAPTURE_GL(MultiDrawArraysIndirect, isCallValid, context, modePacked, indirect,
2776                          drawcount, stride);
2777     }
2778     else
2779     {
2780         GenerateContextLostErrorOnCurrentGlobalContext();
2781     }
2782     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2783 }
2784 
GL_MultiDrawElementsIndirect(GLenum mode,GLenum type,const void * indirect,GLsizei drawcount,GLsizei stride)2785 void GL_APIENTRY GL_MultiDrawElementsIndirect(GLenum mode,
2786                                               GLenum type,
2787                                               const void *indirect,
2788                                               GLsizei drawcount,
2789                                               GLsizei stride)
2790 {
2791     Context *context = GetValidGlobalContext();
2792     EVENT(context, GLMultiDrawElementsIndirect,
2793           "context = %d, mode = %s, type = %s, indirect = 0x%016" PRIxPTR
2794           ", drawcount = %d, stride = %d",
2795           CID(context), GLenumToString(BigGLEnum::PrimitiveType, mode),
2796           GLenumToString(BigGLEnum::DrawElementsType, type), (uintptr_t)indirect, drawcount,
2797           stride);
2798 
2799     if (context)
2800     {
2801         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
2802         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
2803         SCOPED_SHARE_CONTEXT_LOCK(context);
2804         bool isCallValid =
2805             (context->skipValidation() ||
2806              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
2807                                                 context->getMutableErrorSetForValidation(),
2808                                                 angle::EntryPoint::GLMultiDrawElementsIndirect) &&
2809               ValidateMultiDrawElementsIndirect(
2810                   context, angle::EntryPoint::GLMultiDrawElementsIndirect, modePacked, typePacked,
2811                   indirect, drawcount, stride)));
2812         if (isCallValid)
2813         {
2814             context->multiDrawElementsIndirect(modePacked, typePacked, indirect, drawcount, stride);
2815         }
2816         ANGLE_CAPTURE_GL(MultiDrawElementsIndirect, isCallValid, context, modePacked, typePacked,
2817                          indirect, drawcount, stride);
2818     }
2819     else
2820     {
2821         GenerateContextLostErrorOnCurrentGlobalContext();
2822     }
2823     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2824 }
2825 
GL_ShaderStorageBlockBinding(GLuint program,GLuint storageBlockIndex,GLuint storageBlockBinding)2826 void GL_APIENTRY GL_ShaderStorageBlockBinding(GLuint program,
2827                                               GLuint storageBlockIndex,
2828                                               GLuint storageBlockBinding)
2829 {
2830     Context *context = GetValidGlobalContext();
2831     EVENT(context, GLShaderStorageBlockBinding,
2832           "context = %d, program = %u, storageBlockIndex = %u, storageBlockBinding = %u",
2833           CID(context), program, storageBlockIndex, storageBlockBinding);
2834 
2835     if (context)
2836     {
2837         ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
2838         SCOPED_SHARE_CONTEXT_LOCK(context);
2839         bool isCallValid =
2840             (context->skipValidation() ||
2841              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
2842                                                 context->getMutableErrorSetForValidation(),
2843                                                 angle::EntryPoint::GLShaderStorageBlockBinding) &&
2844               ValidateShaderStorageBlockBinding(
2845                   context, angle::EntryPoint::GLShaderStorageBlockBinding, programPacked,
2846                   storageBlockIndex, storageBlockBinding)));
2847         if (isCallValid)
2848         {
2849             context->shaderStorageBlockBinding(programPacked, storageBlockIndex,
2850                                                storageBlockBinding);
2851         }
2852         ANGLE_CAPTURE_GL(ShaderStorageBlockBinding, isCallValid, context, programPacked,
2853                          storageBlockIndex, storageBlockBinding);
2854     }
2855     else
2856     {
2857         GenerateContextLostErrorOnCurrentGlobalContext();
2858     }
2859     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2860 }
2861 
GL_TextureView(GLuint texture,GLenum target,GLuint origtexture,GLenum internalformat,GLuint minlevel,GLuint numlevels,GLuint minlayer,GLuint numlayers)2862 void GL_APIENTRY GL_TextureView(GLuint texture,
2863                                 GLenum target,
2864                                 GLuint origtexture,
2865                                 GLenum internalformat,
2866                                 GLuint minlevel,
2867                                 GLuint numlevels,
2868                                 GLuint minlayer,
2869                                 GLuint numlayers)
2870 {
2871     Context *context = GetValidGlobalContext();
2872     EVENT(context, GLTextureView,
2873           "context = %d, texture = %u, target = %s, origtexture = %u, internalformat = %s, "
2874           "minlevel = %u, numlevels = %u, minlayer = %u, numlayers = %u",
2875           CID(context), texture, GLenumToString(BigGLEnum::TextureTarget, target), origtexture,
2876           GLenumToString(BigGLEnum::SizedInternalFormat, internalformat), minlevel, numlevels,
2877           minlayer, numlayers);
2878 
2879     if (context)
2880     {
2881         TextureID texturePacked = PackParam<TextureID>(texture);
2882         SCOPED_SHARE_CONTEXT_LOCK(context);
2883         bool isCallValid =
2884             (context->skipValidation() ||
2885              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
2886                                                 context->getMutableErrorSetForValidation(),
2887                                                 angle::EntryPoint::GLTextureView) &&
2888               ValidateTextureView(context, angle::EntryPoint::GLTextureView, texturePacked, target,
2889                                   origtexture, internalformat, minlevel, numlevels, minlayer,
2890                                   numlayers)));
2891         if (isCallValid)
2892         {
2893             context->textureView(texturePacked, target, origtexture, internalformat, minlevel,
2894                                  numlevels, minlayer, numlayers);
2895         }
2896         ANGLE_CAPTURE_GL(TextureView, isCallValid, context, texturePacked, target, origtexture,
2897                          internalformat, minlevel, numlevels, minlayer, numlayers);
2898     }
2899     else
2900     {
2901         GenerateContextLostErrorOnCurrentGlobalContext();
2902     }
2903     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2904 }
2905 
GL_VertexAttribLFormat(GLuint attribindex,GLint size,GLenum type,GLuint relativeoffset)2906 void GL_APIENTRY GL_VertexAttribLFormat(GLuint attribindex,
2907                                         GLint size,
2908                                         GLenum type,
2909                                         GLuint relativeoffset)
2910 {
2911     Context *context = GetValidGlobalContext();
2912     EVENT(context, GLVertexAttribLFormat,
2913           "context = %d, attribindex = %u, size = %d, type = %s, relativeoffset = %u", CID(context),
2914           attribindex, size, GLenumToString(BigGLEnum::VertexAttribLType, type), relativeoffset);
2915 
2916     if (context)
2917     {
2918         SCOPED_SHARE_CONTEXT_LOCK(context);
2919         bool isCallValid =
2920             (context->skipValidation() ||
2921              ValidateVertexAttribLFormat(context, angle::EntryPoint::GLVertexAttribLFormat,
2922                                          attribindex, size, type, relativeoffset));
2923         if (isCallValid)
2924         {
2925             context->vertexAttribLFormat(attribindex, size, type, relativeoffset);
2926         }
2927         ANGLE_CAPTURE_GL(VertexAttribLFormat, isCallValid, context, attribindex, size, type,
2928                          relativeoffset);
2929     }
2930     else
2931     {
2932         GenerateContextLostErrorOnCurrentGlobalContext();
2933     }
2934     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2935 }
2936 
2937 // GL 4.4
GL_BindBuffersBase(GLenum target,GLuint first,GLsizei count,const GLuint * buffers)2938 void GL_APIENTRY GL_BindBuffersBase(GLenum target,
2939                                     GLuint first,
2940                                     GLsizei count,
2941                                     const GLuint *buffers)
2942 {
2943     Context *context = GetValidGlobalContext();
2944     EVENT(context, GLBindBuffersBase,
2945           "context = %d, target = %s, first = %u, count = %d, buffers = 0x%016" PRIxPTR "",
2946           CID(context), GLenumToString(BigGLEnum::BufferTargetARB, target), first, count,
2947           (uintptr_t)buffers);
2948 
2949     if (context)
2950     {
2951         const BufferID *buffersPacked = PackParam<const BufferID *>(buffers);
2952         SCOPED_SHARE_CONTEXT_LOCK(context);
2953         bool isCallValid =
2954             (context->skipValidation() ||
2955              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
2956                                                 context->getMutableErrorSetForValidation(),
2957                                                 angle::EntryPoint::GLBindBuffersBase) &&
2958               ValidateBindBuffersBase(context, angle::EntryPoint::GLBindBuffersBase, target, first,
2959                                       count, buffersPacked)));
2960         if (isCallValid)
2961         {
2962             context->bindBuffersBase(target, first, count, buffersPacked);
2963         }
2964         ANGLE_CAPTURE_GL(BindBuffersBase, isCallValid, context, target, first, count,
2965                          buffersPacked);
2966     }
2967     else
2968     {
2969         GenerateContextLostErrorOnCurrentGlobalContext();
2970     }
2971     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2972 }
2973 
GL_BindBuffersRange(GLenum target,GLuint first,GLsizei count,const GLuint * buffers,const GLintptr * offsets,const GLsizeiptr * sizes)2974 void GL_APIENTRY GL_BindBuffersRange(GLenum target,
2975                                      GLuint first,
2976                                      GLsizei count,
2977                                      const GLuint *buffers,
2978                                      const GLintptr *offsets,
2979                                      const GLsizeiptr *sizes)
2980 {
2981     Context *context = GetValidGlobalContext();
2982     EVENT(context, GLBindBuffersRange,
2983           "context = %d, target = %s, first = %u, count = %d, buffers = 0x%016" PRIxPTR
2984           ", offsets = 0x%016" PRIxPTR ", sizes = 0x%016" PRIxPTR "",
2985           CID(context), GLenumToString(BigGLEnum::BufferTargetARB, target), first, count,
2986           (uintptr_t)buffers, (uintptr_t)offsets, (uintptr_t)sizes);
2987 
2988     if (context)
2989     {
2990         const BufferID *buffersPacked = PackParam<const BufferID *>(buffers);
2991         SCOPED_SHARE_CONTEXT_LOCK(context);
2992         bool isCallValid =
2993             (context->skipValidation() ||
2994              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
2995                                                 context->getMutableErrorSetForValidation(),
2996                                                 angle::EntryPoint::GLBindBuffersRange) &&
2997               ValidateBindBuffersRange(context, angle::EntryPoint::GLBindBuffersRange, target,
2998                                        first, count, buffersPacked, offsets, sizes)));
2999         if (isCallValid)
3000         {
3001             context->bindBuffersRange(target, first, count, buffersPacked, offsets, sizes);
3002         }
3003         ANGLE_CAPTURE_GL(BindBuffersRange, isCallValid, context, target, first, count,
3004                          buffersPacked, offsets, sizes);
3005     }
3006     else
3007     {
3008         GenerateContextLostErrorOnCurrentGlobalContext();
3009     }
3010     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3011 }
3012 
GL_BindImageTextures(GLuint first,GLsizei count,const GLuint * textures)3013 void GL_APIENTRY GL_BindImageTextures(GLuint first, GLsizei count, const GLuint *textures)
3014 {
3015     Context *context = GetValidGlobalContext();
3016     EVENT(context, GLBindImageTextures,
3017           "context = %d, first = %u, count = %d, textures = 0x%016" PRIxPTR "", CID(context), first,
3018           count, (uintptr_t)textures);
3019 
3020     if (context)
3021     {
3022         SCOPED_SHARE_CONTEXT_LOCK(context);
3023         bool isCallValid =
3024             (context->skipValidation() ||
3025              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3026                                                 context->getMutableErrorSetForValidation(),
3027                                                 angle::EntryPoint::GLBindImageTextures) &&
3028               ValidateBindImageTextures(context, angle::EntryPoint::GLBindImageTextures, first,
3029                                         count, textures)));
3030         if (isCallValid)
3031         {
3032             context->bindImageTextures(first, count, textures);
3033         }
3034         ANGLE_CAPTURE_GL(BindImageTextures, isCallValid, context, first, count, textures);
3035     }
3036     else
3037     {
3038         GenerateContextLostErrorOnCurrentGlobalContext();
3039     }
3040     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3041 }
3042 
GL_BindSamplers(GLuint first,GLsizei count,const GLuint * samplers)3043 void GL_APIENTRY GL_BindSamplers(GLuint first, GLsizei count, const GLuint *samplers)
3044 {
3045     Context *context = GetValidGlobalContext();
3046     EVENT(context, GLBindSamplers,
3047           "context = %d, first = %u, count = %d, samplers = 0x%016" PRIxPTR "", CID(context), first,
3048           count, (uintptr_t)samplers);
3049 
3050     if (context)
3051     {
3052         SCOPED_SHARE_CONTEXT_LOCK(context);
3053         bool isCallValid =
3054             (context->skipValidation() ||
3055              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3056                                                 context->getMutableErrorSetForValidation(),
3057                                                 angle::EntryPoint::GLBindSamplers) &&
3058               ValidateBindSamplers(context, angle::EntryPoint::GLBindSamplers, first, count,
3059                                    samplers)));
3060         if (isCallValid)
3061         {
3062             context->bindSamplers(first, count, samplers);
3063         }
3064         ANGLE_CAPTURE_GL(BindSamplers, isCallValid, context, first, count, samplers);
3065     }
3066     else
3067     {
3068         GenerateContextLostErrorOnCurrentGlobalContext();
3069     }
3070     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3071 }
3072 
GL_BindTextures(GLuint first,GLsizei count,const GLuint * textures)3073 void GL_APIENTRY GL_BindTextures(GLuint first, GLsizei count, const GLuint *textures)
3074 {
3075     Context *context = GetValidGlobalContext();
3076     EVENT(context, GLBindTextures,
3077           "context = %d, first = %u, count = %d, textures = 0x%016" PRIxPTR "", CID(context), first,
3078           count, (uintptr_t)textures);
3079 
3080     if (context)
3081     {
3082         SCOPED_SHARE_CONTEXT_LOCK(context);
3083         bool isCallValid =
3084             (context->skipValidation() ||
3085              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3086                                                 context->getMutableErrorSetForValidation(),
3087                                                 angle::EntryPoint::GLBindTextures) &&
3088               ValidateBindTextures(context, angle::EntryPoint::GLBindTextures, first, count,
3089                                    textures)));
3090         if (isCallValid)
3091         {
3092             context->bindTextures(first, count, textures);
3093         }
3094         ANGLE_CAPTURE_GL(BindTextures, isCallValid, context, first, count, textures);
3095     }
3096     else
3097     {
3098         GenerateContextLostErrorOnCurrentGlobalContext();
3099     }
3100     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3101 }
3102 
GL_BindVertexBuffers(GLuint first,GLsizei count,const GLuint * buffers,const GLintptr * offsets,const GLsizei * strides)3103 void GL_APIENTRY GL_BindVertexBuffers(GLuint first,
3104                                       GLsizei count,
3105                                       const GLuint *buffers,
3106                                       const GLintptr *offsets,
3107                                       const GLsizei *strides)
3108 {
3109     Context *context = GetValidGlobalContext();
3110     EVENT(context, GLBindVertexBuffers,
3111           "context = %d, first = %u, count = %d, buffers = 0x%016" PRIxPTR
3112           ", offsets = 0x%016" PRIxPTR ", strides = 0x%016" PRIxPTR "",
3113           CID(context), first, count, (uintptr_t)buffers, (uintptr_t)offsets, (uintptr_t)strides);
3114 
3115     if (context)
3116     {
3117         const BufferID *buffersPacked = PackParam<const BufferID *>(buffers);
3118         SCOPED_SHARE_CONTEXT_LOCK(context);
3119         bool isCallValid =
3120             (context->skipValidation() ||
3121              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3122                                                 context->getMutableErrorSetForValidation(),
3123                                                 angle::EntryPoint::GLBindVertexBuffers) &&
3124               ValidateBindVertexBuffers(context, angle::EntryPoint::GLBindVertexBuffers, first,
3125                                         count, buffersPacked, offsets, strides)));
3126         if (isCallValid)
3127         {
3128             context->bindVertexBuffers(first, count, buffersPacked, offsets, strides);
3129         }
3130         ANGLE_CAPTURE_GL(BindVertexBuffers, isCallValid, context, first, count, buffersPacked,
3131                          offsets, strides);
3132     }
3133     else
3134     {
3135         GenerateContextLostErrorOnCurrentGlobalContext();
3136     }
3137     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3138 }
3139 
GL_BufferStorage(GLenum target,GLsizeiptr size,const void * data,GLbitfield flags)3140 void GL_APIENTRY GL_BufferStorage(GLenum target,
3141                                   GLsizeiptr size,
3142                                   const void *data,
3143                                   GLbitfield flags)
3144 {
3145     Context *context = GetValidGlobalContext();
3146     EVENT(context, GLBufferStorage,
3147           "context = %d, target = %s, size = %llu, data = 0x%016" PRIxPTR ", flags = %s",
3148           CID(context), GLenumToString(BigGLEnum::BufferStorageTarget, target),
3149           static_cast<unsigned long long>(size), (uintptr_t)data,
3150           GLbitfieldToString(BigGLEnum::BufferStorageMask, flags).c_str());
3151 
3152     if (context)
3153     {
3154         BufferBinding targetPacked = PackParam<BufferBinding>(target);
3155         SCOPED_SHARE_CONTEXT_LOCK(context);
3156         bool isCallValid =
3157             (context->skipValidation() ||
3158              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3159                                                 context->getMutableErrorSetForValidation(),
3160                                                 angle::EntryPoint::GLBufferStorage) &&
3161               ValidateBufferStorage(context, angle::EntryPoint::GLBufferStorage, targetPacked, size,
3162                                     data, flags)));
3163         if (isCallValid)
3164         {
3165             context->bufferStorage(targetPacked, size, data, flags);
3166         }
3167         ANGLE_CAPTURE_GL(BufferStorage, isCallValid, context, targetPacked, size, data, flags);
3168     }
3169     else
3170     {
3171         GenerateContextLostErrorOnCurrentGlobalContext();
3172     }
3173     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3174 }
3175 
3176 void GL_APIENTRY
GL_ClearTexImage(GLuint texture,GLint level,GLenum format,GLenum type,const void * data)3177 GL_ClearTexImage(GLuint texture, GLint level, GLenum format, GLenum type, const void *data)
3178 {
3179     Context *context = GetValidGlobalContext();
3180     EVENT(context, GLClearTexImage,
3181           "context = %d, texture = %u, level = %d, format = %s, type = %s, data = 0x%016" PRIxPTR
3182           "",
3183           CID(context), texture, level, GLenumToString(BigGLEnum::PixelFormat, format),
3184           GLenumToString(BigGLEnum::PixelType, type), (uintptr_t)data);
3185 
3186     if (context)
3187     {
3188         TextureID texturePacked = PackParam<TextureID>(texture);
3189         SCOPED_SHARE_CONTEXT_LOCK(context);
3190         bool isCallValid =
3191             (context->skipValidation() ||
3192              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3193                                                 context->getMutableErrorSetForValidation(),
3194                                                 angle::EntryPoint::GLClearTexImage) &&
3195               ValidateClearTexImage(context, angle::EntryPoint::GLClearTexImage, texturePacked,
3196                                     level, format, type, data)));
3197         if (isCallValid)
3198         {
3199             context->clearTexImage(texturePacked, level, format, type, data);
3200         }
3201         ANGLE_CAPTURE_GL(ClearTexImage, isCallValid, context, texturePacked, level, format, type,
3202                          data);
3203     }
3204     else
3205     {
3206         GenerateContextLostErrorOnCurrentGlobalContext();
3207     }
3208     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3209 }
3210 
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)3211 void GL_APIENTRY GL_ClearTexSubImage(GLuint texture,
3212                                      GLint level,
3213                                      GLint xoffset,
3214                                      GLint yoffset,
3215                                      GLint zoffset,
3216                                      GLsizei width,
3217                                      GLsizei height,
3218                                      GLsizei depth,
3219                                      GLenum format,
3220                                      GLenum type,
3221                                      const void *data)
3222 {
3223     Context *context = GetValidGlobalContext();
3224     EVENT(context, GLClearTexSubImage,
3225           "context = %d, texture = %u, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width "
3226           "= %d, height = %d, depth = %d, format = %s, type = %s, data = 0x%016" PRIxPTR "",
3227           CID(context), texture, level, xoffset, yoffset, zoffset, width, height, depth,
3228           GLenumToString(BigGLEnum::PixelFormat, format),
3229           GLenumToString(BigGLEnum::PixelType, type), (uintptr_t)data);
3230 
3231     if (context)
3232     {
3233         TextureID texturePacked = PackParam<TextureID>(texture);
3234         SCOPED_SHARE_CONTEXT_LOCK(context);
3235         bool isCallValid =
3236             (context->skipValidation() ||
3237              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3238                                                 context->getMutableErrorSetForValidation(),
3239                                                 angle::EntryPoint::GLClearTexSubImage) &&
3240               ValidateClearTexSubImage(context, angle::EntryPoint::GLClearTexSubImage,
3241                                        texturePacked, level, xoffset, yoffset, zoffset, width,
3242                                        height, depth, format, type, data)));
3243         if (isCallValid)
3244         {
3245             context->clearTexSubImage(texturePacked, level, xoffset, yoffset, zoffset, width,
3246                                       height, depth, format, type, data);
3247         }
3248         ANGLE_CAPTURE_GL(ClearTexSubImage, isCallValid, context, texturePacked, level, xoffset,
3249                          yoffset, zoffset, width, height, depth, format, type, data);
3250     }
3251     else
3252     {
3253         GenerateContextLostErrorOnCurrentGlobalContext();
3254     }
3255     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3256 }
3257 
3258 // GL 4.5
GL_BindTextureUnit(GLuint unit,GLuint texture)3259 void GL_APIENTRY GL_BindTextureUnit(GLuint unit, GLuint texture)
3260 {
3261     Context *context = GetValidGlobalContext();
3262     EVENT(context, GLBindTextureUnit, "context = %d, unit = %u, texture = %u", CID(context), unit,
3263           texture);
3264 
3265     if (context)
3266     {
3267         TextureID texturePacked = PackParam<TextureID>(texture);
3268         SCOPED_SHARE_CONTEXT_LOCK(context);
3269         bool isCallValid =
3270             (context->skipValidation() ||
3271              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3272                                                 context->getMutableErrorSetForValidation(),
3273                                                 angle::EntryPoint::GLBindTextureUnit) &&
3274               ValidateBindTextureUnit(context, angle::EntryPoint::GLBindTextureUnit, unit,
3275                                       texturePacked)));
3276         if (isCallValid)
3277         {
3278             context->bindTextureUnit(unit, texturePacked);
3279         }
3280         ANGLE_CAPTURE_GL(BindTextureUnit, isCallValid, context, unit, texturePacked);
3281     }
3282     else
3283     {
3284         GenerateContextLostErrorOnCurrentGlobalContext();
3285     }
3286     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3287 }
3288 
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)3289 void GL_APIENTRY GL_BlitNamedFramebuffer(GLuint readFramebuffer,
3290                                          GLuint drawFramebuffer,
3291                                          GLint srcX0,
3292                                          GLint srcY0,
3293                                          GLint srcX1,
3294                                          GLint srcY1,
3295                                          GLint dstX0,
3296                                          GLint dstY0,
3297                                          GLint dstX1,
3298                                          GLint dstY1,
3299                                          GLbitfield mask,
3300                                          GLenum filter)
3301 {
3302     Context *context = GetValidGlobalContext();
3303     EVENT(
3304         context, GLBlitNamedFramebuffer,
3305         "context = %d, readFramebuffer = %u, drawFramebuffer = %u, srcX0 = %d, srcY0 = %d, srcX1 = "
3306         "%d, srcY1 = %d, dstX0 = %d, dstY0 = %d, dstX1 = %d, dstY1 = %d, mask = %s, filter = %s",
3307         CID(context), readFramebuffer, drawFramebuffer, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0,
3308         dstX1, dstY1, GLbitfieldToString(BigGLEnum::ClearBufferMask, mask).c_str(),
3309         GLenumToString(BigGLEnum::BlitFramebufferFilter, filter));
3310 
3311     if (context)
3312     {
3313         SCOPED_SHARE_CONTEXT_LOCK(context);
3314         bool isCallValid =
3315             (context->skipValidation() ||
3316              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3317                                                 context->getMutableErrorSetForValidation(),
3318                                                 angle::EntryPoint::GLBlitNamedFramebuffer) &&
3319               ValidateBlitNamedFramebuffer(context, angle::EntryPoint::GLBlitNamedFramebuffer,
3320                                            readFramebuffer, drawFramebuffer, srcX0, srcY0, srcX1,
3321                                            srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter)));
3322         if (isCallValid)
3323         {
3324             context->blitNamedFramebuffer(readFramebuffer, drawFramebuffer, srcX0, srcY0, srcX1,
3325                                           srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
3326         }
3327         ANGLE_CAPTURE_GL(BlitNamedFramebuffer, isCallValid, context, readFramebuffer,
3328                          drawFramebuffer, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
3329                          mask, filter);
3330     }
3331     else
3332     {
3333         GenerateContextLostErrorOnCurrentGlobalContext();
3334     }
3335     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3336 }
3337 
GL_CheckNamedFramebufferStatus(GLuint framebuffer,GLenum target)3338 GLenum GL_APIENTRY GL_CheckNamedFramebufferStatus(GLuint framebuffer, GLenum target)
3339 {
3340     Context *context = GetValidGlobalContext();
3341     EVENT(context, GLCheckNamedFramebufferStatus, "context = %d, framebuffer = %u, target = %s",
3342           CID(context), framebuffer, GLenumToString(BigGLEnum::FramebufferTarget, target));
3343 
3344     GLenum returnValue;
3345     if (context)
3346     {
3347         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
3348         SCOPED_SHARE_CONTEXT_LOCK(context);
3349         bool isCallValid =
3350             (context->skipValidation() ||
3351              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3352                                                 context->getMutableErrorSetForValidation(),
3353                                                 angle::EntryPoint::GLCheckNamedFramebufferStatus) &&
3354               ValidateCheckNamedFramebufferStatus(context,
3355                                                   angle::EntryPoint::GLCheckNamedFramebufferStatus,
3356                                                   framebufferPacked, target)));
3357         if (isCallValid)
3358         {
3359             returnValue = context->checkNamedFramebufferStatus(framebufferPacked, target);
3360         }
3361         else
3362         {
3363             returnValue =
3364                 GetDefaultReturnValue<angle::EntryPoint::GLCheckNamedFramebufferStatus, GLenum>();
3365         }
3366         ANGLE_CAPTURE_GL(CheckNamedFramebufferStatus, isCallValid, context, framebufferPacked,
3367                          target, returnValue);
3368     }
3369     else
3370     {
3371         GenerateContextLostErrorOnCurrentGlobalContext();
3372         returnValue =
3373             GetDefaultReturnValue<angle::EntryPoint::GLCheckNamedFramebufferStatus, GLenum>();
3374     }
3375     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3376     return returnValue;
3377 }
3378 
GL_ClearNamedBufferData(GLuint buffer,GLenum internalformat,GLenum format,GLenum type,const void * data)3379 void GL_APIENTRY GL_ClearNamedBufferData(GLuint buffer,
3380                                          GLenum internalformat,
3381                                          GLenum format,
3382                                          GLenum type,
3383                                          const void *data)
3384 {
3385     Context *context = GetValidGlobalContext();
3386     EVENT(context, GLClearNamedBufferData,
3387           "context = %d, buffer = %u, internalformat = %s, format = %s, type = %s, data = "
3388           "0x%016" PRIxPTR "",
3389           CID(context), buffer, GLenumToString(BigGLEnum::SizedInternalFormat, internalformat),
3390           GLenumToString(BigGLEnum::PixelFormat, format),
3391           GLenumToString(BigGLEnum::PixelType, type), (uintptr_t)data);
3392 
3393     if (context)
3394     {
3395         BufferID bufferPacked = PackParam<BufferID>(buffer);
3396         SCOPED_SHARE_CONTEXT_LOCK(context);
3397         bool isCallValid =
3398             (context->skipValidation() ||
3399              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3400                                                 context->getMutableErrorSetForValidation(),
3401                                                 angle::EntryPoint::GLClearNamedBufferData) &&
3402               ValidateClearNamedBufferData(context, angle::EntryPoint::GLClearNamedBufferData,
3403                                            bufferPacked, internalformat, format, type, data)));
3404         if (isCallValid)
3405         {
3406             context->clearNamedBufferData(bufferPacked, internalformat, format, type, data);
3407         }
3408         ANGLE_CAPTURE_GL(ClearNamedBufferData, isCallValid, context, bufferPacked, internalformat,
3409                          format, type, data);
3410     }
3411     else
3412     {
3413         GenerateContextLostErrorOnCurrentGlobalContext();
3414     }
3415     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3416 }
3417 
GL_ClearNamedBufferSubData(GLuint buffer,GLenum internalformat,GLintptr offset,GLsizeiptr size,GLenum format,GLenum type,const void * data)3418 void GL_APIENTRY GL_ClearNamedBufferSubData(GLuint buffer,
3419                                             GLenum internalformat,
3420                                             GLintptr offset,
3421                                             GLsizeiptr size,
3422                                             GLenum format,
3423                                             GLenum type,
3424                                             const void *data)
3425 {
3426     Context *context = GetValidGlobalContext();
3427     EVENT(context, GLClearNamedBufferSubData,
3428           "context = %d, buffer = %u, internalformat = %s, offset = %llu, size = %llu, format = "
3429           "%s, type = %s, data = 0x%016" PRIxPTR "",
3430           CID(context), buffer, GLenumToString(BigGLEnum::SizedInternalFormat, internalformat),
3431           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size),
3432           GLenumToString(BigGLEnum::PixelFormat, format),
3433           GLenumToString(BigGLEnum::PixelType, type), (uintptr_t)data);
3434 
3435     if (context)
3436     {
3437         BufferID bufferPacked = PackParam<BufferID>(buffer);
3438         SCOPED_SHARE_CONTEXT_LOCK(context);
3439         bool isCallValid =
3440             (context->skipValidation() ||
3441              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3442                                                 context->getMutableErrorSetForValidation(),
3443                                                 angle::EntryPoint::GLClearNamedBufferSubData) &&
3444               ValidateClearNamedBufferSubData(context, angle::EntryPoint::GLClearNamedBufferSubData,
3445                                               bufferPacked, internalformat, offset, size, format,
3446                                               type, data)));
3447         if (isCallValid)
3448         {
3449             context->clearNamedBufferSubData(bufferPacked, internalformat, offset, size, format,
3450                                              type, data);
3451         }
3452         ANGLE_CAPTURE_GL(ClearNamedBufferSubData, isCallValid, context, bufferPacked,
3453                          internalformat, offset, size, format, type, data);
3454     }
3455     else
3456     {
3457         GenerateContextLostErrorOnCurrentGlobalContext();
3458     }
3459     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3460 }
3461 
GL_ClearNamedFramebufferfi(GLuint framebuffer,GLenum buffer,GLint drawbuffer,GLfloat depth,GLint stencil)3462 void GL_APIENTRY GL_ClearNamedFramebufferfi(GLuint framebuffer,
3463                                             GLenum buffer,
3464                                             GLint drawbuffer,
3465                                             GLfloat depth,
3466                                             GLint stencil)
3467 {
3468     Context *context = GetValidGlobalContext();
3469     EVENT(context, GLClearNamedFramebufferfi,
3470           "context = %d, framebuffer = %u, buffer = %s, drawbuffer = %d, depth = %f, stencil = %d",
3471           CID(context), framebuffer, GLenumToString(BigGLEnum::Buffer, buffer), drawbuffer, depth,
3472           stencil);
3473 
3474     if (context)
3475     {
3476         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
3477         SCOPED_SHARE_CONTEXT_LOCK(context);
3478         bool isCallValid =
3479             (context->skipValidation() ||
3480              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3481                                                 context->getMutableErrorSetForValidation(),
3482                                                 angle::EntryPoint::GLClearNamedFramebufferfi) &&
3483               ValidateClearNamedFramebufferfi(context, angle::EntryPoint::GLClearNamedFramebufferfi,
3484                                               framebufferPacked, buffer, drawbuffer, depth,
3485                                               stencil)));
3486         if (isCallValid)
3487         {
3488             context->clearNamedFramebufferfi(framebufferPacked, buffer, drawbuffer, depth, stencil);
3489         }
3490         ANGLE_CAPTURE_GL(ClearNamedFramebufferfi, isCallValid, context, framebufferPacked, buffer,
3491                          drawbuffer, depth, stencil);
3492     }
3493     else
3494     {
3495         GenerateContextLostErrorOnCurrentGlobalContext();
3496     }
3497     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3498 }
3499 
GL_ClearNamedFramebufferfv(GLuint framebuffer,GLenum buffer,GLint drawbuffer,const GLfloat * value)3500 void GL_APIENTRY GL_ClearNamedFramebufferfv(GLuint framebuffer,
3501                                             GLenum buffer,
3502                                             GLint drawbuffer,
3503                                             const GLfloat *value)
3504 {
3505     Context *context = GetValidGlobalContext();
3506     EVENT(context, GLClearNamedFramebufferfv,
3507           "context = %d, framebuffer = %u, buffer = %s, drawbuffer = %d, value = 0x%016" PRIxPTR "",
3508           CID(context), framebuffer, GLenumToString(BigGLEnum::Buffer, buffer), drawbuffer,
3509           (uintptr_t)value);
3510 
3511     if (context)
3512     {
3513         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
3514         SCOPED_SHARE_CONTEXT_LOCK(context);
3515         bool isCallValid =
3516             (context->skipValidation() ||
3517              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3518                                                 context->getMutableErrorSetForValidation(),
3519                                                 angle::EntryPoint::GLClearNamedFramebufferfv) &&
3520               ValidateClearNamedFramebufferfv(context, angle::EntryPoint::GLClearNamedFramebufferfv,
3521                                               framebufferPacked, buffer, drawbuffer, value)));
3522         if (isCallValid)
3523         {
3524             context->clearNamedFramebufferfv(framebufferPacked, buffer, drawbuffer, value);
3525         }
3526         ANGLE_CAPTURE_GL(ClearNamedFramebufferfv, isCallValid, context, framebufferPacked, buffer,
3527                          drawbuffer, value);
3528     }
3529     else
3530     {
3531         GenerateContextLostErrorOnCurrentGlobalContext();
3532     }
3533     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3534 }
3535 
GL_ClearNamedFramebufferiv(GLuint framebuffer,GLenum buffer,GLint drawbuffer,const GLint * value)3536 void GL_APIENTRY GL_ClearNamedFramebufferiv(GLuint framebuffer,
3537                                             GLenum buffer,
3538                                             GLint drawbuffer,
3539                                             const GLint *value)
3540 {
3541     Context *context = GetValidGlobalContext();
3542     EVENT(context, GLClearNamedFramebufferiv,
3543           "context = %d, framebuffer = %u, buffer = %s, drawbuffer = %d, value = 0x%016" PRIxPTR "",
3544           CID(context), framebuffer, GLenumToString(BigGLEnum::Buffer, buffer), drawbuffer,
3545           (uintptr_t)value);
3546 
3547     if (context)
3548     {
3549         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
3550         SCOPED_SHARE_CONTEXT_LOCK(context);
3551         bool isCallValid =
3552             (context->skipValidation() ||
3553              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3554                                                 context->getMutableErrorSetForValidation(),
3555                                                 angle::EntryPoint::GLClearNamedFramebufferiv) &&
3556               ValidateClearNamedFramebufferiv(context, angle::EntryPoint::GLClearNamedFramebufferiv,
3557                                               framebufferPacked, buffer, drawbuffer, value)));
3558         if (isCallValid)
3559         {
3560             context->clearNamedFramebufferiv(framebufferPacked, buffer, drawbuffer, value);
3561         }
3562         ANGLE_CAPTURE_GL(ClearNamedFramebufferiv, isCallValid, context, framebufferPacked, buffer,
3563                          drawbuffer, value);
3564     }
3565     else
3566     {
3567         GenerateContextLostErrorOnCurrentGlobalContext();
3568     }
3569     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3570 }
3571 
GL_ClearNamedFramebufferuiv(GLuint framebuffer,GLenum buffer,GLint drawbuffer,const GLuint * value)3572 void GL_APIENTRY GL_ClearNamedFramebufferuiv(GLuint framebuffer,
3573                                              GLenum buffer,
3574                                              GLint drawbuffer,
3575                                              const GLuint *value)
3576 {
3577     Context *context = GetValidGlobalContext();
3578     EVENT(context, GLClearNamedFramebufferuiv,
3579           "context = %d, framebuffer = %u, buffer = %s, drawbuffer = %d, value = 0x%016" PRIxPTR "",
3580           CID(context), framebuffer, GLenumToString(BigGLEnum::Buffer, buffer), drawbuffer,
3581           (uintptr_t)value);
3582 
3583     if (context)
3584     {
3585         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
3586         SCOPED_SHARE_CONTEXT_LOCK(context);
3587         bool isCallValid =
3588             (context->skipValidation() ||
3589              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3590                                                 context->getMutableErrorSetForValidation(),
3591                                                 angle::EntryPoint::GLClearNamedFramebufferuiv) &&
3592               ValidateClearNamedFramebufferuiv(context,
3593                                                angle::EntryPoint::GLClearNamedFramebufferuiv,
3594                                                framebufferPacked, buffer, drawbuffer, value)));
3595         if (isCallValid)
3596         {
3597             context->clearNamedFramebufferuiv(framebufferPacked, buffer, drawbuffer, value);
3598         }
3599         ANGLE_CAPTURE_GL(ClearNamedFramebufferuiv, isCallValid, context, framebufferPacked, buffer,
3600                          drawbuffer, value);
3601     }
3602     else
3603     {
3604         GenerateContextLostErrorOnCurrentGlobalContext();
3605     }
3606     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3607 }
3608 
GL_ClipControl(GLenum origin,GLenum depth)3609 void GL_APIENTRY GL_ClipControl(GLenum origin, GLenum depth)
3610 {
3611     Context *context = GetValidGlobalContext();
3612     EVENT(context, GLClipControl, "context = %d, origin = %s, depth = %s", CID(context),
3613           GLenumToString(BigGLEnum::ClipControlOrigin, origin),
3614           GLenumToString(BigGLEnum::ClipControlDepth, depth));
3615 
3616     if (context)
3617     {
3618         ClipOrigin originPacked   = PackParam<ClipOrigin>(origin);
3619         ClipDepthMode depthPacked = PackParam<ClipDepthMode>(depth);
3620         bool isCallValid =
3621             (context->skipValidation() ||
3622              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3623                                                 context->getMutableErrorSetForValidation(),
3624                                                 angle::EntryPoint::GLClipControl) &&
3625               ValidateClipControl(context->getPrivateState(),
3626                                   context->getMutableErrorSetForValidation(),
3627                                   angle::EntryPoint::GLClipControl, originPacked, depthPacked)));
3628         if (isCallValid)
3629         {
3630             ContextPrivateClipControl(context->getMutablePrivateState(),
3631                                       context->getMutablePrivateStateCache(), originPacked,
3632                                       depthPacked);
3633         }
3634         ANGLE_CAPTURE_GL(ClipControl, isCallValid, context, originPacked, depthPacked);
3635     }
3636     else
3637     {
3638         GenerateContextLostErrorOnCurrentGlobalContext();
3639     }
3640     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3641 }
3642 
GL_CompressedTextureSubImage1D(GLuint texture,GLint level,GLint xoffset,GLsizei width,GLenum format,GLsizei imageSize,const void * data)3643 void GL_APIENTRY GL_CompressedTextureSubImage1D(GLuint texture,
3644                                                 GLint level,
3645                                                 GLint xoffset,
3646                                                 GLsizei width,
3647                                                 GLenum format,
3648                                                 GLsizei imageSize,
3649                                                 const void *data)
3650 {
3651     Context *context = GetValidGlobalContext();
3652     EVENT(context, GLCompressedTextureSubImage1D,
3653           "context = %d, texture = %u, level = %d, xoffset = %d, width = %d, format = %s, "
3654           "imageSize = %d, data = 0x%016" PRIxPTR "",
3655           CID(context), texture, level, xoffset, width,
3656           GLenumToString(BigGLEnum::InternalFormat, format), imageSize, (uintptr_t)data);
3657 
3658     if (context)
3659     {
3660         TextureID texturePacked = PackParam<TextureID>(texture);
3661         SCOPED_SHARE_CONTEXT_LOCK(context);
3662         bool isCallValid =
3663             (context->skipValidation() ||
3664              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3665                                                 context->getMutableErrorSetForValidation(),
3666                                                 angle::EntryPoint::GLCompressedTextureSubImage1D) &&
3667               ValidateCompressedTextureSubImage1D(
3668                   context, angle::EntryPoint::GLCompressedTextureSubImage1D, texturePacked, level,
3669                   xoffset, width, format, imageSize, data)));
3670         if (isCallValid)
3671         {
3672             context->compressedTextureSubImage1D(texturePacked, level, xoffset, width, format,
3673                                                  imageSize, data);
3674         }
3675         ANGLE_CAPTURE_GL(CompressedTextureSubImage1D, isCallValid, context, texturePacked, level,
3676                          xoffset, width, format, imageSize, data);
3677     }
3678     else
3679     {
3680         GenerateContextLostErrorOnCurrentGlobalContext();
3681     }
3682     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3683 }
3684 
GL_CompressedTextureSubImage2D(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLsizei imageSize,const void * data)3685 void GL_APIENTRY GL_CompressedTextureSubImage2D(GLuint texture,
3686                                                 GLint level,
3687                                                 GLint xoffset,
3688                                                 GLint yoffset,
3689                                                 GLsizei width,
3690                                                 GLsizei height,
3691                                                 GLenum format,
3692                                                 GLsizei imageSize,
3693                                                 const void *data)
3694 {
3695     Context *context = GetValidGlobalContext();
3696     EVENT(context, GLCompressedTextureSubImage2D,
3697           "context = %d, texture = %u, level = %d, xoffset = %d, yoffset = %d, width = %d, height "
3698           "= %d, format = %s, imageSize = %d, data = 0x%016" PRIxPTR "",
3699           CID(context), texture, level, xoffset, yoffset, width, height,
3700           GLenumToString(BigGLEnum::InternalFormat, format), imageSize, (uintptr_t)data);
3701 
3702     if (context)
3703     {
3704         TextureID texturePacked = PackParam<TextureID>(texture);
3705         SCOPED_SHARE_CONTEXT_LOCK(context);
3706         bool isCallValid =
3707             (context->skipValidation() ||
3708              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3709                                                 context->getMutableErrorSetForValidation(),
3710                                                 angle::EntryPoint::GLCompressedTextureSubImage2D) &&
3711               ValidateCompressedTextureSubImage2D(
3712                   context, angle::EntryPoint::GLCompressedTextureSubImage2D, texturePacked, level,
3713                   xoffset, yoffset, width, height, format, imageSize, data)));
3714         if (isCallValid)
3715         {
3716             context->compressedTextureSubImage2D(texturePacked, level, xoffset, yoffset, width,
3717                                                  height, format, imageSize, data);
3718         }
3719         ANGLE_CAPTURE_GL(CompressedTextureSubImage2D, isCallValid, context, texturePacked, level,
3720                          xoffset, yoffset, width, height, format, imageSize, data);
3721     }
3722     else
3723     {
3724         GenerateContextLostErrorOnCurrentGlobalContext();
3725     }
3726     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3727 }
3728 
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)3729 void GL_APIENTRY GL_CompressedTextureSubImage3D(GLuint texture,
3730                                                 GLint level,
3731                                                 GLint xoffset,
3732                                                 GLint yoffset,
3733                                                 GLint zoffset,
3734                                                 GLsizei width,
3735                                                 GLsizei height,
3736                                                 GLsizei depth,
3737                                                 GLenum format,
3738                                                 GLsizei imageSize,
3739                                                 const void *data)
3740 {
3741     Context *context = GetValidGlobalContext();
3742     EVENT(context, GLCompressedTextureSubImage3D,
3743           "context = %d, texture = %u, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width "
3744           "= %d, height = %d, depth = %d, format = %s, imageSize = %d, data = 0x%016" PRIxPTR "",
3745           CID(context), texture, level, xoffset, yoffset, zoffset, width, height, depth,
3746           GLenumToString(BigGLEnum::InternalFormat, format), imageSize, (uintptr_t)data);
3747 
3748     if (context)
3749     {
3750         TextureID texturePacked = PackParam<TextureID>(texture);
3751         SCOPED_SHARE_CONTEXT_LOCK(context);
3752         bool isCallValid =
3753             (context->skipValidation() ||
3754              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3755                                                 context->getMutableErrorSetForValidation(),
3756                                                 angle::EntryPoint::GLCompressedTextureSubImage3D) &&
3757               ValidateCompressedTextureSubImage3D(
3758                   context, angle::EntryPoint::GLCompressedTextureSubImage3D, texturePacked, level,
3759                   xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data)));
3760         if (isCallValid)
3761         {
3762             context->compressedTextureSubImage3D(texturePacked, level, xoffset, yoffset, zoffset,
3763                                                  width, height, depth, format, imageSize, data);
3764         }
3765         ANGLE_CAPTURE_GL(CompressedTextureSubImage3D, isCallValid, context, texturePacked, level,
3766                          xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
3767     }
3768     else
3769     {
3770         GenerateContextLostErrorOnCurrentGlobalContext();
3771     }
3772     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3773 }
3774 
GL_CopyNamedBufferSubData(GLuint readBuffer,GLuint writeBuffer,GLintptr readOffset,GLintptr writeOffset,GLsizeiptr size)3775 void GL_APIENTRY GL_CopyNamedBufferSubData(GLuint readBuffer,
3776                                            GLuint writeBuffer,
3777                                            GLintptr readOffset,
3778                                            GLintptr writeOffset,
3779                                            GLsizeiptr size)
3780 {
3781     Context *context = GetValidGlobalContext();
3782     EVENT(context, GLCopyNamedBufferSubData,
3783           "context = %d, readBuffer = %u, writeBuffer = %u, readOffset = %llu, writeOffset = %llu, "
3784           "size = %llu",
3785           CID(context), readBuffer, writeBuffer, static_cast<unsigned long long>(readOffset),
3786           static_cast<unsigned long long>(writeOffset), static_cast<unsigned long long>(size));
3787 
3788     if (context)
3789     {
3790         SCOPED_SHARE_CONTEXT_LOCK(context);
3791         bool isCallValid =
3792             (context->skipValidation() ||
3793              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3794                                                 context->getMutableErrorSetForValidation(),
3795                                                 angle::EntryPoint::GLCopyNamedBufferSubData) &&
3796               ValidateCopyNamedBufferSubData(context, angle::EntryPoint::GLCopyNamedBufferSubData,
3797                                              readBuffer, writeBuffer, readOffset, writeOffset,
3798                                              size)));
3799         if (isCallValid)
3800         {
3801             context->copyNamedBufferSubData(readBuffer, writeBuffer, readOffset, writeOffset, size);
3802         }
3803         ANGLE_CAPTURE_GL(CopyNamedBufferSubData, isCallValid, context, readBuffer, writeBuffer,
3804                          readOffset, writeOffset, size);
3805     }
3806     else
3807     {
3808         GenerateContextLostErrorOnCurrentGlobalContext();
3809     }
3810     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3811 }
3812 
GL_CopyTextureSubImage1D(GLuint texture,GLint level,GLint xoffset,GLint x,GLint y,GLsizei width)3813 void GL_APIENTRY GL_CopyTextureSubImage1D(GLuint texture,
3814                                           GLint level,
3815                                           GLint xoffset,
3816                                           GLint x,
3817                                           GLint y,
3818                                           GLsizei width)
3819 {
3820     Context *context = GetValidGlobalContext();
3821     EVENT(context, GLCopyTextureSubImage1D,
3822           "context = %d, texture = %u, level = %d, xoffset = %d, x = %d, y = %d, width = %d",
3823           CID(context), texture, level, xoffset, x, y, width);
3824 
3825     if (context)
3826     {
3827         TextureID texturePacked = PackParam<TextureID>(texture);
3828         SCOPED_SHARE_CONTEXT_LOCK(context);
3829         bool isCallValid =
3830             (context->skipValidation() ||
3831              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3832                                                 context->getMutableErrorSetForValidation(),
3833                                                 angle::EntryPoint::GLCopyTextureSubImage1D) &&
3834               ValidateCopyTextureSubImage1D(context, angle::EntryPoint::GLCopyTextureSubImage1D,
3835                                             texturePacked, level, xoffset, x, y, width)));
3836         if (isCallValid)
3837         {
3838             context->copyTextureSubImage1D(texturePacked, level, xoffset, x, y, width);
3839         }
3840         ANGLE_CAPTURE_GL(CopyTextureSubImage1D, isCallValid, context, texturePacked, level, xoffset,
3841                          x, y, width);
3842     }
3843     else
3844     {
3845         GenerateContextLostErrorOnCurrentGlobalContext();
3846     }
3847     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3848 }
3849 
GL_CopyTextureSubImage2D(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLint x,GLint y,GLsizei width,GLsizei height)3850 void GL_APIENTRY GL_CopyTextureSubImage2D(GLuint texture,
3851                                           GLint level,
3852                                           GLint xoffset,
3853                                           GLint yoffset,
3854                                           GLint x,
3855                                           GLint y,
3856                                           GLsizei width,
3857                                           GLsizei height)
3858 {
3859     Context *context = GetValidGlobalContext();
3860     EVENT(context, GLCopyTextureSubImage2D,
3861           "context = %d, texture = %u, level = %d, xoffset = %d, yoffset = %d, x = %d, y = %d, "
3862           "width = %d, height = %d",
3863           CID(context), texture, level, xoffset, yoffset, x, y, width, height);
3864 
3865     if (context)
3866     {
3867         TextureID texturePacked = PackParam<TextureID>(texture);
3868         SCOPED_SHARE_CONTEXT_LOCK(context);
3869         bool isCallValid =
3870             (context->skipValidation() ||
3871              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3872                                                 context->getMutableErrorSetForValidation(),
3873                                                 angle::EntryPoint::GLCopyTextureSubImage2D) &&
3874               ValidateCopyTextureSubImage2D(context, angle::EntryPoint::GLCopyTextureSubImage2D,
3875                                             texturePacked, level, xoffset, yoffset, x, y, width,
3876                                             height)));
3877         if (isCallValid)
3878         {
3879             context->copyTextureSubImage2D(texturePacked, level, xoffset, yoffset, x, y, width,
3880                                            height);
3881         }
3882         ANGLE_CAPTURE_GL(CopyTextureSubImage2D, isCallValid, context, texturePacked, level, xoffset,
3883                          yoffset, x, y, width, height);
3884     }
3885     else
3886     {
3887         GenerateContextLostErrorOnCurrentGlobalContext();
3888     }
3889     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3890 }
3891 
GL_CopyTextureSubImage3D(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLint x,GLint y,GLsizei width,GLsizei height)3892 void GL_APIENTRY GL_CopyTextureSubImage3D(GLuint texture,
3893                                           GLint level,
3894                                           GLint xoffset,
3895                                           GLint yoffset,
3896                                           GLint zoffset,
3897                                           GLint x,
3898                                           GLint y,
3899                                           GLsizei width,
3900                                           GLsizei height)
3901 {
3902     Context *context = GetValidGlobalContext();
3903     EVENT(context, GLCopyTextureSubImage3D,
3904           "context = %d, texture = %u, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, x = "
3905           "%d, y = %d, width = %d, height = %d",
3906           CID(context), texture, level, xoffset, yoffset, zoffset, x, y, width, height);
3907 
3908     if (context)
3909     {
3910         TextureID texturePacked = PackParam<TextureID>(texture);
3911         SCOPED_SHARE_CONTEXT_LOCK(context);
3912         bool isCallValid =
3913             (context->skipValidation() ||
3914              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3915                                                 context->getMutableErrorSetForValidation(),
3916                                                 angle::EntryPoint::GLCopyTextureSubImage3D) &&
3917               ValidateCopyTextureSubImage3D(context, angle::EntryPoint::GLCopyTextureSubImage3D,
3918                                             texturePacked, level, xoffset, yoffset, zoffset, x, y,
3919                                             width, height)));
3920         if (isCallValid)
3921         {
3922             context->copyTextureSubImage3D(texturePacked, level, xoffset, yoffset, zoffset, x, y,
3923                                            width, height);
3924         }
3925         ANGLE_CAPTURE_GL(CopyTextureSubImage3D, isCallValid, context, texturePacked, level, xoffset,
3926                          yoffset, zoffset, x, y, width, height);
3927     }
3928     else
3929     {
3930         GenerateContextLostErrorOnCurrentGlobalContext();
3931     }
3932     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3933 }
3934 
GL_CreateBuffers(GLsizei n,GLuint * buffers)3935 void GL_APIENTRY GL_CreateBuffers(GLsizei n, GLuint *buffers)
3936 {
3937     Context *context = GetValidGlobalContext();
3938     EVENT(context, GLCreateBuffers, "context = %d, n = %d, buffers = 0x%016" PRIxPTR "",
3939           CID(context), n, (uintptr_t)buffers);
3940 
3941     if (context)
3942     {
3943         BufferID *buffersPacked = PackParam<BufferID *>(buffers);
3944         SCOPED_SHARE_CONTEXT_LOCK(context);
3945         bool isCallValid =
3946             (context->skipValidation() ||
3947              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3948                                                 context->getMutableErrorSetForValidation(),
3949                                                 angle::EntryPoint::GLCreateBuffers) &&
3950               ValidateCreateBuffers(context, angle::EntryPoint::GLCreateBuffers, n,
3951                                     buffersPacked)));
3952         if (isCallValid)
3953         {
3954             context->createBuffers(n, buffersPacked);
3955         }
3956         ANGLE_CAPTURE_GL(CreateBuffers, isCallValid, context, n, buffersPacked);
3957     }
3958     else
3959     {
3960         GenerateContextLostErrorOnCurrentGlobalContext();
3961     }
3962     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3963 }
3964 
GL_CreateFramebuffers(GLsizei n,GLuint * framebuffers)3965 void GL_APIENTRY GL_CreateFramebuffers(GLsizei n, GLuint *framebuffers)
3966 {
3967     Context *context = GetValidGlobalContext();
3968     EVENT(context, GLCreateFramebuffers, "context = %d, n = %d, framebuffers = 0x%016" PRIxPTR "",
3969           CID(context), n, (uintptr_t)framebuffers);
3970 
3971     if (context)
3972     {
3973         SCOPED_SHARE_CONTEXT_LOCK(context);
3974         bool isCallValid =
3975             (context->skipValidation() ||
3976              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3977                                                 context->getMutableErrorSetForValidation(),
3978                                                 angle::EntryPoint::GLCreateFramebuffers) &&
3979               ValidateCreateFramebuffers(context, angle::EntryPoint::GLCreateFramebuffers, n,
3980                                          framebuffers)));
3981         if (isCallValid)
3982         {
3983             context->createFramebuffers(n, framebuffers);
3984         }
3985         ANGLE_CAPTURE_GL(CreateFramebuffers, isCallValid, context, n, framebuffers);
3986     }
3987     else
3988     {
3989         GenerateContextLostErrorOnCurrentGlobalContext();
3990     }
3991     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3992 }
3993 
GL_CreateProgramPipelines(GLsizei n,GLuint * pipelines)3994 void GL_APIENTRY GL_CreateProgramPipelines(GLsizei n, GLuint *pipelines)
3995 {
3996     Context *context = GetValidGlobalContext();
3997     EVENT(context, GLCreateProgramPipelines, "context = %d, n = %d, pipelines = 0x%016" PRIxPTR "",
3998           CID(context), n, (uintptr_t)pipelines);
3999 
4000     if (context)
4001     {
4002         SCOPED_SHARE_CONTEXT_LOCK(context);
4003         bool isCallValid =
4004             (context->skipValidation() ||
4005              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4006                                                 context->getMutableErrorSetForValidation(),
4007                                                 angle::EntryPoint::GLCreateProgramPipelines) &&
4008               ValidateCreateProgramPipelines(context, angle::EntryPoint::GLCreateProgramPipelines,
4009                                              n, pipelines)));
4010         if (isCallValid)
4011         {
4012             context->createProgramPipelines(n, pipelines);
4013         }
4014         ANGLE_CAPTURE_GL(CreateProgramPipelines, isCallValid, context, n, pipelines);
4015     }
4016     else
4017     {
4018         GenerateContextLostErrorOnCurrentGlobalContext();
4019     }
4020     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4021 }
4022 
GL_CreateQueries(GLenum target,GLsizei n,GLuint * ids)4023 void GL_APIENTRY GL_CreateQueries(GLenum target, GLsizei n, GLuint *ids)
4024 {
4025     Context *context = GetValidGlobalContext();
4026     EVENT(context, GLCreateQueries, "context = %d, target = %s, n = %d, ids = 0x%016" PRIxPTR "",
4027           CID(context), GLenumToString(BigGLEnum::QueryTarget, target), n, (uintptr_t)ids);
4028 
4029     if (context)
4030     {
4031         SCOPED_SHARE_CONTEXT_LOCK(context);
4032         bool isCallValid =
4033             (context->skipValidation() ||
4034              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4035                                                 context->getMutableErrorSetForValidation(),
4036                                                 angle::EntryPoint::GLCreateQueries) &&
4037               ValidateCreateQueries(context, angle::EntryPoint::GLCreateQueries, target, n, ids)));
4038         if (isCallValid)
4039         {
4040             context->createQueries(target, n, ids);
4041         }
4042         ANGLE_CAPTURE_GL(CreateQueries, isCallValid, context, target, n, ids);
4043     }
4044     else
4045     {
4046         GenerateContextLostErrorOnCurrentGlobalContext();
4047     }
4048     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4049 }
4050 
GL_CreateRenderbuffers(GLsizei n,GLuint * renderbuffers)4051 void GL_APIENTRY GL_CreateRenderbuffers(GLsizei n, GLuint *renderbuffers)
4052 {
4053     Context *context = GetValidGlobalContext();
4054     EVENT(context, GLCreateRenderbuffers, "context = %d, n = %d, renderbuffers = 0x%016" PRIxPTR "",
4055           CID(context), n, (uintptr_t)renderbuffers);
4056 
4057     if (context)
4058     {
4059         RenderbufferID *renderbuffersPacked = PackParam<RenderbufferID *>(renderbuffers);
4060         SCOPED_SHARE_CONTEXT_LOCK(context);
4061         bool isCallValid =
4062             (context->skipValidation() ||
4063              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4064                                                 context->getMutableErrorSetForValidation(),
4065                                                 angle::EntryPoint::GLCreateRenderbuffers) &&
4066               ValidateCreateRenderbuffers(context, angle::EntryPoint::GLCreateRenderbuffers, n,
4067                                           renderbuffersPacked)));
4068         if (isCallValid)
4069         {
4070             context->createRenderbuffers(n, renderbuffersPacked);
4071         }
4072         ANGLE_CAPTURE_GL(CreateRenderbuffers, isCallValid, context, n, renderbuffersPacked);
4073     }
4074     else
4075     {
4076         GenerateContextLostErrorOnCurrentGlobalContext();
4077     }
4078     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4079 }
4080 
GL_CreateSamplers(GLsizei n,GLuint * samplers)4081 void GL_APIENTRY GL_CreateSamplers(GLsizei n, GLuint *samplers)
4082 {
4083     Context *context = GetValidGlobalContext();
4084     EVENT(context, GLCreateSamplers, "context = %d, n = %d, samplers = 0x%016" PRIxPTR "",
4085           CID(context), n, (uintptr_t)samplers);
4086 
4087     if (context)
4088     {
4089         SCOPED_SHARE_CONTEXT_LOCK(context);
4090         bool isCallValid =
4091             (context->skipValidation() ||
4092              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4093                                                 context->getMutableErrorSetForValidation(),
4094                                                 angle::EntryPoint::GLCreateSamplers) &&
4095               ValidateCreateSamplers(context, angle::EntryPoint::GLCreateSamplers, n, samplers)));
4096         if (isCallValid)
4097         {
4098             context->createSamplers(n, samplers);
4099         }
4100         ANGLE_CAPTURE_GL(CreateSamplers, isCallValid, context, n, samplers);
4101     }
4102     else
4103     {
4104         GenerateContextLostErrorOnCurrentGlobalContext();
4105     }
4106     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4107 }
4108 
GL_CreateTextures(GLenum target,GLsizei n,GLuint * textures)4109 void GL_APIENTRY GL_CreateTextures(GLenum target, GLsizei n, GLuint *textures)
4110 {
4111     Context *context = GetValidGlobalContext();
4112     EVENT(context, GLCreateTextures,
4113           "context = %d, target = %s, n = %d, textures = 0x%016" PRIxPTR "", CID(context),
4114           GLenumToString(BigGLEnum::TextureTarget, target), n, (uintptr_t)textures);
4115 
4116     if (context)
4117     {
4118         SCOPED_SHARE_CONTEXT_LOCK(context);
4119         bool isCallValid =
4120             (context->skipValidation() ||
4121              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4122                                                 context->getMutableErrorSetForValidation(),
4123                                                 angle::EntryPoint::GLCreateTextures) &&
4124               ValidateCreateTextures(context, angle::EntryPoint::GLCreateTextures, target, n,
4125                                      textures)));
4126         if (isCallValid)
4127         {
4128             context->createTextures(target, n, textures);
4129         }
4130         ANGLE_CAPTURE_GL(CreateTextures, isCallValid, context, target, n, textures);
4131     }
4132     else
4133     {
4134         GenerateContextLostErrorOnCurrentGlobalContext();
4135     }
4136     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4137 }
4138 
GL_CreateTransformFeedbacks(GLsizei n,GLuint * ids)4139 void GL_APIENTRY GL_CreateTransformFeedbacks(GLsizei n, GLuint *ids)
4140 {
4141     Context *context = GetValidGlobalContext();
4142     EVENT(context, GLCreateTransformFeedbacks, "context = %d, n = %d, ids = 0x%016" PRIxPTR "",
4143           CID(context), n, (uintptr_t)ids);
4144 
4145     if (context)
4146     {
4147         SCOPED_SHARE_CONTEXT_LOCK(context);
4148         bool isCallValid =
4149             (context->skipValidation() ||
4150              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4151                                                 context->getMutableErrorSetForValidation(),
4152                                                 angle::EntryPoint::GLCreateTransformFeedbacks) &&
4153               ValidateCreateTransformFeedbacks(
4154                   context, angle::EntryPoint::GLCreateTransformFeedbacks, n, ids)));
4155         if (isCallValid)
4156         {
4157             context->createTransformFeedbacks(n, ids);
4158         }
4159         ANGLE_CAPTURE_GL(CreateTransformFeedbacks, isCallValid, context, n, ids);
4160     }
4161     else
4162     {
4163         GenerateContextLostErrorOnCurrentGlobalContext();
4164     }
4165     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4166 }
4167 
GL_CreateVertexArrays(GLsizei n,GLuint * arrays)4168 void GL_APIENTRY GL_CreateVertexArrays(GLsizei n, GLuint *arrays)
4169 {
4170     Context *context = GetValidGlobalContext();
4171     EVENT(context, GLCreateVertexArrays, "context = %d, n = %d, arrays = 0x%016" PRIxPTR "",
4172           CID(context), n, (uintptr_t)arrays);
4173 
4174     if (context)
4175     {
4176         VertexArrayID *arraysPacked = PackParam<VertexArrayID *>(arrays);
4177         SCOPED_SHARE_CONTEXT_LOCK(context);
4178         bool isCallValid =
4179             (context->skipValidation() ||
4180              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4181                                                 context->getMutableErrorSetForValidation(),
4182                                                 angle::EntryPoint::GLCreateVertexArrays) &&
4183               ValidateCreateVertexArrays(context, angle::EntryPoint::GLCreateVertexArrays, n,
4184                                          arraysPacked)));
4185         if (isCallValid)
4186         {
4187             context->createVertexArrays(n, arraysPacked);
4188         }
4189         ANGLE_CAPTURE_GL(CreateVertexArrays, isCallValid, context, n, arraysPacked);
4190     }
4191     else
4192     {
4193         GenerateContextLostErrorOnCurrentGlobalContext();
4194     }
4195     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4196 }
4197 
GL_DisableVertexArrayAttrib(GLuint vaobj,GLuint index)4198 void GL_APIENTRY GL_DisableVertexArrayAttrib(GLuint vaobj, GLuint index)
4199 {
4200     Context *context = GetValidGlobalContext();
4201     EVENT(context, GLDisableVertexArrayAttrib, "context = %d, vaobj = %u, index = %u", CID(context),
4202           vaobj, index);
4203 
4204     if (context)
4205     {
4206         VertexArrayID vaobjPacked = PackParam<VertexArrayID>(vaobj);
4207         SCOPED_SHARE_CONTEXT_LOCK(context);
4208         bool isCallValid =
4209             (context->skipValidation() ||
4210              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4211                                                 context->getMutableErrorSetForValidation(),
4212                                                 angle::EntryPoint::GLDisableVertexArrayAttrib) &&
4213               ValidateDisableVertexArrayAttrib(
4214                   context, angle::EntryPoint::GLDisableVertexArrayAttrib, vaobjPacked, index)));
4215         if (isCallValid)
4216         {
4217             context->disableVertexArrayAttrib(vaobjPacked, index);
4218         }
4219         ANGLE_CAPTURE_GL(DisableVertexArrayAttrib, isCallValid, context, vaobjPacked, index);
4220     }
4221     else
4222     {
4223         GenerateContextLostErrorOnCurrentGlobalContext();
4224     }
4225     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4226 }
4227 
GL_EnableVertexArrayAttrib(GLuint vaobj,GLuint index)4228 void GL_APIENTRY GL_EnableVertexArrayAttrib(GLuint vaobj, GLuint index)
4229 {
4230     Context *context = GetValidGlobalContext();
4231     EVENT(context, GLEnableVertexArrayAttrib, "context = %d, vaobj = %u, index = %u", CID(context),
4232           vaobj, index);
4233 
4234     if (context)
4235     {
4236         VertexArrayID vaobjPacked = PackParam<VertexArrayID>(vaobj);
4237         SCOPED_SHARE_CONTEXT_LOCK(context);
4238         bool isCallValid =
4239             (context->skipValidation() ||
4240              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4241                                                 context->getMutableErrorSetForValidation(),
4242                                                 angle::EntryPoint::GLEnableVertexArrayAttrib) &&
4243               ValidateEnableVertexArrayAttrib(context, angle::EntryPoint::GLEnableVertexArrayAttrib,
4244                                               vaobjPacked, index)));
4245         if (isCallValid)
4246         {
4247             context->enableVertexArrayAttrib(vaobjPacked, index);
4248         }
4249         ANGLE_CAPTURE_GL(EnableVertexArrayAttrib, isCallValid, context, vaobjPacked, index);
4250     }
4251     else
4252     {
4253         GenerateContextLostErrorOnCurrentGlobalContext();
4254     }
4255     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4256 }
4257 
GL_FlushMappedNamedBufferRange(GLuint buffer,GLintptr offset,GLsizeiptr length)4258 void GL_APIENTRY GL_FlushMappedNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length)
4259 {
4260     Context *context = GetValidGlobalContext();
4261     EVENT(context, GLFlushMappedNamedBufferRange,
4262           "context = %d, buffer = %u, offset = %llu, length = %llu", CID(context), buffer,
4263           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length));
4264 
4265     if (context)
4266     {
4267         BufferID bufferPacked = PackParam<BufferID>(buffer);
4268         SCOPED_SHARE_CONTEXT_LOCK(context);
4269         bool isCallValid =
4270             (context->skipValidation() ||
4271              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4272                                                 context->getMutableErrorSetForValidation(),
4273                                                 angle::EntryPoint::GLFlushMappedNamedBufferRange) &&
4274               ValidateFlushMappedNamedBufferRange(context,
4275                                                   angle::EntryPoint::GLFlushMappedNamedBufferRange,
4276                                                   bufferPacked, offset, length)));
4277         if (isCallValid)
4278         {
4279             context->flushMappedNamedBufferRange(bufferPacked, offset, length);
4280         }
4281         ANGLE_CAPTURE_GL(FlushMappedNamedBufferRange, isCallValid, context, bufferPacked, offset,
4282                          length);
4283     }
4284     else
4285     {
4286         GenerateContextLostErrorOnCurrentGlobalContext();
4287     }
4288     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4289 }
4290 
GL_GenerateTextureMipmap(GLuint texture)4291 void GL_APIENTRY GL_GenerateTextureMipmap(GLuint texture)
4292 {
4293     Context *context = GetValidGlobalContext();
4294     EVENT(context, GLGenerateTextureMipmap, "context = %d, texture = %u", CID(context), texture);
4295 
4296     if (context)
4297     {
4298         TextureID texturePacked = PackParam<TextureID>(texture);
4299         SCOPED_SHARE_CONTEXT_LOCK(context);
4300         bool isCallValid =
4301             (context->skipValidation() ||
4302              ValidateGenerateTextureMipmap(context, angle::EntryPoint::GLGenerateTextureMipmap,
4303                                            texturePacked));
4304         if (isCallValid)
4305         {
4306             context->generateTextureMipmap(texturePacked);
4307         }
4308         ANGLE_CAPTURE_GL(GenerateTextureMipmap, isCallValid, context, texturePacked);
4309     }
4310     else
4311     {
4312         GenerateContextLostErrorOnCurrentGlobalContext();
4313     }
4314     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4315 }
4316 
GL_GetCompressedTextureImage(GLuint texture,GLint level,GLsizei bufSize,void * pixels)4317 void GL_APIENTRY GL_GetCompressedTextureImage(GLuint texture,
4318                                               GLint level,
4319                                               GLsizei bufSize,
4320                                               void *pixels)
4321 {
4322     Context *context = GetValidGlobalContext();
4323     EVENT(context, GLGetCompressedTextureImage,
4324           "context = %d, texture = %u, level = %d, bufSize = %d, pixels = 0x%016" PRIxPTR "",
4325           CID(context), texture, level, bufSize, (uintptr_t)pixels);
4326 
4327     if (context)
4328     {
4329         TextureID texturePacked = PackParam<TextureID>(texture);
4330         SCOPED_SHARE_CONTEXT_LOCK(context);
4331         bool isCallValid = (context->skipValidation() ||
4332                             ValidateGetCompressedTextureImage(
4333                                 context, angle::EntryPoint::GLGetCompressedTextureImage,
4334                                 texturePacked, level, bufSize, pixels));
4335         if (isCallValid)
4336         {
4337             context->getCompressedTextureImage(texturePacked, level, bufSize, pixels);
4338         }
4339         ANGLE_CAPTURE_GL(GetCompressedTextureImage, isCallValid, context, texturePacked, level,
4340                          bufSize, pixels);
4341     }
4342     else
4343     {
4344         GenerateContextLostErrorOnCurrentGlobalContext();
4345     }
4346     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4347 }
4348 
GL_GetCompressedTextureSubImage(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLsizei bufSize,void * pixels)4349 void GL_APIENTRY GL_GetCompressedTextureSubImage(GLuint texture,
4350                                                  GLint level,
4351                                                  GLint xoffset,
4352                                                  GLint yoffset,
4353                                                  GLint zoffset,
4354                                                  GLsizei width,
4355                                                  GLsizei height,
4356                                                  GLsizei depth,
4357                                                  GLsizei bufSize,
4358                                                  void *pixels)
4359 {
4360     Context *context = GetValidGlobalContext();
4361     EVENT(context, GLGetCompressedTextureSubImage,
4362           "context = %d, texture = %u, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width "
4363           "= %d, height = %d, depth = %d, bufSize = %d, pixels = 0x%016" PRIxPTR "",
4364           CID(context), texture, level, xoffset, yoffset, zoffset, width, height, depth, bufSize,
4365           (uintptr_t)pixels);
4366 
4367     if (context)
4368     {
4369         TextureID texturePacked = PackParam<TextureID>(texture);
4370         SCOPED_SHARE_CONTEXT_LOCK(context);
4371         bool isCallValid =
4372             (context->skipValidation() ||
4373              ValidateGetCompressedTextureSubImage(
4374                  context, angle::EntryPoint::GLGetCompressedTextureSubImage, texturePacked, level,
4375                  xoffset, yoffset, zoffset, width, height, depth, bufSize, pixels));
4376         if (isCallValid)
4377         {
4378             context->getCompressedTextureSubImage(texturePacked, level, xoffset, yoffset, zoffset,
4379                                                   width, height, depth, bufSize, pixels);
4380         }
4381         ANGLE_CAPTURE_GL(GetCompressedTextureSubImage, isCallValid, context, texturePacked, level,
4382                          xoffset, yoffset, zoffset, width, height, depth, bufSize, pixels);
4383     }
4384     else
4385     {
4386         GenerateContextLostErrorOnCurrentGlobalContext();
4387     }
4388     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4389 }
4390 
GL_GetNamedBufferParameteri64v(GLuint buffer,GLenum pname,GLint64 * params)4391 void GL_APIENTRY GL_GetNamedBufferParameteri64v(GLuint buffer, GLenum pname, GLint64 *params)
4392 {
4393     Context *context = GetValidGlobalContext();
4394     EVENT(context, GLGetNamedBufferParameteri64v,
4395           "context = %d, buffer = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), buffer,
4396           GLenumToString(BigGLEnum::AllEnums, pname), (uintptr_t)params);
4397 
4398     if (context)
4399     {
4400         BufferID bufferPacked = PackParam<BufferID>(buffer);
4401         SCOPED_SHARE_CONTEXT_LOCK(context);
4402         bool isCallValid = (context->skipValidation() ||
4403                             ValidateGetNamedBufferParameteri64v(
4404                                 context, angle::EntryPoint::GLGetNamedBufferParameteri64v,
4405                                 bufferPacked, pname, params));
4406         if (isCallValid)
4407         {
4408             context->getNamedBufferParameteri64v(bufferPacked, pname, params);
4409         }
4410         ANGLE_CAPTURE_GL(GetNamedBufferParameteri64v, isCallValid, context, bufferPacked, pname,
4411                          params);
4412     }
4413     else
4414     {
4415         GenerateContextLostErrorOnCurrentGlobalContext();
4416     }
4417     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4418 }
4419 
GL_GetNamedBufferParameteriv(GLuint buffer,GLenum pname,GLint * params)4420 void GL_APIENTRY GL_GetNamedBufferParameteriv(GLuint buffer, GLenum pname, GLint *params)
4421 {
4422     Context *context = GetValidGlobalContext();
4423     EVENT(context, GLGetNamedBufferParameteriv,
4424           "context = %d, buffer = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), buffer,
4425           GLenumToString(BigGLEnum::AllEnums, pname), (uintptr_t)params);
4426 
4427     if (context)
4428     {
4429         BufferID bufferPacked = PackParam<BufferID>(buffer);
4430         SCOPED_SHARE_CONTEXT_LOCK(context);
4431         bool isCallValid = (context->skipValidation() ||
4432                             ValidateGetNamedBufferParameteriv(
4433                                 context, angle::EntryPoint::GLGetNamedBufferParameteriv,
4434                                 bufferPacked, pname, params));
4435         if (isCallValid)
4436         {
4437             context->getNamedBufferParameteriv(bufferPacked, pname, params);
4438         }
4439         ANGLE_CAPTURE_GL(GetNamedBufferParameteriv, isCallValid, context, bufferPacked, pname,
4440                          params);
4441     }
4442     else
4443     {
4444         GenerateContextLostErrorOnCurrentGlobalContext();
4445     }
4446     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4447 }
4448 
GL_GetNamedBufferPointerv(GLuint buffer,GLenum pname,void ** params)4449 void GL_APIENTRY GL_GetNamedBufferPointerv(GLuint buffer, GLenum pname, void **params)
4450 {
4451     Context *context = GetValidGlobalContext();
4452     EVENT(context, GLGetNamedBufferPointerv,
4453           "context = %d, buffer = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), buffer,
4454           GLenumToString(BigGLEnum::AllEnums, pname), (uintptr_t)params);
4455 
4456     if (context)
4457     {
4458         BufferID bufferPacked = PackParam<BufferID>(buffer);
4459         SCOPED_SHARE_CONTEXT_LOCK(context);
4460         bool isCallValid =
4461             (context->skipValidation() ||
4462              ValidateGetNamedBufferPointerv(context, angle::EntryPoint::GLGetNamedBufferPointerv,
4463                                             bufferPacked, pname, params));
4464         if (isCallValid)
4465         {
4466             context->getNamedBufferPointerv(bufferPacked, pname, params);
4467         }
4468         ANGLE_CAPTURE_GL(GetNamedBufferPointerv, isCallValid, context, bufferPacked, pname, params);
4469     }
4470     else
4471     {
4472         GenerateContextLostErrorOnCurrentGlobalContext();
4473     }
4474     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4475 }
4476 
GL_GetNamedBufferSubData(GLuint buffer,GLintptr offset,GLsizeiptr size,void * data)4477 void GL_APIENTRY GL_GetNamedBufferSubData(GLuint buffer,
4478                                           GLintptr offset,
4479                                           GLsizeiptr size,
4480                                           void *data)
4481 {
4482     Context *context = GetValidGlobalContext();
4483     EVENT(context, GLGetNamedBufferSubData,
4484           "context = %d, buffer = %u, offset = %llu, size = %llu, data = 0x%016" PRIxPTR "",
4485           CID(context), buffer, static_cast<unsigned long long>(offset),
4486           static_cast<unsigned long long>(size), (uintptr_t)data);
4487 
4488     if (context)
4489     {
4490         BufferID bufferPacked = PackParam<BufferID>(buffer);
4491         SCOPED_SHARE_CONTEXT_LOCK(context);
4492         bool isCallValid =
4493             (context->skipValidation() ||
4494              ValidateGetNamedBufferSubData(context, angle::EntryPoint::GLGetNamedBufferSubData,
4495                                            bufferPacked, offset, size, data));
4496         if (isCallValid)
4497         {
4498             context->getNamedBufferSubData(bufferPacked, offset, size, data);
4499         }
4500         ANGLE_CAPTURE_GL(GetNamedBufferSubData, isCallValid, context, bufferPacked, offset, size,
4501                          data);
4502     }
4503     else
4504     {
4505         GenerateContextLostErrorOnCurrentGlobalContext();
4506     }
4507     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4508 }
4509 
GL_GetNamedFramebufferAttachmentParameteriv(GLuint framebuffer,GLenum attachment,GLenum pname,GLint * params)4510 void GL_APIENTRY GL_GetNamedFramebufferAttachmentParameteriv(GLuint framebuffer,
4511                                                              GLenum attachment,
4512                                                              GLenum pname,
4513                                                              GLint *params)
4514 {
4515     Context *context = GetValidGlobalContext();
4516     EVENT(context, GLGetNamedFramebufferAttachmentParameteriv,
4517           "context = %d, framebuffer = %u, attachment = %s, pname = %s, params = 0x%016" PRIxPTR "",
4518           CID(context), framebuffer, GLenumToString(BigGLEnum::FramebufferAttachment, attachment),
4519           GLenumToString(BigGLEnum::FramebufferAttachmentParameterName, pname), (uintptr_t)params);
4520 
4521     if (context)
4522     {
4523         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
4524         SCOPED_SHARE_CONTEXT_LOCK(context);
4525         bool isCallValid =
4526             (context->skipValidation() ||
4527              ValidateGetNamedFramebufferAttachmentParameteriv(
4528                  context, angle::EntryPoint::GLGetNamedFramebufferAttachmentParameteriv,
4529                  framebufferPacked, attachment, pname, params));
4530         if (isCallValid)
4531         {
4532             context->getNamedFramebufferAttachmentParameteriv(framebufferPacked, attachment, pname,
4533                                                               params);
4534         }
4535         ANGLE_CAPTURE_GL(GetNamedFramebufferAttachmentParameteriv, isCallValid, context,
4536                          framebufferPacked, attachment, pname, params);
4537     }
4538     else
4539     {
4540         GenerateContextLostErrorOnCurrentGlobalContext();
4541     }
4542     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4543 }
4544 
GL_GetNamedFramebufferParameteriv(GLuint framebuffer,GLenum pname,GLint * param)4545 void GL_APIENTRY GL_GetNamedFramebufferParameteriv(GLuint framebuffer, GLenum pname, GLint *param)
4546 {
4547     Context *context = GetValidGlobalContext();
4548     EVENT(context, GLGetNamedFramebufferParameteriv,
4549           "context = %d, framebuffer = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
4550           framebuffer, GLenumToString(BigGLEnum::GetFramebufferParameter, pname), (uintptr_t)param);
4551 
4552     if (context)
4553     {
4554         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
4555         SCOPED_SHARE_CONTEXT_LOCK(context);
4556         bool isCallValid = (context->skipValidation() ||
4557                             ValidateGetNamedFramebufferParameteriv(
4558                                 context, angle::EntryPoint::GLGetNamedFramebufferParameteriv,
4559                                 framebufferPacked, pname, param));
4560         if (isCallValid)
4561         {
4562             context->getNamedFramebufferParameteriv(framebufferPacked, pname, param);
4563         }
4564         ANGLE_CAPTURE_GL(GetNamedFramebufferParameteriv, isCallValid, context, framebufferPacked,
4565                          pname, param);
4566     }
4567     else
4568     {
4569         GenerateContextLostErrorOnCurrentGlobalContext();
4570     }
4571     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4572 }
4573 
GL_GetNamedRenderbufferParameteriv(GLuint renderbuffer,GLenum pname,GLint * params)4574 void GL_APIENTRY GL_GetNamedRenderbufferParameteriv(GLuint renderbuffer,
4575                                                     GLenum pname,
4576                                                     GLint *params)
4577 {
4578     Context *context = GetValidGlobalContext();
4579     EVENT(context, GLGetNamedRenderbufferParameteriv,
4580           "context = %d, renderbuffer = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
4581           renderbuffer, GLenumToString(BigGLEnum::RenderbufferParameterName, pname),
4582           (uintptr_t)params);
4583 
4584     if (context)
4585     {
4586         RenderbufferID renderbufferPacked = PackParam<RenderbufferID>(renderbuffer);
4587         SCOPED_SHARE_CONTEXT_LOCK(context);
4588         bool isCallValid = (context->skipValidation() ||
4589                             ValidateGetNamedRenderbufferParameteriv(
4590                                 context, angle::EntryPoint::GLGetNamedRenderbufferParameteriv,
4591                                 renderbufferPacked, pname, params));
4592         if (isCallValid)
4593         {
4594             context->getNamedRenderbufferParameteriv(renderbufferPacked, pname, params);
4595         }
4596         ANGLE_CAPTURE_GL(GetNamedRenderbufferParameteriv, isCallValid, context, renderbufferPacked,
4597                          pname, params);
4598     }
4599     else
4600     {
4601         GenerateContextLostErrorOnCurrentGlobalContext();
4602     }
4603     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4604 }
4605 
GL_GetQueryBufferObjecti64v(GLuint id,GLuint buffer,GLenum pname,GLintptr offset)4606 void GL_APIENTRY GL_GetQueryBufferObjecti64v(GLuint id,
4607                                              GLuint buffer,
4608                                              GLenum pname,
4609                                              GLintptr offset)
4610 {
4611     Context *context = GetValidGlobalContext();
4612     EVENT(context, GLGetQueryBufferObjecti64v,
4613           "context = %d, id = %u, buffer = %u, pname = %s, offset = %llu", CID(context), id, buffer,
4614           GLenumToString(BigGLEnum::QueryObjectParameterName, pname),
4615           static_cast<unsigned long long>(offset));
4616 
4617     if (context)
4618     {
4619         BufferID bufferPacked = PackParam<BufferID>(buffer);
4620         SCOPED_SHARE_CONTEXT_LOCK(context);
4621         bool isCallValid = (context->skipValidation() ||
4622                             ValidateGetQueryBufferObjecti64v(
4623                                 context, angle::EntryPoint::GLGetQueryBufferObjecti64v, id,
4624                                 bufferPacked, pname, offset));
4625         if (isCallValid)
4626         {
4627             context->getQueryBufferObjecti64v(id, bufferPacked, pname, offset);
4628         }
4629         ANGLE_CAPTURE_GL(GetQueryBufferObjecti64v, isCallValid, context, id, bufferPacked, pname,
4630                          offset);
4631     }
4632     else
4633     {
4634         GenerateContextLostErrorOnCurrentGlobalContext();
4635     }
4636     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4637 }
4638 
GL_GetQueryBufferObjectiv(GLuint id,GLuint buffer,GLenum pname,GLintptr offset)4639 void GL_APIENTRY GL_GetQueryBufferObjectiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset)
4640 {
4641     Context *context = GetValidGlobalContext();
4642     EVENT(context, GLGetQueryBufferObjectiv,
4643           "context = %d, id = %u, buffer = %u, pname = %s, offset = %llu", CID(context), id, buffer,
4644           GLenumToString(BigGLEnum::QueryObjectParameterName, pname),
4645           static_cast<unsigned long long>(offset));
4646 
4647     if (context)
4648     {
4649         BufferID bufferPacked = PackParam<BufferID>(buffer);
4650         SCOPED_SHARE_CONTEXT_LOCK(context);
4651         bool isCallValid =
4652             (context->skipValidation() ||
4653              ValidateGetQueryBufferObjectiv(context, angle::EntryPoint::GLGetQueryBufferObjectiv,
4654                                             id, bufferPacked, pname, offset));
4655         if (isCallValid)
4656         {
4657             context->getQueryBufferObjectiv(id, bufferPacked, pname, offset);
4658         }
4659         ANGLE_CAPTURE_GL(GetQueryBufferObjectiv, isCallValid, context, id, bufferPacked, pname,
4660                          offset);
4661     }
4662     else
4663     {
4664         GenerateContextLostErrorOnCurrentGlobalContext();
4665     }
4666     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4667 }
4668 
GL_GetQueryBufferObjectui64v(GLuint id,GLuint buffer,GLenum pname,GLintptr offset)4669 void GL_APIENTRY GL_GetQueryBufferObjectui64v(GLuint id,
4670                                               GLuint buffer,
4671                                               GLenum pname,
4672                                               GLintptr offset)
4673 {
4674     Context *context = GetValidGlobalContext();
4675     EVENT(context, GLGetQueryBufferObjectui64v,
4676           "context = %d, id = %u, buffer = %u, pname = %s, offset = %llu", CID(context), id, buffer,
4677           GLenumToString(BigGLEnum::QueryObjectParameterName, pname),
4678           static_cast<unsigned long long>(offset));
4679 
4680     if (context)
4681     {
4682         BufferID bufferPacked = PackParam<BufferID>(buffer);
4683         SCOPED_SHARE_CONTEXT_LOCK(context);
4684         bool isCallValid = (context->skipValidation() ||
4685                             ValidateGetQueryBufferObjectui64v(
4686                                 context, angle::EntryPoint::GLGetQueryBufferObjectui64v, id,
4687                                 bufferPacked, pname, offset));
4688         if (isCallValid)
4689         {
4690             context->getQueryBufferObjectui64v(id, bufferPacked, pname, offset);
4691         }
4692         ANGLE_CAPTURE_GL(GetQueryBufferObjectui64v, isCallValid, context, id, bufferPacked, pname,
4693                          offset);
4694     }
4695     else
4696     {
4697         GenerateContextLostErrorOnCurrentGlobalContext();
4698     }
4699     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4700 }
4701 
GL_GetQueryBufferObjectuiv(GLuint id,GLuint buffer,GLenum pname,GLintptr offset)4702 void GL_APIENTRY GL_GetQueryBufferObjectuiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset)
4703 {
4704     Context *context = GetValidGlobalContext();
4705     EVENT(context, GLGetQueryBufferObjectuiv,
4706           "context = %d, id = %u, buffer = %u, pname = %s, offset = %llu", CID(context), id, buffer,
4707           GLenumToString(BigGLEnum::QueryObjectParameterName, pname),
4708           static_cast<unsigned long long>(offset));
4709 
4710     if (context)
4711     {
4712         BufferID bufferPacked = PackParam<BufferID>(buffer);
4713         SCOPED_SHARE_CONTEXT_LOCK(context);
4714         bool isCallValid =
4715             (context->skipValidation() ||
4716              ValidateGetQueryBufferObjectuiv(context, angle::EntryPoint::GLGetQueryBufferObjectuiv,
4717                                              id, bufferPacked, pname, offset));
4718         if (isCallValid)
4719         {
4720             context->getQueryBufferObjectuiv(id, bufferPacked, pname, offset);
4721         }
4722         ANGLE_CAPTURE_GL(GetQueryBufferObjectuiv, isCallValid, context, id, bufferPacked, pname,
4723                          offset);
4724     }
4725     else
4726     {
4727         GenerateContextLostErrorOnCurrentGlobalContext();
4728     }
4729     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4730 }
4731 
GL_GetTextureImage(GLuint texture,GLint level,GLenum format,GLenum type,GLsizei bufSize,void * pixels)4732 void GL_APIENTRY GL_GetTextureImage(GLuint texture,
4733                                     GLint level,
4734                                     GLenum format,
4735                                     GLenum type,
4736                                     GLsizei bufSize,
4737                                     void *pixels)
4738 {
4739     Context *context = GetValidGlobalContext();
4740     EVENT(context, GLGetTextureImage,
4741           "context = %d, texture = %u, level = %d, format = %s, type = %s, bufSize = %d, pixels = "
4742           "0x%016" PRIxPTR "",
4743           CID(context), texture, level, GLenumToString(BigGLEnum::PixelFormat, format),
4744           GLenumToString(BigGLEnum::PixelType, type), bufSize, (uintptr_t)pixels);
4745 
4746     if (context)
4747     {
4748         TextureID texturePacked = PackParam<TextureID>(texture);
4749         SCOPED_SHARE_CONTEXT_LOCK(context);
4750         bool isCallValid =
4751             (context->skipValidation() ||
4752              ValidateGetTextureImage(context, angle::EntryPoint::GLGetTextureImage, texturePacked,
4753                                      level, format, type, bufSize, pixels));
4754         if (isCallValid)
4755         {
4756             context->getTextureImage(texturePacked, level, format, type, bufSize, pixels);
4757         }
4758         ANGLE_CAPTURE_GL(GetTextureImage, isCallValid, context, texturePacked, level, format, type,
4759                          bufSize, pixels);
4760     }
4761     else
4762     {
4763         GenerateContextLostErrorOnCurrentGlobalContext();
4764     }
4765     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4766 }
4767 
GL_GetTextureLevelParameterfv(GLuint texture,GLint level,GLenum pname,GLfloat * params)4768 void GL_APIENTRY GL_GetTextureLevelParameterfv(GLuint texture,
4769                                                GLint level,
4770                                                GLenum pname,
4771                                                GLfloat *params)
4772 {
4773     Context *context = GetValidGlobalContext();
4774     EVENT(context, GLGetTextureLevelParameterfv,
4775           "context = %d, texture = %u, level = %d, pname = %s, params = 0x%016" PRIxPTR "",
4776           CID(context), texture, level, GLenumToString(BigGLEnum::GetTextureParameter, pname),
4777           (uintptr_t)params);
4778 
4779     if (context)
4780     {
4781         TextureID texturePacked = PackParam<TextureID>(texture);
4782         SCOPED_SHARE_CONTEXT_LOCK(context);
4783         bool isCallValid = (context->skipValidation() ||
4784                             ValidateGetTextureLevelParameterfv(
4785                                 context, angle::EntryPoint::GLGetTextureLevelParameterfv,
4786                                 texturePacked, level, pname, params));
4787         if (isCallValid)
4788         {
4789             context->getTextureLevelParameterfv(texturePacked, level, pname, params);
4790         }
4791         ANGLE_CAPTURE_GL(GetTextureLevelParameterfv, isCallValid, context, texturePacked, level,
4792                          pname, params);
4793     }
4794     else
4795     {
4796         GenerateContextLostErrorOnCurrentGlobalContext();
4797     }
4798     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4799 }
4800 
GL_GetTextureLevelParameteriv(GLuint texture,GLint level,GLenum pname,GLint * params)4801 void GL_APIENTRY GL_GetTextureLevelParameteriv(GLuint texture,
4802                                                GLint level,
4803                                                GLenum pname,
4804                                                GLint *params)
4805 {
4806     Context *context = GetValidGlobalContext();
4807     EVENT(context, GLGetTextureLevelParameteriv,
4808           "context = %d, texture = %u, level = %d, pname = %s, params = 0x%016" PRIxPTR "",
4809           CID(context), texture, level, GLenumToString(BigGLEnum::GetTextureParameter, pname),
4810           (uintptr_t)params);
4811 
4812     if (context)
4813     {
4814         TextureID texturePacked = PackParam<TextureID>(texture);
4815         SCOPED_SHARE_CONTEXT_LOCK(context);
4816         bool isCallValid = (context->skipValidation() ||
4817                             ValidateGetTextureLevelParameteriv(
4818                                 context, angle::EntryPoint::GLGetTextureLevelParameteriv,
4819                                 texturePacked, level, pname, params));
4820         if (isCallValid)
4821         {
4822             context->getTextureLevelParameteriv(texturePacked, level, pname, params);
4823         }
4824         ANGLE_CAPTURE_GL(GetTextureLevelParameteriv, isCallValid, context, texturePacked, level,
4825                          pname, params);
4826     }
4827     else
4828     {
4829         GenerateContextLostErrorOnCurrentGlobalContext();
4830     }
4831     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4832 }
4833 
GL_GetTextureParameterIiv(GLuint texture,GLenum pname,GLint * params)4834 void GL_APIENTRY GL_GetTextureParameterIiv(GLuint texture, GLenum pname, GLint *params)
4835 {
4836     Context *context = GetValidGlobalContext();
4837     EVENT(context, GLGetTextureParameterIiv,
4838           "context = %d, texture = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
4839           texture, GLenumToString(BigGLEnum::GetTextureParameter, pname), (uintptr_t)params);
4840 
4841     if (context)
4842     {
4843         TextureID texturePacked = PackParam<TextureID>(texture);
4844         SCOPED_SHARE_CONTEXT_LOCK(context);
4845         bool isCallValid =
4846             (context->skipValidation() ||
4847              ValidateGetTextureParameterIiv(context, angle::EntryPoint::GLGetTextureParameterIiv,
4848                                             texturePacked, pname, params));
4849         if (isCallValid)
4850         {
4851             context->getTextureParameterIiv(texturePacked, pname, params);
4852         }
4853         ANGLE_CAPTURE_GL(GetTextureParameterIiv, isCallValid, context, texturePacked, pname,
4854                          params);
4855     }
4856     else
4857     {
4858         GenerateContextLostErrorOnCurrentGlobalContext();
4859     }
4860     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4861 }
4862 
GL_GetTextureParameterIuiv(GLuint texture,GLenum pname,GLuint * params)4863 void GL_APIENTRY GL_GetTextureParameterIuiv(GLuint texture, GLenum pname, GLuint *params)
4864 {
4865     Context *context = GetValidGlobalContext();
4866     EVENT(context, GLGetTextureParameterIuiv,
4867           "context = %d, texture = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
4868           texture, GLenumToString(BigGLEnum::GetTextureParameter, pname), (uintptr_t)params);
4869 
4870     if (context)
4871     {
4872         TextureID texturePacked = PackParam<TextureID>(texture);
4873         SCOPED_SHARE_CONTEXT_LOCK(context);
4874         bool isCallValid =
4875             (context->skipValidation() ||
4876              ValidateGetTextureParameterIuiv(context, angle::EntryPoint::GLGetTextureParameterIuiv,
4877                                              texturePacked, pname, params));
4878         if (isCallValid)
4879         {
4880             context->getTextureParameterIuiv(texturePacked, pname, params);
4881         }
4882         ANGLE_CAPTURE_GL(GetTextureParameterIuiv, isCallValid, context, texturePacked, pname,
4883                          params);
4884     }
4885     else
4886     {
4887         GenerateContextLostErrorOnCurrentGlobalContext();
4888     }
4889     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4890 }
4891 
GL_GetTextureParameterfv(GLuint texture,GLenum pname,GLfloat * params)4892 void GL_APIENTRY GL_GetTextureParameterfv(GLuint texture, GLenum pname, GLfloat *params)
4893 {
4894     Context *context = GetValidGlobalContext();
4895     EVENT(context, GLGetTextureParameterfv,
4896           "context = %d, texture = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
4897           texture, GLenumToString(BigGLEnum::GetTextureParameter, pname), (uintptr_t)params);
4898 
4899     if (context)
4900     {
4901         TextureID texturePacked = PackParam<TextureID>(texture);
4902         SCOPED_SHARE_CONTEXT_LOCK(context);
4903         bool isCallValid =
4904             (context->skipValidation() ||
4905              ValidateGetTextureParameterfv(context, angle::EntryPoint::GLGetTextureParameterfv,
4906                                            texturePacked, pname, params));
4907         if (isCallValid)
4908         {
4909             context->getTextureParameterfv(texturePacked, pname, params);
4910         }
4911         ANGLE_CAPTURE_GL(GetTextureParameterfv, isCallValid, context, texturePacked, pname, params);
4912     }
4913     else
4914     {
4915         GenerateContextLostErrorOnCurrentGlobalContext();
4916     }
4917     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4918 }
4919 
GL_GetTextureParameteriv(GLuint texture,GLenum pname,GLint * params)4920 void GL_APIENTRY GL_GetTextureParameteriv(GLuint texture, GLenum pname, GLint *params)
4921 {
4922     Context *context = GetValidGlobalContext();
4923     EVENT(context, GLGetTextureParameteriv,
4924           "context = %d, texture = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
4925           texture, GLenumToString(BigGLEnum::GetTextureParameter, pname), (uintptr_t)params);
4926 
4927     if (context)
4928     {
4929         TextureID texturePacked = PackParam<TextureID>(texture);
4930         SCOPED_SHARE_CONTEXT_LOCK(context);
4931         bool isCallValid =
4932             (context->skipValidation() ||
4933              ValidateGetTextureParameteriv(context, angle::EntryPoint::GLGetTextureParameteriv,
4934                                            texturePacked, pname, params));
4935         if (isCallValid)
4936         {
4937             context->getTextureParameteriv(texturePacked, pname, params);
4938         }
4939         ANGLE_CAPTURE_GL(GetTextureParameteriv, isCallValid, context, texturePacked, pname, params);
4940     }
4941     else
4942     {
4943         GenerateContextLostErrorOnCurrentGlobalContext();
4944     }
4945     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4946 }
4947 
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)4948 void GL_APIENTRY GL_GetTextureSubImage(GLuint texture,
4949                                        GLint level,
4950                                        GLint xoffset,
4951                                        GLint yoffset,
4952                                        GLint zoffset,
4953                                        GLsizei width,
4954                                        GLsizei height,
4955                                        GLsizei depth,
4956                                        GLenum format,
4957                                        GLenum type,
4958                                        GLsizei bufSize,
4959                                        void *pixels)
4960 {
4961     Context *context = GetValidGlobalContext();
4962     EVENT(
4963         context, GLGetTextureSubImage,
4964         "context = %d, texture = %u, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width = "
4965         "%d, height = %d, depth = %d, format = %s, type = %s, bufSize = %d, pixels = 0x%016" PRIxPTR
4966         "",
4967         CID(context), texture, level, xoffset, yoffset, zoffset, width, height, depth,
4968         GLenumToString(BigGLEnum::PixelFormat, format), GLenumToString(BigGLEnum::PixelType, type),
4969         bufSize, (uintptr_t)pixels);
4970 
4971     if (context)
4972     {
4973         TextureID texturePacked = PackParam<TextureID>(texture);
4974         SCOPED_SHARE_CONTEXT_LOCK(context);
4975         bool isCallValid =
4976             (context->skipValidation() ||
4977              ValidateGetTextureSubImage(context, angle::EntryPoint::GLGetTextureSubImage,
4978                                         texturePacked, level, xoffset, yoffset, zoffset, width,
4979                                         height, depth, format, type, bufSize, pixels));
4980         if (isCallValid)
4981         {
4982             context->getTextureSubImage(texturePacked, level, xoffset, yoffset, zoffset, width,
4983                                         height, depth, format, type, bufSize, pixels);
4984         }
4985         ANGLE_CAPTURE_GL(GetTextureSubImage, isCallValid, context, texturePacked, level, xoffset,
4986                          yoffset, zoffset, width, height, depth, format, type, bufSize, pixels);
4987     }
4988     else
4989     {
4990         GenerateContextLostErrorOnCurrentGlobalContext();
4991     }
4992     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4993 }
4994 
GL_GetTransformFeedbacki64_v(GLuint xfb,GLenum pname,GLuint index,GLint64 * param)4995 void GL_APIENTRY GL_GetTransformFeedbacki64_v(GLuint xfb,
4996                                               GLenum pname,
4997                                               GLuint index,
4998                                               GLint64 *param)
4999 {
5000     Context *context = GetValidGlobalContext();
5001     EVENT(context, GLGetTransformFeedbacki64_v,
5002           "context = %d, xfb = %u, pname = %s, index = %u, param = 0x%016" PRIxPTR "", CID(context),
5003           xfb, GLenumToString(BigGLEnum::TransformFeedbackPName, pname), index, (uintptr_t)param);
5004 
5005     if (context)
5006     {
5007         SCOPED_SHARE_CONTEXT_LOCK(context);
5008         bool isCallValid = (context->skipValidation() ||
5009                             ValidateGetTransformFeedbacki64_v(
5010                                 context, angle::EntryPoint::GLGetTransformFeedbacki64_v, xfb, pname,
5011                                 index, param));
5012         if (isCallValid)
5013         {
5014             context->getTransformFeedbacki64_v(xfb, pname, index, param);
5015         }
5016         ANGLE_CAPTURE_GL(GetTransformFeedbacki64_v, isCallValid, context, xfb, pname, index, param);
5017     }
5018     else
5019     {
5020         GenerateContextLostErrorOnCurrentGlobalContext();
5021     }
5022     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5023 }
5024 
GL_GetTransformFeedbacki_v(GLuint xfb,GLenum pname,GLuint index,GLint * param)5025 void GL_APIENTRY GL_GetTransformFeedbacki_v(GLuint xfb, GLenum pname, GLuint index, GLint *param)
5026 {
5027     Context *context = GetValidGlobalContext();
5028     EVENT(context, GLGetTransformFeedbacki_v,
5029           "context = %d, xfb = %u, pname = %s, index = %u, param = 0x%016" PRIxPTR "", CID(context),
5030           xfb, GLenumToString(BigGLEnum::TransformFeedbackPName, pname), index, (uintptr_t)param);
5031 
5032     if (context)
5033     {
5034         SCOPED_SHARE_CONTEXT_LOCK(context);
5035         bool isCallValid =
5036             (context->skipValidation() ||
5037              ValidateGetTransformFeedbacki_v(context, angle::EntryPoint::GLGetTransformFeedbacki_v,
5038                                              xfb, pname, index, param));
5039         if (isCallValid)
5040         {
5041             context->getTransformFeedbacki_v(xfb, pname, index, param);
5042         }
5043         ANGLE_CAPTURE_GL(GetTransformFeedbacki_v, isCallValid, context, xfb, pname, index, param);
5044     }
5045     else
5046     {
5047         GenerateContextLostErrorOnCurrentGlobalContext();
5048     }
5049     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5050 }
5051 
GL_GetTransformFeedbackiv(GLuint xfb,GLenum pname,GLint * param)5052 void GL_APIENTRY GL_GetTransformFeedbackiv(GLuint xfb, GLenum pname, GLint *param)
5053 {
5054     Context *context = GetValidGlobalContext();
5055     EVENT(context, GLGetTransformFeedbackiv,
5056           "context = %d, xfb = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context), xfb,
5057           GLenumToString(BigGLEnum::TransformFeedbackPName, pname), (uintptr_t)param);
5058 
5059     if (context)
5060     {
5061         SCOPED_SHARE_CONTEXT_LOCK(context);
5062         bool isCallValid =
5063             (context->skipValidation() ||
5064              ValidateGetTransformFeedbackiv(context, angle::EntryPoint::GLGetTransformFeedbackiv,
5065                                             xfb, pname, param));
5066         if (isCallValid)
5067         {
5068             context->getTransformFeedbackiv(xfb, pname, param);
5069         }
5070         ANGLE_CAPTURE_GL(GetTransformFeedbackiv, isCallValid, context, xfb, pname, param);
5071     }
5072     else
5073     {
5074         GenerateContextLostErrorOnCurrentGlobalContext();
5075     }
5076     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5077 }
5078 
GL_GetVertexArrayIndexed64iv(GLuint vaobj,GLuint index,GLenum pname,GLint64 * param)5079 void GL_APIENTRY GL_GetVertexArrayIndexed64iv(GLuint vaobj,
5080                                               GLuint index,
5081                                               GLenum pname,
5082                                               GLint64 *param)
5083 {
5084     Context *context = GetValidGlobalContext();
5085     EVENT(context, GLGetVertexArrayIndexed64iv,
5086           "context = %d, vaobj = %u, index = %u, pname = %s, param = 0x%016" PRIxPTR "",
5087           CID(context), vaobj, index, GLenumToString(BigGLEnum::VertexArrayPName, pname),
5088           (uintptr_t)param);
5089 
5090     if (context)
5091     {
5092         VertexArrayID vaobjPacked = PackParam<VertexArrayID>(vaobj);
5093         SCOPED_SHARE_CONTEXT_LOCK(context);
5094         bool isCallValid = (context->skipValidation() ||
5095                             ValidateGetVertexArrayIndexed64iv(
5096                                 context, angle::EntryPoint::GLGetVertexArrayIndexed64iv,
5097                                 vaobjPacked, index, pname, param));
5098         if (isCallValid)
5099         {
5100             context->getVertexArrayIndexed64iv(vaobjPacked, index, pname, param);
5101         }
5102         ANGLE_CAPTURE_GL(GetVertexArrayIndexed64iv, isCallValid, context, vaobjPacked, index, pname,
5103                          param);
5104     }
5105     else
5106     {
5107         GenerateContextLostErrorOnCurrentGlobalContext();
5108     }
5109     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5110 }
5111 
GL_GetVertexArrayIndexediv(GLuint vaobj,GLuint index,GLenum pname,GLint * param)5112 void GL_APIENTRY GL_GetVertexArrayIndexediv(GLuint vaobj, GLuint index, GLenum pname, GLint *param)
5113 {
5114     Context *context = GetValidGlobalContext();
5115     EVENT(context, GLGetVertexArrayIndexediv,
5116           "context = %d, vaobj = %u, index = %u, pname = %s, param = 0x%016" PRIxPTR "",
5117           CID(context), vaobj, index, GLenumToString(BigGLEnum::VertexArrayPName, pname),
5118           (uintptr_t)param);
5119 
5120     if (context)
5121     {
5122         VertexArrayID vaobjPacked = PackParam<VertexArrayID>(vaobj);
5123         SCOPED_SHARE_CONTEXT_LOCK(context);
5124         bool isCallValid =
5125             (context->skipValidation() ||
5126              ValidateGetVertexArrayIndexediv(context, angle::EntryPoint::GLGetVertexArrayIndexediv,
5127                                              vaobjPacked, index, pname, param));
5128         if (isCallValid)
5129         {
5130             context->getVertexArrayIndexediv(vaobjPacked, index, pname, param);
5131         }
5132         ANGLE_CAPTURE_GL(GetVertexArrayIndexediv, isCallValid, context, vaobjPacked, index, pname,
5133                          param);
5134     }
5135     else
5136     {
5137         GenerateContextLostErrorOnCurrentGlobalContext();
5138     }
5139     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5140 }
5141 
GL_GetVertexArrayiv(GLuint vaobj,GLenum pname,GLint * param)5142 void GL_APIENTRY GL_GetVertexArrayiv(GLuint vaobj, GLenum pname, GLint *param)
5143 {
5144     Context *context = GetValidGlobalContext();
5145     EVENT(context, GLGetVertexArrayiv,
5146           "context = %d, vaobj = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context), vaobj,
5147           GLenumToString(BigGLEnum::VertexArrayPName, pname), (uintptr_t)param);
5148 
5149     if (context)
5150     {
5151         VertexArrayID vaobjPacked = PackParam<VertexArrayID>(vaobj);
5152         SCOPED_SHARE_CONTEXT_LOCK(context);
5153         bool isCallValid = (context->skipValidation() ||
5154                             ValidateGetVertexArrayiv(context, angle::EntryPoint::GLGetVertexArrayiv,
5155                                                      vaobjPacked, pname, param));
5156         if (isCallValid)
5157         {
5158             context->getVertexArrayiv(vaobjPacked, pname, param);
5159         }
5160         ANGLE_CAPTURE_GL(GetVertexArrayiv, isCallValid, context, vaobjPacked, pname, param);
5161     }
5162     else
5163     {
5164         GenerateContextLostErrorOnCurrentGlobalContext();
5165     }
5166     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5167 }
5168 
5169 void GL_APIENTRY
GL_GetnColorTable(GLenum target,GLenum format,GLenum type,GLsizei bufSize,void * table)5170 GL_GetnColorTable(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table)
5171 {
5172     Context *context = GetValidGlobalContext();
5173     EVENT(context, GLGetnColorTable,
5174           "context = %d, target = %s, format = %s, type = %s, bufSize = %d, table = 0x%016" PRIxPTR
5175           "",
5176           CID(context), GLenumToString(BigGLEnum::ColorTableTarget, target),
5177           GLenumToString(BigGLEnum::PixelFormat, format),
5178           GLenumToString(BigGLEnum::PixelType, type), bufSize, (uintptr_t)table);
5179 
5180     if (context)
5181     {
5182         SCOPED_SHARE_CONTEXT_LOCK(context);
5183         bool isCallValid = (context->skipValidation() ||
5184                             ValidateGetnColorTable(context, angle::EntryPoint::GLGetnColorTable,
5185                                                    target, format, type, bufSize, table));
5186         if (isCallValid)
5187         {
5188             context->getnColorTable(target, format, type, bufSize, table);
5189         }
5190         ANGLE_CAPTURE_GL(GetnColorTable, isCallValid, context, target, format, type, bufSize,
5191                          table);
5192     }
5193     else
5194     {
5195         GenerateContextLostErrorOnCurrentGlobalContext();
5196     }
5197     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5198 }
5199 
GL_GetnCompressedTexImage(GLenum target,GLint lod,GLsizei bufSize,void * pixels)5200 void GL_APIENTRY GL_GetnCompressedTexImage(GLenum target, GLint lod, GLsizei bufSize, void *pixels)
5201 {
5202     Context *context = GetValidGlobalContext();
5203     EVENT(context, GLGetnCompressedTexImage,
5204           "context = %d, target = %s, lod = %d, bufSize = %d, pixels = 0x%016" PRIxPTR "",
5205           CID(context), GLenumToString(BigGLEnum::TextureTarget, target), lod, bufSize,
5206           (uintptr_t)pixels);
5207 
5208     if (context)
5209     {
5210         SCOPED_SHARE_CONTEXT_LOCK(context);
5211         bool isCallValid =
5212             (context->skipValidation() ||
5213              ValidateGetnCompressedTexImage(context, angle::EntryPoint::GLGetnCompressedTexImage,
5214                                             target, lod, bufSize, pixels));
5215         if (isCallValid)
5216         {
5217             context->getnCompressedTexImage(target, lod, bufSize, pixels);
5218         }
5219         ANGLE_CAPTURE_GL(GetnCompressedTexImage, isCallValid, context, target, lod, bufSize,
5220                          pixels);
5221     }
5222     else
5223     {
5224         GenerateContextLostErrorOnCurrentGlobalContext();
5225     }
5226     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5227 }
5228 
5229 void GL_APIENTRY
GL_GetnConvolutionFilter(GLenum target,GLenum format,GLenum type,GLsizei bufSize,void * image)5230 GL_GetnConvolutionFilter(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image)
5231 {
5232     Context *context = GetValidGlobalContext();
5233     EVENT(context, GLGetnConvolutionFilter,
5234           "context = %d, target = %s, format = %s, type = %s, bufSize = %d, image = 0x%016" PRIxPTR
5235           "",
5236           CID(context), GLenumToString(BigGLEnum::ConvolutionTarget, target),
5237           GLenumToString(BigGLEnum::PixelFormat, format),
5238           GLenumToString(BigGLEnum::PixelType, type), bufSize, (uintptr_t)image);
5239 
5240     if (context)
5241     {
5242         SCOPED_SHARE_CONTEXT_LOCK(context);
5243         bool isCallValid =
5244             (context->skipValidation() ||
5245              ValidateGetnConvolutionFilter(context, angle::EntryPoint::GLGetnConvolutionFilter,
5246                                            target, format, type, bufSize, image));
5247         if (isCallValid)
5248         {
5249             context->getnConvolutionFilter(target, format, type, bufSize, image);
5250         }
5251         ANGLE_CAPTURE_GL(GetnConvolutionFilter, isCallValid, context, target, format, type, bufSize,
5252                          image);
5253     }
5254     else
5255     {
5256         GenerateContextLostErrorOnCurrentGlobalContext();
5257     }
5258     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5259 }
5260 
GL_GetnHistogram(GLenum target,GLboolean reset,GLenum format,GLenum type,GLsizei bufSize,void * values)5261 void GL_APIENTRY GL_GetnHistogram(GLenum target,
5262                                   GLboolean reset,
5263                                   GLenum format,
5264                                   GLenum type,
5265                                   GLsizei bufSize,
5266                                   void *values)
5267 {
5268     Context *context = GetValidGlobalContext();
5269     EVENT(context, GLGetnHistogram,
5270           "context = %d, target = %s, reset = %s, format = %s, type = %s, bufSize = %d, values = "
5271           "0x%016" PRIxPTR "",
5272           CID(context), GLenumToString(BigGLEnum::HistogramTarget, target),
5273           GLbooleanToString(reset), GLenumToString(BigGLEnum::PixelFormat, format),
5274           GLenumToString(BigGLEnum::PixelType, type), bufSize, (uintptr_t)values);
5275 
5276     if (context)
5277     {
5278         SCOPED_SHARE_CONTEXT_LOCK(context);
5279         bool isCallValid = (context->skipValidation() ||
5280                             ValidateGetnHistogram(context, angle::EntryPoint::GLGetnHistogram,
5281                                                   target, reset, format, type, bufSize, values));
5282         if (isCallValid)
5283         {
5284             context->getnHistogram(target, reset, format, type, bufSize, values);
5285         }
5286         ANGLE_CAPTURE_GL(GetnHistogram, isCallValid, context, target, reset, format, type, bufSize,
5287                          values);
5288     }
5289     else
5290     {
5291         GenerateContextLostErrorOnCurrentGlobalContext();
5292     }
5293     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5294 }
5295 
GL_GetnMapdv(GLenum target,GLenum query,GLsizei bufSize,GLdouble * v)5296 void GL_APIENTRY GL_GetnMapdv(GLenum target, GLenum query, GLsizei bufSize, GLdouble *v)
5297 {
5298     Context *context = GetValidGlobalContext();
5299     EVENT(context, GLGetnMapdv,
5300           "context = %d, target = %s, query = %s, bufSize = %d, v = 0x%016" PRIxPTR "",
5301           CID(context), GLenumToString(BigGLEnum::MapTarget, target),
5302           GLenumToString(BigGLEnum::MapQuery, query), bufSize, (uintptr_t)v);
5303 
5304     if (context)
5305     {
5306         SCOPED_SHARE_CONTEXT_LOCK(context);
5307         bool isCallValid =
5308             (context->skipValidation() ||
5309              ValidateGetnMapdv(context, angle::EntryPoint::GLGetnMapdv, target, query, bufSize, v));
5310         if (isCallValid)
5311         {
5312             context->getnMapdv(target, query, bufSize, v);
5313         }
5314         ANGLE_CAPTURE_GL(GetnMapdv, isCallValid, context, target, query, bufSize, v);
5315     }
5316     else
5317     {
5318         GenerateContextLostErrorOnCurrentGlobalContext();
5319     }
5320     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5321 }
5322 
GL_GetnMapfv(GLenum target,GLenum query,GLsizei bufSize,GLfloat * v)5323 void GL_APIENTRY GL_GetnMapfv(GLenum target, GLenum query, GLsizei bufSize, GLfloat *v)
5324 {
5325     Context *context = GetValidGlobalContext();
5326     EVENT(context, GLGetnMapfv,
5327           "context = %d, target = %s, query = %s, bufSize = %d, v = 0x%016" PRIxPTR "",
5328           CID(context), GLenumToString(BigGLEnum::MapTarget, target),
5329           GLenumToString(BigGLEnum::MapQuery, query), bufSize, (uintptr_t)v);
5330 
5331     if (context)
5332     {
5333         SCOPED_SHARE_CONTEXT_LOCK(context);
5334         bool isCallValid =
5335             (context->skipValidation() ||
5336              ValidateGetnMapfv(context, angle::EntryPoint::GLGetnMapfv, target, query, bufSize, v));
5337         if (isCallValid)
5338         {
5339             context->getnMapfv(target, query, bufSize, v);
5340         }
5341         ANGLE_CAPTURE_GL(GetnMapfv, isCallValid, context, target, query, bufSize, v);
5342     }
5343     else
5344     {
5345         GenerateContextLostErrorOnCurrentGlobalContext();
5346     }
5347     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5348 }
5349 
GL_GetnMapiv(GLenum target,GLenum query,GLsizei bufSize,GLint * v)5350 void GL_APIENTRY GL_GetnMapiv(GLenum target, GLenum query, GLsizei bufSize, GLint *v)
5351 {
5352     Context *context = GetValidGlobalContext();
5353     EVENT(context, GLGetnMapiv,
5354           "context = %d, target = %s, query = %s, bufSize = %d, v = 0x%016" PRIxPTR "",
5355           CID(context), GLenumToString(BigGLEnum::MapTarget, target),
5356           GLenumToString(BigGLEnum::MapQuery, query), bufSize, (uintptr_t)v);
5357 
5358     if (context)
5359     {
5360         SCOPED_SHARE_CONTEXT_LOCK(context);
5361         bool isCallValid =
5362             (context->skipValidation() ||
5363              ValidateGetnMapiv(context, angle::EntryPoint::GLGetnMapiv, target, query, bufSize, v));
5364         if (isCallValid)
5365         {
5366             context->getnMapiv(target, query, bufSize, v);
5367         }
5368         ANGLE_CAPTURE_GL(GetnMapiv, isCallValid, context, target, query, bufSize, v);
5369     }
5370     else
5371     {
5372         GenerateContextLostErrorOnCurrentGlobalContext();
5373     }
5374     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5375 }
5376 
GL_GetnMinmax(GLenum target,GLboolean reset,GLenum format,GLenum type,GLsizei bufSize,void * values)5377 void GL_APIENTRY GL_GetnMinmax(GLenum target,
5378                                GLboolean reset,
5379                                GLenum format,
5380                                GLenum type,
5381                                GLsizei bufSize,
5382                                void *values)
5383 {
5384     Context *context = GetValidGlobalContext();
5385     EVENT(context, GLGetnMinmax,
5386           "context = %d, target = %s, reset = %s, format = %s, type = %s, bufSize = %d, values = "
5387           "0x%016" PRIxPTR "",
5388           CID(context), GLenumToString(BigGLEnum::MinmaxTarget, target), GLbooleanToString(reset),
5389           GLenumToString(BigGLEnum::PixelFormat, format),
5390           GLenumToString(BigGLEnum::PixelType, type), bufSize, (uintptr_t)values);
5391 
5392     if (context)
5393     {
5394         SCOPED_SHARE_CONTEXT_LOCK(context);
5395         bool isCallValid = (context->skipValidation() ||
5396                             ValidateGetnMinmax(context, angle::EntryPoint::GLGetnMinmax, target,
5397                                                reset, format, type, bufSize, values));
5398         if (isCallValid)
5399         {
5400             context->getnMinmax(target, reset, format, type, bufSize, values);
5401         }
5402         ANGLE_CAPTURE_GL(GetnMinmax, isCallValid, context, target, reset, format, type, bufSize,
5403                          values);
5404     }
5405     else
5406     {
5407         GenerateContextLostErrorOnCurrentGlobalContext();
5408     }
5409     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5410 }
5411 
GL_GetnPixelMapfv(GLenum map,GLsizei bufSize,GLfloat * values)5412 void GL_APIENTRY GL_GetnPixelMapfv(GLenum map, GLsizei bufSize, GLfloat *values)
5413 {
5414     Context *context = GetValidGlobalContext();
5415     EVENT(context, GLGetnPixelMapfv,
5416           "context = %d, map = %s, bufSize = %d, values = 0x%016" PRIxPTR "", CID(context),
5417           GLenumToString(BigGLEnum::PixelMap, map), bufSize, (uintptr_t)values);
5418 
5419     if (context)
5420     {
5421         SCOPED_SHARE_CONTEXT_LOCK(context);
5422         bool isCallValid = (context->skipValidation() ||
5423                             ValidateGetnPixelMapfv(context, angle::EntryPoint::GLGetnPixelMapfv,
5424                                                    map, bufSize, values));
5425         if (isCallValid)
5426         {
5427             context->getnPixelMapfv(map, bufSize, values);
5428         }
5429         ANGLE_CAPTURE_GL(GetnPixelMapfv, isCallValid, context, map, bufSize, values);
5430     }
5431     else
5432     {
5433         GenerateContextLostErrorOnCurrentGlobalContext();
5434     }
5435     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5436 }
5437 
GL_GetnPixelMapuiv(GLenum map,GLsizei bufSize,GLuint * values)5438 void GL_APIENTRY GL_GetnPixelMapuiv(GLenum map, GLsizei bufSize, GLuint *values)
5439 {
5440     Context *context = GetValidGlobalContext();
5441     EVENT(context, GLGetnPixelMapuiv,
5442           "context = %d, map = %s, bufSize = %d, values = 0x%016" PRIxPTR "", CID(context),
5443           GLenumToString(BigGLEnum::PixelMap, map), bufSize, (uintptr_t)values);
5444 
5445     if (context)
5446     {
5447         SCOPED_SHARE_CONTEXT_LOCK(context);
5448         bool isCallValid = (context->skipValidation() ||
5449                             ValidateGetnPixelMapuiv(context, angle::EntryPoint::GLGetnPixelMapuiv,
5450                                                     map, bufSize, values));
5451         if (isCallValid)
5452         {
5453             context->getnPixelMapuiv(map, bufSize, values);
5454         }
5455         ANGLE_CAPTURE_GL(GetnPixelMapuiv, isCallValid, context, map, bufSize, values);
5456     }
5457     else
5458     {
5459         GenerateContextLostErrorOnCurrentGlobalContext();
5460     }
5461     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5462 }
5463 
GL_GetnPixelMapusv(GLenum map,GLsizei bufSize,GLushort * values)5464 void GL_APIENTRY GL_GetnPixelMapusv(GLenum map, GLsizei bufSize, GLushort *values)
5465 {
5466     Context *context = GetValidGlobalContext();
5467     EVENT(context, GLGetnPixelMapusv,
5468           "context = %d, map = %s, bufSize = %d, values = 0x%016" PRIxPTR "", CID(context),
5469           GLenumToString(BigGLEnum::PixelMap, map), bufSize, (uintptr_t)values);
5470 
5471     if (context)
5472     {
5473         SCOPED_SHARE_CONTEXT_LOCK(context);
5474         bool isCallValid = (context->skipValidation() ||
5475                             ValidateGetnPixelMapusv(context, angle::EntryPoint::GLGetnPixelMapusv,
5476                                                     map, bufSize, values));
5477         if (isCallValid)
5478         {
5479             context->getnPixelMapusv(map, bufSize, values);
5480         }
5481         ANGLE_CAPTURE_GL(GetnPixelMapusv, isCallValid, context, map, bufSize, values);
5482     }
5483     else
5484     {
5485         GenerateContextLostErrorOnCurrentGlobalContext();
5486     }
5487     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5488 }
5489 
GL_GetnPolygonStipple(GLsizei bufSize,GLubyte * pattern)5490 void GL_APIENTRY GL_GetnPolygonStipple(GLsizei bufSize, GLubyte *pattern)
5491 {
5492     Context *context = GetValidGlobalContext();
5493     EVENT(context, GLGetnPolygonStipple, "context = %d, bufSize = %d, pattern = 0x%016" PRIxPTR "",
5494           CID(context), bufSize, (uintptr_t)pattern);
5495 
5496     if (context)
5497     {
5498         SCOPED_SHARE_CONTEXT_LOCK(context);
5499         bool isCallValid =
5500             (context->skipValidation() ||
5501              ValidateGetnPolygonStipple(context, angle::EntryPoint::GLGetnPolygonStipple, bufSize,
5502                                         pattern));
5503         if (isCallValid)
5504         {
5505             context->getnPolygonStipple(bufSize, pattern);
5506         }
5507         ANGLE_CAPTURE_GL(GetnPolygonStipple, isCallValid, context, bufSize, pattern);
5508     }
5509     else
5510     {
5511         GenerateContextLostErrorOnCurrentGlobalContext();
5512     }
5513     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5514 }
5515 
GL_GetnSeparableFilter(GLenum target,GLenum format,GLenum type,GLsizei rowBufSize,void * row,GLsizei columnBufSize,void * column,void * span)5516 void GL_APIENTRY GL_GetnSeparableFilter(GLenum target,
5517                                         GLenum format,
5518                                         GLenum type,
5519                                         GLsizei rowBufSize,
5520                                         void *row,
5521                                         GLsizei columnBufSize,
5522                                         void *column,
5523                                         void *span)
5524 {
5525     Context *context = GetValidGlobalContext();
5526     EVENT(context, GLGetnSeparableFilter,
5527           "context = %d, target = %s, format = %s, type = %s, rowBufSize = %d, row = 0x%016" PRIxPTR
5528           ", columnBufSize = %d, column = 0x%016" PRIxPTR ", span = 0x%016" PRIxPTR "",
5529           CID(context), GLenumToString(BigGLEnum::SeparableTarget, target),
5530           GLenumToString(BigGLEnum::PixelFormat, format),
5531           GLenumToString(BigGLEnum::PixelType, type), rowBufSize, (uintptr_t)row, columnBufSize,
5532           (uintptr_t)column, (uintptr_t)span);
5533 
5534     if (context)
5535     {
5536         SCOPED_SHARE_CONTEXT_LOCK(context);
5537         bool isCallValid = (context->skipValidation() ||
5538                             ValidateGetnSeparableFilter(
5539                                 context, angle::EntryPoint::GLGetnSeparableFilter, target, format,
5540                                 type, rowBufSize, row, columnBufSize, column, span));
5541         if (isCallValid)
5542         {
5543             context->getnSeparableFilter(target, format, type, rowBufSize, row, columnBufSize,
5544                                          column, span);
5545         }
5546         ANGLE_CAPTURE_GL(GetnSeparableFilter, isCallValid, context, target, format, type,
5547                          rowBufSize, row, columnBufSize, column, span);
5548     }
5549     else
5550     {
5551         GenerateContextLostErrorOnCurrentGlobalContext();
5552     }
5553     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5554 }
5555 
GL_GetnTexImage(GLenum target,GLint level,GLenum format,GLenum type,GLsizei bufSize,void * pixels)5556 void GL_APIENTRY GL_GetnTexImage(GLenum target,
5557                                  GLint level,
5558                                  GLenum format,
5559                                  GLenum type,
5560                                  GLsizei bufSize,
5561                                  void *pixels)
5562 {
5563     Context *context = GetValidGlobalContext();
5564     EVENT(context, GLGetnTexImage,
5565           "context = %d, target = %s, level = %d, format = %s, type = %s, bufSize = %d, pixels = "
5566           "0x%016" PRIxPTR "",
5567           CID(context), GLenumToString(BigGLEnum::TextureTarget, target), level,
5568           GLenumToString(BigGLEnum::PixelFormat, format),
5569           GLenumToString(BigGLEnum::PixelType, type), bufSize, (uintptr_t)pixels);
5570 
5571     if (context)
5572     {
5573         SCOPED_SHARE_CONTEXT_LOCK(context);
5574         bool isCallValid = (context->skipValidation() ||
5575                             ValidateGetnTexImage(context, angle::EntryPoint::GLGetnTexImage, target,
5576                                                  level, format, type, bufSize, pixels));
5577         if (isCallValid)
5578         {
5579             context->getnTexImage(target, level, format, type, bufSize, pixels);
5580         }
5581         ANGLE_CAPTURE_GL(GetnTexImage, isCallValid, context, target, level, format, type, bufSize,
5582                          pixels);
5583     }
5584     else
5585     {
5586         GenerateContextLostErrorOnCurrentGlobalContext();
5587     }
5588     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5589 }
5590 
GL_GetnUniformdv(GLuint program,GLint location,GLsizei bufSize,GLdouble * params)5591 void GL_APIENTRY GL_GetnUniformdv(GLuint program, GLint location, GLsizei bufSize, GLdouble *params)
5592 {
5593     Context *context = GetValidGlobalContext();
5594     EVENT(context, GLGetnUniformdv,
5595           "context = %d, program = %u, location = %d, bufSize = %d, params = 0x%016" PRIxPTR "",
5596           CID(context), program, location, bufSize, (uintptr_t)params);
5597 
5598     if (context)
5599     {
5600         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
5601         UniformLocation locationPacked = PackParam<UniformLocation>(location);
5602         SCOPED_SHARE_CONTEXT_LOCK(context);
5603         bool isCallValid = (context->skipValidation() ||
5604                             ValidateGetnUniformdv(context, angle::EntryPoint::GLGetnUniformdv,
5605                                                   programPacked, locationPacked, bufSize, params));
5606         if (isCallValid)
5607         {
5608             context->getnUniformdv(programPacked, locationPacked, bufSize, params);
5609         }
5610         ANGLE_CAPTURE_GL(GetnUniformdv, isCallValid, context, programPacked, locationPacked,
5611                          bufSize, params);
5612     }
5613     else
5614     {
5615         GenerateContextLostErrorOnCurrentGlobalContext();
5616     }
5617     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5618 }
5619 
GL_InvalidateNamedFramebufferData(GLuint framebuffer,GLsizei numAttachments,const GLenum * attachments)5620 void GL_APIENTRY GL_InvalidateNamedFramebufferData(GLuint framebuffer,
5621                                                    GLsizei numAttachments,
5622                                                    const GLenum *attachments)
5623 {
5624     Context *context = GetValidGlobalContext();
5625     EVENT(context, GLInvalidateNamedFramebufferData,
5626           "context = %d, framebuffer = %u, numAttachments = %d, attachments = 0x%016" PRIxPTR "",
5627           CID(context), framebuffer, numAttachments, (uintptr_t)attachments);
5628 
5629     if (context)
5630     {
5631         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
5632         SCOPED_SHARE_CONTEXT_LOCK(context);
5633         bool isCallValid =
5634             (context->skipValidation() ||
5635              (ValidatePixelLocalStorageInactive(
5636                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
5637                   angle::EntryPoint::GLInvalidateNamedFramebufferData) &&
5638               ValidateInvalidateNamedFramebufferData(
5639                   context, angle::EntryPoint::GLInvalidateNamedFramebufferData, framebufferPacked,
5640                   numAttachments, attachments)));
5641         if (isCallValid)
5642         {
5643             context->invalidateNamedFramebufferData(framebufferPacked, numAttachments, attachments);
5644         }
5645         ANGLE_CAPTURE_GL(InvalidateNamedFramebufferData, isCallValid, context, framebufferPacked,
5646                          numAttachments, attachments);
5647     }
5648     else
5649     {
5650         GenerateContextLostErrorOnCurrentGlobalContext();
5651     }
5652     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5653 }
5654 
GL_InvalidateNamedFramebufferSubData(GLuint framebuffer,GLsizei numAttachments,const GLenum * attachments,GLint x,GLint y,GLsizei width,GLsizei height)5655 void GL_APIENTRY GL_InvalidateNamedFramebufferSubData(GLuint framebuffer,
5656                                                       GLsizei numAttachments,
5657                                                       const GLenum *attachments,
5658                                                       GLint x,
5659                                                       GLint y,
5660                                                       GLsizei width,
5661                                                       GLsizei height)
5662 {
5663     Context *context = GetValidGlobalContext();
5664     EVENT(context, GLInvalidateNamedFramebufferSubData,
5665           "context = %d, framebuffer = %u, numAttachments = %d, attachments = 0x%016" PRIxPTR
5666           ", x = %d, y = %d, width = %d, height = %d",
5667           CID(context), framebuffer, numAttachments, (uintptr_t)attachments, x, y, width, height);
5668 
5669     if (context)
5670     {
5671         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
5672         SCOPED_SHARE_CONTEXT_LOCK(context);
5673         bool isCallValid =
5674             (context->skipValidation() ||
5675              (ValidatePixelLocalStorageInactive(
5676                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
5677                   angle::EntryPoint::GLInvalidateNamedFramebufferSubData) &&
5678               ValidateInvalidateNamedFramebufferSubData(
5679                   context, angle::EntryPoint::GLInvalidateNamedFramebufferSubData,
5680                   framebufferPacked, numAttachments, attachments, x, y, width, height)));
5681         if (isCallValid)
5682         {
5683             context->invalidateNamedFramebufferSubData(framebufferPacked, numAttachments,
5684                                                        attachments, x, y, width, height);
5685         }
5686         ANGLE_CAPTURE_GL(InvalidateNamedFramebufferSubData, isCallValid, context, framebufferPacked,
5687                          numAttachments, attachments, x, y, width, height);
5688     }
5689     else
5690     {
5691         GenerateContextLostErrorOnCurrentGlobalContext();
5692     }
5693     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5694 }
5695 
GL_MapNamedBuffer(GLuint buffer,GLenum access)5696 void *GL_APIENTRY GL_MapNamedBuffer(GLuint buffer, GLenum access)
5697 {
5698     Context *context = GetValidGlobalContext();
5699     EVENT(context, GLMapNamedBuffer, "context = %d, buffer = %u, access = %s", CID(context), buffer,
5700           GLenumToString(BigGLEnum::BufferAccessARB, access));
5701 
5702     void *returnValue;
5703     if (context)
5704     {
5705         BufferID bufferPacked = PackParam<BufferID>(buffer);
5706         SCOPED_SHARE_CONTEXT_LOCK(context);
5707         bool isCallValid =
5708             (context->skipValidation() ||
5709              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
5710                                                 context->getMutableErrorSetForValidation(),
5711                                                 angle::EntryPoint::GLMapNamedBuffer) &&
5712               ValidateMapNamedBuffer(context, angle::EntryPoint::GLMapNamedBuffer, bufferPacked,
5713                                      access)));
5714         if (isCallValid)
5715         {
5716             returnValue = context->mapNamedBuffer(bufferPacked, access);
5717         }
5718         else
5719         {
5720             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapNamedBuffer, void *>();
5721         }
5722         ANGLE_CAPTURE_GL(MapNamedBuffer, isCallValid, context, bufferPacked, access, returnValue);
5723     }
5724     else
5725     {
5726         GenerateContextLostErrorOnCurrentGlobalContext();
5727         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapNamedBuffer, void *>();
5728     }
5729     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5730     return returnValue;
5731 }
5732 
GL_MapNamedBufferRange(GLuint buffer,GLintptr offset,GLsizeiptr length,GLbitfield access)5733 void *GL_APIENTRY GL_MapNamedBufferRange(GLuint buffer,
5734                                          GLintptr offset,
5735                                          GLsizeiptr length,
5736                                          GLbitfield access)
5737 {
5738     Context *context = GetValidGlobalContext();
5739     EVENT(context, GLMapNamedBufferRange,
5740           "context = %d, buffer = %u, offset = %llu, length = %llu, access = %s", CID(context),
5741           buffer, static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length),
5742           GLbitfieldToString(BigGLEnum::MapBufferAccessMask, access).c_str());
5743 
5744     void *returnValue;
5745     if (context)
5746     {
5747         BufferID bufferPacked = PackParam<BufferID>(buffer);
5748         SCOPED_SHARE_CONTEXT_LOCK(context);
5749         bool isCallValid =
5750             (context->skipValidation() ||
5751              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
5752                                                 context->getMutableErrorSetForValidation(),
5753                                                 angle::EntryPoint::GLMapNamedBufferRange) &&
5754               ValidateMapNamedBufferRange(context, angle::EntryPoint::GLMapNamedBufferRange,
5755                                           bufferPacked, offset, length, access)));
5756         if (isCallValid)
5757         {
5758             returnValue = context->mapNamedBufferRange(bufferPacked, offset, length, access);
5759         }
5760         else
5761         {
5762             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapNamedBufferRange, void *>();
5763         }
5764         ANGLE_CAPTURE_GL(MapNamedBufferRange, isCallValid, context, bufferPacked, offset, length,
5765                          access, returnValue);
5766     }
5767     else
5768     {
5769         GenerateContextLostErrorOnCurrentGlobalContext();
5770         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapNamedBufferRange, void *>();
5771     }
5772     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5773     return returnValue;
5774 }
5775 
GL_NamedBufferData(GLuint buffer,GLsizeiptr size,const void * data,GLenum usage)5776 void GL_APIENTRY GL_NamedBufferData(GLuint buffer, GLsizeiptr size, const void *data, GLenum usage)
5777 {
5778     Context *context = GetValidGlobalContext();
5779     EVENT(context, GLNamedBufferData,
5780           "context = %d, buffer = %u, size = %llu, data = 0x%016" PRIxPTR ", usage = %s",
5781           CID(context), buffer, static_cast<unsigned long long>(size), (uintptr_t)data,
5782           GLenumToString(BigGLEnum::VertexBufferObjectUsage, usage));
5783 
5784     if (context)
5785     {
5786         BufferID bufferPacked = PackParam<BufferID>(buffer);
5787         SCOPED_SHARE_CONTEXT_LOCK(context);
5788         bool isCallValid =
5789             (context->skipValidation() ||
5790              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
5791                                                 context->getMutableErrorSetForValidation(),
5792                                                 angle::EntryPoint::GLNamedBufferData) &&
5793               ValidateNamedBufferData(context, angle::EntryPoint::GLNamedBufferData, bufferPacked,
5794                                       size, data, usage)));
5795         if (isCallValid)
5796         {
5797             context->namedBufferData(bufferPacked, size, data, usage);
5798         }
5799         ANGLE_CAPTURE_GL(NamedBufferData, isCallValid, context, bufferPacked, size, data, usage);
5800     }
5801     else
5802     {
5803         GenerateContextLostErrorOnCurrentGlobalContext();
5804     }
5805     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5806 }
5807 
GL_NamedBufferStorage(GLuint buffer,GLsizeiptr size,const void * data,GLbitfield flags)5808 void GL_APIENTRY GL_NamedBufferStorage(GLuint buffer,
5809                                        GLsizeiptr size,
5810                                        const void *data,
5811                                        GLbitfield flags)
5812 {
5813     Context *context = GetValidGlobalContext();
5814     EVENT(context, GLNamedBufferStorage,
5815           "context = %d, buffer = %u, size = %llu, data = 0x%016" PRIxPTR ", flags = %s",
5816           CID(context), buffer, static_cast<unsigned long long>(size), (uintptr_t)data,
5817           GLbitfieldToString(BigGLEnum::BufferStorageMask, flags).c_str());
5818 
5819     if (context)
5820     {
5821         BufferID bufferPacked = PackParam<BufferID>(buffer);
5822         SCOPED_SHARE_CONTEXT_LOCK(context);
5823         bool isCallValid =
5824             (context->skipValidation() ||
5825              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
5826                                                 context->getMutableErrorSetForValidation(),
5827                                                 angle::EntryPoint::GLNamedBufferStorage) &&
5828               ValidateNamedBufferStorage(context, angle::EntryPoint::GLNamedBufferStorage,
5829                                          bufferPacked, size, data, flags)));
5830         if (isCallValid)
5831         {
5832             context->namedBufferStorage(bufferPacked, size, data, flags);
5833         }
5834         ANGLE_CAPTURE_GL(NamedBufferStorage, isCallValid, context, bufferPacked, size, data, flags);
5835     }
5836     else
5837     {
5838         GenerateContextLostErrorOnCurrentGlobalContext();
5839     }
5840     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5841 }
5842 
GL_NamedBufferSubData(GLuint buffer,GLintptr offset,GLsizeiptr size,const void * data)5843 void GL_APIENTRY GL_NamedBufferSubData(GLuint buffer,
5844                                        GLintptr offset,
5845                                        GLsizeiptr size,
5846                                        const void *data)
5847 {
5848     Context *context = GetValidGlobalContext();
5849     EVENT(context, GLNamedBufferSubData,
5850           "context = %d, buffer = %u, offset = %llu, size = %llu, data = 0x%016" PRIxPTR "",
5851           CID(context), buffer, static_cast<unsigned long long>(offset),
5852           static_cast<unsigned long long>(size), (uintptr_t)data);
5853 
5854     if (context)
5855     {
5856         BufferID bufferPacked = PackParam<BufferID>(buffer);
5857         SCOPED_SHARE_CONTEXT_LOCK(context);
5858         bool isCallValid =
5859             (context->skipValidation() ||
5860              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
5861                                                 context->getMutableErrorSetForValidation(),
5862                                                 angle::EntryPoint::GLNamedBufferSubData) &&
5863               ValidateNamedBufferSubData(context, angle::EntryPoint::GLNamedBufferSubData,
5864                                          bufferPacked, offset, size, data)));
5865         if (isCallValid)
5866         {
5867             context->namedBufferSubData(bufferPacked, offset, size, data);
5868         }
5869         ANGLE_CAPTURE_GL(NamedBufferSubData, isCallValid, context, bufferPacked, offset, size,
5870                          data);
5871     }
5872     else
5873     {
5874         GenerateContextLostErrorOnCurrentGlobalContext();
5875     }
5876     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5877 }
5878 
GL_NamedFramebufferDrawBuffer(GLuint framebuffer,GLenum buf)5879 void GL_APIENTRY GL_NamedFramebufferDrawBuffer(GLuint framebuffer, GLenum buf)
5880 {
5881     Context *context = GetValidGlobalContext();
5882     EVENT(context, GLNamedFramebufferDrawBuffer, "context = %d, framebuffer = %u, buf = %s",
5883           CID(context), framebuffer, GLenumToString(BigGLEnum::ColorBuffer, buf));
5884 
5885     if (context)
5886     {
5887         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
5888         SCOPED_SHARE_CONTEXT_LOCK(context);
5889         bool isCallValid =
5890             (context->skipValidation() ||
5891              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
5892                                                 context->getMutableErrorSetForValidation(),
5893                                                 angle::EntryPoint::GLNamedFramebufferDrawBuffer) &&
5894               ValidateNamedFramebufferDrawBuffer(context,
5895                                                  angle::EntryPoint::GLNamedFramebufferDrawBuffer,
5896                                                  framebufferPacked, buf)));
5897         if (isCallValid)
5898         {
5899             context->namedFramebufferDrawBuffer(framebufferPacked, buf);
5900         }
5901         ANGLE_CAPTURE_GL(NamedFramebufferDrawBuffer, isCallValid, context, framebufferPacked, buf);
5902     }
5903     else
5904     {
5905         GenerateContextLostErrorOnCurrentGlobalContext();
5906     }
5907     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5908 }
5909 
GL_NamedFramebufferDrawBuffers(GLuint framebuffer,GLsizei n,const GLenum * bufs)5910 void GL_APIENTRY GL_NamedFramebufferDrawBuffers(GLuint framebuffer, GLsizei n, const GLenum *bufs)
5911 {
5912     Context *context = GetValidGlobalContext();
5913     EVENT(context, GLNamedFramebufferDrawBuffers,
5914           "context = %d, framebuffer = %u, n = %d, bufs = 0x%016" PRIxPTR "", CID(context),
5915           framebuffer, n, (uintptr_t)bufs);
5916 
5917     if (context)
5918     {
5919         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
5920         SCOPED_SHARE_CONTEXT_LOCK(context);
5921         bool isCallValid =
5922             (context->skipValidation() ||
5923              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
5924                                                 context->getMutableErrorSetForValidation(),
5925                                                 angle::EntryPoint::GLNamedFramebufferDrawBuffers) &&
5926               ValidateNamedFramebufferDrawBuffers(context,
5927                                                   angle::EntryPoint::GLNamedFramebufferDrawBuffers,
5928                                                   framebufferPacked, n, bufs)));
5929         if (isCallValid)
5930         {
5931             context->namedFramebufferDrawBuffers(framebufferPacked, n, bufs);
5932         }
5933         ANGLE_CAPTURE_GL(NamedFramebufferDrawBuffers, isCallValid, context, framebufferPacked, n,
5934                          bufs);
5935     }
5936     else
5937     {
5938         GenerateContextLostErrorOnCurrentGlobalContext();
5939     }
5940     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5941 }
5942 
GL_NamedFramebufferParameteri(GLuint framebuffer,GLenum pname,GLint param)5943 void GL_APIENTRY GL_NamedFramebufferParameteri(GLuint framebuffer, GLenum pname, GLint param)
5944 {
5945     Context *context = GetValidGlobalContext();
5946     EVENT(context, GLNamedFramebufferParameteri,
5947           "context = %d, framebuffer = %u, pname = %s, param = %d", CID(context), framebuffer,
5948           GLenumToString(BigGLEnum::FramebufferParameterName, pname), param);
5949 
5950     if (context)
5951     {
5952         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
5953         SCOPED_SHARE_CONTEXT_LOCK(context);
5954         bool isCallValid =
5955             (context->skipValidation() ||
5956              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
5957                                                 context->getMutableErrorSetForValidation(),
5958                                                 angle::EntryPoint::GLNamedFramebufferParameteri) &&
5959               ValidateNamedFramebufferParameteri(context,
5960                                                  angle::EntryPoint::GLNamedFramebufferParameteri,
5961                                                  framebufferPacked, pname, param)));
5962         if (isCallValid)
5963         {
5964             context->namedFramebufferParameteri(framebufferPacked, pname, param);
5965         }
5966         ANGLE_CAPTURE_GL(NamedFramebufferParameteri, isCallValid, context, framebufferPacked, pname,
5967                          param);
5968     }
5969     else
5970     {
5971         GenerateContextLostErrorOnCurrentGlobalContext();
5972     }
5973     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5974 }
5975 
GL_NamedFramebufferReadBuffer(GLuint framebuffer,GLenum src)5976 void GL_APIENTRY GL_NamedFramebufferReadBuffer(GLuint framebuffer, GLenum src)
5977 {
5978     Context *context = GetValidGlobalContext();
5979     EVENT(context, GLNamedFramebufferReadBuffer, "context = %d, framebuffer = %u, src = %s",
5980           CID(context), framebuffer, GLenumToString(BigGLEnum::ColorBuffer, src));
5981 
5982     if (context)
5983     {
5984         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
5985         SCOPED_SHARE_CONTEXT_LOCK(context);
5986         bool isCallValid =
5987             (context->skipValidation() ||
5988              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
5989                                                 context->getMutableErrorSetForValidation(),
5990                                                 angle::EntryPoint::GLNamedFramebufferReadBuffer) &&
5991               ValidateNamedFramebufferReadBuffer(context,
5992                                                  angle::EntryPoint::GLNamedFramebufferReadBuffer,
5993                                                  framebufferPacked, src)));
5994         if (isCallValid)
5995         {
5996             context->namedFramebufferReadBuffer(framebufferPacked, src);
5997         }
5998         ANGLE_CAPTURE_GL(NamedFramebufferReadBuffer, isCallValid, context, framebufferPacked, src);
5999     }
6000     else
6001     {
6002         GenerateContextLostErrorOnCurrentGlobalContext();
6003     }
6004     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6005 }
6006 
GL_NamedFramebufferRenderbuffer(GLuint framebuffer,GLenum attachment,GLenum renderbuffertarget,GLuint renderbuffer)6007 void GL_APIENTRY GL_NamedFramebufferRenderbuffer(GLuint framebuffer,
6008                                                  GLenum attachment,
6009                                                  GLenum renderbuffertarget,
6010                                                  GLuint renderbuffer)
6011 {
6012     Context *context = GetValidGlobalContext();
6013     EVENT(context, GLNamedFramebufferRenderbuffer,
6014           "context = %d, framebuffer = %u, attachment = %s, renderbuffertarget = %s, renderbuffer "
6015           "= %u",
6016           CID(context), framebuffer, GLenumToString(BigGLEnum::FramebufferAttachment, attachment),
6017           GLenumToString(BigGLEnum::RenderbufferTarget, renderbuffertarget), renderbuffer);
6018 
6019     if (context)
6020     {
6021         FramebufferID framebufferPacked   = PackParam<FramebufferID>(framebuffer);
6022         RenderbufferID renderbufferPacked = PackParam<RenderbufferID>(renderbuffer);
6023         SCOPED_SHARE_CONTEXT_LOCK(context);
6024         bool isCallValid =
6025             (context->skipValidation() ||
6026              (ValidatePixelLocalStorageInactive(
6027                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
6028                   angle::EntryPoint::GLNamedFramebufferRenderbuffer) &&
6029               ValidateNamedFramebufferRenderbuffer(
6030                   context, angle::EntryPoint::GLNamedFramebufferRenderbuffer, framebufferPacked,
6031                   attachment, renderbuffertarget, renderbufferPacked)));
6032         if (isCallValid)
6033         {
6034             context->namedFramebufferRenderbuffer(framebufferPacked, attachment, renderbuffertarget,
6035                                                   renderbufferPacked);
6036         }
6037         ANGLE_CAPTURE_GL(NamedFramebufferRenderbuffer, isCallValid, context, framebufferPacked,
6038                          attachment, renderbuffertarget, renderbufferPacked);
6039     }
6040     else
6041     {
6042         GenerateContextLostErrorOnCurrentGlobalContext();
6043     }
6044     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6045 }
6046 
GL_NamedFramebufferTexture(GLuint framebuffer,GLenum attachment,GLuint texture,GLint level)6047 void GL_APIENTRY GL_NamedFramebufferTexture(GLuint framebuffer,
6048                                             GLenum attachment,
6049                                             GLuint texture,
6050                                             GLint level)
6051 {
6052     Context *context = GetValidGlobalContext();
6053     EVENT(context, GLNamedFramebufferTexture,
6054           "context = %d, framebuffer = %u, attachment = %s, texture = %u, level = %d", CID(context),
6055           framebuffer, GLenumToString(BigGLEnum::FramebufferAttachment, attachment), texture,
6056           level);
6057 
6058     if (context)
6059     {
6060         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
6061         TextureID texturePacked         = PackParam<TextureID>(texture);
6062         SCOPED_SHARE_CONTEXT_LOCK(context);
6063         bool isCallValid =
6064             (context->skipValidation() ||
6065              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6066                                                 context->getMutableErrorSetForValidation(),
6067                                                 angle::EntryPoint::GLNamedFramebufferTexture) &&
6068               ValidateNamedFramebufferTexture(context, angle::EntryPoint::GLNamedFramebufferTexture,
6069                                               framebufferPacked, attachment, texturePacked,
6070                                               level)));
6071         if (isCallValid)
6072         {
6073             context->namedFramebufferTexture(framebufferPacked, attachment, texturePacked, level);
6074         }
6075         ANGLE_CAPTURE_GL(NamedFramebufferTexture, isCallValid, context, framebufferPacked,
6076                          attachment, texturePacked, level);
6077     }
6078     else
6079     {
6080         GenerateContextLostErrorOnCurrentGlobalContext();
6081     }
6082     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6083 }
6084 
GL_NamedFramebufferTextureLayer(GLuint framebuffer,GLenum attachment,GLuint texture,GLint level,GLint layer)6085 void GL_APIENTRY GL_NamedFramebufferTextureLayer(GLuint framebuffer,
6086                                                  GLenum attachment,
6087                                                  GLuint texture,
6088                                                  GLint level,
6089                                                  GLint layer)
6090 {
6091     Context *context = GetValidGlobalContext();
6092     EVENT(context, GLNamedFramebufferTextureLayer,
6093           "context = %d, framebuffer = %u, attachment = %s, texture = %u, level = %d, layer = %d",
6094           CID(context), framebuffer, GLenumToString(BigGLEnum::FramebufferAttachment, attachment),
6095           texture, level, layer);
6096 
6097     if (context)
6098     {
6099         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
6100         TextureID texturePacked         = PackParam<TextureID>(texture);
6101         SCOPED_SHARE_CONTEXT_LOCK(context);
6102         bool isCallValid =
6103             (context->skipValidation() ||
6104              (ValidatePixelLocalStorageInactive(
6105                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
6106                   angle::EntryPoint::GLNamedFramebufferTextureLayer) &&
6107               ValidateNamedFramebufferTextureLayer(
6108                   context, angle::EntryPoint::GLNamedFramebufferTextureLayer, framebufferPacked,
6109                   attachment, texturePacked, level, layer)));
6110         if (isCallValid)
6111         {
6112             context->namedFramebufferTextureLayer(framebufferPacked, attachment, texturePacked,
6113                                                   level, layer);
6114         }
6115         ANGLE_CAPTURE_GL(NamedFramebufferTextureLayer, isCallValid, context, framebufferPacked,
6116                          attachment, texturePacked, level, layer);
6117     }
6118     else
6119     {
6120         GenerateContextLostErrorOnCurrentGlobalContext();
6121     }
6122     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6123 }
6124 
GL_NamedRenderbufferStorage(GLuint renderbuffer,GLenum internalformat,GLsizei width,GLsizei height)6125 void GL_APIENTRY GL_NamedRenderbufferStorage(GLuint renderbuffer,
6126                                              GLenum internalformat,
6127                                              GLsizei width,
6128                                              GLsizei height)
6129 {
6130     Context *context = GetValidGlobalContext();
6131     EVENT(context, GLNamedRenderbufferStorage,
6132           "context = %d, renderbuffer = %u, internalformat = %s, width = %d, height = %d",
6133           CID(context), renderbuffer, GLenumToString(BigGLEnum::InternalFormat, internalformat),
6134           width, height);
6135 
6136     if (context)
6137     {
6138         RenderbufferID renderbufferPacked = PackParam<RenderbufferID>(renderbuffer);
6139         SCOPED_SHARE_CONTEXT_LOCK(context);
6140         bool isCallValid =
6141             (context->skipValidation() ||
6142              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6143                                                 context->getMutableErrorSetForValidation(),
6144                                                 angle::EntryPoint::GLNamedRenderbufferStorage) &&
6145               ValidateNamedRenderbufferStorage(context,
6146                                                angle::EntryPoint::GLNamedRenderbufferStorage,
6147                                                renderbufferPacked, internalformat, width, height)));
6148         if (isCallValid)
6149         {
6150             context->namedRenderbufferStorage(renderbufferPacked, internalformat, width, height);
6151         }
6152         ANGLE_CAPTURE_GL(NamedRenderbufferStorage, isCallValid, context, renderbufferPacked,
6153                          internalformat, width, height);
6154     }
6155     else
6156     {
6157         GenerateContextLostErrorOnCurrentGlobalContext();
6158     }
6159     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6160 }
6161 
GL_NamedRenderbufferStorageMultisample(GLuint renderbuffer,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height)6162 void GL_APIENTRY GL_NamedRenderbufferStorageMultisample(GLuint renderbuffer,
6163                                                         GLsizei samples,
6164                                                         GLenum internalformat,
6165                                                         GLsizei width,
6166                                                         GLsizei height)
6167 {
6168     Context *context = GetValidGlobalContext();
6169     EVENT(context, GLNamedRenderbufferStorageMultisample,
6170           "context = %d, renderbuffer = %u, samples = %d, internalformat = %s, width = %d, height "
6171           "= %d",
6172           CID(context), renderbuffer, samples,
6173           GLenumToString(BigGLEnum::InternalFormat, internalformat), width, height);
6174 
6175     if (context)
6176     {
6177         RenderbufferID renderbufferPacked = PackParam<RenderbufferID>(renderbuffer);
6178         SCOPED_SHARE_CONTEXT_LOCK(context);
6179         bool isCallValid =
6180             (context->skipValidation() ||
6181              (ValidatePixelLocalStorageInactive(
6182                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
6183                   angle::EntryPoint::GLNamedRenderbufferStorageMultisample) &&
6184               ValidateNamedRenderbufferStorageMultisample(
6185                   context, angle::EntryPoint::GLNamedRenderbufferStorageMultisample,
6186                   renderbufferPacked, samples, internalformat, width, height)));
6187         if (isCallValid)
6188         {
6189             context->namedRenderbufferStorageMultisample(renderbufferPacked, samples,
6190                                                          internalformat, width, height);
6191         }
6192         ANGLE_CAPTURE_GL(NamedRenderbufferStorageMultisample, isCallValid, context,
6193                          renderbufferPacked, samples, internalformat, width, height);
6194     }
6195     else
6196     {
6197         GenerateContextLostErrorOnCurrentGlobalContext();
6198     }
6199     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6200 }
6201 
GL_TextureBarrier()6202 void GL_APIENTRY GL_TextureBarrier()
6203 {
6204     Context *context = GetValidGlobalContext();
6205     EVENT(context, GLTextureBarrier, "context = %d", CID(context));
6206 
6207     if (context)
6208     {
6209         SCOPED_SHARE_CONTEXT_LOCK(context);
6210         bool isCallValid =
6211             (context->skipValidation() ||
6212              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6213                                                 context->getMutableErrorSetForValidation(),
6214                                                 angle::EntryPoint::GLTextureBarrier) &&
6215               ValidateTextureBarrier(context, angle::EntryPoint::GLTextureBarrier)));
6216         if (isCallValid)
6217         {
6218             context->textureBarrier();
6219         }
6220         ANGLE_CAPTURE_GL(TextureBarrier, isCallValid, context);
6221     }
6222     else
6223     {
6224         GenerateContextLostErrorOnCurrentGlobalContext();
6225     }
6226     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6227 }
6228 
GL_TextureBuffer(GLuint texture,GLenum internalformat,GLuint buffer)6229 void GL_APIENTRY GL_TextureBuffer(GLuint texture, GLenum internalformat, GLuint buffer)
6230 {
6231     Context *context = GetValidGlobalContext();
6232     EVENT(context, GLTextureBuffer, "context = %d, texture = %u, internalformat = %s, buffer = %u",
6233           CID(context), texture, GLenumToString(BigGLEnum::SizedInternalFormat, internalformat),
6234           buffer);
6235 
6236     if (context)
6237     {
6238         TextureID texturePacked = PackParam<TextureID>(texture);
6239         BufferID bufferPacked   = PackParam<BufferID>(buffer);
6240         SCOPED_SHARE_CONTEXT_LOCK(context);
6241         bool isCallValid =
6242             (context->skipValidation() ||
6243              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6244                                                 context->getMutableErrorSetForValidation(),
6245                                                 angle::EntryPoint::GLTextureBuffer) &&
6246               ValidateTextureBuffer(context, angle::EntryPoint::GLTextureBuffer, texturePacked,
6247                                     internalformat, bufferPacked)));
6248         if (isCallValid)
6249         {
6250             context->textureBuffer(texturePacked, internalformat, bufferPacked);
6251         }
6252         ANGLE_CAPTURE_GL(TextureBuffer, isCallValid, context, texturePacked, internalformat,
6253                          bufferPacked);
6254     }
6255     else
6256     {
6257         GenerateContextLostErrorOnCurrentGlobalContext();
6258     }
6259     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6260 }
6261 
GL_TextureBufferRange(GLuint texture,GLenum internalformat,GLuint buffer,GLintptr offset,GLsizeiptr size)6262 void GL_APIENTRY GL_TextureBufferRange(GLuint texture,
6263                                        GLenum internalformat,
6264                                        GLuint buffer,
6265                                        GLintptr offset,
6266                                        GLsizeiptr size)
6267 {
6268     Context *context = GetValidGlobalContext();
6269     EVENT(
6270         context, GLTextureBufferRange,
6271         "context = %d, texture = %u, internalformat = %s, buffer = %u, offset = %llu, size = %llu",
6272         CID(context), texture, GLenumToString(BigGLEnum::SizedInternalFormat, internalformat),
6273         buffer, static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size));
6274 
6275     if (context)
6276     {
6277         TextureID texturePacked = PackParam<TextureID>(texture);
6278         BufferID bufferPacked   = PackParam<BufferID>(buffer);
6279         SCOPED_SHARE_CONTEXT_LOCK(context);
6280         bool isCallValid =
6281             (context->skipValidation() ||
6282              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6283                                                 context->getMutableErrorSetForValidation(),
6284                                                 angle::EntryPoint::GLTextureBufferRange) &&
6285               ValidateTextureBufferRange(context, angle::EntryPoint::GLTextureBufferRange,
6286                                          texturePacked, internalformat, bufferPacked, offset,
6287                                          size)));
6288         if (isCallValid)
6289         {
6290             context->textureBufferRange(texturePacked, internalformat, bufferPacked, offset, size);
6291         }
6292         ANGLE_CAPTURE_GL(TextureBufferRange, isCallValid, context, texturePacked, internalformat,
6293                          bufferPacked, offset, size);
6294     }
6295     else
6296     {
6297         GenerateContextLostErrorOnCurrentGlobalContext();
6298     }
6299     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6300 }
6301 
GL_TextureParameterIiv(GLuint texture,GLenum pname,const GLint * params)6302 void GL_APIENTRY GL_TextureParameterIiv(GLuint texture, GLenum pname, const GLint *params)
6303 {
6304     Context *context = GetValidGlobalContext();
6305     EVENT(context, GLTextureParameterIiv,
6306           "context = %d, texture = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
6307           texture, GLenumToString(BigGLEnum::TextureParameterName, pname), (uintptr_t)params);
6308 
6309     if (context)
6310     {
6311         TextureID texturePacked = PackParam<TextureID>(texture);
6312         SCOPED_SHARE_CONTEXT_LOCK(context);
6313         bool isCallValid =
6314             (context->skipValidation() ||
6315              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6316                                                 context->getMutableErrorSetForValidation(),
6317                                                 angle::EntryPoint::GLTextureParameterIiv) &&
6318               ValidateTextureParameterIiv(context, angle::EntryPoint::GLTextureParameterIiv,
6319                                           texturePacked, pname, params)));
6320         if (isCallValid)
6321         {
6322             context->textureParameterIiv(texturePacked, pname, params);
6323         }
6324         ANGLE_CAPTURE_GL(TextureParameterIiv, isCallValid, context, texturePacked, pname, params);
6325     }
6326     else
6327     {
6328         GenerateContextLostErrorOnCurrentGlobalContext();
6329     }
6330     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6331 }
6332 
GL_TextureParameterIuiv(GLuint texture,GLenum pname,const GLuint * params)6333 void GL_APIENTRY GL_TextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params)
6334 {
6335     Context *context = GetValidGlobalContext();
6336     EVENT(context, GLTextureParameterIuiv,
6337           "context = %d, texture = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
6338           texture, GLenumToString(BigGLEnum::TextureParameterName, pname), (uintptr_t)params);
6339 
6340     if (context)
6341     {
6342         TextureID texturePacked = PackParam<TextureID>(texture);
6343         SCOPED_SHARE_CONTEXT_LOCK(context);
6344         bool isCallValid =
6345             (context->skipValidation() ||
6346              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6347                                                 context->getMutableErrorSetForValidation(),
6348                                                 angle::EntryPoint::GLTextureParameterIuiv) &&
6349               ValidateTextureParameterIuiv(context, angle::EntryPoint::GLTextureParameterIuiv,
6350                                            texturePacked, pname, params)));
6351         if (isCallValid)
6352         {
6353             context->textureParameterIuiv(texturePacked, pname, params);
6354         }
6355         ANGLE_CAPTURE_GL(TextureParameterIuiv, isCallValid, context, texturePacked, pname, params);
6356     }
6357     else
6358     {
6359         GenerateContextLostErrorOnCurrentGlobalContext();
6360     }
6361     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6362 }
6363 
GL_TextureParameterf(GLuint texture,GLenum pname,GLfloat param)6364 void GL_APIENTRY GL_TextureParameterf(GLuint texture, GLenum pname, GLfloat param)
6365 {
6366     Context *context = GetValidGlobalContext();
6367     EVENT(context, GLTextureParameterf, "context = %d, texture = %u, pname = %s, param = %f",
6368           CID(context), texture, GLenumToString(BigGLEnum::TextureParameterName, pname), param);
6369 
6370     if (context)
6371     {
6372         TextureID texturePacked = PackParam<TextureID>(texture);
6373         SCOPED_SHARE_CONTEXT_LOCK(context);
6374         bool isCallValid =
6375             (context->skipValidation() ||
6376              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6377                                                 context->getMutableErrorSetForValidation(),
6378                                                 angle::EntryPoint::GLTextureParameterf) &&
6379               ValidateTextureParameterf(context, angle::EntryPoint::GLTextureParameterf,
6380                                         texturePacked, pname, param)));
6381         if (isCallValid)
6382         {
6383             context->textureParameterf(texturePacked, pname, param);
6384         }
6385         ANGLE_CAPTURE_GL(TextureParameterf, isCallValid, context, texturePacked, pname, param);
6386     }
6387     else
6388     {
6389         GenerateContextLostErrorOnCurrentGlobalContext();
6390     }
6391     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6392 }
6393 
GL_TextureParameterfv(GLuint texture,GLenum pname,const GLfloat * param)6394 void GL_APIENTRY GL_TextureParameterfv(GLuint texture, GLenum pname, const GLfloat *param)
6395 {
6396     Context *context = GetValidGlobalContext();
6397     EVENT(context, GLTextureParameterfv,
6398           "context = %d, texture = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
6399           texture, GLenumToString(BigGLEnum::TextureParameterName, pname), (uintptr_t)param);
6400 
6401     if (context)
6402     {
6403         TextureID texturePacked = PackParam<TextureID>(texture);
6404         SCOPED_SHARE_CONTEXT_LOCK(context);
6405         bool isCallValid =
6406             (context->skipValidation() ||
6407              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6408                                                 context->getMutableErrorSetForValidation(),
6409                                                 angle::EntryPoint::GLTextureParameterfv) &&
6410               ValidateTextureParameterfv(context, angle::EntryPoint::GLTextureParameterfv,
6411                                          texturePacked, pname, param)));
6412         if (isCallValid)
6413         {
6414             context->textureParameterfv(texturePacked, pname, param);
6415         }
6416         ANGLE_CAPTURE_GL(TextureParameterfv, isCallValid, context, texturePacked, pname, param);
6417     }
6418     else
6419     {
6420         GenerateContextLostErrorOnCurrentGlobalContext();
6421     }
6422     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6423 }
6424 
GL_TextureParameteri(GLuint texture,GLenum pname,GLint param)6425 void GL_APIENTRY GL_TextureParameteri(GLuint texture, GLenum pname, GLint param)
6426 {
6427     Context *context = GetValidGlobalContext();
6428     EVENT(context, GLTextureParameteri, "context = %d, texture = %u, pname = %s, param = %d",
6429           CID(context), texture, GLenumToString(BigGLEnum::TextureParameterName, pname), param);
6430 
6431     if (context)
6432     {
6433         TextureID texturePacked = PackParam<TextureID>(texture);
6434         SCOPED_SHARE_CONTEXT_LOCK(context);
6435         bool isCallValid =
6436             (context->skipValidation() ||
6437              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6438                                                 context->getMutableErrorSetForValidation(),
6439                                                 angle::EntryPoint::GLTextureParameteri) &&
6440               ValidateTextureParameteri(context, angle::EntryPoint::GLTextureParameteri,
6441                                         texturePacked, pname, param)));
6442         if (isCallValid)
6443         {
6444             context->textureParameteri(texturePacked, pname, param);
6445         }
6446         ANGLE_CAPTURE_GL(TextureParameteri, isCallValid, context, texturePacked, pname, param);
6447     }
6448     else
6449     {
6450         GenerateContextLostErrorOnCurrentGlobalContext();
6451     }
6452     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6453 }
6454 
GL_TextureParameteriv(GLuint texture,GLenum pname,const GLint * param)6455 void GL_APIENTRY GL_TextureParameteriv(GLuint texture, GLenum pname, const GLint *param)
6456 {
6457     Context *context = GetValidGlobalContext();
6458     EVENT(context, GLTextureParameteriv,
6459           "context = %d, texture = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
6460           texture, GLenumToString(BigGLEnum::TextureParameterName, pname), (uintptr_t)param);
6461 
6462     if (context)
6463     {
6464         TextureID texturePacked = PackParam<TextureID>(texture);
6465         SCOPED_SHARE_CONTEXT_LOCK(context);
6466         bool isCallValid =
6467             (context->skipValidation() ||
6468              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6469                                                 context->getMutableErrorSetForValidation(),
6470                                                 angle::EntryPoint::GLTextureParameteriv) &&
6471               ValidateTextureParameteriv(context, angle::EntryPoint::GLTextureParameteriv,
6472                                          texturePacked, pname, param)));
6473         if (isCallValid)
6474         {
6475             context->textureParameteriv(texturePacked, pname, param);
6476         }
6477         ANGLE_CAPTURE_GL(TextureParameteriv, isCallValid, context, texturePacked, pname, param);
6478     }
6479     else
6480     {
6481         GenerateContextLostErrorOnCurrentGlobalContext();
6482     }
6483     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6484 }
6485 
GL_TextureStorage1D(GLuint texture,GLsizei levels,GLenum internalformat,GLsizei width)6486 void GL_APIENTRY GL_TextureStorage1D(GLuint texture,
6487                                      GLsizei levels,
6488                                      GLenum internalformat,
6489                                      GLsizei width)
6490 {
6491     Context *context = GetValidGlobalContext();
6492     EVENT(context, GLTextureStorage1D,
6493           "context = %d, texture = %u, levels = %d, internalformat = %s, width = %d", CID(context),
6494           texture, levels, GLenumToString(BigGLEnum::SizedInternalFormat, internalformat), width);
6495 
6496     if (context)
6497     {
6498         TextureID texturePacked = PackParam<TextureID>(texture);
6499         SCOPED_SHARE_CONTEXT_LOCK(context);
6500         bool isCallValid =
6501             (context->skipValidation() ||
6502              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6503                                                 context->getMutableErrorSetForValidation(),
6504                                                 angle::EntryPoint::GLTextureStorage1D) &&
6505               ValidateTextureStorage1D(context, angle::EntryPoint::GLTextureStorage1D,
6506                                        texturePacked, levels, internalformat, width)));
6507         if (isCallValid)
6508         {
6509             context->textureStorage1D(texturePacked, levels, internalformat, width);
6510         }
6511         ANGLE_CAPTURE_GL(TextureStorage1D, isCallValid, context, texturePacked, levels,
6512                          internalformat, width);
6513     }
6514     else
6515     {
6516         GenerateContextLostErrorOnCurrentGlobalContext();
6517     }
6518     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6519 }
6520 
GL_TextureStorage2D(GLuint texture,GLsizei levels,GLenum internalformat,GLsizei width,GLsizei height)6521 void GL_APIENTRY GL_TextureStorage2D(GLuint texture,
6522                                      GLsizei levels,
6523                                      GLenum internalformat,
6524                                      GLsizei width,
6525                                      GLsizei height)
6526 {
6527     Context *context = GetValidGlobalContext();
6528     EVENT(context, GLTextureStorage2D,
6529           "context = %d, texture = %u, levels = %d, internalformat = %s, width = %d, height = %d",
6530           CID(context), texture, levels,
6531           GLenumToString(BigGLEnum::SizedInternalFormat, internalformat), width, height);
6532 
6533     if (context)
6534     {
6535         TextureID texturePacked = PackParam<TextureID>(texture);
6536         SCOPED_SHARE_CONTEXT_LOCK(context);
6537         bool isCallValid =
6538             (context->skipValidation() ||
6539              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6540                                                 context->getMutableErrorSetForValidation(),
6541                                                 angle::EntryPoint::GLTextureStorage2D) &&
6542               ValidateTextureStorage2D(context, angle::EntryPoint::GLTextureStorage2D,
6543                                        texturePacked, levels, internalformat, width, height)));
6544         if (isCallValid)
6545         {
6546             context->textureStorage2D(texturePacked, levels, internalformat, width, height);
6547         }
6548         ANGLE_CAPTURE_GL(TextureStorage2D, isCallValid, context, texturePacked, levels,
6549                          internalformat, width, height);
6550     }
6551     else
6552     {
6553         GenerateContextLostErrorOnCurrentGlobalContext();
6554     }
6555     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6556 }
6557 
GL_TextureStorage2DMultisample(GLuint texture,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height,GLboolean fixedsamplelocations)6558 void GL_APIENTRY GL_TextureStorage2DMultisample(GLuint texture,
6559                                                 GLsizei samples,
6560                                                 GLenum internalformat,
6561                                                 GLsizei width,
6562                                                 GLsizei height,
6563                                                 GLboolean fixedsamplelocations)
6564 {
6565     Context *context = GetValidGlobalContext();
6566     EVENT(context, GLTextureStorage2DMultisample,
6567           "context = %d, texture = %u, samples = %d, internalformat = %s, width = %d, height = %d, "
6568           "fixedsamplelocations = %s",
6569           CID(context), texture, samples,
6570           GLenumToString(BigGLEnum::SizedInternalFormat, internalformat), width, height,
6571           GLbooleanToString(fixedsamplelocations));
6572 
6573     if (context)
6574     {
6575         TextureID texturePacked = PackParam<TextureID>(texture);
6576         SCOPED_SHARE_CONTEXT_LOCK(context);
6577         bool isCallValid =
6578             (context->skipValidation() ||
6579              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6580                                                 context->getMutableErrorSetForValidation(),
6581                                                 angle::EntryPoint::GLTextureStorage2DMultisample) &&
6582               ValidateTextureStorage2DMultisample(
6583                   context, angle::EntryPoint::GLTextureStorage2DMultisample, texturePacked, samples,
6584                   internalformat, width, height, fixedsamplelocations)));
6585         if (isCallValid)
6586         {
6587             context->textureStorage2DMultisample(texturePacked, samples, internalformat, width,
6588                                                  height, fixedsamplelocations);
6589         }
6590         ANGLE_CAPTURE_GL(TextureStorage2DMultisample, isCallValid, context, texturePacked, samples,
6591                          internalformat, width, height, fixedsamplelocations);
6592     }
6593     else
6594     {
6595         GenerateContextLostErrorOnCurrentGlobalContext();
6596     }
6597     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6598 }
6599 
GL_TextureStorage3D(GLuint texture,GLsizei levels,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth)6600 void GL_APIENTRY GL_TextureStorage3D(GLuint texture,
6601                                      GLsizei levels,
6602                                      GLenum internalformat,
6603                                      GLsizei width,
6604                                      GLsizei height,
6605                                      GLsizei depth)
6606 {
6607     Context *context = GetValidGlobalContext();
6608     EVENT(context, GLTextureStorage3D,
6609           "context = %d, texture = %u, levels = %d, internalformat = %s, width = %d, height = %d, "
6610           "depth = %d",
6611           CID(context), texture, levels,
6612           GLenumToString(BigGLEnum::SizedInternalFormat, internalformat), width, height, depth);
6613 
6614     if (context)
6615     {
6616         TextureID texturePacked = PackParam<TextureID>(texture);
6617         SCOPED_SHARE_CONTEXT_LOCK(context);
6618         bool isCallValid =
6619             (context->skipValidation() ||
6620              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6621                                                 context->getMutableErrorSetForValidation(),
6622                                                 angle::EntryPoint::GLTextureStorage3D) &&
6623               ValidateTextureStorage3D(context, angle::EntryPoint::GLTextureStorage3D,
6624                                        texturePacked, levels, internalformat, width, height,
6625                                        depth)));
6626         if (isCallValid)
6627         {
6628             context->textureStorage3D(texturePacked, levels, internalformat, width, height, depth);
6629         }
6630         ANGLE_CAPTURE_GL(TextureStorage3D, isCallValid, context, texturePacked, levels,
6631                          internalformat, width, height, depth);
6632     }
6633     else
6634     {
6635         GenerateContextLostErrorOnCurrentGlobalContext();
6636     }
6637     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6638 }
6639 
GL_TextureStorage3DMultisample(GLuint texture,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLboolean fixedsamplelocations)6640 void GL_APIENTRY GL_TextureStorage3DMultisample(GLuint texture,
6641                                                 GLsizei samples,
6642                                                 GLenum internalformat,
6643                                                 GLsizei width,
6644                                                 GLsizei height,
6645                                                 GLsizei depth,
6646                                                 GLboolean fixedsamplelocations)
6647 {
6648     Context *context = GetValidGlobalContext();
6649     EVENT(context, GLTextureStorage3DMultisample,
6650           "context = %d, texture = %u, samples = %d, internalformat = %s, width = %d, height = %d, "
6651           "depth = %d, fixedsamplelocations = %s",
6652           CID(context), texture, samples,
6653           GLenumToString(BigGLEnum::SizedInternalFormat, internalformat), width, height, depth,
6654           GLbooleanToString(fixedsamplelocations));
6655 
6656     if (context)
6657     {
6658         TextureID texturePacked = PackParam<TextureID>(texture);
6659         SCOPED_SHARE_CONTEXT_LOCK(context);
6660         bool isCallValid =
6661             (context->skipValidation() ||
6662              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6663                                                 context->getMutableErrorSetForValidation(),
6664                                                 angle::EntryPoint::GLTextureStorage3DMultisample) &&
6665               ValidateTextureStorage3DMultisample(
6666                   context, angle::EntryPoint::GLTextureStorage3DMultisample, texturePacked, samples,
6667                   internalformat, width, height, depth, fixedsamplelocations)));
6668         if (isCallValid)
6669         {
6670             context->textureStorage3DMultisample(texturePacked, samples, internalformat, width,
6671                                                  height, depth, fixedsamplelocations);
6672         }
6673         ANGLE_CAPTURE_GL(TextureStorage3DMultisample, isCallValid, context, texturePacked, samples,
6674                          internalformat, width, height, depth, fixedsamplelocations);
6675     }
6676     else
6677     {
6678         GenerateContextLostErrorOnCurrentGlobalContext();
6679     }
6680     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6681 }
6682 
GL_TextureSubImage1D(GLuint texture,GLint level,GLint xoffset,GLsizei width,GLenum format,GLenum type,const void * pixels)6683 void GL_APIENTRY GL_TextureSubImage1D(GLuint texture,
6684                                       GLint level,
6685                                       GLint xoffset,
6686                                       GLsizei width,
6687                                       GLenum format,
6688                                       GLenum type,
6689                                       const void *pixels)
6690 {
6691     Context *context = GetValidGlobalContext();
6692     EVENT(context, GLTextureSubImage1D,
6693           "context = %d, texture = %u, level = %d, xoffset = %d, width = %d, format = %s, type = "
6694           "%s, pixels = 0x%016" PRIxPTR "",
6695           CID(context), texture, level, xoffset, width,
6696           GLenumToString(BigGLEnum::PixelFormat, format),
6697           GLenumToString(BigGLEnum::PixelType, type), (uintptr_t)pixels);
6698 
6699     if (context)
6700     {
6701         TextureID texturePacked = PackParam<TextureID>(texture);
6702         SCOPED_SHARE_CONTEXT_LOCK(context);
6703         bool isCallValid =
6704             (context->skipValidation() ||
6705              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6706                                                 context->getMutableErrorSetForValidation(),
6707                                                 angle::EntryPoint::GLTextureSubImage1D) &&
6708               ValidateTextureSubImage1D(context, angle::EntryPoint::GLTextureSubImage1D,
6709                                         texturePacked, level, xoffset, width, format, type,
6710                                         pixels)));
6711         if (isCallValid)
6712         {
6713             context->textureSubImage1D(texturePacked, level, xoffset, width, format, type, pixels);
6714         }
6715         ANGLE_CAPTURE_GL(TextureSubImage1D, isCallValid, context, texturePacked, level, xoffset,
6716                          width, format, type, pixels);
6717     }
6718     else
6719     {
6720         GenerateContextLostErrorOnCurrentGlobalContext();
6721     }
6722     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6723 }
6724 
GL_TextureSubImage2D(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLenum type,const void * pixels)6725 void GL_APIENTRY GL_TextureSubImage2D(GLuint texture,
6726                                       GLint level,
6727                                       GLint xoffset,
6728                                       GLint yoffset,
6729                                       GLsizei width,
6730                                       GLsizei height,
6731                                       GLenum format,
6732                                       GLenum type,
6733                                       const void *pixels)
6734 {
6735     Context *context = GetValidGlobalContext();
6736     EVENT(context, GLTextureSubImage2D,
6737           "context = %d, texture = %u, level = %d, xoffset = %d, yoffset = %d, width = %d, height "
6738           "= %d, format = %s, type = %s, pixels = 0x%016" PRIxPTR "",
6739           CID(context), texture, level, xoffset, yoffset, width, height,
6740           GLenumToString(BigGLEnum::PixelFormat, format),
6741           GLenumToString(BigGLEnum::PixelType, type), (uintptr_t)pixels);
6742 
6743     if (context)
6744     {
6745         TextureID texturePacked = PackParam<TextureID>(texture);
6746         SCOPED_SHARE_CONTEXT_LOCK(context);
6747         bool isCallValid =
6748             (context->skipValidation() ||
6749              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6750                                                 context->getMutableErrorSetForValidation(),
6751                                                 angle::EntryPoint::GLTextureSubImage2D) &&
6752               ValidateTextureSubImage2D(context, angle::EntryPoint::GLTextureSubImage2D,
6753                                         texturePacked, level, xoffset, yoffset, width, height,
6754                                         format, type, pixels)));
6755         if (isCallValid)
6756         {
6757             context->textureSubImage2D(texturePacked, level, xoffset, yoffset, width, height,
6758                                        format, type, pixels);
6759         }
6760         ANGLE_CAPTURE_GL(TextureSubImage2D, isCallValid, context, texturePacked, level, xoffset,
6761                          yoffset, width, height, format, type, pixels);
6762     }
6763     else
6764     {
6765         GenerateContextLostErrorOnCurrentGlobalContext();
6766     }
6767     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6768 }
6769 
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)6770 void GL_APIENTRY GL_TextureSubImage3D(GLuint texture,
6771                                       GLint level,
6772                                       GLint xoffset,
6773                                       GLint yoffset,
6774                                       GLint zoffset,
6775                                       GLsizei width,
6776                                       GLsizei height,
6777                                       GLsizei depth,
6778                                       GLenum format,
6779                                       GLenum type,
6780                                       const void *pixels)
6781 {
6782     Context *context = GetValidGlobalContext();
6783     EVENT(context, GLTextureSubImage3D,
6784           "context = %d, texture = %u, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width "
6785           "= %d, height = %d, depth = %d, format = %s, type = %s, pixels = 0x%016" PRIxPTR "",
6786           CID(context), texture, level, xoffset, yoffset, zoffset, width, height, depth,
6787           GLenumToString(BigGLEnum::PixelFormat, format),
6788           GLenumToString(BigGLEnum::PixelType, type), (uintptr_t)pixels);
6789 
6790     if (context)
6791     {
6792         TextureID texturePacked = PackParam<TextureID>(texture);
6793         SCOPED_SHARE_CONTEXT_LOCK(context);
6794         bool isCallValid =
6795             (context->skipValidation() ||
6796              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6797                                                 context->getMutableErrorSetForValidation(),
6798                                                 angle::EntryPoint::GLTextureSubImage3D) &&
6799               ValidateTextureSubImage3D(context, angle::EntryPoint::GLTextureSubImage3D,
6800                                         texturePacked, level, xoffset, yoffset, zoffset, width,
6801                                         height, depth, format, type, pixels)));
6802         if (isCallValid)
6803         {
6804             context->textureSubImage3D(texturePacked, level, xoffset, yoffset, zoffset, width,
6805                                        height, depth, format, type, pixels);
6806         }
6807         ANGLE_CAPTURE_GL(TextureSubImage3D, isCallValid, context, texturePacked, level, xoffset,
6808                          yoffset, zoffset, width, height, depth, format, type, pixels);
6809     }
6810     else
6811     {
6812         GenerateContextLostErrorOnCurrentGlobalContext();
6813     }
6814     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6815 }
6816 
GL_TransformFeedbackBufferBase(GLuint xfb,GLuint index,GLuint buffer)6817 void GL_APIENTRY GL_TransformFeedbackBufferBase(GLuint xfb, GLuint index, GLuint buffer)
6818 {
6819     Context *context = GetValidGlobalContext();
6820     EVENT(context, GLTransformFeedbackBufferBase, "context = %d, xfb = %u, index = %u, buffer = %u",
6821           CID(context), xfb, index, buffer);
6822 
6823     if (context)
6824     {
6825         BufferID bufferPacked = PackParam<BufferID>(buffer);
6826         SCOPED_SHARE_CONTEXT_LOCK(context);
6827         bool isCallValid =
6828             (context->skipValidation() ||
6829              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6830                                                 context->getMutableErrorSetForValidation(),
6831                                                 angle::EntryPoint::GLTransformFeedbackBufferBase) &&
6832               ValidateTransformFeedbackBufferBase(context,
6833                                                   angle::EntryPoint::GLTransformFeedbackBufferBase,
6834                                                   xfb, index, bufferPacked)));
6835         if (isCallValid)
6836         {
6837             context->transformFeedbackBufferBase(xfb, index, bufferPacked);
6838         }
6839         ANGLE_CAPTURE_GL(TransformFeedbackBufferBase, isCallValid, context, xfb, index,
6840                          bufferPacked);
6841     }
6842     else
6843     {
6844         GenerateContextLostErrorOnCurrentGlobalContext();
6845     }
6846     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6847 }
6848 
GL_TransformFeedbackBufferRange(GLuint xfb,GLuint index,GLuint buffer,GLintptr offset,GLsizeiptr size)6849 void GL_APIENTRY GL_TransformFeedbackBufferRange(GLuint xfb,
6850                                                  GLuint index,
6851                                                  GLuint buffer,
6852                                                  GLintptr offset,
6853                                                  GLsizeiptr size)
6854 {
6855     Context *context = GetValidGlobalContext();
6856     EVENT(context, GLTransformFeedbackBufferRange,
6857           "context = %d, xfb = %u, index = %u, buffer = %u, offset = %llu, size = %llu",
6858           CID(context), xfb, index, buffer, static_cast<unsigned long long>(offset),
6859           static_cast<unsigned long long>(size));
6860 
6861     if (context)
6862     {
6863         BufferID bufferPacked = PackParam<BufferID>(buffer);
6864         SCOPED_SHARE_CONTEXT_LOCK(context);
6865         bool isCallValid =
6866             (context->skipValidation() ||
6867              (ValidatePixelLocalStorageInactive(
6868                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
6869                   angle::EntryPoint::GLTransformFeedbackBufferRange) &&
6870               ValidateTransformFeedbackBufferRange(
6871                   context, angle::EntryPoint::GLTransformFeedbackBufferRange, xfb, index,
6872                   bufferPacked, offset, size)));
6873         if (isCallValid)
6874         {
6875             context->transformFeedbackBufferRange(xfb, index, bufferPacked, offset, size);
6876         }
6877         ANGLE_CAPTURE_GL(TransformFeedbackBufferRange, isCallValid, context, xfb, index,
6878                          bufferPacked, offset, size);
6879     }
6880     else
6881     {
6882         GenerateContextLostErrorOnCurrentGlobalContext();
6883     }
6884     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6885 }
6886 
GL_UnmapNamedBuffer(GLuint buffer)6887 GLboolean GL_APIENTRY GL_UnmapNamedBuffer(GLuint buffer)
6888 {
6889     Context *context = GetValidGlobalContext();
6890     EVENT(context, GLUnmapNamedBuffer, "context = %d, buffer = %u", CID(context), buffer);
6891 
6892     GLboolean returnValue;
6893     if (context)
6894     {
6895         BufferID bufferPacked = PackParam<BufferID>(buffer);
6896         SCOPED_SHARE_CONTEXT_LOCK(context);
6897         bool isCallValid =
6898             (context->skipValidation() ||
6899              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6900                                                 context->getMutableErrorSetForValidation(),
6901                                                 angle::EntryPoint::GLUnmapNamedBuffer) &&
6902               ValidateUnmapNamedBuffer(context, angle::EntryPoint::GLUnmapNamedBuffer,
6903                                        bufferPacked)));
6904         if (isCallValid)
6905         {
6906             returnValue = context->unmapNamedBuffer(bufferPacked);
6907         }
6908         else
6909         {
6910             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLUnmapNamedBuffer, GLboolean>();
6911         }
6912         ANGLE_CAPTURE_GL(UnmapNamedBuffer, isCallValid, context, bufferPacked, returnValue);
6913     }
6914     else
6915     {
6916         GenerateContextLostErrorOnCurrentGlobalContext();
6917         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLUnmapNamedBuffer, GLboolean>();
6918     }
6919     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6920     return returnValue;
6921 }
6922 
GL_VertexArrayAttribBinding(GLuint vaobj,GLuint attribindex,GLuint bindingindex)6923 void GL_APIENTRY GL_VertexArrayAttribBinding(GLuint vaobj, GLuint attribindex, GLuint bindingindex)
6924 {
6925     Context *context = GetValidGlobalContext();
6926     EVENT(context, GLVertexArrayAttribBinding,
6927           "context = %d, vaobj = %u, attribindex = %u, bindingindex = %u", CID(context), vaobj,
6928           attribindex, bindingindex);
6929 
6930     if (context)
6931     {
6932         VertexArrayID vaobjPacked = PackParam<VertexArrayID>(vaobj);
6933         SCOPED_SHARE_CONTEXT_LOCK(context);
6934         bool isCallValid =
6935             (context->skipValidation() ||
6936              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6937                                                 context->getMutableErrorSetForValidation(),
6938                                                 angle::EntryPoint::GLVertexArrayAttribBinding) &&
6939               ValidateVertexArrayAttribBinding(context,
6940                                                angle::EntryPoint::GLVertexArrayAttribBinding,
6941                                                vaobjPacked, attribindex, bindingindex)));
6942         if (isCallValid)
6943         {
6944             context->vertexArrayAttribBinding(vaobjPacked, attribindex, bindingindex);
6945         }
6946         ANGLE_CAPTURE_GL(VertexArrayAttribBinding, isCallValid, context, vaobjPacked, attribindex,
6947                          bindingindex);
6948     }
6949     else
6950     {
6951         GenerateContextLostErrorOnCurrentGlobalContext();
6952     }
6953     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6954 }
6955 
GL_VertexArrayAttribFormat(GLuint vaobj,GLuint attribindex,GLint size,GLenum type,GLboolean normalized,GLuint relativeoffset)6956 void GL_APIENTRY GL_VertexArrayAttribFormat(GLuint vaobj,
6957                                             GLuint attribindex,
6958                                             GLint size,
6959                                             GLenum type,
6960                                             GLboolean normalized,
6961                                             GLuint relativeoffset)
6962 {
6963     Context *context = GetValidGlobalContext();
6964     EVENT(context, GLVertexArrayAttribFormat,
6965           "context = %d, vaobj = %u, attribindex = %u, size = %d, type = %s, normalized = %s, "
6966           "relativeoffset = %u",
6967           CID(context), vaobj, attribindex, size, GLenumToString(BigGLEnum::VertexAttribType, type),
6968           GLbooleanToString(normalized), relativeoffset);
6969 
6970     if (context)
6971     {
6972         VertexArrayID vaobjPacked = PackParam<VertexArrayID>(vaobj);
6973         SCOPED_SHARE_CONTEXT_LOCK(context);
6974         bool isCallValid =
6975             (context->skipValidation() ||
6976              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6977                                                 context->getMutableErrorSetForValidation(),
6978                                                 angle::EntryPoint::GLVertexArrayAttribFormat) &&
6979               ValidateVertexArrayAttribFormat(context, angle::EntryPoint::GLVertexArrayAttribFormat,
6980                                               vaobjPacked, attribindex, size, type, normalized,
6981                                               relativeoffset)));
6982         if (isCallValid)
6983         {
6984             context->vertexArrayAttribFormat(vaobjPacked, attribindex, size, type, normalized,
6985                                              relativeoffset);
6986         }
6987         ANGLE_CAPTURE_GL(VertexArrayAttribFormat, isCallValid, context, vaobjPacked, attribindex,
6988                          size, type, normalized, relativeoffset);
6989     }
6990     else
6991     {
6992         GenerateContextLostErrorOnCurrentGlobalContext();
6993     }
6994     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6995 }
6996 
GL_VertexArrayAttribIFormat(GLuint vaobj,GLuint attribindex,GLint size,GLenum type,GLuint relativeoffset)6997 void GL_APIENTRY GL_VertexArrayAttribIFormat(GLuint vaobj,
6998                                              GLuint attribindex,
6999                                              GLint size,
7000                                              GLenum type,
7001                                              GLuint relativeoffset)
7002 {
7003     Context *context = GetValidGlobalContext();
7004     EVENT(context, GLVertexArrayAttribIFormat,
7005           "context = %d, vaobj = %u, attribindex = %u, size = %d, type = %s, relativeoffset = %u",
7006           CID(context), vaobj, attribindex, size,
7007           GLenumToString(BigGLEnum::VertexAttribIType, type), relativeoffset);
7008 
7009     if (context)
7010     {
7011         VertexArrayID vaobjPacked = PackParam<VertexArrayID>(vaobj);
7012         SCOPED_SHARE_CONTEXT_LOCK(context);
7013         bool isCallValid =
7014             (context->skipValidation() ||
7015              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
7016                                                 context->getMutableErrorSetForValidation(),
7017                                                 angle::EntryPoint::GLVertexArrayAttribIFormat) &&
7018               ValidateVertexArrayAttribIFormat(
7019                   context, angle::EntryPoint::GLVertexArrayAttribIFormat, vaobjPacked, attribindex,
7020                   size, type, relativeoffset)));
7021         if (isCallValid)
7022         {
7023             context->vertexArrayAttribIFormat(vaobjPacked, attribindex, size, type, relativeoffset);
7024         }
7025         ANGLE_CAPTURE_GL(VertexArrayAttribIFormat, isCallValid, context, vaobjPacked, attribindex,
7026                          size, type, relativeoffset);
7027     }
7028     else
7029     {
7030         GenerateContextLostErrorOnCurrentGlobalContext();
7031     }
7032     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7033 }
7034 
GL_VertexArrayAttribLFormat(GLuint vaobj,GLuint attribindex,GLint size,GLenum type,GLuint relativeoffset)7035 void GL_APIENTRY GL_VertexArrayAttribLFormat(GLuint vaobj,
7036                                              GLuint attribindex,
7037                                              GLint size,
7038                                              GLenum type,
7039                                              GLuint relativeoffset)
7040 {
7041     Context *context = GetValidGlobalContext();
7042     EVENT(context, GLVertexArrayAttribLFormat,
7043           "context = %d, vaobj = %u, attribindex = %u, size = %d, type = %s, relativeoffset = %u",
7044           CID(context), vaobj, attribindex, size,
7045           GLenumToString(BigGLEnum::VertexAttribLType, type), relativeoffset);
7046 
7047     if (context)
7048     {
7049         VertexArrayID vaobjPacked = PackParam<VertexArrayID>(vaobj);
7050         SCOPED_SHARE_CONTEXT_LOCK(context);
7051         bool isCallValid =
7052             (context->skipValidation() ||
7053              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
7054                                                 context->getMutableErrorSetForValidation(),
7055                                                 angle::EntryPoint::GLVertexArrayAttribLFormat) &&
7056               ValidateVertexArrayAttribLFormat(
7057                   context, angle::EntryPoint::GLVertexArrayAttribLFormat, vaobjPacked, attribindex,
7058                   size, type, relativeoffset)));
7059         if (isCallValid)
7060         {
7061             context->vertexArrayAttribLFormat(vaobjPacked, attribindex, size, type, relativeoffset);
7062         }
7063         ANGLE_CAPTURE_GL(VertexArrayAttribLFormat, isCallValid, context, vaobjPacked, attribindex,
7064                          size, type, relativeoffset);
7065     }
7066     else
7067     {
7068         GenerateContextLostErrorOnCurrentGlobalContext();
7069     }
7070     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7071 }
7072 
GL_VertexArrayBindingDivisor(GLuint vaobj,GLuint bindingindex,GLuint divisor)7073 void GL_APIENTRY GL_VertexArrayBindingDivisor(GLuint vaobj, GLuint bindingindex, GLuint divisor)
7074 {
7075     Context *context = GetValidGlobalContext();
7076     EVENT(context, GLVertexArrayBindingDivisor,
7077           "context = %d, vaobj = %u, bindingindex = %u, divisor = %u", CID(context), vaobj,
7078           bindingindex, divisor);
7079 
7080     if (context)
7081     {
7082         VertexArrayID vaobjPacked = PackParam<VertexArrayID>(vaobj);
7083         SCOPED_SHARE_CONTEXT_LOCK(context);
7084         bool isCallValid =
7085             (context->skipValidation() ||
7086              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
7087                                                 context->getMutableErrorSetForValidation(),
7088                                                 angle::EntryPoint::GLVertexArrayBindingDivisor) &&
7089               ValidateVertexArrayBindingDivisor(context,
7090                                                 angle::EntryPoint::GLVertexArrayBindingDivisor,
7091                                                 vaobjPacked, bindingindex, divisor)));
7092         if (isCallValid)
7093         {
7094             context->vertexArrayBindingDivisor(vaobjPacked, bindingindex, divisor);
7095         }
7096         ANGLE_CAPTURE_GL(VertexArrayBindingDivisor, isCallValid, context, vaobjPacked, bindingindex,
7097                          divisor);
7098     }
7099     else
7100     {
7101         GenerateContextLostErrorOnCurrentGlobalContext();
7102     }
7103     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7104 }
7105 
GL_VertexArrayElementBuffer(GLuint vaobj,GLuint buffer)7106 void GL_APIENTRY GL_VertexArrayElementBuffer(GLuint vaobj, GLuint buffer)
7107 {
7108     Context *context = GetValidGlobalContext();
7109     EVENT(context, GLVertexArrayElementBuffer, "context = %d, vaobj = %u, buffer = %u",
7110           CID(context), vaobj, buffer);
7111 
7112     if (context)
7113     {
7114         VertexArrayID vaobjPacked = PackParam<VertexArrayID>(vaobj);
7115         BufferID bufferPacked     = PackParam<BufferID>(buffer);
7116         SCOPED_SHARE_CONTEXT_LOCK(context);
7117         bool isCallValid =
7118             (context->skipValidation() ||
7119              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
7120                                                 context->getMutableErrorSetForValidation(),
7121                                                 angle::EntryPoint::GLVertexArrayElementBuffer) &&
7122               ValidateVertexArrayElementBuffer(context,
7123                                                angle::EntryPoint::GLVertexArrayElementBuffer,
7124                                                vaobjPacked, bufferPacked)));
7125         if (isCallValid)
7126         {
7127             context->vertexArrayElementBuffer(vaobjPacked, bufferPacked);
7128         }
7129         ANGLE_CAPTURE_GL(VertexArrayElementBuffer, isCallValid, context, vaobjPacked, bufferPacked);
7130     }
7131     else
7132     {
7133         GenerateContextLostErrorOnCurrentGlobalContext();
7134     }
7135     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7136 }
7137 
GL_VertexArrayVertexBuffer(GLuint vaobj,GLuint bindingindex,GLuint buffer,GLintptr offset,GLsizei stride)7138 void GL_APIENTRY GL_VertexArrayVertexBuffer(GLuint vaobj,
7139                                             GLuint bindingindex,
7140                                             GLuint buffer,
7141                                             GLintptr offset,
7142                                             GLsizei stride)
7143 {
7144     Context *context = GetValidGlobalContext();
7145     EVENT(context, GLVertexArrayVertexBuffer,
7146           "context = %d, vaobj = %u, bindingindex = %u, buffer = %u, offset = %llu, stride = %d",
7147           CID(context), vaobj, bindingindex, buffer, static_cast<unsigned long long>(offset),
7148           stride);
7149 
7150     if (context)
7151     {
7152         VertexArrayID vaobjPacked = PackParam<VertexArrayID>(vaobj);
7153         BufferID bufferPacked     = PackParam<BufferID>(buffer);
7154         SCOPED_SHARE_CONTEXT_LOCK(context);
7155         bool isCallValid =
7156             (context->skipValidation() ||
7157              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
7158                                                 context->getMutableErrorSetForValidation(),
7159                                                 angle::EntryPoint::GLVertexArrayVertexBuffer) &&
7160               ValidateVertexArrayVertexBuffer(context, angle::EntryPoint::GLVertexArrayVertexBuffer,
7161                                               vaobjPacked, bindingindex, bufferPacked, offset,
7162                                               stride)));
7163         if (isCallValid)
7164         {
7165             context->vertexArrayVertexBuffer(vaobjPacked, bindingindex, bufferPacked, offset,
7166                                              stride);
7167         }
7168         ANGLE_CAPTURE_GL(VertexArrayVertexBuffer, isCallValid, context, vaobjPacked, bindingindex,
7169                          bufferPacked, offset, stride);
7170     }
7171     else
7172     {
7173         GenerateContextLostErrorOnCurrentGlobalContext();
7174     }
7175     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7176 }
7177 
GL_VertexArrayVertexBuffers(GLuint vaobj,GLuint first,GLsizei count,const GLuint * buffers,const GLintptr * offsets,const GLsizei * strides)7178 void GL_APIENTRY GL_VertexArrayVertexBuffers(GLuint vaobj,
7179                                              GLuint first,
7180                                              GLsizei count,
7181                                              const GLuint *buffers,
7182                                              const GLintptr *offsets,
7183                                              const GLsizei *strides)
7184 {
7185     Context *context = GetValidGlobalContext();
7186     EVENT(context, GLVertexArrayVertexBuffers,
7187           "context = %d, vaobj = %u, first = %u, count = %d, buffers = 0x%016" PRIxPTR
7188           ", offsets = 0x%016" PRIxPTR ", strides = 0x%016" PRIxPTR "",
7189           CID(context), vaobj, first, count, (uintptr_t)buffers, (uintptr_t)offsets,
7190           (uintptr_t)strides);
7191 
7192     if (context)
7193     {
7194         VertexArrayID vaobjPacked     = PackParam<VertexArrayID>(vaobj);
7195         const BufferID *buffersPacked = PackParam<const BufferID *>(buffers);
7196         SCOPED_SHARE_CONTEXT_LOCK(context);
7197         bool isCallValid =
7198             (context->skipValidation() ||
7199              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
7200                                                 context->getMutableErrorSetForValidation(),
7201                                                 angle::EntryPoint::GLVertexArrayVertexBuffers) &&
7202               ValidateVertexArrayVertexBuffers(
7203                   context, angle::EntryPoint::GLVertexArrayVertexBuffers, vaobjPacked, first, count,
7204                   buffersPacked, offsets, strides)));
7205         if (isCallValid)
7206         {
7207             context->vertexArrayVertexBuffers(vaobjPacked, first, count, buffersPacked, offsets,
7208                                               strides);
7209         }
7210         ANGLE_CAPTURE_GL(VertexArrayVertexBuffers, isCallValid, context, vaobjPacked, first, count,
7211                          buffersPacked, offsets, strides);
7212     }
7213     else
7214     {
7215         GenerateContextLostErrorOnCurrentGlobalContext();
7216     }
7217     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7218 }
7219 
7220 // GL 4.6
GL_MultiDrawArraysIndirectCount(GLenum mode,const void * indirect,GLintptr drawcount,GLsizei maxdrawcount,GLsizei stride)7221 void GL_APIENTRY GL_MultiDrawArraysIndirectCount(GLenum mode,
7222                                                  const void *indirect,
7223                                                  GLintptr drawcount,
7224                                                  GLsizei maxdrawcount,
7225                                                  GLsizei stride)
7226 {
7227     Context *context = GetValidGlobalContext();
7228     EVENT(context, GLMultiDrawArraysIndirectCount,
7229           "context = %d, mode = %s, indirect = 0x%016" PRIxPTR
7230           ", drawcount = %llu, maxdrawcount = %d, stride = %d",
7231           CID(context), GLenumToString(BigGLEnum::PrimitiveType, mode), (uintptr_t)indirect,
7232           static_cast<unsigned long long>(drawcount), maxdrawcount, stride);
7233 
7234     if (context)
7235     {
7236         SCOPED_SHARE_CONTEXT_LOCK(context);
7237         bool isCallValid =
7238             (context->skipValidation() ||
7239              (ValidatePixelLocalStorageInactive(
7240                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
7241                   angle::EntryPoint::GLMultiDrawArraysIndirectCount) &&
7242               ValidateMultiDrawArraysIndirectCount(
7243                   context, angle::EntryPoint::GLMultiDrawArraysIndirectCount, mode, indirect,
7244                   drawcount, maxdrawcount, stride)));
7245         if (isCallValid)
7246         {
7247             context->multiDrawArraysIndirectCount(mode, indirect, drawcount, maxdrawcount, stride);
7248         }
7249         ANGLE_CAPTURE_GL(MultiDrawArraysIndirectCount, isCallValid, context, mode, indirect,
7250                          drawcount, maxdrawcount, stride);
7251     }
7252     else
7253     {
7254         GenerateContextLostErrorOnCurrentGlobalContext();
7255     }
7256     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7257 }
7258 
GL_MultiDrawElementsIndirectCount(GLenum mode,GLenum type,const void * indirect,GLintptr drawcount,GLsizei maxdrawcount,GLsizei stride)7259 void GL_APIENTRY GL_MultiDrawElementsIndirectCount(GLenum mode,
7260                                                    GLenum type,
7261                                                    const void *indirect,
7262                                                    GLintptr drawcount,
7263                                                    GLsizei maxdrawcount,
7264                                                    GLsizei stride)
7265 {
7266     Context *context = GetValidGlobalContext();
7267     EVENT(context, GLMultiDrawElementsIndirectCount,
7268           "context = %d, mode = %s, type = %s, indirect = 0x%016" PRIxPTR
7269           ", drawcount = %llu, maxdrawcount = %d, stride = %d",
7270           CID(context), GLenumToString(BigGLEnum::PrimitiveType, mode),
7271           GLenumToString(BigGLEnum::DrawElementsType, type), (uintptr_t)indirect,
7272           static_cast<unsigned long long>(drawcount), maxdrawcount, stride);
7273 
7274     if (context)
7275     {
7276         SCOPED_SHARE_CONTEXT_LOCK(context);
7277         bool isCallValid =
7278             (context->skipValidation() ||
7279              (ValidatePixelLocalStorageInactive(
7280                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
7281                   angle::EntryPoint::GLMultiDrawElementsIndirectCount) &&
7282               ValidateMultiDrawElementsIndirectCount(
7283                   context, angle::EntryPoint::GLMultiDrawElementsIndirectCount, mode, type,
7284                   indirect, drawcount, maxdrawcount, stride)));
7285         if (isCallValid)
7286         {
7287             context->multiDrawElementsIndirectCount(mode, type, indirect, drawcount, maxdrawcount,
7288                                                     stride);
7289         }
7290         ANGLE_CAPTURE_GL(MultiDrawElementsIndirectCount, isCallValid, context, mode, type, indirect,
7291                          drawcount, maxdrawcount, stride);
7292     }
7293     else
7294     {
7295         GenerateContextLostErrorOnCurrentGlobalContext();
7296     }
7297     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7298 }
7299 
GL_PolygonOffsetClamp(GLfloat factor,GLfloat units,GLfloat clamp)7300 void GL_APIENTRY GL_PolygonOffsetClamp(GLfloat factor, GLfloat units, GLfloat clamp)
7301 {
7302     Context *context = GetValidGlobalContext();
7303     EVENT(context, GLPolygonOffsetClamp, "context = %d, factor = %f, units = %f, clamp = %f",
7304           CID(context), factor, units, clamp);
7305 
7306     if (context)
7307     {
7308         bool isCallValid =
7309             (context->skipValidation() ||
7310              ValidatePolygonOffsetClamp(
7311                  context->getPrivateState(), context->getMutableErrorSetForValidation(),
7312                  angle::EntryPoint::GLPolygonOffsetClamp, factor, units, clamp));
7313         if (isCallValid)
7314         {
7315             ContextPrivatePolygonOffsetClamp(context->getMutablePrivateState(),
7316                                              context->getMutablePrivateStateCache(), factor, units,
7317                                              clamp);
7318         }
7319         ANGLE_CAPTURE_GL(PolygonOffsetClamp, isCallValid, context, factor, units, clamp);
7320     }
7321     else
7322     {
7323         GenerateContextLostErrorOnCurrentGlobalContext();
7324     }
7325     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7326 }
7327 
GL_SpecializeShader(GLuint shader,const GLchar * pEntryPoint,GLuint numSpecializationConstants,const GLuint * pConstantIndex,const GLuint * pConstantValue)7328 void GL_APIENTRY GL_SpecializeShader(GLuint shader,
7329                                      const GLchar *pEntryPoint,
7330                                      GLuint numSpecializationConstants,
7331                                      const GLuint *pConstantIndex,
7332                                      const GLuint *pConstantValue)
7333 {
7334     Context *context = GetValidGlobalContext();
7335     EVENT(context, GLSpecializeShader,
7336           "context = %d, shader = %u, pEntryPoint = 0x%016" PRIxPTR
7337           ", numSpecializationConstants = %u, pConstantIndex = 0x%016" PRIxPTR
7338           ", pConstantValue = 0x%016" PRIxPTR "",
7339           CID(context), shader, (uintptr_t)pEntryPoint, numSpecializationConstants,
7340           (uintptr_t)pConstantIndex, (uintptr_t)pConstantValue);
7341 
7342     if (context)
7343     {
7344         SCOPED_SHARE_CONTEXT_LOCK(context);
7345         bool isCallValid =
7346             (context->skipValidation() ||
7347              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
7348                                                 context->getMutableErrorSetForValidation(),
7349                                                 angle::EntryPoint::GLSpecializeShader) &&
7350               ValidateSpecializeShader(context, angle::EntryPoint::GLSpecializeShader, shader,
7351                                        pEntryPoint, numSpecializationConstants, pConstantIndex,
7352                                        pConstantValue)));
7353         if (isCallValid)
7354         {
7355             context->specializeShader(shader, pEntryPoint, numSpecializationConstants,
7356                                       pConstantIndex, pConstantValue);
7357         }
7358         ANGLE_CAPTURE_GL(SpecializeShader, isCallValid, context, shader, pEntryPoint,
7359                          numSpecializationConstants, pConstantIndex, pConstantValue);
7360     }
7361     else
7362     {
7363         GenerateContextLostErrorOnCurrentGlobalContext();
7364     }
7365     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7366 }
7367 
7368 }  // extern "C"
7369