• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by generate_entry_points.py using data from gl.xml.
3 //
4 // Copyright 2020 The ANGLE Project Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style license that can be
6 // found in the LICENSE file.
7 //
8 // entry_points_gles_3_1_autogen.cpp:
9 //   Defines the GLES 3.1 entry points.
10 
11 #include "libGLESv2/entry_points_gles_3_1_autogen.h"
12 
13 #include "common/entry_points_enum_autogen.h"
14 #include "libANGLE/Context.h"
15 #include "libANGLE/Context.inl.h"
16 #include "libANGLE/capture/capture_gles_3_1_autogen.h"
17 #include "libANGLE/capture/gl_enum_utils.h"
18 #include "libANGLE/entry_points_utils.h"
19 #include "libANGLE/validationES31.h"
20 #include "libGLESv2/global_state.h"
21 
22 using namespace gl;
23 
24 extern "C" {
GL_ActiveShaderProgram(GLuint pipeline,GLuint program)25 void GL_APIENTRY GL_ActiveShaderProgram(GLuint pipeline, GLuint program)
26 {
27     Context *context = GetValidGlobalContext();
28     EVENT(context, GLActiveShaderProgram, "context = %d, pipeline = %u, program = %u", CID(context),
29           pipeline, program);
30 
31     if (context)
32     {
33         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
34         ShaderProgramID programPacked    = PackParam<ShaderProgramID>(program);
35         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
36         bool isCallValid                                      = (context->skipValidation() ||
37                             ValidateActiveShaderProgram(context, pipelinePacked, programPacked));
38         if (isCallValid)
39         {
40             context->activeShaderProgram(pipelinePacked, programPacked);
41         }
42         ANGLE_CAPTURE(ActiveShaderProgram, isCallValid, context, pipelinePacked, programPacked);
43     }
44     else
45     {
46         GenerateContextLostErrorOnCurrentGlobalContext();
47     }
48 }
49 
GL_BindImageTexture(GLuint unit,GLuint texture,GLint level,GLboolean layered,GLint layer,GLenum access,GLenum format)50 void GL_APIENTRY GL_BindImageTexture(GLuint unit,
51                                      GLuint texture,
52                                      GLint level,
53                                      GLboolean layered,
54                                      GLint layer,
55                                      GLenum access,
56                                      GLenum format)
57 {
58     Context *context = GetValidGlobalContext();
59     EVENT(context, GLBindImageTexture,
60           "context = %d, unit = %u, texture = %u, level = %d, layered = %s, layer = %d, access = "
61           "%s, format = %s",
62           CID(context), unit, texture, level, GLbooleanToString(layered), layer,
63           GLenumToString(GLenumGroup::BufferAccessARB, access),
64           GLenumToString(GLenumGroup::InternalFormat, format));
65 
66     if (context)
67     {
68         TextureID texturePacked                               = PackParam<TextureID>(texture);
69         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
70         bool isCallValid                                      = (context->skipValidation() ||
71                             ValidateBindImageTexture(context, unit, texturePacked, level, layered,
72                                                      layer, access, format));
73         if (isCallValid)
74         {
75             context->bindImageTexture(unit, texturePacked, level, layered, layer, access, format);
76         }
77         ANGLE_CAPTURE(BindImageTexture, isCallValid, context, unit, texturePacked, level, layered,
78                       layer, access, format);
79     }
80     else
81     {
82         GenerateContextLostErrorOnCurrentGlobalContext();
83     }
84 }
85 
GL_BindProgramPipeline(GLuint pipeline)86 void GL_APIENTRY GL_BindProgramPipeline(GLuint pipeline)
87 {
88     Context *context = GetValidGlobalContext();
89     EVENT(context, GLBindProgramPipeline, "context = %d, pipeline = %u", CID(context), pipeline);
90 
91     if (context)
92     {
93         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
94         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
95         bool isCallValid =
96             (context->skipValidation() || ValidateBindProgramPipeline(context, pipelinePacked));
97         if (isCallValid)
98         {
99             context->bindProgramPipeline(pipelinePacked);
100         }
101         ANGLE_CAPTURE(BindProgramPipeline, isCallValid, context, pipelinePacked);
102     }
103     else
104     {
105         GenerateContextLostErrorOnCurrentGlobalContext();
106     }
107 }
108 
GL_BindVertexBuffer(GLuint bindingindex,GLuint buffer,GLintptr offset,GLsizei stride)109 void GL_APIENTRY GL_BindVertexBuffer(GLuint bindingindex,
110                                      GLuint buffer,
111                                      GLintptr offset,
112                                      GLsizei stride)
113 {
114     Context *context = GetValidGlobalContext();
115     EVENT(context, GLBindVertexBuffer,
116           "context = %d, bindingindex = %u, buffer = %u, offset = %llu, stride = %d", CID(context),
117           bindingindex, buffer, static_cast<unsigned long long>(offset), stride);
118 
119     if (context)
120     {
121         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
122         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
123         bool isCallValid =
124             (context->skipValidation() ||
125              ValidateBindVertexBuffer(context, bindingindex, bufferPacked, offset, stride));
126         if (isCallValid)
127         {
128             context->bindVertexBuffer(bindingindex, bufferPacked, offset, stride);
129         }
130         ANGLE_CAPTURE(BindVertexBuffer, isCallValid, context, bindingindex, bufferPacked, offset,
131                       stride);
132     }
133     else
134     {
135         GenerateContextLostErrorOnCurrentGlobalContext();
136     }
137 }
138 
GL_CreateShaderProgramv(GLenum type,GLsizei count,const GLchar * const * strings)139 GLuint GL_APIENTRY GL_CreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const *strings)
140 {
141     Context *context = GetValidGlobalContext();
142     EVENT(context, GLCreateShaderProgramv,
143           "context = %d, type = %s, count = %d, strings = 0x%016" PRIxPTR "", CID(context),
144           GLenumToString(GLenumGroup::ShaderType, type), count, (uintptr_t)strings);
145 
146     GLuint returnValue;
147     if (context)
148     {
149         ShaderType typePacked                                 = PackParam<ShaderType>(type);
150         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
151         bool isCallValid                                      = (context->skipValidation() ||
152                             ValidateCreateShaderProgramv(context, typePacked, count, strings));
153         if (isCallValid)
154         {
155             returnValue = context->createShaderProgramv(typePacked, count, strings);
156         }
157         else
158         {
159             returnValue =
160                 GetDefaultReturnValue<angle::EntryPoint::GLCreateShaderProgramv, GLuint>();
161         }
162         ANGLE_CAPTURE(CreateShaderProgramv, isCallValid, context, typePacked, count, strings,
163                       returnValue);
164     }
165     else
166     {
167         GenerateContextLostErrorOnCurrentGlobalContext();
168         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLCreateShaderProgramv, GLuint>();
169     }
170     return returnValue;
171 }
172 
GL_DeleteProgramPipelines(GLsizei n,const GLuint * pipelines)173 void GL_APIENTRY GL_DeleteProgramPipelines(GLsizei n, const GLuint *pipelines)
174 {
175     Context *context = GetValidGlobalContext();
176     EVENT(context, GLDeleteProgramPipelines, "context = %d, n = %d, pipelines = 0x%016" PRIxPTR "",
177           CID(context), n, (uintptr_t)pipelines);
178 
179     if (context)
180     {
181         const ProgramPipelineID *pipelinesPacked = PackParam<const ProgramPipelineID *>(pipelines);
182         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
183         bool isCallValid                                      = (context->skipValidation() ||
184                             ValidateDeleteProgramPipelines(context, n, pipelinesPacked));
185         if (isCallValid)
186         {
187             context->deleteProgramPipelines(n, pipelinesPacked);
188         }
189         ANGLE_CAPTURE(DeleteProgramPipelines, isCallValid, context, n, pipelinesPacked);
190     }
191     else
192     {
193         GenerateContextLostErrorOnCurrentGlobalContext();
194     }
195 }
196 
GL_DispatchCompute(GLuint num_groups_x,GLuint num_groups_y,GLuint num_groups_z)197 void GL_APIENTRY GL_DispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z)
198 {
199     Context *context = GetValidGlobalContext();
200     EVENT(context, GLDispatchCompute,
201           "context = %d, num_groups_x = %u, num_groups_y = %u, num_groups_z = %u", CID(context),
202           num_groups_x, num_groups_y, num_groups_z);
203 
204     if (context)
205     {
206         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
207         bool isCallValid =
208             (context->skipValidation() ||
209              ValidateDispatchCompute(context, num_groups_x, num_groups_y, num_groups_z));
210         if (isCallValid)
211         {
212             context->dispatchCompute(num_groups_x, num_groups_y, num_groups_z);
213         }
214         ANGLE_CAPTURE(DispatchCompute, isCallValid, context, num_groups_x, num_groups_y,
215                       num_groups_z);
216     }
217     else
218     {
219         GenerateContextLostErrorOnCurrentGlobalContext();
220     }
221 }
222 
GL_DispatchComputeIndirect(GLintptr indirect)223 void GL_APIENTRY GL_DispatchComputeIndirect(GLintptr indirect)
224 {
225     Context *context = GetValidGlobalContext();
226     EVENT(context, GLDispatchComputeIndirect, "context = %d, indirect = %llu", CID(context),
227           static_cast<unsigned long long>(indirect));
228 
229     if (context)
230     {
231         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
232         bool isCallValid =
233             (context->skipValidation() || ValidateDispatchComputeIndirect(context, indirect));
234         if (isCallValid)
235         {
236             context->dispatchComputeIndirect(indirect);
237         }
238         ANGLE_CAPTURE(DispatchComputeIndirect, isCallValid, context, indirect);
239     }
240     else
241     {
242         GenerateContextLostErrorOnCurrentGlobalContext();
243     }
244 }
245 
GL_DrawArraysIndirect(GLenum mode,const void * indirect)246 void GL_APIENTRY GL_DrawArraysIndirect(GLenum mode, const void *indirect)
247 {
248     Context *context = GetValidGlobalContext();
249     EVENT(context, GLDrawArraysIndirect, "context = %d, mode = %s, indirect = 0x%016" PRIxPTR "",
250           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), (uintptr_t)indirect);
251 
252     if (context)
253     {
254         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
255         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
256         bool isCallValid                                      = (context->skipValidation() ||
257                             ValidateDrawArraysIndirect(context, modePacked, indirect));
258         if (isCallValid)
259         {
260             context->drawArraysIndirect(modePacked, indirect);
261         }
262         ANGLE_CAPTURE(DrawArraysIndirect, isCallValid, context, modePacked, indirect);
263     }
264     else
265     {
266         GenerateContextLostErrorOnCurrentGlobalContext();
267     }
268 }
269 
GL_DrawElementsIndirect(GLenum mode,GLenum type,const void * indirect)270 void GL_APIENTRY GL_DrawElementsIndirect(GLenum mode, GLenum type, const void *indirect)
271 {
272     Context *context = GetValidGlobalContext();
273     EVENT(context, GLDrawElementsIndirect,
274           "context = %d, mode = %s, type = %s, indirect = 0x%016" PRIxPTR "", CID(context),
275           GLenumToString(GLenumGroup::PrimitiveType, mode),
276           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indirect);
277 
278     if (context)
279     {
280         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
281         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
282         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
283         bool isCallValid =
284             (context->skipValidation() ||
285              ValidateDrawElementsIndirect(context, modePacked, typePacked, indirect));
286         if (isCallValid)
287         {
288             context->drawElementsIndirect(modePacked, typePacked, indirect);
289         }
290         ANGLE_CAPTURE(DrawElementsIndirect, isCallValid, context, modePacked, typePacked, indirect);
291     }
292     else
293     {
294         GenerateContextLostErrorOnCurrentGlobalContext();
295     }
296 }
297 
GL_FramebufferParameteri(GLenum target,GLenum pname,GLint param)298 void GL_APIENTRY GL_FramebufferParameteri(GLenum target, GLenum pname, GLint param)
299 {
300     Context *context = GetValidGlobalContext();
301     EVENT(context, GLFramebufferParameteri, "context = %d, target = %s, pname = %s, param = %d",
302           CID(context), GLenumToString(GLenumGroup::FramebufferTarget, target),
303           GLenumToString(GLenumGroup::FramebufferParameterName, pname), param);
304 
305     if (context)
306     {
307         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
308         bool isCallValid                                      = (context->skipValidation() ||
309                             ValidateFramebufferParameteri(context, target, pname, param));
310         if (isCallValid)
311         {
312             context->framebufferParameteri(target, pname, param);
313         }
314         ANGLE_CAPTURE(FramebufferParameteri, isCallValid, context, target, pname, param);
315     }
316     else
317     {
318         GenerateContextLostErrorOnCurrentGlobalContext();
319     }
320 }
321 
GL_GenProgramPipelines(GLsizei n,GLuint * pipelines)322 void GL_APIENTRY GL_GenProgramPipelines(GLsizei n, GLuint *pipelines)
323 {
324     Context *context = GetValidGlobalContext();
325     EVENT(context, GLGenProgramPipelines, "context = %d, n = %d, pipelines = 0x%016" PRIxPTR "",
326           CID(context), n, (uintptr_t)pipelines);
327 
328     if (context)
329     {
330         ProgramPipelineID *pipelinesPacked = PackParam<ProgramPipelineID *>(pipelines);
331         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
332         bool isCallValid =
333             (context->skipValidation() || ValidateGenProgramPipelines(context, n, pipelinesPacked));
334         if (isCallValid)
335         {
336             context->genProgramPipelines(n, pipelinesPacked);
337         }
338         ANGLE_CAPTURE(GenProgramPipelines, isCallValid, context, n, pipelinesPacked);
339     }
340     else
341     {
342         GenerateContextLostErrorOnCurrentGlobalContext();
343     }
344 }
345 
GL_GetBooleani_v(GLenum target,GLuint index,GLboolean * data)346 void GL_APIENTRY GL_GetBooleani_v(GLenum target, GLuint index, GLboolean *data)
347 {
348     Context *context = GetValidGlobalContext();
349     EVENT(context, GLGetBooleani_v,
350           "context = %d, target = %s, index = %u, data = 0x%016" PRIxPTR "", CID(context),
351           GLenumToString(GLenumGroup::BufferTargetARB, target), index, (uintptr_t)data);
352 
353     if (context)
354     {
355         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
356         bool isCallValid =
357             (context->skipValidation() || ValidateGetBooleani_v(context, target, index, data));
358         if (isCallValid)
359         {
360             context->getBooleani_v(target, index, data);
361         }
362         ANGLE_CAPTURE(GetBooleani_v, isCallValid, context, target, index, data);
363     }
364     else
365     {
366         GenerateContextLostErrorOnCurrentGlobalContext();
367     }
368 }
369 
GL_GetFramebufferParameteriv(GLenum target,GLenum pname,GLint * params)370 void GL_APIENTRY GL_GetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params)
371 {
372     Context *context = GetValidGlobalContext();
373     EVENT(context, GLGetFramebufferParameteriv,
374           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
375           GLenumToString(GLenumGroup::FramebufferTarget, target),
376           GLenumToString(GLenumGroup::FramebufferAttachmentParameterName, pname),
377           (uintptr_t)params);
378 
379     if (context)
380     {
381         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
382         bool isCallValid                                      = (context->skipValidation() ||
383                             ValidateGetFramebufferParameteriv(context, target, pname, params));
384         if (isCallValid)
385         {
386             context->getFramebufferParameteriv(target, pname, params);
387         }
388         ANGLE_CAPTURE(GetFramebufferParameteriv, isCallValid, context, target, pname, params);
389     }
390     else
391     {
392         GenerateContextLostErrorOnCurrentGlobalContext();
393     }
394 }
395 
GL_GetMultisamplefv(GLenum pname,GLuint index,GLfloat * val)396 void GL_APIENTRY GL_GetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
397 {
398     Context *context = GetValidGlobalContext();
399     EVENT(context, GLGetMultisamplefv,
400           "context = %d, pname = %s, index = %u, val = 0x%016" PRIxPTR "", CID(context),
401           GLenumToString(GLenumGroup::DefaultGroup, pname), index, (uintptr_t)val);
402 
403     if (context)
404     {
405         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
406         bool isCallValid =
407             (context->skipValidation() || ValidateGetMultisamplefv(context, pname, index, val));
408         if (isCallValid)
409         {
410             context->getMultisamplefv(pname, index, val);
411         }
412         ANGLE_CAPTURE(GetMultisamplefv, isCallValid, context, pname, index, val);
413     }
414     else
415     {
416         GenerateContextLostErrorOnCurrentGlobalContext();
417     }
418 }
419 
GL_GetProgramInterfaceiv(GLuint program,GLenum programInterface,GLenum pname,GLint * params)420 void GL_APIENTRY GL_GetProgramInterfaceiv(GLuint program,
421                                           GLenum programInterface,
422                                           GLenum pname,
423                                           GLint *params)
424 {
425     Context *context = GetValidGlobalContext();
426     EVENT(context, GLGetProgramInterfaceiv,
427           "context = %d, program = %u, programInterface = %s, pname = %s, params = 0x%016" PRIxPTR
428           "",
429           CID(context), program, GLenumToString(GLenumGroup::ProgramInterface, programInterface),
430           GLenumToString(GLenumGroup::ProgramInterfacePName, pname), (uintptr_t)params);
431 
432     if (context)
433     {
434         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
435         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
436         bool isCallValid                                      = (context->skipValidation() ||
437                             ValidateGetProgramInterfaceiv(context, programPacked, programInterface,
438                                                           pname, params));
439         if (isCallValid)
440         {
441             context->getProgramInterfaceiv(programPacked, programInterface, pname, params);
442         }
443         ANGLE_CAPTURE(GetProgramInterfaceiv, isCallValid, context, programPacked, programInterface,
444                       pname, params);
445     }
446     else
447     {
448         GenerateContextLostErrorOnCurrentGlobalContext();
449     }
450 }
451 
GL_GetProgramPipelineInfoLog(GLuint pipeline,GLsizei bufSize,GLsizei * length,GLchar * infoLog)452 void GL_APIENTRY GL_GetProgramPipelineInfoLog(GLuint pipeline,
453                                               GLsizei bufSize,
454                                               GLsizei *length,
455                                               GLchar *infoLog)
456 {
457     Context *context = GetValidGlobalContext();
458     EVENT(context, GLGetProgramPipelineInfoLog,
459           "context = %d, pipeline = %u, bufSize = %d, length = 0x%016" PRIxPTR
460           ", infoLog = 0x%016" PRIxPTR "",
461           CID(context), pipeline, bufSize, (uintptr_t)length, (uintptr_t)infoLog);
462 
463     if (context)
464     {
465         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
466         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
467         bool isCallValid =
468             (context->skipValidation() ||
469              ValidateGetProgramPipelineInfoLog(context, pipelinePacked, bufSize, length, infoLog));
470         if (isCallValid)
471         {
472             context->getProgramPipelineInfoLog(pipelinePacked, bufSize, length, infoLog);
473         }
474         ANGLE_CAPTURE(GetProgramPipelineInfoLog, isCallValid, context, pipelinePacked, bufSize,
475                       length, infoLog);
476     }
477     else
478     {
479         GenerateContextLostErrorOnCurrentGlobalContext();
480     }
481 }
482 
GL_GetProgramPipelineiv(GLuint pipeline,GLenum pname,GLint * params)483 void GL_APIENTRY GL_GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
484 {
485     Context *context = GetValidGlobalContext();
486     EVENT(context, GLGetProgramPipelineiv,
487           "context = %d, pipeline = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
488           pipeline, GLenumToString(GLenumGroup::PipelineParameterName, pname), (uintptr_t)params);
489 
490     if (context)
491     {
492         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
493         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
494         bool isCallValid                                      = (context->skipValidation() ||
495                             ValidateGetProgramPipelineiv(context, pipelinePacked, pname, params));
496         if (isCallValid)
497         {
498             context->getProgramPipelineiv(pipelinePacked, pname, params);
499         }
500         ANGLE_CAPTURE(GetProgramPipelineiv, isCallValid, context, pipelinePacked, pname, params);
501     }
502     else
503     {
504         GenerateContextLostErrorOnCurrentGlobalContext();
505     }
506 }
507 
GL_GetProgramResourceIndex(GLuint program,GLenum programInterface,const GLchar * name)508 GLuint GL_APIENTRY GL_GetProgramResourceIndex(GLuint program,
509                                               GLenum programInterface,
510                                               const GLchar *name)
511 {
512     Context *context = GetValidGlobalContext();
513     EVENT(context, GLGetProgramResourceIndex,
514           "context = %d, program = %u, programInterface = %s, name = 0x%016" PRIxPTR "",
515           CID(context), program, GLenumToString(GLenumGroup::ProgramInterface, programInterface),
516           (uintptr_t)name);
517 
518     GLuint returnValue;
519     if (context)
520     {
521         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
522         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
523         bool isCallValid =
524             (context->skipValidation() ||
525              ValidateGetProgramResourceIndex(context, programPacked, programInterface, name));
526         if (isCallValid)
527         {
528             returnValue = context->getProgramResourceIndex(programPacked, programInterface, name);
529         }
530         else
531         {
532             returnValue =
533                 GetDefaultReturnValue<angle::EntryPoint::GLGetProgramResourceIndex, GLuint>();
534         }
535         ANGLE_CAPTURE(GetProgramResourceIndex, isCallValid, context, programPacked,
536                       programInterface, name, returnValue);
537     }
538     else
539     {
540         GenerateContextLostErrorOnCurrentGlobalContext();
541         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetProgramResourceIndex, GLuint>();
542     }
543     return returnValue;
544 }
545 
GL_GetProgramResourceLocation(GLuint program,GLenum programInterface,const GLchar * name)546 GLint GL_APIENTRY GL_GetProgramResourceLocation(GLuint program,
547                                                 GLenum programInterface,
548                                                 const GLchar *name)
549 {
550     Context *context = GetValidGlobalContext();
551     EVENT(context, GLGetProgramResourceLocation,
552           "context = %d, program = %u, programInterface = %s, name = 0x%016" PRIxPTR "",
553           CID(context), program, GLenumToString(GLenumGroup::ProgramInterface, programInterface),
554           (uintptr_t)name);
555 
556     GLint returnValue;
557     if (context)
558     {
559         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
560         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
561         bool isCallValid =
562             (context->skipValidation() ||
563              ValidateGetProgramResourceLocation(context, programPacked, programInterface, name));
564         if (isCallValid)
565         {
566             returnValue =
567                 context->getProgramResourceLocation(programPacked, programInterface, name);
568         }
569         else
570         {
571             returnValue =
572                 GetDefaultReturnValue<angle::EntryPoint::GLGetProgramResourceLocation, GLint>();
573         }
574         ANGLE_CAPTURE(GetProgramResourceLocation, isCallValid, context, programPacked,
575                       programInterface, name, returnValue);
576     }
577     else
578     {
579         GenerateContextLostErrorOnCurrentGlobalContext();
580         returnValue =
581             GetDefaultReturnValue<angle::EntryPoint::GLGetProgramResourceLocation, GLint>();
582     }
583     return returnValue;
584 }
585 
GL_GetProgramResourceName(GLuint program,GLenum programInterface,GLuint index,GLsizei bufSize,GLsizei * length,GLchar * name)586 void GL_APIENTRY GL_GetProgramResourceName(GLuint program,
587                                            GLenum programInterface,
588                                            GLuint index,
589                                            GLsizei bufSize,
590                                            GLsizei *length,
591                                            GLchar *name)
592 {
593     Context *context = GetValidGlobalContext();
594     EVENT(context, GLGetProgramResourceName,
595           "context = %d, program = %u, programInterface = %s, index = %u, bufSize = %d, length = "
596           "0x%016" PRIxPTR ", name = 0x%016" PRIxPTR "",
597           CID(context), program, GLenumToString(GLenumGroup::ProgramInterface, programInterface),
598           index, bufSize, (uintptr_t)length, (uintptr_t)name);
599 
600     if (context)
601     {
602         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
603         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
604         bool isCallValid                                      = (context->skipValidation() ||
605                             ValidateGetProgramResourceName(context, programPacked, programInterface,
606                                                            index, bufSize, length, name));
607         if (isCallValid)
608         {
609             context->getProgramResourceName(programPacked, programInterface, index, bufSize, length,
610                                             name);
611         }
612         ANGLE_CAPTURE(GetProgramResourceName, isCallValid, context, programPacked, programInterface,
613                       index, bufSize, length, name);
614     }
615     else
616     {
617         GenerateContextLostErrorOnCurrentGlobalContext();
618     }
619 }
620 
GL_GetProgramResourceiv(GLuint program,GLenum programInterface,GLuint index,GLsizei propCount,const GLenum * props,GLsizei bufSize,GLsizei * length,GLint * params)621 void GL_APIENTRY GL_GetProgramResourceiv(GLuint program,
622                                          GLenum programInterface,
623                                          GLuint index,
624                                          GLsizei propCount,
625                                          const GLenum *props,
626                                          GLsizei bufSize,
627                                          GLsizei *length,
628                                          GLint *params)
629 {
630     Context *context = GetValidGlobalContext();
631     EVENT(context, GLGetProgramResourceiv,
632           "context = %d, program = %u, programInterface = %s, index = %u, propCount = %d, props = "
633           "0x%016" PRIxPTR ", bufSize = %d, length = 0x%016" PRIxPTR ", params = 0x%016" PRIxPTR "",
634           CID(context), program, GLenumToString(GLenumGroup::ProgramInterface, programInterface),
635           index, propCount, (uintptr_t)props, bufSize, (uintptr_t)length, (uintptr_t)params);
636 
637     if (context)
638     {
639         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
640         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
641         bool isCallValid =
642             (context->skipValidation() ||
643              ValidateGetProgramResourceiv(context, programPacked, programInterface, index,
644                                           propCount, props, bufSize, length, params));
645         if (isCallValid)
646         {
647             context->getProgramResourceiv(programPacked, programInterface, index, propCount, props,
648                                           bufSize, length, params);
649         }
650         ANGLE_CAPTURE(GetProgramResourceiv, isCallValid, context, programPacked, programInterface,
651                       index, propCount, props, bufSize, length, params);
652     }
653     else
654     {
655         GenerateContextLostErrorOnCurrentGlobalContext();
656     }
657 }
658 
GL_GetTexLevelParameterfv(GLenum target,GLint level,GLenum pname,GLfloat * params)659 void GL_APIENTRY GL_GetTexLevelParameterfv(GLenum target,
660                                            GLint level,
661                                            GLenum pname,
662                                            GLfloat *params)
663 {
664     Context *context = GetValidGlobalContext();
665     EVENT(context, GLGetTexLevelParameterfv,
666           "context = %d, target = %s, level = %d, pname = %s, params = 0x%016" PRIxPTR "",
667           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level,
668           GLenumToString(GLenumGroup::GetTextureParameter, pname), (uintptr_t)params);
669 
670     if (context)
671     {
672         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
673         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
674         bool isCallValid =
675             (context->skipValidation() ||
676              ValidateGetTexLevelParameterfv(context, targetPacked, level, pname, params));
677         if (isCallValid)
678         {
679             context->getTexLevelParameterfv(targetPacked, level, pname, params);
680         }
681         ANGLE_CAPTURE(GetTexLevelParameterfv, isCallValid, context, targetPacked, level, pname,
682                       params);
683     }
684     else
685     {
686         GenerateContextLostErrorOnCurrentGlobalContext();
687     }
688 }
689 
GL_GetTexLevelParameteriv(GLenum target,GLint level,GLenum pname,GLint * params)690 void GL_APIENTRY GL_GetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
691 {
692     Context *context = GetValidGlobalContext();
693     EVENT(context, GLGetTexLevelParameteriv,
694           "context = %d, target = %s, level = %d, pname = %s, params = 0x%016" PRIxPTR "",
695           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level,
696           GLenumToString(GLenumGroup::GetTextureParameter, pname), (uintptr_t)params);
697 
698     if (context)
699     {
700         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
701         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
702         bool isCallValid =
703             (context->skipValidation() ||
704              ValidateGetTexLevelParameteriv(context, targetPacked, level, pname, params));
705         if (isCallValid)
706         {
707             context->getTexLevelParameteriv(targetPacked, level, pname, params);
708         }
709         ANGLE_CAPTURE(GetTexLevelParameteriv, isCallValid, context, targetPacked, level, pname,
710                       params);
711     }
712     else
713     {
714         GenerateContextLostErrorOnCurrentGlobalContext();
715     }
716 }
717 
GL_IsProgramPipeline(GLuint pipeline)718 GLboolean GL_APIENTRY GL_IsProgramPipeline(GLuint pipeline)
719 {
720     Context *context = GetValidGlobalContext();
721     EVENT(context, GLIsProgramPipeline, "context = %d, pipeline = %u", CID(context), pipeline);
722 
723     GLboolean returnValue;
724     if (context)
725     {
726         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
727         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
728         bool isCallValid =
729             (context->skipValidation() || ValidateIsProgramPipeline(context, pipelinePacked));
730         if (isCallValid)
731         {
732             returnValue = context->isProgramPipeline(pipelinePacked);
733         }
734         else
735         {
736             returnValue =
737                 GetDefaultReturnValue<angle::EntryPoint::GLIsProgramPipeline, GLboolean>();
738         }
739         ANGLE_CAPTURE(IsProgramPipeline, isCallValid, context, pipelinePacked, returnValue);
740     }
741     else
742     {
743         GenerateContextLostErrorOnCurrentGlobalContext();
744         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsProgramPipeline, GLboolean>();
745     }
746     return returnValue;
747 }
748 
GL_MemoryBarrier(GLbitfield barriers)749 void GL_APIENTRY GL_MemoryBarrier(GLbitfield barriers)
750 {
751     Context *context = GetValidGlobalContext();
752     EVENT(context, GLMemoryBarrier, "context = %d, barriers = %s", CID(context),
753           GLbitfieldToString(GLenumGroup::MemoryBarrierMask, barriers).c_str());
754 
755     if (context)
756     {
757         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
758         bool isCallValid = (context->skipValidation() || ValidateMemoryBarrier(context, barriers));
759         if (isCallValid)
760         {
761             context->memoryBarrier(barriers);
762         }
763         ANGLE_CAPTURE(MemoryBarrier, isCallValid, context, barriers);
764     }
765     else
766     {
767         GenerateContextLostErrorOnCurrentGlobalContext();
768     }
769 }
770 
GL_MemoryBarrierByRegion(GLbitfield barriers)771 void GL_APIENTRY GL_MemoryBarrierByRegion(GLbitfield barriers)
772 {
773     Context *context = GetValidGlobalContext();
774     EVENT(context, GLMemoryBarrierByRegion, "context = %d, barriers = %s", CID(context),
775           GLbitfieldToString(GLenumGroup::MemoryBarrierMask, barriers).c_str());
776 
777     if (context)
778     {
779         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
780         bool isCallValid =
781             (context->skipValidation() || ValidateMemoryBarrierByRegion(context, barriers));
782         if (isCallValid)
783         {
784             context->memoryBarrierByRegion(barriers);
785         }
786         ANGLE_CAPTURE(MemoryBarrierByRegion, isCallValid, context, barriers);
787     }
788     else
789     {
790         GenerateContextLostErrorOnCurrentGlobalContext();
791     }
792 }
793 
GL_ProgramUniform1f(GLuint program,GLint location,GLfloat v0)794 void GL_APIENTRY GL_ProgramUniform1f(GLuint program, GLint location, GLfloat v0)
795 {
796     Context *context = GetValidGlobalContext();
797     EVENT(context, GLProgramUniform1f, "context = %d, program = %u, location = %d, v0 = %f",
798           CID(context), program, location, v0);
799 
800     if (context)
801     {
802         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
803         UniformLocation locationPacked = PackParam<UniformLocation>(location);
804         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
805         bool isCallValid                                      = (context->skipValidation() ||
806                             ValidateProgramUniform1f(context, programPacked, locationPacked, v0));
807         if (isCallValid)
808         {
809             context->programUniform1f(programPacked, locationPacked, v0);
810         }
811         ANGLE_CAPTURE(ProgramUniform1f, isCallValid, context, programPacked, locationPacked, v0);
812     }
813     else
814     {
815         GenerateContextLostErrorOnCurrentGlobalContext();
816     }
817 }
818 
GL_ProgramUniform1fv(GLuint program,GLint location,GLsizei count,const GLfloat * value)819 void GL_APIENTRY GL_ProgramUniform1fv(GLuint program,
820                                       GLint location,
821                                       GLsizei count,
822                                       const GLfloat *value)
823 {
824     Context *context = GetValidGlobalContext();
825     EVENT(context, GLProgramUniform1fv,
826           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
827           CID(context), program, location, count, (uintptr_t)value);
828 
829     if (context)
830     {
831         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
832         UniformLocation locationPacked = PackParam<UniformLocation>(location);
833         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
834         bool isCallValid =
835             (context->skipValidation() ||
836              ValidateProgramUniform1fv(context, programPacked, locationPacked, count, value));
837         if (isCallValid)
838         {
839             context->programUniform1fv(programPacked, locationPacked, count, value);
840         }
841         ANGLE_CAPTURE(ProgramUniform1fv, isCallValid, context, programPacked, locationPacked, count,
842                       value);
843     }
844     else
845     {
846         GenerateContextLostErrorOnCurrentGlobalContext();
847     }
848 }
849 
GL_ProgramUniform1i(GLuint program,GLint location,GLint v0)850 void GL_APIENTRY GL_ProgramUniform1i(GLuint program, GLint location, GLint v0)
851 {
852     Context *context = GetValidGlobalContext();
853     EVENT(context, GLProgramUniform1i, "context = %d, program = %u, location = %d, v0 = %d",
854           CID(context), program, location, v0);
855 
856     if (context)
857     {
858         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
859         UniformLocation locationPacked = PackParam<UniformLocation>(location);
860         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
861         bool isCallValid                                      = (context->skipValidation() ||
862                             ValidateProgramUniform1i(context, programPacked, locationPacked, v0));
863         if (isCallValid)
864         {
865             context->programUniform1i(programPacked, locationPacked, v0);
866         }
867         ANGLE_CAPTURE(ProgramUniform1i, isCallValid, context, programPacked, locationPacked, v0);
868     }
869     else
870     {
871         GenerateContextLostErrorOnCurrentGlobalContext();
872     }
873 }
874 
GL_ProgramUniform1iv(GLuint program,GLint location,GLsizei count,const GLint * value)875 void GL_APIENTRY GL_ProgramUniform1iv(GLuint program,
876                                       GLint location,
877                                       GLsizei count,
878                                       const GLint *value)
879 {
880     Context *context = GetValidGlobalContext();
881     EVENT(context, GLProgramUniform1iv,
882           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
883           CID(context), program, location, count, (uintptr_t)value);
884 
885     if (context)
886     {
887         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
888         UniformLocation locationPacked = PackParam<UniformLocation>(location);
889         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
890         bool isCallValid =
891             (context->skipValidation() ||
892              ValidateProgramUniform1iv(context, programPacked, locationPacked, count, value));
893         if (isCallValid)
894         {
895             context->programUniform1iv(programPacked, locationPacked, count, value);
896         }
897         ANGLE_CAPTURE(ProgramUniform1iv, isCallValid, context, programPacked, locationPacked, count,
898                       value);
899     }
900     else
901     {
902         GenerateContextLostErrorOnCurrentGlobalContext();
903     }
904 }
905 
GL_ProgramUniform1ui(GLuint program,GLint location,GLuint v0)906 void GL_APIENTRY GL_ProgramUniform1ui(GLuint program, GLint location, GLuint v0)
907 {
908     Context *context = GetValidGlobalContext();
909     EVENT(context, GLProgramUniform1ui, "context = %d, program = %u, location = %d, v0 = %u",
910           CID(context), program, location, v0);
911 
912     if (context)
913     {
914         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
915         UniformLocation locationPacked = PackParam<UniformLocation>(location);
916         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
917         bool isCallValid                                      = (context->skipValidation() ||
918                             ValidateProgramUniform1ui(context, programPacked, locationPacked, v0));
919         if (isCallValid)
920         {
921             context->programUniform1ui(programPacked, locationPacked, v0);
922         }
923         ANGLE_CAPTURE(ProgramUniform1ui, isCallValid, context, programPacked, locationPacked, v0);
924     }
925     else
926     {
927         GenerateContextLostErrorOnCurrentGlobalContext();
928     }
929 }
930 
GL_ProgramUniform1uiv(GLuint program,GLint location,GLsizei count,const GLuint * value)931 void GL_APIENTRY GL_ProgramUniform1uiv(GLuint program,
932                                        GLint location,
933                                        GLsizei count,
934                                        const GLuint *value)
935 {
936     Context *context = GetValidGlobalContext();
937     EVENT(context, GLProgramUniform1uiv,
938           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
939           CID(context), program, location, count, (uintptr_t)value);
940 
941     if (context)
942     {
943         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
944         UniformLocation locationPacked = PackParam<UniformLocation>(location);
945         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
946         bool isCallValid =
947             (context->skipValidation() ||
948              ValidateProgramUniform1uiv(context, programPacked, locationPacked, count, value));
949         if (isCallValid)
950         {
951             context->programUniform1uiv(programPacked, locationPacked, count, value);
952         }
953         ANGLE_CAPTURE(ProgramUniform1uiv, isCallValid, context, programPacked, locationPacked,
954                       count, value);
955     }
956     else
957     {
958         GenerateContextLostErrorOnCurrentGlobalContext();
959     }
960 }
961 
GL_ProgramUniform2f(GLuint program,GLint location,GLfloat v0,GLfloat v1)962 void GL_APIENTRY GL_ProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
963 {
964     Context *context = GetValidGlobalContext();
965     EVENT(context, GLProgramUniform2f,
966           "context = %d, program = %u, location = %d, v0 = %f, v1 = %f", CID(context), program,
967           location, v0, v1);
968 
969     if (context)
970     {
971         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
972         UniformLocation locationPacked = PackParam<UniformLocation>(location);
973         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
974         bool isCallValid =
975             (context->skipValidation() ||
976              ValidateProgramUniform2f(context, programPacked, locationPacked, v0, v1));
977         if (isCallValid)
978         {
979             context->programUniform2f(programPacked, locationPacked, v0, v1);
980         }
981         ANGLE_CAPTURE(ProgramUniform2f, isCallValid, context, programPacked, locationPacked, v0,
982                       v1);
983     }
984     else
985     {
986         GenerateContextLostErrorOnCurrentGlobalContext();
987     }
988 }
989 
GL_ProgramUniform2fv(GLuint program,GLint location,GLsizei count,const GLfloat * value)990 void GL_APIENTRY GL_ProgramUniform2fv(GLuint program,
991                                       GLint location,
992                                       GLsizei count,
993                                       const GLfloat *value)
994 {
995     Context *context = GetValidGlobalContext();
996     EVENT(context, GLProgramUniform2fv,
997           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
998           CID(context), program, location, count, (uintptr_t)value);
999 
1000     if (context)
1001     {
1002         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1003         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1004         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1005         bool isCallValid =
1006             (context->skipValidation() ||
1007              ValidateProgramUniform2fv(context, programPacked, locationPacked, count, value));
1008         if (isCallValid)
1009         {
1010             context->programUniform2fv(programPacked, locationPacked, count, value);
1011         }
1012         ANGLE_CAPTURE(ProgramUniform2fv, isCallValid, context, programPacked, locationPacked, count,
1013                       value);
1014     }
1015     else
1016     {
1017         GenerateContextLostErrorOnCurrentGlobalContext();
1018     }
1019 }
1020 
GL_ProgramUniform2i(GLuint program,GLint location,GLint v0,GLint v1)1021 void GL_APIENTRY GL_ProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
1022 {
1023     Context *context = GetValidGlobalContext();
1024     EVENT(context, GLProgramUniform2i,
1025           "context = %d, program = %u, location = %d, v0 = %d, v1 = %d", CID(context), program,
1026           location, v0, v1);
1027 
1028     if (context)
1029     {
1030         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1031         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1032         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1033         bool isCallValid =
1034             (context->skipValidation() ||
1035              ValidateProgramUniform2i(context, programPacked, locationPacked, v0, v1));
1036         if (isCallValid)
1037         {
1038             context->programUniform2i(programPacked, locationPacked, v0, v1);
1039         }
1040         ANGLE_CAPTURE(ProgramUniform2i, isCallValid, context, programPacked, locationPacked, v0,
1041                       v1);
1042     }
1043     else
1044     {
1045         GenerateContextLostErrorOnCurrentGlobalContext();
1046     }
1047 }
1048 
GL_ProgramUniform2iv(GLuint program,GLint location,GLsizei count,const GLint * value)1049 void GL_APIENTRY GL_ProgramUniform2iv(GLuint program,
1050                                       GLint location,
1051                                       GLsizei count,
1052                                       const GLint *value)
1053 {
1054     Context *context = GetValidGlobalContext();
1055     EVENT(context, GLProgramUniform2iv,
1056           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
1057           CID(context), program, location, count, (uintptr_t)value);
1058 
1059     if (context)
1060     {
1061         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1062         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1063         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1064         bool isCallValid =
1065             (context->skipValidation() ||
1066              ValidateProgramUniform2iv(context, programPacked, locationPacked, count, value));
1067         if (isCallValid)
1068         {
1069             context->programUniform2iv(programPacked, locationPacked, count, value);
1070         }
1071         ANGLE_CAPTURE(ProgramUniform2iv, isCallValid, context, programPacked, locationPacked, count,
1072                       value);
1073     }
1074     else
1075     {
1076         GenerateContextLostErrorOnCurrentGlobalContext();
1077     }
1078 }
1079 
GL_ProgramUniform2ui(GLuint program,GLint location,GLuint v0,GLuint v1)1080 void GL_APIENTRY GL_ProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
1081 {
1082     Context *context = GetValidGlobalContext();
1083     EVENT(context, GLProgramUniform2ui,
1084           "context = %d, program = %u, location = %d, v0 = %u, v1 = %u", CID(context), program,
1085           location, v0, v1);
1086 
1087     if (context)
1088     {
1089         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1090         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1091         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1092         bool isCallValid =
1093             (context->skipValidation() ||
1094              ValidateProgramUniform2ui(context, programPacked, locationPacked, v0, v1));
1095         if (isCallValid)
1096         {
1097             context->programUniform2ui(programPacked, locationPacked, v0, v1);
1098         }
1099         ANGLE_CAPTURE(ProgramUniform2ui, isCallValid, context, programPacked, locationPacked, v0,
1100                       v1);
1101     }
1102     else
1103     {
1104         GenerateContextLostErrorOnCurrentGlobalContext();
1105     }
1106 }
1107 
GL_ProgramUniform2uiv(GLuint program,GLint location,GLsizei count,const GLuint * value)1108 void GL_APIENTRY GL_ProgramUniform2uiv(GLuint program,
1109                                        GLint location,
1110                                        GLsizei count,
1111                                        const GLuint *value)
1112 {
1113     Context *context = GetValidGlobalContext();
1114     EVENT(context, GLProgramUniform2uiv,
1115           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
1116           CID(context), program, location, count, (uintptr_t)value);
1117 
1118     if (context)
1119     {
1120         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1121         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1122         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1123         bool isCallValid =
1124             (context->skipValidation() ||
1125              ValidateProgramUniform2uiv(context, programPacked, locationPacked, count, value));
1126         if (isCallValid)
1127         {
1128             context->programUniform2uiv(programPacked, locationPacked, count, value);
1129         }
1130         ANGLE_CAPTURE(ProgramUniform2uiv, isCallValid, context, programPacked, locationPacked,
1131                       count, value);
1132     }
1133     else
1134     {
1135         GenerateContextLostErrorOnCurrentGlobalContext();
1136     }
1137 }
1138 
1139 void GL_APIENTRY
GL_ProgramUniform3f(GLuint program,GLint location,GLfloat v0,GLfloat v1,GLfloat v2)1140 GL_ProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
1141 {
1142     Context *context = GetValidGlobalContext();
1143     EVENT(context, GLProgramUniform3f,
1144           "context = %d, program = %u, location = %d, v0 = %f, v1 = %f, v2 = %f", CID(context),
1145           program, location, v0, v1, v2);
1146 
1147     if (context)
1148     {
1149         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1150         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1151         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1152         bool isCallValid =
1153             (context->skipValidation() ||
1154              ValidateProgramUniform3f(context, programPacked, locationPacked, v0, v1, v2));
1155         if (isCallValid)
1156         {
1157             context->programUniform3f(programPacked, locationPacked, v0, v1, v2);
1158         }
1159         ANGLE_CAPTURE(ProgramUniform3f, isCallValid, context, programPacked, locationPacked, v0, v1,
1160                       v2);
1161     }
1162     else
1163     {
1164         GenerateContextLostErrorOnCurrentGlobalContext();
1165     }
1166 }
1167 
GL_ProgramUniform3fv(GLuint program,GLint location,GLsizei count,const GLfloat * value)1168 void GL_APIENTRY GL_ProgramUniform3fv(GLuint program,
1169                                       GLint location,
1170                                       GLsizei count,
1171                                       const GLfloat *value)
1172 {
1173     Context *context = GetValidGlobalContext();
1174     EVENT(context, GLProgramUniform3fv,
1175           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
1176           CID(context), program, location, count, (uintptr_t)value);
1177 
1178     if (context)
1179     {
1180         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1181         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1182         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1183         bool isCallValid =
1184             (context->skipValidation() ||
1185              ValidateProgramUniform3fv(context, programPacked, locationPacked, count, value));
1186         if (isCallValid)
1187         {
1188             context->programUniform3fv(programPacked, locationPacked, count, value);
1189         }
1190         ANGLE_CAPTURE(ProgramUniform3fv, isCallValid, context, programPacked, locationPacked, count,
1191                       value);
1192     }
1193     else
1194     {
1195         GenerateContextLostErrorOnCurrentGlobalContext();
1196     }
1197 }
1198 
GL_ProgramUniform3i(GLuint program,GLint location,GLint v0,GLint v1,GLint v2)1199 void GL_APIENTRY GL_ProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
1200 {
1201     Context *context = GetValidGlobalContext();
1202     EVENT(context, GLProgramUniform3i,
1203           "context = %d, program = %u, location = %d, v0 = %d, v1 = %d, v2 = %d", CID(context),
1204           program, location, v0, v1, v2);
1205 
1206     if (context)
1207     {
1208         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1209         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1210         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1211         bool isCallValid =
1212             (context->skipValidation() ||
1213              ValidateProgramUniform3i(context, programPacked, locationPacked, v0, v1, v2));
1214         if (isCallValid)
1215         {
1216             context->programUniform3i(programPacked, locationPacked, v0, v1, v2);
1217         }
1218         ANGLE_CAPTURE(ProgramUniform3i, isCallValid, context, programPacked, locationPacked, v0, v1,
1219                       v2);
1220     }
1221     else
1222     {
1223         GenerateContextLostErrorOnCurrentGlobalContext();
1224     }
1225 }
1226 
GL_ProgramUniform3iv(GLuint program,GLint location,GLsizei count,const GLint * value)1227 void GL_APIENTRY GL_ProgramUniform3iv(GLuint program,
1228                                       GLint location,
1229                                       GLsizei count,
1230                                       const GLint *value)
1231 {
1232     Context *context = GetValidGlobalContext();
1233     EVENT(context, GLProgramUniform3iv,
1234           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
1235           CID(context), program, location, count, (uintptr_t)value);
1236 
1237     if (context)
1238     {
1239         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1240         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1241         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1242         bool isCallValid =
1243             (context->skipValidation() ||
1244              ValidateProgramUniform3iv(context, programPacked, locationPacked, count, value));
1245         if (isCallValid)
1246         {
1247             context->programUniform3iv(programPacked, locationPacked, count, value);
1248         }
1249         ANGLE_CAPTURE(ProgramUniform3iv, isCallValid, context, programPacked, locationPacked, count,
1250                       value);
1251     }
1252     else
1253     {
1254         GenerateContextLostErrorOnCurrentGlobalContext();
1255     }
1256 }
1257 
1258 void GL_APIENTRY
GL_ProgramUniform3ui(GLuint program,GLint location,GLuint v0,GLuint v1,GLuint v2)1259 GL_ProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)
1260 {
1261     Context *context = GetValidGlobalContext();
1262     EVENT(context, GLProgramUniform3ui,
1263           "context = %d, program = %u, location = %d, v0 = %u, v1 = %u, v2 = %u", CID(context),
1264           program, location, v0, v1, v2);
1265 
1266     if (context)
1267     {
1268         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1269         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1270         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1271         bool isCallValid =
1272             (context->skipValidation() ||
1273              ValidateProgramUniform3ui(context, programPacked, locationPacked, v0, v1, v2));
1274         if (isCallValid)
1275         {
1276             context->programUniform3ui(programPacked, locationPacked, v0, v1, v2);
1277         }
1278         ANGLE_CAPTURE(ProgramUniform3ui, isCallValid, context, programPacked, locationPacked, v0,
1279                       v1, v2);
1280     }
1281     else
1282     {
1283         GenerateContextLostErrorOnCurrentGlobalContext();
1284     }
1285 }
1286 
GL_ProgramUniform3uiv(GLuint program,GLint location,GLsizei count,const GLuint * value)1287 void GL_APIENTRY GL_ProgramUniform3uiv(GLuint program,
1288                                        GLint location,
1289                                        GLsizei count,
1290                                        const GLuint *value)
1291 {
1292     Context *context = GetValidGlobalContext();
1293     EVENT(context, GLProgramUniform3uiv,
1294           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
1295           CID(context), program, location, count, (uintptr_t)value);
1296 
1297     if (context)
1298     {
1299         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1300         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1301         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1302         bool isCallValid =
1303             (context->skipValidation() ||
1304              ValidateProgramUniform3uiv(context, programPacked, locationPacked, count, value));
1305         if (isCallValid)
1306         {
1307             context->programUniform3uiv(programPacked, locationPacked, count, value);
1308         }
1309         ANGLE_CAPTURE(ProgramUniform3uiv, isCallValid, context, programPacked, locationPacked,
1310                       count, value);
1311     }
1312     else
1313     {
1314         GenerateContextLostErrorOnCurrentGlobalContext();
1315     }
1316 }
1317 
1318 void GL_APIENTRY
GL_ProgramUniform4f(GLuint program,GLint location,GLfloat v0,GLfloat v1,GLfloat v2,GLfloat v3)1319 GL_ProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
1320 {
1321     Context *context = GetValidGlobalContext();
1322     EVENT(context, GLProgramUniform4f,
1323           "context = %d, program = %u, location = %d, v0 = %f, v1 = %f, v2 = %f, v3 = %f",
1324           CID(context), program, location, v0, v1, v2, v3);
1325 
1326     if (context)
1327     {
1328         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1329         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1330         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1331         bool isCallValid =
1332             (context->skipValidation() ||
1333              ValidateProgramUniform4f(context, programPacked, locationPacked, v0, v1, v2, v3));
1334         if (isCallValid)
1335         {
1336             context->programUniform4f(programPacked, locationPacked, v0, v1, v2, v3);
1337         }
1338         ANGLE_CAPTURE(ProgramUniform4f, isCallValid, context, programPacked, locationPacked, v0, v1,
1339                       v2, v3);
1340     }
1341     else
1342     {
1343         GenerateContextLostErrorOnCurrentGlobalContext();
1344     }
1345 }
1346 
GL_ProgramUniform4fv(GLuint program,GLint location,GLsizei count,const GLfloat * value)1347 void GL_APIENTRY GL_ProgramUniform4fv(GLuint program,
1348                                       GLint location,
1349                                       GLsizei count,
1350                                       const GLfloat *value)
1351 {
1352     Context *context = GetValidGlobalContext();
1353     EVENT(context, GLProgramUniform4fv,
1354           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
1355           CID(context), program, location, count, (uintptr_t)value);
1356 
1357     if (context)
1358     {
1359         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1360         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1361         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1362         bool isCallValid =
1363             (context->skipValidation() ||
1364              ValidateProgramUniform4fv(context, programPacked, locationPacked, count, value));
1365         if (isCallValid)
1366         {
1367             context->programUniform4fv(programPacked, locationPacked, count, value);
1368         }
1369         ANGLE_CAPTURE(ProgramUniform4fv, isCallValid, context, programPacked, locationPacked, count,
1370                       value);
1371     }
1372     else
1373     {
1374         GenerateContextLostErrorOnCurrentGlobalContext();
1375     }
1376 }
1377 
1378 void GL_APIENTRY
GL_ProgramUniform4i(GLuint program,GLint location,GLint v0,GLint v1,GLint v2,GLint v3)1379 GL_ProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
1380 {
1381     Context *context = GetValidGlobalContext();
1382     EVENT(context, GLProgramUniform4i,
1383           "context = %d, program = %u, location = %d, v0 = %d, v1 = %d, v2 = %d, v3 = %d",
1384           CID(context), program, location, v0, v1, v2, v3);
1385 
1386     if (context)
1387     {
1388         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1389         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1390         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1391         bool isCallValid =
1392             (context->skipValidation() ||
1393              ValidateProgramUniform4i(context, programPacked, locationPacked, v0, v1, v2, v3));
1394         if (isCallValid)
1395         {
1396             context->programUniform4i(programPacked, locationPacked, v0, v1, v2, v3);
1397         }
1398         ANGLE_CAPTURE(ProgramUniform4i, isCallValid, context, programPacked, locationPacked, v0, v1,
1399                       v2, v3);
1400     }
1401     else
1402     {
1403         GenerateContextLostErrorOnCurrentGlobalContext();
1404     }
1405 }
1406 
GL_ProgramUniform4iv(GLuint program,GLint location,GLsizei count,const GLint * value)1407 void GL_APIENTRY GL_ProgramUniform4iv(GLuint program,
1408                                       GLint location,
1409                                       GLsizei count,
1410                                       const GLint *value)
1411 {
1412     Context *context = GetValidGlobalContext();
1413     EVENT(context, GLProgramUniform4iv,
1414           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
1415           CID(context), program, location, count, (uintptr_t)value);
1416 
1417     if (context)
1418     {
1419         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1420         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1421         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1422         bool isCallValid =
1423             (context->skipValidation() ||
1424              ValidateProgramUniform4iv(context, programPacked, locationPacked, count, value));
1425         if (isCallValid)
1426         {
1427             context->programUniform4iv(programPacked, locationPacked, count, value);
1428         }
1429         ANGLE_CAPTURE(ProgramUniform4iv, isCallValid, context, programPacked, locationPacked, count,
1430                       value);
1431     }
1432     else
1433     {
1434         GenerateContextLostErrorOnCurrentGlobalContext();
1435     }
1436 }
1437 
1438 void GL_APIENTRY
GL_ProgramUniform4ui(GLuint program,GLint location,GLuint v0,GLuint v1,GLuint v2,GLuint v3)1439 GL_ProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
1440 {
1441     Context *context = GetValidGlobalContext();
1442     EVENT(context, GLProgramUniform4ui,
1443           "context = %d, program = %u, location = %d, v0 = %u, v1 = %u, v2 = %u, v3 = %u",
1444           CID(context), program, location, v0, v1, v2, v3);
1445 
1446     if (context)
1447     {
1448         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1449         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1450         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1451         bool isCallValid =
1452             (context->skipValidation() ||
1453              ValidateProgramUniform4ui(context, programPacked, locationPacked, v0, v1, v2, v3));
1454         if (isCallValid)
1455         {
1456             context->programUniform4ui(programPacked, locationPacked, v0, v1, v2, v3);
1457         }
1458         ANGLE_CAPTURE(ProgramUniform4ui, isCallValid, context, programPacked, locationPacked, v0,
1459                       v1, v2, v3);
1460     }
1461     else
1462     {
1463         GenerateContextLostErrorOnCurrentGlobalContext();
1464     }
1465 }
1466 
GL_ProgramUniform4uiv(GLuint program,GLint location,GLsizei count,const GLuint * value)1467 void GL_APIENTRY GL_ProgramUniform4uiv(GLuint program,
1468                                        GLint location,
1469                                        GLsizei count,
1470                                        const GLuint *value)
1471 {
1472     Context *context = GetValidGlobalContext();
1473     EVENT(context, GLProgramUniform4uiv,
1474           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
1475           CID(context), program, location, count, (uintptr_t)value);
1476 
1477     if (context)
1478     {
1479         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1480         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1481         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1482         bool isCallValid =
1483             (context->skipValidation() ||
1484              ValidateProgramUniform4uiv(context, programPacked, locationPacked, count, value));
1485         if (isCallValid)
1486         {
1487             context->programUniform4uiv(programPacked, locationPacked, count, value);
1488         }
1489         ANGLE_CAPTURE(ProgramUniform4uiv, isCallValid, context, programPacked, locationPacked,
1490                       count, value);
1491     }
1492     else
1493     {
1494         GenerateContextLostErrorOnCurrentGlobalContext();
1495     }
1496 }
1497 
GL_ProgramUniformMatrix2fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)1498 void GL_APIENTRY GL_ProgramUniformMatrix2fv(GLuint program,
1499                                             GLint location,
1500                                             GLsizei count,
1501                                             GLboolean transpose,
1502                                             const GLfloat *value)
1503 {
1504     Context *context = GetValidGlobalContext();
1505     EVENT(context, GLProgramUniformMatrix2fv,
1506           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
1507           "0x%016" PRIxPTR "",
1508           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
1509 
1510     if (context)
1511     {
1512         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1513         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1514         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1515         bool isCallValid                                      = (context->skipValidation() ||
1516                             ValidateProgramUniformMatrix2fv(context, programPacked, locationPacked,
1517                                                             count, transpose, value));
1518         if (isCallValid)
1519         {
1520             context->programUniformMatrix2fv(programPacked, locationPacked, count, transpose,
1521                                              value);
1522         }
1523         ANGLE_CAPTURE(ProgramUniformMatrix2fv, isCallValid, context, programPacked, locationPacked,
1524                       count, transpose, value);
1525     }
1526     else
1527     {
1528         GenerateContextLostErrorOnCurrentGlobalContext();
1529     }
1530 }
1531 
GL_ProgramUniformMatrix2x3fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)1532 void GL_APIENTRY GL_ProgramUniformMatrix2x3fv(GLuint program,
1533                                               GLint location,
1534                                               GLsizei count,
1535                                               GLboolean transpose,
1536                                               const GLfloat *value)
1537 {
1538     Context *context = GetValidGlobalContext();
1539     EVENT(context, GLProgramUniformMatrix2x3fv,
1540           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
1541           "0x%016" PRIxPTR "",
1542           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
1543 
1544     if (context)
1545     {
1546         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1547         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1548         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1549         bool isCallValid                                      = (context->skipValidation() ||
1550                             ValidateProgramUniformMatrix2x3fv(
1551                                 context, programPacked, locationPacked, count, transpose, value));
1552         if (isCallValid)
1553         {
1554             context->programUniformMatrix2x3fv(programPacked, locationPacked, count, transpose,
1555                                                value);
1556         }
1557         ANGLE_CAPTURE(ProgramUniformMatrix2x3fv, isCallValid, context, programPacked,
1558                       locationPacked, count, transpose, value);
1559     }
1560     else
1561     {
1562         GenerateContextLostErrorOnCurrentGlobalContext();
1563     }
1564 }
1565 
GL_ProgramUniformMatrix2x4fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)1566 void GL_APIENTRY GL_ProgramUniformMatrix2x4fv(GLuint program,
1567                                               GLint location,
1568                                               GLsizei count,
1569                                               GLboolean transpose,
1570                                               const GLfloat *value)
1571 {
1572     Context *context = GetValidGlobalContext();
1573     EVENT(context, GLProgramUniformMatrix2x4fv,
1574           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
1575           "0x%016" PRIxPTR "",
1576           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
1577 
1578     if (context)
1579     {
1580         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1581         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1582         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1583         bool isCallValid                                      = (context->skipValidation() ||
1584                             ValidateProgramUniformMatrix2x4fv(
1585                                 context, programPacked, locationPacked, count, transpose, value));
1586         if (isCallValid)
1587         {
1588             context->programUniformMatrix2x4fv(programPacked, locationPacked, count, transpose,
1589                                                value);
1590         }
1591         ANGLE_CAPTURE(ProgramUniformMatrix2x4fv, isCallValid, context, programPacked,
1592                       locationPacked, count, transpose, value);
1593     }
1594     else
1595     {
1596         GenerateContextLostErrorOnCurrentGlobalContext();
1597     }
1598 }
1599 
GL_ProgramUniformMatrix3fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)1600 void GL_APIENTRY GL_ProgramUniformMatrix3fv(GLuint program,
1601                                             GLint location,
1602                                             GLsizei count,
1603                                             GLboolean transpose,
1604                                             const GLfloat *value)
1605 {
1606     Context *context = GetValidGlobalContext();
1607     EVENT(context, GLProgramUniformMatrix3fv,
1608           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
1609           "0x%016" PRIxPTR "",
1610           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
1611 
1612     if (context)
1613     {
1614         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1615         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1616         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1617         bool isCallValid                                      = (context->skipValidation() ||
1618                             ValidateProgramUniformMatrix3fv(context, programPacked, locationPacked,
1619                                                             count, transpose, value));
1620         if (isCallValid)
1621         {
1622             context->programUniformMatrix3fv(programPacked, locationPacked, count, transpose,
1623                                              value);
1624         }
1625         ANGLE_CAPTURE(ProgramUniformMatrix3fv, isCallValid, context, programPacked, locationPacked,
1626                       count, transpose, value);
1627     }
1628     else
1629     {
1630         GenerateContextLostErrorOnCurrentGlobalContext();
1631     }
1632 }
1633 
GL_ProgramUniformMatrix3x2fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)1634 void GL_APIENTRY GL_ProgramUniformMatrix3x2fv(GLuint program,
1635                                               GLint location,
1636                                               GLsizei count,
1637                                               GLboolean transpose,
1638                                               const GLfloat *value)
1639 {
1640     Context *context = GetValidGlobalContext();
1641     EVENT(context, GLProgramUniformMatrix3x2fv,
1642           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
1643           "0x%016" PRIxPTR "",
1644           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
1645 
1646     if (context)
1647     {
1648         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1649         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1650         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1651         bool isCallValid                                      = (context->skipValidation() ||
1652                             ValidateProgramUniformMatrix3x2fv(
1653                                 context, programPacked, locationPacked, count, transpose, value));
1654         if (isCallValid)
1655         {
1656             context->programUniformMatrix3x2fv(programPacked, locationPacked, count, transpose,
1657                                                value);
1658         }
1659         ANGLE_CAPTURE(ProgramUniformMatrix3x2fv, isCallValid, context, programPacked,
1660                       locationPacked, count, transpose, value);
1661     }
1662     else
1663     {
1664         GenerateContextLostErrorOnCurrentGlobalContext();
1665     }
1666 }
1667 
GL_ProgramUniformMatrix3x4fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)1668 void GL_APIENTRY GL_ProgramUniformMatrix3x4fv(GLuint program,
1669                                               GLint location,
1670                                               GLsizei count,
1671                                               GLboolean transpose,
1672                                               const GLfloat *value)
1673 {
1674     Context *context = GetValidGlobalContext();
1675     EVENT(context, GLProgramUniformMatrix3x4fv,
1676           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
1677           "0x%016" PRIxPTR "",
1678           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
1679 
1680     if (context)
1681     {
1682         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1683         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1684         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1685         bool isCallValid                                      = (context->skipValidation() ||
1686                             ValidateProgramUniformMatrix3x4fv(
1687                                 context, programPacked, locationPacked, count, transpose, value));
1688         if (isCallValid)
1689         {
1690             context->programUniformMatrix3x4fv(programPacked, locationPacked, count, transpose,
1691                                                value);
1692         }
1693         ANGLE_CAPTURE(ProgramUniformMatrix3x4fv, isCallValid, context, programPacked,
1694                       locationPacked, count, transpose, value);
1695     }
1696     else
1697     {
1698         GenerateContextLostErrorOnCurrentGlobalContext();
1699     }
1700 }
1701 
GL_ProgramUniformMatrix4fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)1702 void GL_APIENTRY GL_ProgramUniformMatrix4fv(GLuint program,
1703                                             GLint location,
1704                                             GLsizei count,
1705                                             GLboolean transpose,
1706                                             const GLfloat *value)
1707 {
1708     Context *context = GetValidGlobalContext();
1709     EVENT(context, GLProgramUniformMatrix4fv,
1710           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
1711           "0x%016" PRIxPTR "",
1712           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
1713 
1714     if (context)
1715     {
1716         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1717         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1718         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1719         bool isCallValid                                      = (context->skipValidation() ||
1720                             ValidateProgramUniformMatrix4fv(context, programPacked, locationPacked,
1721                                                             count, transpose, value));
1722         if (isCallValid)
1723         {
1724             context->programUniformMatrix4fv(programPacked, locationPacked, count, transpose,
1725                                              value);
1726         }
1727         ANGLE_CAPTURE(ProgramUniformMatrix4fv, isCallValid, context, programPacked, locationPacked,
1728                       count, transpose, value);
1729     }
1730     else
1731     {
1732         GenerateContextLostErrorOnCurrentGlobalContext();
1733     }
1734 }
1735 
GL_ProgramUniformMatrix4x2fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)1736 void GL_APIENTRY GL_ProgramUniformMatrix4x2fv(GLuint program,
1737                                               GLint location,
1738                                               GLsizei count,
1739                                               GLboolean transpose,
1740                                               const GLfloat *value)
1741 {
1742     Context *context = GetValidGlobalContext();
1743     EVENT(context, GLProgramUniformMatrix4x2fv,
1744           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
1745           "0x%016" PRIxPTR "",
1746           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
1747 
1748     if (context)
1749     {
1750         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1751         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1752         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1753         bool isCallValid                                      = (context->skipValidation() ||
1754                             ValidateProgramUniformMatrix4x2fv(
1755                                 context, programPacked, locationPacked, count, transpose, value));
1756         if (isCallValid)
1757         {
1758             context->programUniformMatrix4x2fv(programPacked, locationPacked, count, transpose,
1759                                                value);
1760         }
1761         ANGLE_CAPTURE(ProgramUniformMatrix4x2fv, isCallValid, context, programPacked,
1762                       locationPacked, count, transpose, value);
1763     }
1764     else
1765     {
1766         GenerateContextLostErrorOnCurrentGlobalContext();
1767     }
1768 }
1769 
GL_ProgramUniformMatrix4x3fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)1770 void GL_APIENTRY GL_ProgramUniformMatrix4x3fv(GLuint program,
1771                                               GLint location,
1772                                               GLsizei count,
1773                                               GLboolean transpose,
1774                                               const GLfloat *value)
1775 {
1776     Context *context = GetValidGlobalContext();
1777     EVENT(context, GLProgramUniformMatrix4x3fv,
1778           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
1779           "0x%016" PRIxPTR "",
1780           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
1781 
1782     if (context)
1783     {
1784         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1785         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1786         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1787         bool isCallValid                                      = (context->skipValidation() ||
1788                             ValidateProgramUniformMatrix4x3fv(
1789                                 context, programPacked, locationPacked, count, transpose, value));
1790         if (isCallValid)
1791         {
1792             context->programUniformMatrix4x3fv(programPacked, locationPacked, count, transpose,
1793                                                value);
1794         }
1795         ANGLE_CAPTURE(ProgramUniformMatrix4x3fv, isCallValid, context, programPacked,
1796                       locationPacked, count, transpose, value);
1797     }
1798     else
1799     {
1800         GenerateContextLostErrorOnCurrentGlobalContext();
1801     }
1802 }
1803 
GL_SampleMaski(GLuint maskNumber,GLbitfield mask)1804 void GL_APIENTRY GL_SampleMaski(GLuint maskNumber, GLbitfield mask)
1805 {
1806     Context *context = GetValidGlobalContext();
1807     EVENT(context, GLSampleMaski, "context = %d, maskNumber = %u, mask = %s", CID(context),
1808           maskNumber, GLbitfieldToString(GLenumGroup::DefaultGroup, mask).c_str());
1809 
1810     if (context)
1811     {
1812         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1813         bool isCallValid =
1814             (context->skipValidation() || ValidateSampleMaski(context, maskNumber, mask));
1815         if (isCallValid)
1816         {
1817             context->sampleMaski(maskNumber, mask);
1818         }
1819         ANGLE_CAPTURE(SampleMaski, isCallValid, context, maskNumber, mask);
1820     }
1821     else
1822     {
1823         GenerateContextLostErrorOnCurrentGlobalContext();
1824     }
1825 }
1826 
GL_TexStorage2DMultisample(GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height,GLboolean fixedsamplelocations)1827 void GL_APIENTRY GL_TexStorage2DMultisample(GLenum target,
1828                                             GLsizei samples,
1829                                             GLenum internalformat,
1830                                             GLsizei width,
1831                                             GLsizei height,
1832                                             GLboolean fixedsamplelocations)
1833 {
1834     Context *context = GetValidGlobalContext();
1835     EVENT(context, GLTexStorage2DMultisample,
1836           "context = %d, target = %s, samples = %d, internalformat = %s, width = %d, height = %d, "
1837           "fixedsamplelocations = %s",
1838           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), samples,
1839           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height,
1840           GLbooleanToString(fixedsamplelocations));
1841 
1842     if (context)
1843     {
1844         TextureType targetPacked                              = PackParam<TextureType>(target);
1845         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1846         bool isCallValid =
1847             (context->skipValidation() ||
1848              ValidateTexStorage2DMultisample(context, targetPacked, samples, internalformat, width,
1849                                              height, fixedsamplelocations));
1850         if (isCallValid)
1851         {
1852             context->texStorage2DMultisample(targetPacked, samples, internalformat, width, height,
1853                                              fixedsamplelocations);
1854         }
1855         ANGLE_CAPTURE(TexStorage2DMultisample, isCallValid, context, targetPacked, samples,
1856                       internalformat, width, height, fixedsamplelocations);
1857     }
1858     else
1859     {
1860         GenerateContextLostErrorOnCurrentGlobalContext();
1861     }
1862 }
1863 
GL_UseProgramStages(GLuint pipeline,GLbitfield stages,GLuint program)1864 void GL_APIENTRY GL_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
1865 {
1866     Context *context = GetValidGlobalContext();
1867     EVENT(context, GLUseProgramStages, "context = %d, pipeline = %u, stages = %s, program = %u",
1868           CID(context), pipeline,
1869           GLbitfieldToString(GLenumGroup::UseProgramStageMask, stages).c_str(), program);
1870 
1871     if (context)
1872     {
1873         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
1874         ShaderProgramID programPacked    = PackParam<ShaderProgramID>(program);
1875         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1876         bool isCallValid =
1877             (context->skipValidation() ||
1878              ValidateUseProgramStages(context, pipelinePacked, stages, programPacked));
1879         if (isCallValid)
1880         {
1881             context->useProgramStages(pipelinePacked, stages, programPacked);
1882         }
1883         ANGLE_CAPTURE(UseProgramStages, isCallValid, context, pipelinePacked, stages,
1884                       programPacked);
1885     }
1886     else
1887     {
1888         GenerateContextLostErrorOnCurrentGlobalContext();
1889     }
1890 }
1891 
GL_ValidateProgramPipeline(GLuint pipeline)1892 void GL_APIENTRY GL_ValidateProgramPipeline(GLuint pipeline)
1893 {
1894     Context *context = GetValidGlobalContext();
1895     EVENT(context, GLValidateProgramPipeline, "context = %d, pipeline = %u", CID(context),
1896           pipeline);
1897 
1898     if (context)
1899     {
1900         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
1901         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1902         bool isCallValid =
1903             (context->skipValidation() || ValidateValidateProgramPipeline(context, pipelinePacked));
1904         if (isCallValid)
1905         {
1906             context->validateProgramPipeline(pipelinePacked);
1907         }
1908         ANGLE_CAPTURE(ValidateProgramPipeline, isCallValid, context, pipelinePacked);
1909     }
1910     else
1911     {
1912         GenerateContextLostErrorOnCurrentGlobalContext();
1913     }
1914 }
1915 
GL_VertexAttribBinding(GLuint attribindex,GLuint bindingindex)1916 void GL_APIENTRY GL_VertexAttribBinding(GLuint attribindex, GLuint bindingindex)
1917 {
1918     Context *context = GetValidGlobalContext();
1919     EVENT(context, GLVertexAttribBinding, "context = %d, attribindex = %u, bindingindex = %u",
1920           CID(context), attribindex, bindingindex);
1921 
1922     if (context)
1923     {
1924         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1925         bool isCallValid                                      = (context->skipValidation() ||
1926                             ValidateVertexAttribBinding(context, attribindex, bindingindex));
1927         if (isCallValid)
1928         {
1929             context->vertexAttribBinding(attribindex, bindingindex);
1930         }
1931         ANGLE_CAPTURE(VertexAttribBinding, isCallValid, context, attribindex, bindingindex);
1932     }
1933     else
1934     {
1935         GenerateContextLostErrorOnCurrentGlobalContext();
1936     }
1937 }
1938 
GL_VertexAttribFormat(GLuint attribindex,GLint size,GLenum type,GLboolean normalized,GLuint relativeoffset)1939 void GL_APIENTRY GL_VertexAttribFormat(GLuint attribindex,
1940                                        GLint size,
1941                                        GLenum type,
1942                                        GLboolean normalized,
1943                                        GLuint relativeoffset)
1944 {
1945     Context *context = GetValidGlobalContext();
1946     EVENT(context, GLVertexAttribFormat,
1947           "context = %d, attribindex = %u, size = %d, type = %s, normalized = %s, relativeoffset = "
1948           "%u",
1949           CID(context), attribindex, size, GLenumToString(GLenumGroup::DefaultGroup, type),
1950           GLbooleanToString(normalized), relativeoffset);
1951 
1952     if (context)
1953     {
1954         VertexAttribType typePacked                           = PackParam<VertexAttribType>(type);
1955         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1956         bool isCallValid                                      = (context->skipValidation() ||
1957                             ValidateVertexAttribFormat(context, attribindex, size, typePacked,
1958                                                        normalized, relativeoffset));
1959         if (isCallValid)
1960         {
1961             context->vertexAttribFormat(attribindex, size, typePacked, normalized, relativeoffset);
1962         }
1963         ANGLE_CAPTURE(VertexAttribFormat, isCallValid, context, attribindex, size, typePacked,
1964                       normalized, relativeoffset);
1965     }
1966     else
1967     {
1968         GenerateContextLostErrorOnCurrentGlobalContext();
1969     }
1970 }
1971 
GL_VertexAttribIFormat(GLuint attribindex,GLint size,GLenum type,GLuint relativeoffset)1972 void GL_APIENTRY GL_VertexAttribIFormat(GLuint attribindex,
1973                                         GLint size,
1974                                         GLenum type,
1975                                         GLuint relativeoffset)
1976 {
1977     Context *context = GetValidGlobalContext();
1978     EVENT(context, GLVertexAttribIFormat,
1979           "context = %d, attribindex = %u, size = %d, type = %s, relativeoffset = %u", CID(context),
1980           attribindex, size, GLenumToString(GLenumGroup::DefaultGroup, type), relativeoffset);
1981 
1982     if (context)
1983     {
1984         VertexAttribType typePacked                           = PackParam<VertexAttribType>(type);
1985         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1986         bool isCallValid =
1987             (context->skipValidation() ||
1988              ValidateVertexAttribIFormat(context, attribindex, size, typePacked, relativeoffset));
1989         if (isCallValid)
1990         {
1991             context->vertexAttribIFormat(attribindex, size, typePacked, relativeoffset);
1992         }
1993         ANGLE_CAPTURE(VertexAttribIFormat, isCallValid, context, attribindex, size, typePacked,
1994                       relativeoffset);
1995     }
1996     else
1997     {
1998         GenerateContextLostErrorOnCurrentGlobalContext();
1999     }
2000 }
2001 
GL_VertexBindingDivisor(GLuint bindingindex,GLuint divisor)2002 void GL_APIENTRY GL_VertexBindingDivisor(GLuint bindingindex, GLuint divisor)
2003 {
2004     Context *context = GetValidGlobalContext();
2005     EVENT(context, GLVertexBindingDivisor, "context = %d, bindingindex = %u, divisor = %u",
2006           CID(context), bindingindex, divisor);
2007 
2008     if (context)
2009     {
2010         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2011         bool isCallValid                                      = (context->skipValidation() ||
2012                             ValidateVertexBindingDivisor(context, bindingindex, divisor));
2013         if (isCallValid)
2014         {
2015             context->vertexBindingDivisor(bindingindex, divisor);
2016         }
2017         ANGLE_CAPTURE(VertexBindingDivisor, isCallValid, context, bindingindex, divisor);
2018     }
2019     else
2020     {
2021         GenerateContextLostErrorOnCurrentGlobalContext();
2022     }
2023 }
2024 
2025 }  // extern "C"
2026