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_2_autogen.cpp:
9 //   Defines the Desktop GL 2.x entry points.
10 
11 #include "libGL/entry_points_gl_2_autogen.h"
12 
13 #include "libANGLE/Context.h"
14 #include "libANGLE/Context.inl.h"
15 #include "libANGLE/capture/gl_enum_utils.h"
16 #include "libANGLE/entry_points_utils.h"
17 #include "libANGLE/validationEGL.h"
18 #include "libANGLE/validationES.h"
19 #include "libANGLE/validationES1.h"
20 #include "libANGLE/validationES2.h"
21 #include "libANGLE/validationES3.h"
22 #include "libANGLE/validationES31.h"
23 #include "libANGLE/validationES32.h"
24 #include "libANGLE/validationESEXT.h"
25 #include "libANGLE/validationGL2_autogen.h"
26 #include "libGLESv2/global_state.h"
27 
28 using namespace gl;
29 
30 extern "C" {
31 
32 // GL 2.0
GL_AttachShader(GLuint program,GLuint shader)33 void GL_APIENTRY GL_AttachShader(GLuint program, GLuint shader)
34 {
35     Context *context = GetValidGlobalContext();
36     EVENT(context, GLAttachShader, "context = %d, program = %u, shader = %u", CID(context), program,
37           shader);
38 
39     if (context)
40     {
41         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
42         ShaderProgramID shaderPacked                          = PackParam<ShaderProgramID>(shader);
43         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
44         bool isCallValid                                      = (context->skipValidation() ||
45                             ValidateAttachShader(context, programPacked, shaderPacked));
46         if (isCallValid)
47         {
48             context->attachShader(programPacked, shaderPacked);
49         }
50         ANGLE_CAPTURE(AttachShader, isCallValid, context, programPacked, shaderPacked);
51     }
52     else
53     {
54         GenerateContextLostErrorOnCurrentGlobalContext();
55     }
56 }
57 
GL_BindAttribLocation(GLuint program,GLuint index,const GLchar * name)58 void GL_APIENTRY GL_BindAttribLocation(GLuint program, GLuint index, const GLchar *name)
59 {
60     Context *context = GetValidGlobalContext();
61     EVENT(context, GLBindAttribLocation,
62           "context = %d, program = %u, index = %u, name = 0x%016" PRIxPTR "", CID(context), program,
63           index, (uintptr_t)name);
64 
65     if (context)
66     {
67         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
68         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
69         bool isCallValid                                      = (context->skipValidation() ||
70                             ValidateBindAttribLocation(context, programPacked, index, name));
71         if (isCallValid)
72         {
73             context->bindAttribLocation(programPacked, index, name);
74         }
75         ANGLE_CAPTURE(BindAttribLocation, isCallValid, context, programPacked, index, name);
76     }
77     else
78     {
79         GenerateContextLostErrorOnCurrentGlobalContext();
80     }
81 }
82 
GL_BlendEquationSeparate(GLenum modeRGB,GLenum modeAlpha)83 void GL_APIENTRY GL_BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
84 {
85     Context *context = GetValidGlobalContext();
86     EVENT(context, GLBlendEquationSeparate, "context = %d, modeRGB = %s, modeAlpha = %s",
87           CID(context), GLenumToString(GLenumGroup::BlendEquationModeEXT, modeRGB),
88           GLenumToString(GLenumGroup::BlendEquationModeEXT, modeAlpha));
89 
90     if (context)
91     {
92         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
93         bool isCallValid                                      = (context->skipValidation() ||
94                             ValidateBlendEquationSeparate(context, modeRGB, modeAlpha));
95         if (isCallValid)
96         {
97             context->blendEquationSeparate(modeRGB, modeAlpha);
98         }
99         ANGLE_CAPTURE(BlendEquationSeparate, isCallValid, context, modeRGB, modeAlpha);
100     }
101     else
102     {
103         GenerateContextLostErrorOnCurrentGlobalContext();
104     }
105 }
106 
GL_CompileShader(GLuint shader)107 void GL_APIENTRY GL_CompileShader(GLuint shader)
108 {
109     Context *context = GetValidGlobalContext();
110     EVENT(context, GLCompileShader, "context = %d, shader = %u", CID(context), shader);
111 
112     if (context)
113     {
114         ShaderProgramID shaderPacked                          = PackParam<ShaderProgramID>(shader);
115         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
116         bool isCallValid =
117             (context->skipValidation() || ValidateCompileShader(context, shaderPacked));
118         if (isCallValid)
119         {
120             context->compileShader(shaderPacked);
121         }
122         ANGLE_CAPTURE(CompileShader, isCallValid, context, shaderPacked);
123     }
124     else
125     {
126         GenerateContextLostErrorOnCurrentGlobalContext();
127     }
128 }
129 
GL_CreateProgram()130 GLuint GL_APIENTRY GL_CreateProgram()
131 {
132     Context *context = GetValidGlobalContext();
133     EVENT(context, GLCreateProgram, "context = %d", CID(context));
134 
135     GLuint returnValue;
136     if (context)
137     {
138         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
139         bool isCallValid = (context->skipValidation() || ValidateCreateProgram(context));
140         if (isCallValid)
141         {
142             returnValue = context->createProgram();
143         }
144         else
145         {
146             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLCreateProgram, GLuint>();
147         }
148         ANGLE_CAPTURE(CreateProgram, isCallValid, context, returnValue);
149     }
150     else
151     {
152         GenerateContextLostErrorOnCurrentGlobalContext();
153         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLCreateProgram, GLuint>();
154     }
155     return returnValue;
156 }
157 
GL_CreateShader(GLenum type)158 GLuint GL_APIENTRY GL_CreateShader(GLenum type)
159 {
160     Context *context = GetValidGlobalContext();
161     EVENT(context, GLCreateShader, "context = %d, type = %s", CID(context),
162           GLenumToString(GLenumGroup::ShaderType, type));
163 
164     GLuint returnValue;
165     if (context)
166     {
167         ShaderType typePacked                                 = PackParam<ShaderType>(type);
168         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
169         bool isCallValid = (context->skipValidation() || ValidateCreateShader(context, typePacked));
170         if (isCallValid)
171         {
172             returnValue = context->createShader(typePacked);
173         }
174         else
175         {
176             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLCreateShader, GLuint>();
177         }
178         ANGLE_CAPTURE(CreateShader, isCallValid, context, typePacked, returnValue);
179     }
180     else
181     {
182         GenerateContextLostErrorOnCurrentGlobalContext();
183         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLCreateShader, GLuint>();
184     }
185     return returnValue;
186 }
187 
GL_DeleteProgram(GLuint program)188 void GL_APIENTRY GL_DeleteProgram(GLuint program)
189 {
190     Context *context = GetValidGlobalContext();
191     EVENT(context, GLDeleteProgram, "context = %d, program = %u", CID(context), program);
192 
193     if (context)
194     {
195         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
196         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
197         bool isCallValid =
198             (context->skipValidation() || ValidateDeleteProgram(context, programPacked));
199         if (isCallValid)
200         {
201             context->deleteProgram(programPacked);
202         }
203         ANGLE_CAPTURE(DeleteProgram, isCallValid, context, programPacked);
204     }
205     else
206     {
207         GenerateContextLostErrorOnCurrentGlobalContext();
208     }
209 }
210 
GL_DeleteShader(GLuint shader)211 void GL_APIENTRY GL_DeleteShader(GLuint shader)
212 {
213     Context *context = GetValidGlobalContext();
214     EVENT(context, GLDeleteShader, "context = %d, shader = %u", CID(context), shader);
215 
216     if (context)
217     {
218         ShaderProgramID shaderPacked                          = PackParam<ShaderProgramID>(shader);
219         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
220         bool isCallValid =
221             (context->skipValidation() || ValidateDeleteShader(context, shaderPacked));
222         if (isCallValid)
223         {
224             context->deleteShader(shaderPacked);
225         }
226         ANGLE_CAPTURE(DeleteShader, isCallValid, context, shaderPacked);
227     }
228     else
229     {
230         GenerateContextLostErrorOnCurrentGlobalContext();
231     }
232 }
233 
GL_DetachShader(GLuint program,GLuint shader)234 void GL_APIENTRY GL_DetachShader(GLuint program, GLuint shader)
235 {
236     Context *context = GetValidGlobalContext();
237     EVENT(context, GLDetachShader, "context = %d, program = %u, shader = %u", CID(context), program,
238           shader);
239 
240     if (context)
241     {
242         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
243         ShaderProgramID shaderPacked                          = PackParam<ShaderProgramID>(shader);
244         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
245         bool isCallValid                                      = (context->skipValidation() ||
246                             ValidateDetachShader(context, programPacked, shaderPacked));
247         if (isCallValid)
248         {
249             context->detachShader(programPacked, shaderPacked);
250         }
251         ANGLE_CAPTURE(DetachShader, isCallValid, context, programPacked, shaderPacked);
252     }
253     else
254     {
255         GenerateContextLostErrorOnCurrentGlobalContext();
256     }
257 }
258 
GL_DisableVertexAttribArray(GLuint index)259 void GL_APIENTRY GL_DisableVertexAttribArray(GLuint index)
260 {
261     Context *context = GetValidGlobalContext();
262     EVENT(context, GLDisableVertexAttribArray, "context = %d, index = %u", CID(context), index);
263 
264     if (context)
265     {
266         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
267         bool isCallValid =
268             (context->skipValidation() || ValidateDisableVertexAttribArray(context, index));
269         if (isCallValid)
270         {
271             context->disableVertexAttribArray(index);
272         }
273         ANGLE_CAPTURE(DisableVertexAttribArray, isCallValid, context, index);
274     }
275     else
276     {
277         GenerateContextLostErrorOnCurrentGlobalContext();
278     }
279 }
280 
GL_DrawBuffers(GLsizei n,const GLenum * bufs)281 void GL_APIENTRY GL_DrawBuffers(GLsizei n, const GLenum *bufs)
282 {
283     Context *context = GetValidGlobalContext();
284     EVENT(context, GLDrawBuffers, "context = %d, n = %d, bufs = 0x%016" PRIxPTR "", CID(context), n,
285           (uintptr_t)bufs);
286 
287     if (context)
288     {
289         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
290         bool isCallValid = (context->skipValidation() || ValidateDrawBuffers(context, n, bufs));
291         if (isCallValid)
292         {
293             context->drawBuffers(n, bufs);
294         }
295         ANGLE_CAPTURE(DrawBuffers, isCallValid, context, n, bufs);
296     }
297     else
298     {
299         GenerateContextLostErrorOnCurrentGlobalContext();
300     }
301 }
302 
GL_EnableVertexAttribArray(GLuint index)303 void GL_APIENTRY GL_EnableVertexAttribArray(GLuint index)
304 {
305     Context *context = GetValidGlobalContext();
306     EVENT(context, GLEnableVertexAttribArray, "context = %d, index = %u", CID(context), index);
307 
308     if (context)
309     {
310         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
311         bool isCallValid =
312             (context->skipValidation() || ValidateEnableVertexAttribArray(context, index));
313         if (isCallValid)
314         {
315             context->enableVertexAttribArray(index);
316         }
317         ANGLE_CAPTURE(EnableVertexAttribArray, isCallValid, context, index);
318     }
319     else
320     {
321         GenerateContextLostErrorOnCurrentGlobalContext();
322     }
323 }
324 
GL_GetActiveAttrib(GLuint program,GLuint index,GLsizei bufSize,GLsizei * length,GLint * size,GLenum * type,GLchar * name)325 void GL_APIENTRY GL_GetActiveAttrib(GLuint program,
326                                     GLuint index,
327                                     GLsizei bufSize,
328                                     GLsizei *length,
329                                     GLint *size,
330                                     GLenum *type,
331                                     GLchar *name)
332 {
333     Context *context = GetValidGlobalContext();
334     EVENT(context, GLGetActiveAttrib,
335           "context = %d, program = %u, index = %u, bufSize = %d, length = 0x%016" PRIxPTR
336           ", size = 0x%016" PRIxPTR ", type = 0x%016" PRIxPTR ", name = 0x%016" PRIxPTR "",
337           CID(context), program, index, bufSize, (uintptr_t)length, (uintptr_t)size,
338           (uintptr_t)type, (uintptr_t)name);
339 
340     if (context)
341     {
342         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
343         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
344         bool isCallValid                                      = (context->skipValidation() ||
345                             ValidateGetActiveAttrib(context, programPacked, index, bufSize, length,
346                                                     size, type, name));
347         if (isCallValid)
348         {
349             context->getActiveAttrib(programPacked, index, bufSize, length, size, type, name);
350         }
351         ANGLE_CAPTURE(GetActiveAttrib, isCallValid, context, programPacked, index, bufSize, length,
352                       size, type, name);
353     }
354     else
355     {
356         GenerateContextLostErrorOnCurrentGlobalContext();
357     }
358 }
359 
GL_GetActiveUniform(GLuint program,GLuint index,GLsizei bufSize,GLsizei * length,GLint * size,GLenum * type,GLchar * name)360 void GL_APIENTRY GL_GetActiveUniform(GLuint program,
361                                      GLuint index,
362                                      GLsizei bufSize,
363                                      GLsizei *length,
364                                      GLint *size,
365                                      GLenum *type,
366                                      GLchar *name)
367 {
368     Context *context = GetValidGlobalContext();
369     EVENT(context, GLGetActiveUniform,
370           "context = %d, program = %u, index = %u, bufSize = %d, length = 0x%016" PRIxPTR
371           ", size = 0x%016" PRIxPTR ", type = 0x%016" PRIxPTR ", name = 0x%016" PRIxPTR "",
372           CID(context), program, index, bufSize, (uintptr_t)length, (uintptr_t)size,
373           (uintptr_t)type, (uintptr_t)name);
374 
375     if (context)
376     {
377         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
378         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
379         bool isCallValid                                      = (context->skipValidation() ||
380                             ValidateGetActiveUniform(context, programPacked, index, bufSize, length,
381                                                      size, type, name));
382         if (isCallValid)
383         {
384             context->getActiveUniform(programPacked, index, bufSize, length, size, type, name);
385         }
386         ANGLE_CAPTURE(GetActiveUniform, isCallValid, context, programPacked, index, bufSize, length,
387                       size, type, name);
388     }
389     else
390     {
391         GenerateContextLostErrorOnCurrentGlobalContext();
392     }
393 }
394 
GL_GetAttachedShaders(GLuint program,GLsizei maxCount,GLsizei * count,GLuint * shaders)395 void GL_APIENTRY GL_GetAttachedShaders(GLuint program,
396                                        GLsizei maxCount,
397                                        GLsizei *count,
398                                        GLuint *shaders)
399 {
400     Context *context = GetValidGlobalContext();
401     EVENT(context, GLGetAttachedShaders,
402           "context = %d, program = %u, maxCount = %d, count = 0x%016" PRIxPTR
403           ", shaders = 0x%016" PRIxPTR "",
404           CID(context), program, maxCount, (uintptr_t)count, (uintptr_t)shaders);
405 
406     if (context)
407     {
408         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
409         ShaderProgramID *shadersPacked = PackParam<ShaderProgramID *>(shaders);
410         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
411         bool isCallValid =
412             (context->skipValidation() ||
413              ValidateGetAttachedShaders(context, programPacked, maxCount, count, shadersPacked));
414         if (isCallValid)
415         {
416             context->getAttachedShaders(programPacked, maxCount, count, shadersPacked);
417         }
418         ANGLE_CAPTURE(GetAttachedShaders, isCallValid, context, programPacked, maxCount, count,
419                       shadersPacked);
420     }
421     else
422     {
423         GenerateContextLostErrorOnCurrentGlobalContext();
424     }
425 }
426 
GL_GetAttribLocation(GLuint program,const GLchar * name)427 GLint GL_APIENTRY GL_GetAttribLocation(GLuint program, const GLchar *name)
428 {
429     Context *context = GetValidGlobalContext();
430     EVENT(context, GLGetAttribLocation, "context = %d, program = %u, name = 0x%016" PRIxPTR "",
431           CID(context), program, (uintptr_t)name);
432 
433     GLint returnValue;
434     if (context)
435     {
436         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
437         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
438         bool isCallValid =
439             (context->skipValidation() || ValidateGetAttribLocation(context, programPacked, name));
440         if (isCallValid)
441         {
442             returnValue = context->getAttribLocation(programPacked, name);
443         }
444         else
445         {
446             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetAttribLocation, GLint>();
447         }
448         ANGLE_CAPTURE(GetAttribLocation, isCallValid, context, programPacked, name, returnValue);
449     }
450     else
451     {
452         GenerateContextLostErrorOnCurrentGlobalContext();
453         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetAttribLocation, GLint>();
454     }
455     return returnValue;
456 }
457 
GL_GetProgramInfoLog(GLuint program,GLsizei bufSize,GLsizei * length,GLchar * infoLog)458 void GL_APIENTRY GL_GetProgramInfoLog(GLuint program,
459                                       GLsizei bufSize,
460                                       GLsizei *length,
461                                       GLchar *infoLog)
462 {
463     Context *context = GetValidGlobalContext();
464     EVENT(context, GLGetProgramInfoLog,
465           "context = %d, program = %u, bufSize = %d, length = 0x%016" PRIxPTR
466           ", infoLog = 0x%016" PRIxPTR "",
467           CID(context), program, bufSize, (uintptr_t)length, (uintptr_t)infoLog);
468 
469     if (context)
470     {
471         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
472         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
473         bool isCallValid =
474             (context->skipValidation() ||
475              ValidateGetProgramInfoLog(context, programPacked, bufSize, length, infoLog));
476         if (isCallValid)
477         {
478             context->getProgramInfoLog(programPacked, bufSize, length, infoLog);
479         }
480         ANGLE_CAPTURE(GetProgramInfoLog, isCallValid, context, programPacked, bufSize, length,
481                       infoLog);
482     }
483     else
484     {
485         GenerateContextLostErrorOnCurrentGlobalContext();
486     }
487 }
488 
GL_GetProgramiv(GLuint program,GLenum pname,GLint * params)489 void GL_APIENTRY GL_GetProgramiv(GLuint program, GLenum pname, GLint *params)
490 {
491     Context *context = GetGlobalContext();
492     EVENT(context, GLGetProgramiv,
493           "context = %d, program = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
494           program, GLenumToString(GLenumGroup::ProgramPropertyARB, pname), (uintptr_t)params);
495 
496     if (context)
497     {
498         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
499         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
500         bool isCallValid                                      = (context->skipValidation() ||
501                             ValidateGetProgramiv(context, programPacked, pname, params));
502         if (isCallValid)
503         {
504             context->getProgramiv(programPacked, pname, params);
505         }
506         ANGLE_CAPTURE(GetProgramiv, isCallValid, context, programPacked, pname, params);
507     }
508     else
509     {}
510 }
511 
GL_GetShaderInfoLog(GLuint shader,GLsizei bufSize,GLsizei * length,GLchar * infoLog)512 void GL_APIENTRY GL_GetShaderInfoLog(GLuint shader,
513                                      GLsizei bufSize,
514                                      GLsizei *length,
515                                      GLchar *infoLog)
516 {
517     Context *context = GetValidGlobalContext();
518     EVENT(context, GLGetShaderInfoLog,
519           "context = %d, shader = %u, bufSize = %d, length = 0x%016" PRIxPTR
520           ", infoLog = 0x%016" PRIxPTR "",
521           CID(context), shader, bufSize, (uintptr_t)length, (uintptr_t)infoLog);
522 
523     if (context)
524     {
525         ShaderProgramID shaderPacked                          = PackParam<ShaderProgramID>(shader);
526         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
527         bool isCallValid =
528             (context->skipValidation() ||
529              ValidateGetShaderInfoLog(context, shaderPacked, bufSize, length, infoLog));
530         if (isCallValid)
531         {
532             context->getShaderInfoLog(shaderPacked, bufSize, length, infoLog);
533         }
534         ANGLE_CAPTURE(GetShaderInfoLog, isCallValid, context, shaderPacked, bufSize, length,
535                       infoLog);
536     }
537     else
538     {
539         GenerateContextLostErrorOnCurrentGlobalContext();
540     }
541 }
542 
GL_GetShaderSource(GLuint shader,GLsizei bufSize,GLsizei * length,GLchar * source)543 void GL_APIENTRY GL_GetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
544 {
545     Context *context = GetValidGlobalContext();
546     EVENT(context, GLGetShaderSource,
547           "context = %d, shader = %u, bufSize = %d, length = 0x%016" PRIxPTR
548           ", source = 0x%016" PRIxPTR "",
549           CID(context), shader, bufSize, (uintptr_t)length, (uintptr_t)source);
550 
551     if (context)
552     {
553         ShaderProgramID shaderPacked                          = PackParam<ShaderProgramID>(shader);
554         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
555         bool isCallValid =
556             (context->skipValidation() ||
557              ValidateGetShaderSource(context, shaderPacked, bufSize, length, source));
558         if (isCallValid)
559         {
560             context->getShaderSource(shaderPacked, bufSize, length, source);
561         }
562         ANGLE_CAPTURE(GetShaderSource, isCallValid, context, shaderPacked, bufSize, length, source);
563     }
564     else
565     {
566         GenerateContextLostErrorOnCurrentGlobalContext();
567     }
568 }
569 
GL_GetShaderiv(GLuint shader,GLenum pname,GLint * params)570 void GL_APIENTRY GL_GetShaderiv(GLuint shader, GLenum pname, GLint *params)
571 {
572     Context *context = GetGlobalContext();
573     EVENT(context, GLGetShaderiv,
574           "context = %d, shader = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), shader,
575           GLenumToString(GLenumGroup::ShaderParameterName, pname), (uintptr_t)params);
576 
577     if (context)
578     {
579         ShaderProgramID shaderPacked                          = PackParam<ShaderProgramID>(shader);
580         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
581         bool isCallValid                                      = (context->skipValidation() ||
582                             ValidateGetShaderiv(context, shaderPacked, pname, params));
583         if (isCallValid)
584         {
585             context->getShaderiv(shaderPacked, pname, params);
586         }
587         ANGLE_CAPTURE(GetShaderiv, isCallValid, context, shaderPacked, pname, params);
588     }
589     else
590     {}
591 }
592 
GL_GetUniformLocation(GLuint program,const GLchar * name)593 GLint GL_APIENTRY GL_GetUniformLocation(GLuint program, const GLchar *name)
594 {
595     Context *context = GetValidGlobalContext();
596     EVENT(context, GLGetUniformLocation, "context = %d, program = %u, name = 0x%016" PRIxPTR "",
597           CID(context), program, (uintptr_t)name);
598 
599     GLint returnValue;
600     if (context)
601     {
602         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
603         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
604         bool isCallValid =
605             (context->skipValidation() || ValidateGetUniformLocation(context, programPacked, name));
606         if (isCallValid)
607         {
608             returnValue = context->getUniformLocation(programPacked, name);
609         }
610         else
611         {
612             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetUniformLocation, GLint>();
613         }
614         ANGLE_CAPTURE(GetUniformLocation, isCallValid, context, programPacked, name, returnValue);
615     }
616     else
617     {
618         GenerateContextLostErrorOnCurrentGlobalContext();
619         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetUniformLocation, GLint>();
620     }
621     return returnValue;
622 }
623 
GL_GetUniformfv(GLuint program,GLint location,GLfloat * params)624 void GL_APIENTRY GL_GetUniformfv(GLuint program, GLint location, GLfloat *params)
625 {
626     Context *context = GetValidGlobalContext();
627     EVENT(context, GLGetUniformfv,
628           "context = %d, program = %u, location = %d, params = 0x%016" PRIxPTR "", CID(context),
629           program, location, (uintptr_t)params);
630 
631     if (context)
632     {
633         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
634         UniformLocation locationPacked = PackParam<UniformLocation>(location);
635         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
636         bool isCallValid                                      = (context->skipValidation() ||
637                             ValidateGetUniformfv(context, programPacked, locationPacked, params));
638         if (isCallValid)
639         {
640             context->getUniformfv(programPacked, locationPacked, params);
641         }
642         ANGLE_CAPTURE(GetUniformfv, isCallValid, context, programPacked, locationPacked, params);
643     }
644     else
645     {
646         GenerateContextLostErrorOnCurrentGlobalContext();
647     }
648 }
649 
GL_GetUniformiv(GLuint program,GLint location,GLint * params)650 void GL_APIENTRY GL_GetUniformiv(GLuint program, GLint location, GLint *params)
651 {
652     Context *context = GetValidGlobalContext();
653     EVENT(context, GLGetUniformiv,
654           "context = %d, program = %u, location = %d, params = 0x%016" PRIxPTR "", CID(context),
655           program, location, (uintptr_t)params);
656 
657     if (context)
658     {
659         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
660         UniformLocation locationPacked = PackParam<UniformLocation>(location);
661         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
662         bool isCallValid                                      = (context->skipValidation() ||
663                             ValidateGetUniformiv(context, programPacked, locationPacked, params));
664         if (isCallValid)
665         {
666             context->getUniformiv(programPacked, locationPacked, params);
667         }
668         ANGLE_CAPTURE(GetUniformiv, isCallValid, context, programPacked, locationPacked, params);
669     }
670     else
671     {
672         GenerateContextLostErrorOnCurrentGlobalContext();
673     }
674 }
675 
GL_GetVertexAttribPointerv(GLuint index,GLenum pname,void ** pointer)676 void GL_APIENTRY GL_GetVertexAttribPointerv(GLuint index, GLenum pname, void **pointer)
677 {
678     Context *context = GetValidGlobalContext();
679     EVENT(context, GLGetVertexAttribPointerv,
680           "context = %d, index = %u, pname = %s, pointer = 0x%016" PRIxPTR "", CID(context), index,
681           GLenumToString(GLenumGroup::DefaultGroup, pname), (uintptr_t)pointer);
682 
683     if (context)
684     {
685         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
686         bool isCallValid                                      = (context->skipValidation() ||
687                             ValidateGetVertexAttribPointerv(context, index, pname, pointer));
688         if (isCallValid)
689         {
690             context->getVertexAttribPointerv(index, pname, pointer);
691         }
692         ANGLE_CAPTURE(GetVertexAttribPointerv, isCallValid, context, index, pname, pointer);
693     }
694     else
695     {
696         GenerateContextLostErrorOnCurrentGlobalContext();
697     }
698 }
699 
GL_GetVertexAttribdv(GLuint index,GLenum pname,GLdouble * params)700 void GL_APIENTRY GL_GetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
701 {
702     Context *context = GetValidGlobalContext();
703     EVENT(context, GLGetVertexAttribdv,
704           "context = %d, index = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), index,
705           GLenumToString(GLenumGroup::DefaultGroup, pname), (uintptr_t)params);
706 
707     if (context)
708     {
709         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
710         bool isCallValid =
711             (context->skipValidation() || ValidateGetVertexAttribdv(context, index, pname, params));
712         if (isCallValid)
713         {
714             context->getVertexAttribdv(index, pname, params);
715         }
716         ANGLE_CAPTURE(GetVertexAttribdv, isCallValid, context, index, pname, params);
717     }
718     else
719     {
720         GenerateContextLostErrorOnCurrentGlobalContext();
721     }
722 }
723 
GL_GetVertexAttribfv(GLuint index,GLenum pname,GLfloat * params)724 void GL_APIENTRY GL_GetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
725 {
726     Context *context = GetValidGlobalContext();
727     EVENT(context, GLGetVertexAttribfv,
728           "context = %d, index = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), index,
729           GLenumToString(GLenumGroup::DefaultGroup, pname), (uintptr_t)params);
730 
731     if (context)
732     {
733         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
734         bool isCallValid =
735             (context->skipValidation() || ValidateGetVertexAttribfv(context, index, pname, params));
736         if (isCallValid)
737         {
738             context->getVertexAttribfv(index, pname, params);
739         }
740         ANGLE_CAPTURE(GetVertexAttribfv, isCallValid, context, index, pname, params);
741     }
742     else
743     {
744         GenerateContextLostErrorOnCurrentGlobalContext();
745     }
746 }
747 
GL_GetVertexAttribiv(GLuint index,GLenum pname,GLint * params)748 void GL_APIENTRY GL_GetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
749 {
750     Context *context = GetValidGlobalContext();
751     EVENT(context, GLGetVertexAttribiv,
752           "context = %d, index = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), index,
753           GLenumToString(GLenumGroup::DefaultGroup, pname), (uintptr_t)params);
754 
755     if (context)
756     {
757         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
758         bool isCallValid =
759             (context->skipValidation() || ValidateGetVertexAttribiv(context, index, pname, params));
760         if (isCallValid)
761         {
762             context->getVertexAttribiv(index, pname, params);
763         }
764         ANGLE_CAPTURE(GetVertexAttribiv, isCallValid, context, index, pname, params);
765     }
766     else
767     {
768         GenerateContextLostErrorOnCurrentGlobalContext();
769     }
770 }
771 
GL_IsProgram(GLuint program)772 GLboolean GL_APIENTRY GL_IsProgram(GLuint program)
773 {
774     Context *context = GetValidGlobalContext();
775     EVENT(context, GLIsProgram, "context = %d, program = %u", CID(context), program);
776 
777     GLboolean returnValue;
778     if (context)
779     {
780         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
781         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
782         bool isCallValid = (context->skipValidation() || ValidateIsProgram(context, programPacked));
783         if (isCallValid)
784         {
785             returnValue = context->isProgram(programPacked);
786         }
787         else
788         {
789             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsProgram, GLboolean>();
790         }
791         ANGLE_CAPTURE(IsProgram, isCallValid, context, programPacked, returnValue);
792     }
793     else
794     {
795         GenerateContextLostErrorOnCurrentGlobalContext();
796         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsProgram, GLboolean>();
797     }
798     return returnValue;
799 }
800 
GL_IsShader(GLuint shader)801 GLboolean GL_APIENTRY GL_IsShader(GLuint shader)
802 {
803     Context *context = GetValidGlobalContext();
804     EVENT(context, GLIsShader, "context = %d, shader = %u", CID(context), shader);
805 
806     GLboolean returnValue;
807     if (context)
808     {
809         ShaderProgramID shaderPacked                          = PackParam<ShaderProgramID>(shader);
810         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
811         bool isCallValid = (context->skipValidation() || ValidateIsShader(context, shaderPacked));
812         if (isCallValid)
813         {
814             returnValue = context->isShader(shaderPacked);
815         }
816         else
817         {
818             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsShader, GLboolean>();
819         }
820         ANGLE_CAPTURE(IsShader, isCallValid, context, shaderPacked, returnValue);
821     }
822     else
823     {
824         GenerateContextLostErrorOnCurrentGlobalContext();
825         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsShader, GLboolean>();
826     }
827     return returnValue;
828 }
829 
GL_LinkProgram(GLuint program)830 void GL_APIENTRY GL_LinkProgram(GLuint program)
831 {
832     Context *context = GetValidGlobalContext();
833     EVENT(context, GLLinkProgram, "context = %d, program = %u", CID(context), program);
834 
835     if (context)
836     {
837         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
838         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
839         bool isCallValid =
840             (context->skipValidation() || ValidateLinkProgram(context, programPacked));
841         if (isCallValid)
842         {
843             context->linkProgram(programPacked);
844         }
845         ANGLE_CAPTURE(LinkProgram, isCallValid, context, programPacked);
846     }
847     else
848     {
849         GenerateContextLostErrorOnCurrentGlobalContext();
850     }
851 }
852 
GL_ShaderSource(GLuint shader,GLsizei count,const GLchar * const * string,const GLint * length)853 void GL_APIENTRY GL_ShaderSource(GLuint shader,
854                                  GLsizei count,
855                                  const GLchar *const *string,
856                                  const GLint *length)
857 {
858     Context *context = GetValidGlobalContext();
859     EVENT(context, GLShaderSource,
860           "context = %d, shader = %u, count = %d, string = 0x%016" PRIxPTR
861           ", length = 0x%016" PRIxPTR "",
862           CID(context), shader, count, (uintptr_t)string, (uintptr_t)length);
863 
864     if (context)
865     {
866         ShaderProgramID shaderPacked                          = PackParam<ShaderProgramID>(shader);
867         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
868         bool isCallValid                                      = (context->skipValidation() ||
869                             ValidateShaderSource(context, shaderPacked, count, string, length));
870         if (isCallValid)
871         {
872             context->shaderSource(shaderPacked, count, string, length);
873         }
874         ANGLE_CAPTURE(ShaderSource, isCallValid, context, shaderPacked, count, string, length);
875     }
876     else
877     {
878         GenerateContextLostErrorOnCurrentGlobalContext();
879     }
880 }
881 
GL_StencilFuncSeparate(GLenum face,GLenum func,GLint ref,GLuint mask)882 void GL_APIENTRY GL_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
883 {
884     Context *context = GetValidGlobalContext();
885     EVENT(context, GLStencilFuncSeparate, "context = %d, face = %s, func = %s, ref = %d, mask = %u",
886           CID(context), GLenumToString(GLenumGroup::StencilFaceDirection, face),
887           GLenumToString(GLenumGroup::StencilFunction, func), ref, mask);
888 
889     if (context)
890     {
891         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
892         bool isCallValid                                      = (context->skipValidation() ||
893                             ValidateStencilFuncSeparate(context, face, func, ref, mask));
894         if (isCallValid)
895         {
896             context->stencilFuncSeparate(face, func, ref, mask);
897         }
898         ANGLE_CAPTURE(StencilFuncSeparate, isCallValid, context, face, func, ref, mask);
899     }
900     else
901     {
902         GenerateContextLostErrorOnCurrentGlobalContext();
903     }
904 }
905 
GL_StencilMaskSeparate(GLenum face,GLuint mask)906 void GL_APIENTRY GL_StencilMaskSeparate(GLenum face, GLuint mask)
907 {
908     Context *context = GetValidGlobalContext();
909     EVENT(context, GLStencilMaskSeparate, "context = %d, face = %s, mask = %u", CID(context),
910           GLenumToString(GLenumGroup::StencilFaceDirection, face), mask);
911 
912     if (context)
913     {
914         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
915         bool isCallValid =
916             (context->skipValidation() || ValidateStencilMaskSeparate(context, face, mask));
917         if (isCallValid)
918         {
919             context->stencilMaskSeparate(face, mask);
920         }
921         ANGLE_CAPTURE(StencilMaskSeparate, isCallValid, context, face, mask);
922     }
923     else
924     {
925         GenerateContextLostErrorOnCurrentGlobalContext();
926     }
927 }
928 
GL_StencilOpSeparate(GLenum face,GLenum sfail,GLenum dpfail,GLenum dppass)929 void GL_APIENTRY GL_StencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
930 {
931     Context *context = GetValidGlobalContext();
932     EVENT(context, GLStencilOpSeparate,
933           "context = %d, face = %s, sfail = %s, dpfail = %s, dppass = %s", CID(context),
934           GLenumToString(GLenumGroup::StencilFaceDirection, face),
935           GLenumToString(GLenumGroup::StencilOp, sfail),
936           GLenumToString(GLenumGroup::StencilOp, dpfail),
937           GLenumToString(GLenumGroup::StencilOp, dppass));
938 
939     if (context)
940     {
941         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
942         bool isCallValid                                      = (context->skipValidation() ||
943                             ValidateStencilOpSeparate(context, face, sfail, dpfail, dppass));
944         if (isCallValid)
945         {
946             context->stencilOpSeparate(face, sfail, dpfail, dppass);
947         }
948         ANGLE_CAPTURE(StencilOpSeparate, isCallValid, context, face, sfail, dpfail, dppass);
949     }
950     else
951     {
952         GenerateContextLostErrorOnCurrentGlobalContext();
953     }
954 }
955 
GL_Uniform1f(GLint location,GLfloat v0)956 void GL_APIENTRY GL_Uniform1f(GLint location, GLfloat v0)
957 {
958     Context *context = GetValidGlobalContext();
959     EVENT(context, GLUniform1f, "context = %d, location = %d, v0 = %f", CID(context), location, v0);
960 
961     if (context)
962     {
963         UniformLocation locationPacked = PackParam<UniformLocation>(location);
964         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
965         bool isCallValid =
966             (context->skipValidation() || ValidateUniform1f(context, locationPacked, v0));
967         if (isCallValid)
968         {
969             context->uniform1f(locationPacked, v0);
970         }
971         ANGLE_CAPTURE(Uniform1f, isCallValid, context, locationPacked, v0);
972     }
973     else
974     {
975         GenerateContextLostErrorOnCurrentGlobalContext();
976     }
977 }
978 
GL_Uniform1fv(GLint location,GLsizei count,const GLfloat * value)979 void GL_APIENTRY GL_Uniform1fv(GLint location, GLsizei count, const GLfloat *value)
980 {
981     Context *context = GetValidGlobalContext();
982     EVENT(context, GLUniform1fv,
983           "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
984           location, count, (uintptr_t)value);
985 
986     if (context)
987     {
988         UniformLocation locationPacked = PackParam<UniformLocation>(location);
989         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
990         bool isCallValid                                      = (context->skipValidation() ||
991                             ValidateUniform1fv(context, locationPacked, count, value));
992         if (isCallValid)
993         {
994             context->uniform1fv(locationPacked, count, value);
995         }
996         ANGLE_CAPTURE(Uniform1fv, isCallValid, context, locationPacked, count, value);
997     }
998     else
999     {
1000         GenerateContextLostErrorOnCurrentGlobalContext();
1001     }
1002 }
1003 
GL_Uniform1i(GLint location,GLint v0)1004 void GL_APIENTRY GL_Uniform1i(GLint location, GLint v0)
1005 {
1006     Context *context = GetValidGlobalContext();
1007     EVENT(context, GLUniform1i, "context = %d, location = %d, v0 = %d", CID(context), location, v0);
1008 
1009     if (context)
1010     {
1011         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1012         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1013         bool isCallValid =
1014             (context->skipValidation() || ValidateUniform1i(context, locationPacked, v0));
1015         if (isCallValid)
1016         {
1017             context->uniform1i(locationPacked, v0);
1018         }
1019         ANGLE_CAPTURE(Uniform1i, isCallValid, context, locationPacked, v0);
1020     }
1021     else
1022     {
1023         GenerateContextLostErrorOnCurrentGlobalContext();
1024     }
1025 }
1026 
GL_Uniform1iv(GLint location,GLsizei count,const GLint * value)1027 void GL_APIENTRY GL_Uniform1iv(GLint location, GLsizei count, const GLint *value)
1028 {
1029     Context *context = GetValidGlobalContext();
1030     EVENT(context, GLUniform1iv,
1031           "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
1032           location, count, (uintptr_t)value);
1033 
1034     if (context)
1035     {
1036         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1037         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1038         bool isCallValid                                      = (context->skipValidation() ||
1039                             ValidateUniform1iv(context, locationPacked, count, value));
1040         if (isCallValid)
1041         {
1042             context->uniform1iv(locationPacked, count, value);
1043         }
1044         ANGLE_CAPTURE(Uniform1iv, isCallValid, context, locationPacked, count, value);
1045     }
1046     else
1047     {
1048         GenerateContextLostErrorOnCurrentGlobalContext();
1049     }
1050 }
1051 
GL_Uniform2f(GLint location,GLfloat v0,GLfloat v1)1052 void GL_APIENTRY GL_Uniform2f(GLint location, GLfloat v0, GLfloat v1)
1053 {
1054     Context *context = GetValidGlobalContext();
1055     EVENT(context, GLUniform2f, "context = %d, location = %d, v0 = %f, v1 = %f", CID(context),
1056           location, v0, v1);
1057 
1058     if (context)
1059     {
1060         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1061         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1062         bool isCallValid =
1063             (context->skipValidation() || ValidateUniform2f(context, locationPacked, v0, v1));
1064         if (isCallValid)
1065         {
1066             context->uniform2f(locationPacked, v0, v1);
1067         }
1068         ANGLE_CAPTURE(Uniform2f, isCallValid, context, locationPacked, v0, v1);
1069     }
1070     else
1071     {
1072         GenerateContextLostErrorOnCurrentGlobalContext();
1073     }
1074 }
1075 
GL_Uniform2fv(GLint location,GLsizei count,const GLfloat * value)1076 void GL_APIENTRY GL_Uniform2fv(GLint location, GLsizei count, const GLfloat *value)
1077 {
1078     Context *context = GetValidGlobalContext();
1079     EVENT(context, GLUniform2fv,
1080           "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
1081           location, count, (uintptr_t)value);
1082 
1083     if (context)
1084     {
1085         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1086         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1087         bool isCallValid                                      = (context->skipValidation() ||
1088                             ValidateUniform2fv(context, locationPacked, count, value));
1089         if (isCallValid)
1090         {
1091             context->uniform2fv(locationPacked, count, value);
1092         }
1093         ANGLE_CAPTURE(Uniform2fv, isCallValid, context, locationPacked, count, value);
1094     }
1095     else
1096     {
1097         GenerateContextLostErrorOnCurrentGlobalContext();
1098     }
1099 }
1100 
GL_Uniform2i(GLint location,GLint v0,GLint v1)1101 void GL_APIENTRY GL_Uniform2i(GLint location, GLint v0, GLint v1)
1102 {
1103     Context *context = GetValidGlobalContext();
1104     EVENT(context, GLUniform2i, "context = %d, location = %d, v0 = %d, v1 = %d", CID(context),
1105           location, v0, v1);
1106 
1107     if (context)
1108     {
1109         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1110         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1111         bool isCallValid =
1112             (context->skipValidation() || ValidateUniform2i(context, locationPacked, v0, v1));
1113         if (isCallValid)
1114         {
1115             context->uniform2i(locationPacked, v0, v1);
1116         }
1117         ANGLE_CAPTURE(Uniform2i, isCallValid, context, locationPacked, v0, v1);
1118     }
1119     else
1120     {
1121         GenerateContextLostErrorOnCurrentGlobalContext();
1122     }
1123 }
1124 
GL_Uniform2iv(GLint location,GLsizei count,const GLint * value)1125 void GL_APIENTRY GL_Uniform2iv(GLint location, GLsizei count, const GLint *value)
1126 {
1127     Context *context = GetValidGlobalContext();
1128     EVENT(context, GLUniform2iv,
1129           "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
1130           location, count, (uintptr_t)value);
1131 
1132     if (context)
1133     {
1134         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1135         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1136         bool isCallValid                                      = (context->skipValidation() ||
1137                             ValidateUniform2iv(context, locationPacked, count, value));
1138         if (isCallValid)
1139         {
1140             context->uniform2iv(locationPacked, count, value);
1141         }
1142         ANGLE_CAPTURE(Uniform2iv, isCallValid, context, locationPacked, count, value);
1143     }
1144     else
1145     {
1146         GenerateContextLostErrorOnCurrentGlobalContext();
1147     }
1148 }
1149 
GL_Uniform3f(GLint location,GLfloat v0,GLfloat v1,GLfloat v2)1150 void GL_APIENTRY GL_Uniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
1151 {
1152     Context *context = GetValidGlobalContext();
1153     EVENT(context, GLUniform3f, "context = %d, location = %d, v0 = %f, v1 = %f, v2 = %f",
1154           CID(context), location, v0, v1, v2);
1155 
1156     if (context)
1157     {
1158         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1159         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1160         bool isCallValid =
1161             (context->skipValidation() || ValidateUniform3f(context, locationPacked, v0, v1, v2));
1162         if (isCallValid)
1163         {
1164             context->uniform3f(locationPacked, v0, v1, v2);
1165         }
1166         ANGLE_CAPTURE(Uniform3f, isCallValid, context, locationPacked, v0, v1, v2);
1167     }
1168     else
1169     {
1170         GenerateContextLostErrorOnCurrentGlobalContext();
1171     }
1172 }
1173 
GL_Uniform3fv(GLint location,GLsizei count,const GLfloat * value)1174 void GL_APIENTRY GL_Uniform3fv(GLint location, GLsizei count, const GLfloat *value)
1175 {
1176     Context *context = GetValidGlobalContext();
1177     EVENT(context, GLUniform3fv,
1178           "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
1179           location, count, (uintptr_t)value);
1180 
1181     if (context)
1182     {
1183         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1184         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1185         bool isCallValid                                      = (context->skipValidation() ||
1186                             ValidateUniform3fv(context, locationPacked, count, value));
1187         if (isCallValid)
1188         {
1189             context->uniform3fv(locationPacked, count, value);
1190         }
1191         ANGLE_CAPTURE(Uniform3fv, isCallValid, context, locationPacked, count, value);
1192     }
1193     else
1194     {
1195         GenerateContextLostErrorOnCurrentGlobalContext();
1196     }
1197 }
1198 
GL_Uniform3i(GLint location,GLint v0,GLint v1,GLint v2)1199 void GL_APIENTRY GL_Uniform3i(GLint location, GLint v0, GLint v1, GLint v2)
1200 {
1201     Context *context = GetValidGlobalContext();
1202     EVENT(context, GLUniform3i, "context = %d, location = %d, v0 = %d, v1 = %d, v2 = %d",
1203           CID(context), location, v0, v1, v2);
1204 
1205     if (context)
1206     {
1207         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1208         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1209         bool isCallValid =
1210             (context->skipValidation() || ValidateUniform3i(context, locationPacked, v0, v1, v2));
1211         if (isCallValid)
1212         {
1213             context->uniform3i(locationPacked, v0, v1, v2);
1214         }
1215         ANGLE_CAPTURE(Uniform3i, isCallValid, context, locationPacked, v0, v1, v2);
1216     }
1217     else
1218     {
1219         GenerateContextLostErrorOnCurrentGlobalContext();
1220     }
1221 }
1222 
GL_Uniform3iv(GLint location,GLsizei count,const GLint * value)1223 void GL_APIENTRY GL_Uniform3iv(GLint location, GLsizei count, const GLint *value)
1224 {
1225     Context *context = GetValidGlobalContext();
1226     EVENT(context, GLUniform3iv,
1227           "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
1228           location, count, (uintptr_t)value);
1229 
1230     if (context)
1231     {
1232         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1233         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1234         bool isCallValid                                      = (context->skipValidation() ||
1235                             ValidateUniform3iv(context, locationPacked, count, value));
1236         if (isCallValid)
1237         {
1238             context->uniform3iv(locationPacked, count, value);
1239         }
1240         ANGLE_CAPTURE(Uniform3iv, isCallValid, context, locationPacked, count, value);
1241     }
1242     else
1243     {
1244         GenerateContextLostErrorOnCurrentGlobalContext();
1245     }
1246 }
1247 
GL_Uniform4f(GLint location,GLfloat v0,GLfloat v1,GLfloat v2,GLfloat v3)1248 void GL_APIENTRY GL_Uniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
1249 {
1250     Context *context = GetValidGlobalContext();
1251     EVENT(context, GLUniform4f, "context = %d, location = %d, v0 = %f, v1 = %f, v2 = %f, v3 = %f",
1252           CID(context), location, v0, v1, v2, v3);
1253 
1254     if (context)
1255     {
1256         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1257         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1258         bool isCallValid                                      = (context->skipValidation() ||
1259                             ValidateUniform4f(context, locationPacked, v0, v1, v2, v3));
1260         if (isCallValid)
1261         {
1262             context->uniform4f(locationPacked, v0, v1, v2, v3);
1263         }
1264         ANGLE_CAPTURE(Uniform4f, isCallValid, context, locationPacked, v0, v1, v2, v3);
1265     }
1266     else
1267     {
1268         GenerateContextLostErrorOnCurrentGlobalContext();
1269     }
1270 }
1271 
GL_Uniform4fv(GLint location,GLsizei count,const GLfloat * value)1272 void GL_APIENTRY GL_Uniform4fv(GLint location, GLsizei count, const GLfloat *value)
1273 {
1274     Context *context = GetValidGlobalContext();
1275     EVENT(context, GLUniform4fv,
1276           "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
1277           location, count, (uintptr_t)value);
1278 
1279     if (context)
1280     {
1281         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1282         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1283         bool isCallValid                                      = (context->skipValidation() ||
1284                             ValidateUniform4fv(context, locationPacked, count, value));
1285         if (isCallValid)
1286         {
1287             context->uniform4fv(locationPacked, count, value);
1288         }
1289         ANGLE_CAPTURE(Uniform4fv, isCallValid, context, locationPacked, count, value);
1290     }
1291     else
1292     {
1293         GenerateContextLostErrorOnCurrentGlobalContext();
1294     }
1295 }
1296 
GL_Uniform4i(GLint location,GLint v0,GLint v1,GLint v2,GLint v3)1297 void GL_APIENTRY GL_Uniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
1298 {
1299     Context *context = GetValidGlobalContext();
1300     EVENT(context, GLUniform4i, "context = %d, location = %d, v0 = %d, v1 = %d, v2 = %d, v3 = %d",
1301           CID(context), location, v0, v1, v2, v3);
1302 
1303     if (context)
1304     {
1305         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1306         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1307         bool isCallValid                                      = (context->skipValidation() ||
1308                             ValidateUniform4i(context, locationPacked, v0, v1, v2, v3));
1309         if (isCallValid)
1310         {
1311             context->uniform4i(locationPacked, v0, v1, v2, v3);
1312         }
1313         ANGLE_CAPTURE(Uniform4i, isCallValid, context, locationPacked, v0, v1, v2, v3);
1314     }
1315     else
1316     {
1317         GenerateContextLostErrorOnCurrentGlobalContext();
1318     }
1319 }
1320 
GL_Uniform4iv(GLint location,GLsizei count,const GLint * value)1321 void GL_APIENTRY GL_Uniform4iv(GLint location, GLsizei count, const GLint *value)
1322 {
1323     Context *context = GetValidGlobalContext();
1324     EVENT(context, GLUniform4iv,
1325           "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
1326           location, count, (uintptr_t)value);
1327 
1328     if (context)
1329     {
1330         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1331         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1332         bool isCallValid                                      = (context->skipValidation() ||
1333                             ValidateUniform4iv(context, locationPacked, count, value));
1334         if (isCallValid)
1335         {
1336             context->uniform4iv(locationPacked, count, value);
1337         }
1338         ANGLE_CAPTURE(Uniform4iv, isCallValid, context, locationPacked, count, value);
1339     }
1340     else
1341     {
1342         GenerateContextLostErrorOnCurrentGlobalContext();
1343     }
1344 }
1345 
GL_UniformMatrix2fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)1346 void GL_APIENTRY GL_UniformMatrix2fv(GLint location,
1347                                      GLsizei count,
1348                                      GLboolean transpose,
1349                                      const GLfloat *value)
1350 {
1351     Context *context = GetValidGlobalContext();
1352     EVENT(context, GLUniformMatrix2fv,
1353           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
1354           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
1355 
1356     if (context)
1357     {
1358         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1359         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1360         bool isCallValid =
1361             (context->skipValidation() ||
1362              ValidateUniformMatrix2fv(context, locationPacked, count, transpose, value));
1363         if (isCallValid)
1364         {
1365             context->uniformMatrix2fv(locationPacked, count, transpose, value);
1366         }
1367         ANGLE_CAPTURE(UniformMatrix2fv, isCallValid, context, locationPacked, count, transpose,
1368                       value);
1369     }
1370     else
1371     {
1372         GenerateContextLostErrorOnCurrentGlobalContext();
1373     }
1374 }
1375 
GL_UniformMatrix3fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)1376 void GL_APIENTRY GL_UniformMatrix3fv(GLint location,
1377                                      GLsizei count,
1378                                      GLboolean transpose,
1379                                      const GLfloat *value)
1380 {
1381     Context *context = GetValidGlobalContext();
1382     EVENT(context, GLUniformMatrix3fv,
1383           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
1384           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
1385 
1386     if (context)
1387     {
1388         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1389         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1390         bool isCallValid =
1391             (context->skipValidation() ||
1392              ValidateUniformMatrix3fv(context, locationPacked, count, transpose, value));
1393         if (isCallValid)
1394         {
1395             context->uniformMatrix3fv(locationPacked, count, transpose, value);
1396         }
1397         ANGLE_CAPTURE(UniformMatrix3fv, isCallValid, context, locationPacked, count, transpose,
1398                       value);
1399     }
1400     else
1401     {
1402         GenerateContextLostErrorOnCurrentGlobalContext();
1403     }
1404 }
1405 
GL_UniformMatrix4fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)1406 void GL_APIENTRY GL_UniformMatrix4fv(GLint location,
1407                                      GLsizei count,
1408                                      GLboolean transpose,
1409                                      const GLfloat *value)
1410 {
1411     Context *context = GetValidGlobalContext();
1412     EVENT(context, GLUniformMatrix4fv,
1413           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
1414           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
1415 
1416     if (context)
1417     {
1418         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1419         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1420         bool isCallValid =
1421             (context->skipValidation() ||
1422              ValidateUniformMatrix4fv(context, locationPacked, count, transpose, value));
1423         if (isCallValid)
1424         {
1425             context->uniformMatrix4fv(locationPacked, count, transpose, value);
1426         }
1427         ANGLE_CAPTURE(UniformMatrix4fv, isCallValid, context, locationPacked, count, transpose,
1428                       value);
1429     }
1430     else
1431     {
1432         GenerateContextLostErrorOnCurrentGlobalContext();
1433     }
1434 }
1435 
GL_UseProgram(GLuint program)1436 void GL_APIENTRY GL_UseProgram(GLuint program)
1437 {
1438     Context *context = GetValidGlobalContext();
1439     EVENT(context, GLUseProgram, "context = %d, program = %u", CID(context), program);
1440 
1441     if (context)
1442     {
1443         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
1444         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1445         bool isCallValid =
1446             (context->skipValidation() || ValidateUseProgram(context, programPacked));
1447         if (isCallValid)
1448         {
1449             context->useProgram(programPacked);
1450         }
1451         ANGLE_CAPTURE(UseProgram, isCallValid, context, programPacked);
1452     }
1453     else
1454     {
1455         GenerateContextLostErrorOnCurrentGlobalContext();
1456     }
1457 }
1458 
GL_ValidateProgram(GLuint program)1459 void GL_APIENTRY GL_ValidateProgram(GLuint program)
1460 {
1461     Context *context = GetValidGlobalContext();
1462     EVENT(context, GLValidateProgram, "context = %d, program = %u", CID(context), program);
1463 
1464     if (context)
1465     {
1466         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
1467         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1468         bool isCallValid =
1469             (context->skipValidation() || ValidateValidateProgram(context, programPacked));
1470         if (isCallValid)
1471         {
1472             context->validateProgram(programPacked);
1473         }
1474         ANGLE_CAPTURE(ValidateProgram, isCallValid, context, programPacked);
1475     }
1476     else
1477     {
1478         GenerateContextLostErrorOnCurrentGlobalContext();
1479     }
1480 }
1481 
GL_VertexAttrib1d(GLuint index,GLdouble x)1482 void GL_APIENTRY GL_VertexAttrib1d(GLuint index, GLdouble x)
1483 {
1484     Context *context = GetValidGlobalContext();
1485     EVENT(context, GLVertexAttrib1d, "context = %d, index = %u, x = %f", CID(context), index, x);
1486 
1487     if (context)
1488     {
1489         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1490         bool isCallValid = (context->skipValidation() || ValidateVertexAttrib1d(context, index, x));
1491         if (isCallValid)
1492         {
1493             context->vertexAttrib1d(index, x);
1494         }
1495         ANGLE_CAPTURE(VertexAttrib1d, isCallValid, context, index, x);
1496     }
1497     else
1498     {
1499         GenerateContextLostErrorOnCurrentGlobalContext();
1500     }
1501 }
1502 
GL_VertexAttrib1dv(GLuint index,const GLdouble * v)1503 void GL_APIENTRY GL_VertexAttrib1dv(GLuint index, const GLdouble *v)
1504 {
1505     Context *context = GetValidGlobalContext();
1506     EVENT(context, GLVertexAttrib1dv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1507           CID(context), index, (uintptr_t)v);
1508 
1509     if (context)
1510     {
1511         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1512         bool isCallValid =
1513             (context->skipValidation() || ValidateVertexAttrib1dv(context, index, v));
1514         if (isCallValid)
1515         {
1516             context->vertexAttrib1dv(index, v);
1517         }
1518         ANGLE_CAPTURE(VertexAttrib1dv, isCallValid, context, index, v);
1519     }
1520     else
1521     {
1522         GenerateContextLostErrorOnCurrentGlobalContext();
1523     }
1524 }
1525 
GL_VertexAttrib1f(GLuint index,GLfloat x)1526 void GL_APIENTRY GL_VertexAttrib1f(GLuint index, GLfloat x)
1527 {
1528     Context *context = GetValidGlobalContext();
1529     EVENT(context, GLVertexAttrib1f, "context = %d, index = %u, x = %f", CID(context), index, x);
1530 
1531     if (context)
1532     {
1533         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1534         bool isCallValid = (context->skipValidation() || ValidateVertexAttrib1f(context, index, x));
1535         if (isCallValid)
1536         {
1537             context->vertexAttrib1f(index, x);
1538         }
1539         ANGLE_CAPTURE(VertexAttrib1f, isCallValid, context, index, x);
1540     }
1541     else
1542     {
1543         GenerateContextLostErrorOnCurrentGlobalContext();
1544     }
1545 }
1546 
GL_VertexAttrib1fv(GLuint index,const GLfloat * v)1547 void GL_APIENTRY GL_VertexAttrib1fv(GLuint index, const GLfloat *v)
1548 {
1549     Context *context = GetValidGlobalContext();
1550     EVENT(context, GLVertexAttrib1fv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1551           CID(context), index, (uintptr_t)v);
1552 
1553     if (context)
1554     {
1555         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1556         bool isCallValid =
1557             (context->skipValidation() || ValidateVertexAttrib1fv(context, index, v));
1558         if (isCallValid)
1559         {
1560             context->vertexAttrib1fv(index, v);
1561         }
1562         ANGLE_CAPTURE(VertexAttrib1fv, isCallValid, context, index, v);
1563     }
1564     else
1565     {
1566         GenerateContextLostErrorOnCurrentGlobalContext();
1567     }
1568 }
1569 
GL_VertexAttrib1s(GLuint index,GLshort x)1570 void GL_APIENTRY GL_VertexAttrib1s(GLuint index, GLshort x)
1571 {
1572     Context *context = GetValidGlobalContext();
1573     EVENT(context, GLVertexAttrib1s, "context = %d, index = %u, x = %d", CID(context), index, x);
1574 
1575     if (context)
1576     {
1577         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1578         bool isCallValid = (context->skipValidation() || ValidateVertexAttrib1s(context, index, x));
1579         if (isCallValid)
1580         {
1581             context->vertexAttrib1s(index, x);
1582         }
1583         ANGLE_CAPTURE(VertexAttrib1s, isCallValid, context, index, x);
1584     }
1585     else
1586     {
1587         GenerateContextLostErrorOnCurrentGlobalContext();
1588     }
1589 }
1590 
GL_VertexAttrib1sv(GLuint index,const GLshort * v)1591 void GL_APIENTRY GL_VertexAttrib1sv(GLuint index, const GLshort *v)
1592 {
1593     Context *context = GetValidGlobalContext();
1594     EVENT(context, GLVertexAttrib1sv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1595           CID(context), index, (uintptr_t)v);
1596 
1597     if (context)
1598     {
1599         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1600         bool isCallValid =
1601             (context->skipValidation() || ValidateVertexAttrib1sv(context, index, v));
1602         if (isCallValid)
1603         {
1604             context->vertexAttrib1sv(index, v);
1605         }
1606         ANGLE_CAPTURE(VertexAttrib1sv, isCallValid, context, index, v);
1607     }
1608     else
1609     {
1610         GenerateContextLostErrorOnCurrentGlobalContext();
1611     }
1612 }
1613 
GL_VertexAttrib2d(GLuint index,GLdouble x,GLdouble y)1614 void GL_APIENTRY GL_VertexAttrib2d(GLuint index, GLdouble x, GLdouble y)
1615 {
1616     Context *context = GetValidGlobalContext();
1617     EVENT(context, GLVertexAttrib2d, "context = %d, index = %u, x = %f, y = %f", CID(context),
1618           index, x, y);
1619 
1620     if (context)
1621     {
1622         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1623         bool isCallValid =
1624             (context->skipValidation() || ValidateVertexAttrib2d(context, index, x, y));
1625         if (isCallValid)
1626         {
1627             context->vertexAttrib2d(index, x, y);
1628         }
1629         ANGLE_CAPTURE(VertexAttrib2d, isCallValid, context, index, x, y);
1630     }
1631     else
1632     {
1633         GenerateContextLostErrorOnCurrentGlobalContext();
1634     }
1635 }
1636 
GL_VertexAttrib2dv(GLuint index,const GLdouble * v)1637 void GL_APIENTRY GL_VertexAttrib2dv(GLuint index, const GLdouble *v)
1638 {
1639     Context *context = GetValidGlobalContext();
1640     EVENT(context, GLVertexAttrib2dv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1641           CID(context), index, (uintptr_t)v);
1642 
1643     if (context)
1644     {
1645         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1646         bool isCallValid =
1647             (context->skipValidation() || ValidateVertexAttrib2dv(context, index, v));
1648         if (isCallValid)
1649         {
1650             context->vertexAttrib2dv(index, v);
1651         }
1652         ANGLE_CAPTURE(VertexAttrib2dv, isCallValid, context, index, v);
1653     }
1654     else
1655     {
1656         GenerateContextLostErrorOnCurrentGlobalContext();
1657     }
1658 }
1659 
GL_VertexAttrib2f(GLuint index,GLfloat x,GLfloat y)1660 void GL_APIENTRY GL_VertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
1661 {
1662     Context *context = GetValidGlobalContext();
1663     EVENT(context, GLVertexAttrib2f, "context = %d, index = %u, x = %f, y = %f", CID(context),
1664           index, x, y);
1665 
1666     if (context)
1667     {
1668         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1669         bool isCallValid =
1670             (context->skipValidation() || ValidateVertexAttrib2f(context, index, x, y));
1671         if (isCallValid)
1672         {
1673             context->vertexAttrib2f(index, x, y);
1674         }
1675         ANGLE_CAPTURE(VertexAttrib2f, isCallValid, context, index, x, y);
1676     }
1677     else
1678     {
1679         GenerateContextLostErrorOnCurrentGlobalContext();
1680     }
1681 }
1682 
GL_VertexAttrib2fv(GLuint index,const GLfloat * v)1683 void GL_APIENTRY GL_VertexAttrib2fv(GLuint index, const GLfloat *v)
1684 {
1685     Context *context = GetValidGlobalContext();
1686     EVENT(context, GLVertexAttrib2fv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1687           CID(context), index, (uintptr_t)v);
1688 
1689     if (context)
1690     {
1691         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1692         bool isCallValid =
1693             (context->skipValidation() || ValidateVertexAttrib2fv(context, index, v));
1694         if (isCallValid)
1695         {
1696             context->vertexAttrib2fv(index, v);
1697         }
1698         ANGLE_CAPTURE(VertexAttrib2fv, isCallValid, context, index, v);
1699     }
1700     else
1701     {
1702         GenerateContextLostErrorOnCurrentGlobalContext();
1703     }
1704 }
1705 
GL_VertexAttrib2s(GLuint index,GLshort x,GLshort y)1706 void GL_APIENTRY GL_VertexAttrib2s(GLuint index, GLshort x, GLshort y)
1707 {
1708     Context *context = GetValidGlobalContext();
1709     EVENT(context, GLVertexAttrib2s, "context = %d, index = %u, x = %d, y = %d", CID(context),
1710           index, x, y);
1711 
1712     if (context)
1713     {
1714         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1715         bool isCallValid =
1716             (context->skipValidation() || ValidateVertexAttrib2s(context, index, x, y));
1717         if (isCallValid)
1718         {
1719             context->vertexAttrib2s(index, x, y);
1720         }
1721         ANGLE_CAPTURE(VertexAttrib2s, isCallValid, context, index, x, y);
1722     }
1723     else
1724     {
1725         GenerateContextLostErrorOnCurrentGlobalContext();
1726     }
1727 }
1728 
GL_VertexAttrib2sv(GLuint index,const GLshort * v)1729 void GL_APIENTRY GL_VertexAttrib2sv(GLuint index, const GLshort *v)
1730 {
1731     Context *context = GetValidGlobalContext();
1732     EVENT(context, GLVertexAttrib2sv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1733           CID(context), index, (uintptr_t)v);
1734 
1735     if (context)
1736     {
1737         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1738         bool isCallValid =
1739             (context->skipValidation() || ValidateVertexAttrib2sv(context, index, v));
1740         if (isCallValid)
1741         {
1742             context->vertexAttrib2sv(index, v);
1743         }
1744         ANGLE_CAPTURE(VertexAttrib2sv, isCallValid, context, index, v);
1745     }
1746     else
1747     {
1748         GenerateContextLostErrorOnCurrentGlobalContext();
1749     }
1750 }
1751 
GL_VertexAttrib3d(GLuint index,GLdouble x,GLdouble y,GLdouble z)1752 void GL_APIENTRY GL_VertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
1753 {
1754     Context *context = GetValidGlobalContext();
1755     EVENT(context, GLVertexAttrib3d, "context = %d, index = %u, x = %f, y = %f, z = %f",
1756           CID(context), index, x, y, z);
1757 
1758     if (context)
1759     {
1760         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1761         bool isCallValid =
1762             (context->skipValidation() || ValidateVertexAttrib3d(context, index, x, y, z));
1763         if (isCallValid)
1764         {
1765             context->vertexAttrib3d(index, x, y, z);
1766         }
1767         ANGLE_CAPTURE(VertexAttrib3d, isCallValid, context, index, x, y, z);
1768     }
1769     else
1770     {
1771         GenerateContextLostErrorOnCurrentGlobalContext();
1772     }
1773 }
1774 
GL_VertexAttrib3dv(GLuint index,const GLdouble * v)1775 void GL_APIENTRY GL_VertexAttrib3dv(GLuint index, const GLdouble *v)
1776 {
1777     Context *context = GetValidGlobalContext();
1778     EVENT(context, GLVertexAttrib3dv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1779           CID(context), index, (uintptr_t)v);
1780 
1781     if (context)
1782     {
1783         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1784         bool isCallValid =
1785             (context->skipValidation() || ValidateVertexAttrib3dv(context, index, v));
1786         if (isCallValid)
1787         {
1788             context->vertexAttrib3dv(index, v);
1789         }
1790         ANGLE_CAPTURE(VertexAttrib3dv, isCallValid, context, index, v);
1791     }
1792     else
1793     {
1794         GenerateContextLostErrorOnCurrentGlobalContext();
1795     }
1796 }
1797 
GL_VertexAttrib3f(GLuint index,GLfloat x,GLfloat y,GLfloat z)1798 void GL_APIENTRY GL_VertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
1799 {
1800     Context *context = GetValidGlobalContext();
1801     EVENT(context, GLVertexAttrib3f, "context = %d, index = %u, x = %f, y = %f, z = %f",
1802           CID(context), index, x, y, z);
1803 
1804     if (context)
1805     {
1806         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1807         bool isCallValid =
1808             (context->skipValidation() || ValidateVertexAttrib3f(context, index, x, y, z));
1809         if (isCallValid)
1810         {
1811             context->vertexAttrib3f(index, x, y, z);
1812         }
1813         ANGLE_CAPTURE(VertexAttrib3f, isCallValid, context, index, x, y, z);
1814     }
1815     else
1816     {
1817         GenerateContextLostErrorOnCurrentGlobalContext();
1818     }
1819 }
1820 
GL_VertexAttrib3fv(GLuint index,const GLfloat * v)1821 void GL_APIENTRY GL_VertexAttrib3fv(GLuint index, const GLfloat *v)
1822 {
1823     Context *context = GetValidGlobalContext();
1824     EVENT(context, GLVertexAttrib3fv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1825           CID(context), index, (uintptr_t)v);
1826 
1827     if (context)
1828     {
1829         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1830         bool isCallValid =
1831             (context->skipValidation() || ValidateVertexAttrib3fv(context, index, v));
1832         if (isCallValid)
1833         {
1834             context->vertexAttrib3fv(index, v);
1835         }
1836         ANGLE_CAPTURE(VertexAttrib3fv, isCallValid, context, index, v);
1837     }
1838     else
1839     {
1840         GenerateContextLostErrorOnCurrentGlobalContext();
1841     }
1842 }
1843 
GL_VertexAttrib3s(GLuint index,GLshort x,GLshort y,GLshort z)1844 void GL_APIENTRY GL_VertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z)
1845 {
1846     Context *context = GetValidGlobalContext();
1847     EVENT(context, GLVertexAttrib3s, "context = %d, index = %u, x = %d, y = %d, z = %d",
1848           CID(context), index, x, y, z);
1849 
1850     if (context)
1851     {
1852         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1853         bool isCallValid =
1854             (context->skipValidation() || ValidateVertexAttrib3s(context, index, x, y, z));
1855         if (isCallValid)
1856         {
1857             context->vertexAttrib3s(index, x, y, z);
1858         }
1859         ANGLE_CAPTURE(VertexAttrib3s, isCallValid, context, index, x, y, z);
1860     }
1861     else
1862     {
1863         GenerateContextLostErrorOnCurrentGlobalContext();
1864     }
1865 }
1866 
GL_VertexAttrib3sv(GLuint index,const GLshort * v)1867 void GL_APIENTRY GL_VertexAttrib3sv(GLuint index, const GLshort *v)
1868 {
1869     Context *context = GetValidGlobalContext();
1870     EVENT(context, GLVertexAttrib3sv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1871           CID(context), index, (uintptr_t)v);
1872 
1873     if (context)
1874     {
1875         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1876         bool isCallValid =
1877             (context->skipValidation() || ValidateVertexAttrib3sv(context, index, v));
1878         if (isCallValid)
1879         {
1880             context->vertexAttrib3sv(index, v);
1881         }
1882         ANGLE_CAPTURE(VertexAttrib3sv, isCallValid, context, index, v);
1883     }
1884     else
1885     {
1886         GenerateContextLostErrorOnCurrentGlobalContext();
1887     }
1888 }
1889 
GL_VertexAttrib4Nbv(GLuint index,const GLbyte * v)1890 void GL_APIENTRY GL_VertexAttrib4Nbv(GLuint index, const GLbyte *v)
1891 {
1892     Context *context = GetValidGlobalContext();
1893     EVENT(context, GLVertexAttrib4Nbv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1894           CID(context), index, (uintptr_t)v);
1895 
1896     if (context)
1897     {
1898         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1899         bool isCallValid =
1900             (context->skipValidation() || ValidateVertexAttrib4Nbv(context, index, v));
1901         if (isCallValid)
1902         {
1903             context->vertexAttrib4Nbv(index, v);
1904         }
1905         ANGLE_CAPTURE(VertexAttrib4Nbv, isCallValid, context, index, v);
1906     }
1907     else
1908     {
1909         GenerateContextLostErrorOnCurrentGlobalContext();
1910     }
1911 }
1912 
GL_VertexAttrib4Niv(GLuint index,const GLint * v)1913 void GL_APIENTRY GL_VertexAttrib4Niv(GLuint index, const GLint *v)
1914 {
1915     Context *context = GetValidGlobalContext();
1916     EVENT(context, GLVertexAttrib4Niv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1917           CID(context), index, (uintptr_t)v);
1918 
1919     if (context)
1920     {
1921         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1922         bool isCallValid =
1923             (context->skipValidation() || ValidateVertexAttrib4Niv(context, index, v));
1924         if (isCallValid)
1925         {
1926             context->vertexAttrib4Niv(index, v);
1927         }
1928         ANGLE_CAPTURE(VertexAttrib4Niv, isCallValid, context, index, v);
1929     }
1930     else
1931     {
1932         GenerateContextLostErrorOnCurrentGlobalContext();
1933     }
1934 }
1935 
GL_VertexAttrib4Nsv(GLuint index,const GLshort * v)1936 void GL_APIENTRY GL_VertexAttrib4Nsv(GLuint index, const GLshort *v)
1937 {
1938     Context *context = GetValidGlobalContext();
1939     EVENT(context, GLVertexAttrib4Nsv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1940           CID(context), index, (uintptr_t)v);
1941 
1942     if (context)
1943     {
1944         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1945         bool isCallValid =
1946             (context->skipValidation() || ValidateVertexAttrib4Nsv(context, index, v));
1947         if (isCallValid)
1948         {
1949             context->vertexAttrib4Nsv(index, v);
1950         }
1951         ANGLE_CAPTURE(VertexAttrib4Nsv, isCallValid, context, index, v);
1952     }
1953     else
1954     {
1955         GenerateContextLostErrorOnCurrentGlobalContext();
1956     }
1957 }
1958 
GL_VertexAttrib4Nub(GLuint index,GLubyte x,GLubyte y,GLubyte z,GLubyte w)1959 void GL_APIENTRY GL_VertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)
1960 {
1961     Context *context = GetValidGlobalContext();
1962     EVENT(context, GLVertexAttrib4Nub, "context = %d, index = %u, x = %d, y = %d, z = %d, w = %d",
1963           CID(context), index, x, y, z, w);
1964 
1965     if (context)
1966     {
1967         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1968         bool isCallValid =
1969             (context->skipValidation() || ValidateVertexAttrib4Nub(context, index, x, y, z, w));
1970         if (isCallValid)
1971         {
1972             context->vertexAttrib4Nub(index, x, y, z, w);
1973         }
1974         ANGLE_CAPTURE(VertexAttrib4Nub, isCallValid, context, index, x, y, z, w);
1975     }
1976     else
1977     {
1978         GenerateContextLostErrorOnCurrentGlobalContext();
1979     }
1980 }
1981 
GL_VertexAttrib4Nubv(GLuint index,const GLubyte * v)1982 void GL_APIENTRY GL_VertexAttrib4Nubv(GLuint index, const GLubyte *v)
1983 {
1984     Context *context = GetValidGlobalContext();
1985     EVENT(context, GLVertexAttrib4Nubv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
1986           CID(context), index, (uintptr_t)v);
1987 
1988     if (context)
1989     {
1990         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1991         bool isCallValid =
1992             (context->skipValidation() || ValidateVertexAttrib4Nubv(context, index, v));
1993         if (isCallValid)
1994         {
1995             context->vertexAttrib4Nubv(index, v);
1996         }
1997         ANGLE_CAPTURE(VertexAttrib4Nubv, isCallValid, context, index, v);
1998     }
1999     else
2000     {
2001         GenerateContextLostErrorOnCurrentGlobalContext();
2002     }
2003 }
2004 
GL_VertexAttrib4Nuiv(GLuint index,const GLuint * v)2005 void GL_APIENTRY GL_VertexAttrib4Nuiv(GLuint index, const GLuint *v)
2006 {
2007     Context *context = GetValidGlobalContext();
2008     EVENT(context, GLVertexAttrib4Nuiv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
2009           CID(context), index, (uintptr_t)v);
2010 
2011     if (context)
2012     {
2013         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2014         bool isCallValid =
2015             (context->skipValidation() || ValidateVertexAttrib4Nuiv(context, index, v));
2016         if (isCallValid)
2017         {
2018             context->vertexAttrib4Nuiv(index, v);
2019         }
2020         ANGLE_CAPTURE(VertexAttrib4Nuiv, isCallValid, context, index, v);
2021     }
2022     else
2023     {
2024         GenerateContextLostErrorOnCurrentGlobalContext();
2025     }
2026 }
2027 
GL_VertexAttrib4Nusv(GLuint index,const GLushort * v)2028 void GL_APIENTRY GL_VertexAttrib4Nusv(GLuint index, const GLushort *v)
2029 {
2030     Context *context = GetValidGlobalContext();
2031     EVENT(context, GLVertexAttrib4Nusv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
2032           CID(context), index, (uintptr_t)v);
2033 
2034     if (context)
2035     {
2036         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2037         bool isCallValid =
2038             (context->skipValidation() || ValidateVertexAttrib4Nusv(context, index, v));
2039         if (isCallValid)
2040         {
2041             context->vertexAttrib4Nusv(index, v);
2042         }
2043         ANGLE_CAPTURE(VertexAttrib4Nusv, isCallValid, context, index, v);
2044     }
2045     else
2046     {
2047         GenerateContextLostErrorOnCurrentGlobalContext();
2048     }
2049 }
2050 
GL_VertexAttrib4bv(GLuint index,const GLbyte * v)2051 void GL_APIENTRY GL_VertexAttrib4bv(GLuint index, const GLbyte *v)
2052 {
2053     Context *context = GetValidGlobalContext();
2054     EVENT(context, GLVertexAttrib4bv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
2055           CID(context), index, (uintptr_t)v);
2056 
2057     if (context)
2058     {
2059         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2060         bool isCallValid =
2061             (context->skipValidation() || ValidateVertexAttrib4bv(context, index, v));
2062         if (isCallValid)
2063         {
2064             context->vertexAttrib4bv(index, v);
2065         }
2066         ANGLE_CAPTURE(VertexAttrib4bv, isCallValid, context, index, v);
2067     }
2068     else
2069     {
2070         GenerateContextLostErrorOnCurrentGlobalContext();
2071     }
2072 }
2073 
GL_VertexAttrib4d(GLuint index,GLdouble x,GLdouble y,GLdouble z,GLdouble w)2074 void GL_APIENTRY GL_VertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
2075 {
2076     Context *context = GetValidGlobalContext();
2077     EVENT(context, GLVertexAttrib4d, "context = %d, index = %u, x = %f, y = %f, z = %f, w = %f",
2078           CID(context), index, x, y, z, w);
2079 
2080     if (context)
2081     {
2082         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2083         bool isCallValid =
2084             (context->skipValidation() || ValidateVertexAttrib4d(context, index, x, y, z, w));
2085         if (isCallValid)
2086         {
2087             context->vertexAttrib4d(index, x, y, z, w);
2088         }
2089         ANGLE_CAPTURE(VertexAttrib4d, isCallValid, context, index, x, y, z, w);
2090     }
2091     else
2092     {
2093         GenerateContextLostErrorOnCurrentGlobalContext();
2094     }
2095 }
2096 
GL_VertexAttrib4dv(GLuint index,const GLdouble * v)2097 void GL_APIENTRY GL_VertexAttrib4dv(GLuint index, const GLdouble *v)
2098 {
2099     Context *context = GetValidGlobalContext();
2100     EVENT(context, GLVertexAttrib4dv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
2101           CID(context), index, (uintptr_t)v);
2102 
2103     if (context)
2104     {
2105         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2106         bool isCallValid =
2107             (context->skipValidation() || ValidateVertexAttrib4dv(context, index, v));
2108         if (isCallValid)
2109         {
2110             context->vertexAttrib4dv(index, v);
2111         }
2112         ANGLE_CAPTURE(VertexAttrib4dv, isCallValid, context, index, v);
2113     }
2114     else
2115     {
2116         GenerateContextLostErrorOnCurrentGlobalContext();
2117     }
2118 }
2119 
GL_VertexAttrib4f(GLuint index,GLfloat x,GLfloat y,GLfloat z,GLfloat w)2120 void GL_APIENTRY GL_VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
2121 {
2122     Context *context = GetValidGlobalContext();
2123     EVENT(context, GLVertexAttrib4f, "context = %d, index = %u, x = %f, y = %f, z = %f, w = %f",
2124           CID(context), index, x, y, z, w);
2125 
2126     if (context)
2127     {
2128         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2129         bool isCallValid =
2130             (context->skipValidation() || ValidateVertexAttrib4f(context, index, x, y, z, w));
2131         if (isCallValid)
2132         {
2133             context->vertexAttrib4f(index, x, y, z, w);
2134         }
2135         ANGLE_CAPTURE(VertexAttrib4f, isCallValid, context, index, x, y, z, w);
2136     }
2137     else
2138     {
2139         GenerateContextLostErrorOnCurrentGlobalContext();
2140     }
2141 }
2142 
GL_VertexAttrib4fv(GLuint index,const GLfloat * v)2143 void GL_APIENTRY GL_VertexAttrib4fv(GLuint index, const GLfloat *v)
2144 {
2145     Context *context = GetValidGlobalContext();
2146     EVENT(context, GLVertexAttrib4fv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
2147           CID(context), index, (uintptr_t)v);
2148 
2149     if (context)
2150     {
2151         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2152         bool isCallValid =
2153             (context->skipValidation() || ValidateVertexAttrib4fv(context, index, v));
2154         if (isCallValid)
2155         {
2156             context->vertexAttrib4fv(index, v);
2157         }
2158         ANGLE_CAPTURE(VertexAttrib4fv, isCallValid, context, index, v);
2159     }
2160     else
2161     {
2162         GenerateContextLostErrorOnCurrentGlobalContext();
2163     }
2164 }
2165 
GL_VertexAttrib4iv(GLuint index,const GLint * v)2166 void GL_APIENTRY GL_VertexAttrib4iv(GLuint index, const GLint *v)
2167 {
2168     Context *context = GetValidGlobalContext();
2169     EVENT(context, GLVertexAttrib4iv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
2170           CID(context), index, (uintptr_t)v);
2171 
2172     if (context)
2173     {
2174         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2175         bool isCallValid =
2176             (context->skipValidation() || ValidateVertexAttrib4iv(context, index, v));
2177         if (isCallValid)
2178         {
2179             context->vertexAttrib4iv(index, v);
2180         }
2181         ANGLE_CAPTURE(VertexAttrib4iv, isCallValid, context, index, v);
2182     }
2183     else
2184     {
2185         GenerateContextLostErrorOnCurrentGlobalContext();
2186     }
2187 }
2188 
GL_VertexAttrib4s(GLuint index,GLshort x,GLshort y,GLshort z,GLshort w)2189 void GL_APIENTRY GL_VertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)
2190 {
2191     Context *context = GetValidGlobalContext();
2192     EVENT(context, GLVertexAttrib4s, "context = %d, index = %u, x = %d, y = %d, z = %d, w = %d",
2193           CID(context), index, x, y, z, w);
2194 
2195     if (context)
2196     {
2197         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2198         bool isCallValid =
2199             (context->skipValidation() || ValidateVertexAttrib4s(context, index, x, y, z, w));
2200         if (isCallValid)
2201         {
2202             context->vertexAttrib4s(index, x, y, z, w);
2203         }
2204         ANGLE_CAPTURE(VertexAttrib4s, isCallValid, context, index, x, y, z, w);
2205     }
2206     else
2207     {
2208         GenerateContextLostErrorOnCurrentGlobalContext();
2209     }
2210 }
2211 
GL_VertexAttrib4sv(GLuint index,const GLshort * v)2212 void GL_APIENTRY GL_VertexAttrib4sv(GLuint index, const GLshort *v)
2213 {
2214     Context *context = GetValidGlobalContext();
2215     EVENT(context, GLVertexAttrib4sv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
2216           CID(context), index, (uintptr_t)v);
2217 
2218     if (context)
2219     {
2220         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2221         bool isCallValid =
2222             (context->skipValidation() || ValidateVertexAttrib4sv(context, index, v));
2223         if (isCallValid)
2224         {
2225             context->vertexAttrib4sv(index, v);
2226         }
2227         ANGLE_CAPTURE(VertexAttrib4sv, isCallValid, context, index, v);
2228     }
2229     else
2230     {
2231         GenerateContextLostErrorOnCurrentGlobalContext();
2232     }
2233 }
2234 
GL_VertexAttrib4ubv(GLuint index,const GLubyte * v)2235 void GL_APIENTRY GL_VertexAttrib4ubv(GLuint index, const GLubyte *v)
2236 {
2237     Context *context = GetValidGlobalContext();
2238     EVENT(context, GLVertexAttrib4ubv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
2239           CID(context), index, (uintptr_t)v);
2240 
2241     if (context)
2242     {
2243         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2244         bool isCallValid =
2245             (context->skipValidation() || ValidateVertexAttrib4ubv(context, index, v));
2246         if (isCallValid)
2247         {
2248             context->vertexAttrib4ubv(index, v);
2249         }
2250         ANGLE_CAPTURE(VertexAttrib4ubv, isCallValid, context, index, v);
2251     }
2252     else
2253     {
2254         GenerateContextLostErrorOnCurrentGlobalContext();
2255     }
2256 }
2257 
GL_VertexAttrib4uiv(GLuint index,const GLuint * v)2258 void GL_APIENTRY GL_VertexAttrib4uiv(GLuint index, const GLuint *v)
2259 {
2260     Context *context = GetValidGlobalContext();
2261     EVENT(context, GLVertexAttrib4uiv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
2262           CID(context), index, (uintptr_t)v);
2263 
2264     if (context)
2265     {
2266         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2267         bool isCallValid =
2268             (context->skipValidation() || ValidateVertexAttrib4uiv(context, index, v));
2269         if (isCallValid)
2270         {
2271             context->vertexAttrib4uiv(index, v);
2272         }
2273         ANGLE_CAPTURE(VertexAttrib4uiv, isCallValid, context, index, v);
2274     }
2275     else
2276     {
2277         GenerateContextLostErrorOnCurrentGlobalContext();
2278     }
2279 }
2280 
GL_VertexAttrib4usv(GLuint index,const GLushort * v)2281 void GL_APIENTRY GL_VertexAttrib4usv(GLuint index, const GLushort *v)
2282 {
2283     Context *context = GetValidGlobalContext();
2284     EVENT(context, GLVertexAttrib4usv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
2285           CID(context), index, (uintptr_t)v);
2286 
2287     if (context)
2288     {
2289         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2290         bool isCallValid =
2291             (context->skipValidation() || ValidateVertexAttrib4usv(context, index, v));
2292         if (isCallValid)
2293         {
2294             context->vertexAttrib4usv(index, v);
2295         }
2296         ANGLE_CAPTURE(VertexAttrib4usv, isCallValid, context, index, v);
2297     }
2298     else
2299     {
2300         GenerateContextLostErrorOnCurrentGlobalContext();
2301     }
2302 }
2303 
GL_VertexAttribPointer(GLuint index,GLint size,GLenum type,GLboolean normalized,GLsizei stride,const void * pointer)2304 void GL_APIENTRY GL_VertexAttribPointer(GLuint index,
2305                                         GLint size,
2306                                         GLenum type,
2307                                         GLboolean normalized,
2308                                         GLsizei stride,
2309                                         const void *pointer)
2310 {
2311     Context *context = GetValidGlobalContext();
2312     EVENT(context, GLVertexAttribPointer,
2313           "context = %d, index = %u, size = %d, type = %s, normalized = %s, stride = %d, pointer = "
2314           "0x%016" PRIxPTR "",
2315           CID(context), index, size, GLenumToString(GLenumGroup::VertexAttribPointerType, type),
2316           GLbooleanToString(normalized), stride, (uintptr_t)pointer);
2317 
2318     if (context)
2319     {
2320         VertexAttribType typePacked                           = PackParam<VertexAttribType>(type);
2321         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2322         bool isCallValid                                      = (context->skipValidation() ||
2323                             ValidateVertexAttribPointer(context, index, size, typePacked,
2324                                                         normalized, stride, pointer));
2325         if (isCallValid)
2326         {
2327             context->vertexAttribPointer(index, size, typePacked, normalized, stride, pointer);
2328         }
2329         ANGLE_CAPTURE(VertexAttribPointer, isCallValid, context, index, size, typePacked,
2330                       normalized, stride, pointer);
2331     }
2332     else
2333     {
2334         GenerateContextLostErrorOnCurrentGlobalContext();
2335     }
2336 }
2337 
2338 // GL 2.1
GL_UniformMatrix2x3fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)2339 void GL_APIENTRY GL_UniformMatrix2x3fv(GLint location,
2340                                        GLsizei count,
2341                                        GLboolean transpose,
2342                                        const GLfloat *value)
2343 {
2344     Context *context = GetValidGlobalContext();
2345     EVENT(context, GLUniformMatrix2x3fv,
2346           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
2347           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
2348 
2349     if (context)
2350     {
2351         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2352         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2353         bool isCallValid =
2354             (context->skipValidation() ||
2355              ValidateUniformMatrix2x3fv(context, locationPacked, count, transpose, value));
2356         if (isCallValid)
2357         {
2358             context->uniformMatrix2x3fv(locationPacked, count, transpose, value);
2359         }
2360         ANGLE_CAPTURE(UniformMatrix2x3fv, isCallValid, context, locationPacked, count, transpose,
2361                       value);
2362     }
2363     else
2364     {
2365         GenerateContextLostErrorOnCurrentGlobalContext();
2366     }
2367 }
2368 
GL_UniformMatrix2x4fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)2369 void GL_APIENTRY GL_UniformMatrix2x4fv(GLint location,
2370                                        GLsizei count,
2371                                        GLboolean transpose,
2372                                        const GLfloat *value)
2373 {
2374     Context *context = GetValidGlobalContext();
2375     EVENT(context, GLUniformMatrix2x4fv,
2376           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
2377           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
2378 
2379     if (context)
2380     {
2381         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2382         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2383         bool isCallValid =
2384             (context->skipValidation() ||
2385              ValidateUniformMatrix2x4fv(context, locationPacked, count, transpose, value));
2386         if (isCallValid)
2387         {
2388             context->uniformMatrix2x4fv(locationPacked, count, transpose, value);
2389         }
2390         ANGLE_CAPTURE(UniformMatrix2x4fv, isCallValid, context, locationPacked, count, transpose,
2391                       value);
2392     }
2393     else
2394     {
2395         GenerateContextLostErrorOnCurrentGlobalContext();
2396     }
2397 }
2398 
GL_UniformMatrix3x2fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)2399 void GL_APIENTRY GL_UniformMatrix3x2fv(GLint location,
2400                                        GLsizei count,
2401                                        GLboolean transpose,
2402                                        const GLfloat *value)
2403 {
2404     Context *context = GetValidGlobalContext();
2405     EVENT(context, GLUniformMatrix3x2fv,
2406           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
2407           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
2408 
2409     if (context)
2410     {
2411         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2412         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2413         bool isCallValid =
2414             (context->skipValidation() ||
2415              ValidateUniformMatrix3x2fv(context, locationPacked, count, transpose, value));
2416         if (isCallValid)
2417         {
2418             context->uniformMatrix3x2fv(locationPacked, count, transpose, value);
2419         }
2420         ANGLE_CAPTURE(UniformMatrix3x2fv, isCallValid, context, locationPacked, count, transpose,
2421                       value);
2422     }
2423     else
2424     {
2425         GenerateContextLostErrorOnCurrentGlobalContext();
2426     }
2427 }
2428 
GL_UniformMatrix3x4fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)2429 void GL_APIENTRY GL_UniformMatrix3x4fv(GLint location,
2430                                        GLsizei count,
2431                                        GLboolean transpose,
2432                                        const GLfloat *value)
2433 {
2434     Context *context = GetValidGlobalContext();
2435     EVENT(context, GLUniformMatrix3x4fv,
2436           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
2437           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
2438 
2439     if (context)
2440     {
2441         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2442         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2443         bool isCallValid =
2444             (context->skipValidation() ||
2445              ValidateUniformMatrix3x4fv(context, locationPacked, count, transpose, value));
2446         if (isCallValid)
2447         {
2448             context->uniformMatrix3x4fv(locationPacked, count, transpose, value);
2449         }
2450         ANGLE_CAPTURE(UniformMatrix3x4fv, isCallValid, context, locationPacked, count, transpose,
2451                       value);
2452     }
2453     else
2454     {
2455         GenerateContextLostErrorOnCurrentGlobalContext();
2456     }
2457 }
2458 
GL_UniformMatrix4x2fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)2459 void GL_APIENTRY GL_UniformMatrix4x2fv(GLint location,
2460                                        GLsizei count,
2461                                        GLboolean transpose,
2462                                        const GLfloat *value)
2463 {
2464     Context *context = GetValidGlobalContext();
2465     EVENT(context, GLUniformMatrix4x2fv,
2466           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
2467           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
2468 
2469     if (context)
2470     {
2471         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2472         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2473         bool isCallValid =
2474             (context->skipValidation() ||
2475              ValidateUniformMatrix4x2fv(context, locationPacked, count, transpose, value));
2476         if (isCallValid)
2477         {
2478             context->uniformMatrix4x2fv(locationPacked, count, transpose, value);
2479         }
2480         ANGLE_CAPTURE(UniformMatrix4x2fv, isCallValid, context, locationPacked, count, transpose,
2481                       value);
2482     }
2483     else
2484     {
2485         GenerateContextLostErrorOnCurrentGlobalContext();
2486     }
2487 }
2488 
GL_UniformMatrix4x3fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)2489 void GL_APIENTRY GL_UniformMatrix4x3fv(GLint location,
2490                                        GLsizei count,
2491                                        GLboolean transpose,
2492                                        const GLfloat *value)
2493 {
2494     Context *context = GetValidGlobalContext();
2495     EVENT(context, GLUniformMatrix4x3fv,
2496           "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
2497           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
2498 
2499     if (context)
2500     {
2501         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2502         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2503         bool isCallValid =
2504             (context->skipValidation() ||
2505              ValidateUniformMatrix4x3fv(context, locationPacked, count, transpose, value));
2506         if (isCallValid)
2507         {
2508             context->uniformMatrix4x3fv(locationPacked, count, transpose, value);
2509         }
2510         ANGLE_CAPTURE(UniformMatrix4x3fv, isCallValid, context, locationPacked, count, transpose,
2511                       value);
2512     }
2513     else
2514     {
2515         GenerateContextLostErrorOnCurrentGlobalContext();
2516     }
2517 }
2518 
2519 }  // extern "C"
2520