1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.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_ext_autogen.cpp:
9 //   Defines the GLES extension entry points.
10 
11 #include "libGLESv2/entry_points_gles_ext_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_ext_autogen.h"
17 #include "libANGLE/capture/gl_enum_utils.h"
18 #include "libANGLE/entry_points_utils.h"
19 #include "libANGLE/validationESEXT.h"
20 #include "libGLESv2/global_state.h"
21 
22 using namespace gl;
23 
24 #include "libANGLE/capture/capture_gles_1_0_autogen.h"
25 #include "libANGLE/capture/capture_gles_2_0_autogen.h"
26 #include "libANGLE/capture/capture_gles_3_0_autogen.h"
27 #include "libANGLE/capture/capture_gles_3_1_autogen.h"
28 #include "libANGLE/capture/capture_gles_3_2_autogen.h"
29 #include "libANGLE/validationES1.h"
30 #include "libANGLE/validationES2.h"
31 #include "libANGLE/validationES3.h"
32 #include "libANGLE/validationES31.h"
33 #include "libANGLE/validationES32.h"
34 
35 using namespace gl;
36 
37 extern "C" {
38 
39 // GL_ANGLE_base_vertex_base_instance
GL_DrawArraysInstancedBaseInstanceANGLE(GLenum mode,GLint first,GLsizei count,GLsizei instanceCount,GLuint baseInstance)40 void GL_APIENTRY GL_DrawArraysInstancedBaseInstanceANGLE(GLenum mode,
41                                                          GLint first,
42                                                          GLsizei count,
43                                                          GLsizei instanceCount,
44                                                          GLuint baseInstance)
45 {
46     Context *context = GetValidGlobalContext();
47     EVENT(context, GLDrawArraysInstancedBaseInstanceANGLE,
48           "context = %d, mode = %s, first = %d, count = %d, instanceCount = %d, baseInstance = %u",
49           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), first, count,
50           instanceCount, baseInstance);
51 
52     if (context)
53     {
54         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
55         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
56         bool isCallValid                                      = (context->skipValidation() ||
57                             ValidateDrawArraysInstancedBaseInstanceANGLE(
58                                 context, modePacked, first, count, instanceCount, baseInstance));
59         if (isCallValid)
60         {
61             context->drawArraysInstancedBaseInstance(modePacked, first, count, instanceCount,
62                                                      baseInstance);
63         }
64         ANGLE_CAPTURE(DrawArraysInstancedBaseInstanceANGLE, isCallValid, context, modePacked, first,
65                       count, instanceCount, baseInstance);
66     }
67     else
68     {
69         GenerateContextLostErrorOnCurrentGlobalContext();
70     }
71 }
72 
GL_DrawElementsInstancedBaseVertexBaseInstanceANGLE(GLenum mode,GLsizei count,GLenum type,const GLvoid * indices,GLsizei instanceCounts,GLint baseVertex,GLuint baseInstance)73 void GL_APIENTRY GL_DrawElementsInstancedBaseVertexBaseInstanceANGLE(GLenum mode,
74                                                                      GLsizei count,
75                                                                      GLenum type,
76                                                                      const GLvoid *indices,
77                                                                      GLsizei instanceCounts,
78                                                                      GLint baseVertex,
79                                                                      GLuint baseInstance)
80 {
81     Context *context = GetValidGlobalContext();
82     EVENT(context, GLDrawElementsInstancedBaseVertexBaseInstanceANGLE,
83           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
84           ", instanceCounts = %d, baseVertex = %d, baseInstance = %u",
85           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), count,
86           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices, instanceCounts,
87           baseVertex, baseInstance);
88 
89     if (context)
90     {
91         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
92         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
93         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
94         bool isCallValid =
95             (context->skipValidation() || ValidateDrawElementsInstancedBaseVertexBaseInstanceANGLE(
96                                               context, modePacked, count, typePacked, indices,
97                                               instanceCounts, baseVertex, baseInstance));
98         if (isCallValid)
99         {
100             context->drawElementsInstancedBaseVertexBaseInstance(
101                 modePacked, count, typePacked, indices, instanceCounts, baseVertex, baseInstance);
102         }
103         ANGLE_CAPTURE(DrawElementsInstancedBaseVertexBaseInstanceANGLE, isCallValid, context,
104                       modePacked, count, typePacked, indices, instanceCounts, baseVertex,
105                       baseInstance);
106     }
107     else
108     {
109         GenerateContextLostErrorOnCurrentGlobalContext();
110     }
111 }
112 
GL_MultiDrawArraysInstancedBaseInstanceANGLE(GLenum mode,const GLint * firsts,const GLsizei * counts,const GLsizei * instanceCounts,const GLuint * baseInstances,GLsizei drawcount)113 void GL_APIENTRY GL_MultiDrawArraysInstancedBaseInstanceANGLE(GLenum mode,
114                                                               const GLint *firsts,
115                                                               const GLsizei *counts,
116                                                               const GLsizei *instanceCounts,
117                                                               const GLuint *baseInstances,
118                                                               GLsizei drawcount)
119 {
120     Context *context = GetValidGlobalContext();
121     EVENT(context, GLMultiDrawArraysInstancedBaseInstanceANGLE,
122           "context = %d, mode = %s, firsts = 0x%016" PRIxPTR ", counts = 0x%016" PRIxPTR
123           ", instanceCounts = 0x%016" PRIxPTR ", baseInstances = 0x%016" PRIxPTR ", drawcount = %d",
124           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), (uintptr_t)firsts,
125           (uintptr_t)counts, (uintptr_t)instanceCounts, (uintptr_t)baseInstances, drawcount);
126 
127     if (context)
128     {
129         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
130         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
131         bool isCallValid =
132             (context->skipValidation() ||
133              ValidateMultiDrawArraysInstancedBaseInstanceANGLE(
134                  context, modePacked, firsts, counts, instanceCounts, baseInstances, drawcount));
135         if (isCallValid)
136         {
137             context->multiDrawArraysInstancedBaseInstance(modePacked, firsts, counts,
138                                                           instanceCounts, baseInstances, drawcount);
139         }
140         ANGLE_CAPTURE(MultiDrawArraysInstancedBaseInstanceANGLE, isCallValid, context, modePacked,
141                       firsts, counts, instanceCounts, baseInstances, drawcount);
142     }
143     else
144     {
145         GenerateContextLostErrorOnCurrentGlobalContext();
146     }
147 }
148 
149 void GL_APIENTRY
GL_MultiDrawElementsInstancedBaseVertexBaseInstanceANGLE(GLenum mode,const GLsizei * counts,GLenum type,const GLvoid * const * indices,const GLsizei * instanceCounts,const GLint * baseVertices,const GLuint * baseInstances,GLsizei drawcount)150 GL_MultiDrawElementsInstancedBaseVertexBaseInstanceANGLE(GLenum mode,
151                                                          const GLsizei *counts,
152                                                          GLenum type,
153                                                          const GLvoid *const *indices,
154                                                          const GLsizei *instanceCounts,
155                                                          const GLint *baseVertices,
156                                                          const GLuint *baseInstances,
157                                                          GLsizei drawcount)
158 {
159     Context *context = GetValidGlobalContext();
160     EVENT(context, GLMultiDrawElementsInstancedBaseVertexBaseInstanceANGLE,
161           "context = %d, mode = %s, counts = 0x%016" PRIxPTR ", type = %s, indices = 0x%016" PRIxPTR
162           ", instanceCounts = 0x%016" PRIxPTR ", baseVertices = 0x%016" PRIxPTR
163           ", baseInstances = 0x%016" PRIxPTR ", drawcount = %d",
164           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), (uintptr_t)counts,
165           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices,
166           (uintptr_t)instanceCounts, (uintptr_t)baseVertices, (uintptr_t)baseInstances, drawcount);
167 
168     if (context)
169     {
170         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
171         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
172         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
173         bool isCallValid                                      = (context->skipValidation() ||
174                             ValidateMultiDrawElementsInstancedBaseVertexBaseInstanceANGLE(
175                                 context, modePacked, counts, typePacked, indices, instanceCounts,
176                                 baseVertices, baseInstances, drawcount));
177         if (isCallValid)
178         {
179             context->multiDrawElementsInstancedBaseVertexBaseInstance(
180                 modePacked, counts, typePacked, indices, instanceCounts, baseVertices,
181                 baseInstances, drawcount);
182         }
183         ANGLE_CAPTURE(MultiDrawElementsInstancedBaseVertexBaseInstanceANGLE, isCallValid, context,
184                       modePacked, counts, typePacked, indices, instanceCounts, baseVertices,
185                       baseInstances, drawcount);
186     }
187     else
188     {
189         GenerateContextLostErrorOnCurrentGlobalContext();
190     }
191 }
192 
193 // GL_ANGLE_copy_texture_3d
GL_CopyTexture3DANGLE(GLuint sourceId,GLint sourceLevel,GLenum destTarget,GLuint destId,GLint destLevel,GLint internalFormat,GLenum destType,GLboolean unpackFlipY,GLboolean unpackPremultiplyAlpha,GLboolean unpackUnmultiplyAlpha)194 void GL_APIENTRY GL_CopyTexture3DANGLE(GLuint sourceId,
195                                        GLint sourceLevel,
196                                        GLenum destTarget,
197                                        GLuint destId,
198                                        GLint destLevel,
199                                        GLint internalFormat,
200                                        GLenum destType,
201                                        GLboolean unpackFlipY,
202                                        GLboolean unpackPremultiplyAlpha,
203                                        GLboolean unpackUnmultiplyAlpha)
204 {
205     Context *context = GetValidGlobalContext();
206     EVENT(context, GLCopyTexture3DANGLE,
207           "context = %d, sourceId = %u, sourceLevel = %d, destTarget = %s, destId = %u, destLevel "
208           "= %d, internalFormat = %d, destType = %s, unpackFlipY = %s, unpackPremultiplyAlpha = "
209           "%s, unpackUnmultiplyAlpha = %s",
210           CID(context), sourceId, sourceLevel,
211           GLenumToString(GLenumGroup::DefaultGroup, destTarget), destId, destLevel, internalFormat,
212           GLenumToString(GLenumGroup::DefaultGroup, destType), GLbooleanToString(unpackFlipY),
213           GLbooleanToString(unpackPremultiplyAlpha), GLbooleanToString(unpackUnmultiplyAlpha));
214 
215     if (context)
216     {
217         TextureID sourceIdPacked       = PackParam<TextureID>(sourceId);
218         TextureTarget destTargetPacked = PackParam<TextureTarget>(destTarget);
219         TextureID destIdPacked         = PackParam<TextureID>(destId);
220         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
221         bool isCallValid                                      = (context->skipValidation() ||
222                             ValidateCopyTexture3DANGLE(
223                                 context, sourceIdPacked, sourceLevel, destTargetPacked,
224                                 destIdPacked, destLevel, internalFormat, destType, unpackFlipY,
225                                 unpackPremultiplyAlpha, unpackUnmultiplyAlpha));
226         if (isCallValid)
227         {
228             context->copyTexture3D(sourceIdPacked, sourceLevel, destTargetPacked, destIdPacked,
229                                    destLevel, internalFormat, destType, unpackFlipY,
230                                    unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
231         }
232         ANGLE_CAPTURE(CopyTexture3DANGLE, isCallValid, context, sourceIdPacked, sourceLevel,
233                       destTargetPacked, destIdPacked, destLevel, internalFormat, destType,
234                       unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
235     }
236     else
237     {
238         GenerateContextLostErrorOnCurrentGlobalContext();
239     }
240 }
241 
GL_CopySubTexture3DANGLE(GLuint sourceId,GLint sourceLevel,GLenum destTarget,GLuint destId,GLint destLevel,GLint xoffset,GLint yoffset,GLint zoffset,GLint x,GLint y,GLint z,GLint width,GLint height,GLint depth,GLboolean unpackFlipY,GLboolean unpackPremultiplyAlpha,GLboolean unpackUnmultiplyAlpha)242 void GL_APIENTRY GL_CopySubTexture3DANGLE(GLuint sourceId,
243                                           GLint sourceLevel,
244                                           GLenum destTarget,
245                                           GLuint destId,
246                                           GLint destLevel,
247                                           GLint xoffset,
248                                           GLint yoffset,
249                                           GLint zoffset,
250                                           GLint x,
251                                           GLint y,
252                                           GLint z,
253                                           GLint width,
254                                           GLint height,
255                                           GLint depth,
256                                           GLboolean unpackFlipY,
257                                           GLboolean unpackPremultiplyAlpha,
258                                           GLboolean unpackUnmultiplyAlpha)
259 {
260     Context *context = GetValidGlobalContext();
261     EVENT(context, GLCopySubTexture3DANGLE,
262           "context = %d, sourceId = %u, sourceLevel = %d, destTarget = %s, destId = %u, destLevel "
263           "= %d, xoffset = %d, yoffset = %d, zoffset = %d, x = %d, y = %d, z = %d, width = %d, "
264           "height = %d, depth = %d, unpackFlipY = %s, unpackPremultiplyAlpha = %s, "
265           "unpackUnmultiplyAlpha = %s",
266           CID(context), sourceId, sourceLevel,
267           GLenumToString(GLenumGroup::DefaultGroup, destTarget), destId, destLevel, xoffset,
268           yoffset, zoffset, x, y, z, width, height, depth, GLbooleanToString(unpackFlipY),
269           GLbooleanToString(unpackPremultiplyAlpha), GLbooleanToString(unpackUnmultiplyAlpha));
270 
271     if (context)
272     {
273         TextureID sourceIdPacked       = PackParam<TextureID>(sourceId);
274         TextureTarget destTargetPacked = PackParam<TextureTarget>(destTarget);
275         TextureID destIdPacked         = PackParam<TextureID>(destId);
276         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
277         bool isCallValid =
278             (context->skipValidation() ||
279              ValidateCopySubTexture3DANGLE(context, sourceIdPacked, sourceLevel, destTargetPacked,
280                                            destIdPacked, destLevel, xoffset, yoffset, zoffset, x, y,
281                                            z, width, height, depth, unpackFlipY,
282                                            unpackPremultiplyAlpha, unpackUnmultiplyAlpha));
283         if (isCallValid)
284         {
285             context->copySubTexture3D(sourceIdPacked, sourceLevel, destTargetPacked, destIdPacked,
286                                       destLevel, xoffset, yoffset, zoffset, x, y, z, width, height,
287                                       depth, unpackFlipY, unpackPremultiplyAlpha,
288                                       unpackUnmultiplyAlpha);
289         }
290         ANGLE_CAPTURE(CopySubTexture3DANGLE, isCallValid, context, sourceIdPacked, sourceLevel,
291                       destTargetPacked, destIdPacked, destLevel, xoffset, yoffset, zoffset, x, y, z,
292                       width, height, depth, unpackFlipY, unpackPremultiplyAlpha,
293                       unpackUnmultiplyAlpha);
294     }
295     else
296     {
297         GenerateContextLostErrorOnCurrentGlobalContext();
298     }
299 }
300 
301 // GL_ANGLE_framebuffer_blit
GL_BlitFramebufferANGLE(GLint srcX0,GLint srcY0,GLint srcX1,GLint srcY1,GLint dstX0,GLint dstY0,GLint dstX1,GLint dstY1,GLbitfield mask,GLenum filter)302 void GL_APIENTRY GL_BlitFramebufferANGLE(GLint srcX0,
303                                          GLint srcY0,
304                                          GLint srcX1,
305                                          GLint srcY1,
306                                          GLint dstX0,
307                                          GLint dstY0,
308                                          GLint dstX1,
309                                          GLint dstY1,
310                                          GLbitfield mask,
311                                          GLenum filter)
312 {
313     Context *context = GetValidGlobalContext();
314     EVENT(context, GLBlitFramebufferANGLE,
315           "context = %d, srcX0 = %d, srcY0 = %d, srcX1 = %d, srcY1 = %d, dstX0 = %d, dstY0 = %d, "
316           "dstX1 = %d, dstY1 = %d, mask = %s, filter = %s",
317           CID(context), srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
318           GLbitfieldToString(GLenumGroup::ClearBufferMask, mask).c_str(),
319           GLenumToString(GLenumGroup::BlitFramebufferFilter, filter));
320 
321     if (context)
322     {
323         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
324         bool isCallValid                                      = (context->skipValidation() ||
325                             ValidateBlitFramebufferANGLE(context, srcX0, srcY0, srcX1, srcY1, dstX0,
326                                                          dstY0, dstX1, dstY1, mask, filter));
327         if (isCallValid)
328         {
329             context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask,
330                                      filter);
331         }
332         ANGLE_CAPTURE(BlitFramebufferANGLE, isCallValid, context, srcX0, srcY0, srcX1, srcY1, dstX0,
333                       dstY0, dstX1, dstY1, mask, filter);
334     }
335     else
336     {
337         GenerateContextLostErrorOnCurrentGlobalContext();
338     }
339 }
340 
341 // GL_ANGLE_framebuffer_multisample
GL_RenderbufferStorageMultisampleANGLE(GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height)342 void GL_APIENTRY GL_RenderbufferStorageMultisampleANGLE(GLenum target,
343                                                         GLsizei samples,
344                                                         GLenum internalformat,
345                                                         GLsizei width,
346                                                         GLsizei height)
347 {
348     Context *context = GetValidGlobalContext();
349     EVENT(context, GLRenderbufferStorageMultisampleANGLE,
350           "context = %d, target = %s, samples = %d, internalformat = %s, width = %d, height = %d",
351           CID(context), GLenumToString(GLenumGroup::RenderbufferTarget, target), samples,
352           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height);
353 
354     if (context)
355     {
356         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
357         bool isCallValid                                      = (context->skipValidation() ||
358                             ValidateRenderbufferStorageMultisampleANGLE(
359                                 context, target, samples, internalformat, width, height));
360         if (isCallValid)
361         {
362             context->renderbufferStorageMultisample(target, samples, internalformat, width, height);
363         }
364         ANGLE_CAPTURE(RenderbufferStorageMultisampleANGLE, isCallValid, context, target, samples,
365                       internalformat, width, height);
366     }
367     else
368     {
369         GenerateContextLostErrorOnCurrentGlobalContext();
370     }
371 }
372 
373 // GL_ANGLE_get_image
374 void GL_APIENTRY
GL_GetTexImageANGLE(GLenum target,GLint level,GLenum format,GLenum type,void * pixels)375 GL_GetTexImageANGLE(GLenum target, GLint level, GLenum format, GLenum type, void *pixels)
376 {
377     Context *context = GetValidGlobalContext();
378     EVENT(context, GLGetTexImageANGLE,
379           "context = %d, target = %s, level = %d, format = %s, type = %s, pixels = 0x%016" PRIxPTR
380           "",
381           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level,
382           GLenumToString(GLenumGroup::PixelFormat, format),
383           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
384 
385     if (context)
386     {
387         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
388         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
389         bool isCallValid =
390             (context->skipValidation() ||
391              ValidateGetTexImageANGLE(context, targetPacked, level, format, type, pixels));
392         if (isCallValid)
393         {
394             context->getTexImage(targetPacked, level, format, type, pixels);
395         }
396         ANGLE_CAPTURE(GetTexImageANGLE, isCallValid, context, targetPacked, level, format, type,
397                       pixels);
398     }
399     else
400     {
401         GenerateContextLostErrorOnCurrentGlobalContext();
402     }
403 }
404 
GL_GetRenderbufferImageANGLE(GLenum target,GLenum format,GLenum type,void * pixels)405 void GL_APIENTRY GL_GetRenderbufferImageANGLE(GLenum target,
406                                               GLenum format,
407                                               GLenum type,
408                                               void *pixels)
409 {
410     Context *context = GetValidGlobalContext();
411     EVENT(context, GLGetRenderbufferImageANGLE,
412           "context = %d, target = %s, format = %s, type = %s, pixels = 0x%016" PRIxPTR "",
413           CID(context), GLenumToString(GLenumGroup::RenderbufferTarget, target),
414           GLenumToString(GLenumGroup::PixelFormat, format),
415           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
416 
417     if (context)
418     {
419         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
420         bool isCallValid =
421             (context->skipValidation() ||
422              ValidateGetRenderbufferImageANGLE(context, target, format, type, pixels));
423         if (isCallValid)
424         {
425             context->getRenderbufferImage(target, format, type, pixels);
426         }
427         ANGLE_CAPTURE(GetRenderbufferImageANGLE, isCallValid, context, target, format, type,
428                       pixels);
429     }
430     else
431     {
432         GenerateContextLostErrorOnCurrentGlobalContext();
433     }
434 }
435 
436 // GL_ANGLE_get_tex_level_parameter
GL_GetTexLevelParameterivANGLE(GLenum target,GLint level,GLenum pname,GLint * params)437 void GL_APIENTRY GL_GetTexLevelParameterivANGLE(GLenum target,
438                                                 GLint level,
439                                                 GLenum pname,
440                                                 GLint *params)
441 {
442     Context *context = GetValidGlobalContext();
443     EVENT(context, GLGetTexLevelParameterivANGLE,
444           "context = %d, target = %s, level = %d, pname = %s, params = 0x%016" PRIxPTR "",
445           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level,
446           GLenumToString(GLenumGroup::GetTextureParameter, pname), (uintptr_t)params);
447 
448     if (context)
449     {
450         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
451         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
452         bool isCallValid =
453             (context->skipValidation() ||
454              ValidateGetTexLevelParameterivANGLE(context, targetPacked, level, pname, params));
455         if (isCallValid)
456         {
457             context->getTexLevelParameteriv(targetPacked, level, pname, params);
458         }
459         ANGLE_CAPTURE(GetTexLevelParameterivANGLE, isCallValid, context, targetPacked, level, pname,
460                       params);
461     }
462     else
463     {
464         GenerateContextLostErrorOnCurrentGlobalContext();
465     }
466 }
467 
GL_GetTexLevelParameterfvANGLE(GLenum target,GLint level,GLenum pname,GLfloat * params)468 void GL_APIENTRY GL_GetTexLevelParameterfvANGLE(GLenum target,
469                                                 GLint level,
470                                                 GLenum pname,
471                                                 GLfloat *params)
472 {
473     Context *context = GetValidGlobalContext();
474     EVENT(context, GLGetTexLevelParameterfvANGLE,
475           "context = %d, target = %s, level = %d, pname = %s, params = 0x%016" PRIxPTR "",
476           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target), level,
477           GLenumToString(GLenumGroup::DefaultGroup, pname), (uintptr_t)params);
478 
479     if (context)
480     {
481         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
482         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
483         bool isCallValid =
484             (context->skipValidation() ||
485              ValidateGetTexLevelParameterfvANGLE(context, targetPacked, level, pname, params));
486         if (isCallValid)
487         {
488             context->getTexLevelParameterfv(targetPacked, level, pname, params);
489         }
490         ANGLE_CAPTURE(GetTexLevelParameterfvANGLE, isCallValid, context, targetPacked, level, pname,
491                       params);
492     }
493     else
494     {
495         GenerateContextLostErrorOnCurrentGlobalContext();
496     }
497 }
498 
499 // GL_ANGLE_instanced_arrays
GL_DrawArraysInstancedANGLE(GLenum mode,GLint first,GLsizei count,GLsizei primcount)500 void GL_APIENTRY GL_DrawArraysInstancedANGLE(GLenum mode,
501                                              GLint first,
502                                              GLsizei count,
503                                              GLsizei primcount)
504 {
505     Context *context = GetValidGlobalContext();
506     EVENT(context, GLDrawArraysInstancedANGLE,
507           "context = %d, mode = %s, first = %d, count = %d, primcount = %d", CID(context),
508           GLenumToString(GLenumGroup::PrimitiveType, mode), first, count, primcount);
509 
510     if (context)
511     {
512         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
513         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
514         bool isCallValid =
515             (context->skipValidation() ||
516              ValidateDrawArraysInstancedANGLE(context, modePacked, first, count, primcount));
517         if (isCallValid)
518         {
519             context->drawArraysInstanced(modePacked, first, count, primcount);
520         }
521         ANGLE_CAPTURE(DrawArraysInstancedANGLE, isCallValid, context, modePacked, first, count,
522                       primcount);
523     }
524     else
525     {
526         GenerateContextLostErrorOnCurrentGlobalContext();
527     }
528 }
529 
GL_DrawElementsInstancedANGLE(GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei primcount)530 void GL_APIENTRY GL_DrawElementsInstancedANGLE(GLenum mode,
531                                                GLsizei count,
532                                                GLenum type,
533                                                const void *indices,
534                                                GLsizei primcount)
535 {
536     Context *context = GetValidGlobalContext();
537     EVENT(context, GLDrawElementsInstancedANGLE,
538           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
539           ", primcount = %d",
540           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), count,
541           GLenumToString(GLenumGroup::PrimitiveType, type), (uintptr_t)indices, primcount);
542 
543     if (context)
544     {
545         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
546         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
547         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
548         bool isCallValid                                      = (context->skipValidation() ||
549                             ValidateDrawElementsInstancedANGLE(context, modePacked, count,
550                                                                typePacked, indices, primcount));
551         if (isCallValid)
552         {
553             context->drawElementsInstanced(modePacked, count, typePacked, indices, primcount);
554         }
555         ANGLE_CAPTURE(DrawElementsInstancedANGLE, isCallValid, context, modePacked, count,
556                       typePacked, indices, primcount);
557     }
558     else
559     {
560         GenerateContextLostErrorOnCurrentGlobalContext();
561     }
562 }
563 
GL_VertexAttribDivisorANGLE(GLuint index,GLuint divisor)564 void GL_APIENTRY GL_VertexAttribDivisorANGLE(GLuint index, GLuint divisor)
565 {
566     Context *context = GetValidGlobalContext();
567     EVENT(context, GLVertexAttribDivisorANGLE, "context = %d, index = %u, divisor = %u",
568           CID(context), index, divisor);
569 
570     if (context)
571     {
572         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
573         bool isCallValid                                      = (context->skipValidation() ||
574                             ValidateVertexAttribDivisorANGLE(context, index, divisor));
575         if (isCallValid)
576         {
577             context->vertexAttribDivisor(index, divisor);
578         }
579         ANGLE_CAPTURE(VertexAttribDivisorANGLE, isCallValid, context, index, divisor);
580     }
581     else
582     {
583         GenerateContextLostErrorOnCurrentGlobalContext();
584     }
585 }
586 
587 // GL_ANGLE_memory_object_flags
GL_TexStorageMemFlags2DANGLE(GLenum target,GLsizei levels,GLenum internalFormat,GLsizei width,GLsizei height,GLuint memory,GLuint64 offset,GLbitfield createFlags,GLbitfield usageFlags)588 void GL_APIENTRY GL_TexStorageMemFlags2DANGLE(GLenum target,
589                                               GLsizei levels,
590                                               GLenum internalFormat,
591                                               GLsizei width,
592                                               GLsizei height,
593                                               GLuint memory,
594                                               GLuint64 offset,
595                                               GLbitfield createFlags,
596                                               GLbitfield usageFlags)
597 {
598     Context *context = GetValidGlobalContext();
599     EVENT(context, GLTexStorageMemFlags2DANGLE,
600           "context = %d, target = %s, levels = %d, internalFormat = %s, width = %d, height = %d, "
601           "memory = %u, offset = %llu, createFlags = %s, usageFlags = %s",
602           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), levels,
603           GLenumToString(GLenumGroup::DefaultGroup, internalFormat), width, height, memory,
604           static_cast<unsigned long long>(offset),
605           GLbitfieldToString(GLenumGroup::DefaultGroup, createFlags).c_str(),
606           GLbitfieldToString(GLenumGroup::DefaultGroup, usageFlags).c_str());
607 
608     if (context)
609     {
610         TextureType targetPacked                              = PackParam<TextureType>(target);
611         MemoryObjectID memoryPacked                           = PackParam<MemoryObjectID>(memory);
612         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
613         bool isCallValid                                      = (context->skipValidation() ||
614                             ValidateTexStorageMemFlags2DANGLE(
615                                 context, targetPacked, levels, internalFormat, width, height,
616                                 memoryPacked, offset, createFlags, usageFlags));
617         if (isCallValid)
618         {
619             context->texStorageMemFlags2D(targetPacked, levels, internalFormat, width, height,
620                                           memoryPacked, offset, createFlags, usageFlags);
621         }
622         ANGLE_CAPTURE(TexStorageMemFlags2DANGLE, isCallValid, context, targetPacked, levels,
623                       internalFormat, width, height, memoryPacked, offset, createFlags, usageFlags);
624     }
625     else
626     {
627         GenerateContextLostErrorOnCurrentGlobalContext();
628     }
629 }
630 
GL_TexStorageMemFlags2DMultisampleANGLE(GLenum target,GLsizei samples,GLenum internalFormat,GLsizei width,GLsizei height,GLboolean fixedSampleLocations,GLuint memory,GLuint64 offset,GLbitfield createFlags,GLbitfield usageFlags)631 void GL_APIENTRY GL_TexStorageMemFlags2DMultisampleANGLE(GLenum target,
632                                                          GLsizei samples,
633                                                          GLenum internalFormat,
634                                                          GLsizei width,
635                                                          GLsizei height,
636                                                          GLboolean fixedSampleLocations,
637                                                          GLuint memory,
638                                                          GLuint64 offset,
639                                                          GLbitfield createFlags,
640                                                          GLbitfield usageFlags)
641 {
642     Context *context = GetValidGlobalContext();
643     EVENT(
644         context, GLTexStorageMemFlags2DMultisampleANGLE,
645         "context = %d, target = %s, samples = %d, internalFormat = %s, width = %d, height = %d, "
646         "fixedSampleLocations = %s, memory = %u, offset = %llu, createFlags = %s, usageFlags = %s",
647         CID(context), GLenumToString(GLenumGroup::TextureTarget, target), samples,
648         GLenumToString(GLenumGroup::DefaultGroup, internalFormat), width, height,
649         GLbooleanToString(fixedSampleLocations), memory, static_cast<unsigned long long>(offset),
650         GLbitfieldToString(GLenumGroup::DefaultGroup, createFlags).c_str(),
651         GLbitfieldToString(GLenumGroup::DefaultGroup, usageFlags).c_str());
652 
653     if (context)
654     {
655         TextureType targetPacked                              = PackParam<TextureType>(target);
656         MemoryObjectID memoryPacked                           = PackParam<MemoryObjectID>(memory);
657         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
658         bool isCallValid =
659             (context->skipValidation() ||
660              ValidateTexStorageMemFlags2DMultisampleANGLE(
661                  context, targetPacked, samples, internalFormat, width, height,
662                  fixedSampleLocations, memoryPacked, offset, createFlags, usageFlags));
663         if (isCallValid)
664         {
665             context->texStorageMemFlags2DMultisample(targetPacked, samples, internalFormat, width,
666                                                      height, fixedSampleLocations, memoryPacked,
667                                                      offset, createFlags, usageFlags);
668         }
669         ANGLE_CAPTURE(TexStorageMemFlags2DMultisampleANGLE, isCallValid, context, targetPacked,
670                       samples, internalFormat, width, height, fixedSampleLocations, memoryPacked,
671                       offset, createFlags, usageFlags);
672     }
673     else
674     {
675         GenerateContextLostErrorOnCurrentGlobalContext();
676     }
677 }
678 
GL_TexStorageMemFlags3DANGLE(GLenum target,GLsizei levels,GLenum internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLuint memory,GLuint64 offset,GLbitfield createFlags,GLbitfield usageFlags)679 void GL_APIENTRY GL_TexStorageMemFlags3DANGLE(GLenum target,
680                                               GLsizei levels,
681                                               GLenum internalFormat,
682                                               GLsizei width,
683                                               GLsizei height,
684                                               GLsizei depth,
685                                               GLuint memory,
686                                               GLuint64 offset,
687                                               GLbitfield createFlags,
688                                               GLbitfield usageFlags)
689 {
690     Context *context = GetValidGlobalContext();
691     EVENT(context, GLTexStorageMemFlags3DANGLE,
692           "context = %d, target = %s, levels = %d, internalFormat = %s, width = %d, height = %d, "
693           "depth = %d, memory = %u, offset = %llu, createFlags = %s, usageFlags = %s",
694           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), levels,
695           GLenumToString(GLenumGroup::DefaultGroup, internalFormat), width, height, depth, memory,
696           static_cast<unsigned long long>(offset),
697           GLbitfieldToString(GLenumGroup::DefaultGroup, createFlags).c_str(),
698           GLbitfieldToString(GLenumGroup::DefaultGroup, usageFlags).c_str());
699 
700     if (context)
701     {
702         TextureType targetPacked                              = PackParam<TextureType>(target);
703         MemoryObjectID memoryPacked                           = PackParam<MemoryObjectID>(memory);
704         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
705         bool isCallValid                                      = (context->skipValidation() ||
706                             ValidateTexStorageMemFlags3DANGLE(
707                                 context, targetPacked, levels, internalFormat, width, height, depth,
708                                 memoryPacked, offset, createFlags, usageFlags));
709         if (isCallValid)
710         {
711             context->texStorageMemFlags3D(targetPacked, levels, internalFormat, width, height,
712                                           depth, memoryPacked, offset, createFlags, usageFlags);
713         }
714         ANGLE_CAPTURE(TexStorageMemFlags3DANGLE, isCallValid, context, targetPacked, levels,
715                       internalFormat, width, height, depth, memoryPacked, offset, createFlags,
716                       usageFlags);
717     }
718     else
719     {
720         GenerateContextLostErrorOnCurrentGlobalContext();
721     }
722 }
723 
GL_TexStorageMemFlags3DMultisampleANGLE(GLenum target,GLsizei samples,GLenum internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLboolean fixedSampleLocations,GLuint memory,GLuint64 offset,GLbitfield createFlags,GLbitfield usageFlags)724 void GL_APIENTRY GL_TexStorageMemFlags3DMultisampleANGLE(GLenum target,
725                                                          GLsizei samples,
726                                                          GLenum internalFormat,
727                                                          GLsizei width,
728                                                          GLsizei height,
729                                                          GLsizei depth,
730                                                          GLboolean fixedSampleLocations,
731                                                          GLuint memory,
732                                                          GLuint64 offset,
733                                                          GLbitfield createFlags,
734                                                          GLbitfield usageFlags)
735 {
736     Context *context = GetValidGlobalContext();
737     EVENT(context, GLTexStorageMemFlags3DMultisampleANGLE,
738           "context = %d, target = %s, samples = %d, internalFormat = %s, width = %d, height = %d, "
739           "depth = %d, fixedSampleLocations = %s, memory = %u, offset = %llu, createFlags = %s, "
740           "usageFlags = %s",
741           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), samples,
742           GLenumToString(GLenumGroup::DefaultGroup, internalFormat), width, height, depth,
743           GLbooleanToString(fixedSampleLocations), memory, static_cast<unsigned long long>(offset),
744           GLbitfieldToString(GLenumGroup::DefaultGroup, createFlags).c_str(),
745           GLbitfieldToString(GLenumGroup::DefaultGroup, usageFlags).c_str());
746 
747     if (context)
748     {
749         TextureType targetPacked                              = PackParam<TextureType>(target);
750         MemoryObjectID memoryPacked                           = PackParam<MemoryObjectID>(memory);
751         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
752         bool isCallValid =
753             (context->skipValidation() ||
754              ValidateTexStorageMemFlags3DMultisampleANGLE(
755                  context, targetPacked, samples, internalFormat, width, height, depth,
756                  fixedSampleLocations, memoryPacked, offset, createFlags, usageFlags));
757         if (isCallValid)
758         {
759             context->texStorageMemFlags3DMultisample(targetPacked, samples, internalFormat, width,
760                                                      height, depth, fixedSampleLocations,
761                                                      memoryPacked, offset, createFlags, usageFlags);
762         }
763         ANGLE_CAPTURE(TexStorageMemFlags3DMultisampleANGLE, isCallValid, context, targetPacked,
764                       samples, internalFormat, width, height, depth, fixedSampleLocations,
765                       memoryPacked, offset, createFlags, usageFlags);
766     }
767     else
768     {
769         GenerateContextLostErrorOnCurrentGlobalContext();
770     }
771 }
772 
773 // GL_ANGLE_memory_object_fuchsia
GL_ImportMemoryZirconHandleANGLE(GLuint memory,GLuint64 size,GLenum handleType,GLuint handle)774 void GL_APIENTRY GL_ImportMemoryZirconHandleANGLE(GLuint memory,
775                                                   GLuint64 size,
776                                                   GLenum handleType,
777                                                   GLuint handle)
778 {
779     Context *context = GetValidGlobalContext();
780     EVENT(context, GLImportMemoryZirconHandleANGLE,
781           "context = %d, memory = %u, size = %llu, handleType = %s, handle = %u", CID(context),
782           memory, static_cast<unsigned long long>(size),
783           GLenumToString(GLenumGroup::ExternalHandleType, handleType), handle);
784 
785     if (context)
786     {
787         MemoryObjectID memoryPacked                           = PackParam<MemoryObjectID>(memory);
788         HandleType handleTypePacked                           = PackParam<HandleType>(handleType);
789         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
790         bool isCallValid                                      = (context->skipValidation() ||
791                             ValidateImportMemoryZirconHandleANGLE(context, memoryPacked, size,
792                                                                   handleTypePacked, handle));
793         if (isCallValid)
794         {
795             context->importMemoryZirconHandle(memoryPacked, size, handleTypePacked, handle);
796         }
797         ANGLE_CAPTURE(ImportMemoryZirconHandleANGLE, isCallValid, context, memoryPacked, size,
798                       handleTypePacked, handle);
799     }
800     else
801     {
802         GenerateContextLostErrorOnCurrentGlobalContext();
803     }
804 }
805 
806 // GL_ANGLE_multi_draw
GL_MultiDrawArraysANGLE(GLenum mode,const GLint * firsts,const GLsizei * counts,GLsizei drawcount)807 void GL_APIENTRY GL_MultiDrawArraysANGLE(GLenum mode,
808                                          const GLint *firsts,
809                                          const GLsizei *counts,
810                                          GLsizei drawcount)
811 {
812     Context *context = GetValidGlobalContext();
813     EVENT(context, GLMultiDrawArraysANGLE,
814           "context = %d, mode = %s, firsts = 0x%016" PRIxPTR ", counts = 0x%016" PRIxPTR
815           ", drawcount = %d",
816           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), (uintptr_t)firsts,
817           (uintptr_t)counts, drawcount);
818 
819     if (context)
820     {
821         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
822         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
823         bool isCallValid =
824             (context->skipValidation() ||
825              ValidateMultiDrawArraysANGLE(context, modePacked, firsts, counts, drawcount));
826         if (isCallValid)
827         {
828             context->multiDrawArrays(modePacked, firsts, counts, drawcount);
829         }
830         ANGLE_CAPTURE(MultiDrawArraysANGLE, isCallValid, context, modePacked, firsts, counts,
831                       drawcount);
832     }
833     else
834     {
835         GenerateContextLostErrorOnCurrentGlobalContext();
836     }
837 }
838 
GL_MultiDrawArraysInstancedANGLE(GLenum mode,const GLint * firsts,const GLsizei * counts,const GLsizei * instanceCounts,GLsizei drawcount)839 void GL_APIENTRY GL_MultiDrawArraysInstancedANGLE(GLenum mode,
840                                                   const GLint *firsts,
841                                                   const GLsizei *counts,
842                                                   const GLsizei *instanceCounts,
843                                                   GLsizei drawcount)
844 {
845     Context *context = GetValidGlobalContext();
846     EVENT(context, GLMultiDrawArraysInstancedANGLE,
847           "context = %d, mode = %s, firsts = 0x%016" PRIxPTR ", counts = 0x%016" PRIxPTR
848           ", instanceCounts = 0x%016" PRIxPTR ", drawcount = %d",
849           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), (uintptr_t)firsts,
850           (uintptr_t)counts, (uintptr_t)instanceCounts, drawcount);
851 
852     if (context)
853     {
854         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
855         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
856         bool isCallValid                                      = (context->skipValidation() ||
857                             ValidateMultiDrawArraysInstancedANGLE(
858                                 context, modePacked, firsts, counts, instanceCounts, drawcount));
859         if (isCallValid)
860         {
861             context->multiDrawArraysInstanced(modePacked, firsts, counts, instanceCounts,
862                                               drawcount);
863         }
864         ANGLE_CAPTURE(MultiDrawArraysInstancedANGLE, isCallValid, context, modePacked, firsts,
865                       counts, instanceCounts, drawcount);
866     }
867     else
868     {
869         GenerateContextLostErrorOnCurrentGlobalContext();
870     }
871 }
872 
GL_MultiDrawElementsANGLE(GLenum mode,const GLsizei * counts,GLenum type,const GLvoid * const * indices,GLsizei drawcount)873 void GL_APIENTRY GL_MultiDrawElementsANGLE(GLenum mode,
874                                            const GLsizei *counts,
875                                            GLenum type,
876                                            const GLvoid *const *indices,
877                                            GLsizei drawcount)
878 {
879     Context *context = GetValidGlobalContext();
880     EVENT(context, GLMultiDrawElementsANGLE,
881           "context = %d, mode = %s, counts = 0x%016" PRIxPTR ", type = %s, indices = 0x%016" PRIxPTR
882           ", drawcount = %d",
883           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), (uintptr_t)counts,
884           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices, drawcount);
885 
886     if (context)
887     {
888         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
889         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
890         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
891         bool isCallValid                                      = (context->skipValidation() ||
892                             ValidateMultiDrawElementsANGLE(context, modePacked, counts, typePacked,
893                                                            indices, drawcount));
894         if (isCallValid)
895         {
896             context->multiDrawElements(modePacked, counts, typePacked, indices, drawcount);
897         }
898         ANGLE_CAPTURE(MultiDrawElementsANGLE, isCallValid, context, modePacked, counts, typePacked,
899                       indices, drawcount);
900     }
901     else
902     {
903         GenerateContextLostErrorOnCurrentGlobalContext();
904     }
905 }
906 
GL_MultiDrawElementsInstancedANGLE(GLenum mode,const GLsizei * counts,GLenum type,const GLvoid * const * indices,const GLsizei * instanceCounts,GLsizei drawcount)907 void GL_APIENTRY GL_MultiDrawElementsInstancedANGLE(GLenum mode,
908                                                     const GLsizei *counts,
909                                                     GLenum type,
910                                                     const GLvoid *const *indices,
911                                                     const GLsizei *instanceCounts,
912                                                     GLsizei drawcount)
913 {
914     Context *context = GetValidGlobalContext();
915     EVENT(context, GLMultiDrawElementsInstancedANGLE,
916           "context = %d, mode = %s, counts = 0x%016" PRIxPTR ", type = %s, indices = 0x%016" PRIxPTR
917           ", instanceCounts = 0x%016" PRIxPTR ", drawcount = %d",
918           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), (uintptr_t)counts,
919           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices,
920           (uintptr_t)instanceCounts, drawcount);
921 
922     if (context)
923     {
924         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
925         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
926         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
927         bool isCallValid =
928             (context->skipValidation() ||
929              ValidateMultiDrawElementsInstancedANGLE(context, modePacked, counts, typePacked,
930                                                      indices, instanceCounts, drawcount));
931         if (isCallValid)
932         {
933             context->multiDrawElementsInstanced(modePacked, counts, typePacked, indices,
934                                                 instanceCounts, drawcount);
935         }
936         ANGLE_CAPTURE(MultiDrawElementsInstancedANGLE, isCallValid, context, modePacked, counts,
937                       typePacked, indices, instanceCounts, drawcount);
938     }
939     else
940     {
941         GenerateContextLostErrorOnCurrentGlobalContext();
942     }
943 }
944 
945 // GL_ANGLE_program_binary
946 
947 // GL_ANGLE_provoking_vertex
GL_ProvokingVertexANGLE(GLenum mode)948 void GL_APIENTRY GL_ProvokingVertexANGLE(GLenum mode)
949 {
950     Context *context = GetValidGlobalContext();
951     EVENT(context, GLProvokingVertexANGLE, "context = %d, mode = %s", CID(context),
952           GLenumToString(GLenumGroup::VertexProvokingMode, mode));
953 
954     if (context)
955     {
956         ProvokingVertexConvention modePacked = PackParam<ProvokingVertexConvention>(mode);
957         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
958         bool isCallValid =
959             (context->skipValidation() || ValidateProvokingVertexANGLE(context, modePacked));
960         if (isCallValid)
961         {
962             context->provokingVertex(modePacked);
963         }
964         ANGLE_CAPTURE(ProvokingVertexANGLE, isCallValid, context, modePacked);
965     }
966     else
967     {
968         GenerateContextLostErrorOnCurrentGlobalContext();
969     }
970 }
971 
972 // GL_ANGLE_request_extension
GL_RequestExtensionANGLE(const GLchar * name)973 void GL_APIENTRY GL_RequestExtensionANGLE(const GLchar *name)
974 {
975     Context *context = GetValidGlobalContext();
976     EVENT(context, GLRequestExtensionANGLE, "context = %d, name = 0x%016" PRIxPTR "", CID(context),
977           (uintptr_t)name);
978 
979     if (context)
980     {
981         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
982         bool isCallValid =
983             (context->skipValidation() || ValidateRequestExtensionANGLE(context, name));
984         if (isCallValid)
985         {
986             context->requestExtension(name);
987         }
988         ANGLE_CAPTURE(RequestExtensionANGLE, isCallValid, context, name);
989     }
990     else
991     {
992         GenerateContextLostErrorOnCurrentGlobalContext();
993     }
994 }
995 
GL_DisableExtensionANGLE(const GLchar * name)996 void GL_APIENTRY GL_DisableExtensionANGLE(const GLchar *name)
997 {
998     Context *context = GetValidGlobalContext();
999     EVENT(context, GLDisableExtensionANGLE, "context = %d, name = 0x%016" PRIxPTR "", CID(context),
1000           (uintptr_t)name);
1001 
1002     if (context)
1003     {
1004         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1005         bool isCallValid =
1006             (context->skipValidation() || ValidateDisableExtensionANGLE(context, name));
1007         if (isCallValid)
1008         {
1009             context->disableExtension(name);
1010         }
1011         ANGLE_CAPTURE(DisableExtensionANGLE, isCallValid, context, name);
1012     }
1013     else
1014     {
1015         GenerateContextLostErrorOnCurrentGlobalContext();
1016     }
1017 }
1018 
1019 // GL_ANGLE_robust_client_memory
GL_GetBooleanvRobustANGLE(GLenum pname,GLsizei bufSize,GLsizei * length,GLboolean * params)1020 void GL_APIENTRY GL_GetBooleanvRobustANGLE(GLenum pname,
1021                                            GLsizei bufSize,
1022                                            GLsizei *length,
1023                                            GLboolean *params)
1024 {
1025     Context *context = GetValidGlobalContext();
1026     EVENT(context, GLGetBooleanvRobustANGLE,
1027           "context = %d, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1028           ", params = 0x%016" PRIxPTR "",
1029           CID(context), GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
1030           (uintptr_t)length, (uintptr_t)params);
1031 
1032     if (context)
1033     {
1034         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1035         bool isCallValid =
1036             (context->skipValidation() ||
1037              ValidateGetBooleanvRobustANGLE(context, pname, bufSize, length, params));
1038         if (isCallValid)
1039         {
1040             context->getBooleanvRobust(pname, bufSize, length, params);
1041         }
1042         ANGLE_CAPTURE(GetBooleanvRobustANGLE, isCallValid, context, pname, bufSize, length, params);
1043     }
1044     else
1045     {
1046         GenerateContextLostErrorOnCurrentGlobalContext();
1047     }
1048 }
1049 
GL_GetBufferParameterivRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)1050 void GL_APIENTRY GL_GetBufferParameterivRobustANGLE(GLenum target,
1051                                                     GLenum pname,
1052                                                     GLsizei bufSize,
1053                                                     GLsizei *length,
1054                                                     GLint *params)
1055 {
1056     Context *context = GetValidGlobalContext();
1057     EVENT(context, GLGetBufferParameterivRobustANGLE,
1058           "context = %d, target = %s, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1059           ", params = 0x%016" PRIxPTR "",
1060           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target),
1061           GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize, (uintptr_t)length,
1062           (uintptr_t)params);
1063 
1064     if (context)
1065     {
1066         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
1067         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1068         bool isCallValid                                      = (context->skipValidation() ||
1069                             ValidateGetBufferParameterivRobustANGLE(context, targetPacked, pname,
1070                                                                     bufSize, length, params));
1071         if (isCallValid)
1072         {
1073             context->getBufferParameterivRobust(targetPacked, pname, bufSize, length, params);
1074         }
1075         ANGLE_CAPTURE(GetBufferParameterivRobustANGLE, isCallValid, context, targetPacked, pname,
1076                       bufSize, length, params);
1077     }
1078     else
1079     {
1080         GenerateContextLostErrorOnCurrentGlobalContext();
1081     }
1082 }
1083 
GL_GetFloatvRobustANGLE(GLenum pname,GLsizei bufSize,GLsizei * length,GLfloat * params)1084 void GL_APIENTRY GL_GetFloatvRobustANGLE(GLenum pname,
1085                                          GLsizei bufSize,
1086                                          GLsizei *length,
1087                                          GLfloat *params)
1088 {
1089     Context *context = GetValidGlobalContext();
1090     EVENT(context, GLGetFloatvRobustANGLE,
1091           "context = %d, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1092           ", params = 0x%016" PRIxPTR "",
1093           CID(context), GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
1094           (uintptr_t)length, (uintptr_t)params);
1095 
1096     if (context)
1097     {
1098         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1099         bool isCallValid                                      = (context->skipValidation() ||
1100                             ValidateGetFloatvRobustANGLE(context, pname, bufSize, length, params));
1101         if (isCallValid)
1102         {
1103             context->getFloatvRobust(pname, bufSize, length, params);
1104         }
1105         ANGLE_CAPTURE(GetFloatvRobustANGLE, isCallValid, context, pname, bufSize, length, params);
1106     }
1107     else
1108     {
1109         GenerateContextLostErrorOnCurrentGlobalContext();
1110     }
1111 }
1112 
GL_GetFramebufferAttachmentParameterivRobustANGLE(GLenum target,GLenum attachment,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)1113 void GL_APIENTRY GL_GetFramebufferAttachmentParameterivRobustANGLE(GLenum target,
1114                                                                    GLenum attachment,
1115                                                                    GLenum pname,
1116                                                                    GLsizei bufSize,
1117                                                                    GLsizei *length,
1118                                                                    GLint *params)
1119 {
1120     Context *context = GetValidGlobalContext();
1121     EVENT(context, GLGetFramebufferAttachmentParameterivRobustANGLE,
1122           "context = %d, target = %s, attachment = %s, pname = %s, bufSize = %d, length = "
1123           "0x%016" PRIxPTR ", params = 0x%016" PRIxPTR "",
1124           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target),
1125           GLenumToString(GLenumGroup::DefaultGroup, attachment),
1126           GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize, (uintptr_t)length,
1127           (uintptr_t)params);
1128 
1129     if (context)
1130     {
1131         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1132         bool isCallValid                                      = (context->skipValidation() ||
1133                             ValidateGetFramebufferAttachmentParameterivRobustANGLE(
1134                                 context, target, attachment, pname, bufSize, length, params));
1135         if (isCallValid)
1136         {
1137             context->getFramebufferAttachmentParameterivRobust(target, attachment, pname, bufSize,
1138                                                                length, params);
1139         }
1140         ANGLE_CAPTURE(GetFramebufferAttachmentParameterivRobustANGLE, isCallValid, context, target,
1141                       attachment, pname, bufSize, length, params);
1142     }
1143     else
1144     {
1145         GenerateContextLostErrorOnCurrentGlobalContext();
1146     }
1147 }
1148 
GL_GetIntegervRobustANGLE(GLenum pname,GLsizei bufSize,GLsizei * length,GLint * data)1149 void GL_APIENTRY GL_GetIntegervRobustANGLE(GLenum pname,
1150                                            GLsizei bufSize,
1151                                            GLsizei *length,
1152                                            GLint *data)
1153 {
1154     Context *context = GetValidGlobalContext();
1155     EVENT(context, GLGetIntegervRobustANGLE,
1156           "context = %d, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1157           ", data = 0x%016" PRIxPTR "",
1158           CID(context), GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
1159           (uintptr_t)length, (uintptr_t)data);
1160 
1161     if (context)
1162     {
1163         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1164         bool isCallValid                                      = (context->skipValidation() ||
1165                             ValidateGetIntegervRobustANGLE(context, pname, bufSize, length, data));
1166         if (isCallValid)
1167         {
1168             context->getIntegervRobust(pname, bufSize, length, data);
1169         }
1170         ANGLE_CAPTURE(GetIntegervRobustANGLE, isCallValid, context, pname, bufSize, length, data);
1171     }
1172     else
1173     {
1174         GenerateContextLostErrorOnCurrentGlobalContext();
1175     }
1176 }
1177 
GL_GetProgramivRobustANGLE(GLuint program,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)1178 void GL_APIENTRY GL_GetProgramivRobustANGLE(GLuint program,
1179                                             GLenum pname,
1180                                             GLsizei bufSize,
1181                                             GLsizei *length,
1182                                             GLint *params)
1183 {
1184     Context *context = GetGlobalContext();
1185     EVENT(context, GLGetProgramivRobustANGLE,
1186           "context = %d, program = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1187           ", params = 0x%016" PRIxPTR "",
1188           CID(context), program, GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
1189           (uintptr_t)length, (uintptr_t)params);
1190 
1191     if (context)
1192     {
1193         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
1194         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1195         bool isCallValid                                      = (context->skipValidation() ||
1196                             ValidateGetProgramivRobustANGLE(context, programPacked, pname, bufSize,
1197                                                             length, params));
1198         if (isCallValid)
1199         {
1200             context->getProgramivRobust(programPacked, pname, bufSize, length, params);
1201         }
1202         ANGLE_CAPTURE(GetProgramivRobustANGLE, isCallValid, context, programPacked, pname, bufSize,
1203                       length, params);
1204     }
1205     else
1206     {}
1207 }
1208 
GL_GetRenderbufferParameterivRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)1209 void GL_APIENTRY GL_GetRenderbufferParameterivRobustANGLE(GLenum target,
1210                                                           GLenum pname,
1211                                                           GLsizei bufSize,
1212                                                           GLsizei *length,
1213                                                           GLint *params)
1214 {
1215     Context *context = GetValidGlobalContext();
1216     EVENT(context, GLGetRenderbufferParameterivRobustANGLE,
1217           "context = %d, target = %s, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1218           ", params = 0x%016" PRIxPTR "",
1219           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target),
1220           GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize, (uintptr_t)length,
1221           (uintptr_t)params);
1222 
1223     if (context)
1224     {
1225         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1226         bool isCallValid =
1227             (context->skipValidation() || ValidateGetRenderbufferParameterivRobustANGLE(
1228                                               context, target, pname, bufSize, length, params));
1229         if (isCallValid)
1230         {
1231             context->getRenderbufferParameterivRobust(target, pname, bufSize, length, params);
1232         }
1233         ANGLE_CAPTURE(GetRenderbufferParameterivRobustANGLE, isCallValid, context, target, pname,
1234                       bufSize, length, params);
1235     }
1236     else
1237     {
1238         GenerateContextLostErrorOnCurrentGlobalContext();
1239     }
1240 }
1241 
GL_GetShaderivRobustANGLE(GLuint shader,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)1242 void GL_APIENTRY GL_GetShaderivRobustANGLE(GLuint shader,
1243                                            GLenum pname,
1244                                            GLsizei bufSize,
1245                                            GLsizei *length,
1246                                            GLint *params)
1247 {
1248     Context *context = GetGlobalContext();
1249     EVENT(context, GLGetShaderivRobustANGLE,
1250           "context = %d, shader = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1251           ", params = 0x%016" PRIxPTR "",
1252           CID(context), shader, GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
1253           (uintptr_t)length, (uintptr_t)params);
1254 
1255     if (context)
1256     {
1257         ShaderProgramID shaderPacked                          = PackParam<ShaderProgramID>(shader);
1258         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1259         bool isCallValid =
1260             (context->skipValidation() ||
1261              ValidateGetShaderivRobustANGLE(context, shaderPacked, pname, bufSize, length, params));
1262         if (isCallValid)
1263         {
1264             context->getShaderivRobust(shaderPacked, pname, bufSize, length, params);
1265         }
1266         ANGLE_CAPTURE(GetShaderivRobustANGLE, isCallValid, context, shaderPacked, pname, bufSize,
1267                       length, params);
1268     }
1269     else
1270     {}
1271 }
1272 
GL_GetTexParameterfvRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,GLsizei * length,GLfloat * params)1273 void GL_APIENTRY GL_GetTexParameterfvRobustANGLE(GLenum target,
1274                                                  GLenum pname,
1275                                                  GLsizei bufSize,
1276                                                  GLsizei *length,
1277                                                  GLfloat *params)
1278 {
1279     Context *context = GetValidGlobalContext();
1280     EVENT(context, GLGetTexParameterfvRobustANGLE,
1281           "context = %d, target = %s, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1282           ", params = 0x%016" PRIxPTR "",
1283           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target),
1284           GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize, (uintptr_t)length,
1285           (uintptr_t)params);
1286 
1287     if (context)
1288     {
1289         TextureType targetPacked                              = PackParam<TextureType>(target);
1290         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1291         bool isCallValid                                      = (context->skipValidation() ||
1292                             ValidateGetTexParameterfvRobustANGLE(context, targetPacked, pname,
1293                                                                  bufSize, length, params));
1294         if (isCallValid)
1295         {
1296             context->getTexParameterfvRobust(targetPacked, pname, bufSize, length, params);
1297         }
1298         ANGLE_CAPTURE(GetTexParameterfvRobustANGLE, isCallValid, context, targetPacked, pname,
1299                       bufSize, length, params);
1300     }
1301     else
1302     {
1303         GenerateContextLostErrorOnCurrentGlobalContext();
1304     }
1305 }
1306 
GL_GetTexParameterivRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)1307 void GL_APIENTRY GL_GetTexParameterivRobustANGLE(GLenum target,
1308                                                  GLenum pname,
1309                                                  GLsizei bufSize,
1310                                                  GLsizei *length,
1311                                                  GLint *params)
1312 {
1313     Context *context = GetValidGlobalContext();
1314     EVENT(context, GLGetTexParameterivRobustANGLE,
1315           "context = %d, target = %s, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1316           ", params = 0x%016" PRIxPTR "",
1317           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target),
1318           GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize, (uintptr_t)length,
1319           (uintptr_t)params);
1320 
1321     if (context)
1322     {
1323         TextureType targetPacked                              = PackParam<TextureType>(target);
1324         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1325         bool isCallValid                                      = (context->skipValidation() ||
1326                             ValidateGetTexParameterivRobustANGLE(context, targetPacked, pname,
1327                                                                  bufSize, length, params));
1328         if (isCallValid)
1329         {
1330             context->getTexParameterivRobust(targetPacked, pname, bufSize, length, params);
1331         }
1332         ANGLE_CAPTURE(GetTexParameterivRobustANGLE, isCallValid, context, targetPacked, pname,
1333                       bufSize, length, params);
1334     }
1335     else
1336     {
1337         GenerateContextLostErrorOnCurrentGlobalContext();
1338     }
1339 }
1340 
GL_GetUniformfvRobustANGLE(GLuint program,GLint location,GLsizei bufSize,GLsizei * length,GLfloat * params)1341 void GL_APIENTRY GL_GetUniformfvRobustANGLE(GLuint program,
1342                                             GLint location,
1343                                             GLsizei bufSize,
1344                                             GLsizei *length,
1345                                             GLfloat *params)
1346 {
1347     Context *context = GetValidGlobalContext();
1348     EVENT(context, GLGetUniformfvRobustANGLE,
1349           "context = %d, program = %u, location = %d, bufSize = %d, length = 0x%016" PRIxPTR
1350           ", params = 0x%016" PRIxPTR "",
1351           CID(context), program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
1352 
1353     if (context)
1354     {
1355         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1356         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1357         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1358         bool isCallValid                                      = (context->skipValidation() ||
1359                             ValidateGetUniformfvRobustANGLE(context, programPacked, locationPacked,
1360                                                             bufSize, length, params));
1361         if (isCallValid)
1362         {
1363             context->getUniformfvRobust(programPacked, locationPacked, bufSize, length, params);
1364         }
1365         ANGLE_CAPTURE(GetUniformfvRobustANGLE, isCallValid, context, programPacked, locationPacked,
1366                       bufSize, length, params);
1367     }
1368     else
1369     {
1370         GenerateContextLostErrorOnCurrentGlobalContext();
1371     }
1372 }
1373 
GL_GetUniformivRobustANGLE(GLuint program,GLint location,GLsizei bufSize,GLsizei * length,GLint * params)1374 void GL_APIENTRY GL_GetUniformivRobustANGLE(GLuint program,
1375                                             GLint location,
1376                                             GLsizei bufSize,
1377                                             GLsizei *length,
1378                                             GLint *params)
1379 {
1380     Context *context = GetValidGlobalContext();
1381     EVENT(context, GLGetUniformivRobustANGLE,
1382           "context = %d, program = %u, location = %d, bufSize = %d, length = 0x%016" PRIxPTR
1383           ", params = 0x%016" PRIxPTR "",
1384           CID(context), program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
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                                      = (context->skipValidation() ||
1392                             ValidateGetUniformivRobustANGLE(context, programPacked, locationPacked,
1393                                                             bufSize, length, params));
1394         if (isCallValid)
1395         {
1396             context->getUniformivRobust(programPacked, locationPacked, bufSize, length, params);
1397         }
1398         ANGLE_CAPTURE(GetUniformivRobustANGLE, isCallValid, context, programPacked, locationPacked,
1399                       bufSize, length, params);
1400     }
1401     else
1402     {
1403         GenerateContextLostErrorOnCurrentGlobalContext();
1404     }
1405 }
1406 
GL_GetVertexAttribfvRobustANGLE(GLuint index,GLenum pname,GLsizei bufSize,GLsizei * length,GLfloat * params)1407 void GL_APIENTRY GL_GetVertexAttribfvRobustANGLE(GLuint index,
1408                                                  GLenum pname,
1409                                                  GLsizei bufSize,
1410                                                  GLsizei *length,
1411                                                  GLfloat *params)
1412 {
1413     Context *context = GetValidGlobalContext();
1414     EVENT(context, GLGetVertexAttribfvRobustANGLE,
1415           "context = %d, index = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1416           ", params = 0x%016" PRIxPTR "",
1417           CID(context), index, GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
1418           (uintptr_t)length, (uintptr_t)params);
1419 
1420     if (context)
1421     {
1422         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1423         bool isCallValid =
1424             (context->skipValidation() ||
1425              ValidateGetVertexAttribfvRobustANGLE(context, index, pname, bufSize, length, params));
1426         if (isCallValid)
1427         {
1428             context->getVertexAttribfvRobust(index, pname, bufSize, length, params);
1429         }
1430         ANGLE_CAPTURE(GetVertexAttribfvRobustANGLE, isCallValid, context, index, pname, bufSize,
1431                       length, params);
1432     }
1433     else
1434     {
1435         GenerateContextLostErrorOnCurrentGlobalContext();
1436     }
1437 }
1438 
GL_GetVertexAttribivRobustANGLE(GLuint index,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)1439 void GL_APIENTRY GL_GetVertexAttribivRobustANGLE(GLuint index,
1440                                                  GLenum pname,
1441                                                  GLsizei bufSize,
1442                                                  GLsizei *length,
1443                                                  GLint *params)
1444 {
1445     Context *context = GetValidGlobalContext();
1446     EVENT(context, GLGetVertexAttribivRobustANGLE,
1447           "context = %d, index = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1448           ", params = 0x%016" PRIxPTR "",
1449           CID(context), index, GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
1450           (uintptr_t)length, (uintptr_t)params);
1451 
1452     if (context)
1453     {
1454         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1455         bool isCallValid =
1456             (context->skipValidation() ||
1457              ValidateGetVertexAttribivRobustANGLE(context, index, pname, bufSize, length, params));
1458         if (isCallValid)
1459         {
1460             context->getVertexAttribivRobust(index, pname, bufSize, length, params);
1461         }
1462         ANGLE_CAPTURE(GetVertexAttribivRobustANGLE, isCallValid, context, index, pname, bufSize,
1463                       length, params);
1464     }
1465     else
1466     {
1467         GenerateContextLostErrorOnCurrentGlobalContext();
1468     }
1469 }
1470 
GL_GetVertexAttribPointervRobustANGLE(GLuint index,GLenum pname,GLsizei bufSize,GLsizei * length,void ** pointer)1471 void GL_APIENTRY GL_GetVertexAttribPointervRobustANGLE(GLuint index,
1472                                                        GLenum pname,
1473                                                        GLsizei bufSize,
1474                                                        GLsizei *length,
1475                                                        void **pointer)
1476 {
1477     Context *context = GetValidGlobalContext();
1478     EVENT(context, GLGetVertexAttribPointervRobustANGLE,
1479           "context = %d, index = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1480           ", pointer = 0x%016" PRIxPTR "",
1481           CID(context), index, GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
1482           (uintptr_t)length, (uintptr_t)pointer);
1483 
1484     if (context)
1485     {
1486         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1487         bool isCallValid =
1488             (context->skipValidation() || ValidateGetVertexAttribPointervRobustANGLE(
1489                                               context, index, pname, bufSize, length, pointer));
1490         if (isCallValid)
1491         {
1492             context->getVertexAttribPointervRobust(index, pname, bufSize, length, pointer);
1493         }
1494         ANGLE_CAPTURE(GetVertexAttribPointervRobustANGLE, isCallValid, context, index, pname,
1495                       bufSize, length, pointer);
1496     }
1497     else
1498     {
1499         GenerateContextLostErrorOnCurrentGlobalContext();
1500     }
1501 }
1502 
GL_ReadPixelsRobustANGLE(GLint x,GLint y,GLsizei width,GLsizei height,GLenum format,GLenum type,GLsizei bufSize,GLsizei * length,GLsizei * columns,GLsizei * rows,void * pixels)1503 void GL_APIENTRY GL_ReadPixelsRobustANGLE(GLint x,
1504                                           GLint y,
1505                                           GLsizei width,
1506                                           GLsizei height,
1507                                           GLenum format,
1508                                           GLenum type,
1509                                           GLsizei bufSize,
1510                                           GLsizei *length,
1511                                           GLsizei *columns,
1512                                           GLsizei *rows,
1513                                           void *pixels)
1514 {
1515     Context *context = GetValidGlobalContext();
1516     EVENT(context, GLReadPixelsRobustANGLE,
1517           "context = %d, x = %d, y = %d, width = %d, height = %d, format = %s, type = %s, bufSize "
1518           "= %d, length = 0x%016" PRIxPTR ", columns = 0x%016" PRIxPTR ", rows = 0x%016" PRIxPTR
1519           ", pixels = 0x%016" PRIxPTR "",
1520           CID(context), x, y, width, height, GLenumToString(GLenumGroup::DefaultGroup, format),
1521           GLenumToString(GLenumGroup::DefaultGroup, type), bufSize, (uintptr_t)length,
1522           (uintptr_t)columns, (uintptr_t)rows, (uintptr_t)pixels);
1523 
1524     if (context)
1525     {
1526         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1527         bool isCallValid =
1528             (context->skipValidation() ||
1529              ValidateReadPixelsRobustANGLE(context, x, y, width, height, format, type, bufSize,
1530                                            length, columns, rows, pixels));
1531         if (isCallValid)
1532         {
1533             context->readPixelsRobust(x, y, width, height, format, type, bufSize, length, columns,
1534                                       rows, pixels);
1535         }
1536         ANGLE_CAPTURE(ReadPixelsRobustANGLE, isCallValid, context, x, y, width, height, format,
1537                       type, bufSize, length, columns, rows, pixels);
1538     }
1539     else
1540     {
1541         GenerateContextLostErrorOnCurrentGlobalContext();
1542     }
1543 }
1544 
GL_TexImage2DRobustANGLE(GLenum target,GLint level,GLint internalformat,GLsizei width,GLsizei height,GLint border,GLenum format,GLenum type,GLsizei bufSize,const void * pixels)1545 void GL_APIENTRY GL_TexImage2DRobustANGLE(GLenum target,
1546                                           GLint level,
1547                                           GLint internalformat,
1548                                           GLsizei width,
1549                                           GLsizei height,
1550                                           GLint border,
1551                                           GLenum format,
1552                                           GLenum type,
1553                                           GLsizei bufSize,
1554                                           const void *pixels)
1555 {
1556     Context *context = GetValidGlobalContext();
1557     EVENT(context, GLTexImage2DRobustANGLE,
1558           "context = %d, target = %s, level = %d, internalformat = %d, width = %d, height = %d, "
1559           "border = %d, format = %s, type = %s, bufSize = %d, pixels = 0x%016" PRIxPTR "",
1560           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target), level, internalformat,
1561           width, height, border, GLenumToString(GLenumGroup::DefaultGroup, format),
1562           GLenumToString(GLenumGroup::DefaultGroup, type), bufSize, (uintptr_t)pixels);
1563 
1564     if (context)
1565     {
1566         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
1567         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1568         bool isCallValid =
1569             (context->skipValidation() ||
1570              ValidateTexImage2DRobustANGLE(context, targetPacked, level, internalformat, width,
1571                                            height, border, format, type, bufSize, pixels));
1572         if (isCallValid)
1573         {
1574             context->texImage2DRobust(targetPacked, level, internalformat, width, height, border,
1575                                       format, type, bufSize, pixels);
1576         }
1577         ANGLE_CAPTURE(TexImage2DRobustANGLE, isCallValid, context, targetPacked, level,
1578                       internalformat, width, height, border, format, type, bufSize, pixels);
1579     }
1580     else
1581     {
1582         GenerateContextLostErrorOnCurrentGlobalContext();
1583     }
1584 }
1585 
GL_TexParameterfvRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,const GLfloat * params)1586 void GL_APIENTRY GL_TexParameterfvRobustANGLE(GLenum target,
1587                                               GLenum pname,
1588                                               GLsizei bufSize,
1589                                               const GLfloat *params)
1590 {
1591     Context *context = GetValidGlobalContext();
1592     EVENT(context, GLTexParameterfvRobustANGLE,
1593           "context = %d, target = %s, pname = %s, bufSize = %d, params = 0x%016" PRIxPTR "",
1594           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target),
1595           GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize, (uintptr_t)params);
1596 
1597     if (context)
1598     {
1599         TextureType targetPacked                              = PackParam<TextureType>(target);
1600         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1601         bool isCallValid =
1602             (context->skipValidation() ||
1603              ValidateTexParameterfvRobustANGLE(context, targetPacked, pname, bufSize, params));
1604         if (isCallValid)
1605         {
1606             context->texParameterfvRobust(targetPacked, pname, bufSize, params);
1607         }
1608         ANGLE_CAPTURE(TexParameterfvRobustANGLE, isCallValid, context, targetPacked, pname, bufSize,
1609                       params);
1610     }
1611     else
1612     {
1613         GenerateContextLostErrorOnCurrentGlobalContext();
1614     }
1615 }
1616 
GL_TexParameterivRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,const GLint * params)1617 void GL_APIENTRY GL_TexParameterivRobustANGLE(GLenum target,
1618                                               GLenum pname,
1619                                               GLsizei bufSize,
1620                                               const GLint *params)
1621 {
1622     Context *context = GetValidGlobalContext();
1623     EVENT(context, GLTexParameterivRobustANGLE,
1624           "context = %d, target = %s, pname = %s, bufSize = %d, params = 0x%016" PRIxPTR "",
1625           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target),
1626           GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize, (uintptr_t)params);
1627 
1628     if (context)
1629     {
1630         TextureType targetPacked                              = PackParam<TextureType>(target);
1631         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1632         bool isCallValid =
1633             (context->skipValidation() ||
1634              ValidateTexParameterivRobustANGLE(context, targetPacked, pname, bufSize, params));
1635         if (isCallValid)
1636         {
1637             context->texParameterivRobust(targetPacked, pname, bufSize, params);
1638         }
1639         ANGLE_CAPTURE(TexParameterivRobustANGLE, isCallValid, context, targetPacked, pname, bufSize,
1640                       params);
1641     }
1642     else
1643     {
1644         GenerateContextLostErrorOnCurrentGlobalContext();
1645     }
1646 }
1647 
GL_TexSubImage2DRobustANGLE(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLenum type,GLsizei bufSize,const void * pixels)1648 void GL_APIENTRY GL_TexSubImage2DRobustANGLE(GLenum target,
1649                                              GLint level,
1650                                              GLint xoffset,
1651                                              GLint yoffset,
1652                                              GLsizei width,
1653                                              GLsizei height,
1654                                              GLenum format,
1655                                              GLenum type,
1656                                              GLsizei bufSize,
1657                                              const void *pixels)
1658 {
1659     Context *context = GetValidGlobalContext();
1660     EVENT(context, GLTexSubImage2DRobustANGLE,
1661           "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, width = %d, height = "
1662           "%d, format = %s, type = %s, bufSize = %d, pixels = 0x%016" PRIxPTR "",
1663           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target), level, xoffset, yoffset,
1664           width, height, GLenumToString(GLenumGroup::DefaultGroup, format),
1665           GLenumToString(GLenumGroup::DefaultGroup, type), bufSize, (uintptr_t)pixels);
1666 
1667     if (context)
1668     {
1669         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
1670         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1671         bool isCallValid =
1672             (context->skipValidation() ||
1673              ValidateTexSubImage2DRobustANGLE(context, targetPacked, level, xoffset, yoffset, width,
1674                                               height, format, type, bufSize, pixels));
1675         if (isCallValid)
1676         {
1677             context->texSubImage2DRobust(targetPacked, level, xoffset, yoffset, width, height,
1678                                          format, type, bufSize, pixels);
1679         }
1680         ANGLE_CAPTURE(TexSubImage2DRobustANGLE, isCallValid, context, targetPacked, level, xoffset,
1681                       yoffset, width, height, format, type, bufSize, pixels);
1682     }
1683     else
1684     {
1685         GenerateContextLostErrorOnCurrentGlobalContext();
1686     }
1687 }
1688 
GL_TexImage3DRobustANGLE(GLenum target,GLint level,GLint internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLenum format,GLenum type,GLsizei bufSize,const void * pixels)1689 void GL_APIENTRY GL_TexImage3DRobustANGLE(GLenum target,
1690                                           GLint level,
1691                                           GLint internalformat,
1692                                           GLsizei width,
1693                                           GLsizei height,
1694                                           GLsizei depth,
1695                                           GLint border,
1696                                           GLenum format,
1697                                           GLenum type,
1698                                           GLsizei bufSize,
1699                                           const void *pixels)
1700 {
1701     Context *context = GetValidGlobalContext();
1702     EVENT(context, GLTexImage3DRobustANGLE,
1703           "context = %d, target = %s, level = %d, internalformat = %d, width = %d, height = %d, "
1704           "depth = %d, border = %d, format = %s, type = %s, bufSize = %d, pixels = 0x%016" PRIxPTR
1705           "",
1706           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target), level, internalformat,
1707           width, height, depth, border, GLenumToString(GLenumGroup::DefaultGroup, format),
1708           GLenumToString(GLenumGroup::DefaultGroup, type), bufSize, (uintptr_t)pixels);
1709 
1710     if (context)
1711     {
1712         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
1713         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1714         bool isCallValid =
1715             (context->skipValidation() ||
1716              ValidateTexImage3DRobustANGLE(context, targetPacked, level, internalformat, width,
1717                                            height, depth, border, format, type, bufSize, pixels));
1718         if (isCallValid)
1719         {
1720             context->texImage3DRobust(targetPacked, level, internalformat, width, height, depth,
1721                                       border, format, type, bufSize, pixels);
1722         }
1723         ANGLE_CAPTURE(TexImage3DRobustANGLE, isCallValid, context, targetPacked, level,
1724                       internalformat, width, height, depth, border, format, type, bufSize, pixels);
1725     }
1726     else
1727     {
1728         GenerateContextLostErrorOnCurrentGlobalContext();
1729     }
1730 }
1731 
GL_TexSubImage3DRobustANGLE(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLenum type,GLsizei bufSize,const void * pixels)1732 void GL_APIENTRY GL_TexSubImage3DRobustANGLE(GLenum target,
1733                                              GLint level,
1734                                              GLint xoffset,
1735                                              GLint yoffset,
1736                                              GLint zoffset,
1737                                              GLsizei width,
1738                                              GLsizei height,
1739                                              GLsizei depth,
1740                                              GLenum format,
1741                                              GLenum type,
1742                                              GLsizei bufSize,
1743                                              const void *pixels)
1744 {
1745     Context *context = GetValidGlobalContext();
1746     EVENT(
1747         context, GLTexSubImage3DRobustANGLE,
1748         "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width = "
1749         "%d, height = %d, depth = %d, format = %s, type = %s, bufSize = %d, pixels = 0x%016" PRIxPTR
1750         "",
1751         CID(context), GLenumToString(GLenumGroup::DefaultGroup, target), level, xoffset, yoffset,
1752         zoffset, width, height, depth, GLenumToString(GLenumGroup::DefaultGroup, format),
1753         GLenumToString(GLenumGroup::DefaultGroup, type), bufSize, (uintptr_t)pixels);
1754 
1755     if (context)
1756     {
1757         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
1758         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1759         bool isCallValid                                      = (context->skipValidation() ||
1760                             ValidateTexSubImage3DRobustANGLE(context, targetPacked, level, xoffset,
1761                                                              yoffset, zoffset, width, height, depth,
1762                                                              format, type, bufSize, pixels));
1763         if (isCallValid)
1764         {
1765             context->texSubImage3DRobust(targetPacked, level, xoffset, yoffset, zoffset, width,
1766                                          height, depth, format, type, bufSize, pixels);
1767         }
1768         ANGLE_CAPTURE(TexSubImage3DRobustANGLE, isCallValid, context, targetPacked, level, xoffset,
1769                       yoffset, zoffset, width, height, depth, format, type, bufSize, pixels);
1770     }
1771     else
1772     {
1773         GenerateContextLostErrorOnCurrentGlobalContext();
1774     }
1775 }
1776 
GL_CompressedTexImage2DRobustANGLE(GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLint border,GLsizei imageSize,GLsizei dataSize,const GLvoid * data)1777 void GL_APIENTRY GL_CompressedTexImage2DRobustANGLE(GLenum target,
1778                                                     GLint level,
1779                                                     GLenum internalformat,
1780                                                     GLsizei width,
1781                                                     GLsizei height,
1782                                                     GLint border,
1783                                                     GLsizei imageSize,
1784                                                     GLsizei dataSize,
1785                                                     const GLvoid *data)
1786 {
1787     Context *context = GetValidGlobalContext();
1788     EVENT(context, GLCompressedTexImage2DRobustANGLE,
1789           "context = %d, target = %s, level = %d, internalformat = %s, width = %d, height = %d, "
1790           "border = %d, imageSize = %d, dataSize = %d, data = 0x%016" PRIxPTR "",
1791           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target), level,
1792           GLenumToString(GLenumGroup::DefaultGroup, internalformat), width, height, border,
1793           imageSize, dataSize, (uintptr_t)data);
1794 
1795     if (context)
1796     {
1797         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
1798         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1799         bool isCallValid =
1800             (context->skipValidation() || ValidateCompressedTexImage2DRobustANGLE(
1801                                               context, targetPacked, level, internalformat, width,
1802                                               height, border, imageSize, dataSize, data));
1803         if (isCallValid)
1804         {
1805             context->compressedTexImage2DRobust(targetPacked, level, internalformat, width, height,
1806                                                 border, imageSize, dataSize, data);
1807         }
1808         ANGLE_CAPTURE(CompressedTexImage2DRobustANGLE, isCallValid, context, targetPacked, level,
1809                       internalformat, width, height, border, imageSize, dataSize, data);
1810     }
1811     else
1812     {
1813         GenerateContextLostErrorOnCurrentGlobalContext();
1814     }
1815 }
1816 
GL_CompressedTexSubImage2DRobustANGLE(GLenum target,GLint level,GLsizei xoffset,GLsizei yoffset,GLsizei width,GLsizei height,GLenum format,GLsizei imageSize,GLsizei dataSize,const GLvoid * data)1817 void GL_APIENTRY GL_CompressedTexSubImage2DRobustANGLE(GLenum target,
1818                                                        GLint level,
1819                                                        GLsizei xoffset,
1820                                                        GLsizei yoffset,
1821                                                        GLsizei width,
1822                                                        GLsizei height,
1823                                                        GLenum format,
1824                                                        GLsizei imageSize,
1825                                                        GLsizei dataSize,
1826                                                        const GLvoid *data)
1827 {
1828     Context *context = GetValidGlobalContext();
1829     EVENT(context, GLCompressedTexSubImage2DRobustANGLE,
1830           "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, width = %d, height = "
1831           "%d, format = %s, imageSize = %d, dataSize = %d, data = 0x%016" PRIxPTR "",
1832           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target), level, xoffset, yoffset,
1833           width, height, GLenumToString(GLenumGroup::DefaultGroup, format), imageSize, dataSize,
1834           (uintptr_t)data);
1835 
1836     if (context)
1837     {
1838         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
1839         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1840         bool isCallValid =
1841             (context->skipValidation() || ValidateCompressedTexSubImage2DRobustANGLE(
1842                                               context, targetPacked, level, xoffset, yoffset, width,
1843                                               height, format, imageSize, dataSize, data));
1844         if (isCallValid)
1845         {
1846             context->compressedTexSubImage2DRobust(targetPacked, level, xoffset, yoffset, width,
1847                                                    height, format, imageSize, dataSize, data);
1848         }
1849         ANGLE_CAPTURE(CompressedTexSubImage2DRobustANGLE, isCallValid, context, targetPacked, level,
1850                       xoffset, yoffset, width, height, format, imageSize, dataSize, data);
1851     }
1852     else
1853     {
1854         GenerateContextLostErrorOnCurrentGlobalContext();
1855     }
1856 }
1857 
GL_CompressedTexImage3DRobustANGLE(GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLsizei imageSize,GLsizei dataSize,const GLvoid * data)1858 void GL_APIENTRY GL_CompressedTexImage3DRobustANGLE(GLenum target,
1859                                                     GLint level,
1860                                                     GLenum internalformat,
1861                                                     GLsizei width,
1862                                                     GLsizei height,
1863                                                     GLsizei depth,
1864                                                     GLint border,
1865                                                     GLsizei imageSize,
1866                                                     GLsizei dataSize,
1867                                                     const GLvoid *data)
1868 {
1869     Context *context = GetValidGlobalContext();
1870     EVENT(context, GLCompressedTexImage3DRobustANGLE,
1871           "context = %d, target = %s, level = %d, internalformat = %s, width = %d, height = %d, "
1872           "depth = %d, border = %d, imageSize = %d, dataSize = %d, data = 0x%016" PRIxPTR "",
1873           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target), level,
1874           GLenumToString(GLenumGroup::DefaultGroup, internalformat), width, height, depth, border,
1875           imageSize, dataSize, (uintptr_t)data);
1876 
1877     if (context)
1878     {
1879         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
1880         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1881         bool isCallValid =
1882             (context->skipValidation() || ValidateCompressedTexImage3DRobustANGLE(
1883                                               context, targetPacked, level, internalformat, width,
1884                                               height, depth, border, imageSize, dataSize, data));
1885         if (isCallValid)
1886         {
1887             context->compressedTexImage3DRobust(targetPacked, level, internalformat, width, height,
1888                                                 depth, border, imageSize, dataSize, data);
1889         }
1890         ANGLE_CAPTURE(CompressedTexImage3DRobustANGLE, isCallValid, context, targetPacked, level,
1891                       internalformat, width, height, depth, border, imageSize, dataSize, data);
1892     }
1893     else
1894     {
1895         GenerateContextLostErrorOnCurrentGlobalContext();
1896     }
1897 }
1898 
GL_CompressedTexSubImage3DRobustANGLE(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLsizei imageSize,GLsizei dataSize,const GLvoid * data)1899 void GL_APIENTRY GL_CompressedTexSubImage3DRobustANGLE(GLenum target,
1900                                                        GLint level,
1901                                                        GLint xoffset,
1902                                                        GLint yoffset,
1903                                                        GLint zoffset,
1904                                                        GLsizei width,
1905                                                        GLsizei height,
1906                                                        GLsizei depth,
1907                                                        GLenum format,
1908                                                        GLsizei imageSize,
1909                                                        GLsizei dataSize,
1910                                                        const GLvoid *data)
1911 {
1912     Context *context = GetValidGlobalContext();
1913     EVENT(context, GLCompressedTexSubImage3DRobustANGLE,
1914           "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width "
1915           "= %d, height = %d, depth = %d, format = %s, imageSize = %d, dataSize = %d, data = "
1916           "0x%016" PRIxPTR "",
1917           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target), level, xoffset, yoffset,
1918           zoffset, width, height, depth, GLenumToString(GLenumGroup::DefaultGroup, format),
1919           imageSize, dataSize, (uintptr_t)data);
1920 
1921     if (context)
1922     {
1923         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
1924         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1925         bool isCallValid                                      = (context->skipValidation() ||
1926                             ValidateCompressedTexSubImage3DRobustANGLE(
1927                                 context, targetPacked, level, xoffset, yoffset, zoffset, width,
1928                                 height, depth, format, imageSize, dataSize, data));
1929         if (isCallValid)
1930         {
1931             context->compressedTexSubImage3DRobust(targetPacked, level, xoffset, yoffset, zoffset,
1932                                                    width, height, depth, format, imageSize,
1933                                                    dataSize, data);
1934         }
1935         ANGLE_CAPTURE(CompressedTexSubImage3DRobustANGLE, isCallValid, context, targetPacked, level,
1936                       xoffset, yoffset, zoffset, width, height, depth, format, imageSize, dataSize,
1937                       data);
1938     }
1939     else
1940     {
1941         GenerateContextLostErrorOnCurrentGlobalContext();
1942     }
1943 }
1944 
GL_GetQueryivRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)1945 void GL_APIENTRY GL_GetQueryivRobustANGLE(GLenum target,
1946                                           GLenum pname,
1947                                           GLsizei bufSize,
1948                                           GLsizei *length,
1949                                           GLint *params)
1950 {
1951     Context *context = GetValidGlobalContext();
1952     EVENT(context, GLGetQueryivRobustANGLE,
1953           "context = %d, target = %s, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1954           ", params = 0x%016" PRIxPTR "",
1955           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target),
1956           GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize, (uintptr_t)length,
1957           (uintptr_t)params);
1958 
1959     if (context)
1960     {
1961         QueryType targetPacked                                = PackParam<QueryType>(target);
1962         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1963         bool isCallValid =
1964             (context->skipValidation() ||
1965              ValidateGetQueryivRobustANGLE(context, targetPacked, pname, bufSize, length, params));
1966         if (isCallValid)
1967         {
1968             context->getQueryivRobust(targetPacked, pname, bufSize, length, params);
1969         }
1970         ANGLE_CAPTURE(GetQueryivRobustANGLE, isCallValid, context, targetPacked, pname, bufSize,
1971                       length, params);
1972     }
1973     else
1974     {
1975         GenerateContextLostErrorOnCurrentGlobalContext();
1976     }
1977 }
1978 
GL_GetQueryObjectuivRobustANGLE(GLuint id,GLenum pname,GLsizei bufSize,GLsizei * length,GLuint * params)1979 void GL_APIENTRY GL_GetQueryObjectuivRobustANGLE(GLuint id,
1980                                                  GLenum pname,
1981                                                  GLsizei bufSize,
1982                                                  GLsizei *length,
1983                                                  GLuint *params)
1984 {
1985     Context *context = GetValidGlobalContext();
1986     EVENT(context, GLGetQueryObjectuivRobustANGLE,
1987           "context = %d, id = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1988           ", params = 0x%016" PRIxPTR "",
1989           CID(context), id, GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
1990           (uintptr_t)length, (uintptr_t)params);
1991 
1992     if (context)
1993     {
1994         QueryID idPacked                                      = PackParam<QueryID>(id);
1995         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
1996         bool isCallValid =
1997             (context->skipValidation() || ValidateGetQueryObjectuivRobustANGLE(
1998                                               context, idPacked, pname, bufSize, length, params));
1999         if (isCallValid)
2000         {
2001             context->getQueryObjectuivRobust(idPacked, pname, bufSize, length, params);
2002         }
2003         ANGLE_CAPTURE(GetQueryObjectuivRobustANGLE, isCallValid, context, idPacked, pname, bufSize,
2004                       length, params);
2005     }
2006     else
2007     {
2008         GenerateContextLostErrorOnCurrentGlobalContext();
2009     }
2010 }
2011 
GL_GetBufferPointervRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,GLsizei * length,void ** params)2012 void GL_APIENTRY GL_GetBufferPointervRobustANGLE(GLenum target,
2013                                                  GLenum pname,
2014                                                  GLsizei bufSize,
2015                                                  GLsizei *length,
2016                                                  void **params)
2017 {
2018     Context *context = GetValidGlobalContext();
2019     EVENT(context, GLGetBufferPointervRobustANGLE,
2020           "context = %d, target = %s, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2021           ", params = 0x%016" PRIxPTR "",
2022           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target),
2023           GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize, (uintptr_t)length,
2024           (uintptr_t)params);
2025 
2026     if (context)
2027     {
2028         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
2029         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2030         bool isCallValid                                      = (context->skipValidation() ||
2031                             ValidateGetBufferPointervRobustANGLE(context, targetPacked, pname,
2032                                                                  bufSize, length, params));
2033         if (isCallValid)
2034         {
2035             context->getBufferPointervRobust(targetPacked, pname, bufSize, length, params);
2036         }
2037         ANGLE_CAPTURE(GetBufferPointervRobustANGLE, isCallValid, context, targetPacked, pname,
2038                       bufSize, length, params);
2039     }
2040     else
2041     {
2042         GenerateContextLostErrorOnCurrentGlobalContext();
2043     }
2044 }
2045 
GL_GetIntegeri_vRobustANGLE(GLenum target,GLuint index,GLsizei bufSize,GLsizei * length,GLint * data)2046 void GL_APIENTRY GL_GetIntegeri_vRobustANGLE(GLenum target,
2047                                              GLuint index,
2048                                              GLsizei bufSize,
2049                                              GLsizei *length,
2050                                              GLint *data)
2051 {
2052     Context *context = GetValidGlobalContext();
2053     EVENT(context, GLGetIntegeri_vRobustANGLE,
2054           "context = %d, target = %s, index = %u, bufSize = %d, length = 0x%016" PRIxPTR
2055           ", data = 0x%016" PRIxPTR "",
2056           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target), index, bufSize,
2057           (uintptr_t)length, (uintptr_t)data);
2058 
2059     if (context)
2060     {
2061         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2062         bool isCallValid =
2063             (context->skipValidation() ||
2064              ValidateGetIntegeri_vRobustANGLE(context, target, index, bufSize, length, data));
2065         if (isCallValid)
2066         {
2067             context->getIntegeri_vRobust(target, index, bufSize, length, data);
2068         }
2069         ANGLE_CAPTURE(GetIntegeri_vRobustANGLE, isCallValid, context, target, index, bufSize,
2070                       length, data);
2071     }
2072     else
2073     {
2074         GenerateContextLostErrorOnCurrentGlobalContext();
2075     }
2076 }
2077 
GL_GetInternalformativRobustANGLE(GLenum target,GLenum internalformat,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)2078 void GL_APIENTRY GL_GetInternalformativRobustANGLE(GLenum target,
2079                                                    GLenum internalformat,
2080                                                    GLenum pname,
2081                                                    GLsizei bufSize,
2082                                                    GLsizei *length,
2083                                                    GLint *params)
2084 {
2085     Context *context = GetValidGlobalContext();
2086     EVENT(context, GLGetInternalformativRobustANGLE,
2087           "context = %d, target = %s, internalformat = %s, pname = %s, bufSize = %d, length = "
2088           "0x%016" PRIxPTR ", params = 0x%016" PRIxPTR "",
2089           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target),
2090           GLenumToString(GLenumGroup::DefaultGroup, internalformat),
2091           GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize, (uintptr_t)length,
2092           (uintptr_t)params);
2093 
2094     if (context)
2095     {
2096         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2097         bool isCallValid                                      = (context->skipValidation() ||
2098                             ValidateGetInternalformativRobustANGLE(context, target, internalformat,
2099                                                                    pname, bufSize, length, params));
2100         if (isCallValid)
2101         {
2102             context->getInternalformativRobust(target, internalformat, pname, bufSize, length,
2103                                                params);
2104         }
2105         ANGLE_CAPTURE(GetInternalformativRobustANGLE, isCallValid, context, target, internalformat,
2106                       pname, bufSize, length, params);
2107     }
2108     else
2109     {
2110         GenerateContextLostErrorOnCurrentGlobalContext();
2111     }
2112 }
2113 
GL_GetVertexAttribIivRobustANGLE(GLuint index,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)2114 void GL_APIENTRY GL_GetVertexAttribIivRobustANGLE(GLuint index,
2115                                                   GLenum pname,
2116                                                   GLsizei bufSize,
2117                                                   GLsizei *length,
2118                                                   GLint *params)
2119 {
2120     Context *context = GetValidGlobalContext();
2121     EVENT(context, GLGetVertexAttribIivRobustANGLE,
2122           "context = %d, index = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2123           ", params = 0x%016" PRIxPTR "",
2124           CID(context), index, GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
2125           (uintptr_t)length, (uintptr_t)params);
2126 
2127     if (context)
2128     {
2129         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2130         bool isCallValid =
2131             (context->skipValidation() ||
2132              ValidateGetVertexAttribIivRobustANGLE(context, index, pname, bufSize, length, params));
2133         if (isCallValid)
2134         {
2135             context->getVertexAttribIivRobust(index, pname, bufSize, length, params);
2136         }
2137         ANGLE_CAPTURE(GetVertexAttribIivRobustANGLE, isCallValid, context, index, pname, bufSize,
2138                       length, params);
2139     }
2140     else
2141     {
2142         GenerateContextLostErrorOnCurrentGlobalContext();
2143     }
2144 }
2145 
GL_GetVertexAttribIuivRobustANGLE(GLuint index,GLenum pname,GLsizei bufSize,GLsizei * length,GLuint * params)2146 void GL_APIENTRY GL_GetVertexAttribIuivRobustANGLE(GLuint index,
2147                                                    GLenum pname,
2148                                                    GLsizei bufSize,
2149                                                    GLsizei *length,
2150                                                    GLuint *params)
2151 {
2152     Context *context = GetValidGlobalContext();
2153     EVENT(context, GLGetVertexAttribIuivRobustANGLE,
2154           "context = %d, index = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2155           ", params = 0x%016" PRIxPTR "",
2156           CID(context), index, GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
2157           (uintptr_t)length, (uintptr_t)params);
2158 
2159     if (context)
2160     {
2161         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2162         bool isCallValid =
2163             (context->skipValidation() || ValidateGetVertexAttribIuivRobustANGLE(
2164                                               context, index, pname, bufSize, length, params));
2165         if (isCallValid)
2166         {
2167             context->getVertexAttribIuivRobust(index, pname, bufSize, length, params);
2168         }
2169         ANGLE_CAPTURE(GetVertexAttribIuivRobustANGLE, isCallValid, context, index, pname, bufSize,
2170                       length, params);
2171     }
2172     else
2173     {
2174         GenerateContextLostErrorOnCurrentGlobalContext();
2175     }
2176 }
2177 
GL_GetUniformuivRobustANGLE(GLuint program,GLint location,GLsizei bufSize,GLsizei * length,GLuint * params)2178 void GL_APIENTRY GL_GetUniformuivRobustANGLE(GLuint program,
2179                                              GLint location,
2180                                              GLsizei bufSize,
2181                                              GLsizei *length,
2182                                              GLuint *params)
2183 {
2184     Context *context = GetValidGlobalContext();
2185     EVENT(context, GLGetUniformuivRobustANGLE,
2186           "context = %d, program = %u, location = %d, bufSize = %d, length = 0x%016" PRIxPTR
2187           ", params = 0x%016" PRIxPTR "",
2188           CID(context), program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
2189 
2190     if (context)
2191     {
2192         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2193         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2194         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2195         bool isCallValid                                      = (context->skipValidation() ||
2196                             ValidateGetUniformuivRobustANGLE(context, programPacked, locationPacked,
2197                                                              bufSize, length, params));
2198         if (isCallValid)
2199         {
2200             context->getUniformuivRobust(programPacked, locationPacked, bufSize, length, params);
2201         }
2202         ANGLE_CAPTURE(GetUniformuivRobustANGLE, isCallValid, context, programPacked, locationPacked,
2203                       bufSize, length, params);
2204     }
2205     else
2206     {
2207         GenerateContextLostErrorOnCurrentGlobalContext();
2208     }
2209 }
2210 
GL_GetActiveUniformBlockivRobustANGLE(GLuint program,GLuint uniformBlockIndex,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)2211 void GL_APIENTRY GL_GetActiveUniformBlockivRobustANGLE(GLuint program,
2212                                                        GLuint uniformBlockIndex,
2213                                                        GLenum pname,
2214                                                        GLsizei bufSize,
2215                                                        GLsizei *length,
2216                                                        GLint *params)
2217 {
2218     Context *context = GetValidGlobalContext();
2219     EVENT(context, GLGetActiveUniformBlockivRobustANGLE,
2220           "context = %d, program = %u, uniformBlockIndex = %u, pname = %s, bufSize = %d, length = "
2221           "0x%016" PRIxPTR ", params = 0x%016" PRIxPTR "",
2222           CID(context), program, uniformBlockIndex,
2223           GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize, (uintptr_t)length,
2224           (uintptr_t)params);
2225 
2226     if (context)
2227     {
2228         ShaderProgramID programPacked             = PackParam<ShaderProgramID>(program);
2229         UniformBlockIndex uniformBlockIndexPacked = PackParam<UniformBlockIndex>(uniformBlockIndex);
2230         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2231         bool isCallValid =
2232             (context->skipValidation() ||
2233              ValidateGetActiveUniformBlockivRobustANGLE(
2234                  context, programPacked, uniformBlockIndexPacked, pname, bufSize, length, params));
2235         if (isCallValid)
2236         {
2237             context->getActiveUniformBlockivRobust(programPacked, uniformBlockIndexPacked, pname,
2238                                                    bufSize, length, params);
2239         }
2240         ANGLE_CAPTURE(GetActiveUniformBlockivRobustANGLE, isCallValid, context, programPacked,
2241                       uniformBlockIndexPacked, pname, bufSize, length, params);
2242     }
2243     else
2244     {
2245         GenerateContextLostErrorOnCurrentGlobalContext();
2246     }
2247 }
2248 
GL_GetInteger64vRobustANGLE(GLenum pname,GLsizei bufSize,GLsizei * length,GLint64 * data)2249 void GL_APIENTRY GL_GetInteger64vRobustANGLE(GLenum pname,
2250                                              GLsizei bufSize,
2251                                              GLsizei *length,
2252                                              GLint64 *data)
2253 {
2254     Context *context = GetValidGlobalContext();
2255     EVENT(context, GLGetInteger64vRobustANGLE,
2256           "context = %d, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2257           ", data = 0x%016" PRIxPTR "",
2258           CID(context), GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
2259           (uintptr_t)length, (uintptr_t)data);
2260 
2261     if (context)
2262     {
2263         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2264         bool isCallValid =
2265             (context->skipValidation() ||
2266              ValidateGetInteger64vRobustANGLE(context, pname, bufSize, length, data));
2267         if (isCallValid)
2268         {
2269             context->getInteger64vRobust(pname, bufSize, length, data);
2270         }
2271         ANGLE_CAPTURE(GetInteger64vRobustANGLE, isCallValid, context, pname, bufSize, length, data);
2272     }
2273     else
2274     {
2275         GenerateContextLostErrorOnCurrentGlobalContext();
2276     }
2277 }
2278 
GL_GetInteger64i_vRobustANGLE(GLenum target,GLuint index,GLsizei bufSize,GLsizei * length,GLint64 * data)2279 void GL_APIENTRY GL_GetInteger64i_vRobustANGLE(GLenum target,
2280                                                GLuint index,
2281                                                GLsizei bufSize,
2282                                                GLsizei *length,
2283                                                GLint64 *data)
2284 {
2285     Context *context = GetValidGlobalContext();
2286     EVENT(context, GLGetInteger64i_vRobustANGLE,
2287           "context = %d, target = %s, index = %u, bufSize = %d, length = 0x%016" PRIxPTR
2288           ", data = 0x%016" PRIxPTR "",
2289           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target), index, bufSize,
2290           (uintptr_t)length, (uintptr_t)data);
2291 
2292     if (context)
2293     {
2294         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2295         bool isCallValid =
2296             (context->skipValidation() ||
2297              ValidateGetInteger64i_vRobustANGLE(context, target, index, bufSize, length, data));
2298         if (isCallValid)
2299         {
2300             context->getInteger64i_vRobust(target, index, bufSize, length, data);
2301         }
2302         ANGLE_CAPTURE(GetInteger64i_vRobustANGLE, isCallValid, context, target, index, bufSize,
2303                       length, data);
2304     }
2305     else
2306     {
2307         GenerateContextLostErrorOnCurrentGlobalContext();
2308     }
2309 }
2310 
GL_GetBufferParameteri64vRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,GLsizei * length,GLint64 * params)2311 void GL_APIENTRY GL_GetBufferParameteri64vRobustANGLE(GLenum target,
2312                                                       GLenum pname,
2313                                                       GLsizei bufSize,
2314                                                       GLsizei *length,
2315                                                       GLint64 *params)
2316 {
2317     Context *context = GetValidGlobalContext();
2318     EVENT(context, GLGetBufferParameteri64vRobustANGLE,
2319           "context = %d, target = %s, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2320           ", params = 0x%016" PRIxPTR "",
2321           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target),
2322           GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize, (uintptr_t)length,
2323           (uintptr_t)params);
2324 
2325     if (context)
2326     {
2327         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
2328         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2329         bool isCallValid                                      = (context->skipValidation() ||
2330                             ValidateGetBufferParameteri64vRobustANGLE(context, targetPacked, pname,
2331                                                                       bufSize, length, params));
2332         if (isCallValid)
2333         {
2334             context->getBufferParameteri64vRobust(targetPacked, pname, bufSize, length, params);
2335         }
2336         ANGLE_CAPTURE(GetBufferParameteri64vRobustANGLE, isCallValid, context, targetPacked, pname,
2337                       bufSize, length, params);
2338     }
2339     else
2340     {
2341         GenerateContextLostErrorOnCurrentGlobalContext();
2342     }
2343 }
2344 
GL_SamplerParameterivRobustANGLE(GLuint sampler,GLuint pname,GLsizei bufSize,const GLint * param)2345 void GL_APIENTRY GL_SamplerParameterivRobustANGLE(GLuint sampler,
2346                                                   GLuint pname,
2347                                                   GLsizei bufSize,
2348                                                   const GLint *param)
2349 {
2350     Context *context = GetValidGlobalContext();
2351     EVENT(context, GLSamplerParameterivRobustANGLE,
2352           "context = %d, sampler = %u, pname = %u, bufSize = %d, param = 0x%016" PRIxPTR "",
2353           CID(context), sampler, pname, bufSize, (uintptr_t)param);
2354 
2355     if (context)
2356     {
2357         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
2358         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2359         bool isCallValid =
2360             (context->skipValidation() ||
2361              ValidateSamplerParameterivRobustANGLE(context, samplerPacked, pname, bufSize, param));
2362         if (isCallValid)
2363         {
2364             context->samplerParameterivRobust(samplerPacked, pname, bufSize, param);
2365         }
2366         ANGLE_CAPTURE(SamplerParameterivRobustANGLE, isCallValid, context, samplerPacked, pname,
2367                       bufSize, param);
2368     }
2369     else
2370     {
2371         GenerateContextLostErrorOnCurrentGlobalContext();
2372     }
2373 }
2374 
GL_SamplerParameterfvRobustANGLE(GLuint sampler,GLenum pname,GLsizei bufSize,const GLfloat * param)2375 void GL_APIENTRY GL_SamplerParameterfvRobustANGLE(GLuint sampler,
2376                                                   GLenum pname,
2377                                                   GLsizei bufSize,
2378                                                   const GLfloat *param)
2379 {
2380     Context *context = GetValidGlobalContext();
2381     EVENT(context, GLSamplerParameterfvRobustANGLE,
2382           "context = %d, sampler = %u, pname = %s, bufSize = %d, param = 0x%016" PRIxPTR "",
2383           CID(context), sampler, GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
2384           (uintptr_t)param);
2385 
2386     if (context)
2387     {
2388         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
2389         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2390         bool isCallValid =
2391             (context->skipValidation() ||
2392              ValidateSamplerParameterfvRobustANGLE(context, samplerPacked, pname, bufSize, param));
2393         if (isCallValid)
2394         {
2395             context->samplerParameterfvRobust(samplerPacked, pname, bufSize, param);
2396         }
2397         ANGLE_CAPTURE(SamplerParameterfvRobustANGLE, isCallValid, context, samplerPacked, pname,
2398                       bufSize, param);
2399     }
2400     else
2401     {
2402         GenerateContextLostErrorOnCurrentGlobalContext();
2403     }
2404 }
2405 
GL_GetSamplerParameterivRobustANGLE(GLuint sampler,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)2406 void GL_APIENTRY GL_GetSamplerParameterivRobustANGLE(GLuint sampler,
2407                                                      GLenum pname,
2408                                                      GLsizei bufSize,
2409                                                      GLsizei *length,
2410                                                      GLint *params)
2411 {
2412     Context *context = GetValidGlobalContext();
2413     EVENT(context, GLGetSamplerParameterivRobustANGLE,
2414           "context = %d, sampler = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2415           ", params = 0x%016" PRIxPTR "",
2416           CID(context), sampler, GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
2417           (uintptr_t)length, (uintptr_t)params);
2418 
2419     if (context)
2420     {
2421         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
2422         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2423         bool isCallValid                                      = (context->skipValidation() ||
2424                             ValidateGetSamplerParameterivRobustANGLE(context, samplerPacked, pname,
2425                                                                      bufSize, length, params));
2426         if (isCallValid)
2427         {
2428             context->getSamplerParameterivRobust(samplerPacked, pname, bufSize, length, params);
2429         }
2430         ANGLE_CAPTURE(GetSamplerParameterivRobustANGLE, isCallValid, context, samplerPacked, pname,
2431                       bufSize, length, params);
2432     }
2433     else
2434     {
2435         GenerateContextLostErrorOnCurrentGlobalContext();
2436     }
2437 }
2438 
GL_GetSamplerParameterfvRobustANGLE(GLuint sampler,GLenum pname,GLsizei bufSize,GLsizei * length,GLfloat * params)2439 void GL_APIENTRY GL_GetSamplerParameterfvRobustANGLE(GLuint sampler,
2440                                                      GLenum pname,
2441                                                      GLsizei bufSize,
2442                                                      GLsizei *length,
2443                                                      GLfloat *params)
2444 {
2445     Context *context = GetValidGlobalContext();
2446     EVENT(context, GLGetSamplerParameterfvRobustANGLE,
2447           "context = %d, sampler = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2448           ", params = 0x%016" PRIxPTR "",
2449           CID(context), sampler, GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
2450           (uintptr_t)length, (uintptr_t)params);
2451 
2452     if (context)
2453     {
2454         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
2455         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2456         bool isCallValid                                      = (context->skipValidation() ||
2457                             ValidateGetSamplerParameterfvRobustANGLE(context, samplerPacked, pname,
2458                                                                      bufSize, length, params));
2459         if (isCallValid)
2460         {
2461             context->getSamplerParameterfvRobust(samplerPacked, pname, bufSize, length, params);
2462         }
2463         ANGLE_CAPTURE(GetSamplerParameterfvRobustANGLE, isCallValid, context, samplerPacked, pname,
2464                       bufSize, length, params);
2465     }
2466     else
2467     {
2468         GenerateContextLostErrorOnCurrentGlobalContext();
2469     }
2470 }
2471 
GL_GetFramebufferParameterivRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)2472 void GL_APIENTRY GL_GetFramebufferParameterivRobustANGLE(GLenum target,
2473                                                          GLenum pname,
2474                                                          GLsizei bufSize,
2475                                                          GLsizei *length,
2476                                                          GLint *params)
2477 {
2478     Context *context = GetValidGlobalContext();
2479     EVENT(context, GLGetFramebufferParameterivRobustANGLE,
2480           "context = %d, target = %s, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2481           ", params = 0x%016" PRIxPTR "",
2482           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target),
2483           GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize, (uintptr_t)length,
2484           (uintptr_t)params);
2485 
2486     if (context)
2487     {
2488         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2489         bool isCallValid =
2490             (context->skipValidation() || ValidateGetFramebufferParameterivRobustANGLE(
2491                                               context, target, pname, bufSize, length, params));
2492         if (isCallValid)
2493         {
2494             context->getFramebufferParameterivRobust(target, pname, bufSize, length, params);
2495         }
2496         ANGLE_CAPTURE(GetFramebufferParameterivRobustANGLE, isCallValid, context, target, pname,
2497                       bufSize, length, params);
2498     }
2499     else
2500     {
2501         GenerateContextLostErrorOnCurrentGlobalContext();
2502     }
2503 }
2504 
GL_GetProgramInterfaceivRobustANGLE(GLuint program,GLenum programInterface,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)2505 void GL_APIENTRY GL_GetProgramInterfaceivRobustANGLE(GLuint program,
2506                                                      GLenum programInterface,
2507                                                      GLenum pname,
2508                                                      GLsizei bufSize,
2509                                                      GLsizei *length,
2510                                                      GLint *params)
2511 {
2512     Context *context = GetValidGlobalContext();
2513     EVENT(context, GLGetProgramInterfaceivRobustANGLE,
2514           "context = %d, program = %u, programInterface = %s, pname = %s, bufSize = %d, length = "
2515           "0x%016" PRIxPTR ", params = 0x%016" PRIxPTR "",
2516           CID(context), program, GLenumToString(GLenumGroup::DefaultGroup, programInterface),
2517           GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize, (uintptr_t)length,
2518           (uintptr_t)params);
2519 
2520     if (context)
2521     {
2522         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
2523         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2524         bool isCallValid =
2525             (context->skipValidation() ||
2526              ValidateGetProgramInterfaceivRobustANGLE(context, programPacked, programInterface,
2527                                                       pname, bufSize, length, params));
2528         if (isCallValid)
2529         {
2530             context->getProgramInterfaceivRobust(programPacked, programInterface, pname, bufSize,
2531                                                  length, params);
2532         }
2533         ANGLE_CAPTURE(GetProgramInterfaceivRobustANGLE, isCallValid, context, programPacked,
2534                       programInterface, pname, bufSize, length, params);
2535     }
2536     else
2537     {
2538         GenerateContextLostErrorOnCurrentGlobalContext();
2539     }
2540 }
2541 
GL_GetBooleani_vRobustANGLE(GLenum target,GLuint index,GLsizei bufSize,GLsizei * length,GLboolean * data)2542 void GL_APIENTRY GL_GetBooleani_vRobustANGLE(GLenum target,
2543                                              GLuint index,
2544                                              GLsizei bufSize,
2545                                              GLsizei *length,
2546                                              GLboolean *data)
2547 {
2548     Context *context = GetValidGlobalContext();
2549     EVENT(context, GLGetBooleani_vRobustANGLE,
2550           "context = %d, target = %s, index = %u, bufSize = %d, length = 0x%016" PRIxPTR
2551           ", data = 0x%016" PRIxPTR "",
2552           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target), index, bufSize,
2553           (uintptr_t)length, (uintptr_t)data);
2554 
2555     if (context)
2556     {
2557         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2558         bool isCallValid =
2559             (context->skipValidation() ||
2560              ValidateGetBooleani_vRobustANGLE(context, target, index, bufSize, length, data));
2561         if (isCallValid)
2562         {
2563             context->getBooleani_vRobust(target, index, bufSize, length, data);
2564         }
2565         ANGLE_CAPTURE(GetBooleani_vRobustANGLE, isCallValid, context, target, index, bufSize,
2566                       length, data);
2567     }
2568     else
2569     {
2570         GenerateContextLostErrorOnCurrentGlobalContext();
2571     }
2572 }
2573 
GL_GetMultisamplefvRobustANGLE(GLenum pname,GLuint index,GLsizei bufSize,GLsizei * length,GLfloat * val)2574 void GL_APIENTRY GL_GetMultisamplefvRobustANGLE(GLenum pname,
2575                                                 GLuint index,
2576                                                 GLsizei bufSize,
2577                                                 GLsizei *length,
2578                                                 GLfloat *val)
2579 {
2580     Context *context = GetValidGlobalContext();
2581     EVENT(context, GLGetMultisamplefvRobustANGLE,
2582           "context = %d, pname = %s, index = %u, bufSize = %d, length = 0x%016" PRIxPTR
2583           ", val = 0x%016" PRIxPTR "",
2584           CID(context), GLenumToString(GLenumGroup::DefaultGroup, pname), index, bufSize,
2585           (uintptr_t)length, (uintptr_t)val);
2586 
2587     if (context)
2588     {
2589         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2590         bool isCallValid =
2591             (context->skipValidation() ||
2592              ValidateGetMultisamplefvRobustANGLE(context, pname, index, bufSize, length, val));
2593         if (isCallValid)
2594         {
2595             context->getMultisamplefvRobust(pname, index, bufSize, length, val);
2596         }
2597         ANGLE_CAPTURE(GetMultisamplefvRobustANGLE, isCallValid, context, pname, index, bufSize,
2598                       length, val);
2599     }
2600     else
2601     {
2602         GenerateContextLostErrorOnCurrentGlobalContext();
2603     }
2604 }
2605 
GL_GetTexLevelParameterivRobustANGLE(GLenum target,GLint level,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)2606 void GL_APIENTRY GL_GetTexLevelParameterivRobustANGLE(GLenum target,
2607                                                       GLint level,
2608                                                       GLenum pname,
2609                                                       GLsizei bufSize,
2610                                                       GLsizei *length,
2611                                                       GLint *params)
2612 {
2613     Context *context = GetValidGlobalContext();
2614     EVENT(context, GLGetTexLevelParameterivRobustANGLE,
2615           "context = %d, target = %s, level = %d, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2616           ", params = 0x%016" PRIxPTR "",
2617           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target), level,
2618           GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize, (uintptr_t)length,
2619           (uintptr_t)params);
2620 
2621     if (context)
2622     {
2623         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
2624         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2625         bool isCallValid                                      = (context->skipValidation() ||
2626                             ValidateGetTexLevelParameterivRobustANGLE(
2627                                 context, targetPacked, level, pname, bufSize, length, params));
2628         if (isCallValid)
2629         {
2630             context->getTexLevelParameterivRobust(targetPacked, level, pname, bufSize, length,
2631                                                   params);
2632         }
2633         ANGLE_CAPTURE(GetTexLevelParameterivRobustANGLE, isCallValid, context, targetPacked, level,
2634                       pname, bufSize, length, params);
2635     }
2636     else
2637     {
2638         GenerateContextLostErrorOnCurrentGlobalContext();
2639     }
2640 }
2641 
GL_GetTexLevelParameterfvRobustANGLE(GLenum target,GLint level,GLenum pname,GLsizei bufSize,GLsizei * length,GLfloat * params)2642 void GL_APIENTRY GL_GetTexLevelParameterfvRobustANGLE(GLenum target,
2643                                                       GLint level,
2644                                                       GLenum pname,
2645                                                       GLsizei bufSize,
2646                                                       GLsizei *length,
2647                                                       GLfloat *params)
2648 {
2649     Context *context = GetValidGlobalContext();
2650     EVENT(context, GLGetTexLevelParameterfvRobustANGLE,
2651           "context = %d, target = %s, level = %d, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2652           ", params = 0x%016" PRIxPTR "",
2653           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target), level,
2654           GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize, (uintptr_t)length,
2655           (uintptr_t)params);
2656 
2657     if (context)
2658     {
2659         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
2660         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2661         bool isCallValid                                      = (context->skipValidation() ||
2662                             ValidateGetTexLevelParameterfvRobustANGLE(
2663                                 context, targetPacked, level, pname, bufSize, length, params));
2664         if (isCallValid)
2665         {
2666             context->getTexLevelParameterfvRobust(targetPacked, level, pname, bufSize, length,
2667                                                   params);
2668         }
2669         ANGLE_CAPTURE(GetTexLevelParameterfvRobustANGLE, isCallValid, context, targetPacked, level,
2670                       pname, bufSize, length, params);
2671     }
2672     else
2673     {
2674         GenerateContextLostErrorOnCurrentGlobalContext();
2675     }
2676 }
2677 
GL_GetPointervRobustANGLERobustANGLE(GLenum pname,GLsizei bufSize,GLsizei * length,void ** params)2678 void GL_APIENTRY GL_GetPointervRobustANGLERobustANGLE(GLenum pname,
2679                                                       GLsizei bufSize,
2680                                                       GLsizei *length,
2681                                                       void **params)
2682 {
2683     Context *context = GetValidGlobalContext();
2684     EVENT(context, GLGetPointervRobustANGLERobustANGLE,
2685           "context = %d, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2686           ", params = 0x%016" PRIxPTR "",
2687           CID(context), GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
2688           (uintptr_t)length, (uintptr_t)params);
2689 
2690     if (context)
2691     {
2692         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2693         bool isCallValid =
2694             (context->skipValidation() ||
2695              ValidateGetPointervRobustANGLERobustANGLE(context, pname, bufSize, length, params));
2696         if (isCallValid)
2697         {
2698             context->getPointervRobustANGLERobust(pname, bufSize, length, params);
2699         }
2700         ANGLE_CAPTURE(GetPointervRobustANGLERobustANGLE, isCallValid, context, pname, bufSize,
2701                       length, params);
2702     }
2703     else
2704     {
2705         GenerateContextLostErrorOnCurrentGlobalContext();
2706     }
2707 }
2708 
GL_ReadnPixelsRobustANGLE(GLint x,GLint y,GLsizei width,GLsizei height,GLenum format,GLenum type,GLsizei bufSize,GLsizei * length,GLsizei * columns,GLsizei * rows,void * data)2709 void GL_APIENTRY GL_ReadnPixelsRobustANGLE(GLint x,
2710                                            GLint y,
2711                                            GLsizei width,
2712                                            GLsizei height,
2713                                            GLenum format,
2714                                            GLenum type,
2715                                            GLsizei bufSize,
2716                                            GLsizei *length,
2717                                            GLsizei *columns,
2718                                            GLsizei *rows,
2719                                            void *data)
2720 {
2721     Context *context = GetValidGlobalContext();
2722     EVENT(context, GLReadnPixelsRobustANGLE,
2723           "context = %d, x = %d, y = %d, width = %d, height = %d, format = %s, type = %s, bufSize "
2724           "= %d, length = 0x%016" PRIxPTR ", columns = 0x%016" PRIxPTR ", rows = 0x%016" PRIxPTR
2725           ", data = 0x%016" PRIxPTR "",
2726           CID(context), x, y, width, height, GLenumToString(GLenumGroup::DefaultGroup, format),
2727           GLenumToString(GLenumGroup::DefaultGroup, type), bufSize, (uintptr_t)length,
2728           (uintptr_t)columns, (uintptr_t)rows, (uintptr_t)data);
2729 
2730     if (context)
2731     {
2732         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2733         bool isCallValid =
2734             (context->skipValidation() ||
2735              ValidateReadnPixelsRobustANGLE(context, x, y, width, height, format, type, bufSize,
2736                                             length, columns, rows, data));
2737         if (isCallValid)
2738         {
2739             context->readnPixelsRobust(x, y, width, height, format, type, bufSize, length, columns,
2740                                        rows, data);
2741         }
2742         ANGLE_CAPTURE(ReadnPixelsRobustANGLE, isCallValid, context, x, y, width, height, format,
2743                       type, bufSize, length, columns, rows, data);
2744     }
2745     else
2746     {
2747         GenerateContextLostErrorOnCurrentGlobalContext();
2748     }
2749 }
2750 
GL_GetnUniformfvRobustANGLE(GLuint program,GLint location,GLsizei bufSize,GLsizei * length,GLfloat * params)2751 void GL_APIENTRY GL_GetnUniformfvRobustANGLE(GLuint program,
2752                                              GLint location,
2753                                              GLsizei bufSize,
2754                                              GLsizei *length,
2755                                              GLfloat *params)
2756 {
2757     Context *context = GetValidGlobalContext();
2758     EVENT(context, GLGetnUniformfvRobustANGLE,
2759           "context = %d, program = %u, location = %d, bufSize = %d, length = 0x%016" PRIxPTR
2760           ", params = 0x%016" PRIxPTR "",
2761           CID(context), program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
2762 
2763     if (context)
2764     {
2765         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2766         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2767         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2768         bool isCallValid                                      = (context->skipValidation() ||
2769                             ValidateGetnUniformfvRobustANGLE(context, programPacked, locationPacked,
2770                                                              bufSize, length, params));
2771         if (isCallValid)
2772         {
2773             context->getnUniformfvRobust(programPacked, locationPacked, bufSize, length, params);
2774         }
2775         ANGLE_CAPTURE(GetnUniformfvRobustANGLE, isCallValid, context, programPacked, locationPacked,
2776                       bufSize, length, params);
2777     }
2778     else
2779     {
2780         GenerateContextLostErrorOnCurrentGlobalContext();
2781     }
2782 }
2783 
GL_GetnUniformivRobustANGLE(GLuint program,GLint location,GLsizei bufSize,GLsizei * length,GLint * params)2784 void GL_APIENTRY GL_GetnUniformivRobustANGLE(GLuint program,
2785                                              GLint location,
2786                                              GLsizei bufSize,
2787                                              GLsizei *length,
2788                                              GLint *params)
2789 {
2790     Context *context = GetValidGlobalContext();
2791     EVENT(context, GLGetnUniformivRobustANGLE,
2792           "context = %d, program = %u, location = %d, bufSize = %d, length = 0x%016" PRIxPTR
2793           ", params = 0x%016" PRIxPTR "",
2794           CID(context), program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
2795 
2796     if (context)
2797     {
2798         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2799         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2800         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2801         bool isCallValid                                      = (context->skipValidation() ||
2802                             ValidateGetnUniformivRobustANGLE(context, programPacked, locationPacked,
2803                                                              bufSize, length, params));
2804         if (isCallValid)
2805         {
2806             context->getnUniformivRobust(programPacked, locationPacked, bufSize, length, params);
2807         }
2808         ANGLE_CAPTURE(GetnUniformivRobustANGLE, isCallValid, context, programPacked, locationPacked,
2809                       bufSize, length, params);
2810     }
2811     else
2812     {
2813         GenerateContextLostErrorOnCurrentGlobalContext();
2814     }
2815 }
2816 
GL_GetnUniformuivRobustANGLE(GLuint program,GLint location,GLsizei bufSize,GLsizei * length,GLuint * params)2817 void GL_APIENTRY GL_GetnUniformuivRobustANGLE(GLuint program,
2818                                               GLint location,
2819                                               GLsizei bufSize,
2820                                               GLsizei *length,
2821                                               GLuint *params)
2822 {
2823     Context *context = GetValidGlobalContext();
2824     EVENT(context, GLGetnUniformuivRobustANGLE,
2825           "context = %d, program = %u, location = %d, bufSize = %d, length = 0x%016" PRIxPTR
2826           ", params = 0x%016" PRIxPTR "",
2827           CID(context), program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
2828 
2829     if (context)
2830     {
2831         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2832         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2833         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2834         bool isCallValid                                      = (context->skipValidation() ||
2835                             ValidateGetnUniformuivRobustANGLE(
2836                                 context, programPacked, locationPacked, bufSize, length, params));
2837         if (isCallValid)
2838         {
2839             context->getnUniformuivRobust(programPacked, locationPacked, bufSize, length, params);
2840         }
2841         ANGLE_CAPTURE(GetnUniformuivRobustANGLE, isCallValid, context, programPacked,
2842                       locationPacked, bufSize, length, params);
2843     }
2844     else
2845     {
2846         GenerateContextLostErrorOnCurrentGlobalContext();
2847     }
2848 }
2849 
GL_TexParameterIivRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,const GLint * params)2850 void GL_APIENTRY GL_TexParameterIivRobustANGLE(GLenum target,
2851                                                GLenum pname,
2852                                                GLsizei bufSize,
2853                                                const GLint *params)
2854 {
2855     Context *context = GetValidGlobalContext();
2856     EVENT(context, GLTexParameterIivRobustANGLE,
2857           "context = %d, target = %s, pname = %s, bufSize = %d, params = 0x%016" PRIxPTR "",
2858           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target),
2859           GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize, (uintptr_t)params);
2860 
2861     if (context)
2862     {
2863         TextureType targetPacked                              = PackParam<TextureType>(target);
2864         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2865         bool isCallValid =
2866             (context->skipValidation() ||
2867              ValidateTexParameterIivRobustANGLE(context, targetPacked, pname, bufSize, params));
2868         if (isCallValid)
2869         {
2870             context->texParameterIivRobust(targetPacked, pname, bufSize, params);
2871         }
2872         ANGLE_CAPTURE(TexParameterIivRobustANGLE, isCallValid, context, targetPacked, pname,
2873                       bufSize, params);
2874     }
2875     else
2876     {
2877         GenerateContextLostErrorOnCurrentGlobalContext();
2878     }
2879 }
2880 
GL_TexParameterIuivRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,const GLuint * params)2881 void GL_APIENTRY GL_TexParameterIuivRobustANGLE(GLenum target,
2882                                                 GLenum pname,
2883                                                 GLsizei bufSize,
2884                                                 const GLuint *params)
2885 {
2886     Context *context = GetValidGlobalContext();
2887     EVENT(context, GLTexParameterIuivRobustANGLE,
2888           "context = %d, target = %s, pname = %s, bufSize = %d, params = 0x%016" PRIxPTR "",
2889           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target),
2890           GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize, (uintptr_t)params);
2891 
2892     if (context)
2893     {
2894         TextureType targetPacked                              = PackParam<TextureType>(target);
2895         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2896         bool isCallValid =
2897             (context->skipValidation() ||
2898              ValidateTexParameterIuivRobustANGLE(context, targetPacked, pname, bufSize, params));
2899         if (isCallValid)
2900         {
2901             context->texParameterIuivRobust(targetPacked, pname, bufSize, params);
2902         }
2903         ANGLE_CAPTURE(TexParameterIuivRobustANGLE, isCallValid, context, targetPacked, pname,
2904                       bufSize, params);
2905     }
2906     else
2907     {
2908         GenerateContextLostErrorOnCurrentGlobalContext();
2909     }
2910 }
2911 
GL_GetTexParameterIivRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)2912 void GL_APIENTRY GL_GetTexParameterIivRobustANGLE(GLenum target,
2913                                                   GLenum pname,
2914                                                   GLsizei bufSize,
2915                                                   GLsizei *length,
2916                                                   GLint *params)
2917 {
2918     Context *context = GetValidGlobalContext();
2919     EVENT(context, GLGetTexParameterIivRobustANGLE,
2920           "context = %d, target = %s, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2921           ", params = 0x%016" PRIxPTR "",
2922           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target),
2923           GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize, (uintptr_t)length,
2924           (uintptr_t)params);
2925 
2926     if (context)
2927     {
2928         TextureType targetPacked                              = PackParam<TextureType>(target);
2929         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2930         bool isCallValid                                      = (context->skipValidation() ||
2931                             ValidateGetTexParameterIivRobustANGLE(context, targetPacked, pname,
2932                                                                   bufSize, length, params));
2933         if (isCallValid)
2934         {
2935             context->getTexParameterIivRobust(targetPacked, pname, bufSize, length, params);
2936         }
2937         ANGLE_CAPTURE(GetTexParameterIivRobustANGLE, isCallValid, context, targetPacked, pname,
2938                       bufSize, length, params);
2939     }
2940     else
2941     {
2942         GenerateContextLostErrorOnCurrentGlobalContext();
2943     }
2944 }
2945 
GL_GetTexParameterIuivRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,GLsizei * length,GLuint * params)2946 void GL_APIENTRY GL_GetTexParameterIuivRobustANGLE(GLenum target,
2947                                                    GLenum pname,
2948                                                    GLsizei bufSize,
2949                                                    GLsizei *length,
2950                                                    GLuint *params)
2951 {
2952     Context *context = GetValidGlobalContext();
2953     EVENT(context, GLGetTexParameterIuivRobustANGLE,
2954           "context = %d, target = %s, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2955           ", params = 0x%016" PRIxPTR "",
2956           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target),
2957           GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize, (uintptr_t)length,
2958           (uintptr_t)params);
2959 
2960     if (context)
2961     {
2962         TextureType targetPacked                              = PackParam<TextureType>(target);
2963         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2964         bool isCallValid                                      = (context->skipValidation() ||
2965                             ValidateGetTexParameterIuivRobustANGLE(context, targetPacked, pname,
2966                                                                    bufSize, length, params));
2967         if (isCallValid)
2968         {
2969             context->getTexParameterIuivRobust(targetPacked, pname, bufSize, length, params);
2970         }
2971         ANGLE_CAPTURE(GetTexParameterIuivRobustANGLE, isCallValid, context, targetPacked, pname,
2972                       bufSize, length, params);
2973     }
2974     else
2975     {
2976         GenerateContextLostErrorOnCurrentGlobalContext();
2977     }
2978 }
2979 
GL_SamplerParameterIivRobustANGLE(GLuint sampler,GLenum pname,GLsizei bufSize,const GLint * param)2980 void GL_APIENTRY GL_SamplerParameterIivRobustANGLE(GLuint sampler,
2981                                                    GLenum pname,
2982                                                    GLsizei bufSize,
2983                                                    const GLint *param)
2984 {
2985     Context *context = GetValidGlobalContext();
2986     EVENT(context, GLSamplerParameterIivRobustANGLE,
2987           "context = %d, sampler = %u, pname = %s, bufSize = %d, param = 0x%016" PRIxPTR "",
2988           CID(context), sampler, GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
2989           (uintptr_t)param);
2990 
2991     if (context)
2992     {
2993         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
2994         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
2995         bool isCallValid =
2996             (context->skipValidation() ||
2997              ValidateSamplerParameterIivRobustANGLE(context, samplerPacked, pname, bufSize, param));
2998         if (isCallValid)
2999         {
3000             context->samplerParameterIivRobust(samplerPacked, pname, bufSize, param);
3001         }
3002         ANGLE_CAPTURE(SamplerParameterIivRobustANGLE, isCallValid, context, samplerPacked, pname,
3003                       bufSize, param);
3004     }
3005     else
3006     {
3007         GenerateContextLostErrorOnCurrentGlobalContext();
3008     }
3009 }
3010 
GL_SamplerParameterIuivRobustANGLE(GLuint sampler,GLenum pname,GLsizei bufSize,const GLuint * param)3011 void GL_APIENTRY GL_SamplerParameterIuivRobustANGLE(GLuint sampler,
3012                                                     GLenum pname,
3013                                                     GLsizei bufSize,
3014                                                     const GLuint *param)
3015 {
3016     Context *context = GetValidGlobalContext();
3017     EVENT(context, GLSamplerParameterIuivRobustANGLE,
3018           "context = %d, sampler = %u, pname = %s, bufSize = %d, param = 0x%016" PRIxPTR "",
3019           CID(context), sampler, GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
3020           (uintptr_t)param);
3021 
3022     if (context)
3023     {
3024         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
3025         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3026         bool isCallValid =
3027             (context->skipValidation() || ValidateSamplerParameterIuivRobustANGLE(
3028                                               context, samplerPacked, pname, bufSize, param));
3029         if (isCallValid)
3030         {
3031             context->samplerParameterIuivRobust(samplerPacked, pname, bufSize, param);
3032         }
3033         ANGLE_CAPTURE(SamplerParameterIuivRobustANGLE, isCallValid, context, samplerPacked, pname,
3034                       bufSize, param);
3035     }
3036     else
3037     {
3038         GenerateContextLostErrorOnCurrentGlobalContext();
3039     }
3040 }
3041 
GL_GetSamplerParameterIivRobustANGLE(GLuint sampler,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)3042 void GL_APIENTRY GL_GetSamplerParameterIivRobustANGLE(GLuint sampler,
3043                                                       GLenum pname,
3044                                                       GLsizei bufSize,
3045                                                       GLsizei *length,
3046                                                       GLint *params)
3047 {
3048     Context *context = GetValidGlobalContext();
3049     EVENT(context, GLGetSamplerParameterIivRobustANGLE,
3050           "context = %d, sampler = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
3051           ", params = 0x%016" PRIxPTR "",
3052           CID(context), sampler, GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
3053           (uintptr_t)length, (uintptr_t)params);
3054 
3055     if (context)
3056     {
3057         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
3058         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3059         bool isCallValid                                      = (context->skipValidation() ||
3060                             ValidateGetSamplerParameterIivRobustANGLE(context, samplerPacked, pname,
3061                                                                       bufSize, length, params));
3062         if (isCallValid)
3063         {
3064             context->getSamplerParameterIivRobust(samplerPacked, pname, bufSize, length, params);
3065         }
3066         ANGLE_CAPTURE(GetSamplerParameterIivRobustANGLE, isCallValid, context, samplerPacked, pname,
3067                       bufSize, length, params);
3068     }
3069     else
3070     {
3071         GenerateContextLostErrorOnCurrentGlobalContext();
3072     }
3073 }
3074 
GL_GetSamplerParameterIuivRobustANGLE(GLuint sampler,GLenum pname,GLsizei bufSize,GLsizei * length,GLuint * params)3075 void GL_APIENTRY GL_GetSamplerParameterIuivRobustANGLE(GLuint sampler,
3076                                                        GLenum pname,
3077                                                        GLsizei bufSize,
3078                                                        GLsizei *length,
3079                                                        GLuint *params)
3080 {
3081     Context *context = GetValidGlobalContext();
3082     EVENT(context, GLGetSamplerParameterIuivRobustANGLE,
3083           "context = %d, sampler = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
3084           ", params = 0x%016" PRIxPTR "",
3085           CID(context), sampler, GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
3086           (uintptr_t)length, (uintptr_t)params);
3087 
3088     if (context)
3089     {
3090         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
3091         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3092         bool isCallValid                                      = (context->skipValidation() ||
3093                             ValidateGetSamplerParameterIuivRobustANGLE(
3094                                 context, samplerPacked, pname, bufSize, length, params));
3095         if (isCallValid)
3096         {
3097             context->getSamplerParameterIuivRobust(samplerPacked, pname, bufSize, length, params);
3098         }
3099         ANGLE_CAPTURE(GetSamplerParameterIuivRobustANGLE, isCallValid, context, samplerPacked,
3100                       pname, bufSize, length, params);
3101     }
3102     else
3103     {
3104         GenerateContextLostErrorOnCurrentGlobalContext();
3105     }
3106 }
3107 
GL_GetQueryObjectivRobustANGLE(GLuint id,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)3108 void GL_APIENTRY GL_GetQueryObjectivRobustANGLE(GLuint id,
3109                                                 GLenum pname,
3110                                                 GLsizei bufSize,
3111                                                 GLsizei *length,
3112                                                 GLint *params)
3113 {
3114     Context *context = GetGlobalContext();
3115     EVENT(context, GLGetQueryObjectivRobustANGLE,
3116           "context = %d, id = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
3117           ", params = 0x%016" PRIxPTR "",
3118           CID(context), id, GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
3119           (uintptr_t)length, (uintptr_t)params);
3120 
3121     if (context)
3122     {
3123         QueryID idPacked                                      = PackParam<QueryID>(id);
3124         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3125         bool isCallValid =
3126             (context->skipValidation() || ValidateGetQueryObjectivRobustANGLE(
3127                                               context, idPacked, pname, bufSize, length, params));
3128         if (isCallValid)
3129         {
3130             context->getQueryObjectivRobust(idPacked, pname, bufSize, length, params);
3131         }
3132         ANGLE_CAPTURE(GetQueryObjectivRobustANGLE, isCallValid, context, idPacked, pname, bufSize,
3133                       length, params);
3134     }
3135     else
3136     {}
3137 }
3138 
GL_GetQueryObjecti64vRobustANGLE(GLuint id,GLenum pname,GLsizei bufSize,GLsizei * length,GLint64 * params)3139 void GL_APIENTRY GL_GetQueryObjecti64vRobustANGLE(GLuint id,
3140                                                   GLenum pname,
3141                                                   GLsizei bufSize,
3142                                                   GLsizei *length,
3143                                                   GLint64 *params)
3144 {
3145     Context *context = GetGlobalContext();
3146     EVENT(context, GLGetQueryObjecti64vRobustANGLE,
3147           "context = %d, id = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
3148           ", params = 0x%016" PRIxPTR "",
3149           CID(context), id, GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
3150           (uintptr_t)length, (uintptr_t)params);
3151 
3152     if (context)
3153     {
3154         QueryID idPacked                                      = PackParam<QueryID>(id);
3155         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3156         bool isCallValid =
3157             (context->skipValidation() || ValidateGetQueryObjecti64vRobustANGLE(
3158                                               context, idPacked, pname, bufSize, length, params));
3159         if (isCallValid)
3160         {
3161             context->getQueryObjecti64vRobust(idPacked, pname, bufSize, length, params);
3162         }
3163         ANGLE_CAPTURE(GetQueryObjecti64vRobustANGLE, isCallValid, context, idPacked, pname, bufSize,
3164                       length, params);
3165     }
3166     else
3167     {}
3168 }
3169 
GL_GetQueryObjectui64vRobustANGLE(GLuint id,GLenum pname,GLsizei bufSize,GLsizei * length,GLuint64 * params)3170 void GL_APIENTRY GL_GetQueryObjectui64vRobustANGLE(GLuint id,
3171                                                    GLenum pname,
3172                                                    GLsizei bufSize,
3173                                                    GLsizei *length,
3174                                                    GLuint64 *params)
3175 {
3176     Context *context = GetValidGlobalContext();
3177     EVENT(context, GLGetQueryObjectui64vRobustANGLE,
3178           "context = %d, id = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
3179           ", params = 0x%016" PRIxPTR "",
3180           CID(context), id, GLenumToString(GLenumGroup::DefaultGroup, pname), bufSize,
3181           (uintptr_t)length, (uintptr_t)params);
3182 
3183     if (context)
3184     {
3185         QueryID idPacked                                      = PackParam<QueryID>(id);
3186         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3187         bool isCallValid =
3188             (context->skipValidation() || ValidateGetQueryObjectui64vRobustANGLE(
3189                                               context, idPacked, pname, bufSize, length, params));
3190         if (isCallValid)
3191         {
3192             context->getQueryObjectui64vRobust(idPacked, pname, bufSize, length, params);
3193         }
3194         ANGLE_CAPTURE(GetQueryObjectui64vRobustANGLE, isCallValid, context, idPacked, pname,
3195                       bufSize, length, params);
3196     }
3197     else
3198     {
3199         GenerateContextLostErrorOnCurrentGlobalContext();
3200     }
3201 }
3202 
3203 // GL_ANGLE_semaphore_fuchsia
GL_ImportSemaphoreZirconHandleANGLE(GLuint semaphore,GLenum handleType,GLuint handle)3204 void GL_APIENTRY GL_ImportSemaphoreZirconHandleANGLE(GLuint semaphore,
3205                                                      GLenum handleType,
3206                                                      GLuint handle)
3207 {
3208     Context *context = GetValidGlobalContext();
3209     EVENT(context, GLImportSemaphoreZirconHandleANGLE,
3210           "context = %d, semaphore = %u, handleType = %s, handle = %u", CID(context), semaphore,
3211           GLenumToString(GLenumGroup::ExternalHandleType, handleType), handle);
3212 
3213     if (context)
3214     {
3215         SemaphoreID semaphorePacked                           = PackParam<SemaphoreID>(semaphore);
3216         HandleType handleTypePacked                           = PackParam<HandleType>(handleType);
3217         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3218         bool isCallValid =
3219             (context->skipValidation() || ValidateImportSemaphoreZirconHandleANGLE(
3220                                               context, semaphorePacked, handleTypePacked, handle));
3221         if (isCallValid)
3222         {
3223             context->importSemaphoreZirconHandle(semaphorePacked, handleTypePacked, handle);
3224         }
3225         ANGLE_CAPTURE(ImportSemaphoreZirconHandleANGLE, isCallValid, context, semaphorePacked,
3226                       handleTypePacked, handle);
3227     }
3228     else
3229     {
3230         GenerateContextLostErrorOnCurrentGlobalContext();
3231     }
3232 }
3233 
3234 // GL_ANGLE_texture_external_update
GL_TexImage2DExternalANGLE(GLenum target,GLint level,GLint internalformat,GLsizei width,GLsizei height,GLint border,GLenum format,GLenum type)3235 void GL_APIENTRY GL_TexImage2DExternalANGLE(GLenum target,
3236                                             GLint level,
3237                                             GLint internalformat,
3238                                             GLsizei width,
3239                                             GLsizei height,
3240                                             GLint border,
3241                                             GLenum format,
3242                                             GLenum type)
3243 {
3244     Context *context = GetValidGlobalContext();
3245     EVENT(context, GLTexImage2DExternalANGLE,
3246           "context = %d, target = %s, level = %d, internalformat = %d, width = %d, height = %d, "
3247           "border = %d, format = %s, type = %s",
3248           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, internalformat,
3249           width, height, border, GLenumToString(GLenumGroup::PixelFormat, format),
3250           GLenumToString(GLenumGroup::PixelType, type));
3251 
3252     if (context)
3253     {
3254         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
3255         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3256         bool isCallValid =
3257             (context->skipValidation() ||
3258              ValidateTexImage2DExternalANGLE(context, targetPacked, level, internalformat, width,
3259                                              height, border, format, type));
3260         if (isCallValid)
3261         {
3262             context->texImage2DExternal(targetPacked, level, internalformat, width, height, border,
3263                                         format, type);
3264         }
3265         ANGLE_CAPTURE(TexImage2DExternalANGLE, isCallValid, context, targetPacked, level,
3266                       internalformat, width, height, border, format, type);
3267     }
3268     else
3269     {
3270         GenerateContextLostErrorOnCurrentGlobalContext();
3271     }
3272 }
3273 
GL_InvalidateTextureANGLE(GLenum target)3274 void GL_APIENTRY GL_InvalidateTextureANGLE(GLenum target)
3275 {
3276     Context *context = GetValidGlobalContext();
3277     EVENT(context, GLInvalidateTextureANGLE, "context = %d, target = %s", CID(context),
3278           GLenumToString(GLenumGroup::TextureTarget, target));
3279 
3280     if (context)
3281     {
3282         TextureType targetPacked                              = PackParam<TextureType>(target);
3283         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3284         bool isCallValid =
3285             (context->skipValidation() || ValidateInvalidateTextureANGLE(context, targetPacked));
3286         if (isCallValid)
3287         {
3288             context->invalidateTexture(targetPacked);
3289         }
3290         ANGLE_CAPTURE(InvalidateTextureANGLE, isCallValid, context, targetPacked);
3291     }
3292     else
3293     {
3294         GenerateContextLostErrorOnCurrentGlobalContext();
3295     }
3296 }
3297 
3298 // GL_ANGLE_texture_multisample
GL_TexStorage2DMultisampleANGLE(GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height,GLboolean fixedsamplelocations)3299 void GL_APIENTRY GL_TexStorage2DMultisampleANGLE(GLenum target,
3300                                                  GLsizei samples,
3301                                                  GLenum internalformat,
3302                                                  GLsizei width,
3303                                                  GLsizei height,
3304                                                  GLboolean fixedsamplelocations)
3305 {
3306     Context *context = GetValidGlobalContext();
3307     EVENT(context, GLTexStorage2DMultisampleANGLE,
3308           "context = %d, target = %s, samples = %d, internalformat = %s, width = %d, height = %d, "
3309           "fixedsamplelocations = %s",
3310           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target), samples,
3311           GLenumToString(GLenumGroup::DefaultGroup, internalformat), width, height,
3312           GLbooleanToString(fixedsamplelocations));
3313 
3314     if (context)
3315     {
3316         TextureType targetPacked                              = PackParam<TextureType>(target);
3317         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3318         bool isCallValid =
3319             (context->skipValidation() ||
3320              ValidateTexStorage2DMultisampleANGLE(context, targetPacked, samples, internalformat,
3321                                                   width, height, fixedsamplelocations));
3322         if (isCallValid)
3323         {
3324             context->texStorage2DMultisample(targetPacked, samples, internalformat, width, height,
3325                                              fixedsamplelocations);
3326         }
3327         ANGLE_CAPTURE(TexStorage2DMultisampleANGLE, isCallValid, context, targetPacked, samples,
3328                       internalformat, width, height, fixedsamplelocations);
3329     }
3330     else
3331     {
3332         GenerateContextLostErrorOnCurrentGlobalContext();
3333     }
3334 }
3335 
GL_GetMultisamplefvANGLE(GLenum pname,GLuint index,GLfloat * val)3336 void GL_APIENTRY GL_GetMultisamplefvANGLE(GLenum pname, GLuint index, GLfloat *val)
3337 {
3338     Context *context = GetValidGlobalContext();
3339     EVENT(context, GLGetMultisamplefvANGLE,
3340           "context = %d, pname = %s, index = %u, val = 0x%016" PRIxPTR "", CID(context),
3341           GLenumToString(GLenumGroup::DefaultGroup, pname), index, (uintptr_t)val);
3342 
3343     if (context)
3344     {
3345         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3346         bool isCallValid                                      = (context->skipValidation() ||
3347                             ValidateGetMultisamplefvANGLE(context, pname, index, val));
3348         if (isCallValid)
3349         {
3350             context->getMultisamplefv(pname, index, val);
3351         }
3352         ANGLE_CAPTURE(GetMultisamplefvANGLE, isCallValid, context, pname, index, val);
3353     }
3354     else
3355     {
3356         GenerateContextLostErrorOnCurrentGlobalContext();
3357     }
3358 }
3359 
GL_SampleMaskiANGLE(GLuint maskNumber,GLbitfield mask)3360 void GL_APIENTRY GL_SampleMaskiANGLE(GLuint maskNumber, GLbitfield mask)
3361 {
3362     Context *context = GetValidGlobalContext();
3363     EVENT(context, GLSampleMaskiANGLE, "context = %d, maskNumber = %u, mask = %s", CID(context),
3364           maskNumber, GLbitfieldToString(GLenumGroup::DefaultGroup, mask).c_str());
3365 
3366     if (context)
3367     {
3368         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3369         bool isCallValid =
3370             (context->skipValidation() || ValidateSampleMaskiANGLE(context, maskNumber, mask));
3371         if (isCallValid)
3372         {
3373             context->sampleMaski(maskNumber, mask);
3374         }
3375         ANGLE_CAPTURE(SampleMaskiANGLE, isCallValid, context, maskNumber, mask);
3376     }
3377     else
3378     {
3379         GenerateContextLostErrorOnCurrentGlobalContext();
3380     }
3381 }
3382 
3383 // GetTexLevelParameterfvANGLE is already defined.
3384 
3385 // GetTexLevelParameterivANGLE is already defined.
3386 
3387 // GL_ANGLE_translated_shader_source
GL_GetTranslatedShaderSourceANGLE(GLuint shader,GLsizei bufsize,GLsizei * length,GLchar * source)3388 void GL_APIENTRY GL_GetTranslatedShaderSourceANGLE(GLuint shader,
3389                                                    GLsizei bufsize,
3390                                                    GLsizei *length,
3391                                                    GLchar *source)
3392 {
3393     Context *context = GetValidGlobalContext();
3394     EVENT(context, GLGetTranslatedShaderSourceANGLE,
3395           "context = %d, shader = %u, bufsize = %d, length = 0x%016" PRIxPTR
3396           ", source = 0x%016" PRIxPTR "",
3397           CID(context), shader, bufsize, (uintptr_t)length, (uintptr_t)source);
3398 
3399     if (context)
3400     {
3401         ShaderProgramID shaderPacked                          = PackParam<ShaderProgramID>(shader);
3402         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3403         bool isCallValid =
3404             (context->skipValidation() || ValidateGetTranslatedShaderSourceANGLE(
3405                                               context, shaderPacked, bufsize, length, source));
3406         if (isCallValid)
3407         {
3408             context->getTranslatedShaderSource(shaderPacked, bufsize, length, source);
3409         }
3410         ANGLE_CAPTURE(GetTranslatedShaderSourceANGLE, isCallValid, context, shaderPacked, bufsize,
3411                       length, source);
3412     }
3413     else
3414     {
3415         GenerateContextLostErrorOnCurrentGlobalContext();
3416     }
3417 }
3418 
3419 // GL_CHROMIUM_bind_uniform_location
GL_BindUniformLocationCHROMIUM(GLuint program,GLint location,const GLchar * name)3420 void GL_APIENTRY GL_BindUniformLocationCHROMIUM(GLuint program, GLint location, const GLchar *name)
3421 {
3422     Context *context = GetValidGlobalContext();
3423     EVENT(context, GLBindUniformLocationCHROMIUM,
3424           "context = %d, program = %u, location = %d, name = 0x%016" PRIxPTR "", CID(context),
3425           program, location, (uintptr_t)name);
3426 
3427     if (context)
3428     {
3429         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
3430         UniformLocation locationPacked = PackParam<UniformLocation>(location);
3431         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3432         bool isCallValid =
3433             (context->skipValidation() ||
3434              ValidateBindUniformLocationCHROMIUM(context, programPacked, locationPacked, name));
3435         if (isCallValid)
3436         {
3437             context->bindUniformLocation(programPacked, locationPacked, name);
3438         }
3439         ANGLE_CAPTURE(BindUniformLocationCHROMIUM, isCallValid, context, programPacked,
3440                       locationPacked, name);
3441     }
3442     else
3443     {
3444         GenerateContextLostErrorOnCurrentGlobalContext();
3445     }
3446 }
3447 
3448 // GL_CHROMIUM_copy_compressed_texture
GL_CompressedCopyTextureCHROMIUM(GLuint sourceId,GLuint destId)3449 void GL_APIENTRY GL_CompressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId)
3450 {
3451     Context *context = GetValidGlobalContext();
3452     EVENT(context, GLCompressedCopyTextureCHROMIUM, "context = %d, sourceId = %u, destId = %u",
3453           CID(context), sourceId, destId);
3454 
3455     if (context)
3456     {
3457         TextureID sourceIdPacked                              = PackParam<TextureID>(sourceId);
3458         TextureID destIdPacked                                = PackParam<TextureID>(destId);
3459         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3460         bool isCallValid =
3461             (context->skipValidation() ||
3462              ValidateCompressedCopyTextureCHROMIUM(context, sourceIdPacked, destIdPacked));
3463         if (isCallValid)
3464         {
3465             context->compressedCopyTexture(sourceIdPacked, destIdPacked);
3466         }
3467         ANGLE_CAPTURE(CompressedCopyTextureCHROMIUM, isCallValid, context, sourceIdPacked,
3468                       destIdPacked);
3469     }
3470     else
3471     {
3472         GenerateContextLostErrorOnCurrentGlobalContext();
3473     }
3474 }
3475 
3476 // GL_CHROMIUM_copy_texture
GL_CopyTextureCHROMIUM(GLuint sourceId,GLint sourceLevel,GLenum destTarget,GLuint destId,GLint destLevel,GLint internalFormat,GLenum destType,GLboolean unpackFlipY,GLboolean unpackPremultiplyAlpha,GLboolean unpackUnmultiplyAlpha)3477 void GL_APIENTRY GL_CopyTextureCHROMIUM(GLuint sourceId,
3478                                         GLint sourceLevel,
3479                                         GLenum destTarget,
3480                                         GLuint destId,
3481                                         GLint destLevel,
3482                                         GLint internalFormat,
3483                                         GLenum destType,
3484                                         GLboolean unpackFlipY,
3485                                         GLboolean unpackPremultiplyAlpha,
3486                                         GLboolean unpackUnmultiplyAlpha)
3487 {
3488     Context *context = GetValidGlobalContext();
3489     EVENT(context, GLCopyTextureCHROMIUM,
3490           "context = %d, sourceId = %u, sourceLevel = %d, destTarget = %s, destId = %u, destLevel "
3491           "= %d, internalFormat = %d, destType = %s, unpackFlipY = %s, unpackPremultiplyAlpha = "
3492           "%s, unpackUnmultiplyAlpha = %s",
3493           CID(context), sourceId, sourceLevel,
3494           GLenumToString(GLenumGroup::DefaultGroup, destTarget), destId, destLevel, internalFormat,
3495           GLenumToString(GLenumGroup::DefaultGroup, destType), GLbooleanToString(unpackFlipY),
3496           GLbooleanToString(unpackPremultiplyAlpha), GLbooleanToString(unpackUnmultiplyAlpha));
3497 
3498     if (context)
3499     {
3500         TextureID sourceIdPacked       = PackParam<TextureID>(sourceId);
3501         TextureTarget destTargetPacked = PackParam<TextureTarget>(destTarget);
3502         TextureID destIdPacked         = PackParam<TextureID>(destId);
3503         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3504         bool isCallValid                                      = (context->skipValidation() ||
3505                             ValidateCopyTextureCHROMIUM(
3506                                 context, sourceIdPacked, sourceLevel, destTargetPacked,
3507                                 destIdPacked, destLevel, internalFormat, destType, unpackFlipY,
3508                                 unpackPremultiplyAlpha, unpackUnmultiplyAlpha));
3509         if (isCallValid)
3510         {
3511             context->copyTexture(sourceIdPacked, sourceLevel, destTargetPacked, destIdPacked,
3512                                  destLevel, internalFormat, destType, unpackFlipY,
3513                                  unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
3514         }
3515         ANGLE_CAPTURE(CopyTextureCHROMIUM, isCallValid, context, sourceIdPacked, sourceLevel,
3516                       destTargetPacked, destIdPacked, destLevel, internalFormat, destType,
3517                       unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
3518     }
3519     else
3520     {
3521         GenerateContextLostErrorOnCurrentGlobalContext();
3522     }
3523 }
3524 
GL_CopySubTextureCHROMIUM(GLuint sourceId,GLint sourceLevel,GLenum destTarget,GLuint destId,GLint destLevel,GLint xoffset,GLint yoffset,GLint x,GLint y,GLint width,GLint height,GLboolean unpackFlipY,GLboolean unpackPremultiplyAlpha,GLboolean unpackUnmultiplyAlpha)3525 void GL_APIENTRY GL_CopySubTextureCHROMIUM(GLuint sourceId,
3526                                            GLint sourceLevel,
3527                                            GLenum destTarget,
3528                                            GLuint destId,
3529                                            GLint destLevel,
3530                                            GLint xoffset,
3531                                            GLint yoffset,
3532                                            GLint x,
3533                                            GLint y,
3534                                            GLint width,
3535                                            GLint height,
3536                                            GLboolean unpackFlipY,
3537                                            GLboolean unpackPremultiplyAlpha,
3538                                            GLboolean unpackUnmultiplyAlpha)
3539 {
3540     Context *context = GetValidGlobalContext();
3541     EVENT(context, GLCopySubTextureCHROMIUM,
3542           "context = %d, sourceId = %u, sourceLevel = %d, destTarget = %s, destId = %u, destLevel "
3543           "= %d, xoffset = %d, yoffset = %d, x = %d, y = %d, width = %d, height = %d, unpackFlipY "
3544           "= %s, unpackPremultiplyAlpha = %s, unpackUnmultiplyAlpha = %s",
3545           CID(context), sourceId, sourceLevel,
3546           GLenumToString(GLenumGroup::DefaultGroup, destTarget), destId, destLevel, xoffset,
3547           yoffset, x, y, width, height, GLbooleanToString(unpackFlipY),
3548           GLbooleanToString(unpackPremultiplyAlpha), GLbooleanToString(unpackUnmultiplyAlpha));
3549 
3550     if (context)
3551     {
3552         TextureID sourceIdPacked       = PackParam<TextureID>(sourceId);
3553         TextureTarget destTargetPacked = PackParam<TextureTarget>(destTarget);
3554         TextureID destIdPacked         = PackParam<TextureID>(destId);
3555         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3556         bool isCallValid                                      = (context->skipValidation() ||
3557                             ValidateCopySubTextureCHROMIUM(
3558                                 context, sourceIdPacked, sourceLevel, destTargetPacked,
3559                                 destIdPacked, destLevel, xoffset, yoffset, x, y, width, height,
3560                                 unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha));
3561         if (isCallValid)
3562         {
3563             context->copySubTexture(sourceIdPacked, sourceLevel, destTargetPacked, destIdPacked,
3564                                     destLevel, xoffset, yoffset, x, y, width, height, unpackFlipY,
3565                                     unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
3566         }
3567         ANGLE_CAPTURE(CopySubTextureCHROMIUM, isCallValid, context, sourceIdPacked, sourceLevel,
3568                       destTargetPacked, destIdPacked, destLevel, xoffset, yoffset, x, y, width,
3569                       height, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
3570     }
3571     else
3572     {
3573         GenerateContextLostErrorOnCurrentGlobalContext();
3574     }
3575 }
3576 
3577 // GL_CHROMIUM_framebuffer_mixed_samples
GL_CoverageModulationCHROMIUM(GLenum components)3578 void GL_APIENTRY GL_CoverageModulationCHROMIUM(GLenum components)
3579 {
3580     Context *context = GetValidGlobalContext();
3581     EVENT(context, GLCoverageModulationCHROMIUM, "context = %d, components = %s", CID(context),
3582           GLenumToString(GLenumGroup::DefaultGroup, components));
3583 
3584     if (context)
3585     {
3586         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3587         bool isCallValid =
3588             (context->skipValidation() || ValidateCoverageModulationCHROMIUM(context, components));
3589         if (isCallValid)
3590         {
3591             context->coverageModulation(components);
3592         }
3593         ANGLE_CAPTURE(CoverageModulationCHROMIUM, isCallValid, context, components);
3594     }
3595     else
3596     {
3597         GenerateContextLostErrorOnCurrentGlobalContext();
3598     }
3599 }
3600 
3601 // GL_CHROMIUM_lose_context
GL_LoseContextCHROMIUM(GLenum current,GLenum other)3602 void GL_APIENTRY GL_LoseContextCHROMIUM(GLenum current, GLenum other)
3603 {
3604     Context *context = GetValidGlobalContext();
3605     EVENT(context, GLLoseContextCHROMIUM, "context = %d, current = %s, other = %s", CID(context),
3606           GLenumToString(GLenumGroup::GraphicsResetStatus, current),
3607           GLenumToString(GLenumGroup::GraphicsResetStatus, other));
3608 
3609     if (context)
3610     {
3611         GraphicsResetStatus currentPacked = PackParam<GraphicsResetStatus>(current);
3612         GraphicsResetStatus otherPacked   = PackParam<GraphicsResetStatus>(other);
3613         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3614         bool isCallValid                                      = (context->skipValidation() ||
3615                             ValidateLoseContextCHROMIUM(context, currentPacked, otherPacked));
3616         if (isCallValid)
3617         {
3618             context->loseContext(currentPacked, otherPacked);
3619         }
3620         ANGLE_CAPTURE(LoseContextCHROMIUM, isCallValid, context, currentPacked, otherPacked);
3621     }
3622     else
3623     {
3624         GenerateContextLostErrorOnCurrentGlobalContext();
3625     }
3626 }
3627 
3628 // GL_EXT_EGL_image_array
3629 
3630 // GL_EXT_YUV_target
3631 
3632 // GL_EXT_blend_func_extended
GL_BindFragDataLocationEXT(GLuint program,GLuint color,const GLchar * name)3633 void GL_APIENTRY GL_BindFragDataLocationEXT(GLuint program, GLuint color, const GLchar *name)
3634 {
3635     Context *context = GetValidGlobalContext();
3636     EVENT(context, GLBindFragDataLocationEXT,
3637           "context = %d, program = %u, color = %u, name = 0x%016" PRIxPTR "", CID(context), program,
3638           color, (uintptr_t)name);
3639 
3640     if (context)
3641     {
3642         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
3643         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3644         bool isCallValid                                      = (context->skipValidation() ||
3645                             ValidateBindFragDataLocationEXT(context, programPacked, color, name));
3646         if (isCallValid)
3647         {
3648             context->bindFragDataLocation(programPacked, color, name);
3649         }
3650         ANGLE_CAPTURE(BindFragDataLocationEXT, isCallValid, context, programPacked, color, name);
3651     }
3652     else
3653     {
3654         GenerateContextLostErrorOnCurrentGlobalContext();
3655     }
3656 }
3657 
GL_BindFragDataLocationIndexedEXT(GLuint program,GLuint colorNumber,GLuint index,const GLchar * name)3658 void GL_APIENTRY GL_BindFragDataLocationIndexedEXT(GLuint program,
3659                                                    GLuint colorNumber,
3660                                                    GLuint index,
3661                                                    const GLchar *name)
3662 {
3663     Context *context = GetValidGlobalContext();
3664     EVENT(context, GLBindFragDataLocationIndexedEXT,
3665           "context = %d, program = %u, colorNumber = %u, index = %u, name = 0x%016" PRIxPTR "",
3666           CID(context), program, colorNumber, index, (uintptr_t)name);
3667 
3668     if (context)
3669     {
3670         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
3671         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3672         bool isCallValid =
3673             (context->skipValidation() || ValidateBindFragDataLocationIndexedEXT(
3674                                               context, programPacked, colorNumber, index, name));
3675         if (isCallValid)
3676         {
3677             context->bindFragDataLocationIndexed(programPacked, colorNumber, index, name);
3678         }
3679         ANGLE_CAPTURE(BindFragDataLocationIndexedEXT, isCallValid, context, programPacked,
3680                       colorNumber, index, name);
3681     }
3682     else
3683     {
3684         GenerateContextLostErrorOnCurrentGlobalContext();
3685     }
3686 }
3687 
GL_GetFragDataIndexEXT(GLuint program,const GLchar * name)3688 GLint GL_APIENTRY GL_GetFragDataIndexEXT(GLuint program, const GLchar *name)
3689 {
3690     Context *context = GetValidGlobalContext();
3691     EVENT(context, GLGetFragDataIndexEXT, "context = %d, program = %u, name = 0x%016" PRIxPTR "",
3692           CID(context), program, (uintptr_t)name);
3693 
3694     GLint returnValue;
3695     if (context)
3696     {
3697         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
3698         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3699         bool isCallValid                                      = (context->skipValidation() ||
3700                             ValidateGetFragDataIndexEXT(context, programPacked, name));
3701         if (isCallValid)
3702         {
3703             returnValue = context->getFragDataIndex(programPacked, name);
3704         }
3705         else
3706         {
3707             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetFragDataIndexEXT, GLint>();
3708         }
3709         ANGLE_CAPTURE(GetFragDataIndexEXT, isCallValid, context, programPacked, name, returnValue);
3710     }
3711     else
3712     {
3713         GenerateContextLostErrorOnCurrentGlobalContext();
3714         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetFragDataIndexEXT, GLint>();
3715     }
3716     return returnValue;
3717 }
3718 
GL_GetProgramResourceLocationIndexEXT(GLuint program,GLenum programInterface,const GLchar * name)3719 GLint GL_APIENTRY GL_GetProgramResourceLocationIndexEXT(GLuint program,
3720                                                         GLenum programInterface,
3721                                                         const GLchar *name)
3722 {
3723     Context *context = GetValidGlobalContext();
3724     EVENT(context, GLGetProgramResourceLocationIndexEXT,
3725           "context = %d, program = %u, programInterface = %s, name = 0x%016" PRIxPTR "",
3726           CID(context), program, GLenumToString(GLenumGroup::ProgramInterface, programInterface),
3727           (uintptr_t)name);
3728 
3729     GLint returnValue;
3730     if (context)
3731     {
3732         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
3733         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3734         bool isCallValid =
3735             (context->skipValidation() || ValidateGetProgramResourceLocationIndexEXT(
3736                                               context, programPacked, programInterface, name));
3737         if (isCallValid)
3738         {
3739             returnValue =
3740                 context->getProgramResourceLocationIndex(programPacked, programInterface, name);
3741         }
3742         else
3743         {
3744             returnValue =
3745                 GetDefaultReturnValue<angle::EntryPoint::GLGetProgramResourceLocationIndexEXT,
3746                                       GLint>();
3747         }
3748         ANGLE_CAPTURE(GetProgramResourceLocationIndexEXT, isCallValid, context, programPacked,
3749                       programInterface, name, returnValue);
3750     }
3751     else
3752     {
3753         GenerateContextLostErrorOnCurrentGlobalContext();
3754         returnValue =
3755             GetDefaultReturnValue<angle::EntryPoint::GLGetProgramResourceLocationIndexEXT, GLint>();
3756     }
3757     return returnValue;
3758 }
3759 
3760 // GL_EXT_buffer_storage
GL_BufferStorageEXT(GLenum target,GLsizeiptr size,const void * data,GLbitfield flags)3761 void GL_APIENTRY GL_BufferStorageEXT(GLenum target,
3762                                      GLsizeiptr size,
3763                                      const void *data,
3764                                      GLbitfield flags)
3765 {
3766     Context *context = GetValidGlobalContext();
3767     EVENT(context, GLBufferStorageEXT,
3768           "context = %d, target = %s, size = %llu, data = 0x%016" PRIxPTR ", flags = %s",
3769           CID(context), GLenumToString(GLenumGroup::BufferStorageTarget, target),
3770           static_cast<unsigned long long>(size), (uintptr_t)data,
3771           GLbitfieldToString(GLenumGroup::MapBufferUsageMask, flags).c_str());
3772 
3773     if (context)
3774     {
3775         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
3776         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3777         bool isCallValid                                      = (context->skipValidation() ||
3778                             ValidateBufferStorageEXT(context, targetPacked, size, data, flags));
3779         if (isCallValid)
3780         {
3781             context->bufferStorage(targetPacked, size, data, flags);
3782         }
3783         ANGLE_CAPTURE(BufferStorageEXT, isCallValid, context, targetPacked, size, data, flags);
3784     }
3785     else
3786     {
3787         GenerateContextLostErrorOnCurrentGlobalContext();
3788     }
3789 }
3790 
3791 // GL_EXT_clip_control
GL_ClipControlEXT(GLenum origin,GLenum depth)3792 void GL_APIENTRY GL_ClipControlEXT(GLenum origin, GLenum depth)
3793 {
3794     Context *context = GetValidGlobalContext();
3795     EVENT(context, GLClipControlEXT, "context = %d, origin = %s, depth = %s", CID(context),
3796           GLenumToString(GLenumGroup::DefaultGroup, origin),
3797           GLenumToString(GLenumGroup::DefaultGroup, depth));
3798 
3799     if (context)
3800     {
3801         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3802         bool isCallValid =
3803             (context->skipValidation() || ValidateClipControlEXT(context, origin, depth));
3804         if (isCallValid)
3805         {
3806             context->clipControl(origin, depth);
3807         }
3808         ANGLE_CAPTURE(ClipControlEXT, isCallValid, context, origin, depth);
3809     }
3810     else
3811     {
3812         GenerateContextLostErrorOnCurrentGlobalContext();
3813     }
3814 }
3815 
3816 // GL_EXT_copy_image
GL_CopyImageSubDataEXT(GLuint srcName,GLenum srcTarget,GLint srcLevel,GLint srcX,GLint srcY,GLint srcZ,GLuint dstName,GLenum dstTarget,GLint dstLevel,GLint dstX,GLint dstY,GLint dstZ,GLsizei srcWidth,GLsizei srcHeight,GLsizei srcDepth)3817 void GL_APIENTRY GL_CopyImageSubDataEXT(GLuint srcName,
3818                                         GLenum srcTarget,
3819                                         GLint srcLevel,
3820                                         GLint srcX,
3821                                         GLint srcY,
3822                                         GLint srcZ,
3823                                         GLuint dstName,
3824                                         GLenum dstTarget,
3825                                         GLint dstLevel,
3826                                         GLint dstX,
3827                                         GLint dstY,
3828                                         GLint dstZ,
3829                                         GLsizei srcWidth,
3830                                         GLsizei srcHeight,
3831                                         GLsizei srcDepth)
3832 {
3833     Context *context = GetValidGlobalContext();
3834     EVENT(context, GLCopyImageSubDataEXT,
3835           "context = %d, srcName = %u, srcTarget = %s, srcLevel = %d, srcX = %d, srcY = %d, srcZ = "
3836           "%d, dstName = %u, dstTarget = %s, dstLevel = %d, dstX = %d, dstY = %d, dstZ = %d, "
3837           "srcWidth = %d, srcHeight = %d, srcDepth = %d",
3838           CID(context), srcName, GLenumToString(GLenumGroup::CopyBufferSubDataTarget, srcTarget),
3839           srcLevel, srcX, srcY, srcZ, dstName,
3840           GLenumToString(GLenumGroup::CopyBufferSubDataTarget, dstTarget), dstLevel, dstX, dstY,
3841           dstZ, srcWidth, srcHeight, srcDepth);
3842 
3843     if (context)
3844     {
3845         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3846         bool isCallValid =
3847             (context->skipValidation() ||
3848              ValidateCopyImageSubDataEXT(context, srcName, srcTarget, srcLevel, srcX, srcY, srcZ,
3849                                          dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth,
3850                                          srcHeight, srcDepth));
3851         if (isCallValid)
3852         {
3853             context->copyImageSubData(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName,
3854                                       dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight,
3855                                       srcDepth);
3856         }
3857         ANGLE_CAPTURE(CopyImageSubDataEXT, isCallValid, context, srcName, srcTarget, srcLevel, srcX,
3858                       srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth,
3859                       srcHeight, srcDepth);
3860     }
3861     else
3862     {
3863         GenerateContextLostErrorOnCurrentGlobalContext();
3864     }
3865 }
3866 
3867 // GL_EXT_debug_label
3868 void GL_APIENTRY
GL_GetObjectLabelEXT(GLenum type,GLuint object,GLsizei bufSize,GLsizei * length,GLchar * label)3869 GL_GetObjectLabelEXT(GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label)
3870 {
3871     Context *context = GetValidGlobalContext();
3872     EVENT(context, GLGetObjectLabelEXT,
3873           "context = %d, type = %s, object = %u, bufSize = %d, length = 0x%016" PRIxPTR
3874           ", label = 0x%016" PRIxPTR "",
3875           CID(context), GLenumToString(GLenumGroup::DefaultGroup, type), object, bufSize,
3876           (uintptr_t)length, (uintptr_t)label);
3877 
3878     if (context)
3879     {
3880         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3881         bool isCallValid =
3882             (context->skipValidation() ||
3883              ValidateGetObjectLabelEXT(context, type, object, bufSize, length, label));
3884         if (isCallValid)
3885         {
3886             context->getObjectLabel(type, object, bufSize, length, label);
3887         }
3888         ANGLE_CAPTURE(GetObjectLabelEXT, isCallValid, context, type, object, bufSize, length,
3889                       label);
3890     }
3891     else
3892     {
3893         GenerateContextLostErrorOnCurrentGlobalContext();
3894     }
3895 }
3896 
GL_LabelObjectEXT(GLenum type,GLuint object,GLsizei length,const GLchar * label)3897 void GL_APIENTRY GL_LabelObjectEXT(GLenum type, GLuint object, GLsizei length, const GLchar *label)
3898 {
3899     Context *context = GetValidGlobalContext();
3900     EVENT(context, GLLabelObjectEXT,
3901           "context = %d, type = %s, object = %u, length = %d, label = 0x%016" PRIxPTR "",
3902           CID(context), GLenumToString(GLenumGroup::DefaultGroup, type), object, length,
3903           (uintptr_t)label);
3904 
3905     if (context)
3906     {
3907         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3908         bool isCallValid                                      = (context->skipValidation() ||
3909                             ValidateLabelObjectEXT(context, type, object, length, label));
3910         if (isCallValid)
3911         {
3912             context->labelObject(type, object, length, label);
3913         }
3914         ANGLE_CAPTURE(LabelObjectEXT, isCallValid, context, type, object, length, label);
3915     }
3916     else
3917     {
3918         GenerateContextLostErrorOnCurrentGlobalContext();
3919     }
3920 }
3921 
3922 // GL_EXT_debug_marker
GL_InsertEventMarkerEXT(GLsizei length,const GLchar * marker)3923 void GL_APIENTRY GL_InsertEventMarkerEXT(GLsizei length, const GLchar *marker)
3924 {
3925     Context *context = GetValidGlobalContext();
3926     // Don't run the EVENT() macro on the EXT_debug_marker entry points.
3927     // It can interfere with the debug events being set by the caller.
3928     // EVENT(context, GLInsertEventMarkerEXT, "context = %d, length = %d, marker = 0x%016" PRIxPTR
3929     // "", CID(context), length, (uintptr_t)marker);
3930 
3931     if (context)
3932     {
3933         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3934         bool isCallValid =
3935             (context->skipValidation() || ValidateInsertEventMarkerEXT(context, length, marker));
3936         if (isCallValid)
3937         {
3938             context->insertEventMarker(length, marker);
3939         }
3940         ANGLE_CAPTURE(InsertEventMarkerEXT, isCallValid, context, length, marker);
3941     }
3942     else
3943     {
3944         GenerateContextLostErrorOnCurrentGlobalContext();
3945     }
3946 }
3947 
GL_PopGroupMarkerEXT()3948 void GL_APIENTRY GL_PopGroupMarkerEXT()
3949 {
3950     Context *context = GetValidGlobalContext();
3951     // Don't run the EVENT() macro on the EXT_debug_marker entry points.
3952     // It can interfere with the debug events being set by the caller.
3953     // EVENT(context, GLPopGroupMarkerEXT, "context = %d", CID(context));
3954 
3955     if (context)
3956     {
3957         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3958         bool isCallValid = (context->skipValidation() || ValidatePopGroupMarkerEXT(context));
3959         if (isCallValid)
3960         {
3961             context->popGroupMarker();
3962         }
3963         ANGLE_CAPTURE(PopGroupMarkerEXT, isCallValid, context);
3964     }
3965     else
3966     {
3967         GenerateContextLostErrorOnCurrentGlobalContext();
3968     }
3969 }
3970 
GL_PushGroupMarkerEXT(GLsizei length,const GLchar * marker)3971 void GL_APIENTRY GL_PushGroupMarkerEXT(GLsizei length, const GLchar *marker)
3972 {
3973     Context *context = GetValidGlobalContext();
3974     // Don't run the EVENT() macro on the EXT_debug_marker entry points.
3975     // It can interfere with the debug events being set by the caller.
3976     // EVENT(context, GLPushGroupMarkerEXT, "context = %d, length = %d, marker = 0x%016" PRIxPTR "",
3977     // CID(context), length, (uintptr_t)marker);
3978 
3979     if (context)
3980     {
3981         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
3982         bool isCallValid =
3983             (context->skipValidation() || ValidatePushGroupMarkerEXT(context, length, marker));
3984         if (isCallValid)
3985         {
3986             context->pushGroupMarker(length, marker);
3987         }
3988         ANGLE_CAPTURE(PushGroupMarkerEXT, isCallValid, context, length, marker);
3989     }
3990     else
3991     {
3992         GenerateContextLostErrorOnCurrentGlobalContext();
3993     }
3994 }
3995 
3996 // GL_EXT_discard_framebuffer
GL_DiscardFramebufferEXT(GLenum target,GLsizei numAttachments,const GLenum * attachments)3997 void GL_APIENTRY GL_DiscardFramebufferEXT(GLenum target,
3998                                           GLsizei numAttachments,
3999                                           const GLenum *attachments)
4000 {
4001     Context *context = GetValidGlobalContext();
4002     EVENT(context, GLDiscardFramebufferEXT,
4003           "context = %d, target = %s, numAttachments = %d, attachments = 0x%016" PRIxPTR "",
4004           CID(context), GLenumToString(GLenumGroup::FramebufferTarget, target), numAttachments,
4005           (uintptr_t)attachments);
4006 
4007     if (context)
4008     {
4009         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4010         bool isCallValid =
4011             (context->skipValidation() ||
4012              ValidateDiscardFramebufferEXT(context, target, numAttachments, attachments));
4013         if (isCallValid)
4014         {
4015             context->discardFramebuffer(target, numAttachments, attachments);
4016         }
4017         ANGLE_CAPTURE(DiscardFramebufferEXT, isCallValid, context, target, numAttachments,
4018                       attachments);
4019     }
4020     else
4021     {
4022         GenerateContextLostErrorOnCurrentGlobalContext();
4023     }
4024 }
4025 
4026 // GL_EXT_disjoint_timer_query
GL_BeginQueryEXT(GLenum target,GLuint id)4027 void GL_APIENTRY GL_BeginQueryEXT(GLenum target, GLuint id)
4028 {
4029     Context *context = GetValidGlobalContext();
4030     EVENT(context, GLBeginQueryEXT, "context = %d, target = %s, id = %u", CID(context),
4031           GLenumToString(GLenumGroup::QueryTarget, target), id);
4032 
4033     if (context)
4034     {
4035         QueryType targetPacked                                = PackParam<QueryType>(target);
4036         QueryID idPacked                                      = PackParam<QueryID>(id);
4037         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4038         bool isCallValid =
4039             (context->skipValidation() || ValidateBeginQueryEXT(context, targetPacked, idPacked));
4040         if (isCallValid)
4041         {
4042             context->beginQuery(targetPacked, idPacked);
4043         }
4044         ANGLE_CAPTURE(BeginQueryEXT, isCallValid, context, targetPacked, idPacked);
4045     }
4046     else
4047     {
4048         GenerateContextLostErrorOnCurrentGlobalContext();
4049     }
4050 }
4051 
GL_DeleteQueriesEXT(GLsizei n,const GLuint * ids)4052 void GL_APIENTRY GL_DeleteQueriesEXT(GLsizei n, const GLuint *ids)
4053 {
4054     Context *context = GetValidGlobalContext();
4055     EVENT(context, GLDeleteQueriesEXT, "context = %d, n = %d, ids = 0x%016" PRIxPTR "",
4056           CID(context), n, (uintptr_t)ids);
4057 
4058     if (context)
4059     {
4060         const QueryID *idsPacked                              = PackParam<const QueryID *>(ids);
4061         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4062         bool isCallValid =
4063             (context->skipValidation() || ValidateDeleteQueriesEXT(context, n, idsPacked));
4064         if (isCallValid)
4065         {
4066             context->deleteQueries(n, idsPacked);
4067         }
4068         ANGLE_CAPTURE(DeleteQueriesEXT, isCallValid, context, n, idsPacked);
4069     }
4070     else
4071     {
4072         GenerateContextLostErrorOnCurrentGlobalContext();
4073     }
4074 }
4075 
GL_EndQueryEXT(GLenum target)4076 void GL_APIENTRY GL_EndQueryEXT(GLenum target)
4077 {
4078     Context *context = GetValidGlobalContext();
4079     EVENT(context, GLEndQueryEXT, "context = %d, target = %s", CID(context),
4080           GLenumToString(GLenumGroup::QueryTarget, target));
4081 
4082     if (context)
4083     {
4084         QueryType targetPacked                                = PackParam<QueryType>(target);
4085         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4086         bool isCallValid =
4087             (context->skipValidation() || ValidateEndQueryEXT(context, targetPacked));
4088         if (isCallValid)
4089         {
4090             context->endQuery(targetPacked);
4091         }
4092         ANGLE_CAPTURE(EndQueryEXT, isCallValid, context, targetPacked);
4093     }
4094     else
4095     {
4096         GenerateContextLostErrorOnCurrentGlobalContext();
4097     }
4098 }
4099 
GL_GenQueriesEXT(GLsizei n,GLuint * ids)4100 void GL_APIENTRY GL_GenQueriesEXT(GLsizei n, GLuint *ids)
4101 {
4102     Context *context = GetValidGlobalContext();
4103     EVENT(context, GLGenQueriesEXT, "context = %d, n = %d, ids = 0x%016" PRIxPTR "", CID(context),
4104           n, (uintptr_t)ids);
4105 
4106     if (context)
4107     {
4108         QueryID *idsPacked                                    = PackParam<QueryID *>(ids);
4109         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4110         bool isCallValid =
4111             (context->skipValidation() || ValidateGenQueriesEXT(context, n, idsPacked));
4112         if (isCallValid)
4113         {
4114             context->genQueries(n, idsPacked);
4115         }
4116         ANGLE_CAPTURE(GenQueriesEXT, isCallValid, context, n, idsPacked);
4117     }
4118     else
4119     {
4120         GenerateContextLostErrorOnCurrentGlobalContext();
4121     }
4122 }
4123 
GL_GetInteger64vEXT(GLenum pname,GLint64 * data)4124 void GL_APIENTRY GL_GetInteger64vEXT(GLenum pname, GLint64 *data)
4125 {
4126     Context *context = GetValidGlobalContext();
4127     EVENT(context, GLGetInteger64vEXT, "context = %d, pname = %s, data = 0x%016" PRIxPTR "",
4128           CID(context), GLenumToString(GLenumGroup::GetPName, pname), (uintptr_t)data);
4129 
4130     if (context)
4131     {
4132         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4133         bool isCallValid =
4134             (context->skipValidation() || ValidateGetInteger64vEXT(context, pname, data));
4135         if (isCallValid)
4136         {
4137             context->getInteger64v(pname, data);
4138         }
4139         ANGLE_CAPTURE(GetInteger64vEXT, isCallValid, context, pname, data);
4140     }
4141     else
4142     {
4143         GenerateContextLostErrorOnCurrentGlobalContext();
4144     }
4145 }
4146 
GL_GetQueryObjecti64vEXT(GLuint id,GLenum pname,GLint64 * params)4147 void GL_APIENTRY GL_GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64 *params)
4148 {
4149     Context *context = GetGlobalContext();
4150     EVENT(context, GLGetQueryObjecti64vEXT,
4151           "context = %d, id = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), id,
4152           GLenumToString(GLenumGroup::QueryObjectParameterName, pname), (uintptr_t)params);
4153 
4154     if (context)
4155     {
4156         QueryID idPacked                                      = PackParam<QueryID>(id);
4157         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4158         bool isCallValid                                      = (context->skipValidation() ||
4159                             ValidateGetQueryObjecti64vEXT(context, idPacked, pname, params));
4160         if (isCallValid)
4161         {
4162             context->getQueryObjecti64v(idPacked, pname, params);
4163         }
4164         ANGLE_CAPTURE(GetQueryObjecti64vEXT, isCallValid, context, idPacked, pname, params);
4165     }
4166     else
4167     {}
4168 }
4169 
GL_GetQueryObjectivEXT(GLuint id,GLenum pname,GLint * params)4170 void GL_APIENTRY GL_GetQueryObjectivEXT(GLuint id, GLenum pname, GLint *params)
4171 {
4172     Context *context = GetGlobalContext();
4173     EVENT(context, GLGetQueryObjectivEXT,
4174           "context = %d, id = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), id,
4175           GLenumToString(GLenumGroup::QueryObjectParameterName, pname), (uintptr_t)params);
4176 
4177     if (context)
4178     {
4179         QueryID idPacked                                      = PackParam<QueryID>(id);
4180         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4181         bool isCallValid                                      = (context->skipValidation() ||
4182                             ValidateGetQueryObjectivEXT(context, idPacked, pname, params));
4183         if (isCallValid)
4184         {
4185             context->getQueryObjectiv(idPacked, pname, params);
4186         }
4187         ANGLE_CAPTURE(GetQueryObjectivEXT, isCallValid, context, idPacked, pname, params);
4188     }
4189     else
4190     {}
4191 }
4192 
GL_GetQueryObjectui64vEXT(GLuint id,GLenum pname,GLuint64 * params)4193 void GL_APIENTRY GL_GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64 *params)
4194 {
4195     Context *context = GetValidGlobalContext();
4196     EVENT(context, GLGetQueryObjectui64vEXT,
4197           "context = %d, id = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), id,
4198           GLenumToString(GLenumGroup::QueryObjectParameterName, pname), (uintptr_t)params);
4199 
4200     if (context)
4201     {
4202         QueryID idPacked                                      = PackParam<QueryID>(id);
4203         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4204         bool isCallValid                                      = (context->skipValidation() ||
4205                             ValidateGetQueryObjectui64vEXT(context, idPacked, pname, params));
4206         if (isCallValid)
4207         {
4208             context->getQueryObjectui64v(idPacked, pname, params);
4209         }
4210         ANGLE_CAPTURE(GetQueryObjectui64vEXT, isCallValid, context, idPacked, pname, params);
4211     }
4212     else
4213     {
4214         GenerateContextLostErrorOnCurrentGlobalContext();
4215     }
4216 }
4217 
GL_GetQueryObjectuivEXT(GLuint id,GLenum pname,GLuint * params)4218 void GL_APIENTRY GL_GetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params)
4219 {
4220     Context *context = GetValidGlobalContext();
4221     EVENT(context, GLGetQueryObjectuivEXT,
4222           "context = %d, id = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), id,
4223           GLenumToString(GLenumGroup::QueryObjectParameterName, pname), (uintptr_t)params);
4224 
4225     if (context)
4226     {
4227         QueryID idPacked                                      = PackParam<QueryID>(id);
4228         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4229         bool isCallValid                                      = (context->skipValidation() ||
4230                             ValidateGetQueryObjectuivEXT(context, idPacked, pname, params));
4231         if (isCallValid)
4232         {
4233             context->getQueryObjectuiv(idPacked, pname, params);
4234         }
4235         ANGLE_CAPTURE(GetQueryObjectuivEXT, isCallValid, context, idPacked, pname, params);
4236     }
4237     else
4238     {
4239         GenerateContextLostErrorOnCurrentGlobalContext();
4240     }
4241 }
4242 
GL_GetQueryivEXT(GLenum target,GLenum pname,GLint * params)4243 void GL_APIENTRY GL_GetQueryivEXT(GLenum target, GLenum pname, GLint *params)
4244 {
4245     Context *context = GetValidGlobalContext();
4246     EVENT(context, GLGetQueryivEXT,
4247           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
4248           GLenumToString(GLenumGroup::QueryTarget, target),
4249           GLenumToString(GLenumGroup::QueryParameterName, pname), (uintptr_t)params);
4250 
4251     if (context)
4252     {
4253         QueryType targetPacked                                = PackParam<QueryType>(target);
4254         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4255         bool isCallValid                                      = (context->skipValidation() ||
4256                             ValidateGetQueryivEXT(context, targetPacked, pname, params));
4257         if (isCallValid)
4258         {
4259             context->getQueryiv(targetPacked, pname, params);
4260         }
4261         ANGLE_CAPTURE(GetQueryivEXT, isCallValid, context, targetPacked, pname, params);
4262     }
4263     else
4264     {
4265         GenerateContextLostErrorOnCurrentGlobalContext();
4266     }
4267 }
4268 
GL_IsQueryEXT(GLuint id)4269 GLboolean GL_APIENTRY GL_IsQueryEXT(GLuint id)
4270 {
4271     Context *context = GetValidGlobalContext();
4272     EVENT(context, GLIsQueryEXT, "context = %d, id = %u", CID(context), id);
4273 
4274     GLboolean returnValue;
4275     if (context)
4276     {
4277         QueryID idPacked                                      = PackParam<QueryID>(id);
4278         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4279         bool isCallValid = (context->skipValidation() || ValidateIsQueryEXT(context, idPacked));
4280         if (isCallValid)
4281         {
4282             returnValue = context->isQuery(idPacked);
4283         }
4284         else
4285         {
4286             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsQueryEXT, GLboolean>();
4287         }
4288         ANGLE_CAPTURE(IsQueryEXT, isCallValid, context, idPacked, returnValue);
4289     }
4290     else
4291     {
4292         GenerateContextLostErrorOnCurrentGlobalContext();
4293         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsQueryEXT, GLboolean>();
4294     }
4295     return returnValue;
4296 }
4297 
GL_QueryCounterEXT(GLuint id,GLenum target)4298 void GL_APIENTRY GL_QueryCounterEXT(GLuint id, GLenum target)
4299 {
4300     Context *context = GetValidGlobalContext();
4301     EVENT(context, GLQueryCounterEXT, "context = %d, id = %u, target = %s", CID(context), id,
4302           GLenumToString(GLenumGroup::QueryTarget, target));
4303 
4304     if (context)
4305     {
4306         QueryID idPacked                                      = PackParam<QueryID>(id);
4307         QueryType targetPacked                                = PackParam<QueryType>(target);
4308         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4309         bool isCallValid =
4310             (context->skipValidation() || ValidateQueryCounterEXT(context, idPacked, targetPacked));
4311         if (isCallValid)
4312         {
4313             context->queryCounter(idPacked, targetPacked);
4314         }
4315         ANGLE_CAPTURE(QueryCounterEXT, isCallValid, context, idPacked, targetPacked);
4316     }
4317     else
4318     {
4319         GenerateContextLostErrorOnCurrentGlobalContext();
4320     }
4321 }
4322 
4323 // GL_EXT_draw_buffers
GL_DrawBuffersEXT(GLsizei n,const GLenum * bufs)4324 void GL_APIENTRY GL_DrawBuffersEXT(GLsizei n, const GLenum *bufs)
4325 {
4326     Context *context = GetValidGlobalContext();
4327     EVENT(context, GLDrawBuffersEXT, "context = %d, n = %d, bufs = 0x%016" PRIxPTR "", CID(context),
4328           n, (uintptr_t)bufs);
4329 
4330     if (context)
4331     {
4332         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4333         bool isCallValid = (context->skipValidation() || ValidateDrawBuffersEXT(context, n, bufs));
4334         if (isCallValid)
4335         {
4336             context->drawBuffers(n, bufs);
4337         }
4338         ANGLE_CAPTURE(DrawBuffersEXT, isCallValid, context, n, bufs);
4339     }
4340     else
4341     {
4342         GenerateContextLostErrorOnCurrentGlobalContext();
4343     }
4344 }
4345 
4346 // GL_EXT_draw_buffers_indexed
GL_BlendEquationSeparateiEXT(GLuint buf,GLenum modeRGB,GLenum modeAlpha)4347 void GL_APIENTRY GL_BlendEquationSeparateiEXT(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
4348 {
4349     Context *context = GetValidGlobalContext();
4350     EVENT(context, GLBlendEquationSeparateiEXT,
4351           "context = %d, buf = %u, modeRGB = %s, modeAlpha = %s", CID(context), buf,
4352           GLenumToString(GLenumGroup::BlendEquationModeEXT, modeRGB),
4353           GLenumToString(GLenumGroup::BlendEquationModeEXT, modeAlpha));
4354 
4355     if (context)
4356     {
4357         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4358         bool isCallValid                                      = (context->skipValidation() ||
4359                             ValidateBlendEquationSeparateiEXT(context, buf, modeRGB, modeAlpha));
4360         if (isCallValid)
4361         {
4362             context->blendEquationSeparatei(buf, modeRGB, modeAlpha);
4363         }
4364         ANGLE_CAPTURE(BlendEquationSeparateiEXT, isCallValid, context, buf, modeRGB, modeAlpha);
4365     }
4366     else
4367     {
4368         GenerateContextLostErrorOnCurrentGlobalContext();
4369     }
4370 }
4371 
GL_BlendEquationiEXT(GLuint buf,GLenum mode)4372 void GL_APIENTRY GL_BlendEquationiEXT(GLuint buf, GLenum mode)
4373 {
4374     Context *context = GetValidGlobalContext();
4375     EVENT(context, GLBlendEquationiEXT, "context = %d, buf = %u, mode = %s", CID(context), buf,
4376           GLenumToString(GLenumGroup::BlendEquationModeEXT, mode));
4377 
4378     if (context)
4379     {
4380         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4381         bool isCallValid =
4382             (context->skipValidation() || ValidateBlendEquationiEXT(context, buf, mode));
4383         if (isCallValid)
4384         {
4385             context->blendEquationi(buf, mode);
4386         }
4387         ANGLE_CAPTURE(BlendEquationiEXT, isCallValid, context, buf, mode);
4388     }
4389     else
4390     {
4391         GenerateContextLostErrorOnCurrentGlobalContext();
4392     }
4393 }
4394 
4395 void GL_APIENTRY
GL_BlendFuncSeparateiEXT(GLuint buf,GLenum srcRGB,GLenum dstRGB,GLenum srcAlpha,GLenum dstAlpha)4396 GL_BlendFuncSeparateiEXT(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
4397 {
4398     Context *context = GetValidGlobalContext();
4399     EVENT(context, GLBlendFuncSeparateiEXT,
4400           "context = %d, buf = %u, srcRGB = %s, dstRGB = %s, srcAlpha = %s, dstAlpha = %s",
4401           CID(context), buf, GLenumToString(GLenumGroup::BlendingFactor, srcRGB),
4402           GLenumToString(GLenumGroup::BlendingFactor, dstRGB),
4403           GLenumToString(GLenumGroup::BlendingFactor, srcAlpha),
4404           GLenumToString(GLenumGroup::BlendingFactor, dstAlpha));
4405 
4406     if (context)
4407     {
4408         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4409         bool isCallValid =
4410             (context->skipValidation() ||
4411              ValidateBlendFuncSeparateiEXT(context, buf, srcRGB, dstRGB, srcAlpha, dstAlpha));
4412         if (isCallValid)
4413         {
4414             context->blendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
4415         }
4416         ANGLE_CAPTURE(BlendFuncSeparateiEXT, isCallValid, context, buf, srcRGB, dstRGB, srcAlpha,
4417                       dstAlpha);
4418     }
4419     else
4420     {
4421         GenerateContextLostErrorOnCurrentGlobalContext();
4422     }
4423 }
4424 
GL_BlendFunciEXT(GLuint buf,GLenum src,GLenum dst)4425 void GL_APIENTRY GL_BlendFunciEXT(GLuint buf, GLenum src, GLenum dst)
4426 {
4427     Context *context = GetValidGlobalContext();
4428     EVENT(context, GLBlendFunciEXT, "context = %d, buf = %u, src = %s, dst = %s", CID(context), buf,
4429           GLenumToString(GLenumGroup::BlendingFactor, src),
4430           GLenumToString(GLenumGroup::BlendingFactor, dst));
4431 
4432     if (context)
4433     {
4434         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4435         bool isCallValid =
4436             (context->skipValidation() || ValidateBlendFunciEXT(context, buf, src, dst));
4437         if (isCallValid)
4438         {
4439             context->blendFunci(buf, src, dst);
4440         }
4441         ANGLE_CAPTURE(BlendFunciEXT, isCallValid, context, buf, src, dst);
4442     }
4443     else
4444     {
4445         GenerateContextLostErrorOnCurrentGlobalContext();
4446     }
4447 }
4448 
GL_ColorMaskiEXT(GLuint index,GLboolean r,GLboolean g,GLboolean b,GLboolean a)4449 void GL_APIENTRY GL_ColorMaskiEXT(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
4450 {
4451     Context *context = GetValidGlobalContext();
4452     EVENT(context, GLColorMaskiEXT, "context = %d, index = %u, r = %s, g = %s, b = %s, a = %s",
4453           CID(context), index, GLbooleanToString(r), GLbooleanToString(g), GLbooleanToString(b),
4454           GLbooleanToString(a));
4455 
4456     if (context)
4457     {
4458         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4459         bool isCallValid =
4460             (context->skipValidation() || ValidateColorMaskiEXT(context, index, r, g, b, a));
4461         if (isCallValid)
4462         {
4463             context->colorMaski(index, r, g, b, a);
4464         }
4465         ANGLE_CAPTURE(ColorMaskiEXT, isCallValid, context, index, r, g, b, a);
4466     }
4467     else
4468     {
4469         GenerateContextLostErrorOnCurrentGlobalContext();
4470     }
4471 }
4472 
GL_DisableiEXT(GLenum target,GLuint index)4473 void GL_APIENTRY GL_DisableiEXT(GLenum target, GLuint index)
4474 {
4475     Context *context = GetValidGlobalContext();
4476     EVENT(context, GLDisableiEXT, "context = %d, target = %s, index = %u", CID(context),
4477           GLenumToString(GLenumGroup::EnableCap, target), index);
4478 
4479     if (context)
4480     {
4481         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4482         bool isCallValid =
4483             (context->skipValidation() || ValidateDisableiEXT(context, target, index));
4484         if (isCallValid)
4485         {
4486             context->disablei(target, index);
4487         }
4488         ANGLE_CAPTURE(DisableiEXT, isCallValid, context, target, index);
4489     }
4490     else
4491     {
4492         GenerateContextLostErrorOnCurrentGlobalContext();
4493     }
4494 }
4495 
GL_EnableiEXT(GLenum target,GLuint index)4496 void GL_APIENTRY GL_EnableiEXT(GLenum target, GLuint index)
4497 {
4498     Context *context = GetValidGlobalContext();
4499     EVENT(context, GLEnableiEXT, "context = %d, target = %s, index = %u", CID(context),
4500           GLenumToString(GLenumGroup::EnableCap, target), index);
4501 
4502     if (context)
4503     {
4504         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4505         bool isCallValid =
4506             (context->skipValidation() || ValidateEnableiEXT(context, target, index));
4507         if (isCallValid)
4508         {
4509             context->enablei(target, index);
4510         }
4511         ANGLE_CAPTURE(EnableiEXT, isCallValid, context, target, index);
4512     }
4513     else
4514     {
4515         GenerateContextLostErrorOnCurrentGlobalContext();
4516     }
4517 }
4518 
GL_IsEnablediEXT(GLenum target,GLuint index)4519 GLboolean GL_APIENTRY GL_IsEnablediEXT(GLenum target, GLuint index)
4520 {
4521     Context *context = GetValidGlobalContext();
4522     EVENT(context, GLIsEnablediEXT, "context = %d, target = %s, index = %u", CID(context),
4523           GLenumToString(GLenumGroup::EnableCap, target), index);
4524 
4525     GLboolean returnValue;
4526     if (context)
4527     {
4528         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4529         bool isCallValid =
4530             (context->skipValidation() || ValidateIsEnablediEXT(context, target, index));
4531         if (isCallValid)
4532         {
4533             returnValue = context->isEnabledi(target, index);
4534         }
4535         else
4536         {
4537             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsEnablediEXT, GLboolean>();
4538         }
4539         ANGLE_CAPTURE(IsEnablediEXT, isCallValid, context, target, index, returnValue);
4540     }
4541     else
4542     {
4543         GenerateContextLostErrorOnCurrentGlobalContext();
4544         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsEnablediEXT, GLboolean>();
4545     }
4546     return returnValue;
4547 }
4548 
4549 // GL_EXT_draw_elements_base_vertex
GL_DrawElementsBaseVertexEXT(GLenum mode,GLsizei count,GLenum type,const void * indices,GLint basevertex)4550 void GL_APIENTRY GL_DrawElementsBaseVertexEXT(GLenum mode,
4551                                               GLsizei count,
4552                                               GLenum type,
4553                                               const void *indices,
4554                                               GLint basevertex)
4555 {
4556     Context *context = GetValidGlobalContext();
4557     EVENT(context, GLDrawElementsBaseVertexEXT,
4558           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
4559           ", basevertex = %d",
4560           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), count,
4561           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices, basevertex);
4562 
4563     if (context)
4564     {
4565         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
4566         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
4567         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4568         bool isCallValid                                      = (context->skipValidation() ||
4569                             ValidateDrawElementsBaseVertexEXT(context, modePacked, count,
4570                                                               typePacked, indices, basevertex));
4571         if (isCallValid)
4572         {
4573             context->drawElementsBaseVertex(modePacked, count, typePacked, indices, basevertex);
4574         }
4575         ANGLE_CAPTURE(DrawElementsBaseVertexEXT, isCallValid, context, modePacked, count,
4576                       typePacked, indices, basevertex);
4577     }
4578     else
4579     {
4580         GenerateContextLostErrorOnCurrentGlobalContext();
4581     }
4582 }
4583 
GL_DrawElementsInstancedBaseVertexEXT(GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei instancecount,GLint basevertex)4584 void GL_APIENTRY GL_DrawElementsInstancedBaseVertexEXT(GLenum mode,
4585                                                        GLsizei count,
4586                                                        GLenum type,
4587                                                        const void *indices,
4588                                                        GLsizei instancecount,
4589                                                        GLint basevertex)
4590 {
4591     Context *context = GetValidGlobalContext();
4592     EVENT(context, GLDrawElementsInstancedBaseVertexEXT,
4593           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
4594           ", instancecount = %d, basevertex = %d",
4595           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), count,
4596           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices, instancecount,
4597           basevertex);
4598 
4599     if (context)
4600     {
4601         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
4602         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
4603         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4604         bool isCallValid = (context->skipValidation() || ValidateDrawElementsInstancedBaseVertexEXT(
4605                                                              context, modePacked, count, typePacked,
4606                                                              indices, instancecount, basevertex));
4607         if (isCallValid)
4608         {
4609             context->drawElementsInstancedBaseVertex(modePacked, count, typePacked, indices,
4610                                                      instancecount, basevertex);
4611         }
4612         ANGLE_CAPTURE(DrawElementsInstancedBaseVertexEXT, isCallValid, context, modePacked, count,
4613                       typePacked, indices, instancecount, basevertex);
4614     }
4615     else
4616     {
4617         GenerateContextLostErrorOnCurrentGlobalContext();
4618     }
4619 }
4620 
GL_DrawRangeElementsBaseVertexEXT(GLenum mode,GLuint start,GLuint end,GLsizei count,GLenum type,const void * indices,GLint basevertex)4621 void GL_APIENTRY GL_DrawRangeElementsBaseVertexEXT(GLenum mode,
4622                                                    GLuint start,
4623                                                    GLuint end,
4624                                                    GLsizei count,
4625                                                    GLenum type,
4626                                                    const void *indices,
4627                                                    GLint basevertex)
4628 {
4629     Context *context = GetValidGlobalContext();
4630     EVENT(context, GLDrawRangeElementsBaseVertexEXT,
4631           "context = %d, mode = %s, start = %u, end = %u, count = %d, type = %s, indices = "
4632           "0x%016" PRIxPTR ", basevertex = %d",
4633           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), start, end, count,
4634           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices, basevertex);
4635 
4636     if (context)
4637     {
4638         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
4639         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
4640         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4641         bool isCallValid = (context->skipValidation() || ValidateDrawRangeElementsBaseVertexEXT(
4642                                                              context, modePacked, start, end, count,
4643                                                              typePacked, indices, basevertex));
4644         if (isCallValid)
4645         {
4646             context->drawRangeElementsBaseVertex(modePacked, start, end, count, typePacked, indices,
4647                                                  basevertex);
4648         }
4649         ANGLE_CAPTURE(DrawRangeElementsBaseVertexEXT, isCallValid, context, modePacked, start, end,
4650                       count, typePacked, indices, basevertex);
4651     }
4652     else
4653     {
4654         GenerateContextLostErrorOnCurrentGlobalContext();
4655     }
4656 }
4657 
GL_MultiDrawElementsBaseVertexEXT(GLenum mode,const GLsizei * count,GLenum type,const void * const * indices,GLsizei primcount,const GLint * basevertex)4658 void GL_APIENTRY GL_MultiDrawElementsBaseVertexEXT(GLenum mode,
4659                                                    const GLsizei *count,
4660                                                    GLenum type,
4661                                                    const void *const *indices,
4662                                                    GLsizei primcount,
4663                                                    const GLint *basevertex)
4664 {
4665     Context *context = GetValidGlobalContext();
4666     EVENT(context, GLMultiDrawElementsBaseVertexEXT,
4667           "context = %d, mode = %s, count = 0x%016" PRIxPTR ", type = %s, indices = 0x%016" PRIxPTR
4668           ", primcount = %d, basevertex = 0x%016" PRIxPTR "",
4669           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), (uintptr_t)count,
4670           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices, primcount,
4671           (uintptr_t)basevertex);
4672 
4673     if (context)
4674     {
4675         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
4676         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
4677         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4678         bool isCallValid = (context->skipValidation() || ValidateMultiDrawElementsBaseVertexEXT(
4679                                                              context, modePacked, count, typePacked,
4680                                                              indices, primcount, basevertex));
4681         if (isCallValid)
4682         {
4683             context->multiDrawElementsBaseVertex(modePacked, count, typePacked, indices, primcount,
4684                                                  basevertex);
4685         }
4686         ANGLE_CAPTURE(MultiDrawElementsBaseVertexEXT, isCallValid, context, modePacked, count,
4687                       typePacked, indices, primcount, basevertex);
4688     }
4689     else
4690     {
4691         GenerateContextLostErrorOnCurrentGlobalContext();
4692     }
4693 }
4694 
4695 // GL_EXT_external_buffer
GL_BufferStorageExternalEXT(GLenum target,GLintptr offset,GLsizeiptr size,GLeglClientBufferEXT clientBuffer,GLbitfield flags)4696 void GL_APIENTRY GL_BufferStorageExternalEXT(GLenum target,
4697                                              GLintptr offset,
4698                                              GLsizeiptr size,
4699                                              GLeglClientBufferEXT clientBuffer,
4700                                              GLbitfield flags)
4701 {
4702     Context *context = GetValidGlobalContext();
4703     EVENT(context, GLBufferStorageExternalEXT,
4704           "context = %d, target = %s, offset = %llu, size = %llu, clientBuffer = 0x%016" PRIxPTR
4705           ", flags = %s",
4706           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target),
4707           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size),
4708           (uintptr_t)clientBuffer,
4709           GLbitfieldToString(GLenumGroup::MapBufferUsageMask, flags).c_str());
4710 
4711     if (context)
4712     {
4713         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
4714         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4715         bool isCallValid                                      = (context->skipValidation() ||
4716                             ValidateBufferStorageExternalEXT(context, targetPacked, offset, size,
4717                                                              clientBuffer, flags));
4718         if (isCallValid)
4719         {
4720             context->bufferStorageExternal(targetPacked, offset, size, clientBuffer, flags);
4721         }
4722         ANGLE_CAPTURE(BufferStorageExternalEXT, isCallValid, context, targetPacked, offset, size,
4723                       clientBuffer, flags);
4724     }
4725     else
4726     {
4727         GenerateContextLostErrorOnCurrentGlobalContext();
4728     }
4729 }
4730 
GL_NamedBufferStorageExternalEXT(GLuint buffer,GLintptr offset,GLsizeiptr size,GLeglClientBufferEXT clientBuffer,GLbitfield flags)4731 void GL_APIENTRY GL_NamedBufferStorageExternalEXT(GLuint buffer,
4732                                                   GLintptr offset,
4733                                                   GLsizeiptr size,
4734                                                   GLeglClientBufferEXT clientBuffer,
4735                                                   GLbitfield flags)
4736 {
4737     Context *context = GetValidGlobalContext();
4738     EVENT(context, GLNamedBufferStorageExternalEXT,
4739           "context = %d, buffer = %u, offset = %llu, size = %llu, clientBuffer = 0x%016" PRIxPTR
4740           ", flags = %s",
4741           CID(context), buffer, static_cast<unsigned long long>(offset),
4742           static_cast<unsigned long long>(size), (uintptr_t)clientBuffer,
4743           GLbitfieldToString(GLenumGroup::MapBufferUsageMask, flags).c_str());
4744 
4745     if (context)
4746     {
4747         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4748         bool isCallValid =
4749             (context->skipValidation() || ValidateNamedBufferStorageExternalEXT(
4750                                               context, buffer, offset, size, clientBuffer, flags));
4751         if (isCallValid)
4752         {
4753             context->namedBufferStorageExternal(buffer, offset, size, clientBuffer, flags);
4754         }
4755         ANGLE_CAPTURE(NamedBufferStorageExternalEXT, isCallValid, context, buffer, offset, size,
4756                       clientBuffer, flags);
4757     }
4758     else
4759     {
4760         GenerateContextLostErrorOnCurrentGlobalContext();
4761     }
4762 }
4763 
4764 // GL_EXT_geometry_shader
GL_FramebufferTextureEXT(GLenum target,GLenum attachment,GLuint texture,GLint level)4765 void GL_APIENTRY GL_FramebufferTextureEXT(GLenum target,
4766                                           GLenum attachment,
4767                                           GLuint texture,
4768                                           GLint level)
4769 {
4770     Context *context = GetValidGlobalContext();
4771     EVENT(context, GLFramebufferTextureEXT,
4772           "context = %d, target = %s, attachment = %s, texture = %u, level = %d", CID(context),
4773           GLenumToString(GLenumGroup::FramebufferTarget, target),
4774           GLenumToString(GLenumGroup::FramebufferAttachment, attachment), texture, level);
4775 
4776     if (context)
4777     {
4778         TextureID texturePacked                               = PackParam<TextureID>(texture);
4779         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4780         bool isCallValid =
4781             (context->skipValidation() ||
4782              ValidateFramebufferTextureEXT(context, target, attachment, texturePacked, level));
4783         if (isCallValid)
4784         {
4785             context->framebufferTexture(target, attachment, texturePacked, level);
4786         }
4787         ANGLE_CAPTURE(FramebufferTextureEXT, isCallValid, context, target, attachment,
4788                       texturePacked, level);
4789     }
4790     else
4791     {
4792         GenerateContextLostErrorOnCurrentGlobalContext();
4793     }
4794 }
4795 
4796 // GL_EXT_instanced_arrays
GL_DrawArraysInstancedEXT(GLenum mode,GLint start,GLsizei count,GLsizei primcount)4797 void GL_APIENTRY GL_DrawArraysInstancedEXT(GLenum mode,
4798                                            GLint start,
4799                                            GLsizei count,
4800                                            GLsizei primcount)
4801 {
4802     Context *context = GetValidGlobalContext();
4803     EVENT(context, GLDrawArraysInstancedEXT,
4804           "context = %d, mode = %s, start = %d, count = %d, primcount = %d", CID(context),
4805           GLenumToString(GLenumGroup::PrimitiveType, mode), start, count, primcount);
4806 
4807     if (context)
4808     {
4809         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
4810         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4811         bool isCallValid =
4812             (context->skipValidation() ||
4813              ValidateDrawArraysInstancedEXT(context, modePacked, start, count, primcount));
4814         if (isCallValid)
4815         {
4816             context->drawArraysInstanced(modePacked, start, count, primcount);
4817         }
4818         ANGLE_CAPTURE(DrawArraysInstancedEXT, isCallValid, context, modePacked, start, count,
4819                       primcount);
4820     }
4821     else
4822     {
4823         GenerateContextLostErrorOnCurrentGlobalContext();
4824     }
4825 }
4826 
GL_DrawElementsInstancedEXT(GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei primcount)4827 void GL_APIENTRY GL_DrawElementsInstancedEXT(GLenum mode,
4828                                              GLsizei count,
4829                                              GLenum type,
4830                                              const void *indices,
4831                                              GLsizei primcount)
4832 {
4833     Context *context = GetValidGlobalContext();
4834     EVENT(context, GLDrawElementsInstancedEXT,
4835           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
4836           ", primcount = %d",
4837           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), count,
4838           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices, primcount);
4839 
4840     if (context)
4841     {
4842         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
4843         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
4844         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4845         bool isCallValid                                      = (context->skipValidation() ||
4846                             ValidateDrawElementsInstancedEXT(context, modePacked, count, typePacked,
4847                                                              indices, primcount));
4848         if (isCallValid)
4849         {
4850             context->drawElementsInstanced(modePacked, count, typePacked, indices, primcount);
4851         }
4852         ANGLE_CAPTURE(DrawElementsInstancedEXT, isCallValid, context, modePacked, count, typePacked,
4853                       indices, primcount);
4854     }
4855     else
4856     {
4857         GenerateContextLostErrorOnCurrentGlobalContext();
4858     }
4859 }
4860 
GL_VertexAttribDivisorEXT(GLuint index,GLuint divisor)4861 void GL_APIENTRY GL_VertexAttribDivisorEXT(GLuint index, GLuint divisor)
4862 {
4863     Context *context = GetValidGlobalContext();
4864     EVENT(context, GLVertexAttribDivisorEXT, "context = %d, index = %u, divisor = %u", CID(context),
4865           index, divisor);
4866 
4867     if (context)
4868     {
4869         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4870         bool isCallValid =
4871             (context->skipValidation() || ValidateVertexAttribDivisorEXT(context, index, divisor));
4872         if (isCallValid)
4873         {
4874             context->vertexAttribDivisor(index, divisor);
4875         }
4876         ANGLE_CAPTURE(VertexAttribDivisorEXT, isCallValid, context, index, divisor);
4877     }
4878     else
4879     {
4880         GenerateContextLostErrorOnCurrentGlobalContext();
4881     }
4882 }
4883 
4884 // GL_EXT_map_buffer_range
GL_FlushMappedBufferRangeEXT(GLenum target,GLintptr offset,GLsizeiptr length)4885 void GL_APIENTRY GL_FlushMappedBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length)
4886 {
4887     Context *context = GetValidGlobalContext();
4888     EVENT(context, GLFlushMappedBufferRangeEXT,
4889           "context = %d, target = %s, offset = %llu, length = %llu", CID(context),
4890           GLenumToString(GLenumGroup::BufferTargetARB, target),
4891           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length));
4892 
4893     if (context)
4894     {
4895         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
4896         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4897         bool isCallValid =
4898             (context->skipValidation() ||
4899              ValidateFlushMappedBufferRangeEXT(context, targetPacked, offset, length));
4900         if (isCallValid)
4901         {
4902             context->flushMappedBufferRange(targetPacked, offset, length);
4903         }
4904         ANGLE_CAPTURE(FlushMappedBufferRangeEXT, isCallValid, context, targetPacked, offset,
4905                       length);
4906     }
4907     else
4908     {
4909         GenerateContextLostErrorOnCurrentGlobalContext();
4910     }
4911 }
4912 
GL_MapBufferRangeEXT(GLenum target,GLintptr offset,GLsizeiptr length,GLbitfield access)4913 void *GL_APIENTRY GL_MapBufferRangeEXT(GLenum target,
4914                                        GLintptr offset,
4915                                        GLsizeiptr length,
4916                                        GLbitfield access)
4917 {
4918     Context *context = GetValidGlobalContext();
4919     EVENT(context, GLMapBufferRangeEXT,
4920           "context = %d, target = %s, offset = %llu, length = %llu, access = %s", CID(context),
4921           GLenumToString(GLenumGroup::BufferTargetARB, target),
4922           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length),
4923           GLbitfieldToString(GLenumGroup::BufferAccessMask, access).c_str());
4924 
4925     void *returnValue;
4926     if (context)
4927     {
4928         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
4929         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4930         bool isCallValid =
4931             (context->skipValidation() ||
4932              ValidateMapBufferRangeEXT(context, targetPacked, offset, length, access));
4933         if (isCallValid)
4934         {
4935             returnValue = context->mapBufferRange(targetPacked, offset, length, access);
4936         }
4937         else
4938         {
4939             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapBufferRangeEXT, void *>();
4940         }
4941         ANGLE_CAPTURE(MapBufferRangeEXT, isCallValid, context, targetPacked, offset, length, access,
4942                       returnValue);
4943     }
4944     else
4945     {
4946         GenerateContextLostErrorOnCurrentGlobalContext();
4947         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapBufferRangeEXT, void *>();
4948     }
4949     return returnValue;
4950 }
4951 
4952 // GL_EXT_memory_object
GL_BufferStorageMemEXT(GLenum target,GLsizeiptr size,GLuint memory,GLuint64 offset)4953 void GL_APIENTRY GL_BufferStorageMemEXT(GLenum target,
4954                                         GLsizeiptr size,
4955                                         GLuint memory,
4956                                         GLuint64 offset)
4957 {
4958     Context *context = GetValidGlobalContext();
4959     EVENT(context, GLBufferStorageMemEXT,
4960           "context = %d, target = %s, size = %llu, memory = %u, offset = %llu", CID(context),
4961           GLenumToString(GLenumGroup::BufferTargetARB, target),
4962           static_cast<unsigned long long>(size), memory, static_cast<unsigned long long>(offset));
4963 
4964     if (context)
4965     {
4966         TextureType targetPacked                              = PackParam<TextureType>(target);
4967         MemoryObjectID memoryPacked                           = PackParam<MemoryObjectID>(memory);
4968         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4969         bool isCallValid =
4970             (context->skipValidation() ||
4971              ValidateBufferStorageMemEXT(context, targetPacked, size, memoryPacked, offset));
4972         if (isCallValid)
4973         {
4974             context->bufferStorageMem(targetPacked, size, memoryPacked, offset);
4975         }
4976         ANGLE_CAPTURE(BufferStorageMemEXT, isCallValid, context, targetPacked, size, memoryPacked,
4977                       offset);
4978     }
4979     else
4980     {
4981         GenerateContextLostErrorOnCurrentGlobalContext();
4982     }
4983 }
4984 
GL_CreateMemoryObjectsEXT(GLsizei n,GLuint * memoryObjects)4985 void GL_APIENTRY GL_CreateMemoryObjectsEXT(GLsizei n, GLuint *memoryObjects)
4986 {
4987     Context *context = GetValidGlobalContext();
4988     EVENT(context, GLCreateMemoryObjectsEXT,
4989           "context = %d, n = %d, memoryObjects = 0x%016" PRIxPTR "", CID(context), n,
4990           (uintptr_t)memoryObjects);
4991 
4992     if (context)
4993     {
4994         MemoryObjectID *memoryObjectsPacked = PackParam<MemoryObjectID *>(memoryObjects);
4995         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
4996         bool isCallValid                                      = (context->skipValidation() ||
4997                             ValidateCreateMemoryObjectsEXT(context, n, memoryObjectsPacked));
4998         if (isCallValid)
4999         {
5000             context->createMemoryObjects(n, memoryObjectsPacked);
5001         }
5002         ANGLE_CAPTURE(CreateMemoryObjectsEXT, isCallValid, context, n, memoryObjectsPacked);
5003     }
5004     else
5005     {
5006         GenerateContextLostErrorOnCurrentGlobalContext();
5007     }
5008 }
5009 
GL_DeleteMemoryObjectsEXT(GLsizei n,const GLuint * memoryObjects)5010 void GL_APIENTRY GL_DeleteMemoryObjectsEXT(GLsizei n, const GLuint *memoryObjects)
5011 {
5012     Context *context = GetValidGlobalContext();
5013     EVENT(context, GLDeleteMemoryObjectsEXT,
5014           "context = %d, n = %d, memoryObjects = 0x%016" PRIxPTR "", CID(context), n,
5015           (uintptr_t)memoryObjects);
5016 
5017     if (context)
5018     {
5019         const MemoryObjectID *memoryObjectsPacked =
5020             PackParam<const MemoryObjectID *>(memoryObjects);
5021         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5022         bool isCallValid                                      = (context->skipValidation() ||
5023                             ValidateDeleteMemoryObjectsEXT(context, n, memoryObjectsPacked));
5024         if (isCallValid)
5025         {
5026             context->deleteMemoryObjects(n, memoryObjectsPacked);
5027         }
5028         ANGLE_CAPTURE(DeleteMemoryObjectsEXT, isCallValid, context, n, memoryObjectsPacked);
5029     }
5030     else
5031     {
5032         GenerateContextLostErrorOnCurrentGlobalContext();
5033     }
5034 }
5035 
GL_GetMemoryObjectParameterivEXT(GLuint memoryObject,GLenum pname,GLint * params)5036 void GL_APIENTRY GL_GetMemoryObjectParameterivEXT(GLuint memoryObject, GLenum pname, GLint *params)
5037 {
5038     Context *context = GetValidGlobalContext();
5039     EVENT(context, GLGetMemoryObjectParameterivEXT,
5040           "context = %d, memoryObject = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
5041           memoryObject, GLenumToString(GLenumGroup::MemoryObjectParameterName, pname),
5042           (uintptr_t)params);
5043 
5044     if (context)
5045     {
5046         MemoryObjectID memoryObjectPacked = PackParam<MemoryObjectID>(memoryObject);
5047         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5048         bool isCallValid =
5049             (context->skipValidation() ||
5050              ValidateGetMemoryObjectParameterivEXT(context, memoryObjectPacked, pname, params));
5051         if (isCallValid)
5052         {
5053             context->getMemoryObjectParameteriv(memoryObjectPacked, pname, params);
5054         }
5055         ANGLE_CAPTURE(GetMemoryObjectParameterivEXT, isCallValid, context, memoryObjectPacked,
5056                       pname, params);
5057     }
5058     else
5059     {
5060         GenerateContextLostErrorOnCurrentGlobalContext();
5061     }
5062 }
5063 
GL_GetUnsignedBytevEXT(GLenum pname,GLubyte * data)5064 void GL_APIENTRY GL_GetUnsignedBytevEXT(GLenum pname, GLubyte *data)
5065 {
5066     Context *context = GetValidGlobalContext();
5067     EVENT(context, GLGetUnsignedBytevEXT, "context = %d, pname = %s, data = 0x%016" PRIxPTR "",
5068           CID(context), GLenumToString(GLenumGroup::GetPName, pname), (uintptr_t)data);
5069 
5070     if (context)
5071     {
5072         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5073         bool isCallValid =
5074             (context->skipValidation() || ValidateGetUnsignedBytevEXT(context, pname, data));
5075         if (isCallValid)
5076         {
5077             context->getUnsignedBytev(pname, data);
5078         }
5079         ANGLE_CAPTURE(GetUnsignedBytevEXT, isCallValid, context, pname, data);
5080     }
5081     else
5082     {
5083         GenerateContextLostErrorOnCurrentGlobalContext();
5084     }
5085 }
5086 
GL_GetUnsignedBytei_vEXT(GLenum target,GLuint index,GLubyte * data)5087 void GL_APIENTRY GL_GetUnsignedBytei_vEXT(GLenum target, GLuint index, GLubyte *data)
5088 {
5089     Context *context = GetValidGlobalContext();
5090     EVENT(context, GLGetUnsignedBytei_vEXT,
5091           "context = %d, target = %s, index = %u, data = 0x%016" PRIxPTR "", CID(context),
5092           GLenumToString(GLenumGroup::DefaultGroup, target), index, (uintptr_t)data);
5093 
5094     if (context)
5095     {
5096         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5097         bool isCallValid                                      = (context->skipValidation() ||
5098                             ValidateGetUnsignedBytei_vEXT(context, target, index, data));
5099         if (isCallValid)
5100         {
5101             context->getUnsignedBytei_v(target, index, data);
5102         }
5103         ANGLE_CAPTURE(GetUnsignedBytei_vEXT, isCallValid, context, target, index, data);
5104     }
5105     else
5106     {
5107         GenerateContextLostErrorOnCurrentGlobalContext();
5108     }
5109 }
5110 
GL_IsMemoryObjectEXT(GLuint memoryObject)5111 GLboolean GL_APIENTRY GL_IsMemoryObjectEXT(GLuint memoryObject)
5112 {
5113     Context *context = GetValidGlobalContext();
5114     EVENT(context, GLIsMemoryObjectEXT, "context = %d, memoryObject = %u", CID(context),
5115           memoryObject);
5116 
5117     GLboolean returnValue;
5118     if (context)
5119     {
5120         MemoryObjectID memoryObjectPacked = PackParam<MemoryObjectID>(memoryObject);
5121         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5122         bool isCallValid =
5123             (context->skipValidation() || ValidateIsMemoryObjectEXT(context, memoryObjectPacked));
5124         if (isCallValid)
5125         {
5126             returnValue = context->isMemoryObject(memoryObjectPacked);
5127         }
5128         else
5129         {
5130             returnValue =
5131                 GetDefaultReturnValue<angle::EntryPoint::GLIsMemoryObjectEXT, GLboolean>();
5132         }
5133         ANGLE_CAPTURE(IsMemoryObjectEXT, isCallValid, context, memoryObjectPacked, returnValue);
5134     }
5135     else
5136     {
5137         GenerateContextLostErrorOnCurrentGlobalContext();
5138         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsMemoryObjectEXT, GLboolean>();
5139     }
5140     return returnValue;
5141 }
5142 
GL_MemoryObjectParameterivEXT(GLuint memoryObject,GLenum pname,const GLint * params)5143 void GL_APIENTRY GL_MemoryObjectParameterivEXT(GLuint memoryObject,
5144                                                GLenum pname,
5145                                                const GLint *params)
5146 {
5147     Context *context = GetValidGlobalContext();
5148     EVENT(context, GLMemoryObjectParameterivEXT,
5149           "context = %d, memoryObject = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
5150           memoryObject, GLenumToString(GLenumGroup::MemoryObjectParameterName, pname),
5151           (uintptr_t)params);
5152 
5153     if (context)
5154     {
5155         MemoryObjectID memoryObjectPacked = PackParam<MemoryObjectID>(memoryObject);
5156         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5157         bool isCallValid =
5158             (context->skipValidation() ||
5159              ValidateMemoryObjectParameterivEXT(context, memoryObjectPacked, pname, params));
5160         if (isCallValid)
5161         {
5162             context->memoryObjectParameteriv(memoryObjectPacked, pname, params);
5163         }
5164         ANGLE_CAPTURE(MemoryObjectParameterivEXT, isCallValid, context, memoryObjectPacked, pname,
5165                       params);
5166     }
5167     else
5168     {
5169         GenerateContextLostErrorOnCurrentGlobalContext();
5170     }
5171 }
5172 
GL_TexStorageMem2DEXT(GLenum target,GLsizei levels,GLenum internalFormat,GLsizei width,GLsizei height,GLuint memory,GLuint64 offset)5173 void GL_APIENTRY GL_TexStorageMem2DEXT(GLenum target,
5174                                        GLsizei levels,
5175                                        GLenum internalFormat,
5176                                        GLsizei width,
5177                                        GLsizei height,
5178                                        GLuint memory,
5179                                        GLuint64 offset)
5180 {
5181     Context *context = GetValidGlobalContext();
5182     EVENT(context, GLTexStorageMem2DEXT,
5183           "context = %d, target = %s, levels = %d, internalFormat = %s, width = %d, height = %d, "
5184           "memory = %u, offset = %llu",
5185           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), levels,
5186           GLenumToString(GLenumGroup::DefaultGroup, internalFormat), width, height, memory,
5187           static_cast<unsigned long long>(offset));
5188 
5189     if (context)
5190     {
5191         TextureType targetPacked                              = PackParam<TextureType>(target);
5192         MemoryObjectID memoryPacked                           = PackParam<MemoryObjectID>(memory);
5193         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5194         bool isCallValid =
5195             (context->skipValidation() ||
5196              ValidateTexStorageMem2DEXT(context, targetPacked, levels, internalFormat, width,
5197                                         height, memoryPacked, offset));
5198         if (isCallValid)
5199         {
5200             context->texStorageMem2D(targetPacked, levels, internalFormat, width, height,
5201                                      memoryPacked, offset);
5202         }
5203         ANGLE_CAPTURE(TexStorageMem2DEXT, isCallValid, context, targetPacked, levels,
5204                       internalFormat, width, height, memoryPacked, offset);
5205     }
5206     else
5207     {
5208         GenerateContextLostErrorOnCurrentGlobalContext();
5209     }
5210 }
5211 
GL_TexStorageMem2DMultisampleEXT(GLenum target,GLsizei samples,GLenum internalFormat,GLsizei width,GLsizei height,GLboolean fixedSampleLocations,GLuint memory,GLuint64 offset)5212 void GL_APIENTRY GL_TexStorageMem2DMultisampleEXT(GLenum target,
5213                                                   GLsizei samples,
5214                                                   GLenum internalFormat,
5215                                                   GLsizei width,
5216                                                   GLsizei height,
5217                                                   GLboolean fixedSampleLocations,
5218                                                   GLuint memory,
5219                                                   GLuint64 offset)
5220 {
5221     Context *context = GetValidGlobalContext();
5222     EVENT(context, GLTexStorageMem2DMultisampleEXT,
5223           "context = %d, target = %s, samples = %d, internalFormat = %s, width = %d, height = %d, "
5224           "fixedSampleLocations = %s, memory = %u, offset = %llu",
5225           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), samples,
5226           GLenumToString(GLenumGroup::DefaultGroup, internalFormat), width, height,
5227           GLbooleanToString(fixedSampleLocations), memory, static_cast<unsigned long long>(offset));
5228 
5229     if (context)
5230     {
5231         TextureType targetPacked                              = PackParam<TextureType>(target);
5232         MemoryObjectID memoryPacked                           = PackParam<MemoryObjectID>(memory);
5233         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5234         bool isCallValid =
5235             (context->skipValidation() || ValidateTexStorageMem2DMultisampleEXT(
5236                                               context, targetPacked, samples, internalFormat, width,
5237                                               height, fixedSampleLocations, memoryPacked, offset));
5238         if (isCallValid)
5239         {
5240             context->texStorageMem2DMultisample(targetPacked, samples, internalFormat, width,
5241                                                 height, fixedSampleLocations, memoryPacked, offset);
5242         }
5243         ANGLE_CAPTURE(TexStorageMem2DMultisampleEXT, isCallValid, context, targetPacked, samples,
5244                       internalFormat, width, height, fixedSampleLocations, memoryPacked, offset);
5245     }
5246     else
5247     {
5248         GenerateContextLostErrorOnCurrentGlobalContext();
5249     }
5250 }
5251 
GL_TexStorageMem3DEXT(GLenum target,GLsizei levels,GLenum internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLuint memory,GLuint64 offset)5252 void GL_APIENTRY GL_TexStorageMem3DEXT(GLenum target,
5253                                        GLsizei levels,
5254                                        GLenum internalFormat,
5255                                        GLsizei width,
5256                                        GLsizei height,
5257                                        GLsizei depth,
5258                                        GLuint memory,
5259                                        GLuint64 offset)
5260 {
5261     Context *context = GetValidGlobalContext();
5262     EVENT(context, GLTexStorageMem3DEXT,
5263           "context = %d, target = %s, levels = %d, internalFormat = %s, width = %d, height = %d, "
5264           "depth = %d, memory = %u, offset = %llu",
5265           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), levels,
5266           GLenumToString(GLenumGroup::DefaultGroup, internalFormat), width, height, depth, memory,
5267           static_cast<unsigned long long>(offset));
5268 
5269     if (context)
5270     {
5271         TextureType targetPacked                              = PackParam<TextureType>(target);
5272         MemoryObjectID memoryPacked                           = PackParam<MemoryObjectID>(memory);
5273         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5274         bool isCallValid =
5275             (context->skipValidation() ||
5276              ValidateTexStorageMem3DEXT(context, targetPacked, levels, internalFormat, width,
5277                                         height, depth, memoryPacked, offset));
5278         if (isCallValid)
5279         {
5280             context->texStorageMem3D(targetPacked, levels, internalFormat, width, height, depth,
5281                                      memoryPacked, offset);
5282         }
5283         ANGLE_CAPTURE(TexStorageMem3DEXT, isCallValid, context, targetPacked, levels,
5284                       internalFormat, width, height, depth, memoryPacked, offset);
5285     }
5286     else
5287     {
5288         GenerateContextLostErrorOnCurrentGlobalContext();
5289     }
5290 }
5291 
GL_TexStorageMem3DMultisampleEXT(GLenum target,GLsizei samples,GLenum internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLboolean fixedSampleLocations,GLuint memory,GLuint64 offset)5292 void GL_APIENTRY GL_TexStorageMem3DMultisampleEXT(GLenum target,
5293                                                   GLsizei samples,
5294                                                   GLenum internalFormat,
5295                                                   GLsizei width,
5296                                                   GLsizei height,
5297                                                   GLsizei depth,
5298                                                   GLboolean fixedSampleLocations,
5299                                                   GLuint memory,
5300                                                   GLuint64 offset)
5301 {
5302     Context *context = GetValidGlobalContext();
5303     EVENT(context, GLTexStorageMem3DMultisampleEXT,
5304           "context = %d, target = %s, samples = %d, internalFormat = %s, width = %d, height = %d, "
5305           "depth = %d, fixedSampleLocations = %s, memory = %u, offset = %llu",
5306           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), samples,
5307           GLenumToString(GLenumGroup::DefaultGroup, internalFormat), width, height, depth,
5308           GLbooleanToString(fixedSampleLocations), memory, static_cast<unsigned long long>(offset));
5309 
5310     if (context)
5311     {
5312         TextureType targetPacked                              = PackParam<TextureType>(target);
5313         MemoryObjectID memoryPacked                           = PackParam<MemoryObjectID>(memory);
5314         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5315         bool isCallValid                                      = (context->skipValidation() ||
5316                             ValidateTexStorageMem3DMultisampleEXT(
5317                                 context, targetPacked, samples, internalFormat, width, height,
5318                                 depth, fixedSampleLocations, memoryPacked, offset));
5319         if (isCallValid)
5320         {
5321             context->texStorageMem3DMultisample(targetPacked, samples, internalFormat, width,
5322                                                 height, depth, fixedSampleLocations, memoryPacked,
5323                                                 offset);
5324         }
5325         ANGLE_CAPTURE(TexStorageMem3DMultisampleEXT, isCallValid, context, targetPacked, samples,
5326                       internalFormat, width, height, depth, fixedSampleLocations, memoryPacked,
5327                       offset);
5328     }
5329     else
5330     {
5331         GenerateContextLostErrorOnCurrentGlobalContext();
5332     }
5333 }
5334 
5335 // GL_EXT_memory_object_fd
GL_ImportMemoryFdEXT(GLuint memory,GLuint64 size,GLenum handleType,GLint fd)5336 void GL_APIENTRY GL_ImportMemoryFdEXT(GLuint memory, GLuint64 size, GLenum handleType, GLint fd)
5337 {
5338     Context *context = GetValidGlobalContext();
5339     EVENT(context, GLImportMemoryFdEXT,
5340           "context = %d, memory = %u, size = %llu, handleType = %s, fd = %d", CID(context), memory,
5341           static_cast<unsigned long long>(size),
5342           GLenumToString(GLenumGroup::ExternalHandleType, handleType), fd);
5343 
5344     if (context)
5345     {
5346         MemoryObjectID memoryPacked                           = PackParam<MemoryObjectID>(memory);
5347         HandleType handleTypePacked                           = PackParam<HandleType>(handleType);
5348         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5349         bool isCallValid =
5350             (context->skipValidation() ||
5351              ValidateImportMemoryFdEXT(context, memoryPacked, size, handleTypePacked, fd));
5352         if (isCallValid)
5353         {
5354             context->importMemoryFd(memoryPacked, size, handleTypePacked, fd);
5355         }
5356         ANGLE_CAPTURE(ImportMemoryFdEXT, isCallValid, context, memoryPacked, size, handleTypePacked,
5357                       fd);
5358     }
5359     else
5360     {
5361         GenerateContextLostErrorOnCurrentGlobalContext();
5362     }
5363 }
5364 
5365 // GL_EXT_multisampled_render_to_texture
GL_FramebufferTexture2DMultisampleEXT(GLenum target,GLenum attachment,GLenum textarget,GLuint texture,GLint level,GLsizei samples)5366 void GL_APIENTRY GL_FramebufferTexture2DMultisampleEXT(GLenum target,
5367                                                        GLenum attachment,
5368                                                        GLenum textarget,
5369                                                        GLuint texture,
5370                                                        GLint level,
5371                                                        GLsizei samples)
5372 {
5373     Context *context = GetValidGlobalContext();
5374     EVENT(context, GLFramebufferTexture2DMultisampleEXT,
5375           "context = %d, target = %s, attachment = %s, textarget = %s, texture = %u, level = %d, "
5376           "samples = %d",
5377           CID(context), GLenumToString(GLenumGroup::FramebufferTarget, target),
5378           GLenumToString(GLenumGroup::FramebufferAttachment, attachment),
5379           GLenumToString(GLenumGroup::TextureTarget, textarget), texture, level, samples);
5380 
5381     if (context)
5382     {
5383         TextureTarget textargetPacked                         = PackParam<TextureTarget>(textarget);
5384         TextureID texturePacked                               = PackParam<TextureID>(texture);
5385         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5386         bool isCallValid =
5387             (context->skipValidation() ||
5388              ValidateFramebufferTexture2DMultisampleEXT(
5389                  context, target, attachment, textargetPacked, texturePacked, level, samples));
5390         if (isCallValid)
5391         {
5392             context->framebufferTexture2DMultisample(target, attachment, textargetPacked,
5393                                                      texturePacked, level, samples);
5394         }
5395         ANGLE_CAPTURE(FramebufferTexture2DMultisampleEXT, isCallValid, context, target, attachment,
5396                       textargetPacked, texturePacked, level, samples);
5397     }
5398     else
5399     {
5400         GenerateContextLostErrorOnCurrentGlobalContext();
5401     }
5402 }
5403 
GL_RenderbufferStorageMultisampleEXT(GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height)5404 void GL_APIENTRY GL_RenderbufferStorageMultisampleEXT(GLenum target,
5405                                                       GLsizei samples,
5406                                                       GLenum internalformat,
5407                                                       GLsizei width,
5408                                                       GLsizei height)
5409 {
5410     Context *context = GetValidGlobalContext();
5411     EVENT(context, GLRenderbufferStorageMultisampleEXT,
5412           "context = %d, target = %s, samples = %d, internalformat = %s, width = %d, height = %d",
5413           CID(context), GLenumToString(GLenumGroup::RenderbufferTarget, target), samples,
5414           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height);
5415 
5416     if (context)
5417     {
5418         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5419         bool isCallValid                                      = (context->skipValidation() ||
5420                             ValidateRenderbufferStorageMultisampleEXT(
5421                                 context, target, samples, internalformat, width, height));
5422         if (isCallValid)
5423         {
5424             context->renderbufferStorageMultisampleEXT(target, samples, internalformat, width,
5425                                                        height);
5426         }
5427         ANGLE_CAPTURE(RenderbufferStorageMultisampleEXT, isCallValid, context, target, samples,
5428                       internalformat, width, height);
5429     }
5430     else
5431     {
5432         GenerateContextLostErrorOnCurrentGlobalContext();
5433     }
5434 }
5435 
5436 // GL_EXT_occlusion_query_boolean
5437 // BeginQueryEXT is already defined.
5438 
5439 // DeleteQueriesEXT is already defined.
5440 
5441 // EndQueryEXT is already defined.
5442 
5443 // GenQueriesEXT is already defined.
5444 
5445 // GetQueryObjectuivEXT is already defined.
5446 
5447 // GetQueryivEXT is already defined.
5448 
5449 // IsQueryEXT is already defined.
5450 
5451 // GL_EXT_primitive_bounding_box
GL_PrimitiveBoundingBoxEXT(GLfloat minX,GLfloat minY,GLfloat minZ,GLfloat minW,GLfloat maxX,GLfloat maxY,GLfloat maxZ,GLfloat maxW)5452 void GL_APIENTRY GL_PrimitiveBoundingBoxEXT(GLfloat minX,
5453                                             GLfloat minY,
5454                                             GLfloat minZ,
5455                                             GLfloat minW,
5456                                             GLfloat maxX,
5457                                             GLfloat maxY,
5458                                             GLfloat maxZ,
5459                                             GLfloat maxW)
5460 {
5461     Context *context = GetValidGlobalContext();
5462     EVENT(context, GLPrimitiveBoundingBoxEXT,
5463           "context = %d, minX = %f, minY = %f, minZ = %f, minW = %f, maxX = %f, maxY = %f, maxZ = "
5464           "%f, maxW = %f",
5465           CID(context), minX, minY, minZ, minW, maxX, maxY, maxZ, maxW);
5466 
5467     if (context)
5468     {
5469         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5470         bool isCallValid                                      = (context->skipValidation() ||
5471                             ValidatePrimitiveBoundingBoxEXT(context, minX, minY, minZ, minW, maxX,
5472                                                             maxY, maxZ, maxW));
5473         if (isCallValid)
5474         {
5475             context->primitiveBoundingBox(minX, minY, minZ, minW, maxX, maxY, maxZ, maxW);
5476         }
5477         ANGLE_CAPTURE(PrimitiveBoundingBoxEXT, isCallValid, context, minX, minY, minZ, minW, maxX,
5478                       maxY, maxZ, maxW);
5479     }
5480     else
5481     {
5482         GenerateContextLostErrorOnCurrentGlobalContext();
5483     }
5484 }
5485 
5486 // GL_EXT_read_format_bgra
5487 
5488 // GL_EXT_robustness
GL_GetGraphicsResetStatusEXT()5489 GLenum GL_APIENTRY GL_GetGraphicsResetStatusEXT()
5490 {
5491     Context *context = GetGlobalContext();
5492     EVENT(context, GLGetGraphicsResetStatusEXT, "context = %d", CID(context));
5493 
5494     GLenum returnValue;
5495     if (context)
5496     {
5497         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5498         bool isCallValid =
5499             (context->skipValidation() || ValidateGetGraphicsResetStatusEXT(context));
5500         if (isCallValid)
5501         {
5502             returnValue = context->getGraphicsResetStatus();
5503         }
5504         else
5505         {
5506             returnValue =
5507                 GetDefaultReturnValue<angle::EntryPoint::GLGetGraphicsResetStatusEXT, GLenum>();
5508         }
5509         ANGLE_CAPTURE(GetGraphicsResetStatusEXT, isCallValid, context, returnValue);
5510     }
5511     else
5512     {
5513 
5514         returnValue =
5515             GetDefaultReturnValue<angle::EntryPoint::GLGetGraphicsResetStatusEXT, GLenum>();
5516     }
5517     return returnValue;
5518 }
5519 
GL_GetnUniformfvEXT(GLuint program,GLint location,GLsizei bufSize,GLfloat * params)5520 void GL_APIENTRY GL_GetnUniformfvEXT(GLuint program,
5521                                      GLint location,
5522                                      GLsizei bufSize,
5523                                      GLfloat *params)
5524 {
5525     Context *context = GetValidGlobalContext();
5526     EVENT(context, GLGetnUniformfvEXT,
5527           "context = %d, program = %u, location = %d, bufSize = %d, params = 0x%016" PRIxPTR "",
5528           CID(context), program, location, bufSize, (uintptr_t)params);
5529 
5530     if (context)
5531     {
5532         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
5533         UniformLocation locationPacked = PackParam<UniformLocation>(location);
5534         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5535         bool isCallValid =
5536             (context->skipValidation() ||
5537              ValidateGetnUniformfvEXT(context, programPacked, locationPacked, bufSize, params));
5538         if (isCallValid)
5539         {
5540             context->getnUniformfv(programPacked, locationPacked, bufSize, params);
5541         }
5542         ANGLE_CAPTURE(GetnUniformfvEXT, isCallValid, context, programPacked, locationPacked,
5543                       bufSize, params);
5544     }
5545     else
5546     {
5547         GenerateContextLostErrorOnCurrentGlobalContext();
5548     }
5549 }
5550 
GL_GetnUniformivEXT(GLuint program,GLint location,GLsizei bufSize,GLint * params)5551 void GL_APIENTRY GL_GetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint *params)
5552 {
5553     Context *context = GetValidGlobalContext();
5554     EVENT(context, GLGetnUniformivEXT,
5555           "context = %d, program = %u, location = %d, bufSize = %d, params = 0x%016" PRIxPTR "",
5556           CID(context), program, location, bufSize, (uintptr_t)params);
5557 
5558     if (context)
5559     {
5560         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
5561         UniformLocation locationPacked = PackParam<UniformLocation>(location);
5562         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5563         bool isCallValid =
5564             (context->skipValidation() ||
5565              ValidateGetnUniformivEXT(context, programPacked, locationPacked, bufSize, params));
5566         if (isCallValid)
5567         {
5568             context->getnUniformiv(programPacked, locationPacked, bufSize, params);
5569         }
5570         ANGLE_CAPTURE(GetnUniformivEXT, isCallValid, context, programPacked, locationPacked,
5571                       bufSize, params);
5572     }
5573     else
5574     {
5575         GenerateContextLostErrorOnCurrentGlobalContext();
5576     }
5577 }
5578 
GL_ReadnPixelsEXT(GLint x,GLint y,GLsizei width,GLsizei height,GLenum format,GLenum type,GLsizei bufSize,void * data)5579 void GL_APIENTRY GL_ReadnPixelsEXT(GLint x,
5580                                    GLint y,
5581                                    GLsizei width,
5582                                    GLsizei height,
5583                                    GLenum format,
5584                                    GLenum type,
5585                                    GLsizei bufSize,
5586                                    void *data)
5587 {
5588     Context *context = GetValidGlobalContext();
5589     EVENT(context, GLReadnPixelsEXT,
5590           "context = %d, x = %d, y = %d, width = %d, height = %d, format = %s, type = %s, bufSize "
5591           "= %d, data = 0x%016" PRIxPTR "",
5592           CID(context), x, y, width, height, GLenumToString(GLenumGroup::PixelFormat, format),
5593           GLenumToString(GLenumGroup::PixelType, type), bufSize, (uintptr_t)data);
5594 
5595     if (context)
5596     {
5597         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5598         bool isCallValid =
5599             (context->skipValidation() ||
5600              ValidateReadnPixelsEXT(context, x, y, width, height, format, type, bufSize, data));
5601         if (isCallValid)
5602         {
5603             context->readnPixels(x, y, width, height, format, type, bufSize, data);
5604         }
5605         ANGLE_CAPTURE(ReadnPixelsEXT, isCallValid, context, x, y, width, height, format, type,
5606                       bufSize, data);
5607     }
5608     else
5609     {
5610         GenerateContextLostErrorOnCurrentGlobalContext();
5611     }
5612 }
5613 
5614 // GL_EXT_sRGB
5615 
5616 // GL_EXT_sRGB_write_control
5617 
5618 // GL_EXT_semaphore
GL_DeleteSemaphoresEXT(GLsizei n,const GLuint * semaphores)5619 void GL_APIENTRY GL_DeleteSemaphoresEXT(GLsizei n, const GLuint *semaphores)
5620 {
5621     Context *context = GetValidGlobalContext();
5622     EVENT(context, GLDeleteSemaphoresEXT, "context = %d, n = %d, semaphores = 0x%016" PRIxPTR "",
5623           CID(context), n, (uintptr_t)semaphores);
5624 
5625     if (context)
5626     {
5627         const SemaphoreID *semaphoresPacked = PackParam<const SemaphoreID *>(semaphores);
5628         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5629         bool isCallValid                                      = (context->skipValidation() ||
5630                             ValidateDeleteSemaphoresEXT(context, n, semaphoresPacked));
5631         if (isCallValid)
5632         {
5633             context->deleteSemaphores(n, semaphoresPacked);
5634         }
5635         ANGLE_CAPTURE(DeleteSemaphoresEXT, isCallValid, context, n, semaphoresPacked);
5636     }
5637     else
5638     {
5639         GenerateContextLostErrorOnCurrentGlobalContext();
5640     }
5641 }
5642 
GL_GenSemaphoresEXT(GLsizei n,GLuint * semaphores)5643 void GL_APIENTRY GL_GenSemaphoresEXT(GLsizei n, GLuint *semaphores)
5644 {
5645     Context *context = GetValidGlobalContext();
5646     EVENT(context, GLGenSemaphoresEXT, "context = %d, n = %d, semaphores = 0x%016" PRIxPTR "",
5647           CID(context), n, (uintptr_t)semaphores);
5648 
5649     if (context)
5650     {
5651         SemaphoreID *semaphoresPacked = PackParam<SemaphoreID *>(semaphores);
5652         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5653         bool isCallValid =
5654             (context->skipValidation() || ValidateGenSemaphoresEXT(context, n, semaphoresPacked));
5655         if (isCallValid)
5656         {
5657             context->genSemaphores(n, semaphoresPacked);
5658         }
5659         ANGLE_CAPTURE(GenSemaphoresEXT, isCallValid, context, n, semaphoresPacked);
5660     }
5661     else
5662     {
5663         GenerateContextLostErrorOnCurrentGlobalContext();
5664     }
5665 }
5666 
GL_GetSemaphoreParameterui64vEXT(GLuint semaphore,GLenum pname,GLuint64 * params)5667 void GL_APIENTRY GL_GetSemaphoreParameterui64vEXT(GLuint semaphore, GLenum pname, GLuint64 *params)
5668 {
5669     Context *context = GetValidGlobalContext();
5670     EVENT(context, GLGetSemaphoreParameterui64vEXT,
5671           "context = %d, semaphore = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
5672           semaphore, GLenumToString(GLenumGroup::SemaphoreParameterName, pname), (uintptr_t)params);
5673 
5674     if (context)
5675     {
5676         SemaphoreID semaphorePacked                           = PackParam<SemaphoreID>(semaphore);
5677         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5678         bool isCallValid =
5679             (context->skipValidation() ||
5680              ValidateGetSemaphoreParameterui64vEXT(context, semaphorePacked, pname, params));
5681         if (isCallValid)
5682         {
5683             context->getSemaphoreParameterui64v(semaphorePacked, pname, params);
5684         }
5685         ANGLE_CAPTURE(GetSemaphoreParameterui64vEXT, isCallValid, context, semaphorePacked, pname,
5686                       params);
5687     }
5688     else
5689     {
5690         GenerateContextLostErrorOnCurrentGlobalContext();
5691     }
5692 }
5693 
GL_IsSemaphoreEXT(GLuint semaphore)5694 GLboolean GL_APIENTRY GL_IsSemaphoreEXT(GLuint semaphore)
5695 {
5696     Context *context = GetValidGlobalContext();
5697     EVENT(context, GLIsSemaphoreEXT, "context = %d, semaphore = %u", CID(context), semaphore);
5698 
5699     GLboolean returnValue;
5700     if (context)
5701     {
5702         SemaphoreID semaphorePacked                           = PackParam<SemaphoreID>(semaphore);
5703         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5704         bool isCallValid =
5705             (context->skipValidation() || ValidateIsSemaphoreEXT(context, semaphorePacked));
5706         if (isCallValid)
5707         {
5708             returnValue = context->isSemaphore(semaphorePacked);
5709         }
5710         else
5711         {
5712             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsSemaphoreEXT, GLboolean>();
5713         }
5714         ANGLE_CAPTURE(IsSemaphoreEXT, isCallValid, context, semaphorePacked, returnValue);
5715     }
5716     else
5717     {
5718         GenerateContextLostErrorOnCurrentGlobalContext();
5719         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsSemaphoreEXT, GLboolean>();
5720     }
5721     return returnValue;
5722 }
5723 
GL_SemaphoreParameterui64vEXT(GLuint semaphore,GLenum pname,const GLuint64 * params)5724 void GL_APIENTRY GL_SemaphoreParameterui64vEXT(GLuint semaphore,
5725                                                GLenum pname,
5726                                                const GLuint64 *params)
5727 {
5728     Context *context = GetValidGlobalContext();
5729     EVENT(context, GLSemaphoreParameterui64vEXT,
5730           "context = %d, semaphore = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
5731           semaphore, GLenumToString(GLenumGroup::SemaphoreParameterName, pname), (uintptr_t)params);
5732 
5733     if (context)
5734     {
5735         SemaphoreID semaphorePacked                           = PackParam<SemaphoreID>(semaphore);
5736         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5737         bool isCallValid =
5738             (context->skipValidation() ||
5739              ValidateSemaphoreParameterui64vEXT(context, semaphorePacked, pname, params));
5740         if (isCallValid)
5741         {
5742             context->semaphoreParameterui64v(semaphorePacked, pname, params);
5743         }
5744         ANGLE_CAPTURE(SemaphoreParameterui64vEXT, isCallValid, context, semaphorePacked, pname,
5745                       params);
5746     }
5747     else
5748     {
5749         GenerateContextLostErrorOnCurrentGlobalContext();
5750     }
5751 }
5752 
GL_SignalSemaphoreEXT(GLuint semaphore,GLuint numBufferBarriers,const GLuint * buffers,GLuint numTextureBarriers,const GLuint * textures,const GLenum * dstLayouts)5753 void GL_APIENTRY GL_SignalSemaphoreEXT(GLuint semaphore,
5754                                        GLuint numBufferBarriers,
5755                                        const GLuint *buffers,
5756                                        GLuint numTextureBarriers,
5757                                        const GLuint *textures,
5758                                        const GLenum *dstLayouts)
5759 {
5760     Context *context = GetValidGlobalContext();
5761     EVENT(context, GLSignalSemaphoreEXT,
5762           "context = %d, semaphore = %u, numBufferBarriers = %u, buffers = 0x%016" PRIxPTR
5763           ", numTextureBarriers = %u, textures = 0x%016" PRIxPTR ", dstLayouts = 0x%016" PRIxPTR "",
5764           CID(context), semaphore, numBufferBarriers, (uintptr_t)buffers, numTextureBarriers,
5765           (uintptr_t)textures, (uintptr_t)dstLayouts);
5766 
5767     if (context)
5768     {
5769         SemaphoreID semaphorePacked     = PackParam<SemaphoreID>(semaphore);
5770         const BufferID *buffersPacked   = PackParam<const BufferID *>(buffers);
5771         const TextureID *texturesPacked = PackParam<const TextureID *>(textures);
5772         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5773         bool isCallValid =
5774             (context->skipValidation() ||
5775              ValidateSignalSemaphoreEXT(context, semaphorePacked, numBufferBarriers, buffersPacked,
5776                                         numTextureBarriers, texturesPacked, dstLayouts));
5777         if (isCallValid)
5778         {
5779             context->signalSemaphore(semaphorePacked, numBufferBarriers, buffersPacked,
5780                                      numTextureBarriers, texturesPacked, dstLayouts);
5781         }
5782         ANGLE_CAPTURE(SignalSemaphoreEXT, isCallValid, context, semaphorePacked, numBufferBarriers,
5783                       buffersPacked, numTextureBarriers, texturesPacked, dstLayouts);
5784     }
5785     else
5786     {
5787         GenerateContextLostErrorOnCurrentGlobalContext();
5788     }
5789 }
5790 
GL_WaitSemaphoreEXT(GLuint semaphore,GLuint numBufferBarriers,const GLuint * buffers,GLuint numTextureBarriers,const GLuint * textures,const GLenum * srcLayouts)5791 void GL_APIENTRY GL_WaitSemaphoreEXT(GLuint semaphore,
5792                                      GLuint numBufferBarriers,
5793                                      const GLuint *buffers,
5794                                      GLuint numTextureBarriers,
5795                                      const GLuint *textures,
5796                                      const GLenum *srcLayouts)
5797 {
5798     Context *context = GetValidGlobalContext();
5799     EVENT(context, GLWaitSemaphoreEXT,
5800           "context = %d, semaphore = %u, numBufferBarriers = %u, buffers = 0x%016" PRIxPTR
5801           ", numTextureBarriers = %u, textures = 0x%016" PRIxPTR ", srcLayouts = 0x%016" PRIxPTR "",
5802           CID(context), semaphore, numBufferBarriers, (uintptr_t)buffers, numTextureBarriers,
5803           (uintptr_t)textures, (uintptr_t)srcLayouts);
5804 
5805     if (context)
5806     {
5807         SemaphoreID semaphorePacked     = PackParam<SemaphoreID>(semaphore);
5808         const BufferID *buffersPacked   = PackParam<const BufferID *>(buffers);
5809         const TextureID *texturesPacked = PackParam<const TextureID *>(textures);
5810         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5811         bool isCallValid =
5812             (context->skipValidation() ||
5813              ValidateWaitSemaphoreEXT(context, semaphorePacked, numBufferBarriers, buffersPacked,
5814                                       numTextureBarriers, texturesPacked, srcLayouts));
5815         if (isCallValid)
5816         {
5817             context->waitSemaphore(semaphorePacked, numBufferBarriers, buffersPacked,
5818                                    numTextureBarriers, texturesPacked, srcLayouts);
5819         }
5820         ANGLE_CAPTURE(WaitSemaphoreEXT, isCallValid, context, semaphorePacked, numBufferBarriers,
5821                       buffersPacked, numTextureBarriers, texturesPacked, srcLayouts);
5822     }
5823     else
5824     {
5825         GenerateContextLostErrorOnCurrentGlobalContext();
5826     }
5827 }
5828 
5829 // GetUnsignedBytei_vEXT is already defined.
5830 
5831 // GetUnsignedBytevEXT is already defined.
5832 
5833 // GL_EXT_semaphore_fd
GL_ImportSemaphoreFdEXT(GLuint semaphore,GLenum handleType,GLint fd)5834 void GL_APIENTRY GL_ImportSemaphoreFdEXT(GLuint semaphore, GLenum handleType, GLint fd)
5835 {
5836     Context *context = GetValidGlobalContext();
5837     EVENT(context, GLImportSemaphoreFdEXT, "context = %d, semaphore = %u, handleType = %s, fd = %d",
5838           CID(context), semaphore, GLenumToString(GLenumGroup::ExternalHandleType, handleType), fd);
5839 
5840     if (context)
5841     {
5842         SemaphoreID semaphorePacked                           = PackParam<SemaphoreID>(semaphore);
5843         HandleType handleTypePacked                           = PackParam<HandleType>(handleType);
5844         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5845         bool isCallValid =
5846             (context->skipValidation() ||
5847              ValidateImportSemaphoreFdEXT(context, semaphorePacked, handleTypePacked, fd));
5848         if (isCallValid)
5849         {
5850             context->importSemaphoreFd(semaphorePacked, handleTypePacked, fd);
5851         }
5852         ANGLE_CAPTURE(ImportSemaphoreFdEXT, isCallValid, context, semaphorePacked, handleTypePacked,
5853                       fd);
5854     }
5855     else
5856     {
5857         GenerateContextLostErrorOnCurrentGlobalContext();
5858     }
5859 }
5860 
5861 // GL_EXT_separate_shader_objects
GL_ActiveShaderProgramEXT(GLuint pipeline,GLuint program)5862 void GL_APIENTRY GL_ActiveShaderProgramEXT(GLuint pipeline, GLuint program)
5863 {
5864     Context *context = GetValidGlobalContext();
5865     EVENT(context, GLActiveShaderProgramEXT, "context = %d, pipeline = %u, program = %u",
5866           CID(context), pipeline, program);
5867 
5868     if (context)
5869     {
5870         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
5871         ShaderProgramID programPacked    = PackParam<ShaderProgramID>(program);
5872         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5873         bool isCallValid                                      = (context->skipValidation() ||
5874                             ValidateActiveShaderProgramEXT(context, pipelinePacked, programPacked));
5875         if (isCallValid)
5876         {
5877             context->activeShaderProgram(pipelinePacked, programPacked);
5878         }
5879         ANGLE_CAPTURE(ActiveShaderProgramEXT, isCallValid, context, pipelinePacked, programPacked);
5880     }
5881     else
5882     {
5883         GenerateContextLostErrorOnCurrentGlobalContext();
5884     }
5885 }
5886 
GL_BindProgramPipelineEXT(GLuint pipeline)5887 void GL_APIENTRY GL_BindProgramPipelineEXT(GLuint pipeline)
5888 {
5889     Context *context = GetValidGlobalContext();
5890     EVENT(context, GLBindProgramPipelineEXT, "context = %d, pipeline = %u", CID(context), pipeline);
5891 
5892     if (context)
5893     {
5894         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
5895         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5896         bool isCallValid =
5897             (context->skipValidation() || ValidateBindProgramPipelineEXT(context, pipelinePacked));
5898         if (isCallValid)
5899         {
5900             context->bindProgramPipeline(pipelinePacked);
5901         }
5902         ANGLE_CAPTURE(BindProgramPipelineEXT, isCallValid, context, pipelinePacked);
5903     }
5904     else
5905     {
5906         GenerateContextLostErrorOnCurrentGlobalContext();
5907     }
5908 }
5909 
GL_CreateShaderProgramvEXT(GLenum type,GLsizei count,const GLchar ** strings)5910 GLuint GL_APIENTRY GL_CreateShaderProgramvEXT(GLenum type, GLsizei count, const GLchar **strings)
5911 {
5912     Context *context = GetValidGlobalContext();
5913     EVENT(context, GLCreateShaderProgramvEXT,
5914           "context = %d, type = %s, count = %d, strings = 0x%016" PRIxPTR "", CID(context),
5915           GLenumToString(GLenumGroup::ShaderType, type), count, (uintptr_t)strings);
5916 
5917     GLuint returnValue;
5918     if (context)
5919     {
5920         ShaderType typePacked                                 = PackParam<ShaderType>(type);
5921         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5922         bool isCallValid                                      = (context->skipValidation() ||
5923                             ValidateCreateShaderProgramvEXT(context, typePacked, count, strings));
5924         if (isCallValid)
5925         {
5926             returnValue = context->createShaderProgramv(typePacked, count, strings);
5927         }
5928         else
5929         {
5930             returnValue =
5931                 GetDefaultReturnValue<angle::EntryPoint::GLCreateShaderProgramvEXT, GLuint>();
5932         }
5933         ANGLE_CAPTURE(CreateShaderProgramvEXT, isCallValid, context, typePacked, count, strings,
5934                       returnValue);
5935     }
5936     else
5937     {
5938         GenerateContextLostErrorOnCurrentGlobalContext();
5939         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLCreateShaderProgramvEXT, GLuint>();
5940     }
5941     return returnValue;
5942 }
5943 
GL_DeleteProgramPipelinesEXT(GLsizei n,const GLuint * pipelines)5944 void GL_APIENTRY GL_DeleteProgramPipelinesEXT(GLsizei n, const GLuint *pipelines)
5945 {
5946     Context *context = GetValidGlobalContext();
5947     EVENT(context, GLDeleteProgramPipelinesEXT,
5948           "context = %d, n = %d, pipelines = 0x%016" PRIxPTR "", CID(context), n,
5949           (uintptr_t)pipelines);
5950 
5951     if (context)
5952     {
5953         const ProgramPipelineID *pipelinesPacked = PackParam<const ProgramPipelineID *>(pipelines);
5954         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5955         bool isCallValid                                      = (context->skipValidation() ||
5956                             ValidateDeleteProgramPipelinesEXT(context, n, pipelinesPacked));
5957         if (isCallValid)
5958         {
5959             context->deleteProgramPipelines(n, pipelinesPacked);
5960         }
5961         ANGLE_CAPTURE(DeleteProgramPipelinesEXT, isCallValid, context, n, pipelinesPacked);
5962     }
5963     else
5964     {
5965         GenerateContextLostErrorOnCurrentGlobalContext();
5966     }
5967 }
5968 
GL_GenProgramPipelinesEXT(GLsizei n,GLuint * pipelines)5969 void GL_APIENTRY GL_GenProgramPipelinesEXT(GLsizei n, GLuint *pipelines)
5970 {
5971     Context *context = GetValidGlobalContext();
5972     EVENT(context, GLGenProgramPipelinesEXT, "context = %d, n = %d, pipelines = 0x%016" PRIxPTR "",
5973           CID(context), n, (uintptr_t)pipelines);
5974 
5975     if (context)
5976     {
5977         ProgramPipelineID *pipelinesPacked = PackParam<ProgramPipelineID *>(pipelines);
5978         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
5979         bool isCallValid                                      = (context->skipValidation() ||
5980                             ValidateGenProgramPipelinesEXT(context, n, pipelinesPacked));
5981         if (isCallValid)
5982         {
5983             context->genProgramPipelines(n, pipelinesPacked);
5984         }
5985         ANGLE_CAPTURE(GenProgramPipelinesEXT, isCallValid, context, n, pipelinesPacked);
5986     }
5987     else
5988     {
5989         GenerateContextLostErrorOnCurrentGlobalContext();
5990     }
5991 }
5992 
GL_GetProgramPipelineInfoLogEXT(GLuint pipeline,GLsizei bufSize,GLsizei * length,GLchar * infoLog)5993 void GL_APIENTRY GL_GetProgramPipelineInfoLogEXT(GLuint pipeline,
5994                                                  GLsizei bufSize,
5995                                                  GLsizei *length,
5996                                                  GLchar *infoLog)
5997 {
5998     Context *context = GetValidGlobalContext();
5999     EVENT(context, GLGetProgramPipelineInfoLogEXT,
6000           "context = %d, pipeline = %u, bufSize = %d, length = 0x%016" PRIxPTR
6001           ", infoLog = 0x%016" PRIxPTR "",
6002           CID(context), pipeline, bufSize, (uintptr_t)length, (uintptr_t)infoLog);
6003 
6004     if (context)
6005     {
6006         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
6007         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6008         bool isCallValid =
6009             (context->skipValidation() || ValidateGetProgramPipelineInfoLogEXT(
6010                                               context, pipelinePacked, bufSize, length, infoLog));
6011         if (isCallValid)
6012         {
6013             context->getProgramPipelineInfoLog(pipelinePacked, bufSize, length, infoLog);
6014         }
6015         ANGLE_CAPTURE(GetProgramPipelineInfoLogEXT, isCallValid, context, pipelinePacked, bufSize,
6016                       length, infoLog);
6017     }
6018     else
6019     {
6020         GenerateContextLostErrorOnCurrentGlobalContext();
6021     }
6022 }
6023 
GL_GetProgramPipelineivEXT(GLuint pipeline,GLenum pname,GLint * params)6024 void GL_APIENTRY GL_GetProgramPipelineivEXT(GLuint pipeline, GLenum pname, GLint *params)
6025 {
6026     Context *context = GetValidGlobalContext();
6027     EVENT(context, GLGetProgramPipelineivEXT,
6028           "context = %d, pipeline = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
6029           pipeline, GLenumToString(GLenumGroup::PipelineParameterName, pname), (uintptr_t)params);
6030 
6031     if (context)
6032     {
6033         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
6034         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6035         bool isCallValid =
6036             (context->skipValidation() ||
6037              ValidateGetProgramPipelineivEXT(context, pipelinePacked, pname, params));
6038         if (isCallValid)
6039         {
6040             context->getProgramPipelineiv(pipelinePacked, pname, params);
6041         }
6042         ANGLE_CAPTURE(GetProgramPipelineivEXT, isCallValid, context, pipelinePacked, pname, params);
6043     }
6044     else
6045     {
6046         GenerateContextLostErrorOnCurrentGlobalContext();
6047     }
6048 }
6049 
GL_IsProgramPipelineEXT(GLuint pipeline)6050 GLboolean GL_APIENTRY GL_IsProgramPipelineEXT(GLuint pipeline)
6051 {
6052     Context *context = GetValidGlobalContext();
6053     EVENT(context, GLIsProgramPipelineEXT, "context = %d, pipeline = %u", CID(context), pipeline);
6054 
6055     GLboolean returnValue;
6056     if (context)
6057     {
6058         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
6059         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6060         bool isCallValid =
6061             (context->skipValidation() || ValidateIsProgramPipelineEXT(context, pipelinePacked));
6062         if (isCallValid)
6063         {
6064             returnValue = context->isProgramPipeline(pipelinePacked);
6065         }
6066         else
6067         {
6068             returnValue =
6069                 GetDefaultReturnValue<angle::EntryPoint::GLIsProgramPipelineEXT, GLboolean>();
6070         }
6071         ANGLE_CAPTURE(IsProgramPipelineEXT, isCallValid, context, pipelinePacked, returnValue);
6072     }
6073     else
6074     {
6075         GenerateContextLostErrorOnCurrentGlobalContext();
6076         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsProgramPipelineEXT, GLboolean>();
6077     }
6078     return returnValue;
6079 }
6080 
GL_ProgramParameteriEXT(GLuint program,GLenum pname,GLint value)6081 void GL_APIENTRY GL_ProgramParameteriEXT(GLuint program, GLenum pname, GLint value)
6082 {
6083     Context *context = GetValidGlobalContext();
6084     EVENT(context, GLProgramParameteriEXT, "context = %d, program = %u, pname = %s, value = %d",
6085           CID(context), program, GLenumToString(GLenumGroup::ProgramParameterPName, pname), value);
6086 
6087     if (context)
6088     {
6089         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
6090         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6091         bool isCallValid                                      = (context->skipValidation() ||
6092                             ValidateProgramParameteriEXT(context, programPacked, pname, value));
6093         if (isCallValid)
6094         {
6095             context->programParameteri(programPacked, pname, value);
6096         }
6097         ANGLE_CAPTURE(ProgramParameteriEXT, isCallValid, context, programPacked, pname, value);
6098     }
6099     else
6100     {
6101         GenerateContextLostErrorOnCurrentGlobalContext();
6102     }
6103 }
6104 
GL_ProgramUniform1fEXT(GLuint program,GLint location,GLfloat v0)6105 void GL_APIENTRY GL_ProgramUniform1fEXT(GLuint program, GLint location, GLfloat v0)
6106 {
6107     Context *context = GetValidGlobalContext();
6108     EVENT(context, GLProgramUniform1fEXT, "context = %d, program = %u, location = %d, v0 = %f",
6109           CID(context), program, location, v0);
6110 
6111     if (context)
6112     {
6113         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6114         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6115         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6116         bool isCallValid =
6117             (context->skipValidation() ||
6118              ValidateProgramUniform1fEXT(context, programPacked, locationPacked, v0));
6119         if (isCallValid)
6120         {
6121             context->programUniform1f(programPacked, locationPacked, v0);
6122         }
6123         ANGLE_CAPTURE(ProgramUniform1fEXT, isCallValid, context, programPacked, locationPacked, v0);
6124     }
6125     else
6126     {
6127         GenerateContextLostErrorOnCurrentGlobalContext();
6128     }
6129 }
6130 
GL_ProgramUniform1fvEXT(GLuint program,GLint location,GLsizei count,const GLfloat * value)6131 void GL_APIENTRY GL_ProgramUniform1fvEXT(GLuint program,
6132                                          GLint location,
6133                                          GLsizei count,
6134                                          const GLfloat *value)
6135 {
6136     Context *context = GetValidGlobalContext();
6137     EVENT(context, GLProgramUniform1fvEXT,
6138           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
6139           CID(context), program, location, count, (uintptr_t)value);
6140 
6141     if (context)
6142     {
6143         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6144         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6145         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6146         bool isCallValid =
6147             (context->skipValidation() ||
6148              ValidateProgramUniform1fvEXT(context, programPacked, locationPacked, count, value));
6149         if (isCallValid)
6150         {
6151             context->programUniform1fv(programPacked, locationPacked, count, value);
6152         }
6153         ANGLE_CAPTURE(ProgramUniform1fvEXT, isCallValid, context, programPacked, locationPacked,
6154                       count, value);
6155     }
6156     else
6157     {
6158         GenerateContextLostErrorOnCurrentGlobalContext();
6159     }
6160 }
6161 
GL_ProgramUniform1iEXT(GLuint program,GLint location,GLint v0)6162 void GL_APIENTRY GL_ProgramUniform1iEXT(GLuint program, GLint location, GLint v0)
6163 {
6164     Context *context = GetValidGlobalContext();
6165     EVENT(context, GLProgramUniform1iEXT, "context = %d, program = %u, location = %d, v0 = %d",
6166           CID(context), program, location, v0);
6167 
6168     if (context)
6169     {
6170         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6171         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6172         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6173         bool isCallValid =
6174             (context->skipValidation() ||
6175              ValidateProgramUniform1iEXT(context, programPacked, locationPacked, v0));
6176         if (isCallValid)
6177         {
6178             context->programUniform1i(programPacked, locationPacked, v0);
6179         }
6180         ANGLE_CAPTURE(ProgramUniform1iEXT, isCallValid, context, programPacked, locationPacked, v0);
6181     }
6182     else
6183     {
6184         GenerateContextLostErrorOnCurrentGlobalContext();
6185     }
6186 }
6187 
GL_ProgramUniform1ivEXT(GLuint program,GLint location,GLsizei count,const GLint * value)6188 void GL_APIENTRY GL_ProgramUniform1ivEXT(GLuint program,
6189                                          GLint location,
6190                                          GLsizei count,
6191                                          const GLint *value)
6192 {
6193     Context *context = GetValidGlobalContext();
6194     EVENT(context, GLProgramUniform1ivEXT,
6195           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
6196           CID(context), program, location, count, (uintptr_t)value);
6197 
6198     if (context)
6199     {
6200         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6201         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6202         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6203         bool isCallValid =
6204             (context->skipValidation() ||
6205              ValidateProgramUniform1ivEXT(context, programPacked, locationPacked, count, value));
6206         if (isCallValid)
6207         {
6208             context->programUniform1iv(programPacked, locationPacked, count, value);
6209         }
6210         ANGLE_CAPTURE(ProgramUniform1ivEXT, isCallValid, context, programPacked, locationPacked,
6211                       count, value);
6212     }
6213     else
6214     {
6215         GenerateContextLostErrorOnCurrentGlobalContext();
6216     }
6217 }
6218 
GL_ProgramUniform1uiEXT(GLuint program,GLint location,GLuint v0)6219 void GL_APIENTRY GL_ProgramUniform1uiEXT(GLuint program, GLint location, GLuint v0)
6220 {
6221     Context *context = GetValidGlobalContext();
6222     EVENT(context, GLProgramUniform1uiEXT, "context = %d, program = %u, location = %d, v0 = %u",
6223           CID(context), program, location, v0);
6224 
6225     if (context)
6226     {
6227         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6228         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6229         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6230         bool isCallValid =
6231             (context->skipValidation() ||
6232              ValidateProgramUniform1uiEXT(context, programPacked, locationPacked, v0));
6233         if (isCallValid)
6234         {
6235             context->programUniform1ui(programPacked, locationPacked, v0);
6236         }
6237         ANGLE_CAPTURE(ProgramUniform1uiEXT, isCallValid, context, programPacked, locationPacked,
6238                       v0);
6239     }
6240     else
6241     {
6242         GenerateContextLostErrorOnCurrentGlobalContext();
6243     }
6244 }
6245 
GL_ProgramUniform1uivEXT(GLuint program,GLint location,GLsizei count,const GLuint * value)6246 void GL_APIENTRY GL_ProgramUniform1uivEXT(GLuint program,
6247                                           GLint location,
6248                                           GLsizei count,
6249                                           const GLuint *value)
6250 {
6251     Context *context = GetValidGlobalContext();
6252     EVENT(context, GLProgramUniform1uivEXT,
6253           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
6254           CID(context), program, location, count, (uintptr_t)value);
6255 
6256     if (context)
6257     {
6258         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6259         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6260         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6261         bool isCallValid =
6262             (context->skipValidation() ||
6263              ValidateProgramUniform1uivEXT(context, programPacked, locationPacked, count, value));
6264         if (isCallValid)
6265         {
6266             context->programUniform1uiv(programPacked, locationPacked, count, value);
6267         }
6268         ANGLE_CAPTURE(ProgramUniform1uivEXT, isCallValid, context, programPacked, locationPacked,
6269                       count, value);
6270     }
6271     else
6272     {
6273         GenerateContextLostErrorOnCurrentGlobalContext();
6274     }
6275 }
6276 
GL_ProgramUniform2fEXT(GLuint program,GLint location,GLfloat v0,GLfloat v1)6277 void GL_APIENTRY GL_ProgramUniform2fEXT(GLuint program, GLint location, GLfloat v0, GLfloat v1)
6278 {
6279     Context *context = GetValidGlobalContext();
6280     EVENT(context, GLProgramUniform2fEXT,
6281           "context = %d, program = %u, location = %d, v0 = %f, v1 = %f", CID(context), program,
6282           location, v0, v1);
6283 
6284     if (context)
6285     {
6286         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6287         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6288         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6289         bool isCallValid =
6290             (context->skipValidation() ||
6291              ValidateProgramUniform2fEXT(context, programPacked, locationPacked, v0, v1));
6292         if (isCallValid)
6293         {
6294             context->programUniform2f(programPacked, locationPacked, v0, v1);
6295         }
6296         ANGLE_CAPTURE(ProgramUniform2fEXT, isCallValid, context, programPacked, locationPacked, v0,
6297                       v1);
6298     }
6299     else
6300     {
6301         GenerateContextLostErrorOnCurrentGlobalContext();
6302     }
6303 }
6304 
GL_ProgramUniform2fvEXT(GLuint program,GLint location,GLsizei count,const GLfloat * value)6305 void GL_APIENTRY GL_ProgramUniform2fvEXT(GLuint program,
6306                                          GLint location,
6307                                          GLsizei count,
6308                                          const GLfloat *value)
6309 {
6310     Context *context = GetValidGlobalContext();
6311     EVENT(context, GLProgramUniform2fvEXT,
6312           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
6313           CID(context), program, location, count, (uintptr_t)value);
6314 
6315     if (context)
6316     {
6317         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6318         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6319         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6320         bool isCallValid =
6321             (context->skipValidation() ||
6322              ValidateProgramUniform2fvEXT(context, programPacked, locationPacked, count, value));
6323         if (isCallValid)
6324         {
6325             context->programUniform2fv(programPacked, locationPacked, count, value);
6326         }
6327         ANGLE_CAPTURE(ProgramUniform2fvEXT, isCallValid, context, programPacked, locationPacked,
6328                       count, value);
6329     }
6330     else
6331     {
6332         GenerateContextLostErrorOnCurrentGlobalContext();
6333     }
6334 }
6335 
GL_ProgramUniform2iEXT(GLuint program,GLint location,GLint v0,GLint v1)6336 void GL_APIENTRY GL_ProgramUniform2iEXT(GLuint program, GLint location, GLint v0, GLint v1)
6337 {
6338     Context *context = GetValidGlobalContext();
6339     EVENT(context, GLProgramUniform2iEXT,
6340           "context = %d, program = %u, location = %d, v0 = %d, v1 = %d", CID(context), program,
6341           location, v0, v1);
6342 
6343     if (context)
6344     {
6345         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6346         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6347         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6348         bool isCallValid =
6349             (context->skipValidation() ||
6350              ValidateProgramUniform2iEXT(context, programPacked, locationPacked, v0, v1));
6351         if (isCallValid)
6352         {
6353             context->programUniform2i(programPacked, locationPacked, v0, v1);
6354         }
6355         ANGLE_CAPTURE(ProgramUniform2iEXT, isCallValid, context, programPacked, locationPacked, v0,
6356                       v1);
6357     }
6358     else
6359     {
6360         GenerateContextLostErrorOnCurrentGlobalContext();
6361     }
6362 }
6363 
GL_ProgramUniform2ivEXT(GLuint program,GLint location,GLsizei count,const GLint * value)6364 void GL_APIENTRY GL_ProgramUniform2ivEXT(GLuint program,
6365                                          GLint location,
6366                                          GLsizei count,
6367                                          const GLint *value)
6368 {
6369     Context *context = GetValidGlobalContext();
6370     EVENT(context, GLProgramUniform2ivEXT,
6371           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
6372           CID(context), program, location, count, (uintptr_t)value);
6373 
6374     if (context)
6375     {
6376         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6377         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6378         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6379         bool isCallValid =
6380             (context->skipValidation() ||
6381              ValidateProgramUniform2ivEXT(context, programPacked, locationPacked, count, value));
6382         if (isCallValid)
6383         {
6384             context->programUniform2iv(programPacked, locationPacked, count, value);
6385         }
6386         ANGLE_CAPTURE(ProgramUniform2ivEXT, isCallValid, context, programPacked, locationPacked,
6387                       count, value);
6388     }
6389     else
6390     {
6391         GenerateContextLostErrorOnCurrentGlobalContext();
6392     }
6393 }
6394 
GL_ProgramUniform2uiEXT(GLuint program,GLint location,GLuint v0,GLuint v1)6395 void GL_APIENTRY GL_ProgramUniform2uiEXT(GLuint program, GLint location, GLuint v0, GLuint v1)
6396 {
6397     Context *context = GetValidGlobalContext();
6398     EVENT(context, GLProgramUniform2uiEXT,
6399           "context = %d, program = %u, location = %d, v0 = %u, v1 = %u", CID(context), program,
6400           location, v0, v1);
6401 
6402     if (context)
6403     {
6404         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6405         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6406         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6407         bool isCallValid =
6408             (context->skipValidation() ||
6409              ValidateProgramUniform2uiEXT(context, programPacked, locationPacked, v0, v1));
6410         if (isCallValid)
6411         {
6412             context->programUniform2ui(programPacked, locationPacked, v0, v1);
6413         }
6414         ANGLE_CAPTURE(ProgramUniform2uiEXT, isCallValid, context, programPacked, locationPacked, v0,
6415                       v1);
6416     }
6417     else
6418     {
6419         GenerateContextLostErrorOnCurrentGlobalContext();
6420     }
6421 }
6422 
GL_ProgramUniform2uivEXT(GLuint program,GLint location,GLsizei count,const GLuint * value)6423 void GL_APIENTRY GL_ProgramUniform2uivEXT(GLuint program,
6424                                           GLint location,
6425                                           GLsizei count,
6426                                           const GLuint *value)
6427 {
6428     Context *context = GetValidGlobalContext();
6429     EVENT(context, GLProgramUniform2uivEXT,
6430           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
6431           CID(context), program, location, count, (uintptr_t)value);
6432 
6433     if (context)
6434     {
6435         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6436         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6437         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6438         bool isCallValid =
6439             (context->skipValidation() ||
6440              ValidateProgramUniform2uivEXT(context, programPacked, locationPacked, count, value));
6441         if (isCallValid)
6442         {
6443             context->programUniform2uiv(programPacked, locationPacked, count, value);
6444         }
6445         ANGLE_CAPTURE(ProgramUniform2uivEXT, isCallValid, context, programPacked, locationPacked,
6446                       count, value);
6447     }
6448     else
6449     {
6450         GenerateContextLostErrorOnCurrentGlobalContext();
6451     }
6452 }
6453 
6454 void GL_APIENTRY
GL_ProgramUniform3fEXT(GLuint program,GLint location,GLfloat v0,GLfloat v1,GLfloat v2)6455 GL_ProgramUniform3fEXT(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
6456 {
6457     Context *context = GetValidGlobalContext();
6458     EVENT(context, GLProgramUniform3fEXT,
6459           "context = %d, program = %u, location = %d, v0 = %f, v1 = %f, v2 = %f", CID(context),
6460           program, location, v0, v1, v2);
6461 
6462     if (context)
6463     {
6464         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6465         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6466         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6467         bool isCallValid =
6468             (context->skipValidation() ||
6469              ValidateProgramUniform3fEXT(context, programPacked, locationPacked, v0, v1, v2));
6470         if (isCallValid)
6471         {
6472             context->programUniform3f(programPacked, locationPacked, v0, v1, v2);
6473         }
6474         ANGLE_CAPTURE(ProgramUniform3fEXT, isCallValid, context, programPacked, locationPacked, v0,
6475                       v1, v2);
6476     }
6477     else
6478     {
6479         GenerateContextLostErrorOnCurrentGlobalContext();
6480     }
6481 }
6482 
GL_ProgramUniform3fvEXT(GLuint program,GLint location,GLsizei count,const GLfloat * value)6483 void GL_APIENTRY GL_ProgramUniform3fvEXT(GLuint program,
6484                                          GLint location,
6485                                          GLsizei count,
6486                                          const GLfloat *value)
6487 {
6488     Context *context = GetValidGlobalContext();
6489     EVENT(context, GLProgramUniform3fvEXT,
6490           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
6491           CID(context), program, location, count, (uintptr_t)value);
6492 
6493     if (context)
6494     {
6495         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6496         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6497         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6498         bool isCallValid =
6499             (context->skipValidation() ||
6500              ValidateProgramUniform3fvEXT(context, programPacked, locationPacked, count, value));
6501         if (isCallValid)
6502         {
6503             context->programUniform3fv(programPacked, locationPacked, count, value);
6504         }
6505         ANGLE_CAPTURE(ProgramUniform3fvEXT, isCallValid, context, programPacked, locationPacked,
6506                       count, value);
6507     }
6508     else
6509     {
6510         GenerateContextLostErrorOnCurrentGlobalContext();
6511     }
6512 }
6513 
6514 void GL_APIENTRY
GL_ProgramUniform3iEXT(GLuint program,GLint location,GLint v0,GLint v1,GLint v2)6515 GL_ProgramUniform3iEXT(GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
6516 {
6517     Context *context = GetValidGlobalContext();
6518     EVENT(context, GLProgramUniform3iEXT,
6519           "context = %d, program = %u, location = %d, v0 = %d, v1 = %d, v2 = %d", CID(context),
6520           program, location, v0, v1, v2);
6521 
6522     if (context)
6523     {
6524         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6525         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6526         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6527         bool isCallValid =
6528             (context->skipValidation() ||
6529              ValidateProgramUniform3iEXT(context, programPacked, locationPacked, v0, v1, v2));
6530         if (isCallValid)
6531         {
6532             context->programUniform3i(programPacked, locationPacked, v0, v1, v2);
6533         }
6534         ANGLE_CAPTURE(ProgramUniform3iEXT, isCallValid, context, programPacked, locationPacked, v0,
6535                       v1, v2);
6536     }
6537     else
6538     {
6539         GenerateContextLostErrorOnCurrentGlobalContext();
6540     }
6541 }
6542 
GL_ProgramUniform3ivEXT(GLuint program,GLint location,GLsizei count,const GLint * value)6543 void GL_APIENTRY GL_ProgramUniform3ivEXT(GLuint program,
6544                                          GLint location,
6545                                          GLsizei count,
6546                                          const GLint *value)
6547 {
6548     Context *context = GetValidGlobalContext();
6549     EVENT(context, GLProgramUniform3ivEXT,
6550           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
6551           CID(context), program, location, count, (uintptr_t)value);
6552 
6553     if (context)
6554     {
6555         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6556         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6557         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6558         bool isCallValid =
6559             (context->skipValidation() ||
6560              ValidateProgramUniform3ivEXT(context, programPacked, locationPacked, count, value));
6561         if (isCallValid)
6562         {
6563             context->programUniform3iv(programPacked, locationPacked, count, value);
6564         }
6565         ANGLE_CAPTURE(ProgramUniform3ivEXT, isCallValid, context, programPacked, locationPacked,
6566                       count, value);
6567     }
6568     else
6569     {
6570         GenerateContextLostErrorOnCurrentGlobalContext();
6571     }
6572 }
6573 
6574 void GL_APIENTRY
GL_ProgramUniform3uiEXT(GLuint program,GLint location,GLuint v0,GLuint v1,GLuint v2)6575 GL_ProgramUniform3uiEXT(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)
6576 {
6577     Context *context = GetValidGlobalContext();
6578     EVENT(context, GLProgramUniform3uiEXT,
6579           "context = %d, program = %u, location = %d, v0 = %u, v1 = %u, v2 = %u", CID(context),
6580           program, location, v0, v1, v2);
6581 
6582     if (context)
6583     {
6584         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6585         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6586         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6587         bool isCallValid =
6588             (context->skipValidation() ||
6589              ValidateProgramUniform3uiEXT(context, programPacked, locationPacked, v0, v1, v2));
6590         if (isCallValid)
6591         {
6592             context->programUniform3ui(programPacked, locationPacked, v0, v1, v2);
6593         }
6594         ANGLE_CAPTURE(ProgramUniform3uiEXT, isCallValid, context, programPacked, locationPacked, v0,
6595                       v1, v2);
6596     }
6597     else
6598     {
6599         GenerateContextLostErrorOnCurrentGlobalContext();
6600     }
6601 }
6602 
GL_ProgramUniform3uivEXT(GLuint program,GLint location,GLsizei count,const GLuint * value)6603 void GL_APIENTRY GL_ProgramUniform3uivEXT(GLuint program,
6604                                           GLint location,
6605                                           GLsizei count,
6606                                           const GLuint *value)
6607 {
6608     Context *context = GetValidGlobalContext();
6609     EVENT(context, GLProgramUniform3uivEXT,
6610           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
6611           CID(context), program, location, count, (uintptr_t)value);
6612 
6613     if (context)
6614     {
6615         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6616         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6617         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6618         bool isCallValid =
6619             (context->skipValidation() ||
6620              ValidateProgramUniform3uivEXT(context, programPacked, locationPacked, count, value));
6621         if (isCallValid)
6622         {
6623             context->programUniform3uiv(programPacked, locationPacked, count, value);
6624         }
6625         ANGLE_CAPTURE(ProgramUniform3uivEXT, isCallValid, context, programPacked, locationPacked,
6626                       count, value);
6627     }
6628     else
6629     {
6630         GenerateContextLostErrorOnCurrentGlobalContext();
6631     }
6632 }
6633 
GL_ProgramUniform4fEXT(GLuint program,GLint location,GLfloat v0,GLfloat v1,GLfloat v2,GLfloat v3)6634 void GL_APIENTRY GL_ProgramUniform4fEXT(GLuint program,
6635                                         GLint location,
6636                                         GLfloat v0,
6637                                         GLfloat v1,
6638                                         GLfloat v2,
6639                                         GLfloat v3)
6640 {
6641     Context *context = GetValidGlobalContext();
6642     EVENT(context, GLProgramUniform4fEXT,
6643           "context = %d, program = %u, location = %d, v0 = %f, v1 = %f, v2 = %f, v3 = %f",
6644           CID(context), program, location, v0, v1, v2, v3);
6645 
6646     if (context)
6647     {
6648         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6649         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6650         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6651         bool isCallValid =
6652             (context->skipValidation() ||
6653              ValidateProgramUniform4fEXT(context, programPacked, locationPacked, v0, v1, v2, v3));
6654         if (isCallValid)
6655         {
6656             context->programUniform4f(programPacked, locationPacked, v0, v1, v2, v3);
6657         }
6658         ANGLE_CAPTURE(ProgramUniform4fEXT, isCallValid, context, programPacked, locationPacked, v0,
6659                       v1, v2, v3);
6660     }
6661     else
6662     {
6663         GenerateContextLostErrorOnCurrentGlobalContext();
6664     }
6665 }
6666 
GL_ProgramUniform4fvEXT(GLuint program,GLint location,GLsizei count,const GLfloat * value)6667 void GL_APIENTRY GL_ProgramUniform4fvEXT(GLuint program,
6668                                          GLint location,
6669                                          GLsizei count,
6670                                          const GLfloat *value)
6671 {
6672     Context *context = GetValidGlobalContext();
6673     EVENT(context, GLProgramUniform4fvEXT,
6674           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
6675           CID(context), program, location, count, (uintptr_t)value);
6676 
6677     if (context)
6678     {
6679         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6680         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6681         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6682         bool isCallValid =
6683             (context->skipValidation() ||
6684              ValidateProgramUniform4fvEXT(context, programPacked, locationPacked, count, value));
6685         if (isCallValid)
6686         {
6687             context->programUniform4fv(programPacked, locationPacked, count, value);
6688         }
6689         ANGLE_CAPTURE(ProgramUniform4fvEXT, isCallValid, context, programPacked, locationPacked,
6690                       count, value);
6691     }
6692     else
6693     {
6694         GenerateContextLostErrorOnCurrentGlobalContext();
6695     }
6696 }
6697 
6698 void GL_APIENTRY
GL_ProgramUniform4iEXT(GLuint program,GLint location,GLint v0,GLint v1,GLint v2,GLint v3)6699 GL_ProgramUniform4iEXT(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
6700 {
6701     Context *context = GetValidGlobalContext();
6702     EVENT(context, GLProgramUniform4iEXT,
6703           "context = %d, program = %u, location = %d, v0 = %d, v1 = %d, v2 = %d, v3 = %d",
6704           CID(context), program, location, v0, v1, v2, v3);
6705 
6706     if (context)
6707     {
6708         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6709         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6710         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6711         bool isCallValid =
6712             (context->skipValidation() ||
6713              ValidateProgramUniform4iEXT(context, programPacked, locationPacked, v0, v1, v2, v3));
6714         if (isCallValid)
6715         {
6716             context->programUniform4i(programPacked, locationPacked, v0, v1, v2, v3);
6717         }
6718         ANGLE_CAPTURE(ProgramUniform4iEXT, isCallValid, context, programPacked, locationPacked, v0,
6719                       v1, v2, v3);
6720     }
6721     else
6722     {
6723         GenerateContextLostErrorOnCurrentGlobalContext();
6724     }
6725 }
6726 
GL_ProgramUniform4ivEXT(GLuint program,GLint location,GLsizei count,const GLint * value)6727 void GL_APIENTRY GL_ProgramUniform4ivEXT(GLuint program,
6728                                          GLint location,
6729                                          GLsizei count,
6730                                          const GLint *value)
6731 {
6732     Context *context = GetValidGlobalContext();
6733     EVENT(context, GLProgramUniform4ivEXT,
6734           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
6735           CID(context), program, location, count, (uintptr_t)value);
6736 
6737     if (context)
6738     {
6739         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6740         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6741         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6742         bool isCallValid =
6743             (context->skipValidation() ||
6744              ValidateProgramUniform4ivEXT(context, programPacked, locationPacked, count, value));
6745         if (isCallValid)
6746         {
6747             context->programUniform4iv(programPacked, locationPacked, count, value);
6748         }
6749         ANGLE_CAPTURE(ProgramUniform4ivEXT, isCallValid, context, programPacked, locationPacked,
6750                       count, value);
6751     }
6752     else
6753     {
6754         GenerateContextLostErrorOnCurrentGlobalContext();
6755     }
6756 }
6757 
6758 void GL_APIENTRY
GL_ProgramUniform4uiEXT(GLuint program,GLint location,GLuint v0,GLuint v1,GLuint v2,GLuint v3)6759 GL_ProgramUniform4uiEXT(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
6760 {
6761     Context *context = GetValidGlobalContext();
6762     EVENT(context, GLProgramUniform4uiEXT,
6763           "context = %d, program = %u, location = %d, v0 = %u, v1 = %u, v2 = %u, v3 = %u",
6764           CID(context), program, location, v0, v1, v2, v3);
6765 
6766     if (context)
6767     {
6768         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6769         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6770         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6771         bool isCallValid =
6772             (context->skipValidation() ||
6773              ValidateProgramUniform4uiEXT(context, programPacked, locationPacked, v0, v1, v2, v3));
6774         if (isCallValid)
6775         {
6776             context->programUniform4ui(programPacked, locationPacked, v0, v1, v2, v3);
6777         }
6778         ANGLE_CAPTURE(ProgramUniform4uiEXT, isCallValid, context, programPacked, locationPacked, v0,
6779                       v1, v2, v3);
6780     }
6781     else
6782     {
6783         GenerateContextLostErrorOnCurrentGlobalContext();
6784     }
6785 }
6786 
GL_ProgramUniform4uivEXT(GLuint program,GLint location,GLsizei count,const GLuint * value)6787 void GL_APIENTRY GL_ProgramUniform4uivEXT(GLuint program,
6788                                           GLint location,
6789                                           GLsizei count,
6790                                           const GLuint *value)
6791 {
6792     Context *context = GetValidGlobalContext();
6793     EVENT(context, GLProgramUniform4uivEXT,
6794           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
6795           CID(context), program, location, count, (uintptr_t)value);
6796 
6797     if (context)
6798     {
6799         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6800         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6801         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6802         bool isCallValid =
6803             (context->skipValidation() ||
6804              ValidateProgramUniform4uivEXT(context, programPacked, locationPacked, count, value));
6805         if (isCallValid)
6806         {
6807             context->programUniform4uiv(programPacked, locationPacked, count, value);
6808         }
6809         ANGLE_CAPTURE(ProgramUniform4uivEXT, isCallValid, context, programPacked, locationPacked,
6810                       count, value);
6811     }
6812     else
6813     {
6814         GenerateContextLostErrorOnCurrentGlobalContext();
6815     }
6816 }
6817 
GL_ProgramUniformMatrix2fvEXT(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)6818 void GL_APIENTRY GL_ProgramUniformMatrix2fvEXT(GLuint program,
6819                                                GLint location,
6820                                                GLsizei count,
6821                                                GLboolean transpose,
6822                                                const GLfloat *value)
6823 {
6824     Context *context = GetValidGlobalContext();
6825     EVENT(context, GLProgramUniformMatrix2fvEXT,
6826           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
6827           "0x%016" PRIxPTR "",
6828           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
6829 
6830     if (context)
6831     {
6832         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6833         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6834         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6835         bool isCallValid                                      = (context->skipValidation() ||
6836                             ValidateProgramUniformMatrix2fvEXT(
6837                                 context, programPacked, locationPacked, count, transpose, value));
6838         if (isCallValid)
6839         {
6840             context->programUniformMatrix2fv(programPacked, locationPacked, count, transpose,
6841                                              value);
6842         }
6843         ANGLE_CAPTURE(ProgramUniformMatrix2fvEXT, isCallValid, context, programPacked,
6844                       locationPacked, count, transpose, value);
6845     }
6846     else
6847     {
6848         GenerateContextLostErrorOnCurrentGlobalContext();
6849     }
6850 }
6851 
GL_ProgramUniformMatrix2x3fvEXT(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)6852 void GL_APIENTRY GL_ProgramUniformMatrix2x3fvEXT(GLuint program,
6853                                                  GLint location,
6854                                                  GLsizei count,
6855                                                  GLboolean transpose,
6856                                                  const GLfloat *value)
6857 {
6858     Context *context = GetValidGlobalContext();
6859     EVENT(context, GLProgramUniformMatrix2x3fvEXT,
6860           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
6861           "0x%016" PRIxPTR "",
6862           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
6863 
6864     if (context)
6865     {
6866         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6867         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6868         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6869         bool isCallValid                                      = (context->skipValidation() ||
6870                             ValidateProgramUniformMatrix2x3fvEXT(
6871                                 context, programPacked, locationPacked, count, transpose, value));
6872         if (isCallValid)
6873         {
6874             context->programUniformMatrix2x3fv(programPacked, locationPacked, count, transpose,
6875                                                value);
6876         }
6877         ANGLE_CAPTURE(ProgramUniformMatrix2x3fvEXT, isCallValid, context, programPacked,
6878                       locationPacked, count, transpose, value);
6879     }
6880     else
6881     {
6882         GenerateContextLostErrorOnCurrentGlobalContext();
6883     }
6884 }
6885 
GL_ProgramUniformMatrix2x4fvEXT(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)6886 void GL_APIENTRY GL_ProgramUniformMatrix2x4fvEXT(GLuint program,
6887                                                  GLint location,
6888                                                  GLsizei count,
6889                                                  GLboolean transpose,
6890                                                  const GLfloat *value)
6891 {
6892     Context *context = GetValidGlobalContext();
6893     EVENT(context, GLProgramUniformMatrix2x4fvEXT,
6894           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
6895           "0x%016" PRIxPTR "",
6896           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
6897 
6898     if (context)
6899     {
6900         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6901         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6902         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6903         bool isCallValid                                      = (context->skipValidation() ||
6904                             ValidateProgramUniformMatrix2x4fvEXT(
6905                                 context, programPacked, locationPacked, count, transpose, value));
6906         if (isCallValid)
6907         {
6908             context->programUniformMatrix2x4fv(programPacked, locationPacked, count, transpose,
6909                                                value);
6910         }
6911         ANGLE_CAPTURE(ProgramUniformMatrix2x4fvEXT, isCallValid, context, programPacked,
6912                       locationPacked, count, transpose, value);
6913     }
6914     else
6915     {
6916         GenerateContextLostErrorOnCurrentGlobalContext();
6917     }
6918 }
6919 
GL_ProgramUniformMatrix3fvEXT(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)6920 void GL_APIENTRY GL_ProgramUniformMatrix3fvEXT(GLuint program,
6921                                                GLint location,
6922                                                GLsizei count,
6923                                                GLboolean transpose,
6924                                                const GLfloat *value)
6925 {
6926     Context *context = GetValidGlobalContext();
6927     EVENT(context, GLProgramUniformMatrix3fvEXT,
6928           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
6929           "0x%016" PRIxPTR "",
6930           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
6931 
6932     if (context)
6933     {
6934         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6935         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6936         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6937         bool isCallValid                                      = (context->skipValidation() ||
6938                             ValidateProgramUniformMatrix3fvEXT(
6939                                 context, programPacked, locationPacked, count, transpose, value));
6940         if (isCallValid)
6941         {
6942             context->programUniformMatrix3fv(programPacked, locationPacked, count, transpose,
6943                                              value);
6944         }
6945         ANGLE_CAPTURE(ProgramUniformMatrix3fvEXT, isCallValid, context, programPacked,
6946                       locationPacked, count, transpose, value);
6947     }
6948     else
6949     {
6950         GenerateContextLostErrorOnCurrentGlobalContext();
6951     }
6952 }
6953 
GL_ProgramUniformMatrix3x2fvEXT(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)6954 void GL_APIENTRY GL_ProgramUniformMatrix3x2fvEXT(GLuint program,
6955                                                  GLint location,
6956                                                  GLsizei count,
6957                                                  GLboolean transpose,
6958                                                  const GLfloat *value)
6959 {
6960     Context *context = GetValidGlobalContext();
6961     EVENT(context, GLProgramUniformMatrix3x2fvEXT,
6962           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
6963           "0x%016" PRIxPTR "",
6964           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
6965 
6966     if (context)
6967     {
6968         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
6969         UniformLocation locationPacked = PackParam<UniformLocation>(location);
6970         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
6971         bool isCallValid                                      = (context->skipValidation() ||
6972                             ValidateProgramUniformMatrix3x2fvEXT(
6973                                 context, programPacked, locationPacked, count, transpose, value));
6974         if (isCallValid)
6975         {
6976             context->programUniformMatrix3x2fv(programPacked, locationPacked, count, transpose,
6977                                                value);
6978         }
6979         ANGLE_CAPTURE(ProgramUniformMatrix3x2fvEXT, isCallValid, context, programPacked,
6980                       locationPacked, count, transpose, value);
6981     }
6982     else
6983     {
6984         GenerateContextLostErrorOnCurrentGlobalContext();
6985     }
6986 }
6987 
GL_ProgramUniformMatrix3x4fvEXT(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)6988 void GL_APIENTRY GL_ProgramUniformMatrix3x4fvEXT(GLuint program,
6989                                                  GLint location,
6990                                                  GLsizei count,
6991                                                  GLboolean transpose,
6992                                                  const GLfloat *value)
6993 {
6994     Context *context = GetValidGlobalContext();
6995     EVENT(context, GLProgramUniformMatrix3x4fvEXT,
6996           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
6997           "0x%016" PRIxPTR "",
6998           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
6999 
7000     if (context)
7001     {
7002         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
7003         UniformLocation locationPacked = PackParam<UniformLocation>(location);
7004         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7005         bool isCallValid                                      = (context->skipValidation() ||
7006                             ValidateProgramUniformMatrix3x4fvEXT(
7007                                 context, programPacked, locationPacked, count, transpose, value));
7008         if (isCallValid)
7009         {
7010             context->programUniformMatrix3x4fv(programPacked, locationPacked, count, transpose,
7011                                                value);
7012         }
7013         ANGLE_CAPTURE(ProgramUniformMatrix3x4fvEXT, isCallValid, context, programPacked,
7014                       locationPacked, count, transpose, value);
7015     }
7016     else
7017     {
7018         GenerateContextLostErrorOnCurrentGlobalContext();
7019     }
7020 }
7021 
GL_ProgramUniformMatrix4fvEXT(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)7022 void GL_APIENTRY GL_ProgramUniformMatrix4fvEXT(GLuint program,
7023                                                GLint location,
7024                                                GLsizei count,
7025                                                GLboolean transpose,
7026                                                const GLfloat *value)
7027 {
7028     Context *context = GetValidGlobalContext();
7029     EVENT(context, GLProgramUniformMatrix4fvEXT,
7030           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
7031           "0x%016" PRIxPTR "",
7032           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
7033 
7034     if (context)
7035     {
7036         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
7037         UniformLocation locationPacked = PackParam<UniformLocation>(location);
7038         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7039         bool isCallValid                                      = (context->skipValidation() ||
7040                             ValidateProgramUniformMatrix4fvEXT(
7041                                 context, programPacked, locationPacked, count, transpose, value));
7042         if (isCallValid)
7043         {
7044             context->programUniformMatrix4fv(programPacked, locationPacked, count, transpose,
7045                                              value);
7046         }
7047         ANGLE_CAPTURE(ProgramUniformMatrix4fvEXT, isCallValid, context, programPacked,
7048                       locationPacked, count, transpose, value);
7049     }
7050     else
7051     {
7052         GenerateContextLostErrorOnCurrentGlobalContext();
7053     }
7054 }
7055 
GL_ProgramUniformMatrix4x2fvEXT(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)7056 void GL_APIENTRY GL_ProgramUniformMatrix4x2fvEXT(GLuint program,
7057                                                  GLint location,
7058                                                  GLsizei count,
7059                                                  GLboolean transpose,
7060                                                  const GLfloat *value)
7061 {
7062     Context *context = GetValidGlobalContext();
7063     EVENT(context, GLProgramUniformMatrix4x2fvEXT,
7064           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
7065           "0x%016" PRIxPTR "",
7066           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
7067 
7068     if (context)
7069     {
7070         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
7071         UniformLocation locationPacked = PackParam<UniformLocation>(location);
7072         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7073         bool isCallValid                                      = (context->skipValidation() ||
7074                             ValidateProgramUniformMatrix4x2fvEXT(
7075                                 context, programPacked, locationPacked, count, transpose, value));
7076         if (isCallValid)
7077         {
7078             context->programUniformMatrix4x2fv(programPacked, locationPacked, count, transpose,
7079                                                value);
7080         }
7081         ANGLE_CAPTURE(ProgramUniformMatrix4x2fvEXT, isCallValid, context, programPacked,
7082                       locationPacked, count, transpose, value);
7083     }
7084     else
7085     {
7086         GenerateContextLostErrorOnCurrentGlobalContext();
7087     }
7088 }
7089 
GL_ProgramUniformMatrix4x3fvEXT(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)7090 void GL_APIENTRY GL_ProgramUniformMatrix4x3fvEXT(GLuint program,
7091                                                  GLint location,
7092                                                  GLsizei count,
7093                                                  GLboolean transpose,
7094                                                  const GLfloat *value)
7095 {
7096     Context *context = GetValidGlobalContext();
7097     EVENT(context, GLProgramUniformMatrix4x3fvEXT,
7098           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
7099           "0x%016" PRIxPTR "",
7100           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
7101 
7102     if (context)
7103     {
7104         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
7105         UniformLocation locationPacked = PackParam<UniformLocation>(location);
7106         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7107         bool isCallValid                                      = (context->skipValidation() ||
7108                             ValidateProgramUniformMatrix4x3fvEXT(
7109                                 context, programPacked, locationPacked, count, transpose, value));
7110         if (isCallValid)
7111         {
7112             context->programUniformMatrix4x3fv(programPacked, locationPacked, count, transpose,
7113                                                value);
7114         }
7115         ANGLE_CAPTURE(ProgramUniformMatrix4x3fvEXT, isCallValid, context, programPacked,
7116                       locationPacked, count, transpose, value);
7117     }
7118     else
7119     {
7120         GenerateContextLostErrorOnCurrentGlobalContext();
7121     }
7122 }
7123 
GL_UseProgramStagesEXT(GLuint pipeline,GLbitfield stages,GLuint program)7124 void GL_APIENTRY GL_UseProgramStagesEXT(GLuint pipeline, GLbitfield stages, GLuint program)
7125 {
7126     Context *context = GetValidGlobalContext();
7127     EVENT(context, GLUseProgramStagesEXT, "context = %d, pipeline = %u, stages = %s, program = %u",
7128           CID(context), pipeline,
7129           GLbitfieldToString(GLenumGroup::UseProgramStageMask, stages).c_str(), program);
7130 
7131     if (context)
7132     {
7133         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
7134         ShaderProgramID programPacked    = PackParam<ShaderProgramID>(program);
7135         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7136         bool isCallValid =
7137             (context->skipValidation() ||
7138              ValidateUseProgramStagesEXT(context, pipelinePacked, stages, programPacked));
7139         if (isCallValid)
7140         {
7141             context->useProgramStages(pipelinePacked, stages, programPacked);
7142         }
7143         ANGLE_CAPTURE(UseProgramStagesEXT, isCallValid, context, pipelinePacked, stages,
7144                       programPacked);
7145     }
7146     else
7147     {
7148         GenerateContextLostErrorOnCurrentGlobalContext();
7149     }
7150 }
7151 
GL_ValidateProgramPipelineEXT(GLuint pipeline)7152 void GL_APIENTRY GL_ValidateProgramPipelineEXT(GLuint pipeline)
7153 {
7154     Context *context = GetValidGlobalContext();
7155     EVENT(context, GLValidateProgramPipelineEXT, "context = %d, pipeline = %u", CID(context),
7156           pipeline);
7157 
7158     if (context)
7159     {
7160         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
7161         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7162         bool isCallValid                                      = (context->skipValidation() ||
7163                             ValidateValidateProgramPipelineEXT(context, pipelinePacked));
7164         if (isCallValid)
7165         {
7166             context->validateProgramPipeline(pipelinePacked);
7167         }
7168         ANGLE_CAPTURE(ValidateProgramPipelineEXT, isCallValid, context, pipelinePacked);
7169     }
7170     else
7171     {
7172         GenerateContextLostErrorOnCurrentGlobalContext();
7173     }
7174 }
7175 
7176 // GL_EXT_shader_framebuffer_fetch_non_coherent
GL_FramebufferFetchBarrierEXT()7177 void GL_APIENTRY GL_FramebufferFetchBarrierEXT()
7178 {
7179     Context *context = GetValidGlobalContext();
7180     EVENT(context, GLFramebufferFetchBarrierEXT, "context = %d", CID(context));
7181 
7182     if (context)
7183     {
7184         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7185         bool isCallValid =
7186             (context->skipValidation() || ValidateFramebufferFetchBarrierEXT(context));
7187         if (isCallValid)
7188         {
7189             context->framebufferFetchBarrier();
7190         }
7191         ANGLE_CAPTURE(FramebufferFetchBarrierEXT, isCallValid, context);
7192     }
7193     else
7194     {
7195         GenerateContextLostErrorOnCurrentGlobalContext();
7196     }
7197 }
7198 
7199 // GL_EXT_shader_io_blocks
7200 
7201 // GL_EXT_tessellation_shader
GL_PatchParameteriEXT(GLenum pname,GLint value)7202 void GL_APIENTRY GL_PatchParameteriEXT(GLenum pname, GLint value)
7203 {
7204     Context *context = GetValidGlobalContext();
7205     EVENT(context, GLPatchParameteriEXT, "context = %d, pname = %s, value = %d", CID(context),
7206           GLenumToString(GLenumGroup::PatchParameterName, pname), value);
7207 
7208     if (context)
7209     {
7210         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7211         bool isCallValid =
7212             (context->skipValidation() || ValidatePatchParameteriEXT(context, pname, value));
7213         if (isCallValid)
7214         {
7215             context->patchParameteri(pname, value);
7216         }
7217         ANGLE_CAPTURE(PatchParameteriEXT, isCallValid, context, pname, value);
7218     }
7219     else
7220     {
7221         GenerateContextLostErrorOnCurrentGlobalContext();
7222     }
7223 }
7224 
7225 // GL_EXT_texture_border_clamp
GL_GetSamplerParameterIivEXT(GLuint sampler,GLenum pname,GLint * params)7226 void GL_APIENTRY GL_GetSamplerParameterIivEXT(GLuint sampler, GLenum pname, GLint *params)
7227 {
7228     Context *context = GetValidGlobalContext();
7229     EVENT(context, GLGetSamplerParameterIivEXT,
7230           "context = %d, sampler = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
7231           sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname), (uintptr_t)params);
7232 
7233     if (context)
7234     {
7235         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
7236         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7237         bool isCallValid =
7238             (context->skipValidation() ||
7239              ValidateGetSamplerParameterIivEXT(context, samplerPacked, pname, params));
7240         if (isCallValid)
7241         {
7242             context->getSamplerParameterIiv(samplerPacked, pname, params);
7243         }
7244         ANGLE_CAPTURE(GetSamplerParameterIivEXT, isCallValid, context, samplerPacked, pname,
7245                       params);
7246     }
7247     else
7248     {
7249         GenerateContextLostErrorOnCurrentGlobalContext();
7250     }
7251 }
7252 
GL_GetSamplerParameterIuivEXT(GLuint sampler,GLenum pname,GLuint * params)7253 void GL_APIENTRY GL_GetSamplerParameterIuivEXT(GLuint sampler, GLenum pname, GLuint *params)
7254 {
7255     Context *context = GetValidGlobalContext();
7256     EVENT(context, GLGetSamplerParameterIuivEXT,
7257           "context = %d, sampler = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
7258           sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname), (uintptr_t)params);
7259 
7260     if (context)
7261     {
7262         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
7263         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7264         bool isCallValid =
7265             (context->skipValidation() ||
7266              ValidateGetSamplerParameterIuivEXT(context, samplerPacked, pname, params));
7267         if (isCallValid)
7268         {
7269             context->getSamplerParameterIuiv(samplerPacked, pname, params);
7270         }
7271         ANGLE_CAPTURE(GetSamplerParameterIuivEXT, isCallValid, context, samplerPacked, pname,
7272                       params);
7273     }
7274     else
7275     {
7276         GenerateContextLostErrorOnCurrentGlobalContext();
7277     }
7278 }
7279 
GL_GetTexParameterIivEXT(GLenum target,GLenum pname,GLint * params)7280 void GL_APIENTRY GL_GetTexParameterIivEXT(GLenum target, GLenum pname, GLint *params)
7281 {
7282     Context *context = GetValidGlobalContext();
7283     EVENT(context, GLGetTexParameterIivEXT,
7284           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
7285           GLenumToString(GLenumGroup::TextureTarget, target),
7286           GLenumToString(GLenumGroup::GetTextureParameter, pname), (uintptr_t)params);
7287 
7288     if (context)
7289     {
7290         TextureType targetPacked                              = PackParam<TextureType>(target);
7291         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7292         bool isCallValid                                      = (context->skipValidation() ||
7293                             ValidateGetTexParameterIivEXT(context, targetPacked, pname, params));
7294         if (isCallValid)
7295         {
7296             context->getTexParameterIiv(targetPacked, pname, params);
7297         }
7298         ANGLE_CAPTURE(GetTexParameterIivEXT, isCallValid, context, targetPacked, pname, params);
7299     }
7300     else
7301     {
7302         GenerateContextLostErrorOnCurrentGlobalContext();
7303     }
7304 }
7305 
GL_GetTexParameterIuivEXT(GLenum target,GLenum pname,GLuint * params)7306 void GL_APIENTRY GL_GetTexParameterIuivEXT(GLenum target, GLenum pname, GLuint *params)
7307 {
7308     Context *context = GetValidGlobalContext();
7309     EVENT(context, GLGetTexParameterIuivEXT,
7310           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
7311           GLenumToString(GLenumGroup::TextureTarget, target),
7312           GLenumToString(GLenumGroup::GetTextureParameter, pname), (uintptr_t)params);
7313 
7314     if (context)
7315     {
7316         TextureType targetPacked                              = PackParam<TextureType>(target);
7317         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7318         bool isCallValid                                      = (context->skipValidation() ||
7319                             ValidateGetTexParameterIuivEXT(context, targetPacked, pname, params));
7320         if (isCallValid)
7321         {
7322             context->getTexParameterIuiv(targetPacked, pname, params);
7323         }
7324         ANGLE_CAPTURE(GetTexParameterIuivEXT, isCallValid, context, targetPacked, pname, params);
7325     }
7326     else
7327     {
7328         GenerateContextLostErrorOnCurrentGlobalContext();
7329     }
7330 }
7331 
GL_SamplerParameterIivEXT(GLuint sampler,GLenum pname,const GLint * param)7332 void GL_APIENTRY GL_SamplerParameterIivEXT(GLuint sampler, GLenum pname, const GLint *param)
7333 {
7334     Context *context = GetValidGlobalContext();
7335     EVENT(context, GLSamplerParameterIivEXT,
7336           "context = %d, sampler = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
7337           sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname), (uintptr_t)param);
7338 
7339     if (context)
7340     {
7341         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
7342         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7343         bool isCallValid                                      = (context->skipValidation() ||
7344                             ValidateSamplerParameterIivEXT(context, samplerPacked, pname, param));
7345         if (isCallValid)
7346         {
7347             context->samplerParameterIiv(samplerPacked, pname, param);
7348         }
7349         ANGLE_CAPTURE(SamplerParameterIivEXT, isCallValid, context, samplerPacked, pname, param);
7350     }
7351     else
7352     {
7353         GenerateContextLostErrorOnCurrentGlobalContext();
7354     }
7355 }
7356 
GL_SamplerParameterIuivEXT(GLuint sampler,GLenum pname,const GLuint * param)7357 void GL_APIENTRY GL_SamplerParameterIuivEXT(GLuint sampler, GLenum pname, const GLuint *param)
7358 {
7359     Context *context = GetValidGlobalContext();
7360     EVENT(context, GLSamplerParameterIuivEXT,
7361           "context = %d, sampler = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
7362           sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname), (uintptr_t)param);
7363 
7364     if (context)
7365     {
7366         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
7367         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7368         bool isCallValid                                      = (context->skipValidation() ||
7369                             ValidateSamplerParameterIuivEXT(context, samplerPacked, pname, param));
7370         if (isCallValid)
7371         {
7372             context->samplerParameterIuiv(samplerPacked, pname, param);
7373         }
7374         ANGLE_CAPTURE(SamplerParameterIuivEXT, isCallValid, context, samplerPacked, pname, param);
7375     }
7376     else
7377     {
7378         GenerateContextLostErrorOnCurrentGlobalContext();
7379     }
7380 }
7381 
GL_TexParameterIivEXT(GLenum target,GLenum pname,const GLint * params)7382 void GL_APIENTRY GL_TexParameterIivEXT(GLenum target, GLenum pname, const GLint *params)
7383 {
7384     Context *context = GetValidGlobalContext();
7385     EVENT(context, GLTexParameterIivEXT,
7386           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
7387           GLenumToString(GLenumGroup::TextureTarget, target),
7388           GLenumToString(GLenumGroup::TextureParameterName, pname), (uintptr_t)params);
7389 
7390     if (context)
7391     {
7392         TextureType targetPacked                              = PackParam<TextureType>(target);
7393         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7394         bool isCallValid                                      = (context->skipValidation() ||
7395                             ValidateTexParameterIivEXT(context, targetPacked, pname, params));
7396         if (isCallValid)
7397         {
7398             context->texParameterIiv(targetPacked, pname, params);
7399         }
7400         ANGLE_CAPTURE(TexParameterIivEXT, isCallValid, context, targetPacked, pname, params);
7401     }
7402     else
7403     {
7404         GenerateContextLostErrorOnCurrentGlobalContext();
7405     }
7406 }
7407 
GL_TexParameterIuivEXT(GLenum target,GLenum pname,const GLuint * params)7408 void GL_APIENTRY GL_TexParameterIuivEXT(GLenum target, GLenum pname, const GLuint *params)
7409 {
7410     Context *context = GetValidGlobalContext();
7411     EVENT(context, GLTexParameterIuivEXT,
7412           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
7413           GLenumToString(GLenumGroup::TextureTarget, target),
7414           GLenumToString(GLenumGroup::TextureParameterName, pname), (uintptr_t)params);
7415 
7416     if (context)
7417     {
7418         TextureType targetPacked                              = PackParam<TextureType>(target);
7419         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7420         bool isCallValid                                      = (context->skipValidation() ||
7421                             ValidateTexParameterIuivEXT(context, targetPacked, pname, params));
7422         if (isCallValid)
7423         {
7424             context->texParameterIuiv(targetPacked, pname, params);
7425         }
7426         ANGLE_CAPTURE(TexParameterIuivEXT, isCallValid, context, targetPacked, pname, params);
7427     }
7428     else
7429     {
7430         GenerateContextLostErrorOnCurrentGlobalContext();
7431     }
7432 }
7433 
7434 // GL_EXT_texture_buffer
GL_TexBufferEXT(GLenum target,GLenum internalformat,GLuint buffer)7435 void GL_APIENTRY GL_TexBufferEXT(GLenum target, GLenum internalformat, GLuint buffer)
7436 {
7437     Context *context = GetValidGlobalContext();
7438     EVENT(context, GLTexBufferEXT, "context = %d, target = %s, internalformat = %s, buffer = %u",
7439           CID(context), GLenumToString(GLenumGroup::TextureTarget, target),
7440           GLenumToString(GLenumGroup::InternalFormat, internalformat), buffer);
7441 
7442     if (context)
7443     {
7444         TextureType targetPacked                              = PackParam<TextureType>(target);
7445         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
7446         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7447         bool isCallValid =
7448             (context->skipValidation() ||
7449              ValidateTexBufferEXT(context, targetPacked, internalformat, bufferPacked));
7450         if (isCallValid)
7451         {
7452             context->texBuffer(targetPacked, internalformat, bufferPacked);
7453         }
7454         ANGLE_CAPTURE(TexBufferEXT, isCallValid, context, targetPacked, internalformat,
7455                       bufferPacked);
7456     }
7457     else
7458     {
7459         GenerateContextLostErrorOnCurrentGlobalContext();
7460     }
7461 }
7462 
GL_TexBufferRangeEXT(GLenum target,GLenum internalformat,GLuint buffer,GLintptr offset,GLsizeiptr size)7463 void GL_APIENTRY GL_TexBufferRangeEXT(GLenum target,
7464                                       GLenum internalformat,
7465                                       GLuint buffer,
7466                                       GLintptr offset,
7467                                       GLsizeiptr size)
7468 {
7469     Context *context = GetValidGlobalContext();
7470     EVENT(context, GLTexBufferRangeEXT,
7471           "context = %d, target = %s, internalformat = %s, buffer = %u, offset = %llu, size = %llu",
7472           CID(context), GLenumToString(GLenumGroup::TextureTarget, target),
7473           GLenumToString(GLenumGroup::InternalFormat, internalformat), buffer,
7474           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size));
7475 
7476     if (context)
7477     {
7478         TextureType targetPacked                              = PackParam<TextureType>(target);
7479         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
7480         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7481         bool isCallValid                                      = (context->skipValidation() ||
7482                             ValidateTexBufferRangeEXT(context, targetPacked, internalformat,
7483                                                       bufferPacked, offset, size));
7484         if (isCallValid)
7485         {
7486             context->texBufferRange(targetPacked, internalformat, bufferPacked, offset, size);
7487         }
7488         ANGLE_CAPTURE(TexBufferRangeEXT, isCallValid, context, targetPacked, internalformat,
7489                       bufferPacked, offset, size);
7490     }
7491     else
7492     {
7493         GenerateContextLostErrorOnCurrentGlobalContext();
7494     }
7495 }
7496 
7497 // GL_EXT_texture_compression_bptc
7498 
7499 // GL_EXT_texture_compression_dxt1
7500 
7501 // GL_EXT_texture_compression_rgtc
7502 
7503 // GL_EXT_texture_compression_s3tc
7504 
7505 // GL_EXT_texture_compression_s3tc_srgb
7506 
7507 // GL_EXT_texture_cube_map_array
7508 
7509 // GL_EXT_texture_filter_anisotropic
7510 
7511 // GL_EXT_texture_format_BGRA8888
7512 
7513 // GL_EXT_texture_sRGB_R8
7514 
7515 // GL_EXT_texture_sRGB_RG8
7516 
7517 // GL_EXT_texture_storage
GL_TexStorage1DEXT(GLenum target,GLsizei levels,GLenum internalformat,GLsizei width)7518 void GL_APIENTRY GL_TexStorage1DEXT(GLenum target,
7519                                     GLsizei levels,
7520                                     GLenum internalformat,
7521                                     GLsizei width)
7522 {
7523     Context *context = GetValidGlobalContext();
7524     EVENT(context, GLTexStorage1DEXT,
7525           "context = %d, target = %s, levels = %d, internalformat = %s, width = %d", CID(context),
7526           GLenumToString(GLenumGroup::TextureTarget, target), levels,
7527           GLenumToString(GLenumGroup::InternalFormat, internalformat), width);
7528 
7529     if (context)
7530     {
7531         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7532         bool isCallValid =
7533             (context->skipValidation() ||
7534              ValidateTexStorage1DEXT(context, target, levels, internalformat, width));
7535         if (isCallValid)
7536         {
7537             context->texStorage1D(target, levels, internalformat, width);
7538         }
7539         ANGLE_CAPTURE(TexStorage1DEXT, isCallValid, context, target, levels, internalformat, width);
7540     }
7541     else
7542     {
7543         GenerateContextLostErrorOnCurrentGlobalContext();
7544     }
7545 }
7546 
GL_TexStorage2DEXT(GLenum target,GLsizei levels,GLenum internalformat,GLsizei width,GLsizei height)7547 void GL_APIENTRY GL_TexStorage2DEXT(GLenum target,
7548                                     GLsizei levels,
7549                                     GLenum internalformat,
7550                                     GLsizei width,
7551                                     GLsizei height)
7552 {
7553     Context *context = GetValidGlobalContext();
7554     EVENT(context, GLTexStorage2DEXT,
7555           "context = %d, target = %s, levels = %d, internalformat = %s, width = %d, height = %d",
7556           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), levels,
7557           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height);
7558 
7559     if (context)
7560     {
7561         TextureType targetPacked                              = PackParam<TextureType>(target);
7562         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7563         bool isCallValid =
7564             (context->skipValidation() ||
7565              ValidateTexStorage2DEXT(context, targetPacked, levels, internalformat, width, height));
7566         if (isCallValid)
7567         {
7568             context->texStorage2D(targetPacked, levels, internalformat, width, height);
7569         }
7570         ANGLE_CAPTURE(TexStorage2DEXT, isCallValid, context, targetPacked, levels, internalformat,
7571                       width, height);
7572     }
7573     else
7574     {
7575         GenerateContextLostErrorOnCurrentGlobalContext();
7576     }
7577 }
7578 
GL_TexStorage3DEXT(GLenum target,GLsizei levels,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth)7579 void GL_APIENTRY GL_TexStorage3DEXT(GLenum target,
7580                                     GLsizei levels,
7581                                     GLenum internalformat,
7582                                     GLsizei width,
7583                                     GLsizei height,
7584                                     GLsizei depth)
7585 {
7586     Context *context = GetValidGlobalContext();
7587     EVENT(context, GLTexStorage3DEXT,
7588           "context = %d, target = %s, levels = %d, internalformat = %s, width = %d, height = %d, "
7589           "depth = %d",
7590           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), levels,
7591           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height, depth);
7592 
7593     if (context)
7594     {
7595         TextureType targetPacked                              = PackParam<TextureType>(target);
7596         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7597         bool isCallValid                                      = (context->skipValidation() ||
7598                             ValidateTexStorage3DEXT(context, targetPacked, levels, internalformat,
7599                                                     width, height, depth));
7600         if (isCallValid)
7601         {
7602             context->texStorage3D(targetPacked, levels, internalformat, width, height, depth);
7603         }
7604         ANGLE_CAPTURE(TexStorage3DEXT, isCallValid, context, targetPacked, levels, internalformat,
7605                       width, height, depth);
7606     }
7607     else
7608     {
7609         GenerateContextLostErrorOnCurrentGlobalContext();
7610     }
7611 }
7612 
7613 // GL_KHR_blend_equation_advanced
GL_BlendBarrierKHR()7614 void GL_APIENTRY GL_BlendBarrierKHR()
7615 {
7616     Context *context = GetValidGlobalContext();
7617     EVENT(context, GLBlendBarrierKHR, "context = %d", CID(context));
7618 
7619     if (context)
7620     {
7621         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7622         bool isCallValid = (context->skipValidation() || ValidateBlendBarrierKHR(context));
7623         if (isCallValid)
7624         {
7625             context->blendBarrier();
7626         }
7627         ANGLE_CAPTURE(BlendBarrierKHR, isCallValid, context);
7628     }
7629     else
7630     {
7631         GenerateContextLostErrorOnCurrentGlobalContext();
7632     }
7633 }
7634 
7635 // GL_KHR_debug
GL_DebugMessageCallbackKHR(GLDEBUGPROCKHR callback,const void * userParam)7636 void GL_APIENTRY GL_DebugMessageCallbackKHR(GLDEBUGPROCKHR callback, const void *userParam)
7637 {
7638     Context *context = GetValidGlobalContext();
7639     EVENT(context, GLDebugMessageCallbackKHR,
7640           "context = %d, callback = 0x%016" PRIxPTR ", userParam = 0x%016" PRIxPTR "", CID(context),
7641           (uintptr_t)callback, (uintptr_t)userParam);
7642 
7643     if (context)
7644     {
7645         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7646         bool isCallValid                                      = (context->skipValidation() ||
7647                             ValidateDebugMessageCallbackKHR(context, callback, userParam));
7648         if (isCallValid)
7649         {
7650             context->debugMessageCallback(callback, userParam);
7651         }
7652         ANGLE_CAPTURE(DebugMessageCallbackKHR, isCallValid, context, callback, userParam);
7653     }
7654     else
7655     {
7656         GenerateContextLostErrorOnCurrentGlobalContext();
7657     }
7658 }
7659 
GL_DebugMessageControlKHR(GLenum source,GLenum type,GLenum severity,GLsizei count,const GLuint * ids,GLboolean enabled)7660 void GL_APIENTRY GL_DebugMessageControlKHR(GLenum source,
7661                                            GLenum type,
7662                                            GLenum severity,
7663                                            GLsizei count,
7664                                            const GLuint *ids,
7665                                            GLboolean enabled)
7666 {
7667     Context *context = GetValidGlobalContext();
7668     EVENT(context, GLDebugMessageControlKHR,
7669           "context = %d, source = %s, type = %s, severity = %s, count = %d, ids = 0x%016" PRIxPTR
7670           ", enabled = %s",
7671           CID(context), GLenumToString(GLenumGroup::DebugSource, source),
7672           GLenumToString(GLenumGroup::DebugType, type),
7673           GLenumToString(GLenumGroup::DebugSeverity, severity), count, (uintptr_t)ids,
7674           GLbooleanToString(enabled));
7675 
7676     if (context)
7677     {
7678         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7679         bool isCallValid =
7680             (context->skipValidation() ||
7681              ValidateDebugMessageControlKHR(context, source, type, severity, count, ids, enabled));
7682         if (isCallValid)
7683         {
7684             context->debugMessageControl(source, type, severity, count, ids, enabled);
7685         }
7686         ANGLE_CAPTURE(DebugMessageControlKHR, isCallValid, context, source, type, severity, count,
7687                       ids, enabled);
7688     }
7689     else
7690     {
7691         GenerateContextLostErrorOnCurrentGlobalContext();
7692     }
7693 }
7694 
GL_DebugMessageInsertKHR(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar * buf)7695 void GL_APIENTRY GL_DebugMessageInsertKHR(GLenum source,
7696                                           GLenum type,
7697                                           GLuint id,
7698                                           GLenum severity,
7699                                           GLsizei length,
7700                                           const GLchar *buf)
7701 {
7702     Context *context = GetValidGlobalContext();
7703     EVENT(context, GLDebugMessageInsertKHR,
7704           "context = %d, source = %s, type = %s, id = %u, severity = %s, length = %d, buf = "
7705           "0x%016" PRIxPTR "",
7706           CID(context), GLenumToString(GLenumGroup::DebugSource, source),
7707           GLenumToString(GLenumGroup::DebugType, type), id,
7708           GLenumToString(GLenumGroup::DebugSeverity, severity), length, (uintptr_t)buf);
7709 
7710     if (context)
7711     {
7712         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7713         bool isCallValid =
7714             (context->skipValidation() ||
7715              ValidateDebugMessageInsertKHR(context, source, type, id, severity, length, buf));
7716         if (isCallValid)
7717         {
7718             context->debugMessageInsert(source, type, id, severity, length, buf);
7719         }
7720         ANGLE_CAPTURE(DebugMessageInsertKHR, isCallValid, context, source, type, id, severity,
7721                       length, buf);
7722     }
7723     else
7724     {
7725         GenerateContextLostErrorOnCurrentGlobalContext();
7726     }
7727 }
7728 
GL_GetDebugMessageLogKHR(GLuint count,GLsizei bufSize,GLenum * sources,GLenum * types,GLuint * ids,GLenum * severities,GLsizei * lengths,GLchar * messageLog)7729 GLuint GL_APIENTRY GL_GetDebugMessageLogKHR(GLuint count,
7730                                             GLsizei bufSize,
7731                                             GLenum *sources,
7732                                             GLenum *types,
7733                                             GLuint *ids,
7734                                             GLenum *severities,
7735                                             GLsizei *lengths,
7736                                             GLchar *messageLog)
7737 {
7738     Context *context = GetValidGlobalContext();
7739     EVENT(context, GLGetDebugMessageLogKHR,
7740           "context = %d, count = %u, bufSize = %d, sources = 0x%016" PRIxPTR
7741           ", types = 0x%016" PRIxPTR ", ids = 0x%016" PRIxPTR ", severities = 0x%016" PRIxPTR
7742           ", lengths = 0x%016" PRIxPTR ", messageLog = 0x%016" PRIxPTR "",
7743           CID(context), count, bufSize, (uintptr_t)sources, (uintptr_t)types, (uintptr_t)ids,
7744           (uintptr_t)severities, (uintptr_t)lengths, (uintptr_t)messageLog);
7745 
7746     GLuint returnValue;
7747     if (context)
7748     {
7749         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7750         bool isCallValid                                      = (context->skipValidation() ||
7751                             ValidateGetDebugMessageLogKHR(context, count, bufSize, sources, types,
7752                                                           ids, severities, lengths, messageLog));
7753         if (isCallValid)
7754         {
7755             returnValue = context->getDebugMessageLog(count, bufSize, sources, types, ids,
7756                                                       severities, lengths, messageLog);
7757         }
7758         else
7759         {
7760             returnValue =
7761                 GetDefaultReturnValue<angle::EntryPoint::GLGetDebugMessageLogKHR, GLuint>();
7762         }
7763         ANGLE_CAPTURE(GetDebugMessageLogKHR, isCallValid, context, count, bufSize, sources, types,
7764                       ids, severities, lengths, messageLog, returnValue);
7765     }
7766     else
7767     {
7768         GenerateContextLostErrorOnCurrentGlobalContext();
7769         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetDebugMessageLogKHR, GLuint>();
7770     }
7771     return returnValue;
7772 }
7773 
GL_GetObjectLabelKHR(GLenum identifier,GLuint name,GLsizei bufSize,GLsizei * length,GLchar * label)7774 void GL_APIENTRY GL_GetObjectLabelKHR(GLenum identifier,
7775                                       GLuint name,
7776                                       GLsizei bufSize,
7777                                       GLsizei *length,
7778                                       GLchar *label)
7779 {
7780     Context *context = GetValidGlobalContext();
7781     EVENT(context, GLGetObjectLabelKHR,
7782           "context = %d, identifier = %s, name = %u, bufSize = %d, length = 0x%016" PRIxPTR
7783           ", label = 0x%016" PRIxPTR "",
7784           CID(context), GLenumToString(GLenumGroup::DefaultGroup, identifier), name, bufSize,
7785           (uintptr_t)length, (uintptr_t)label);
7786 
7787     if (context)
7788     {
7789         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7790         bool isCallValid =
7791             (context->skipValidation() ||
7792              ValidateGetObjectLabelKHR(context, identifier, name, bufSize, length, label));
7793         if (isCallValid)
7794         {
7795             context->getObjectLabel(identifier, name, bufSize, length, label);
7796         }
7797         ANGLE_CAPTURE(GetObjectLabelKHR, isCallValid, context, identifier, name, bufSize, length,
7798                       label);
7799     }
7800     else
7801     {
7802         GenerateContextLostErrorOnCurrentGlobalContext();
7803     }
7804 }
7805 
GL_GetObjectPtrLabelKHR(const void * ptr,GLsizei bufSize,GLsizei * length,GLchar * label)7806 void GL_APIENTRY GL_GetObjectPtrLabelKHR(const void *ptr,
7807                                          GLsizei bufSize,
7808                                          GLsizei *length,
7809                                          GLchar *label)
7810 {
7811     Context *context = GetValidGlobalContext();
7812     EVENT(context, GLGetObjectPtrLabelKHR,
7813           "context = %d, ptr = 0x%016" PRIxPTR ", bufSize = %d, length = 0x%016" PRIxPTR
7814           ", label = 0x%016" PRIxPTR "",
7815           CID(context), (uintptr_t)ptr, bufSize, (uintptr_t)length, (uintptr_t)label);
7816 
7817     if (context)
7818     {
7819         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7820         bool isCallValid                                      = (context->skipValidation() ||
7821                             ValidateGetObjectPtrLabelKHR(context, ptr, bufSize, length, label));
7822         if (isCallValid)
7823         {
7824             context->getObjectPtrLabel(ptr, bufSize, length, label);
7825         }
7826         ANGLE_CAPTURE(GetObjectPtrLabelKHR, isCallValid, context, ptr, bufSize, length, label);
7827     }
7828     else
7829     {
7830         GenerateContextLostErrorOnCurrentGlobalContext();
7831     }
7832 }
7833 
GL_GetPointervKHR(GLenum pname,void ** params)7834 void GL_APIENTRY GL_GetPointervKHR(GLenum pname, void **params)
7835 {
7836     Context *context = GetValidGlobalContext();
7837     EVENT(context, GLGetPointervKHR, "context = %d, pname = %s, params = 0x%016" PRIxPTR "",
7838           CID(context), GLenumToString(GLenumGroup::DefaultGroup, pname), (uintptr_t)params);
7839 
7840     if (context)
7841     {
7842         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7843         bool isCallValid =
7844             (context->skipValidation() || ValidateGetPointervKHR(context, pname, params));
7845         if (isCallValid)
7846         {
7847             context->getPointerv(pname, params);
7848         }
7849         ANGLE_CAPTURE(GetPointervKHR, isCallValid, context, pname, params);
7850     }
7851     else
7852     {
7853         GenerateContextLostErrorOnCurrentGlobalContext();
7854     }
7855 }
7856 
GL_ObjectLabelKHR(GLenum identifier,GLuint name,GLsizei length,const GLchar * label)7857 void GL_APIENTRY GL_ObjectLabelKHR(GLenum identifier,
7858                                    GLuint name,
7859                                    GLsizei length,
7860                                    const GLchar *label)
7861 {
7862     Context *context = GetValidGlobalContext();
7863     EVENT(context, GLObjectLabelKHR,
7864           "context = %d, identifier = %s, name = %u, length = %d, label = 0x%016" PRIxPTR "",
7865           CID(context), GLenumToString(GLenumGroup::ObjectIdentifier, identifier), name, length,
7866           (uintptr_t)label);
7867 
7868     if (context)
7869     {
7870         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7871         bool isCallValid                                      = (context->skipValidation() ||
7872                             ValidateObjectLabelKHR(context, identifier, name, length, label));
7873         if (isCallValid)
7874         {
7875             context->objectLabel(identifier, name, length, label);
7876         }
7877         ANGLE_CAPTURE(ObjectLabelKHR, isCallValid, context, identifier, name, length, label);
7878     }
7879     else
7880     {
7881         GenerateContextLostErrorOnCurrentGlobalContext();
7882     }
7883 }
7884 
GL_ObjectPtrLabelKHR(const void * ptr,GLsizei length,const GLchar * label)7885 void GL_APIENTRY GL_ObjectPtrLabelKHR(const void *ptr, GLsizei length, const GLchar *label)
7886 {
7887     Context *context = GetValidGlobalContext();
7888     EVENT(context, GLObjectPtrLabelKHR,
7889           "context = %d, ptr = 0x%016" PRIxPTR ", length = %d, label = 0x%016" PRIxPTR "",
7890           CID(context), (uintptr_t)ptr, length, (uintptr_t)label);
7891 
7892     if (context)
7893     {
7894         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7895         bool isCallValid =
7896             (context->skipValidation() || ValidateObjectPtrLabelKHR(context, ptr, length, label));
7897         if (isCallValid)
7898         {
7899             context->objectPtrLabel(ptr, length, label);
7900         }
7901         ANGLE_CAPTURE(ObjectPtrLabelKHR, isCallValid, context, ptr, length, label);
7902     }
7903     else
7904     {
7905         GenerateContextLostErrorOnCurrentGlobalContext();
7906     }
7907 }
7908 
GL_PopDebugGroupKHR()7909 void GL_APIENTRY GL_PopDebugGroupKHR()
7910 {
7911     Context *context = GetValidGlobalContext();
7912     EVENT(context, GLPopDebugGroupKHR, "context = %d", CID(context));
7913 
7914     if (context)
7915     {
7916         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7917         bool isCallValid = (context->skipValidation() || ValidatePopDebugGroupKHR(context));
7918         if (isCallValid)
7919         {
7920             context->popDebugGroup();
7921         }
7922         ANGLE_CAPTURE(PopDebugGroupKHR, isCallValid, context);
7923     }
7924     else
7925     {
7926         GenerateContextLostErrorOnCurrentGlobalContext();
7927     }
7928 }
7929 
GL_PushDebugGroupKHR(GLenum source,GLuint id,GLsizei length,const GLchar * message)7930 void GL_APIENTRY GL_PushDebugGroupKHR(GLenum source,
7931                                       GLuint id,
7932                                       GLsizei length,
7933                                       const GLchar *message)
7934 {
7935     Context *context = GetValidGlobalContext();
7936     EVENT(context, GLPushDebugGroupKHR,
7937           "context = %d, source = %s, id = %u, length = %d, message = 0x%016" PRIxPTR "",
7938           CID(context), GLenumToString(GLenumGroup::DebugSource, source), id, length,
7939           (uintptr_t)message);
7940 
7941     if (context)
7942     {
7943         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7944         bool isCallValid                                      = (context->skipValidation() ||
7945                             ValidatePushDebugGroupKHR(context, source, id, length, message));
7946         if (isCallValid)
7947         {
7948             context->pushDebugGroup(source, id, length, message);
7949         }
7950         ANGLE_CAPTURE(PushDebugGroupKHR, isCallValid, context, source, id, length, message);
7951     }
7952     else
7953     {
7954         GenerateContextLostErrorOnCurrentGlobalContext();
7955     }
7956 }
7957 
7958 // GL_KHR_parallel_shader_compile
GL_MaxShaderCompilerThreadsKHR(GLuint count)7959 void GL_APIENTRY GL_MaxShaderCompilerThreadsKHR(GLuint count)
7960 {
7961     Context *context = GetValidGlobalContext();
7962     EVENT(context, GLMaxShaderCompilerThreadsKHR, "context = %d, count = %u", CID(context), count);
7963 
7964     if (context)
7965     {
7966         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7967         bool isCallValid =
7968             (context->skipValidation() || ValidateMaxShaderCompilerThreadsKHR(context, count));
7969         if (isCallValid)
7970         {
7971             context->maxShaderCompilerThreads(count);
7972         }
7973         ANGLE_CAPTURE(MaxShaderCompilerThreadsKHR, isCallValid, context, count);
7974     }
7975     else
7976     {
7977         GenerateContextLostErrorOnCurrentGlobalContext();
7978     }
7979 }
7980 
7981 // GL_NV_fence
GL_DeleteFencesNV(GLsizei n,const GLuint * fences)7982 void GL_APIENTRY GL_DeleteFencesNV(GLsizei n, const GLuint *fences)
7983 {
7984     Context *context = GetValidGlobalContext();
7985     EVENT(context, GLDeleteFencesNV, "context = %d, n = %d, fences = 0x%016" PRIxPTR "",
7986           CID(context), n, (uintptr_t)fences);
7987 
7988     if (context)
7989     {
7990         const FenceNVID *fencesPacked = PackParam<const FenceNVID *>(fences);
7991         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
7992         bool isCallValid =
7993             (context->skipValidation() || ValidateDeleteFencesNV(context, n, fencesPacked));
7994         if (isCallValid)
7995         {
7996             context->deleteFencesNV(n, fencesPacked);
7997         }
7998         ANGLE_CAPTURE(DeleteFencesNV, isCallValid, context, n, fencesPacked);
7999     }
8000     else
8001     {
8002         GenerateContextLostErrorOnCurrentGlobalContext();
8003     }
8004 }
8005 
GL_FinishFenceNV(GLuint fence)8006 void GL_APIENTRY GL_FinishFenceNV(GLuint fence)
8007 {
8008     Context *context = GetValidGlobalContext();
8009     EVENT(context, GLFinishFenceNV, "context = %d, fence = %u", CID(context), fence);
8010 
8011     if (context)
8012     {
8013         FenceNVID fencePacked                                 = PackParam<FenceNVID>(fence);
8014         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8015         bool isCallValid =
8016             (context->skipValidation() || ValidateFinishFenceNV(context, fencePacked));
8017         if (isCallValid)
8018         {
8019             context->finishFenceNV(fencePacked);
8020         }
8021         ANGLE_CAPTURE(FinishFenceNV, isCallValid, context, fencePacked);
8022     }
8023     else
8024     {
8025         GenerateContextLostErrorOnCurrentGlobalContext();
8026     }
8027 }
8028 
GL_GenFencesNV(GLsizei n,GLuint * fences)8029 void GL_APIENTRY GL_GenFencesNV(GLsizei n, GLuint *fences)
8030 {
8031     Context *context = GetValidGlobalContext();
8032     EVENT(context, GLGenFencesNV, "context = %d, n = %d, fences = 0x%016" PRIxPTR "", CID(context),
8033           n, (uintptr_t)fences);
8034 
8035     if (context)
8036     {
8037         FenceNVID *fencesPacked                               = PackParam<FenceNVID *>(fences);
8038         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8039         bool isCallValid =
8040             (context->skipValidation() || ValidateGenFencesNV(context, n, fencesPacked));
8041         if (isCallValid)
8042         {
8043             context->genFencesNV(n, fencesPacked);
8044         }
8045         ANGLE_CAPTURE(GenFencesNV, isCallValid, context, n, fencesPacked);
8046     }
8047     else
8048     {
8049         GenerateContextLostErrorOnCurrentGlobalContext();
8050     }
8051 }
8052 
GL_GetFenceivNV(GLuint fence,GLenum pname,GLint * params)8053 void GL_APIENTRY GL_GetFenceivNV(GLuint fence, GLenum pname, GLint *params)
8054 {
8055     Context *context = GetValidGlobalContext();
8056     EVENT(context, GLGetFenceivNV,
8057           "context = %d, fence = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), fence,
8058           GLenumToString(GLenumGroup::DefaultGroup, pname), (uintptr_t)params);
8059 
8060     if (context)
8061     {
8062         FenceNVID fencePacked                                 = PackParam<FenceNVID>(fence);
8063         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8064         bool isCallValid                                      = (context->skipValidation() ||
8065                             ValidateGetFenceivNV(context, fencePacked, pname, params));
8066         if (isCallValid)
8067         {
8068             context->getFenceivNV(fencePacked, pname, params);
8069         }
8070         ANGLE_CAPTURE(GetFenceivNV, isCallValid, context, fencePacked, pname, params);
8071     }
8072     else
8073     {
8074         GenerateContextLostErrorOnCurrentGlobalContext();
8075     }
8076 }
8077 
GL_IsFenceNV(GLuint fence)8078 GLboolean GL_APIENTRY GL_IsFenceNV(GLuint fence)
8079 {
8080     Context *context = GetValidGlobalContext();
8081     EVENT(context, GLIsFenceNV, "context = %d, fence = %u", CID(context), fence);
8082 
8083     GLboolean returnValue;
8084     if (context)
8085     {
8086         FenceNVID fencePacked                                 = PackParam<FenceNVID>(fence);
8087         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8088         bool isCallValid = (context->skipValidation() || ValidateIsFenceNV(context, fencePacked));
8089         if (isCallValid)
8090         {
8091             returnValue = context->isFenceNV(fencePacked);
8092         }
8093         else
8094         {
8095             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsFenceNV, GLboolean>();
8096         }
8097         ANGLE_CAPTURE(IsFenceNV, isCallValid, context, fencePacked, returnValue);
8098     }
8099     else
8100     {
8101         GenerateContextLostErrorOnCurrentGlobalContext();
8102         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsFenceNV, GLboolean>();
8103     }
8104     return returnValue;
8105 }
8106 
GL_SetFenceNV(GLuint fence,GLenum condition)8107 void GL_APIENTRY GL_SetFenceNV(GLuint fence, GLenum condition)
8108 {
8109     Context *context = GetValidGlobalContext();
8110     EVENT(context, GLSetFenceNV, "context = %d, fence = %u, condition = %s", CID(context), fence,
8111           GLenumToString(GLenumGroup::DefaultGroup, condition));
8112 
8113     if (context)
8114     {
8115         FenceNVID fencePacked                                 = PackParam<FenceNVID>(fence);
8116         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8117         bool isCallValid =
8118             (context->skipValidation() || ValidateSetFenceNV(context, fencePacked, condition));
8119         if (isCallValid)
8120         {
8121             context->setFenceNV(fencePacked, condition);
8122         }
8123         ANGLE_CAPTURE(SetFenceNV, isCallValid, context, fencePacked, condition);
8124     }
8125     else
8126     {
8127         GenerateContextLostErrorOnCurrentGlobalContext();
8128     }
8129 }
8130 
GL_TestFenceNV(GLuint fence)8131 GLboolean GL_APIENTRY GL_TestFenceNV(GLuint fence)
8132 {
8133     Context *context = GetValidGlobalContext();
8134     EVENT(context, GLTestFenceNV, "context = %d, fence = %u", CID(context), fence);
8135 
8136     GLboolean returnValue;
8137     if (context)
8138     {
8139         FenceNVID fencePacked                                 = PackParam<FenceNVID>(fence);
8140         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8141         bool isCallValid = (context->skipValidation() || ValidateTestFenceNV(context, fencePacked));
8142         if (isCallValid)
8143         {
8144             returnValue = context->testFenceNV(fencePacked);
8145         }
8146         else
8147         {
8148             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLTestFenceNV, GLboolean>();
8149         }
8150         ANGLE_CAPTURE(TestFenceNV, isCallValid, context, fencePacked, returnValue);
8151     }
8152     else
8153     {
8154         GenerateContextLostErrorOnCurrentGlobalContext();
8155         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLTestFenceNV, GLboolean>();
8156     }
8157     return returnValue;
8158 }
8159 
8160 // GL_NV_framebuffer_blit
GL_BlitFramebufferNV(GLint srcX0,GLint srcY0,GLint srcX1,GLint srcY1,GLint dstX0,GLint dstY0,GLint dstX1,GLint dstY1,GLbitfield mask,GLenum filter)8161 void GL_APIENTRY GL_BlitFramebufferNV(GLint srcX0,
8162                                       GLint srcY0,
8163                                       GLint srcX1,
8164                                       GLint srcY1,
8165                                       GLint dstX0,
8166                                       GLint dstY0,
8167                                       GLint dstX1,
8168                                       GLint dstY1,
8169                                       GLbitfield mask,
8170                                       GLenum filter)
8171 {
8172     Context *context = GetValidGlobalContext();
8173     EVENT(context, GLBlitFramebufferNV,
8174           "context = %d, srcX0 = %d, srcY0 = %d, srcX1 = %d, srcY1 = %d, dstX0 = %d, dstY0 = %d, "
8175           "dstX1 = %d, dstY1 = %d, mask = %s, filter = %s",
8176           CID(context), srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
8177           GLbitfieldToString(GLenumGroup::ClearBufferMask, mask).c_str(),
8178           GLenumToString(GLenumGroup::BlitFramebufferFilter, filter));
8179 
8180     if (context)
8181     {
8182         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8183         bool isCallValid                                      = (context->skipValidation() ||
8184                             ValidateBlitFramebufferNV(context, srcX0, srcY0, srcX1, srcY1, dstX0,
8185                                                       dstY0, dstX1, dstY1, mask, filter));
8186         if (isCallValid)
8187         {
8188             context->blitFramebufferNV(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask,
8189                                        filter);
8190         }
8191         ANGLE_CAPTURE(BlitFramebufferNV, isCallValid, context, srcX0, srcY0, srcX1, srcY1, dstX0,
8192                       dstY0, dstX1, dstY1, mask, filter);
8193     }
8194     else
8195     {
8196         GenerateContextLostErrorOnCurrentGlobalContext();
8197     }
8198 }
8199 
8200 // GL_OES_EGL_image
GL_EGLImageTargetRenderbufferStorageOES(GLenum target,GLeglImageOES image)8201 void GL_APIENTRY GL_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
8202 {
8203     Context *context = GetValidGlobalContext();
8204     EVENT(context, GLEGLImageTargetRenderbufferStorageOES,
8205           "context = %d, target = %s, image = 0x%016" PRIxPTR "", CID(context),
8206           GLenumToString(GLenumGroup::DefaultGroup, target), (uintptr_t)image);
8207 
8208     if (context)
8209     {
8210         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8211         bool isCallValid                                      = (context->skipValidation() ||
8212                             ValidateEGLImageTargetRenderbufferStorageOES(context, target, image));
8213         if (isCallValid)
8214         {
8215             context->eGLImageTargetRenderbufferStorage(target, image);
8216         }
8217         ANGLE_CAPTURE(EGLImageTargetRenderbufferStorageOES, isCallValid, context, target, image);
8218     }
8219     else
8220     {
8221         GenerateContextLostErrorOnCurrentGlobalContext();
8222     }
8223 }
8224 
GL_EGLImageTargetTexture2DOES(GLenum target,GLeglImageOES image)8225 void GL_APIENTRY GL_EGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
8226 {
8227     Context *context = GetValidGlobalContext();
8228     EVENT(context, GLEGLImageTargetTexture2DOES,
8229           "context = %d, target = %s, image = 0x%016" PRIxPTR "", CID(context),
8230           GLenumToString(GLenumGroup::DefaultGroup, target), (uintptr_t)image);
8231 
8232     if (context)
8233     {
8234         TextureType targetPacked                              = PackParam<TextureType>(target);
8235         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8236         bool isCallValid                                      = (context->skipValidation() ||
8237                             ValidateEGLImageTargetTexture2DOES(context, targetPacked, image));
8238         if (isCallValid)
8239         {
8240             context->eGLImageTargetTexture2D(targetPacked, image);
8241         }
8242         ANGLE_CAPTURE(EGLImageTargetTexture2DOES, isCallValid, context, targetPacked, image);
8243     }
8244     else
8245     {
8246         GenerateContextLostErrorOnCurrentGlobalContext();
8247     }
8248 }
8249 
8250 // GL_OES_compressed_ETC1_RGB8_texture
8251 
8252 // GL_OES_copy_image
GL_CopyImageSubDataOES(GLuint srcName,GLenum srcTarget,GLint srcLevel,GLint srcX,GLint srcY,GLint srcZ,GLuint dstName,GLenum dstTarget,GLint dstLevel,GLint dstX,GLint dstY,GLint dstZ,GLsizei srcWidth,GLsizei srcHeight,GLsizei srcDepth)8253 void GL_APIENTRY GL_CopyImageSubDataOES(GLuint srcName,
8254                                         GLenum srcTarget,
8255                                         GLint srcLevel,
8256                                         GLint srcX,
8257                                         GLint srcY,
8258                                         GLint srcZ,
8259                                         GLuint dstName,
8260                                         GLenum dstTarget,
8261                                         GLint dstLevel,
8262                                         GLint dstX,
8263                                         GLint dstY,
8264                                         GLint dstZ,
8265                                         GLsizei srcWidth,
8266                                         GLsizei srcHeight,
8267                                         GLsizei srcDepth)
8268 {
8269     Context *context = GetValidGlobalContext();
8270     EVENT(context, GLCopyImageSubDataOES,
8271           "context = %d, srcName = %u, srcTarget = %s, srcLevel = %d, srcX = %d, srcY = %d, srcZ = "
8272           "%d, dstName = %u, dstTarget = %s, dstLevel = %d, dstX = %d, dstY = %d, dstZ = %d, "
8273           "srcWidth = %d, srcHeight = %d, srcDepth = %d",
8274           CID(context), srcName, GLenumToString(GLenumGroup::CopyBufferSubDataTarget, srcTarget),
8275           srcLevel, srcX, srcY, srcZ, dstName,
8276           GLenumToString(GLenumGroup::CopyBufferSubDataTarget, dstTarget), dstLevel, dstX, dstY,
8277           dstZ, srcWidth, srcHeight, srcDepth);
8278 
8279     if (context)
8280     {
8281         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8282         bool isCallValid =
8283             (context->skipValidation() ||
8284              ValidateCopyImageSubDataOES(context, srcName, srcTarget, srcLevel, srcX, srcY, srcZ,
8285                                          dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth,
8286                                          srcHeight, srcDepth));
8287         if (isCallValid)
8288         {
8289             context->copyImageSubData(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName,
8290                                       dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight,
8291                                       srcDepth);
8292         }
8293         ANGLE_CAPTURE(CopyImageSubDataOES, isCallValid, context, srcName, srcTarget, srcLevel, srcX,
8294                       srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth,
8295                       srcHeight, srcDepth);
8296     }
8297     else
8298     {
8299         GenerateContextLostErrorOnCurrentGlobalContext();
8300     }
8301 }
8302 
8303 // GL_OES_depth32
8304 
8305 // GL_OES_draw_buffers_indexed
GL_BlendEquationSeparateiOES(GLuint buf,GLenum modeRGB,GLenum modeAlpha)8306 void GL_APIENTRY GL_BlendEquationSeparateiOES(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
8307 {
8308     Context *context = GetValidGlobalContext();
8309     EVENT(context, GLBlendEquationSeparateiOES,
8310           "context = %d, buf = %u, modeRGB = %s, modeAlpha = %s", CID(context), buf,
8311           GLenumToString(GLenumGroup::BlendEquationModeEXT, modeRGB),
8312           GLenumToString(GLenumGroup::BlendEquationModeEXT, modeAlpha));
8313 
8314     if (context)
8315     {
8316         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8317         bool isCallValid                                      = (context->skipValidation() ||
8318                             ValidateBlendEquationSeparateiOES(context, buf, modeRGB, modeAlpha));
8319         if (isCallValid)
8320         {
8321             context->blendEquationSeparatei(buf, modeRGB, modeAlpha);
8322         }
8323         ANGLE_CAPTURE(BlendEquationSeparateiOES, isCallValid, context, buf, modeRGB, modeAlpha);
8324     }
8325     else
8326     {
8327         GenerateContextLostErrorOnCurrentGlobalContext();
8328     }
8329 }
8330 
GL_BlendEquationiOES(GLuint buf,GLenum mode)8331 void GL_APIENTRY GL_BlendEquationiOES(GLuint buf, GLenum mode)
8332 {
8333     Context *context = GetValidGlobalContext();
8334     EVENT(context, GLBlendEquationiOES, "context = %d, buf = %u, mode = %s", CID(context), buf,
8335           GLenumToString(GLenumGroup::BlendEquationModeEXT, mode));
8336 
8337     if (context)
8338     {
8339         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8340         bool isCallValid =
8341             (context->skipValidation() || ValidateBlendEquationiOES(context, buf, mode));
8342         if (isCallValid)
8343         {
8344             context->blendEquationi(buf, mode);
8345         }
8346         ANGLE_CAPTURE(BlendEquationiOES, isCallValid, context, buf, mode);
8347     }
8348     else
8349     {
8350         GenerateContextLostErrorOnCurrentGlobalContext();
8351     }
8352 }
8353 
8354 void GL_APIENTRY
GL_BlendFuncSeparateiOES(GLuint buf,GLenum srcRGB,GLenum dstRGB,GLenum srcAlpha,GLenum dstAlpha)8355 GL_BlendFuncSeparateiOES(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
8356 {
8357     Context *context = GetValidGlobalContext();
8358     EVENT(context, GLBlendFuncSeparateiOES,
8359           "context = %d, buf = %u, srcRGB = %s, dstRGB = %s, srcAlpha = %s, dstAlpha = %s",
8360           CID(context), buf, GLenumToString(GLenumGroup::BlendingFactor, srcRGB),
8361           GLenumToString(GLenumGroup::BlendingFactor, dstRGB),
8362           GLenumToString(GLenumGroup::BlendingFactor, srcAlpha),
8363           GLenumToString(GLenumGroup::BlendingFactor, dstAlpha));
8364 
8365     if (context)
8366     {
8367         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8368         bool isCallValid =
8369             (context->skipValidation() ||
8370              ValidateBlendFuncSeparateiOES(context, buf, srcRGB, dstRGB, srcAlpha, dstAlpha));
8371         if (isCallValid)
8372         {
8373             context->blendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
8374         }
8375         ANGLE_CAPTURE(BlendFuncSeparateiOES, isCallValid, context, buf, srcRGB, dstRGB, srcAlpha,
8376                       dstAlpha);
8377     }
8378     else
8379     {
8380         GenerateContextLostErrorOnCurrentGlobalContext();
8381     }
8382 }
8383 
GL_BlendFunciOES(GLuint buf,GLenum src,GLenum dst)8384 void GL_APIENTRY GL_BlendFunciOES(GLuint buf, GLenum src, GLenum dst)
8385 {
8386     Context *context = GetValidGlobalContext();
8387     EVENT(context, GLBlendFunciOES, "context = %d, buf = %u, src = %s, dst = %s", CID(context), buf,
8388           GLenumToString(GLenumGroup::BlendingFactor, src),
8389           GLenumToString(GLenumGroup::BlendingFactor, dst));
8390 
8391     if (context)
8392     {
8393         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8394         bool isCallValid =
8395             (context->skipValidation() || ValidateBlendFunciOES(context, buf, src, dst));
8396         if (isCallValid)
8397         {
8398             context->blendFunci(buf, src, dst);
8399         }
8400         ANGLE_CAPTURE(BlendFunciOES, isCallValid, context, buf, src, dst);
8401     }
8402     else
8403     {
8404         GenerateContextLostErrorOnCurrentGlobalContext();
8405     }
8406 }
8407 
GL_ColorMaskiOES(GLuint index,GLboolean r,GLboolean g,GLboolean b,GLboolean a)8408 void GL_APIENTRY GL_ColorMaskiOES(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
8409 {
8410     Context *context = GetValidGlobalContext();
8411     EVENT(context, GLColorMaskiOES, "context = %d, index = %u, r = %s, g = %s, b = %s, a = %s",
8412           CID(context), index, GLbooleanToString(r), GLbooleanToString(g), GLbooleanToString(b),
8413           GLbooleanToString(a));
8414 
8415     if (context)
8416     {
8417         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8418         bool isCallValid =
8419             (context->skipValidation() || ValidateColorMaskiOES(context, index, r, g, b, a));
8420         if (isCallValid)
8421         {
8422             context->colorMaski(index, r, g, b, a);
8423         }
8424         ANGLE_CAPTURE(ColorMaskiOES, isCallValid, context, index, r, g, b, a);
8425     }
8426     else
8427     {
8428         GenerateContextLostErrorOnCurrentGlobalContext();
8429     }
8430 }
8431 
GL_DisableiOES(GLenum target,GLuint index)8432 void GL_APIENTRY GL_DisableiOES(GLenum target, GLuint index)
8433 {
8434     Context *context = GetValidGlobalContext();
8435     EVENT(context, GLDisableiOES, "context = %d, target = %s, index = %u", CID(context),
8436           GLenumToString(GLenumGroup::EnableCap, target), index);
8437 
8438     if (context)
8439     {
8440         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8441         bool isCallValid =
8442             (context->skipValidation() || ValidateDisableiOES(context, target, index));
8443         if (isCallValid)
8444         {
8445             context->disablei(target, index);
8446         }
8447         ANGLE_CAPTURE(DisableiOES, isCallValid, context, target, index);
8448     }
8449     else
8450     {
8451         GenerateContextLostErrorOnCurrentGlobalContext();
8452     }
8453 }
8454 
GL_EnableiOES(GLenum target,GLuint index)8455 void GL_APIENTRY GL_EnableiOES(GLenum target, GLuint index)
8456 {
8457     Context *context = GetValidGlobalContext();
8458     EVENT(context, GLEnableiOES, "context = %d, target = %s, index = %u", CID(context),
8459           GLenumToString(GLenumGroup::EnableCap, target), index);
8460 
8461     if (context)
8462     {
8463         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8464         bool isCallValid =
8465             (context->skipValidation() || ValidateEnableiOES(context, target, index));
8466         if (isCallValid)
8467         {
8468             context->enablei(target, index);
8469         }
8470         ANGLE_CAPTURE(EnableiOES, isCallValid, context, target, index);
8471     }
8472     else
8473     {
8474         GenerateContextLostErrorOnCurrentGlobalContext();
8475     }
8476 }
8477 
GL_IsEnablediOES(GLenum target,GLuint index)8478 GLboolean GL_APIENTRY GL_IsEnablediOES(GLenum target, GLuint index)
8479 {
8480     Context *context = GetValidGlobalContext();
8481     EVENT(context, GLIsEnablediOES, "context = %d, target = %s, index = %u", CID(context),
8482           GLenumToString(GLenumGroup::EnableCap, target), index);
8483 
8484     GLboolean returnValue;
8485     if (context)
8486     {
8487         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8488         bool isCallValid =
8489             (context->skipValidation() || ValidateIsEnablediOES(context, target, index));
8490         if (isCallValid)
8491         {
8492             returnValue = context->isEnabledi(target, index);
8493         }
8494         else
8495         {
8496             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsEnablediOES, GLboolean>();
8497         }
8498         ANGLE_CAPTURE(IsEnablediOES, isCallValid, context, target, index, returnValue);
8499     }
8500     else
8501     {
8502         GenerateContextLostErrorOnCurrentGlobalContext();
8503         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsEnablediOES, GLboolean>();
8504     }
8505     return returnValue;
8506 }
8507 
8508 // GL_OES_draw_elements_base_vertex
GL_DrawElementsBaseVertexOES(GLenum mode,GLsizei count,GLenum type,const void * indices,GLint basevertex)8509 void GL_APIENTRY GL_DrawElementsBaseVertexOES(GLenum mode,
8510                                               GLsizei count,
8511                                               GLenum type,
8512                                               const void *indices,
8513                                               GLint basevertex)
8514 {
8515     Context *context = GetValidGlobalContext();
8516     EVENT(context, GLDrawElementsBaseVertexOES,
8517           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
8518           ", basevertex = %d",
8519           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), count,
8520           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices, basevertex);
8521 
8522     if (context)
8523     {
8524         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
8525         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
8526         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8527         bool isCallValid                                      = (context->skipValidation() ||
8528                             ValidateDrawElementsBaseVertexOES(context, modePacked, count,
8529                                                               typePacked, indices, basevertex));
8530         if (isCallValid)
8531         {
8532             context->drawElementsBaseVertex(modePacked, count, typePacked, indices, basevertex);
8533         }
8534         ANGLE_CAPTURE(DrawElementsBaseVertexOES, isCallValid, context, modePacked, count,
8535                       typePacked, indices, basevertex);
8536     }
8537     else
8538     {
8539         GenerateContextLostErrorOnCurrentGlobalContext();
8540     }
8541 }
8542 
GL_DrawElementsInstancedBaseVertexOES(GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei instancecount,GLint basevertex)8543 void GL_APIENTRY GL_DrawElementsInstancedBaseVertexOES(GLenum mode,
8544                                                        GLsizei count,
8545                                                        GLenum type,
8546                                                        const void *indices,
8547                                                        GLsizei instancecount,
8548                                                        GLint basevertex)
8549 {
8550     Context *context = GetValidGlobalContext();
8551     EVENT(context, GLDrawElementsInstancedBaseVertexOES,
8552           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
8553           ", instancecount = %d, basevertex = %d",
8554           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), count,
8555           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices, instancecount,
8556           basevertex);
8557 
8558     if (context)
8559     {
8560         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
8561         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
8562         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8563         bool isCallValid = (context->skipValidation() || ValidateDrawElementsInstancedBaseVertexOES(
8564                                                              context, modePacked, count, typePacked,
8565                                                              indices, instancecount, basevertex));
8566         if (isCallValid)
8567         {
8568             context->drawElementsInstancedBaseVertex(modePacked, count, typePacked, indices,
8569                                                      instancecount, basevertex);
8570         }
8571         ANGLE_CAPTURE(DrawElementsInstancedBaseVertexOES, isCallValid, context, modePacked, count,
8572                       typePacked, indices, instancecount, basevertex);
8573     }
8574     else
8575     {
8576         GenerateContextLostErrorOnCurrentGlobalContext();
8577     }
8578 }
8579 
GL_DrawRangeElementsBaseVertexOES(GLenum mode,GLuint start,GLuint end,GLsizei count,GLenum type,const void * indices,GLint basevertex)8580 void GL_APIENTRY GL_DrawRangeElementsBaseVertexOES(GLenum mode,
8581                                                    GLuint start,
8582                                                    GLuint end,
8583                                                    GLsizei count,
8584                                                    GLenum type,
8585                                                    const void *indices,
8586                                                    GLint basevertex)
8587 {
8588     Context *context = GetValidGlobalContext();
8589     EVENT(context, GLDrawRangeElementsBaseVertexOES,
8590           "context = %d, mode = %s, start = %u, end = %u, count = %d, type = %s, indices = "
8591           "0x%016" PRIxPTR ", basevertex = %d",
8592           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), start, end, count,
8593           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices, basevertex);
8594 
8595     if (context)
8596     {
8597         PrimitiveMode modePacked                              = PackParam<PrimitiveMode>(mode);
8598         DrawElementsType typePacked                           = PackParam<DrawElementsType>(type);
8599         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8600         bool isCallValid = (context->skipValidation() || ValidateDrawRangeElementsBaseVertexOES(
8601                                                              context, modePacked, start, end, count,
8602                                                              typePacked, indices, basevertex));
8603         if (isCallValid)
8604         {
8605             context->drawRangeElementsBaseVertex(modePacked, start, end, count, typePacked, indices,
8606                                                  basevertex);
8607         }
8608         ANGLE_CAPTURE(DrawRangeElementsBaseVertexOES, isCallValid, context, modePacked, start, end,
8609                       count, typePacked, indices, basevertex);
8610     }
8611     else
8612     {
8613         GenerateContextLostErrorOnCurrentGlobalContext();
8614     }
8615 }
8616 
8617 // MultiDrawElementsBaseVertexEXT is already defined.
8618 
8619 // GL_OES_draw_texture
GL_DrawTexfOES(GLfloat x,GLfloat y,GLfloat z,GLfloat width,GLfloat height)8620 void GL_APIENTRY GL_DrawTexfOES(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height)
8621 {
8622     Context *context = GetValidGlobalContext();
8623     EVENT(context, GLDrawTexfOES, "context = %d, x = %f, y = %f, z = %f, width = %f, height = %f",
8624           CID(context), x, y, z, width, height);
8625 
8626     if (context)
8627     {
8628         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8629         bool isCallValid =
8630             (context->skipValidation() || ValidateDrawTexfOES(context, x, y, z, width, height));
8631         if (isCallValid)
8632         {
8633             context->drawTexf(x, y, z, width, height);
8634         }
8635         ANGLE_CAPTURE(DrawTexfOES, isCallValid, context, x, y, z, width, height);
8636     }
8637     else
8638     {
8639         GenerateContextLostErrorOnCurrentGlobalContext();
8640     }
8641 }
8642 
GL_DrawTexfvOES(const GLfloat * coords)8643 void GL_APIENTRY GL_DrawTexfvOES(const GLfloat *coords)
8644 {
8645     Context *context = GetValidGlobalContext();
8646     EVENT(context, GLDrawTexfvOES, "context = %d, coords = 0x%016" PRIxPTR "", CID(context),
8647           (uintptr_t)coords);
8648 
8649     if (context)
8650     {
8651         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8652         bool isCallValid = (context->skipValidation() || ValidateDrawTexfvOES(context, coords));
8653         if (isCallValid)
8654         {
8655             context->drawTexfv(coords);
8656         }
8657         ANGLE_CAPTURE(DrawTexfvOES, isCallValid, context, coords);
8658     }
8659     else
8660     {
8661         GenerateContextLostErrorOnCurrentGlobalContext();
8662     }
8663 }
8664 
GL_DrawTexiOES(GLint x,GLint y,GLint z,GLint width,GLint height)8665 void GL_APIENTRY GL_DrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height)
8666 {
8667     Context *context = GetValidGlobalContext();
8668     EVENT(context, GLDrawTexiOES, "context = %d, x = %d, y = %d, z = %d, width = %d, height = %d",
8669           CID(context), x, y, z, width, height);
8670 
8671     if (context)
8672     {
8673         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8674         bool isCallValid =
8675             (context->skipValidation() || ValidateDrawTexiOES(context, x, y, z, width, height));
8676         if (isCallValid)
8677         {
8678             context->drawTexi(x, y, z, width, height);
8679         }
8680         ANGLE_CAPTURE(DrawTexiOES, isCallValid, context, x, y, z, width, height);
8681     }
8682     else
8683     {
8684         GenerateContextLostErrorOnCurrentGlobalContext();
8685     }
8686 }
8687 
GL_DrawTexivOES(const GLint * coords)8688 void GL_APIENTRY GL_DrawTexivOES(const GLint *coords)
8689 {
8690     Context *context = GetValidGlobalContext();
8691     EVENT(context, GLDrawTexivOES, "context = %d, coords = 0x%016" PRIxPTR "", CID(context),
8692           (uintptr_t)coords);
8693 
8694     if (context)
8695     {
8696         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8697         bool isCallValid = (context->skipValidation() || ValidateDrawTexivOES(context, coords));
8698         if (isCallValid)
8699         {
8700             context->drawTexiv(coords);
8701         }
8702         ANGLE_CAPTURE(DrawTexivOES, isCallValid, context, coords);
8703     }
8704     else
8705     {
8706         GenerateContextLostErrorOnCurrentGlobalContext();
8707     }
8708 }
8709 
GL_DrawTexsOES(GLshort x,GLshort y,GLshort z,GLshort width,GLshort height)8710 void GL_APIENTRY GL_DrawTexsOES(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height)
8711 {
8712     Context *context = GetValidGlobalContext();
8713     EVENT(context, GLDrawTexsOES, "context = %d, x = %d, y = %d, z = %d, width = %d, height = %d",
8714           CID(context), x, y, z, width, height);
8715 
8716     if (context)
8717     {
8718         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8719         bool isCallValid =
8720             (context->skipValidation() || ValidateDrawTexsOES(context, x, y, z, width, height));
8721         if (isCallValid)
8722         {
8723             context->drawTexs(x, y, z, width, height);
8724         }
8725         ANGLE_CAPTURE(DrawTexsOES, isCallValid, context, x, y, z, width, height);
8726     }
8727     else
8728     {
8729         GenerateContextLostErrorOnCurrentGlobalContext();
8730     }
8731 }
8732 
GL_DrawTexsvOES(const GLshort * coords)8733 void GL_APIENTRY GL_DrawTexsvOES(const GLshort *coords)
8734 {
8735     Context *context = GetValidGlobalContext();
8736     EVENT(context, GLDrawTexsvOES, "context = %d, coords = 0x%016" PRIxPTR "", CID(context),
8737           (uintptr_t)coords);
8738 
8739     if (context)
8740     {
8741         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8742         bool isCallValid = (context->skipValidation() || ValidateDrawTexsvOES(context, coords));
8743         if (isCallValid)
8744         {
8745             context->drawTexsv(coords);
8746         }
8747         ANGLE_CAPTURE(DrawTexsvOES, isCallValid, context, coords);
8748     }
8749     else
8750     {
8751         GenerateContextLostErrorOnCurrentGlobalContext();
8752     }
8753 }
8754 
GL_DrawTexxOES(GLfixed x,GLfixed y,GLfixed z,GLfixed width,GLfixed height)8755 void GL_APIENTRY GL_DrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height)
8756 {
8757     Context *context = GetValidGlobalContext();
8758     EVENT(context, GLDrawTexxOES,
8759           "context = %d, x = 0x%X, y = 0x%X, z = 0x%X, width = 0x%X, height = 0x%X", CID(context),
8760           x, y, z, width, height);
8761 
8762     if (context)
8763     {
8764         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8765         bool isCallValid =
8766             (context->skipValidation() || ValidateDrawTexxOES(context, x, y, z, width, height));
8767         if (isCallValid)
8768         {
8769             context->drawTexx(x, y, z, width, height);
8770         }
8771         ANGLE_CAPTURE(DrawTexxOES, isCallValid, context, x, y, z, width, height);
8772     }
8773     else
8774     {
8775         GenerateContextLostErrorOnCurrentGlobalContext();
8776     }
8777 }
8778 
GL_DrawTexxvOES(const GLfixed * coords)8779 void GL_APIENTRY GL_DrawTexxvOES(const GLfixed *coords)
8780 {
8781     Context *context = GetValidGlobalContext();
8782     EVENT(context, GLDrawTexxvOES, "context = %d, coords = 0x%016" PRIxPTR "", CID(context),
8783           (uintptr_t)coords);
8784 
8785     if (context)
8786     {
8787         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8788         bool isCallValid = (context->skipValidation() || ValidateDrawTexxvOES(context, coords));
8789         if (isCallValid)
8790         {
8791             context->drawTexxv(coords);
8792         }
8793         ANGLE_CAPTURE(DrawTexxvOES, isCallValid, context, coords);
8794     }
8795     else
8796     {
8797         GenerateContextLostErrorOnCurrentGlobalContext();
8798     }
8799 }
8800 
8801 // GL_OES_framebuffer_object
GL_BindFramebufferOES(GLenum target,GLuint framebuffer)8802 void GL_APIENTRY GL_BindFramebufferOES(GLenum target, GLuint framebuffer)
8803 {
8804     Context *context = GetValidGlobalContext();
8805     EVENT(context, GLBindFramebufferOES, "context = %d, target = %s, framebuffer = %u",
8806           CID(context), GLenumToString(GLenumGroup::FramebufferTarget, target), framebuffer);
8807 
8808     if (context)
8809     {
8810         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
8811         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8812         bool isCallValid                                      = (context->skipValidation() ||
8813                             ValidateBindFramebufferOES(context, target, framebufferPacked));
8814         if (isCallValid)
8815         {
8816             context->bindFramebuffer(target, framebufferPacked);
8817         }
8818         ANGLE_CAPTURE(BindFramebufferOES, isCallValid, context, target, framebufferPacked);
8819     }
8820     else
8821     {
8822         GenerateContextLostErrorOnCurrentGlobalContext();
8823     }
8824 }
8825 
GL_BindRenderbufferOES(GLenum target,GLuint renderbuffer)8826 void GL_APIENTRY GL_BindRenderbufferOES(GLenum target, GLuint renderbuffer)
8827 {
8828     Context *context = GetValidGlobalContext();
8829     EVENT(context, GLBindRenderbufferOES, "context = %d, target = %s, renderbuffer = %u",
8830           CID(context), GLenumToString(GLenumGroup::RenderbufferTarget, target), renderbuffer);
8831 
8832     if (context)
8833     {
8834         RenderbufferID renderbufferPacked = PackParam<RenderbufferID>(renderbuffer);
8835         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8836         bool isCallValid                                      = (context->skipValidation() ||
8837                             ValidateBindRenderbufferOES(context, target, renderbufferPacked));
8838         if (isCallValid)
8839         {
8840             context->bindRenderbuffer(target, renderbufferPacked);
8841         }
8842         ANGLE_CAPTURE(BindRenderbufferOES, isCallValid, context, target, renderbufferPacked);
8843     }
8844     else
8845     {
8846         GenerateContextLostErrorOnCurrentGlobalContext();
8847     }
8848 }
8849 
GL_CheckFramebufferStatusOES(GLenum target)8850 GLenum GL_APIENTRY GL_CheckFramebufferStatusOES(GLenum target)
8851 {
8852     Context *context = GetValidGlobalContext();
8853     EVENT(context, GLCheckFramebufferStatusOES, "context = %d, target = %s", CID(context),
8854           GLenumToString(GLenumGroup::FramebufferTarget, target));
8855 
8856     GLenum returnValue;
8857     if (context)
8858     {
8859         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8860         bool isCallValid =
8861             (context->skipValidation() || ValidateCheckFramebufferStatusOES(context, target));
8862         if (isCallValid)
8863         {
8864             returnValue = context->checkFramebufferStatus(target);
8865         }
8866         else
8867         {
8868             returnValue =
8869                 GetDefaultReturnValue<angle::EntryPoint::GLCheckFramebufferStatusOES, GLenum>();
8870         }
8871         ANGLE_CAPTURE(CheckFramebufferStatusOES, isCallValid, context, target, returnValue);
8872     }
8873     else
8874     {
8875         GenerateContextLostErrorOnCurrentGlobalContext();
8876         returnValue =
8877             GetDefaultReturnValue<angle::EntryPoint::GLCheckFramebufferStatusOES, GLenum>();
8878     }
8879     return returnValue;
8880 }
8881 
GL_DeleteFramebuffersOES(GLsizei n,const GLuint * framebuffers)8882 void GL_APIENTRY GL_DeleteFramebuffersOES(GLsizei n, const GLuint *framebuffers)
8883 {
8884     Context *context = GetValidGlobalContext();
8885     EVENT(context, GLDeleteFramebuffersOES,
8886           "context = %d, n = %d, framebuffers = 0x%016" PRIxPTR "", CID(context), n,
8887           (uintptr_t)framebuffers);
8888 
8889     if (context)
8890     {
8891         const FramebufferID *framebuffersPacked = PackParam<const FramebufferID *>(framebuffers);
8892         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8893         bool isCallValid                                      = (context->skipValidation() ||
8894                             ValidateDeleteFramebuffersOES(context, n, framebuffersPacked));
8895         if (isCallValid)
8896         {
8897             context->deleteFramebuffers(n, framebuffersPacked);
8898         }
8899         ANGLE_CAPTURE(DeleteFramebuffersOES, isCallValid, context, n, framebuffersPacked);
8900     }
8901     else
8902     {
8903         GenerateContextLostErrorOnCurrentGlobalContext();
8904     }
8905 }
8906 
GL_DeleteRenderbuffersOES(GLsizei n,const GLuint * renderbuffers)8907 void GL_APIENTRY GL_DeleteRenderbuffersOES(GLsizei n, const GLuint *renderbuffers)
8908 {
8909     Context *context = GetValidGlobalContext();
8910     EVENT(context, GLDeleteRenderbuffersOES,
8911           "context = %d, n = %d, renderbuffers = 0x%016" PRIxPTR "", CID(context), n,
8912           (uintptr_t)renderbuffers);
8913 
8914     if (context)
8915     {
8916         const RenderbufferID *renderbuffersPacked =
8917             PackParam<const RenderbufferID *>(renderbuffers);
8918         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8919         bool isCallValid                                      = (context->skipValidation() ||
8920                             ValidateDeleteRenderbuffersOES(context, n, renderbuffersPacked));
8921         if (isCallValid)
8922         {
8923             context->deleteRenderbuffers(n, renderbuffersPacked);
8924         }
8925         ANGLE_CAPTURE(DeleteRenderbuffersOES, isCallValid, context, n, renderbuffersPacked);
8926     }
8927     else
8928     {
8929         GenerateContextLostErrorOnCurrentGlobalContext();
8930     }
8931 }
8932 
GL_FramebufferRenderbufferOES(GLenum target,GLenum attachment,GLenum renderbuffertarget,GLuint renderbuffer)8933 void GL_APIENTRY GL_FramebufferRenderbufferOES(GLenum target,
8934                                                GLenum attachment,
8935                                                GLenum renderbuffertarget,
8936                                                GLuint renderbuffer)
8937 {
8938     Context *context = GetValidGlobalContext();
8939     EVENT(context, GLFramebufferRenderbufferOES,
8940           "context = %d, target = %s, attachment = %s, renderbuffertarget = %s, renderbuffer = %u",
8941           CID(context), GLenumToString(GLenumGroup::FramebufferTarget, target),
8942           GLenumToString(GLenumGroup::FramebufferAttachment, attachment),
8943           GLenumToString(GLenumGroup::RenderbufferTarget, renderbuffertarget), renderbuffer);
8944 
8945     if (context)
8946     {
8947         RenderbufferID renderbufferPacked = PackParam<RenderbufferID>(renderbuffer);
8948         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8949         bool isCallValid =
8950             (context->skipValidation() ||
8951              ValidateFramebufferRenderbufferOES(context, target, attachment, renderbuffertarget,
8952                                                 renderbufferPacked));
8953         if (isCallValid)
8954         {
8955             context->framebufferRenderbuffer(target, attachment, renderbuffertarget,
8956                                              renderbufferPacked);
8957         }
8958         ANGLE_CAPTURE(FramebufferRenderbufferOES, isCallValid, context, target, attachment,
8959                       renderbuffertarget, renderbufferPacked);
8960     }
8961     else
8962     {
8963         GenerateContextLostErrorOnCurrentGlobalContext();
8964     }
8965 }
8966 
GL_FramebufferTexture2DOES(GLenum target,GLenum attachment,GLenum textarget,GLuint texture,GLint level)8967 void GL_APIENTRY GL_FramebufferTexture2DOES(GLenum target,
8968                                             GLenum attachment,
8969                                             GLenum textarget,
8970                                             GLuint texture,
8971                                             GLint level)
8972 {
8973     Context *context = GetValidGlobalContext();
8974     EVENT(context, GLFramebufferTexture2DOES,
8975           "context = %d, target = %s, attachment = %s, textarget = %s, texture = %u, level = %d",
8976           CID(context), GLenumToString(GLenumGroup::FramebufferTarget, target),
8977           GLenumToString(GLenumGroup::FramebufferAttachment, attachment),
8978           GLenumToString(GLenumGroup::TextureTarget, textarget), texture, level);
8979 
8980     if (context)
8981     {
8982         TextureTarget textargetPacked                         = PackParam<TextureTarget>(textarget);
8983         TextureID texturePacked                               = PackParam<TextureID>(texture);
8984         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
8985         bool isCallValid                                      = (context->skipValidation() ||
8986                             ValidateFramebufferTexture2DOES(context, target, attachment,
8987                                                             textargetPacked, texturePacked, level));
8988         if (isCallValid)
8989         {
8990             context->framebufferTexture2D(target, attachment, textargetPacked, texturePacked,
8991                                           level);
8992         }
8993         ANGLE_CAPTURE(FramebufferTexture2DOES, isCallValid, context, target, attachment,
8994                       textargetPacked, texturePacked, level);
8995     }
8996     else
8997     {
8998         GenerateContextLostErrorOnCurrentGlobalContext();
8999     }
9000 }
9001 
GL_GenFramebuffersOES(GLsizei n,GLuint * framebuffers)9002 void GL_APIENTRY GL_GenFramebuffersOES(GLsizei n, GLuint *framebuffers)
9003 {
9004     Context *context = GetValidGlobalContext();
9005     EVENT(context, GLGenFramebuffersOES, "context = %d, n = %d, framebuffers = 0x%016" PRIxPTR "",
9006           CID(context), n, (uintptr_t)framebuffers);
9007 
9008     if (context)
9009     {
9010         FramebufferID *framebuffersPacked = PackParam<FramebufferID *>(framebuffers);
9011         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9012         bool isCallValid                                      = (context->skipValidation() ||
9013                             ValidateGenFramebuffersOES(context, n, framebuffersPacked));
9014         if (isCallValid)
9015         {
9016             context->genFramebuffers(n, framebuffersPacked);
9017         }
9018         ANGLE_CAPTURE(GenFramebuffersOES, isCallValid, context, n, framebuffersPacked);
9019     }
9020     else
9021     {
9022         GenerateContextLostErrorOnCurrentGlobalContext();
9023     }
9024 }
9025 
GL_GenRenderbuffersOES(GLsizei n,GLuint * renderbuffers)9026 void GL_APIENTRY GL_GenRenderbuffersOES(GLsizei n, GLuint *renderbuffers)
9027 {
9028     Context *context = GetValidGlobalContext();
9029     EVENT(context, GLGenRenderbuffersOES, "context = %d, n = %d, renderbuffers = 0x%016" PRIxPTR "",
9030           CID(context), n, (uintptr_t)renderbuffers);
9031 
9032     if (context)
9033     {
9034         RenderbufferID *renderbuffersPacked = PackParam<RenderbufferID *>(renderbuffers);
9035         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9036         bool isCallValid                                      = (context->skipValidation() ||
9037                             ValidateGenRenderbuffersOES(context, n, renderbuffersPacked));
9038         if (isCallValid)
9039         {
9040             context->genRenderbuffers(n, renderbuffersPacked);
9041         }
9042         ANGLE_CAPTURE(GenRenderbuffersOES, isCallValid, context, n, renderbuffersPacked);
9043     }
9044     else
9045     {
9046         GenerateContextLostErrorOnCurrentGlobalContext();
9047     }
9048 }
9049 
GL_GenerateMipmapOES(GLenum target)9050 void GL_APIENTRY GL_GenerateMipmapOES(GLenum target)
9051 {
9052     Context *context = GetValidGlobalContext();
9053     EVENT(context, GLGenerateMipmapOES, "context = %d, target = %s", CID(context),
9054           GLenumToString(GLenumGroup::TextureTarget, target));
9055 
9056     if (context)
9057     {
9058         TextureType targetPacked                              = PackParam<TextureType>(target);
9059         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9060         bool isCallValid =
9061             (context->skipValidation() || ValidateGenerateMipmapOES(context, targetPacked));
9062         if (isCallValid)
9063         {
9064             context->generateMipmap(targetPacked);
9065         }
9066         ANGLE_CAPTURE(GenerateMipmapOES, isCallValid, context, targetPacked);
9067     }
9068     else
9069     {
9070         GenerateContextLostErrorOnCurrentGlobalContext();
9071     }
9072 }
9073 
GL_GetFramebufferAttachmentParameterivOES(GLenum target,GLenum attachment,GLenum pname,GLint * params)9074 void GL_APIENTRY GL_GetFramebufferAttachmentParameterivOES(GLenum target,
9075                                                            GLenum attachment,
9076                                                            GLenum pname,
9077                                                            GLint *params)
9078 {
9079     Context *context = GetValidGlobalContext();
9080     EVENT(context, GLGetFramebufferAttachmentParameterivOES,
9081           "context = %d, target = %s, attachment = %s, pname = %s, params = 0x%016" PRIxPTR "",
9082           CID(context), GLenumToString(GLenumGroup::FramebufferTarget, target),
9083           GLenumToString(GLenumGroup::FramebufferAttachment, attachment),
9084           GLenumToString(GLenumGroup::FramebufferAttachmentParameterName, pname),
9085           (uintptr_t)params);
9086 
9087     if (context)
9088     {
9089         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9090         bool isCallValid =
9091             (context->skipValidation() || ValidateGetFramebufferAttachmentParameterivOES(
9092                                               context, target, attachment, pname, params));
9093         if (isCallValid)
9094         {
9095             context->getFramebufferAttachmentParameteriv(target, attachment, pname, params);
9096         }
9097         ANGLE_CAPTURE(GetFramebufferAttachmentParameterivOES, isCallValid, context, target,
9098                       attachment, pname, params);
9099     }
9100     else
9101     {
9102         GenerateContextLostErrorOnCurrentGlobalContext();
9103     }
9104 }
9105 
GL_GetRenderbufferParameterivOES(GLenum target,GLenum pname,GLint * params)9106 void GL_APIENTRY GL_GetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint *params)
9107 {
9108     Context *context = GetValidGlobalContext();
9109     EVENT(context, GLGetRenderbufferParameterivOES,
9110           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
9111           GLenumToString(GLenumGroup::RenderbufferTarget, target),
9112           GLenumToString(GLenumGroup::RenderbufferParameterName, pname), (uintptr_t)params);
9113 
9114     if (context)
9115     {
9116         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9117         bool isCallValid                                      = (context->skipValidation() ||
9118                             ValidateGetRenderbufferParameterivOES(context, target, pname, params));
9119         if (isCallValid)
9120         {
9121             context->getRenderbufferParameteriv(target, pname, params);
9122         }
9123         ANGLE_CAPTURE(GetRenderbufferParameterivOES, isCallValid, context, target, pname, params);
9124     }
9125     else
9126     {
9127         GenerateContextLostErrorOnCurrentGlobalContext();
9128     }
9129 }
9130 
GL_IsFramebufferOES(GLuint framebuffer)9131 GLboolean GL_APIENTRY GL_IsFramebufferOES(GLuint framebuffer)
9132 {
9133     Context *context = GetValidGlobalContext();
9134     EVENT(context, GLIsFramebufferOES, "context = %d, framebuffer = %u", CID(context), framebuffer);
9135 
9136     GLboolean returnValue;
9137     if (context)
9138     {
9139         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
9140         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9141         bool isCallValid =
9142             (context->skipValidation() || ValidateIsFramebufferOES(context, framebufferPacked));
9143         if (isCallValid)
9144         {
9145             returnValue = context->isFramebuffer(framebufferPacked);
9146         }
9147         else
9148         {
9149             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsFramebufferOES, GLboolean>();
9150         }
9151         ANGLE_CAPTURE(IsFramebufferOES, isCallValid, context, framebufferPacked, returnValue);
9152     }
9153     else
9154     {
9155         GenerateContextLostErrorOnCurrentGlobalContext();
9156         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsFramebufferOES, GLboolean>();
9157     }
9158     return returnValue;
9159 }
9160 
GL_IsRenderbufferOES(GLuint renderbuffer)9161 GLboolean GL_APIENTRY GL_IsRenderbufferOES(GLuint renderbuffer)
9162 {
9163     Context *context = GetValidGlobalContext();
9164     EVENT(context, GLIsRenderbufferOES, "context = %d, renderbuffer = %u", CID(context),
9165           renderbuffer);
9166 
9167     GLboolean returnValue;
9168     if (context)
9169     {
9170         RenderbufferID renderbufferPacked = PackParam<RenderbufferID>(renderbuffer);
9171         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9172         bool isCallValid =
9173             (context->skipValidation() || ValidateIsRenderbufferOES(context, renderbufferPacked));
9174         if (isCallValid)
9175         {
9176             returnValue = context->isRenderbuffer(renderbufferPacked);
9177         }
9178         else
9179         {
9180             returnValue =
9181                 GetDefaultReturnValue<angle::EntryPoint::GLIsRenderbufferOES, GLboolean>();
9182         }
9183         ANGLE_CAPTURE(IsRenderbufferOES, isCallValid, context, renderbufferPacked, returnValue);
9184     }
9185     else
9186     {
9187         GenerateContextLostErrorOnCurrentGlobalContext();
9188         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsRenderbufferOES, GLboolean>();
9189     }
9190     return returnValue;
9191 }
9192 
GL_RenderbufferStorageOES(GLenum target,GLenum internalformat,GLsizei width,GLsizei height)9193 void GL_APIENTRY GL_RenderbufferStorageOES(GLenum target,
9194                                            GLenum internalformat,
9195                                            GLsizei width,
9196                                            GLsizei height)
9197 {
9198     Context *context = GetValidGlobalContext();
9199     EVENT(context, GLRenderbufferStorageOES,
9200           "context = %d, target = %s, internalformat = %s, width = %d, height = %d", CID(context),
9201           GLenumToString(GLenumGroup::RenderbufferTarget, target),
9202           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height);
9203 
9204     if (context)
9205     {
9206         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9207         bool isCallValid =
9208             (context->skipValidation() ||
9209              ValidateRenderbufferStorageOES(context, target, internalformat, width, height));
9210         if (isCallValid)
9211         {
9212             context->renderbufferStorage(target, internalformat, width, height);
9213         }
9214         ANGLE_CAPTURE(RenderbufferStorageOES, isCallValid, context, target, internalformat, width,
9215                       height);
9216     }
9217     else
9218     {
9219         GenerateContextLostErrorOnCurrentGlobalContext();
9220     }
9221 }
9222 
9223 // GL_OES_geometry_shader
GL_FramebufferTextureOES(GLenum target,GLenum attachment,GLuint texture,GLint level)9224 void GL_APIENTRY GL_FramebufferTextureOES(GLenum target,
9225                                           GLenum attachment,
9226                                           GLuint texture,
9227                                           GLint level)
9228 {
9229     Context *context = GetValidGlobalContext();
9230     EVENT(context, GLFramebufferTextureOES,
9231           "context = %d, target = %s, attachment = %s, texture = %u, level = %d", CID(context),
9232           GLenumToString(GLenumGroup::FramebufferTarget, target),
9233           GLenumToString(GLenumGroup::FramebufferAttachment, attachment), texture, level);
9234 
9235     if (context)
9236     {
9237         TextureID texturePacked                               = PackParam<TextureID>(texture);
9238         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9239         bool isCallValid =
9240             (context->skipValidation() ||
9241              ValidateFramebufferTextureOES(context, target, attachment, texturePacked, level));
9242         if (isCallValid)
9243         {
9244             context->framebufferTexture(target, attachment, texturePacked, level);
9245         }
9246         ANGLE_CAPTURE(FramebufferTextureOES, isCallValid, context, target, attachment,
9247                       texturePacked, level);
9248     }
9249     else
9250     {
9251         GenerateContextLostErrorOnCurrentGlobalContext();
9252     }
9253 }
9254 
9255 // GL_OES_get_program_binary
GL_GetProgramBinaryOES(GLuint program,GLsizei bufSize,GLsizei * length,GLenum * binaryFormat,void * binary)9256 void GL_APIENTRY GL_GetProgramBinaryOES(GLuint program,
9257                                         GLsizei bufSize,
9258                                         GLsizei *length,
9259                                         GLenum *binaryFormat,
9260                                         void *binary)
9261 {
9262     Context *context = GetValidGlobalContext();
9263     EVENT(context, GLGetProgramBinaryOES,
9264           "context = %d, program = %u, bufSize = %d, length = 0x%016" PRIxPTR
9265           ", binaryFormat = 0x%016" PRIxPTR ", binary = 0x%016" PRIxPTR "",
9266           CID(context), program, bufSize, (uintptr_t)length, (uintptr_t)binaryFormat,
9267           (uintptr_t)binary);
9268 
9269     if (context)
9270     {
9271         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
9272         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9273         bool isCallValid                                      = (context->skipValidation() ||
9274                             ValidateGetProgramBinaryOES(context, programPacked, bufSize, length,
9275                                                         binaryFormat, binary));
9276         if (isCallValid)
9277         {
9278             context->getProgramBinary(programPacked, bufSize, length, binaryFormat, binary);
9279         }
9280         ANGLE_CAPTURE(GetProgramBinaryOES, isCallValid, context, programPacked, bufSize, length,
9281                       binaryFormat, binary);
9282     }
9283     else
9284     {
9285         GenerateContextLostErrorOnCurrentGlobalContext();
9286     }
9287 }
9288 
GL_ProgramBinaryOES(GLuint program,GLenum binaryFormat,const void * binary,GLint length)9289 void GL_APIENTRY GL_ProgramBinaryOES(GLuint program,
9290                                      GLenum binaryFormat,
9291                                      const void *binary,
9292                                      GLint length)
9293 {
9294     Context *context = GetValidGlobalContext();
9295     EVENT(context, GLProgramBinaryOES,
9296           "context = %d, program = %u, binaryFormat = %s, binary = 0x%016" PRIxPTR ", length = %d",
9297           CID(context), program, GLenumToString(GLenumGroup::DefaultGroup, binaryFormat),
9298           (uintptr_t)binary, length);
9299 
9300     if (context)
9301     {
9302         ShaderProgramID programPacked                         = PackParam<ShaderProgramID>(program);
9303         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9304         bool isCallValid =
9305             (context->skipValidation() ||
9306              ValidateProgramBinaryOES(context, programPacked, binaryFormat, binary, length));
9307         if (isCallValid)
9308         {
9309             context->programBinary(programPacked, binaryFormat, binary, length);
9310         }
9311         ANGLE_CAPTURE(ProgramBinaryOES, isCallValid, context, programPacked, binaryFormat, binary,
9312                       length);
9313     }
9314     else
9315     {
9316         GenerateContextLostErrorOnCurrentGlobalContext();
9317     }
9318 }
9319 
9320 // GL_OES_mapbuffer
GL_GetBufferPointervOES(GLenum target,GLenum pname,void ** params)9321 void GL_APIENTRY GL_GetBufferPointervOES(GLenum target, GLenum pname, void **params)
9322 {
9323     Context *context = GetValidGlobalContext();
9324     EVENT(context, GLGetBufferPointervOES,
9325           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
9326           GLenumToString(GLenumGroup::BufferTargetARB, target),
9327           GLenumToString(GLenumGroup::DefaultGroup, pname), (uintptr_t)params);
9328 
9329     if (context)
9330     {
9331         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
9332         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9333         bool isCallValid                                      = (context->skipValidation() ||
9334                             ValidateGetBufferPointervOES(context, targetPacked, pname, params));
9335         if (isCallValid)
9336         {
9337             context->getBufferPointerv(targetPacked, pname, params);
9338         }
9339         ANGLE_CAPTURE(GetBufferPointervOES, isCallValid, context, targetPacked, pname, params);
9340     }
9341     else
9342     {
9343         GenerateContextLostErrorOnCurrentGlobalContext();
9344     }
9345 }
9346 
GL_MapBufferOES(GLenum target,GLenum access)9347 void *GL_APIENTRY GL_MapBufferOES(GLenum target, GLenum access)
9348 {
9349     Context *context = GetValidGlobalContext();
9350     EVENT(context, GLMapBufferOES, "context = %d, target = %s, access = %s", CID(context),
9351           GLenumToString(GLenumGroup::BufferTargetARB, target),
9352           GLenumToString(GLenumGroup::BufferAccessARB, access));
9353 
9354     void *returnValue;
9355     if (context)
9356     {
9357         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
9358         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9359         bool isCallValid =
9360             (context->skipValidation() || ValidateMapBufferOES(context, targetPacked, access));
9361         if (isCallValid)
9362         {
9363             returnValue = context->mapBuffer(targetPacked, access);
9364         }
9365         else
9366         {
9367             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapBufferOES, void *>();
9368         }
9369         ANGLE_CAPTURE(MapBufferOES, isCallValid, context, targetPacked, access, returnValue);
9370     }
9371     else
9372     {
9373         GenerateContextLostErrorOnCurrentGlobalContext();
9374         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapBufferOES, void *>();
9375     }
9376     return returnValue;
9377 }
9378 
GL_UnmapBufferOES(GLenum target)9379 GLboolean GL_APIENTRY GL_UnmapBufferOES(GLenum target)
9380 {
9381     Context *context = GetValidGlobalContext();
9382     EVENT(context, GLUnmapBufferOES, "context = %d, target = %s", CID(context),
9383           GLenumToString(GLenumGroup::DefaultGroup, target));
9384 
9385     GLboolean returnValue;
9386     if (context)
9387     {
9388         BufferBinding targetPacked                            = PackParam<BufferBinding>(target);
9389         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9390         bool isCallValid =
9391             (context->skipValidation() || ValidateUnmapBufferOES(context, targetPacked));
9392         if (isCallValid)
9393         {
9394             returnValue = context->unmapBuffer(targetPacked);
9395         }
9396         else
9397         {
9398             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLUnmapBufferOES, GLboolean>();
9399         }
9400         ANGLE_CAPTURE(UnmapBufferOES, isCallValid, context, targetPacked, returnValue);
9401     }
9402     else
9403     {
9404         GenerateContextLostErrorOnCurrentGlobalContext();
9405         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLUnmapBufferOES, GLboolean>();
9406     }
9407     return returnValue;
9408 }
9409 
9410 // GL_OES_matrix_palette
GL_CurrentPaletteMatrixOES(GLuint matrixpaletteindex)9411 void GL_APIENTRY GL_CurrentPaletteMatrixOES(GLuint matrixpaletteindex)
9412 {
9413     Context *context = GetValidGlobalContext();
9414     EVENT(context, GLCurrentPaletteMatrixOES, "context = %d, matrixpaletteindex = %u", CID(context),
9415           matrixpaletteindex);
9416 
9417     if (context)
9418     {
9419         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9420         bool isCallValid                                      = (context->skipValidation() ||
9421                             ValidateCurrentPaletteMatrixOES(context, matrixpaletteindex));
9422         if (isCallValid)
9423         {
9424             context->currentPaletteMatrix(matrixpaletteindex);
9425         }
9426         ANGLE_CAPTURE(CurrentPaletteMatrixOES, isCallValid, context, matrixpaletteindex);
9427     }
9428     else
9429     {
9430         GenerateContextLostErrorOnCurrentGlobalContext();
9431     }
9432 }
9433 
GL_LoadPaletteFromModelViewMatrixOES()9434 void GL_APIENTRY GL_LoadPaletteFromModelViewMatrixOES()
9435 {
9436     Context *context = GetValidGlobalContext();
9437     EVENT(context, GLLoadPaletteFromModelViewMatrixOES, "context = %d", CID(context));
9438 
9439     if (context)
9440     {
9441         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9442         bool isCallValid =
9443             (context->skipValidation() || ValidateLoadPaletteFromModelViewMatrixOES(context));
9444         if (isCallValid)
9445         {
9446             context->loadPaletteFromModelViewMatrix();
9447         }
9448         ANGLE_CAPTURE(LoadPaletteFromModelViewMatrixOES, isCallValid, context);
9449     }
9450     else
9451     {
9452         GenerateContextLostErrorOnCurrentGlobalContext();
9453     }
9454 }
9455 
GL_MatrixIndexPointerOES(GLint size,GLenum type,GLsizei stride,const void * pointer)9456 void GL_APIENTRY GL_MatrixIndexPointerOES(GLint size,
9457                                           GLenum type,
9458                                           GLsizei stride,
9459                                           const void *pointer)
9460 {
9461     Context *context = GetValidGlobalContext();
9462     EVENT(context, GLMatrixIndexPointerOES,
9463           "context = %d, size = %d, type = %s, stride = %d, pointer = 0x%016" PRIxPTR "",
9464           CID(context), size, GLenumToString(GLenumGroup::DefaultGroup, type), stride,
9465           (uintptr_t)pointer);
9466 
9467     if (context)
9468     {
9469         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9470         bool isCallValid                                      = (context->skipValidation() ||
9471                             ValidateMatrixIndexPointerOES(context, size, type, stride, pointer));
9472         if (isCallValid)
9473         {
9474             context->matrixIndexPointer(size, type, stride, pointer);
9475         }
9476         ANGLE_CAPTURE(MatrixIndexPointerOES, isCallValid, context, size, type, stride, pointer);
9477     }
9478     else
9479     {
9480         GenerateContextLostErrorOnCurrentGlobalContext();
9481     }
9482 }
9483 
GL_WeightPointerOES(GLint size,GLenum type,GLsizei stride,const void * pointer)9484 void GL_APIENTRY GL_WeightPointerOES(GLint size, GLenum type, GLsizei stride, const void *pointer)
9485 {
9486     Context *context = GetValidGlobalContext();
9487     EVENT(context, GLWeightPointerOES,
9488           "context = %d, size = %d, type = %s, stride = %d, pointer = 0x%016" PRIxPTR "",
9489           CID(context), size, GLenumToString(GLenumGroup::DefaultGroup, type), stride,
9490           (uintptr_t)pointer);
9491 
9492     if (context)
9493     {
9494         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9495         bool isCallValid                                      = (context->skipValidation() ||
9496                             ValidateWeightPointerOES(context, size, type, stride, pointer));
9497         if (isCallValid)
9498         {
9499             context->weightPointer(size, type, stride, pointer);
9500         }
9501         ANGLE_CAPTURE(WeightPointerOES, isCallValid, context, size, type, stride, pointer);
9502     }
9503     else
9504     {
9505         GenerateContextLostErrorOnCurrentGlobalContext();
9506     }
9507 }
9508 
9509 // GL_OES_point_size_array
GL_PointSizePointerOES(GLenum type,GLsizei stride,const void * pointer)9510 void GL_APIENTRY GL_PointSizePointerOES(GLenum type, GLsizei stride, const void *pointer)
9511 {
9512     Context *context = GetValidGlobalContext();
9513     EVENT(context, GLPointSizePointerOES,
9514           "context = %d, type = %s, stride = %d, pointer = 0x%016" PRIxPTR "", CID(context),
9515           GLenumToString(GLenumGroup::DefaultGroup, type), stride, (uintptr_t)pointer);
9516 
9517     if (context)
9518     {
9519         VertexAttribType typePacked                           = PackParam<VertexAttribType>(type);
9520         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9521         bool isCallValid                                      = (context->skipValidation() ||
9522                             ValidatePointSizePointerOES(context, typePacked, stride, pointer));
9523         if (isCallValid)
9524         {
9525             context->pointSizePointer(typePacked, stride, pointer);
9526         }
9527         ANGLE_CAPTURE(PointSizePointerOES, isCallValid, context, typePacked, stride, pointer);
9528     }
9529     else
9530     {
9531         GenerateContextLostErrorOnCurrentGlobalContext();
9532     }
9533 }
9534 
9535 // GL_OES_query_matrix
GL_QueryMatrixxOES(GLfixed * mantissa,GLint * exponent)9536 GLbitfield GL_APIENTRY GL_QueryMatrixxOES(GLfixed *mantissa, GLint *exponent)
9537 {
9538     Context *context = GetValidGlobalContext();
9539     EVENT(context, GLQueryMatrixxOES,
9540           "context = %d, mantissa = 0x%016" PRIxPTR ", exponent = 0x%016" PRIxPTR "", CID(context),
9541           (uintptr_t)mantissa, (uintptr_t)exponent);
9542 
9543     GLbitfield returnValue;
9544     if (context)
9545     {
9546         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9547         bool isCallValid =
9548             (context->skipValidation() || ValidateQueryMatrixxOES(context, mantissa, exponent));
9549         if (isCallValid)
9550         {
9551             returnValue = context->queryMatrixx(mantissa, exponent);
9552         }
9553         else
9554         {
9555             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLQueryMatrixxOES, GLbitfield>();
9556         }
9557         ANGLE_CAPTURE(QueryMatrixxOES, isCallValid, context, mantissa, exponent, returnValue);
9558     }
9559     else
9560     {
9561         GenerateContextLostErrorOnCurrentGlobalContext();
9562         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLQueryMatrixxOES, GLbitfield>();
9563     }
9564     return returnValue;
9565 }
9566 
9567 // GL_OES_sample_shading
GL_MinSampleShadingOES(GLfloat value)9568 void GL_APIENTRY GL_MinSampleShadingOES(GLfloat value)
9569 {
9570     Context *context = GetValidGlobalContext();
9571     EVENT(context, GLMinSampleShadingOES, "context = %d, value = %f", CID(context), value);
9572 
9573     if (context)
9574     {
9575         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9576         bool isCallValid =
9577             (context->skipValidation() || ValidateMinSampleShadingOES(context, value));
9578         if (isCallValid)
9579         {
9580             context->minSampleShading(value);
9581         }
9582         ANGLE_CAPTURE(MinSampleShadingOES, isCallValid, context, value);
9583     }
9584     else
9585     {
9586         GenerateContextLostErrorOnCurrentGlobalContext();
9587     }
9588 }
9589 
9590 // GL_OES_shader_io_blocks
9591 
9592 // GL_OES_texture_3D
GL_CompressedTexImage3DOES(GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLsizei imageSize,const void * data)9593 void GL_APIENTRY GL_CompressedTexImage3DOES(GLenum target,
9594                                             GLint level,
9595                                             GLenum internalformat,
9596                                             GLsizei width,
9597                                             GLsizei height,
9598                                             GLsizei depth,
9599                                             GLint border,
9600                                             GLsizei imageSize,
9601                                             const void *data)
9602 {
9603     Context *context = GetValidGlobalContext();
9604     EVENT(context, GLCompressedTexImage3DOES,
9605           "context = %d, target = %s, level = %d, internalformat = %s, width = %d, height = %d, "
9606           "depth = %d, border = %d, imageSize = %d, data = 0x%016" PRIxPTR "",
9607           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level,
9608           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height, depth, border,
9609           imageSize, (uintptr_t)data);
9610 
9611     if (context)
9612     {
9613         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
9614         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9615         bool isCallValid =
9616             (context->skipValidation() ||
9617              ValidateCompressedTexImage3DOES(context, targetPacked, level, internalformat, width,
9618                                              height, depth, border, imageSize, data));
9619         if (isCallValid)
9620         {
9621             context->compressedTexImage3D(targetPacked, level, internalformat, width, height, depth,
9622                                           border, imageSize, data);
9623         }
9624         ANGLE_CAPTURE(CompressedTexImage3DOES, isCallValid, context, targetPacked, level,
9625                       internalformat, width, height, depth, border, imageSize, data);
9626     }
9627     else
9628     {
9629         GenerateContextLostErrorOnCurrentGlobalContext();
9630     }
9631 }
9632 
GL_CompressedTexSubImage3DOES(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLsizei imageSize,const void * data)9633 void GL_APIENTRY GL_CompressedTexSubImage3DOES(GLenum target,
9634                                                GLint level,
9635                                                GLint xoffset,
9636                                                GLint yoffset,
9637                                                GLint zoffset,
9638                                                GLsizei width,
9639                                                GLsizei height,
9640                                                GLsizei depth,
9641                                                GLenum format,
9642                                                GLsizei imageSize,
9643                                                const void *data)
9644 {
9645     Context *context = GetValidGlobalContext();
9646     EVENT(context, GLCompressedTexSubImage3DOES,
9647           "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width "
9648           "= %d, height = %d, depth = %d, format = %s, imageSize = %d, data = 0x%016" PRIxPTR "",
9649           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, xoffset, yoffset,
9650           zoffset, width, height, depth, GLenumToString(GLenumGroup::PixelFormat, format),
9651           imageSize, (uintptr_t)data);
9652 
9653     if (context)
9654     {
9655         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
9656         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9657         bool isCallValid                                      = (context->skipValidation() ||
9658                             ValidateCompressedTexSubImage3DOES(
9659                                 context, targetPacked, level, xoffset, yoffset, zoffset, width,
9660                                 height, depth, format, imageSize, data));
9661         if (isCallValid)
9662         {
9663             context->compressedTexSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, width,
9664                                              height, depth, format, imageSize, data);
9665         }
9666         ANGLE_CAPTURE(CompressedTexSubImage3DOES, isCallValid, context, targetPacked, level,
9667                       xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
9668     }
9669     else
9670     {
9671         GenerateContextLostErrorOnCurrentGlobalContext();
9672     }
9673 }
9674 
GL_CopyTexSubImage3DOES(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLint x,GLint y,GLsizei width,GLsizei height)9675 void GL_APIENTRY GL_CopyTexSubImage3DOES(GLenum target,
9676                                          GLint level,
9677                                          GLint xoffset,
9678                                          GLint yoffset,
9679                                          GLint zoffset,
9680                                          GLint x,
9681                                          GLint y,
9682                                          GLsizei width,
9683                                          GLsizei height)
9684 {
9685     Context *context = GetValidGlobalContext();
9686     EVENT(context, GLCopyTexSubImage3DOES,
9687           "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, x = "
9688           "%d, y = %d, width = %d, height = %d",
9689           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target), level, xoffset, yoffset,
9690           zoffset, x, y, width, height);
9691 
9692     if (context)
9693     {
9694         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
9695         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9696         bool isCallValid                                      = (context->skipValidation() ||
9697                             ValidateCopyTexSubImage3DOES(context, targetPacked, level, xoffset,
9698                                                          yoffset, zoffset, x, y, width, height));
9699         if (isCallValid)
9700         {
9701             context->copyTexSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, x, y, width,
9702                                        height);
9703         }
9704         ANGLE_CAPTURE(CopyTexSubImage3DOES, isCallValid, context, targetPacked, level, xoffset,
9705                       yoffset, zoffset, x, y, width, height);
9706     }
9707     else
9708     {
9709         GenerateContextLostErrorOnCurrentGlobalContext();
9710     }
9711 }
9712 
GL_FramebufferTexture3DOES(GLenum target,GLenum attachment,GLenum textarget,GLuint texture,GLint level,GLint zoffset)9713 void GL_APIENTRY GL_FramebufferTexture3DOES(GLenum target,
9714                                             GLenum attachment,
9715                                             GLenum textarget,
9716                                             GLuint texture,
9717                                             GLint level,
9718                                             GLint zoffset)
9719 {
9720     Context *context = GetValidGlobalContext();
9721     EVENT(context, GLFramebufferTexture3DOES,
9722           "context = %d, target = %s, attachment = %s, textarget = %s, texture = %u, level = %d, "
9723           "zoffset = %d",
9724           CID(context), GLenumToString(GLenumGroup::FramebufferTarget, target),
9725           GLenumToString(GLenumGroup::FramebufferAttachment, attachment),
9726           GLenumToString(GLenumGroup::TextureTarget, textarget), texture, level, zoffset);
9727 
9728     if (context)
9729     {
9730         TextureTarget textargetPacked                         = PackParam<TextureTarget>(textarget);
9731         TextureID texturePacked                               = PackParam<TextureID>(texture);
9732         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9733         bool isCallValid =
9734             (context->skipValidation() ||
9735              ValidateFramebufferTexture3DOES(context, target, attachment, textargetPacked,
9736                                              texturePacked, level, zoffset));
9737         if (isCallValid)
9738         {
9739             context->framebufferTexture3D(target, attachment, textargetPacked, texturePacked, level,
9740                                           zoffset);
9741         }
9742         ANGLE_CAPTURE(FramebufferTexture3DOES, isCallValid, context, target, attachment,
9743                       textargetPacked, texturePacked, level, zoffset);
9744     }
9745     else
9746     {
9747         GenerateContextLostErrorOnCurrentGlobalContext();
9748     }
9749 }
9750 
GL_TexImage3DOES(GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLenum format,GLenum type,const void * pixels)9751 void GL_APIENTRY GL_TexImage3DOES(GLenum target,
9752                                   GLint level,
9753                                   GLenum internalformat,
9754                                   GLsizei width,
9755                                   GLsizei height,
9756                                   GLsizei depth,
9757                                   GLint border,
9758                                   GLenum format,
9759                                   GLenum type,
9760                                   const void *pixels)
9761 {
9762     Context *context = GetValidGlobalContext();
9763     EVENT(context, GLTexImage3DOES,
9764           "context = %d, target = %s, level = %d, internalformat = %s, width = %d, height = %d, "
9765           "depth = %d, border = %d, format = %s, type = %s, pixels = 0x%016" PRIxPTR "",
9766           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level,
9767           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height, depth, border,
9768           GLenumToString(GLenumGroup::PixelFormat, format),
9769           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
9770 
9771     if (context)
9772     {
9773         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
9774         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9775         bool isCallValid =
9776             (context->skipValidation() ||
9777              ValidateTexImage3DOES(context, targetPacked, level, internalformat, width, height,
9778                                    depth, border, format, type, pixels));
9779         if (isCallValid)
9780         {
9781             context->texImage3D(targetPacked, level, internalformat, width, height, depth, border,
9782                                 format, type, pixels);
9783         }
9784         ANGLE_CAPTURE(TexImage3DOES, isCallValid, context, targetPacked, level, internalformat,
9785                       width, height, depth, border, format, type, pixels);
9786     }
9787     else
9788     {
9789         GenerateContextLostErrorOnCurrentGlobalContext();
9790     }
9791 }
9792 
GL_TexSubImage3DOES(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLenum type,const void * pixels)9793 void GL_APIENTRY GL_TexSubImage3DOES(GLenum target,
9794                                      GLint level,
9795                                      GLint xoffset,
9796                                      GLint yoffset,
9797                                      GLint zoffset,
9798                                      GLsizei width,
9799                                      GLsizei height,
9800                                      GLsizei depth,
9801                                      GLenum format,
9802                                      GLenum type,
9803                                      const void *pixels)
9804 {
9805     Context *context = GetValidGlobalContext();
9806     EVENT(context, GLTexSubImage3DOES,
9807           "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width "
9808           "= %d, height = %d, depth = %d, format = %s, type = %s, pixels = 0x%016" PRIxPTR "",
9809           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, xoffset, yoffset,
9810           zoffset, width, height, depth, GLenumToString(GLenumGroup::PixelFormat, format),
9811           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
9812 
9813     if (context)
9814     {
9815         TextureTarget targetPacked                            = PackParam<TextureTarget>(target);
9816         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9817         bool isCallValid =
9818             (context->skipValidation() ||
9819              ValidateTexSubImage3DOES(context, targetPacked, level, xoffset, yoffset, zoffset,
9820                                       width, height, depth, format, type, pixels));
9821         if (isCallValid)
9822         {
9823             context->texSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, width, height,
9824                                    depth, format, type, pixels);
9825         }
9826         ANGLE_CAPTURE(TexSubImage3DOES, isCallValid, context, targetPacked, level, xoffset, yoffset,
9827                       zoffset, width, height, depth, format, type, pixels);
9828     }
9829     else
9830     {
9831         GenerateContextLostErrorOnCurrentGlobalContext();
9832     }
9833 }
9834 
9835 // GL_OES_texture_border_clamp
GL_GetSamplerParameterIivOES(GLuint sampler,GLenum pname,GLint * params)9836 void GL_APIENTRY GL_GetSamplerParameterIivOES(GLuint sampler, GLenum pname, GLint *params)
9837 {
9838     Context *context = GetValidGlobalContext();
9839     EVENT(context, GLGetSamplerParameterIivOES,
9840           "context = %d, sampler = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
9841           sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname), (uintptr_t)params);
9842 
9843     if (context)
9844     {
9845         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
9846         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9847         bool isCallValid =
9848             (context->skipValidation() ||
9849              ValidateGetSamplerParameterIivOES(context, samplerPacked, pname, params));
9850         if (isCallValid)
9851         {
9852             context->getSamplerParameterIiv(samplerPacked, pname, params);
9853         }
9854         ANGLE_CAPTURE(GetSamplerParameterIivOES, isCallValid, context, samplerPacked, pname,
9855                       params);
9856     }
9857     else
9858     {
9859         GenerateContextLostErrorOnCurrentGlobalContext();
9860     }
9861 }
9862 
GL_GetSamplerParameterIuivOES(GLuint sampler,GLenum pname,GLuint * params)9863 void GL_APIENTRY GL_GetSamplerParameterIuivOES(GLuint sampler, GLenum pname, GLuint *params)
9864 {
9865     Context *context = GetValidGlobalContext();
9866     EVENT(context, GLGetSamplerParameterIuivOES,
9867           "context = %d, sampler = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
9868           sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname), (uintptr_t)params);
9869 
9870     if (context)
9871     {
9872         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
9873         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9874         bool isCallValid =
9875             (context->skipValidation() ||
9876              ValidateGetSamplerParameterIuivOES(context, samplerPacked, pname, params));
9877         if (isCallValid)
9878         {
9879             context->getSamplerParameterIuiv(samplerPacked, pname, params);
9880         }
9881         ANGLE_CAPTURE(GetSamplerParameterIuivOES, isCallValid, context, samplerPacked, pname,
9882                       params);
9883     }
9884     else
9885     {
9886         GenerateContextLostErrorOnCurrentGlobalContext();
9887     }
9888 }
9889 
GL_GetTexParameterIivOES(GLenum target,GLenum pname,GLint * params)9890 void GL_APIENTRY GL_GetTexParameterIivOES(GLenum target, GLenum pname, GLint *params)
9891 {
9892     Context *context = GetValidGlobalContext();
9893     EVENT(context, GLGetTexParameterIivOES,
9894           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
9895           GLenumToString(GLenumGroup::TextureTarget, target),
9896           GLenumToString(GLenumGroup::GetTextureParameter, pname), (uintptr_t)params);
9897 
9898     if (context)
9899     {
9900         TextureType targetPacked                              = PackParam<TextureType>(target);
9901         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9902         bool isCallValid                                      = (context->skipValidation() ||
9903                             ValidateGetTexParameterIivOES(context, targetPacked, pname, params));
9904         if (isCallValid)
9905         {
9906             context->getTexParameterIiv(targetPacked, pname, params);
9907         }
9908         ANGLE_CAPTURE(GetTexParameterIivOES, isCallValid, context, targetPacked, pname, params);
9909     }
9910     else
9911     {
9912         GenerateContextLostErrorOnCurrentGlobalContext();
9913     }
9914 }
9915 
GL_GetTexParameterIuivOES(GLenum target,GLenum pname,GLuint * params)9916 void GL_APIENTRY GL_GetTexParameterIuivOES(GLenum target, GLenum pname, GLuint *params)
9917 {
9918     Context *context = GetValidGlobalContext();
9919     EVENT(context, GLGetTexParameterIuivOES,
9920           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
9921           GLenumToString(GLenumGroup::TextureTarget, target),
9922           GLenumToString(GLenumGroup::GetTextureParameter, pname), (uintptr_t)params);
9923 
9924     if (context)
9925     {
9926         TextureType targetPacked                              = PackParam<TextureType>(target);
9927         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9928         bool isCallValid                                      = (context->skipValidation() ||
9929                             ValidateGetTexParameterIuivOES(context, targetPacked, pname, params));
9930         if (isCallValid)
9931         {
9932             context->getTexParameterIuiv(targetPacked, pname, params);
9933         }
9934         ANGLE_CAPTURE(GetTexParameterIuivOES, isCallValid, context, targetPacked, pname, params);
9935     }
9936     else
9937     {
9938         GenerateContextLostErrorOnCurrentGlobalContext();
9939     }
9940 }
9941 
GL_SamplerParameterIivOES(GLuint sampler,GLenum pname,const GLint * param)9942 void GL_APIENTRY GL_SamplerParameterIivOES(GLuint sampler, GLenum pname, const GLint *param)
9943 {
9944     Context *context = GetValidGlobalContext();
9945     EVENT(context, GLSamplerParameterIivOES,
9946           "context = %d, sampler = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
9947           sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname), (uintptr_t)param);
9948 
9949     if (context)
9950     {
9951         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
9952         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9953         bool isCallValid                                      = (context->skipValidation() ||
9954                             ValidateSamplerParameterIivOES(context, samplerPacked, pname, param));
9955         if (isCallValid)
9956         {
9957             context->samplerParameterIiv(samplerPacked, pname, param);
9958         }
9959         ANGLE_CAPTURE(SamplerParameterIivOES, isCallValid, context, samplerPacked, pname, param);
9960     }
9961     else
9962     {
9963         GenerateContextLostErrorOnCurrentGlobalContext();
9964     }
9965 }
9966 
GL_SamplerParameterIuivOES(GLuint sampler,GLenum pname,const GLuint * param)9967 void GL_APIENTRY GL_SamplerParameterIuivOES(GLuint sampler, GLenum pname, const GLuint *param)
9968 {
9969     Context *context = GetValidGlobalContext();
9970     EVENT(context, GLSamplerParameterIuivOES,
9971           "context = %d, sampler = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
9972           sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname), (uintptr_t)param);
9973 
9974     if (context)
9975     {
9976         SamplerID samplerPacked                               = PackParam<SamplerID>(sampler);
9977         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
9978         bool isCallValid                                      = (context->skipValidation() ||
9979                             ValidateSamplerParameterIuivOES(context, samplerPacked, pname, param));
9980         if (isCallValid)
9981         {
9982             context->samplerParameterIuiv(samplerPacked, pname, param);
9983         }
9984         ANGLE_CAPTURE(SamplerParameterIuivOES, isCallValid, context, samplerPacked, pname, param);
9985     }
9986     else
9987     {
9988         GenerateContextLostErrorOnCurrentGlobalContext();
9989     }
9990 }
9991 
GL_TexParameterIivOES(GLenum target,GLenum pname,const GLint * params)9992 void GL_APIENTRY GL_TexParameterIivOES(GLenum target, GLenum pname, const GLint *params)
9993 {
9994     Context *context = GetValidGlobalContext();
9995     EVENT(context, GLTexParameterIivOES,
9996           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
9997           GLenumToString(GLenumGroup::TextureTarget, target),
9998           GLenumToString(GLenumGroup::TextureParameterName, pname), (uintptr_t)params);
9999 
10000     if (context)
10001     {
10002         TextureType targetPacked                              = PackParam<TextureType>(target);
10003         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10004         bool isCallValid                                      = (context->skipValidation() ||
10005                             ValidateTexParameterIivOES(context, targetPacked, pname, params));
10006         if (isCallValid)
10007         {
10008             context->texParameterIiv(targetPacked, pname, params);
10009         }
10010         ANGLE_CAPTURE(TexParameterIivOES, isCallValid, context, targetPacked, pname, params);
10011     }
10012     else
10013     {
10014         GenerateContextLostErrorOnCurrentGlobalContext();
10015     }
10016 }
10017 
GL_TexParameterIuivOES(GLenum target,GLenum pname,const GLuint * params)10018 void GL_APIENTRY GL_TexParameterIuivOES(GLenum target, GLenum pname, const GLuint *params)
10019 {
10020     Context *context = GetValidGlobalContext();
10021     EVENT(context, GLTexParameterIuivOES,
10022           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
10023           GLenumToString(GLenumGroup::TextureTarget, target),
10024           GLenumToString(GLenumGroup::TextureParameterName, pname), (uintptr_t)params);
10025 
10026     if (context)
10027     {
10028         TextureType targetPacked                              = PackParam<TextureType>(target);
10029         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10030         bool isCallValid                                      = (context->skipValidation() ||
10031                             ValidateTexParameterIuivOES(context, targetPacked, pname, params));
10032         if (isCallValid)
10033         {
10034             context->texParameterIuiv(targetPacked, pname, params);
10035         }
10036         ANGLE_CAPTURE(TexParameterIuivOES, isCallValid, context, targetPacked, pname, params);
10037     }
10038     else
10039     {
10040         GenerateContextLostErrorOnCurrentGlobalContext();
10041     }
10042 }
10043 
10044 // GL_OES_texture_buffer
GL_TexBufferOES(GLenum target,GLenum internalformat,GLuint buffer)10045 void GL_APIENTRY GL_TexBufferOES(GLenum target, GLenum internalformat, GLuint buffer)
10046 {
10047     Context *context = GetValidGlobalContext();
10048     EVENT(context, GLTexBufferOES, "context = %d, target = %s, internalformat = %s, buffer = %u",
10049           CID(context), GLenumToString(GLenumGroup::TextureTarget, target),
10050           GLenumToString(GLenumGroup::InternalFormat, internalformat), buffer);
10051 
10052     if (context)
10053     {
10054         TextureType targetPacked                              = PackParam<TextureType>(target);
10055         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
10056         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10057         bool isCallValid =
10058             (context->skipValidation() ||
10059              ValidateTexBufferOES(context, targetPacked, internalformat, bufferPacked));
10060         if (isCallValid)
10061         {
10062             context->texBuffer(targetPacked, internalformat, bufferPacked);
10063         }
10064         ANGLE_CAPTURE(TexBufferOES, isCallValid, context, targetPacked, internalformat,
10065                       bufferPacked);
10066     }
10067     else
10068     {
10069         GenerateContextLostErrorOnCurrentGlobalContext();
10070     }
10071 }
10072 
GL_TexBufferRangeOES(GLenum target,GLenum internalformat,GLuint buffer,GLintptr offset,GLsizeiptr size)10073 void GL_APIENTRY GL_TexBufferRangeOES(GLenum target,
10074                                       GLenum internalformat,
10075                                       GLuint buffer,
10076                                       GLintptr offset,
10077                                       GLsizeiptr size)
10078 {
10079     Context *context = GetValidGlobalContext();
10080     EVENT(context, GLTexBufferRangeOES,
10081           "context = %d, target = %s, internalformat = %s, buffer = %u, offset = %llu, size = %llu",
10082           CID(context), GLenumToString(GLenumGroup::TextureTarget, target),
10083           GLenumToString(GLenumGroup::InternalFormat, internalformat), buffer,
10084           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size));
10085 
10086     if (context)
10087     {
10088         TextureType targetPacked                              = PackParam<TextureType>(target);
10089         BufferID bufferPacked                                 = PackParam<BufferID>(buffer);
10090         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10091         bool isCallValid                                      = (context->skipValidation() ||
10092                             ValidateTexBufferRangeOES(context, targetPacked, internalformat,
10093                                                       bufferPacked, offset, size));
10094         if (isCallValid)
10095         {
10096             context->texBufferRange(targetPacked, internalformat, bufferPacked, offset, size);
10097         }
10098         ANGLE_CAPTURE(TexBufferRangeOES, isCallValid, context, targetPacked, internalformat,
10099                       bufferPacked, offset, size);
10100     }
10101     else
10102     {
10103         GenerateContextLostErrorOnCurrentGlobalContext();
10104     }
10105 }
10106 
10107 // GL_OES_texture_cube_map
GL_GetTexGenfvOES(GLenum coord,GLenum pname,GLfloat * params)10108 void GL_APIENTRY GL_GetTexGenfvOES(GLenum coord, GLenum pname, GLfloat *params)
10109 {
10110     Context *context = GetValidGlobalContext();
10111     EVENT(context, GLGetTexGenfvOES,
10112           "context = %d, coord = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
10113           GLenumToString(GLenumGroup::TextureCoordName, coord),
10114           GLenumToString(GLenumGroup::TextureGenParameter, pname), (uintptr_t)params);
10115 
10116     if (context)
10117     {
10118         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10119         bool isCallValid =
10120             (context->skipValidation() || ValidateGetTexGenfvOES(context, coord, pname, params));
10121         if (isCallValid)
10122         {
10123             context->getTexGenfv(coord, pname, params);
10124         }
10125         ANGLE_CAPTURE(GetTexGenfvOES, isCallValid, context, coord, pname, params);
10126     }
10127     else
10128     {
10129         GenerateContextLostErrorOnCurrentGlobalContext();
10130     }
10131 }
10132 
GL_GetTexGenivOES(GLenum coord,GLenum pname,GLint * params)10133 void GL_APIENTRY GL_GetTexGenivOES(GLenum coord, GLenum pname, GLint *params)
10134 {
10135     Context *context = GetValidGlobalContext();
10136     EVENT(context, GLGetTexGenivOES,
10137           "context = %d, coord = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
10138           GLenumToString(GLenumGroup::TextureCoordName, coord),
10139           GLenumToString(GLenumGroup::TextureGenParameter, pname), (uintptr_t)params);
10140 
10141     if (context)
10142     {
10143         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10144         bool isCallValid =
10145             (context->skipValidation() || ValidateGetTexGenivOES(context, coord, pname, params));
10146         if (isCallValid)
10147         {
10148             context->getTexGeniv(coord, pname, params);
10149         }
10150         ANGLE_CAPTURE(GetTexGenivOES, isCallValid, context, coord, pname, params);
10151     }
10152     else
10153     {
10154         GenerateContextLostErrorOnCurrentGlobalContext();
10155     }
10156 }
10157 
GL_GetTexGenxvOES(GLenum coord,GLenum pname,GLfixed * params)10158 void GL_APIENTRY GL_GetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params)
10159 {
10160     Context *context = GetValidGlobalContext();
10161     EVENT(context, GLGetTexGenxvOES,
10162           "context = %d, coord = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
10163           GLenumToString(GLenumGroup::TextureCoordName, coord),
10164           GLenumToString(GLenumGroup::TextureGenParameter, pname), (uintptr_t)params);
10165 
10166     if (context)
10167     {
10168         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10169         bool isCallValid =
10170             (context->skipValidation() || ValidateGetTexGenxvOES(context, coord, pname, params));
10171         if (isCallValid)
10172         {
10173             context->getTexGenxv(coord, pname, params);
10174         }
10175         ANGLE_CAPTURE(GetTexGenxvOES, isCallValid, context, coord, pname, params);
10176     }
10177     else
10178     {
10179         GenerateContextLostErrorOnCurrentGlobalContext();
10180     }
10181 }
10182 
GL_TexGenfOES(GLenum coord,GLenum pname,GLfloat param)10183 void GL_APIENTRY GL_TexGenfOES(GLenum coord, GLenum pname, GLfloat param)
10184 {
10185     Context *context = GetValidGlobalContext();
10186     EVENT(context, GLTexGenfOES, "context = %d, coord = %s, pname = %s, param = %f", CID(context),
10187           GLenumToString(GLenumGroup::TextureCoordName, coord),
10188           GLenumToString(GLenumGroup::TextureGenParameter, pname), param);
10189 
10190     if (context)
10191     {
10192         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10193         bool isCallValid =
10194             (context->skipValidation() || ValidateTexGenfOES(context, coord, pname, param));
10195         if (isCallValid)
10196         {
10197             context->texGenf(coord, pname, param);
10198         }
10199         ANGLE_CAPTURE(TexGenfOES, isCallValid, context, coord, pname, param);
10200     }
10201     else
10202     {
10203         GenerateContextLostErrorOnCurrentGlobalContext();
10204     }
10205 }
10206 
GL_TexGenfvOES(GLenum coord,GLenum pname,const GLfloat * params)10207 void GL_APIENTRY GL_TexGenfvOES(GLenum coord, GLenum pname, const GLfloat *params)
10208 {
10209     Context *context = GetValidGlobalContext();
10210     EVENT(context, GLTexGenfvOES,
10211           "context = %d, coord = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
10212           GLenumToString(GLenumGroup::TextureCoordName, coord),
10213           GLenumToString(GLenumGroup::TextureGenParameter, pname), (uintptr_t)params);
10214 
10215     if (context)
10216     {
10217         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10218         bool isCallValid =
10219             (context->skipValidation() || ValidateTexGenfvOES(context, coord, pname, params));
10220         if (isCallValid)
10221         {
10222             context->texGenfv(coord, pname, params);
10223         }
10224         ANGLE_CAPTURE(TexGenfvOES, isCallValid, context, coord, pname, params);
10225     }
10226     else
10227     {
10228         GenerateContextLostErrorOnCurrentGlobalContext();
10229     }
10230 }
10231 
GL_TexGeniOES(GLenum coord,GLenum pname,GLint param)10232 void GL_APIENTRY GL_TexGeniOES(GLenum coord, GLenum pname, GLint param)
10233 {
10234     Context *context = GetValidGlobalContext();
10235     EVENT(context, GLTexGeniOES, "context = %d, coord = %s, pname = %s, param = %d", CID(context),
10236           GLenumToString(GLenumGroup::TextureCoordName, coord),
10237           GLenumToString(GLenumGroup::TextureGenParameter, pname), param);
10238 
10239     if (context)
10240     {
10241         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10242         bool isCallValid =
10243             (context->skipValidation() || ValidateTexGeniOES(context, coord, pname, param));
10244         if (isCallValid)
10245         {
10246             context->texGeni(coord, pname, param);
10247         }
10248         ANGLE_CAPTURE(TexGeniOES, isCallValid, context, coord, pname, param);
10249     }
10250     else
10251     {
10252         GenerateContextLostErrorOnCurrentGlobalContext();
10253     }
10254 }
10255 
GL_TexGenivOES(GLenum coord,GLenum pname,const GLint * params)10256 void GL_APIENTRY GL_TexGenivOES(GLenum coord, GLenum pname, const GLint *params)
10257 {
10258     Context *context = GetValidGlobalContext();
10259     EVENT(context, GLTexGenivOES,
10260           "context = %d, coord = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
10261           GLenumToString(GLenumGroup::TextureCoordName, coord),
10262           GLenumToString(GLenumGroup::TextureGenParameter, pname), (uintptr_t)params);
10263 
10264     if (context)
10265     {
10266         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10267         bool isCallValid =
10268             (context->skipValidation() || ValidateTexGenivOES(context, coord, pname, params));
10269         if (isCallValid)
10270         {
10271             context->texGeniv(coord, pname, params);
10272         }
10273         ANGLE_CAPTURE(TexGenivOES, isCallValid, context, coord, pname, params);
10274     }
10275     else
10276     {
10277         GenerateContextLostErrorOnCurrentGlobalContext();
10278     }
10279 }
10280 
GL_TexGenxOES(GLenum coord,GLenum pname,GLfixed param)10281 void GL_APIENTRY GL_TexGenxOES(GLenum coord, GLenum pname, GLfixed param)
10282 {
10283     Context *context = GetValidGlobalContext();
10284     EVENT(context, GLTexGenxOES, "context = %d, coord = %s, pname = %s, param = 0x%X", CID(context),
10285           GLenumToString(GLenumGroup::TextureCoordName, coord),
10286           GLenumToString(GLenumGroup::TextureGenParameter, pname), param);
10287 
10288     if (context)
10289     {
10290         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10291         bool isCallValid =
10292             (context->skipValidation() || ValidateTexGenxOES(context, coord, pname, param));
10293         if (isCallValid)
10294         {
10295             context->texGenx(coord, pname, param);
10296         }
10297         ANGLE_CAPTURE(TexGenxOES, isCallValid, context, coord, pname, param);
10298     }
10299     else
10300     {
10301         GenerateContextLostErrorOnCurrentGlobalContext();
10302     }
10303 }
10304 
GL_TexGenxvOES(GLenum coord,GLenum pname,const GLfixed * params)10305 void GL_APIENTRY GL_TexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params)
10306 {
10307     Context *context = GetValidGlobalContext();
10308     EVENT(context, GLTexGenxvOES,
10309           "context = %d, coord = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
10310           GLenumToString(GLenumGroup::TextureCoordName, coord),
10311           GLenumToString(GLenumGroup::TextureGenParameter, pname), (uintptr_t)params);
10312 
10313     if (context)
10314     {
10315         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10316         bool isCallValid =
10317             (context->skipValidation() || ValidateTexGenxvOES(context, coord, pname, params));
10318         if (isCallValid)
10319         {
10320             context->texGenxv(coord, pname, params);
10321         }
10322         ANGLE_CAPTURE(TexGenxvOES, isCallValid, context, coord, pname, params);
10323     }
10324     else
10325     {
10326         GenerateContextLostErrorOnCurrentGlobalContext();
10327     }
10328 }
10329 
10330 // GL_OES_texture_cube_map_array
10331 
10332 // GL_OES_texture_half_float
10333 
10334 // GL_OES_texture_stencil8
10335 
10336 // GL_OES_texture_storage_multisample_2d_array
GL_TexStorage3DMultisampleOES(GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLboolean fixedsamplelocations)10337 void GL_APIENTRY GL_TexStorage3DMultisampleOES(GLenum target,
10338                                                GLsizei samples,
10339                                                GLenum internalformat,
10340                                                GLsizei width,
10341                                                GLsizei height,
10342                                                GLsizei depth,
10343                                                GLboolean fixedsamplelocations)
10344 {
10345     Context *context = GetValidGlobalContext();
10346     EVENT(context, GLTexStorage3DMultisampleOES,
10347           "context = %d, target = %s, samples = %d, internalformat = %s, width = %d, height = %d, "
10348           "depth = %d, fixedsamplelocations = %s",
10349           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), samples,
10350           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height, depth,
10351           GLbooleanToString(fixedsamplelocations));
10352 
10353     if (context)
10354     {
10355         TextureType targetPacked                              = PackParam<TextureType>(target);
10356         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10357         bool isCallValid =
10358             (context->skipValidation() ||
10359              ValidateTexStorage3DMultisampleOES(context, targetPacked, samples, internalformat,
10360                                                 width, height, depth, fixedsamplelocations));
10361         if (isCallValid)
10362         {
10363             context->texStorage3DMultisample(targetPacked, samples, internalformat, width, height,
10364                                              depth, fixedsamplelocations);
10365         }
10366         ANGLE_CAPTURE(TexStorage3DMultisampleOES, isCallValid, context, targetPacked, samples,
10367                       internalformat, width, height, depth, fixedsamplelocations);
10368     }
10369     else
10370     {
10371         GenerateContextLostErrorOnCurrentGlobalContext();
10372     }
10373 }
10374 
10375 // GL_OES_vertex_array_object
GL_BindVertexArrayOES(GLuint array)10376 void GL_APIENTRY GL_BindVertexArrayOES(GLuint array)
10377 {
10378     Context *context = GetValidGlobalContext();
10379     EVENT(context, GLBindVertexArrayOES, "context = %d, array = %u", CID(context), array);
10380 
10381     if (context)
10382     {
10383         VertexArrayID arrayPacked                             = PackParam<VertexArrayID>(array);
10384         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10385         bool isCallValid =
10386             (context->skipValidation() || ValidateBindVertexArrayOES(context, arrayPacked));
10387         if (isCallValid)
10388         {
10389             context->bindVertexArray(arrayPacked);
10390         }
10391         ANGLE_CAPTURE(BindVertexArrayOES, isCallValid, context, arrayPacked);
10392     }
10393     else
10394     {
10395         GenerateContextLostErrorOnCurrentGlobalContext();
10396     }
10397 }
10398 
GL_DeleteVertexArraysOES(GLsizei n,const GLuint * arrays)10399 void GL_APIENTRY GL_DeleteVertexArraysOES(GLsizei n, const GLuint *arrays)
10400 {
10401     Context *context = GetValidGlobalContext();
10402     EVENT(context, GLDeleteVertexArraysOES, "context = %d, n = %d, arrays = 0x%016" PRIxPTR "",
10403           CID(context), n, (uintptr_t)arrays);
10404 
10405     if (context)
10406     {
10407         const VertexArrayID *arraysPacked = PackParam<const VertexArrayID *>(arrays);
10408         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10409         bool isCallValid =
10410             (context->skipValidation() || ValidateDeleteVertexArraysOES(context, n, arraysPacked));
10411         if (isCallValid)
10412         {
10413             context->deleteVertexArrays(n, arraysPacked);
10414         }
10415         ANGLE_CAPTURE(DeleteVertexArraysOES, isCallValid, context, n, arraysPacked);
10416     }
10417     else
10418     {
10419         GenerateContextLostErrorOnCurrentGlobalContext();
10420     }
10421 }
10422 
GL_GenVertexArraysOES(GLsizei n,GLuint * arrays)10423 void GL_APIENTRY GL_GenVertexArraysOES(GLsizei n, GLuint *arrays)
10424 {
10425     Context *context = GetValidGlobalContext();
10426     EVENT(context, GLGenVertexArraysOES, "context = %d, n = %d, arrays = 0x%016" PRIxPTR "",
10427           CID(context), n, (uintptr_t)arrays);
10428 
10429     if (context)
10430     {
10431         VertexArrayID *arraysPacked                           = PackParam<VertexArrayID *>(arrays);
10432         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10433         bool isCallValid =
10434             (context->skipValidation() || ValidateGenVertexArraysOES(context, n, arraysPacked));
10435         if (isCallValid)
10436         {
10437             context->genVertexArrays(n, arraysPacked);
10438         }
10439         ANGLE_CAPTURE(GenVertexArraysOES, isCallValid, context, n, arraysPacked);
10440     }
10441     else
10442     {
10443         GenerateContextLostErrorOnCurrentGlobalContext();
10444     }
10445 }
10446 
GL_IsVertexArrayOES(GLuint array)10447 GLboolean GL_APIENTRY GL_IsVertexArrayOES(GLuint array)
10448 {
10449     Context *context = GetValidGlobalContext();
10450     EVENT(context, GLIsVertexArrayOES, "context = %d, array = %u", CID(context), array);
10451 
10452     GLboolean returnValue;
10453     if (context)
10454     {
10455         VertexArrayID arrayPacked                             = PackParam<VertexArrayID>(array);
10456         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10457         bool isCallValid =
10458             (context->skipValidation() || ValidateIsVertexArrayOES(context, arrayPacked));
10459         if (isCallValid)
10460         {
10461             returnValue = context->isVertexArray(arrayPacked);
10462         }
10463         else
10464         {
10465             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsVertexArrayOES, GLboolean>();
10466         }
10467         ANGLE_CAPTURE(IsVertexArrayOES, isCallValid, context, arrayPacked, returnValue);
10468     }
10469     else
10470     {
10471         GenerateContextLostErrorOnCurrentGlobalContext();
10472         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsVertexArrayOES, GLboolean>();
10473     }
10474     return returnValue;
10475 }
10476 
10477 // GL_OVR_multiview
GL_FramebufferTextureMultiviewOVR(GLenum target,GLenum attachment,GLuint texture,GLint level,GLint baseViewIndex,GLsizei numViews)10478 void GL_APIENTRY GL_FramebufferTextureMultiviewOVR(GLenum target,
10479                                                    GLenum attachment,
10480                                                    GLuint texture,
10481                                                    GLint level,
10482                                                    GLint baseViewIndex,
10483                                                    GLsizei numViews)
10484 {
10485     Context *context = GetValidGlobalContext();
10486     EVENT(context, GLFramebufferTextureMultiviewOVR,
10487           "context = %d, target = %s, attachment = %s, texture = %u, level = %d, baseViewIndex = "
10488           "%d, numViews = %d",
10489           CID(context), GLenumToString(GLenumGroup::FramebufferTarget, target),
10490           GLenumToString(GLenumGroup::FramebufferAttachment, attachment), texture, level,
10491           baseViewIndex, numViews);
10492 
10493     if (context)
10494     {
10495         TextureID texturePacked                               = PackParam<TextureID>(texture);
10496         std::unique_lock<angle::GlobalMutex> shareContextLock = GetContextLock(context);
10497         bool isCallValid =
10498             (context->skipValidation() ||
10499              ValidateFramebufferTextureMultiviewOVR(context, target, attachment, texturePacked,
10500                                                     level, baseViewIndex, numViews));
10501         if (isCallValid)
10502         {
10503             context->framebufferTextureMultiview(target, attachment, texturePacked, level,
10504                                                  baseViewIndex, numViews);
10505         }
10506         ANGLE_CAPTURE(FramebufferTextureMultiviewOVR, isCallValid, context, target, attachment,
10507                       texturePacked, level, baseViewIndex, numViews);
10508     }
10509     else
10510     {
10511         GenerateContextLostErrorOnCurrentGlobalContext();
10512     }
10513 }
10514 
10515 // GL_OVR_multiview2
10516 }  // extern "C"
10517