• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by generate_entry_points.py using data from gl.xml.
3 //
4 // Copyright 2020 The ANGLE Project Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style license that can be
6 // found in the LICENSE file.
7 //
8 // entry_points_gles_3_0_autogen.cpp:
9 //   Defines the GLES 3.0 entry points.
10 
11 #include "libGLESv2/entry_points_gles_3_0_autogen.h"
12 
13 #include "libANGLE/Context.h"
14 #include "libANGLE/Context.inl.h"
15 #include "libANGLE/capture_gles_3_0_autogen.h"
16 #include "libANGLE/entry_points_utils.h"
17 #include "libANGLE/gl_enum_utils.h"
18 #include "libANGLE/validationES3.h"
19 #include "libGLESv2/global_state.h"
20 
21 namespace gl
22 {
BeginQuery(GLenum target,GLuint id)23 void GL_APIENTRY BeginQuery(GLenum target, GLuint id)
24 {
25     Context *context = GetValidGlobalContext();
26     EVENT("glBeginQuery", "context = %d, GLenum target = %s, GLuint id = %u", CID(context),
27           GLenumToString(GLenumGroup::QueryTarget, target), id);
28 
29     if (context)
30     {
31         QueryType targetPacked                                = FromGL<QueryType>(target);
32         QueryID idPacked                                      = FromGL<QueryID>(id);
33         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
34         bool isCallValid =
35             (context->skipValidation() || ValidateBeginQuery(context, targetPacked, idPacked));
36         if (isCallValid)
37         {
38             context->beginQuery(targetPacked, idPacked);
39         }
40         ANGLE_CAPTURE(BeginQuery, isCallValid, context, targetPacked, idPacked);
41     }
42 }
43 
BeginTransformFeedback(GLenum primitiveMode)44 void GL_APIENTRY BeginTransformFeedback(GLenum primitiveMode)
45 {
46     Context *context = GetValidGlobalContext();
47     EVENT("glBeginTransformFeedback", "context = %d, GLenum primitiveMode = %s", CID(context),
48           GLenumToString(GLenumGroup::PrimitiveType, primitiveMode));
49 
50     if (context)
51     {
52         PrimitiveMode primitiveModePacked = FromGL<PrimitiveMode>(primitiveMode);
53         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
54         bool isCallValid                                      = (context->skipValidation() ||
55                             ValidateBeginTransformFeedback(context, primitiveModePacked));
56         if (isCallValid)
57         {
58             context->beginTransformFeedback(primitiveModePacked);
59         }
60         ANGLE_CAPTURE(BeginTransformFeedback, isCallValid, context, primitiveModePacked);
61     }
62 }
63 
BindBufferBase(GLenum target,GLuint index,GLuint buffer)64 void GL_APIENTRY BindBufferBase(GLenum target, GLuint index, GLuint buffer)
65 {
66     Context *context = GetValidGlobalContext();
67     EVENT("glBindBufferBase",
68           "context = %d, GLenum target = %s, GLuint index = %u, GLuint buffer = %u", CID(context),
69           GLenumToString(GLenumGroup::BufferTargetARB, target), index, buffer);
70 
71     if (context)
72     {
73         BufferBinding targetPacked                            = FromGL<BufferBinding>(target);
74         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
75         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
76         bool isCallValid                                      = (context->skipValidation() ||
77                             ValidateBindBufferBase(context, targetPacked, index, bufferPacked));
78         if (isCallValid)
79         {
80             context->bindBufferBase(targetPacked, index, bufferPacked);
81         }
82         ANGLE_CAPTURE(BindBufferBase, isCallValid, context, targetPacked, index, bufferPacked);
83     }
84 }
85 
86 void GL_APIENTRY
BindBufferRange(GLenum target,GLuint index,GLuint buffer,GLintptr offset,GLsizeiptr size)87 BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
88 {
89     Context *context = GetValidGlobalContext();
90     EVENT("glBindBufferRange",
91           "context = %d, GLenum target = %s, GLuint index = %u, GLuint buffer = %u, GLintptr "
92           "offset = %llu, GLsizeiptr size = %llu",
93           CID(context), GLenumToString(GLenumGroup::BufferTargetARB, target), index, buffer,
94           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size));
95 
96     if (context)
97     {
98         BufferBinding targetPacked                            = FromGL<BufferBinding>(target);
99         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
100         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
101         bool isCallValid =
102             (context->skipValidation() ||
103              ValidateBindBufferRange(context, targetPacked, index, bufferPacked, offset, size));
104         if (isCallValid)
105         {
106             context->bindBufferRange(targetPacked, index, bufferPacked, offset, size);
107         }
108         ANGLE_CAPTURE(BindBufferRange, isCallValid, context, targetPacked, index, bufferPacked,
109                       offset, size);
110     }
111 }
112 
BindSampler(GLuint unit,GLuint sampler)113 void GL_APIENTRY BindSampler(GLuint unit, GLuint sampler)
114 {
115     Context *context = GetValidGlobalContext();
116     EVENT("glBindSampler", "context = %d, GLuint unit = %u, GLuint sampler = %u", CID(context),
117           unit, sampler);
118 
119     if (context)
120     {
121         SamplerID samplerPacked                               = FromGL<SamplerID>(sampler);
122         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
123         bool isCallValid =
124             (context->skipValidation() || ValidateBindSampler(context, unit, samplerPacked));
125         if (isCallValid)
126         {
127             context->bindSampler(unit, samplerPacked);
128         }
129         ANGLE_CAPTURE(BindSampler, isCallValid, context, unit, samplerPacked);
130     }
131 }
132 
BindTransformFeedback(GLenum target,GLuint id)133 void GL_APIENTRY BindTransformFeedback(GLenum target, GLuint id)
134 {
135     Context *context = GetValidGlobalContext();
136     EVENT("glBindTransformFeedback", "context = %d, GLenum target = %s, GLuint id = %u",
137           CID(context), GLenumToString(GLenumGroup::BindTransformFeedbackTarget, target), id);
138 
139     if (context)
140     {
141         TransformFeedbackID idPacked                          = FromGL<TransformFeedbackID>(id);
142         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
143         bool isCallValid =
144             (context->skipValidation() || ValidateBindTransformFeedback(context, target, idPacked));
145         if (isCallValid)
146         {
147             context->bindTransformFeedback(target, idPacked);
148         }
149         ANGLE_CAPTURE(BindTransformFeedback, isCallValid, context, target, idPacked);
150     }
151 }
152 
BindVertexArray(GLuint array)153 void GL_APIENTRY BindVertexArray(GLuint array)
154 {
155     Context *context = GetValidGlobalContext();
156     EVENT("glBindVertexArray", "context = %d, GLuint array = %u", CID(context), array);
157 
158     if (context)
159     {
160         VertexArrayID arrayPacked                             = FromGL<VertexArrayID>(array);
161         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
162         bool isCallValid =
163             (context->skipValidation() || ValidateBindVertexArray(context, arrayPacked));
164         if (isCallValid)
165         {
166             context->bindVertexArray(arrayPacked);
167         }
168         ANGLE_CAPTURE(BindVertexArray, isCallValid, context, arrayPacked);
169     }
170 }
171 
BlitFramebuffer(GLint srcX0,GLint srcY0,GLint srcX1,GLint srcY1,GLint dstX0,GLint dstY0,GLint dstX1,GLint dstY1,GLbitfield mask,GLenum filter)172 void GL_APIENTRY BlitFramebuffer(GLint srcX0,
173                                  GLint srcY0,
174                                  GLint srcX1,
175                                  GLint srcY1,
176                                  GLint dstX0,
177                                  GLint dstY0,
178                                  GLint dstX1,
179                                  GLint dstY1,
180                                  GLbitfield mask,
181                                  GLenum filter)
182 {
183     Context *context = GetValidGlobalContext();
184     EVENT("glBlitFramebuffer",
185           "context = %d, GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, "
186           "GLint dstX0 = %d, GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, GLbitfield mask "
187           "= %s, GLenum filter = %s",
188           CID(context), srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
189           GLbitfieldToString(GLenumGroup::ClearBufferMask, mask).c_str(),
190           GLenumToString(GLenumGroup::BlitFramebufferFilter, filter));
191 
192     if (context)
193     {
194         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
195         bool isCallValid                                      = (context->skipValidation() ||
196                             ValidateBlitFramebuffer(context, srcX0, srcY0, srcX1, srcY1, dstX0,
197                                                     dstY0, dstX1, dstY1, mask, filter));
198         if (isCallValid)
199         {
200             context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask,
201                                      filter);
202         }
203         ANGLE_CAPTURE(BlitFramebuffer, isCallValid, context, srcX0, srcY0, srcX1, srcY1, dstX0,
204                       dstY0, dstX1, dstY1, mask, filter);
205     }
206 }
207 
ClearBufferfi(GLenum buffer,GLint drawbuffer,GLfloat depth,GLint stencil)208 void GL_APIENTRY ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
209 {
210     Context *context = GetValidGlobalContext();
211     EVENT("glClearBufferfi",
212           "context = %d, GLenum buffer = %s, GLint drawbuffer = %d, GLfloat depth = %f, GLint "
213           "stencil = %d",
214           CID(context), GLenumToString(GLenumGroup::Buffer, buffer), drawbuffer, depth, stencil);
215 
216     if (context)
217     {
218         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
219         bool isCallValid                                      = (context->skipValidation() ||
220                             ValidateClearBufferfi(context, buffer, drawbuffer, depth, stencil));
221         if (isCallValid)
222         {
223             context->clearBufferfi(buffer, drawbuffer, depth, stencil);
224         }
225         ANGLE_CAPTURE(ClearBufferfi, isCallValid, context, buffer, drawbuffer, depth, stencil);
226     }
227 }
228 
ClearBufferfv(GLenum buffer,GLint drawbuffer,const GLfloat * value)229 void GL_APIENTRY ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
230 {
231     Context *context = GetValidGlobalContext();
232     EVENT("glClearBufferfv",
233           "context = %d, GLenum buffer = %s, GLint drawbuffer = %d, const GLfloat *value = "
234           "0x%016" PRIxPTR "",
235           CID(context), GLenumToString(GLenumGroup::Buffer, buffer), drawbuffer, (uintptr_t)value);
236 
237     if (context)
238     {
239         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
240         bool isCallValid                                      = (context->skipValidation() ||
241                             ValidateClearBufferfv(context, buffer, drawbuffer, value));
242         if (isCallValid)
243         {
244             context->clearBufferfv(buffer, drawbuffer, value);
245         }
246         ANGLE_CAPTURE(ClearBufferfv, isCallValid, context, buffer, drawbuffer, value);
247     }
248 }
249 
ClearBufferiv(GLenum buffer,GLint drawbuffer,const GLint * value)250 void GL_APIENTRY ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
251 {
252     Context *context = GetValidGlobalContext();
253     EVENT("glClearBufferiv",
254           "context = %d, GLenum buffer = %s, GLint drawbuffer = %d, const GLint *value = "
255           "0x%016" PRIxPTR "",
256           CID(context), GLenumToString(GLenumGroup::Buffer, buffer), drawbuffer, (uintptr_t)value);
257 
258     if (context)
259     {
260         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
261         bool isCallValid                                      = (context->skipValidation() ||
262                             ValidateClearBufferiv(context, buffer, drawbuffer, value));
263         if (isCallValid)
264         {
265             context->clearBufferiv(buffer, drawbuffer, value);
266         }
267         ANGLE_CAPTURE(ClearBufferiv, isCallValid, context, buffer, drawbuffer, value);
268     }
269 }
270 
ClearBufferuiv(GLenum buffer,GLint drawbuffer,const GLuint * value)271 void GL_APIENTRY ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
272 {
273     Context *context = GetValidGlobalContext();
274     EVENT("glClearBufferuiv",
275           "context = %d, GLenum buffer = %s, GLint drawbuffer = %d, const GLuint *value = "
276           "0x%016" PRIxPTR "",
277           CID(context), GLenumToString(GLenumGroup::Buffer, buffer), drawbuffer, (uintptr_t)value);
278 
279     if (context)
280     {
281         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
282         bool isCallValid                                      = (context->skipValidation() ||
283                             ValidateClearBufferuiv(context, buffer, drawbuffer, value));
284         if (isCallValid)
285         {
286             context->clearBufferuiv(buffer, drawbuffer, value);
287         }
288         ANGLE_CAPTURE(ClearBufferuiv, isCallValid, context, buffer, drawbuffer, value);
289     }
290 }
291 
ClientWaitSync(GLsync sync,GLbitfield flags,GLuint64 timeout)292 GLenum GL_APIENTRY ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
293 {
294     Context *context = GetValidGlobalContext();
295     EVENT("glClientWaitSync",
296           "context = %d, GLsync sync = 0x%016" PRIxPTR
297           ", GLbitfield flags = %s, GLuint64 timeout = %llu",
298           CID(context), (uintptr_t)sync,
299           GLbitfieldToString(GLenumGroup::SyncObjectMask, flags).c_str(),
300           static_cast<unsigned long long>(timeout));
301 
302     GLenum returnValue;
303     if (context)
304     {
305         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
306         bool isCallValid =
307             (context->skipValidation() || ValidateClientWaitSync(context, sync, flags, timeout));
308         if (isCallValid)
309         {
310             returnValue = context->clientWaitSync(sync, flags, timeout);
311         }
312         else
313         {
314             returnValue = GetDefaultReturnValue<EntryPoint::ClientWaitSync, GLenum>();
315         }
316         ANGLE_CAPTURE(ClientWaitSync, isCallValid, context, sync, flags, timeout, returnValue);
317     }
318     else
319     {
320         returnValue = GetDefaultReturnValue<EntryPoint::ClientWaitSync, GLenum>();
321     }
322     return returnValue;
323 }
324 
CompressedTexImage3D(GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLsizei imageSize,const void * data)325 void GL_APIENTRY CompressedTexImage3D(GLenum target,
326                                       GLint level,
327                                       GLenum internalformat,
328                                       GLsizei width,
329                                       GLsizei height,
330                                       GLsizei depth,
331                                       GLint border,
332                                       GLsizei imageSize,
333                                       const void *data)
334 {
335     Context *context = GetValidGlobalContext();
336     EVENT("glCompressedTexImage3D",
337           "context = %d, GLenum target = %s, GLint level = %d, GLenum internalformat = %s, GLsizei "
338           "width = %d, GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLsizei "
339           "imageSize = %d, const void *data = 0x%016" PRIxPTR "",
340           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level,
341           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height, depth, border,
342           imageSize, (uintptr_t)data);
343 
344     if (context)
345     {
346         TextureTarget targetPacked                            = FromGL<TextureTarget>(target);
347         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
348         bool isCallValid =
349             (context->skipValidation() ||
350              ValidateCompressedTexImage3D(context, targetPacked, level, internalformat, width,
351                                           height, depth, border, imageSize, data));
352         if (isCallValid)
353         {
354             context->compressedTexImage3D(targetPacked, level, internalformat, width, height, depth,
355                                           border, imageSize, data);
356         }
357         ANGLE_CAPTURE(CompressedTexImage3D, isCallValid, context, targetPacked, level,
358                       internalformat, width, height, depth, border, imageSize, data);
359     }
360 }
361 
CompressedTexSubImage3D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLsizei imageSize,const void * data)362 void GL_APIENTRY CompressedTexSubImage3D(GLenum target,
363                                          GLint level,
364                                          GLint xoffset,
365                                          GLint yoffset,
366                                          GLint zoffset,
367                                          GLsizei width,
368                                          GLsizei height,
369                                          GLsizei depth,
370                                          GLenum format,
371                                          GLsizei imageSize,
372                                          const void *data)
373 {
374     Context *context = GetValidGlobalContext();
375     EVENT("glCompressedTexSubImage3D",
376           "context = %d, GLenum target = %s, GLint level = %d, GLint xoffset = %d, GLint yoffset = "
377           "%d, GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, "
378           "GLenum format = %s, GLsizei imageSize = %d, const void *data = 0x%016" PRIxPTR "",
379           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, xoffset, yoffset,
380           zoffset, width, height, depth, GLenumToString(GLenumGroup::PixelFormat, format),
381           imageSize, (uintptr_t)data);
382 
383     if (context)
384     {
385         TextureTarget targetPacked                            = FromGL<TextureTarget>(target);
386         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
387         bool isCallValid                                      = (context->skipValidation() ||
388                             ValidateCompressedTexSubImage3D(context, targetPacked, level, xoffset,
389                                                             yoffset, zoffset, width, height, depth,
390                                                             format, imageSize, data));
391         if (isCallValid)
392         {
393             context->compressedTexSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, width,
394                                              height, depth, format, imageSize, data);
395         }
396         ANGLE_CAPTURE(CompressedTexSubImage3D, isCallValid, context, targetPacked, level, xoffset,
397                       yoffset, zoffset, width, height, depth, format, imageSize, data);
398     }
399 }
400 
CopyBufferSubData(GLenum readTarget,GLenum writeTarget,GLintptr readOffset,GLintptr writeOffset,GLsizeiptr size)401 void GL_APIENTRY CopyBufferSubData(GLenum readTarget,
402                                    GLenum writeTarget,
403                                    GLintptr readOffset,
404                                    GLintptr writeOffset,
405                                    GLsizeiptr size)
406 {
407     Context *context = GetValidGlobalContext();
408     EVENT("glCopyBufferSubData",
409           "context = %d, GLenum readTarget = %s, GLenum writeTarget = %s, GLintptr readOffset = "
410           "%llu, GLintptr writeOffset = %llu, GLsizeiptr size = %llu",
411           CID(context), GLenumToString(GLenumGroup::CopyBufferSubDataTarget, readTarget),
412           GLenumToString(GLenumGroup::CopyBufferSubDataTarget, writeTarget),
413           static_cast<unsigned long long>(readOffset), static_cast<unsigned long long>(writeOffset),
414           static_cast<unsigned long long>(size));
415 
416     if (context)
417     {
418         BufferBinding readTargetPacked                        = FromGL<BufferBinding>(readTarget);
419         BufferBinding writeTargetPacked                       = FromGL<BufferBinding>(writeTarget);
420         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
421         bool isCallValid                                      = (context->skipValidation() ||
422                             ValidateCopyBufferSubData(context, readTargetPacked, writeTargetPacked,
423                                                       readOffset, writeOffset, size));
424         if (isCallValid)
425         {
426             context->copyBufferSubData(readTargetPacked, writeTargetPacked, readOffset, writeOffset,
427                                        size);
428         }
429         ANGLE_CAPTURE(CopyBufferSubData, isCallValid, context, readTargetPacked, writeTargetPacked,
430                       readOffset, writeOffset, size);
431     }
432 }
433 
CopyTexSubImage3D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLint x,GLint y,GLsizei width,GLsizei height)434 void GL_APIENTRY CopyTexSubImage3D(GLenum target,
435                                    GLint level,
436                                    GLint xoffset,
437                                    GLint yoffset,
438                                    GLint zoffset,
439                                    GLint x,
440                                    GLint y,
441                                    GLsizei width,
442                                    GLsizei height)
443 {
444     Context *context = GetValidGlobalContext();
445     EVENT("glCopyTexSubImage3D",
446           "context = %d, GLenum target = %s, GLint level = %d, GLint xoffset = %d, GLint yoffset = "
447           "%d, GLint zoffset = %d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height "
448           "= %d",
449           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, xoffset, yoffset,
450           zoffset, x, y, width, height);
451 
452     if (context)
453     {
454         TextureTarget targetPacked                            = FromGL<TextureTarget>(target);
455         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
456         bool isCallValid                                      = (context->skipValidation() ||
457                             ValidateCopyTexSubImage3D(context, targetPacked, level, xoffset,
458                                                       yoffset, zoffset, x, y, width, height));
459         if (isCallValid)
460         {
461             context->copyTexSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, x, y, width,
462                                        height);
463         }
464         ANGLE_CAPTURE(CopyTexSubImage3D, isCallValid, context, targetPacked, level, xoffset,
465                       yoffset, zoffset, x, y, width, height);
466     }
467 }
468 
DeleteQueries(GLsizei n,const GLuint * ids)469 void GL_APIENTRY DeleteQueries(GLsizei n, const GLuint *ids)
470 {
471     Context *context = GetValidGlobalContext();
472     EVENT("glDeleteQueries", "context = %d, GLsizei n = %d, const GLuint *ids = 0x%016" PRIxPTR "",
473           CID(context), n, (uintptr_t)ids);
474 
475     if (context)
476     {
477         const QueryID *idsPacked                              = FromGL<const QueryID *>(ids);
478         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
479         bool isCallValid =
480             (context->skipValidation() || ValidateDeleteQueries(context, n, idsPacked));
481         if (isCallValid)
482         {
483             context->deleteQueries(n, idsPacked);
484         }
485         ANGLE_CAPTURE(DeleteQueries, isCallValid, context, n, idsPacked);
486     }
487 }
488 
DeleteSamplers(GLsizei count,const GLuint * samplers)489 void GL_APIENTRY DeleteSamplers(GLsizei count, const GLuint *samplers)
490 {
491     Context *context = GetValidGlobalContext();
492     EVENT("glDeleteSamplers",
493           "context = %d, GLsizei count = %d, const GLuint *samplers = 0x%016" PRIxPTR "",
494           CID(context), count, (uintptr_t)samplers);
495 
496     if (context)
497     {
498         const SamplerID *samplersPacked                       = FromGL<const SamplerID *>(samplers);
499         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
500         bool isCallValid =
501             (context->skipValidation() || ValidateDeleteSamplers(context, count, samplersPacked));
502         if (isCallValid)
503         {
504             context->deleteSamplers(count, samplersPacked);
505         }
506         ANGLE_CAPTURE(DeleteSamplers, isCallValid, context, count, samplersPacked);
507     }
508 }
509 
DeleteSync(GLsync sync)510 void GL_APIENTRY DeleteSync(GLsync sync)
511 {
512     Context *context = GetValidGlobalContext();
513     EVENT("glDeleteSync", "context = %d, GLsync sync = 0x%016" PRIxPTR "", CID(context),
514           (uintptr_t)sync);
515 
516     if (context)
517     {
518         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
519         bool isCallValid = (context->skipValidation() || ValidateDeleteSync(context, sync));
520         if (isCallValid)
521         {
522             context->deleteSync(sync);
523         }
524         ANGLE_CAPTURE(DeleteSync, isCallValid, context, sync);
525     }
526 }
527 
DeleteTransformFeedbacks(GLsizei n,const GLuint * ids)528 void GL_APIENTRY DeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
529 {
530     Context *context = GetValidGlobalContext();
531     EVENT("glDeleteTransformFeedbacks",
532           "context = %d, GLsizei n = %d, const GLuint *ids = 0x%016" PRIxPTR "", CID(context), n,
533           (uintptr_t)ids);
534 
535     if (context)
536     {
537         const TransformFeedbackID *idsPacked = FromGL<const TransformFeedbackID *>(ids);
538         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
539         bool isCallValid =
540             (context->skipValidation() || ValidateDeleteTransformFeedbacks(context, n, idsPacked));
541         if (isCallValid)
542         {
543             context->deleteTransformFeedbacks(n, idsPacked);
544         }
545         ANGLE_CAPTURE(DeleteTransformFeedbacks, isCallValid, context, n, idsPacked);
546     }
547 }
548 
DeleteVertexArrays(GLsizei n,const GLuint * arrays)549 void GL_APIENTRY DeleteVertexArrays(GLsizei n, const GLuint *arrays)
550 {
551     Context *context = GetValidGlobalContext();
552     EVENT("glDeleteVertexArrays",
553           "context = %d, GLsizei n = %d, const GLuint *arrays = 0x%016" PRIxPTR "", CID(context), n,
554           (uintptr_t)arrays);
555 
556     if (context)
557     {
558         const VertexArrayID *arraysPacked = FromGL<const VertexArrayID *>(arrays);
559         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
560         bool isCallValid =
561             (context->skipValidation() || ValidateDeleteVertexArrays(context, n, arraysPacked));
562         if (isCallValid)
563         {
564             context->deleteVertexArrays(n, arraysPacked);
565         }
566         ANGLE_CAPTURE(DeleteVertexArrays, isCallValid, context, n, arraysPacked);
567     }
568 }
569 
DrawArraysInstanced(GLenum mode,GLint first,GLsizei count,GLsizei instancecount)570 void GL_APIENTRY DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount)
571 {
572     Context *context = GetValidGlobalContext();
573     EVENT("glDrawArraysInstanced",
574           "context = %d, GLenum mode = %s, GLint first = %d, GLsizei count = %d, GLsizei "
575           "instancecount = %d",
576           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), first, count,
577           instancecount);
578 
579     if (context)
580     {
581         PrimitiveMode modePacked                              = FromGL<PrimitiveMode>(mode);
582         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
583         bool isCallValid =
584             (context->skipValidation() ||
585              ValidateDrawArraysInstanced(context, modePacked, first, count, instancecount));
586         if (isCallValid)
587         {
588             context->drawArraysInstanced(modePacked, first, count, instancecount);
589         }
590         ANGLE_CAPTURE(DrawArraysInstanced, isCallValid, context, modePacked, first, count,
591                       instancecount);
592     }
593 }
594 
DrawBuffers(GLsizei n,const GLenum * bufs)595 void GL_APIENTRY DrawBuffers(GLsizei n, const GLenum *bufs)
596 {
597     Context *context = GetValidGlobalContext();
598     EVENT("glDrawBuffers", "context = %d, GLsizei n = %d, const GLenum *bufs = 0x%016" PRIxPTR "",
599           CID(context), n, (uintptr_t)bufs);
600 
601     if (context)
602     {
603         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
604         bool isCallValid = (context->skipValidation() || ValidateDrawBuffers(context, n, bufs));
605         if (isCallValid)
606         {
607             context->drawBuffers(n, bufs);
608         }
609         ANGLE_CAPTURE(DrawBuffers, isCallValid, context, n, bufs);
610     }
611 }
612 
DrawElementsInstanced(GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei instancecount)613 void GL_APIENTRY DrawElementsInstanced(GLenum mode,
614                                        GLsizei count,
615                                        GLenum type,
616                                        const void *indices,
617                                        GLsizei instancecount)
618 {
619     Context *context = GetValidGlobalContext();
620     EVENT("glDrawElementsInstanced",
621           "context = %d, GLenum mode = %s, GLsizei count = %d, GLenum type = %s, const void "
622           "*indices = 0x%016" PRIxPTR ", GLsizei instancecount = %d",
623           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), count,
624           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices, instancecount);
625 
626     if (context)
627     {
628         PrimitiveMode modePacked                              = FromGL<PrimitiveMode>(mode);
629         DrawElementsType typePacked                           = FromGL<DrawElementsType>(type);
630         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
631         bool isCallValid                                      = (context->skipValidation() ||
632                             ValidateDrawElementsInstanced(context, modePacked, count, typePacked,
633                                                           indices, instancecount));
634         if (isCallValid)
635         {
636             context->drawElementsInstanced(modePacked, count, typePacked, indices, instancecount);
637         }
638         ANGLE_CAPTURE(DrawElementsInstanced, isCallValid, context, modePacked, count, typePacked,
639                       indices, instancecount);
640     }
641 }
642 
DrawRangeElements(GLenum mode,GLuint start,GLuint end,GLsizei count,GLenum type,const void * indices)643 void GL_APIENTRY DrawRangeElements(GLenum mode,
644                                    GLuint start,
645                                    GLuint end,
646                                    GLsizei count,
647                                    GLenum type,
648                                    const void *indices)
649 {
650     Context *context = GetValidGlobalContext();
651     EVENT("glDrawRangeElements",
652           "context = %d, GLenum mode = %s, GLuint start = %u, GLuint end = %u, GLsizei count = %d, "
653           "GLenum type = %s, const void *indices = 0x%016" PRIxPTR "",
654           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), start, end, count,
655           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices);
656 
657     if (context)
658     {
659         PrimitiveMode modePacked                              = FromGL<PrimitiveMode>(mode);
660         DrawElementsType typePacked                           = FromGL<DrawElementsType>(type);
661         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
662         bool isCallValid =
663             (context->skipValidation() || ValidateDrawRangeElements(context, modePacked, start, end,
664                                                                     count, typePacked, indices));
665         if (isCallValid)
666         {
667             context->drawRangeElements(modePacked, start, end, count, typePacked, indices);
668         }
669         ANGLE_CAPTURE(DrawRangeElements, isCallValid, context, modePacked, start, end, count,
670                       typePacked, indices);
671     }
672 }
673 
EndQuery(GLenum target)674 void GL_APIENTRY EndQuery(GLenum target)
675 {
676     Context *context = GetValidGlobalContext();
677     EVENT("glEndQuery", "context = %d, GLenum target = %s", CID(context),
678           GLenumToString(GLenumGroup::QueryTarget, target));
679 
680     if (context)
681     {
682         QueryType targetPacked                                = FromGL<QueryType>(target);
683         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
684         bool isCallValid = (context->skipValidation() || ValidateEndQuery(context, targetPacked));
685         if (isCallValid)
686         {
687             context->endQuery(targetPacked);
688         }
689         ANGLE_CAPTURE(EndQuery, isCallValid, context, targetPacked);
690     }
691 }
692 
EndTransformFeedback()693 void GL_APIENTRY EndTransformFeedback()
694 {
695     Context *context = GetValidGlobalContext();
696     EVENT("glEndTransformFeedback", "context = %d", CID(context));
697 
698     if (context)
699     {
700         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
701         bool isCallValid = (context->skipValidation() || ValidateEndTransformFeedback(context));
702         if (isCallValid)
703         {
704             context->endTransformFeedback();
705         }
706         ANGLE_CAPTURE(EndTransformFeedback, isCallValid, context);
707     }
708 }
709 
FenceSync(GLenum condition,GLbitfield flags)710 GLsync GL_APIENTRY FenceSync(GLenum condition, GLbitfield flags)
711 {
712     Context *context = GetValidGlobalContext();
713     EVENT("glFenceSync", "context = %d, GLenum condition = %s, GLbitfield flags = %s", CID(context),
714           GLenumToString(GLenumGroup::SyncCondition, condition),
715           GLbitfieldToString(GLenumGroup::DefaultGroup, flags).c_str());
716 
717     GLsync returnValue;
718     if (context)
719     {
720         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
721         bool isCallValid =
722             (context->skipValidation() || ValidateFenceSync(context, condition, flags));
723         if (isCallValid)
724         {
725             returnValue = context->fenceSync(condition, flags);
726         }
727         else
728         {
729             returnValue = GetDefaultReturnValue<EntryPoint::FenceSync, GLsync>();
730         }
731         ANGLE_CAPTURE(FenceSync, isCallValid, context, condition, flags, returnValue);
732     }
733     else
734     {
735         returnValue = GetDefaultReturnValue<EntryPoint::FenceSync, GLsync>();
736     }
737     return returnValue;
738 }
739 
FlushMappedBufferRange(GLenum target,GLintptr offset,GLsizeiptr length)740 void GL_APIENTRY FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
741 {
742     Context *context = GetValidGlobalContext();
743     EVENT("glFlushMappedBufferRange",
744           "context = %d, GLenum target = %s, GLintptr offset = %llu, GLsizeiptr length = %llu",
745           CID(context), GLenumToString(GLenumGroup::BufferTargetARB, target),
746           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length));
747 
748     if (context)
749     {
750         BufferBinding targetPacked                            = FromGL<BufferBinding>(target);
751         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
752         bool isCallValid                                      = (context->skipValidation() ||
753                             ValidateFlushMappedBufferRange(context, targetPacked, offset, length));
754         if (isCallValid)
755         {
756             context->flushMappedBufferRange(targetPacked, offset, length);
757         }
758         ANGLE_CAPTURE(FlushMappedBufferRange, isCallValid, context, targetPacked, offset, length);
759     }
760 }
761 
762 void GL_APIENTRY
FramebufferTextureLayer(GLenum target,GLenum attachment,GLuint texture,GLint level,GLint layer)763 FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
764 {
765     Context *context = GetValidGlobalContext();
766     EVENT("glFramebufferTextureLayer",
767           "context = %d, GLenum target = %s, GLenum attachment = %s, GLuint texture = %u, GLint "
768           "level = %d, GLint layer = %d",
769           CID(context), GLenumToString(GLenumGroup::FramebufferTarget, target),
770           GLenumToString(GLenumGroup::FramebufferAttachment, attachment), texture, level, layer);
771 
772     if (context)
773     {
774         TextureID texturePacked                               = FromGL<TextureID>(texture);
775         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
776         bool isCallValid                                      = (context->skipValidation() ||
777                             ValidateFramebufferTextureLayer(context, target, attachment,
778                                                             texturePacked, level, layer));
779         if (isCallValid)
780         {
781             context->framebufferTextureLayer(target, attachment, texturePacked, level, layer);
782         }
783         ANGLE_CAPTURE(FramebufferTextureLayer, isCallValid, context, target, attachment,
784                       texturePacked, level, layer);
785     }
786 }
787 
GenQueries(GLsizei n,GLuint * ids)788 void GL_APIENTRY GenQueries(GLsizei n, GLuint *ids)
789 {
790     Context *context = GetValidGlobalContext();
791     EVENT("glGenQueries", "context = %d, GLsizei n = %d, GLuint *ids = 0x%016" PRIxPTR "",
792           CID(context), n, (uintptr_t)ids);
793 
794     if (context)
795     {
796         QueryID *idsPacked                                    = FromGL<QueryID *>(ids);
797         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
798         bool isCallValid = (context->skipValidation() || ValidateGenQueries(context, n, idsPacked));
799         if (isCallValid)
800         {
801             context->genQueries(n, idsPacked);
802         }
803         ANGLE_CAPTURE(GenQueries, isCallValid, context, n, idsPacked);
804     }
805 }
806 
GenSamplers(GLsizei count,GLuint * samplers)807 void GL_APIENTRY GenSamplers(GLsizei count, GLuint *samplers)
808 {
809     Context *context = GetValidGlobalContext();
810     EVENT("glGenSamplers", "context = %d, GLsizei count = %d, GLuint *samplers = 0x%016" PRIxPTR "",
811           CID(context), count, (uintptr_t)samplers);
812 
813     if (context)
814     {
815         SamplerID *samplersPacked                             = FromGL<SamplerID *>(samplers);
816         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
817         bool isCallValid =
818             (context->skipValidation() || ValidateGenSamplers(context, count, samplersPacked));
819         if (isCallValid)
820         {
821             context->genSamplers(count, samplersPacked);
822         }
823         ANGLE_CAPTURE(GenSamplers, isCallValid, context, count, samplersPacked);
824     }
825 }
826 
GenTransformFeedbacks(GLsizei n,GLuint * ids)827 void GL_APIENTRY GenTransformFeedbacks(GLsizei n, GLuint *ids)
828 {
829     Context *context = GetValidGlobalContext();
830     EVENT("glGenTransformFeedbacks",
831           "context = %d, GLsizei n = %d, GLuint *ids = 0x%016" PRIxPTR "", CID(context), n,
832           (uintptr_t)ids);
833 
834     if (context)
835     {
836         TransformFeedbackID *idsPacked                        = FromGL<TransformFeedbackID *>(ids);
837         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
838         bool isCallValid =
839             (context->skipValidation() || ValidateGenTransformFeedbacks(context, n, idsPacked));
840         if (isCallValid)
841         {
842             context->genTransformFeedbacks(n, idsPacked);
843         }
844         ANGLE_CAPTURE(GenTransformFeedbacks, isCallValid, context, n, idsPacked);
845     }
846 }
847 
GenVertexArrays(GLsizei n,GLuint * arrays)848 void GL_APIENTRY GenVertexArrays(GLsizei n, GLuint *arrays)
849 {
850     Context *context = GetValidGlobalContext();
851     EVENT("glGenVertexArrays", "context = %d, GLsizei n = %d, GLuint *arrays = 0x%016" PRIxPTR "",
852           CID(context), n, (uintptr_t)arrays);
853 
854     if (context)
855     {
856         VertexArrayID *arraysPacked                           = FromGL<VertexArrayID *>(arrays);
857         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
858         bool isCallValid =
859             (context->skipValidation() || ValidateGenVertexArrays(context, n, arraysPacked));
860         if (isCallValid)
861         {
862             context->genVertexArrays(n, arraysPacked);
863         }
864         ANGLE_CAPTURE(GenVertexArrays, isCallValid, context, n, arraysPacked);
865     }
866 }
867 
GetActiveUniformBlockName(GLuint program,GLuint uniformBlockIndex,GLsizei bufSize,GLsizei * length,GLchar * uniformBlockName)868 void GL_APIENTRY GetActiveUniformBlockName(GLuint program,
869                                            GLuint uniformBlockIndex,
870                                            GLsizei bufSize,
871                                            GLsizei *length,
872                                            GLchar *uniformBlockName)
873 {
874     Context *context = GetValidGlobalContext();
875     EVENT("glGetActiveUniformBlockName",
876           "context = %d, GLuint program = %u, GLuint uniformBlockIndex = %u, GLsizei bufSize = %d, "
877           "GLsizei *length = 0x%016" PRIxPTR ", GLchar *uniformBlockName = 0x%016" PRIxPTR "",
878           CID(context), program, uniformBlockIndex, bufSize, (uintptr_t)length,
879           (uintptr_t)uniformBlockName);
880 
881     if (context)
882     {
883         ShaderProgramID programPacked                         = FromGL<ShaderProgramID>(program);
884         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
885         bool isCallValid =
886             (context->skipValidation() ||
887              ValidateGetActiveUniformBlockName(context, programPacked, uniformBlockIndex, bufSize,
888                                                length, uniformBlockName));
889         if (isCallValid)
890         {
891             context->getActiveUniformBlockName(programPacked, uniformBlockIndex, bufSize, length,
892                                                uniformBlockName);
893         }
894         ANGLE_CAPTURE(GetActiveUniformBlockName, isCallValid, context, programPacked,
895                       uniformBlockIndex, bufSize, length, uniformBlockName);
896     }
897 }
898 
GetActiveUniformBlockiv(GLuint program,GLuint uniformBlockIndex,GLenum pname,GLint * params)899 void GL_APIENTRY GetActiveUniformBlockiv(GLuint program,
900                                          GLuint uniformBlockIndex,
901                                          GLenum pname,
902                                          GLint *params)
903 {
904     Context *context = GetValidGlobalContext();
905     EVENT("glGetActiveUniformBlockiv",
906           "context = %d, GLuint program = %u, GLuint uniformBlockIndex = %u, GLenum pname = %s, "
907           "GLint *params = 0x%016" PRIxPTR "",
908           CID(context), program, uniformBlockIndex,
909           GLenumToString(GLenumGroup::UniformBlockPName, pname), (uintptr_t)params);
910 
911     if (context)
912     {
913         ShaderProgramID programPacked                         = FromGL<ShaderProgramID>(program);
914         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
915         bool isCallValid                                      = (context->skipValidation() ||
916                             ValidateGetActiveUniformBlockiv(context, programPacked,
917                                                             uniformBlockIndex, pname, params));
918         if (isCallValid)
919         {
920             context->getActiveUniformBlockiv(programPacked, uniformBlockIndex, pname, params);
921         }
922         ANGLE_CAPTURE(GetActiveUniformBlockiv, isCallValid, context, programPacked,
923                       uniformBlockIndex, pname, params);
924     }
925 }
926 
GetActiveUniformsiv(GLuint program,GLsizei uniformCount,const GLuint * uniformIndices,GLenum pname,GLint * params)927 void GL_APIENTRY GetActiveUniformsiv(GLuint program,
928                                      GLsizei uniformCount,
929                                      const GLuint *uniformIndices,
930                                      GLenum pname,
931                                      GLint *params)
932 {
933     Context *context = GetValidGlobalContext();
934     EVENT("glGetActiveUniformsiv",
935           "context = %d, GLuint program = %u, GLsizei uniformCount = %d, const GLuint "
936           "*uniformIndices = 0x%016" PRIxPTR ", GLenum pname = %s, GLint *params = 0x%016" PRIxPTR
937           "",
938           CID(context), program, uniformCount, (uintptr_t)uniformIndices,
939           GLenumToString(GLenumGroup::UniformPName, pname), (uintptr_t)params);
940 
941     if (context)
942     {
943         ShaderProgramID programPacked                         = FromGL<ShaderProgramID>(program);
944         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
945         bool isCallValid                                      = (context->skipValidation() ||
946                             ValidateGetActiveUniformsiv(context, programPacked, uniformCount,
947                                                         uniformIndices, pname, params));
948         if (isCallValid)
949         {
950             context->getActiveUniformsiv(programPacked, uniformCount, uniformIndices, pname,
951                                          params);
952         }
953         ANGLE_CAPTURE(GetActiveUniformsiv, isCallValid, context, programPacked, uniformCount,
954                       uniformIndices, pname, params);
955     }
956 }
957 
GetBufferParameteri64v(GLenum target,GLenum pname,GLint64 * params)958 void GL_APIENTRY GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
959 {
960     Context *context = GetValidGlobalContext();
961     EVENT("glGetBufferParameteri64v",
962           "context = %d, GLenum target = %s, GLenum pname = %s, GLint64 *params = 0x%016" PRIxPTR
963           "",
964           CID(context), GLenumToString(GLenumGroup::BufferTargetARB, target),
965           GLenumToString(GLenumGroup::DefaultGroup, pname), (uintptr_t)params);
966 
967     if (context)
968     {
969         BufferBinding targetPacked                            = FromGL<BufferBinding>(target);
970         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
971         bool isCallValid                                      = (context->skipValidation() ||
972                             ValidateGetBufferParameteri64v(context, targetPacked, pname, params));
973         if (isCallValid)
974         {
975             context->getBufferParameteri64v(targetPacked, pname, params);
976         }
977         ANGLE_CAPTURE(GetBufferParameteri64v, isCallValid, context, targetPacked, pname, params);
978     }
979 }
980 
GetBufferPointerv(GLenum target,GLenum pname,void ** params)981 void GL_APIENTRY GetBufferPointerv(GLenum target, GLenum pname, void **params)
982 {
983     Context *context = GetValidGlobalContext();
984     EVENT("glGetBufferPointerv",
985           "context = %d, GLenum target = %s, GLenum pname = %s, void **params = 0x%016" PRIxPTR "",
986           CID(context), GLenumToString(GLenumGroup::BufferTargetARB, target),
987           GLenumToString(GLenumGroup::DefaultGroup, pname), (uintptr_t)params);
988 
989     if (context)
990     {
991         BufferBinding targetPacked                            = FromGL<BufferBinding>(target);
992         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
993         bool isCallValid                                      = (context->skipValidation() ||
994                             ValidateGetBufferPointerv(context, targetPacked, pname, params));
995         if (isCallValid)
996         {
997             context->getBufferPointerv(targetPacked, pname, params);
998         }
999         ANGLE_CAPTURE(GetBufferPointerv, isCallValid, context, targetPacked, pname, params);
1000     }
1001 }
1002 
GetFragDataLocation(GLuint program,const GLchar * name)1003 GLint GL_APIENTRY GetFragDataLocation(GLuint program, const GLchar *name)
1004 {
1005     Context *context = GetValidGlobalContext();
1006     EVENT("glGetFragDataLocation",
1007           "context = %d, GLuint program = %u, const GLchar *name = 0x%016" PRIxPTR "", CID(context),
1008           program, (uintptr_t)name);
1009 
1010     GLint returnValue;
1011     if (context)
1012     {
1013         ShaderProgramID programPacked                         = FromGL<ShaderProgramID>(program);
1014         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1015         bool isCallValid                                      = (context->skipValidation() ||
1016                             ValidateGetFragDataLocation(context, programPacked, name));
1017         if (isCallValid)
1018         {
1019             returnValue = context->getFragDataLocation(programPacked, name);
1020         }
1021         else
1022         {
1023             returnValue = GetDefaultReturnValue<EntryPoint::GetFragDataLocation, GLint>();
1024         }
1025         ANGLE_CAPTURE(GetFragDataLocation, isCallValid, context, programPacked, name, returnValue);
1026     }
1027     else
1028     {
1029         returnValue = GetDefaultReturnValue<EntryPoint::GetFragDataLocation, GLint>();
1030     }
1031     return returnValue;
1032 }
1033 
GetInteger64i_v(GLenum target,GLuint index,GLint64 * data)1034 void GL_APIENTRY GetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
1035 {
1036     Context *context = GetValidGlobalContext();
1037     EVENT("glGetInteger64i_v",
1038           "context = %d, GLenum target = %s, GLuint index = %u, GLint64 *data = 0x%016" PRIxPTR "",
1039           CID(context), GLenumToString(GLenumGroup::TypeEnum, target), index, (uintptr_t)data);
1040 
1041     if (context)
1042     {
1043         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1044         bool isCallValid =
1045             (context->skipValidation() || ValidateGetInteger64i_v(context, target, index, data));
1046         if (isCallValid)
1047         {
1048             context->getInteger64i_v(target, index, data);
1049         }
1050         ANGLE_CAPTURE(GetInteger64i_v, isCallValid, context, target, index, data);
1051     }
1052 }
1053 
GetInteger64v(GLenum pname,GLint64 * data)1054 void GL_APIENTRY GetInteger64v(GLenum pname, GLint64 *data)
1055 {
1056     Context *context = GetValidGlobalContext();
1057     EVENT("glGetInteger64v", "context = %d, GLenum pname = %s, GLint64 *data = 0x%016" PRIxPTR "",
1058           CID(context), GLenumToString(GLenumGroup::GetPName, pname), (uintptr_t)data);
1059 
1060     if (context)
1061     {
1062         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1063         bool isCallValid =
1064             (context->skipValidation() || ValidateGetInteger64v(context, pname, data));
1065         if (isCallValid)
1066         {
1067             context->getInteger64v(pname, data);
1068         }
1069         ANGLE_CAPTURE(GetInteger64v, isCallValid, context, pname, data);
1070     }
1071 }
1072 
GetIntegeri_v(GLenum target,GLuint index,GLint * data)1073 void GL_APIENTRY GetIntegeri_v(GLenum target, GLuint index, GLint *data)
1074 {
1075     Context *context = GetValidGlobalContext();
1076     EVENT("glGetIntegeri_v",
1077           "context = %d, GLenum target = %s, GLuint index = %u, GLint *data = 0x%016" PRIxPTR "",
1078           CID(context), GLenumToString(GLenumGroup::TypeEnum, target), index, (uintptr_t)data);
1079 
1080     if (context)
1081     {
1082         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1083         bool isCallValid =
1084             (context->skipValidation() || ValidateGetIntegeri_v(context, target, index, data));
1085         if (isCallValid)
1086         {
1087             context->getIntegeri_v(target, index, data);
1088         }
1089         ANGLE_CAPTURE(GetIntegeri_v, isCallValid, context, target, index, data);
1090     }
1091 }
1092 
GetInternalformativ(GLenum target,GLenum internalformat,GLenum pname,GLsizei bufSize,GLint * params)1093 void GL_APIENTRY GetInternalformativ(GLenum target,
1094                                      GLenum internalformat,
1095                                      GLenum pname,
1096                                      GLsizei bufSize,
1097                                      GLint *params)
1098 {
1099     Context *context = GetValidGlobalContext();
1100     EVENT("glGetInternalformativ",
1101           "context = %d, GLenum target = %s, GLenum internalformat = %s, GLenum pname = %s, "
1102           "GLsizei bufSize = %d, GLint *params = 0x%016" PRIxPTR "",
1103           CID(context), GLenumToString(GLenumGroup::TextureTarget, target),
1104           GLenumToString(GLenumGroup::InternalFormat, internalformat),
1105           GLenumToString(GLenumGroup::InternalFormatPName, pname), bufSize, (uintptr_t)params);
1106 
1107     if (context)
1108     {
1109         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1110         bool isCallValid =
1111             (context->skipValidation() ||
1112              ValidateGetInternalformativ(context, target, internalformat, pname, bufSize, params));
1113         if (isCallValid)
1114         {
1115             context->getInternalformativ(target, internalformat, pname, bufSize, params);
1116         }
1117         ANGLE_CAPTURE(GetInternalformativ, isCallValid, context, target, internalformat, pname,
1118                       bufSize, params);
1119     }
1120 }
1121 
GetProgramBinary(GLuint program,GLsizei bufSize,GLsizei * length,GLenum * binaryFormat,void * binary)1122 void GL_APIENTRY GetProgramBinary(GLuint program,
1123                                   GLsizei bufSize,
1124                                   GLsizei *length,
1125                                   GLenum *binaryFormat,
1126                                   void *binary)
1127 {
1128     Context *context = GetValidGlobalContext();
1129     EVENT(
1130         "glGetProgramBinary",
1131         "context = %d, GLuint program = %u, GLsizei bufSize = %d, GLsizei *length = 0x%016" PRIxPTR
1132         ", GLenum *binaryFormat = 0x%016" PRIxPTR ", void *binary = 0x%016" PRIxPTR "",
1133         CID(context), program, bufSize, (uintptr_t)length, (uintptr_t)binaryFormat,
1134         (uintptr_t)binary);
1135 
1136     if (context)
1137     {
1138         ShaderProgramID programPacked                         = FromGL<ShaderProgramID>(program);
1139         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1140         bool isCallValid =
1141             (context->skipValidation() || ValidateGetProgramBinary(context, programPacked, bufSize,
1142                                                                    length, binaryFormat, binary));
1143         if (isCallValid)
1144         {
1145             context->getProgramBinary(programPacked, bufSize, length, binaryFormat, binary);
1146         }
1147         ANGLE_CAPTURE(GetProgramBinary, isCallValid, context, programPacked, bufSize, length,
1148                       binaryFormat, binary);
1149     }
1150 }
1151 
GetQueryObjectuiv(GLuint id,GLenum pname,GLuint * params)1152 void GL_APIENTRY GetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
1153 {
1154     Context *context = GetValidGlobalContext();
1155     EVENT("glGetQueryObjectuiv",
1156           "context = %d, GLuint id = %u, GLenum pname = %s, GLuint *params = 0x%016" PRIxPTR "",
1157           CID(context), id, GLenumToString(GLenumGroup::QueryObjectParameterName, pname),
1158           (uintptr_t)params);
1159 
1160     if (context)
1161     {
1162         QueryID idPacked                                      = FromGL<QueryID>(id);
1163         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1164         bool isCallValid                                      = (context->skipValidation() ||
1165                             ValidateGetQueryObjectuiv(context, idPacked, pname, params));
1166         if (isCallValid)
1167         {
1168             context->getQueryObjectuiv(idPacked, pname, params);
1169         }
1170         ANGLE_CAPTURE(GetQueryObjectuiv, isCallValid, context, idPacked, pname, params);
1171     }
1172 }
1173 
GetQueryiv(GLenum target,GLenum pname,GLint * params)1174 void GL_APIENTRY GetQueryiv(GLenum target, GLenum pname, GLint *params)
1175 {
1176     Context *context = GetValidGlobalContext();
1177     EVENT("glGetQueryiv",
1178           "context = %d, GLenum target = %s, GLenum pname = %s, GLint *params = 0x%016" PRIxPTR "",
1179           CID(context), GLenumToString(GLenumGroup::QueryTarget, target),
1180           GLenumToString(GLenumGroup::QueryParameterName, pname), (uintptr_t)params);
1181 
1182     if (context)
1183     {
1184         QueryType targetPacked                                = FromGL<QueryType>(target);
1185         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1186         bool isCallValid =
1187             (context->skipValidation() || ValidateGetQueryiv(context, targetPacked, pname, params));
1188         if (isCallValid)
1189         {
1190             context->getQueryiv(targetPacked, pname, params);
1191         }
1192         ANGLE_CAPTURE(GetQueryiv, isCallValid, context, targetPacked, pname, params);
1193     }
1194 }
1195 
GetSamplerParameterfv(GLuint sampler,GLenum pname,GLfloat * params)1196 void GL_APIENTRY GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
1197 {
1198     Context *context = GetValidGlobalContext();
1199     EVENT("glGetSamplerParameterfv",
1200           "context = %d, GLuint sampler = %u, GLenum pname = %s, GLfloat *params = 0x%016" PRIxPTR
1201           "",
1202           CID(context), sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname),
1203           (uintptr_t)params);
1204 
1205     if (context)
1206     {
1207         SamplerID samplerPacked                               = FromGL<SamplerID>(sampler);
1208         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1209         bool isCallValid                                      = (context->skipValidation() ||
1210                             ValidateGetSamplerParameterfv(context, samplerPacked, pname, params));
1211         if (isCallValid)
1212         {
1213             context->getSamplerParameterfv(samplerPacked, pname, params);
1214         }
1215         ANGLE_CAPTURE(GetSamplerParameterfv, isCallValid, context, samplerPacked, pname, params);
1216     }
1217 }
1218 
GetSamplerParameteriv(GLuint sampler,GLenum pname,GLint * params)1219 void GL_APIENTRY GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
1220 {
1221     Context *context = GetValidGlobalContext();
1222     EVENT("glGetSamplerParameteriv",
1223           "context = %d, GLuint sampler = %u, GLenum pname = %s, GLint *params = 0x%016" PRIxPTR "",
1224           CID(context), sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname),
1225           (uintptr_t)params);
1226 
1227     if (context)
1228     {
1229         SamplerID samplerPacked                               = FromGL<SamplerID>(sampler);
1230         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1231         bool isCallValid                                      = (context->skipValidation() ||
1232                             ValidateGetSamplerParameteriv(context, samplerPacked, pname, params));
1233         if (isCallValid)
1234         {
1235             context->getSamplerParameteriv(samplerPacked, pname, params);
1236         }
1237         ANGLE_CAPTURE(GetSamplerParameteriv, isCallValid, context, samplerPacked, pname, params);
1238     }
1239 }
1240 
GetStringi(GLenum name,GLuint index)1241 const GLubyte *GL_APIENTRY GetStringi(GLenum name, GLuint index)
1242 {
1243     Context *context = GetValidGlobalContext();
1244     EVENT("glGetStringi", "context = %d, GLenum name = %s, GLuint index = %u", CID(context),
1245           GLenumToString(GLenumGroup::StringName, name), index);
1246 
1247     const GLubyte *returnValue;
1248     if (context)
1249     {
1250         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1251         bool isCallValid = (context->skipValidation() || ValidateGetStringi(context, name, index));
1252         if (isCallValid)
1253         {
1254             returnValue = context->getStringi(name, index);
1255         }
1256         else
1257         {
1258             returnValue = GetDefaultReturnValue<EntryPoint::GetStringi, const GLubyte *>();
1259         }
1260         ANGLE_CAPTURE(GetStringi, isCallValid, context, name, index, returnValue);
1261     }
1262     else
1263     {
1264         returnValue = GetDefaultReturnValue<EntryPoint::GetStringi, const GLubyte *>();
1265     }
1266     return returnValue;
1267 }
1268 
1269 void GL_APIENTRY
GetSynciv(GLsync sync,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * values)1270 GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
1271 {
1272     Context *context = GetGlobalContext();
1273     EVENT("glGetSynciv",
1274           "context = %d, GLsync sync = 0x%016" PRIxPTR
1275           ", GLenum pname = %s, GLsizei bufSize = %d, GLsizei *length = 0x%016" PRIxPTR
1276           ", GLint *values = 0x%016" PRIxPTR "",
1277           CID(context), (uintptr_t)sync, GLenumToString(GLenumGroup::SyncParameterName, pname),
1278           bufSize, (uintptr_t)length, (uintptr_t)values);
1279 
1280     if (context)
1281     {
1282         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1283         bool isCallValid                                      = (context->skipValidation() ||
1284                             ValidateGetSynciv(context, sync, pname, bufSize, length, values));
1285         if (isCallValid)
1286         {
1287             context->getSynciv(sync, pname, bufSize, length, values);
1288         }
1289         ANGLE_CAPTURE(GetSynciv, isCallValid, context, sync, pname, bufSize, length, values);
1290     }
1291 }
1292 
GetTransformFeedbackVarying(GLuint program,GLuint index,GLsizei bufSize,GLsizei * length,GLsizei * size,GLenum * type,GLchar * name)1293 void GL_APIENTRY GetTransformFeedbackVarying(GLuint program,
1294                                              GLuint index,
1295                                              GLsizei bufSize,
1296                                              GLsizei *length,
1297                                              GLsizei *size,
1298                                              GLenum *type,
1299                                              GLchar *name)
1300 {
1301     Context *context = GetValidGlobalContext();
1302     EVENT("glGetTransformFeedbackVarying",
1303           "context = %d, GLuint program = %u, GLuint index = %u, GLsizei bufSize = %d, GLsizei "
1304           "*length = 0x%016" PRIxPTR ", GLsizei *size = 0x%016" PRIxPTR
1305           ", GLenum *type = 0x%016" PRIxPTR ", GLchar *name = 0x%016" PRIxPTR "",
1306           CID(context), program, index, bufSize, (uintptr_t)length, (uintptr_t)size,
1307           (uintptr_t)type, (uintptr_t)name);
1308 
1309     if (context)
1310     {
1311         ShaderProgramID programPacked                         = FromGL<ShaderProgramID>(program);
1312         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1313         bool isCallValid                                      = (context->skipValidation() ||
1314                             ValidateGetTransformFeedbackVarying(context, programPacked, index,
1315                                                                 bufSize, length, size, type, name));
1316         if (isCallValid)
1317         {
1318             context->getTransformFeedbackVarying(programPacked, index, bufSize, length, size, type,
1319                                                  name);
1320         }
1321         ANGLE_CAPTURE(GetTransformFeedbackVarying, isCallValid, context, programPacked, index,
1322                       bufSize, length, size, type, name);
1323     }
1324 }
1325 
GetUniformBlockIndex(GLuint program,const GLchar * uniformBlockName)1326 GLuint GL_APIENTRY GetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
1327 {
1328     Context *context = GetValidGlobalContext();
1329     EVENT("glGetUniformBlockIndex",
1330           "context = %d, GLuint program = %u, const GLchar *uniformBlockName = 0x%016" PRIxPTR "",
1331           CID(context), program, (uintptr_t)uniformBlockName);
1332 
1333     GLuint returnValue;
1334     if (context)
1335     {
1336         ShaderProgramID programPacked                         = FromGL<ShaderProgramID>(program);
1337         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1338         bool isCallValid                                      = (context->skipValidation() ||
1339                             ValidateGetUniformBlockIndex(context, programPacked, uniformBlockName));
1340         if (isCallValid)
1341         {
1342             returnValue = context->getUniformBlockIndex(programPacked, uniformBlockName);
1343         }
1344         else
1345         {
1346             returnValue = GetDefaultReturnValue<EntryPoint::GetUniformBlockIndex, GLuint>();
1347         }
1348         ANGLE_CAPTURE(GetUniformBlockIndex, isCallValid, context, programPacked, uniformBlockName,
1349                       returnValue);
1350     }
1351     else
1352     {
1353         returnValue = GetDefaultReturnValue<EntryPoint::GetUniformBlockIndex, GLuint>();
1354     }
1355     return returnValue;
1356 }
1357 
GetUniformIndices(GLuint program,GLsizei uniformCount,const GLchar * const * uniformNames,GLuint * uniformIndices)1358 void GL_APIENTRY GetUniformIndices(GLuint program,
1359                                    GLsizei uniformCount,
1360                                    const GLchar *const *uniformNames,
1361                                    GLuint *uniformIndices)
1362 {
1363     Context *context = GetValidGlobalContext();
1364     EVENT("glGetUniformIndices",
1365           "context = %d, GLuint program = %u, GLsizei uniformCount = %d, const GLchar "
1366           "*const*uniformNames = 0x%016" PRIxPTR ", GLuint *uniformIndices = 0x%016" PRIxPTR "",
1367           CID(context), program, uniformCount, (uintptr_t)uniformNames, (uintptr_t)uniformIndices);
1368 
1369     if (context)
1370     {
1371         ShaderProgramID programPacked                         = FromGL<ShaderProgramID>(program);
1372         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1373         bool isCallValid                                      = (context->skipValidation() ||
1374                             ValidateGetUniformIndices(context, programPacked, uniformCount,
1375                                                       uniformNames, uniformIndices));
1376         if (isCallValid)
1377         {
1378             context->getUniformIndices(programPacked, uniformCount, uniformNames, uniformIndices);
1379         }
1380         ANGLE_CAPTURE(GetUniformIndices, isCallValid, context, programPacked, uniformCount,
1381                       uniformNames, uniformIndices);
1382     }
1383 }
1384 
GetUniformuiv(GLuint program,GLint location,GLuint * params)1385 void GL_APIENTRY GetUniformuiv(GLuint program, GLint location, GLuint *params)
1386 {
1387     Context *context = GetValidGlobalContext();
1388     EVENT("glGetUniformuiv",
1389           "context = %d, GLuint program = %u, GLint location = %d, GLuint *params = 0x%016" PRIxPTR
1390           "",
1391           CID(context), program, location, (uintptr_t)params);
1392 
1393     if (context)
1394     {
1395         ShaderProgramID programPacked                         = FromGL<ShaderProgramID>(program);
1396         UniformLocation locationPacked                        = FromGL<UniformLocation>(location);
1397         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1398         bool isCallValid                                      = (context->skipValidation() ||
1399                             ValidateGetUniformuiv(context, programPacked, locationPacked, params));
1400         if (isCallValid)
1401         {
1402             context->getUniformuiv(programPacked, locationPacked, params);
1403         }
1404         ANGLE_CAPTURE(GetUniformuiv, isCallValid, context, programPacked, locationPacked, params);
1405     }
1406 }
1407 
GetVertexAttribIiv(GLuint index,GLenum pname,GLint * params)1408 void GL_APIENTRY GetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
1409 {
1410     Context *context = GetValidGlobalContext();
1411     EVENT("glGetVertexAttribIiv",
1412           "context = %d, GLuint index = %u, GLenum pname = %s, GLint *params = 0x%016" PRIxPTR "",
1413           CID(context), index, GLenumToString(GLenumGroup::VertexAttribEnum, pname),
1414           (uintptr_t)params);
1415 
1416     if (context)
1417     {
1418         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1419         bool isCallValid                                      = (context->skipValidation() ||
1420                             ValidateGetVertexAttribIiv(context, index, pname, params));
1421         if (isCallValid)
1422         {
1423             context->getVertexAttribIiv(index, pname, params);
1424         }
1425         ANGLE_CAPTURE(GetVertexAttribIiv, isCallValid, context, index, pname, params);
1426     }
1427 }
1428 
GetVertexAttribIuiv(GLuint index,GLenum pname,GLuint * params)1429 void GL_APIENTRY GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
1430 {
1431     Context *context = GetValidGlobalContext();
1432     EVENT("glGetVertexAttribIuiv",
1433           "context = %d, GLuint index = %u, GLenum pname = %s, GLuint *params = 0x%016" PRIxPTR "",
1434           CID(context), index, GLenumToString(GLenumGroup::VertexAttribEnum, pname),
1435           (uintptr_t)params);
1436 
1437     if (context)
1438     {
1439         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1440         bool isCallValid                                      = (context->skipValidation() ||
1441                             ValidateGetVertexAttribIuiv(context, index, pname, params));
1442         if (isCallValid)
1443         {
1444             context->getVertexAttribIuiv(index, pname, params);
1445         }
1446         ANGLE_CAPTURE(GetVertexAttribIuiv, isCallValid, context, index, pname, params);
1447     }
1448 }
1449 
InvalidateFramebuffer(GLenum target,GLsizei numAttachments,const GLenum * attachments)1450 void GL_APIENTRY InvalidateFramebuffer(GLenum target,
1451                                        GLsizei numAttachments,
1452                                        const GLenum *attachments)
1453 {
1454     Context *context = GetValidGlobalContext();
1455     EVENT("glInvalidateFramebuffer",
1456           "context = %d, GLenum target = %s, GLsizei numAttachments = %d, const GLenum "
1457           "*attachments = 0x%016" PRIxPTR "",
1458           CID(context), GLenumToString(GLenumGroup::FramebufferTarget, target), numAttachments,
1459           (uintptr_t)attachments);
1460 
1461     if (context)
1462     {
1463         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1464         bool isCallValid =
1465             (context->skipValidation() ||
1466              ValidateInvalidateFramebuffer(context, target, numAttachments, attachments));
1467         if (isCallValid)
1468         {
1469             context->invalidateFramebuffer(target, numAttachments, attachments);
1470         }
1471         ANGLE_CAPTURE(InvalidateFramebuffer, isCallValid, context, target, numAttachments,
1472                       attachments);
1473     }
1474 }
1475 
InvalidateSubFramebuffer(GLenum target,GLsizei numAttachments,const GLenum * attachments,GLint x,GLint y,GLsizei width,GLsizei height)1476 void GL_APIENTRY InvalidateSubFramebuffer(GLenum target,
1477                                           GLsizei numAttachments,
1478                                           const GLenum *attachments,
1479                                           GLint x,
1480                                           GLint y,
1481                                           GLsizei width,
1482                                           GLsizei height)
1483 {
1484     Context *context = GetValidGlobalContext();
1485     EVENT("glInvalidateSubFramebuffer",
1486           "context = %d, GLenum target = %s, GLsizei numAttachments = %d, const GLenum "
1487           "*attachments = 0x%016" PRIxPTR
1488           ", GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d",
1489           CID(context), GLenumToString(GLenumGroup::DefaultGroup, target), numAttachments,
1490           (uintptr_t)attachments, x, y, width, height);
1491 
1492     if (context)
1493     {
1494         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1495         bool isCallValid                                      = (context->skipValidation() ||
1496                             ValidateInvalidateSubFramebuffer(context, target, numAttachments,
1497                                                              attachments, x, y, width, height));
1498         if (isCallValid)
1499         {
1500             context->invalidateSubFramebuffer(target, numAttachments, attachments, x, y, width,
1501                                               height);
1502         }
1503         ANGLE_CAPTURE(InvalidateSubFramebuffer, isCallValid, context, target, numAttachments,
1504                       attachments, x, y, width, height);
1505     }
1506 }
1507 
IsQuery(GLuint id)1508 GLboolean GL_APIENTRY IsQuery(GLuint id)
1509 {
1510     Context *context = GetValidGlobalContext();
1511     EVENT("glIsQuery", "context = %d, GLuint id = %u", CID(context), id);
1512 
1513     GLboolean returnValue;
1514     if (context)
1515     {
1516         QueryID idPacked                                      = FromGL<QueryID>(id);
1517         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1518         bool isCallValid = (context->skipValidation() || ValidateIsQuery(context, idPacked));
1519         if (isCallValid)
1520         {
1521             returnValue = context->isQuery(idPacked);
1522         }
1523         else
1524         {
1525             returnValue = GetDefaultReturnValue<EntryPoint::IsQuery, GLboolean>();
1526         }
1527         ANGLE_CAPTURE(IsQuery, isCallValid, context, idPacked, returnValue);
1528     }
1529     else
1530     {
1531         returnValue = GetDefaultReturnValue<EntryPoint::IsQuery, GLboolean>();
1532     }
1533     return returnValue;
1534 }
1535 
IsSampler(GLuint sampler)1536 GLboolean GL_APIENTRY IsSampler(GLuint sampler)
1537 {
1538     Context *context = GetValidGlobalContext();
1539     EVENT("glIsSampler", "context = %d, GLuint sampler = %u", CID(context), sampler);
1540 
1541     GLboolean returnValue;
1542     if (context)
1543     {
1544         SamplerID samplerPacked                               = FromGL<SamplerID>(sampler);
1545         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1546         bool isCallValid = (context->skipValidation() || ValidateIsSampler(context, samplerPacked));
1547         if (isCallValid)
1548         {
1549             returnValue = context->isSampler(samplerPacked);
1550         }
1551         else
1552         {
1553             returnValue = GetDefaultReturnValue<EntryPoint::IsSampler, GLboolean>();
1554         }
1555         ANGLE_CAPTURE(IsSampler, isCallValid, context, samplerPacked, returnValue);
1556     }
1557     else
1558     {
1559         returnValue = GetDefaultReturnValue<EntryPoint::IsSampler, GLboolean>();
1560     }
1561     return returnValue;
1562 }
1563 
IsSync(GLsync sync)1564 GLboolean GL_APIENTRY IsSync(GLsync sync)
1565 {
1566     Context *context = GetValidGlobalContext();
1567     EVENT("glIsSync", "context = %d, GLsync sync = 0x%016" PRIxPTR "", CID(context),
1568           (uintptr_t)sync);
1569 
1570     GLboolean returnValue;
1571     if (context)
1572     {
1573         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1574         bool isCallValid = (context->skipValidation() || ValidateIsSync(context, sync));
1575         if (isCallValid)
1576         {
1577             returnValue = context->isSync(sync);
1578         }
1579         else
1580         {
1581             returnValue = GetDefaultReturnValue<EntryPoint::IsSync, GLboolean>();
1582         }
1583         ANGLE_CAPTURE(IsSync, isCallValid, context, sync, returnValue);
1584     }
1585     else
1586     {
1587         returnValue = GetDefaultReturnValue<EntryPoint::IsSync, GLboolean>();
1588     }
1589     return returnValue;
1590 }
1591 
IsTransformFeedback(GLuint id)1592 GLboolean GL_APIENTRY IsTransformFeedback(GLuint id)
1593 {
1594     Context *context = GetValidGlobalContext();
1595     EVENT("glIsTransformFeedback", "context = %d, GLuint id = %u", CID(context), id);
1596 
1597     GLboolean returnValue;
1598     if (context)
1599     {
1600         TransformFeedbackID idPacked                          = FromGL<TransformFeedbackID>(id);
1601         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1602         bool isCallValid =
1603             (context->skipValidation() || ValidateIsTransformFeedback(context, idPacked));
1604         if (isCallValid)
1605         {
1606             returnValue = context->isTransformFeedback(idPacked);
1607         }
1608         else
1609         {
1610             returnValue = GetDefaultReturnValue<EntryPoint::IsTransformFeedback, GLboolean>();
1611         }
1612         ANGLE_CAPTURE(IsTransformFeedback, isCallValid, context, idPacked, returnValue);
1613     }
1614     else
1615     {
1616         returnValue = GetDefaultReturnValue<EntryPoint::IsTransformFeedback, GLboolean>();
1617     }
1618     return returnValue;
1619 }
1620 
IsVertexArray(GLuint array)1621 GLboolean GL_APIENTRY IsVertexArray(GLuint array)
1622 {
1623     Context *context = GetValidGlobalContext();
1624     EVENT("glIsVertexArray", "context = %d, GLuint array = %u", CID(context), array);
1625 
1626     GLboolean returnValue;
1627     if (context)
1628     {
1629         VertexArrayID arrayPacked                             = FromGL<VertexArrayID>(array);
1630         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1631         bool isCallValid =
1632             (context->skipValidation() || ValidateIsVertexArray(context, arrayPacked));
1633         if (isCallValid)
1634         {
1635             returnValue = context->isVertexArray(arrayPacked);
1636         }
1637         else
1638         {
1639             returnValue = GetDefaultReturnValue<EntryPoint::IsVertexArray, GLboolean>();
1640         }
1641         ANGLE_CAPTURE(IsVertexArray, isCallValid, context, arrayPacked, returnValue);
1642     }
1643     else
1644     {
1645         returnValue = GetDefaultReturnValue<EntryPoint::IsVertexArray, GLboolean>();
1646     }
1647     return returnValue;
1648 }
1649 
MapBufferRange(GLenum target,GLintptr offset,GLsizeiptr length,GLbitfield access)1650 void *GL_APIENTRY MapBufferRange(GLenum target,
1651                                  GLintptr offset,
1652                                  GLsizeiptr length,
1653                                  GLbitfield access)
1654 {
1655     Context *context = GetValidGlobalContext();
1656     EVENT("glMapBufferRange",
1657           "context = %d, GLenum target = %s, GLintptr offset = %llu, GLsizeiptr length = %llu, "
1658           "GLbitfield access = %s",
1659           CID(context), GLenumToString(GLenumGroup::BufferTargetARB, target),
1660           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length),
1661           GLbitfieldToString(GLenumGroup::BufferAccessMask, access).c_str());
1662 
1663     void *returnValue;
1664     if (context)
1665     {
1666         BufferBinding targetPacked                            = FromGL<BufferBinding>(target);
1667         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1668         bool isCallValid                                      = (context->skipValidation() ||
1669                             ValidateMapBufferRange(context, targetPacked, offset, length, access));
1670         if (isCallValid)
1671         {
1672             returnValue = context->mapBufferRange(targetPacked, offset, length, access);
1673         }
1674         else
1675         {
1676             returnValue = GetDefaultReturnValue<EntryPoint::MapBufferRange, void *>();
1677         }
1678         ANGLE_CAPTURE(MapBufferRange, isCallValid, context, targetPacked, offset, length, access,
1679                       returnValue);
1680     }
1681     else
1682     {
1683         returnValue = GetDefaultReturnValue<EntryPoint::MapBufferRange, void *>();
1684     }
1685     return returnValue;
1686 }
1687 
PauseTransformFeedback()1688 void GL_APIENTRY PauseTransformFeedback()
1689 {
1690     Context *context = GetValidGlobalContext();
1691     EVENT("glPauseTransformFeedback", "context = %d", CID(context));
1692 
1693     if (context)
1694     {
1695         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1696         bool isCallValid = (context->skipValidation() || ValidatePauseTransformFeedback(context));
1697         if (isCallValid)
1698         {
1699             context->pauseTransformFeedback();
1700         }
1701         ANGLE_CAPTURE(PauseTransformFeedback, isCallValid, context);
1702     }
1703 }
1704 
ProgramBinary(GLuint program,GLenum binaryFormat,const void * binary,GLsizei length)1705 void GL_APIENTRY ProgramBinary(GLuint program,
1706                                GLenum binaryFormat,
1707                                const void *binary,
1708                                GLsizei length)
1709 {
1710     Context *context = GetValidGlobalContext();
1711     EVENT("glProgramBinary",
1712           "context = %d, GLuint program = %u, GLenum binaryFormat = %s, const void *binary = "
1713           "0x%016" PRIxPTR ", GLsizei length = %d",
1714           CID(context), program, GLenumToString(GLenumGroup::DefaultGroup, binaryFormat),
1715           (uintptr_t)binary, length);
1716 
1717     if (context)
1718     {
1719         ShaderProgramID programPacked                         = FromGL<ShaderProgramID>(program);
1720         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1721         bool isCallValid =
1722             (context->skipValidation() ||
1723              ValidateProgramBinary(context, programPacked, binaryFormat, binary, length));
1724         if (isCallValid)
1725         {
1726             context->programBinary(programPacked, binaryFormat, binary, length);
1727         }
1728         ANGLE_CAPTURE(ProgramBinary, isCallValid, context, programPacked, binaryFormat, binary,
1729                       length);
1730     }
1731 }
1732 
ProgramParameteri(GLuint program,GLenum pname,GLint value)1733 void GL_APIENTRY ProgramParameteri(GLuint program, GLenum pname, GLint value)
1734 {
1735     Context *context = GetValidGlobalContext();
1736     EVENT("glProgramParameteri",
1737           "context = %d, GLuint program = %u, GLenum pname = %s, GLint value = %d", CID(context),
1738           program, GLenumToString(GLenumGroup::ProgramParameterPName, pname), value);
1739 
1740     if (context)
1741     {
1742         ShaderProgramID programPacked                         = FromGL<ShaderProgramID>(program);
1743         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1744         bool isCallValid                                      = (context->skipValidation() ||
1745                             ValidateProgramParameteri(context, programPacked, pname, value));
1746         if (isCallValid)
1747         {
1748             context->programParameteri(programPacked, pname, value);
1749         }
1750         ANGLE_CAPTURE(ProgramParameteri, isCallValid, context, programPacked, pname, value);
1751     }
1752 }
1753 
ReadBuffer(GLenum src)1754 void GL_APIENTRY ReadBuffer(GLenum src)
1755 {
1756     Context *context = GetValidGlobalContext();
1757     EVENT("glReadBuffer", "context = %d, GLenum src = %s", CID(context),
1758           GLenumToString(GLenumGroup::ReadBufferMode, src));
1759 
1760     if (context)
1761     {
1762         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1763         bool isCallValid = (context->skipValidation() || ValidateReadBuffer(context, src));
1764         if (isCallValid)
1765         {
1766             context->readBuffer(src);
1767         }
1768         ANGLE_CAPTURE(ReadBuffer, isCallValid, context, src);
1769     }
1770 }
1771 
RenderbufferStorageMultisample(GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height)1772 void GL_APIENTRY RenderbufferStorageMultisample(GLenum target,
1773                                                 GLsizei samples,
1774                                                 GLenum internalformat,
1775                                                 GLsizei width,
1776                                                 GLsizei height)
1777 {
1778     Context *context = GetValidGlobalContext();
1779     EVENT("glRenderbufferStorageMultisample",
1780           "context = %d, GLenum target = %s, GLsizei samples = %d, GLenum internalformat = %s, "
1781           "GLsizei width = %d, GLsizei height = %d",
1782           CID(context), GLenumToString(GLenumGroup::RenderbufferTarget, target), samples,
1783           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height);
1784 
1785     if (context)
1786     {
1787         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1788         bool isCallValid                                      = (context->skipValidation() ||
1789                             ValidateRenderbufferStorageMultisample(context, target, samples,
1790                                                                    internalformat, width, height));
1791         if (isCallValid)
1792         {
1793             context->renderbufferStorageMultisample(target, samples, internalformat, width, height);
1794         }
1795         ANGLE_CAPTURE(RenderbufferStorageMultisample, isCallValid, context, target, samples,
1796                       internalformat, width, height);
1797     }
1798 }
1799 
ResumeTransformFeedback()1800 void GL_APIENTRY ResumeTransformFeedback()
1801 {
1802     Context *context = GetValidGlobalContext();
1803     EVENT("glResumeTransformFeedback", "context = %d", CID(context));
1804 
1805     if (context)
1806     {
1807         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1808         bool isCallValid = (context->skipValidation() || ValidateResumeTransformFeedback(context));
1809         if (isCallValid)
1810         {
1811             context->resumeTransformFeedback();
1812         }
1813         ANGLE_CAPTURE(ResumeTransformFeedback, isCallValid, context);
1814     }
1815 }
1816 
SamplerParameterf(GLuint sampler,GLenum pname,GLfloat param)1817 void GL_APIENTRY SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
1818 {
1819     Context *context = GetValidGlobalContext();
1820     EVENT("glSamplerParameterf",
1821           "context = %d, GLuint sampler = %u, GLenum pname = %s, GLfloat param = %f", CID(context),
1822           sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname), param);
1823 
1824     if (context)
1825     {
1826         SamplerID samplerPacked                               = FromGL<SamplerID>(sampler);
1827         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1828         bool isCallValid                                      = (context->skipValidation() ||
1829                             ValidateSamplerParameterf(context, samplerPacked, pname, param));
1830         if (isCallValid)
1831         {
1832             context->samplerParameterf(samplerPacked, pname, param);
1833         }
1834         ANGLE_CAPTURE(SamplerParameterf, isCallValid, context, samplerPacked, pname, param);
1835     }
1836 }
1837 
SamplerParameterfv(GLuint sampler,GLenum pname,const GLfloat * param)1838 void GL_APIENTRY SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
1839 {
1840     Context *context = GetValidGlobalContext();
1841     EVENT("glSamplerParameterfv",
1842           "context = %d, GLuint sampler = %u, GLenum pname = %s, const GLfloat *param = "
1843           "0x%016" PRIxPTR "",
1844           CID(context), sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname),
1845           (uintptr_t)param);
1846 
1847     if (context)
1848     {
1849         SamplerID samplerPacked                               = FromGL<SamplerID>(sampler);
1850         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1851         bool isCallValid                                      = (context->skipValidation() ||
1852                             ValidateSamplerParameterfv(context, samplerPacked, pname, param));
1853         if (isCallValid)
1854         {
1855             context->samplerParameterfv(samplerPacked, pname, param);
1856         }
1857         ANGLE_CAPTURE(SamplerParameterfv, isCallValid, context, samplerPacked, pname, param);
1858     }
1859 }
1860 
SamplerParameteri(GLuint sampler,GLenum pname,GLint param)1861 void GL_APIENTRY SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
1862 {
1863     Context *context = GetValidGlobalContext();
1864     EVENT("glSamplerParameteri",
1865           "context = %d, GLuint sampler = %u, GLenum pname = %s, GLint param = %d", CID(context),
1866           sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname), param);
1867 
1868     if (context)
1869     {
1870         SamplerID samplerPacked                               = FromGL<SamplerID>(sampler);
1871         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1872         bool isCallValid                                      = (context->skipValidation() ||
1873                             ValidateSamplerParameteri(context, samplerPacked, pname, param));
1874         if (isCallValid)
1875         {
1876             context->samplerParameteri(samplerPacked, pname, param);
1877         }
1878         ANGLE_CAPTURE(SamplerParameteri, isCallValid, context, samplerPacked, pname, param);
1879     }
1880 }
1881 
SamplerParameteriv(GLuint sampler,GLenum pname,const GLint * param)1882 void GL_APIENTRY SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
1883 {
1884     Context *context = GetValidGlobalContext();
1885     EVENT(
1886         "glSamplerParameteriv",
1887         "context = %d, GLuint sampler = %u, GLenum pname = %s, const GLint *param = 0x%016" PRIxPTR
1888         "",
1889         CID(context), sampler, GLenumToString(GLenumGroup::SamplerParameterName, pname),
1890         (uintptr_t)param);
1891 
1892     if (context)
1893     {
1894         SamplerID samplerPacked                               = FromGL<SamplerID>(sampler);
1895         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1896         bool isCallValid                                      = (context->skipValidation() ||
1897                             ValidateSamplerParameteriv(context, samplerPacked, pname, param));
1898         if (isCallValid)
1899         {
1900             context->samplerParameteriv(samplerPacked, pname, param);
1901         }
1902         ANGLE_CAPTURE(SamplerParameteriv, isCallValid, context, samplerPacked, pname, param);
1903     }
1904 }
1905 
TexImage3D(GLenum target,GLint level,GLint internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLenum format,GLenum type,const void * pixels)1906 void GL_APIENTRY TexImage3D(GLenum target,
1907                             GLint level,
1908                             GLint internalformat,
1909                             GLsizei width,
1910                             GLsizei height,
1911                             GLsizei depth,
1912                             GLint border,
1913                             GLenum format,
1914                             GLenum type,
1915                             const void *pixels)
1916 {
1917     Context *context = GetValidGlobalContext();
1918     EVENT("glTexImage3D",
1919           "context = %d, GLenum target = %s, GLint level = %d, GLint internalformat = %d, GLsizei "
1920           "width = %d, GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLenum format = "
1921           "%s, GLenum type = %s, const void *pixels = 0x%016" PRIxPTR "",
1922           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, internalformat,
1923           width, height, depth, border, GLenumToString(GLenumGroup::PixelFormat, format),
1924           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
1925 
1926     if (context)
1927     {
1928         TextureTarget targetPacked                            = FromGL<TextureTarget>(target);
1929         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1930         bool isCallValid                                      = (context->skipValidation() ||
1931                             ValidateTexImage3D(context, targetPacked, level, internalformat, width,
1932                                                height, depth, border, format, type, pixels));
1933         if (isCallValid)
1934         {
1935             context->texImage3D(targetPacked, level, internalformat, width, height, depth, border,
1936                                 format, type, pixels);
1937         }
1938         ANGLE_CAPTURE(TexImage3D, isCallValid, context, targetPacked, level, internalformat, width,
1939                       height, depth, border, format, type, pixels);
1940     }
1941 }
1942 
1943 void GL_APIENTRY
TexStorage2D(GLenum target,GLsizei levels,GLenum internalformat,GLsizei width,GLsizei height)1944 TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
1945 {
1946     Context *context = GetValidGlobalContext();
1947     EVENT("glTexStorage2D",
1948           "context = %d, GLenum target = %s, GLsizei levels = %d, GLenum internalformat = %s, "
1949           "GLsizei width = %d, GLsizei height = %d",
1950           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), levels,
1951           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height);
1952 
1953     if (context)
1954     {
1955         TextureType targetPacked                              = FromGL<TextureType>(target);
1956         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1957         bool isCallValid =
1958             (context->skipValidation() ||
1959              ValidateTexStorage2D(context, targetPacked, levels, internalformat, width, height));
1960         if (isCallValid)
1961         {
1962             context->texStorage2D(targetPacked, levels, internalformat, width, height);
1963         }
1964         ANGLE_CAPTURE(TexStorage2D, isCallValid, context, targetPacked, levels, internalformat,
1965                       width, height);
1966     }
1967 }
1968 
TexStorage3D(GLenum target,GLsizei levels,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth)1969 void GL_APIENTRY TexStorage3D(GLenum target,
1970                               GLsizei levels,
1971                               GLenum internalformat,
1972                               GLsizei width,
1973                               GLsizei height,
1974                               GLsizei depth)
1975 {
1976     Context *context = GetValidGlobalContext();
1977     EVENT("glTexStorage3D",
1978           "context = %d, GLenum target = %s, GLsizei levels = %d, GLenum internalformat = %s, "
1979           "GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d",
1980           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), levels,
1981           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height, depth);
1982 
1983     if (context)
1984     {
1985         TextureType targetPacked                              = FromGL<TextureType>(target);
1986         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1987         bool isCallValid                                      = (context->skipValidation() ||
1988                             ValidateTexStorage3D(context, targetPacked, levels, internalformat,
1989                                                  width, height, depth));
1990         if (isCallValid)
1991         {
1992             context->texStorage3D(targetPacked, levels, internalformat, width, height, depth);
1993         }
1994         ANGLE_CAPTURE(TexStorage3D, isCallValid, context, targetPacked, levels, internalformat,
1995                       width, height, depth);
1996     }
1997 }
1998 
TexSubImage3D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLenum type,const void * pixels)1999 void GL_APIENTRY TexSubImage3D(GLenum target,
2000                                GLint level,
2001                                GLint xoffset,
2002                                GLint yoffset,
2003                                GLint zoffset,
2004                                GLsizei width,
2005                                GLsizei height,
2006                                GLsizei depth,
2007                                GLenum format,
2008                                GLenum type,
2009                                const void *pixels)
2010 {
2011     Context *context = GetValidGlobalContext();
2012     EVENT("glTexSubImage3D",
2013           "context = %d, GLenum target = %s, GLint level = %d, GLint xoffset = %d, GLint yoffset = "
2014           "%d, GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, "
2015           "GLenum format = %s, GLenum type = %s, const void *pixels = 0x%016" PRIxPTR "",
2016           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, xoffset, yoffset,
2017           zoffset, width, height, depth, GLenumToString(GLenumGroup::PixelFormat, format),
2018           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
2019 
2020     if (context)
2021     {
2022         TextureTarget targetPacked                            = FromGL<TextureTarget>(target);
2023         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2024         bool isCallValid =
2025             (context->skipValidation() ||
2026              ValidateTexSubImage3D(context, targetPacked, level, xoffset, yoffset, zoffset, width,
2027                                    height, depth, format, type, pixels));
2028         if (isCallValid)
2029         {
2030             context->texSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, width, height,
2031                                    depth, format, type, pixels);
2032         }
2033         ANGLE_CAPTURE(TexSubImage3D, isCallValid, context, targetPacked, level, xoffset, yoffset,
2034                       zoffset, width, height, depth, format, type, pixels);
2035     }
2036 }
2037 
TransformFeedbackVaryings(GLuint program,GLsizei count,const GLchar * const * varyings,GLenum bufferMode)2038 void GL_APIENTRY TransformFeedbackVaryings(GLuint program,
2039                                            GLsizei count,
2040                                            const GLchar *const *varyings,
2041                                            GLenum bufferMode)
2042 {
2043     Context *context = GetValidGlobalContext();
2044     EVENT("glTransformFeedbackVaryings",
2045           "context = %d, GLuint program = %u, GLsizei count = %d, const GLchar *const*varyings = "
2046           "0x%016" PRIxPTR ", GLenum bufferMode = %s",
2047           CID(context), program, count, (uintptr_t)varyings,
2048           GLenumToString(GLenumGroup::DefaultGroup, bufferMode));
2049 
2050     if (context)
2051     {
2052         ShaderProgramID programPacked                         = FromGL<ShaderProgramID>(program);
2053         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2054         bool isCallValid =
2055             (context->skipValidation() || ValidateTransformFeedbackVaryings(
2056                                               context, programPacked, count, varyings, bufferMode));
2057         if (isCallValid)
2058         {
2059             context->transformFeedbackVaryings(programPacked, count, varyings, bufferMode);
2060         }
2061         ANGLE_CAPTURE(TransformFeedbackVaryings, isCallValid, context, programPacked, count,
2062                       varyings, bufferMode);
2063     }
2064 }
2065 
Uniform1ui(GLint location,GLuint v0)2066 void GL_APIENTRY Uniform1ui(GLint location, GLuint v0)
2067 {
2068     Context *context = GetValidGlobalContext();
2069     EVENT("glUniform1ui", "context = %d, GLint location = %d, GLuint v0 = %u", CID(context),
2070           location, v0);
2071 
2072     if (context)
2073     {
2074         UniformLocation locationPacked                        = FromGL<UniformLocation>(location);
2075         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2076         bool isCallValid =
2077             (context->skipValidation() || ValidateUniform1ui(context, locationPacked, v0));
2078         if (isCallValid)
2079         {
2080             context->uniform1ui(locationPacked, v0);
2081         }
2082         ANGLE_CAPTURE(Uniform1ui, isCallValid, context, locationPacked, v0);
2083     }
2084 }
2085 
Uniform1uiv(GLint location,GLsizei count,const GLuint * value)2086 void GL_APIENTRY Uniform1uiv(GLint location, GLsizei count, const GLuint *value)
2087 {
2088     Context *context = GetValidGlobalContext();
2089     EVENT("glUniform1uiv",
2090           "context = %d, GLint location = %d, GLsizei count = %d, const GLuint *value = "
2091           "0x%016" PRIxPTR "",
2092           CID(context), location, count, (uintptr_t)value);
2093 
2094     if (context)
2095     {
2096         UniformLocation locationPacked                        = FromGL<UniformLocation>(location);
2097         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2098         bool isCallValid                                      = (context->skipValidation() ||
2099                             ValidateUniform1uiv(context, locationPacked, count, value));
2100         if (isCallValid)
2101         {
2102             context->uniform1uiv(locationPacked, count, value);
2103         }
2104         ANGLE_CAPTURE(Uniform1uiv, isCallValid, context, locationPacked, count, value);
2105     }
2106 }
2107 
Uniform2ui(GLint location,GLuint v0,GLuint v1)2108 void GL_APIENTRY Uniform2ui(GLint location, GLuint v0, GLuint v1)
2109 {
2110     Context *context = GetValidGlobalContext();
2111     EVENT("glUniform2ui", "context = %d, GLint location = %d, GLuint v0 = %u, GLuint v1 = %u",
2112           CID(context), location, v0, v1);
2113 
2114     if (context)
2115     {
2116         UniformLocation locationPacked                        = FromGL<UniformLocation>(location);
2117         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2118         bool isCallValid =
2119             (context->skipValidation() || ValidateUniform2ui(context, locationPacked, v0, v1));
2120         if (isCallValid)
2121         {
2122             context->uniform2ui(locationPacked, v0, v1);
2123         }
2124         ANGLE_CAPTURE(Uniform2ui, isCallValid, context, locationPacked, v0, v1);
2125     }
2126 }
2127 
Uniform2uiv(GLint location,GLsizei count,const GLuint * value)2128 void GL_APIENTRY Uniform2uiv(GLint location, GLsizei count, const GLuint *value)
2129 {
2130     Context *context = GetValidGlobalContext();
2131     EVENT("glUniform2uiv",
2132           "context = %d, GLint location = %d, GLsizei count = %d, const GLuint *value = "
2133           "0x%016" PRIxPTR "",
2134           CID(context), location, count, (uintptr_t)value);
2135 
2136     if (context)
2137     {
2138         UniformLocation locationPacked                        = FromGL<UniformLocation>(location);
2139         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2140         bool isCallValid                                      = (context->skipValidation() ||
2141                             ValidateUniform2uiv(context, locationPacked, count, value));
2142         if (isCallValid)
2143         {
2144             context->uniform2uiv(locationPacked, count, value);
2145         }
2146         ANGLE_CAPTURE(Uniform2uiv, isCallValid, context, locationPacked, count, value);
2147     }
2148 }
2149 
Uniform3ui(GLint location,GLuint v0,GLuint v1,GLuint v2)2150 void GL_APIENTRY Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
2151 {
2152     Context *context = GetValidGlobalContext();
2153     EVENT("glUniform3ui",
2154           "context = %d, GLint location = %d, GLuint v0 = %u, GLuint v1 = %u, GLuint v2 = %u",
2155           CID(context), location, v0, v1, v2);
2156 
2157     if (context)
2158     {
2159         UniformLocation locationPacked                        = FromGL<UniformLocation>(location);
2160         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2161         bool isCallValid =
2162             (context->skipValidation() || ValidateUniform3ui(context, locationPacked, v0, v1, v2));
2163         if (isCallValid)
2164         {
2165             context->uniform3ui(locationPacked, v0, v1, v2);
2166         }
2167         ANGLE_CAPTURE(Uniform3ui, isCallValid, context, locationPacked, v0, v1, v2);
2168     }
2169 }
2170 
Uniform3uiv(GLint location,GLsizei count,const GLuint * value)2171 void GL_APIENTRY Uniform3uiv(GLint location, GLsizei count, const GLuint *value)
2172 {
2173     Context *context = GetValidGlobalContext();
2174     EVENT("glUniform3uiv",
2175           "context = %d, GLint location = %d, GLsizei count = %d, const GLuint *value = "
2176           "0x%016" PRIxPTR "",
2177           CID(context), location, count, (uintptr_t)value);
2178 
2179     if (context)
2180     {
2181         UniformLocation locationPacked                        = FromGL<UniformLocation>(location);
2182         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2183         bool isCallValid                                      = (context->skipValidation() ||
2184                             ValidateUniform3uiv(context, locationPacked, count, value));
2185         if (isCallValid)
2186         {
2187             context->uniform3uiv(locationPacked, count, value);
2188         }
2189         ANGLE_CAPTURE(Uniform3uiv, isCallValid, context, locationPacked, count, value);
2190     }
2191 }
2192 
Uniform4ui(GLint location,GLuint v0,GLuint v1,GLuint v2,GLuint v3)2193 void GL_APIENTRY Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
2194 {
2195     Context *context = GetValidGlobalContext();
2196     EVENT("glUniform4ui",
2197           "context = %d, GLint location = %d, GLuint v0 = %u, GLuint v1 = %u, GLuint v2 = %u, "
2198           "GLuint v3 = %u",
2199           CID(context), location, v0, v1, v2, v3);
2200 
2201     if (context)
2202     {
2203         UniformLocation locationPacked                        = FromGL<UniformLocation>(location);
2204         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2205         bool isCallValid                                      = (context->skipValidation() ||
2206                             ValidateUniform4ui(context, locationPacked, v0, v1, v2, v3));
2207         if (isCallValid)
2208         {
2209             context->uniform4ui(locationPacked, v0, v1, v2, v3);
2210         }
2211         ANGLE_CAPTURE(Uniform4ui, isCallValid, context, locationPacked, v0, v1, v2, v3);
2212     }
2213 }
2214 
Uniform4uiv(GLint location,GLsizei count,const GLuint * value)2215 void GL_APIENTRY Uniform4uiv(GLint location, GLsizei count, const GLuint *value)
2216 {
2217     Context *context = GetValidGlobalContext();
2218     EVENT("glUniform4uiv",
2219           "context = %d, GLint location = %d, GLsizei count = %d, const GLuint *value = "
2220           "0x%016" PRIxPTR "",
2221           CID(context), location, count, (uintptr_t)value);
2222 
2223     if (context)
2224     {
2225         UniformLocation locationPacked                        = FromGL<UniformLocation>(location);
2226         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2227         bool isCallValid                                      = (context->skipValidation() ||
2228                             ValidateUniform4uiv(context, locationPacked, count, value));
2229         if (isCallValid)
2230         {
2231             context->uniform4uiv(locationPacked, count, value);
2232         }
2233         ANGLE_CAPTURE(Uniform4uiv, isCallValid, context, locationPacked, count, value);
2234     }
2235 }
2236 
UniformBlockBinding(GLuint program,GLuint uniformBlockIndex,GLuint uniformBlockBinding)2237 void GL_APIENTRY UniformBlockBinding(GLuint program,
2238                                      GLuint uniformBlockIndex,
2239                                      GLuint uniformBlockBinding)
2240 {
2241     Context *context = GetValidGlobalContext();
2242     EVENT("glUniformBlockBinding",
2243           "context = %d, GLuint program = %u, GLuint uniformBlockIndex = %u, GLuint "
2244           "uniformBlockBinding = %u",
2245           CID(context), program, uniformBlockIndex, uniformBlockBinding);
2246 
2247     if (context)
2248     {
2249         ShaderProgramID programPacked                         = FromGL<ShaderProgramID>(program);
2250         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2251         bool isCallValid                                      = (context->skipValidation() ||
2252                             ValidateUniformBlockBinding(context, programPacked, uniformBlockIndex,
2253                                                         uniformBlockBinding));
2254         if (isCallValid)
2255         {
2256             context->uniformBlockBinding(programPacked, uniformBlockIndex, uniformBlockBinding);
2257         }
2258         ANGLE_CAPTURE(UniformBlockBinding, isCallValid, context, programPacked, uniformBlockIndex,
2259                       uniformBlockBinding);
2260     }
2261 }
2262 
UniformMatrix2x3fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)2263 void GL_APIENTRY UniformMatrix2x3fv(GLint location,
2264                                     GLsizei count,
2265                                     GLboolean transpose,
2266                                     const GLfloat *value)
2267 {
2268     Context *context = GetValidGlobalContext();
2269     EVENT("glUniformMatrix2x3fv",
2270           "context = %d, GLint location = %d, GLsizei count = %d, GLboolean transpose = %s, const "
2271           "GLfloat *value = 0x%016" PRIxPTR "",
2272           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
2273 
2274     if (context)
2275     {
2276         UniformLocation locationPacked                        = FromGL<UniformLocation>(location);
2277         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2278         bool isCallValid =
2279             (context->skipValidation() ||
2280              ValidateUniformMatrix2x3fv(context, locationPacked, count, transpose, value));
2281         if (isCallValid)
2282         {
2283             context->uniformMatrix2x3fv(locationPacked, count, transpose, value);
2284         }
2285         ANGLE_CAPTURE(UniformMatrix2x3fv, isCallValid, context, locationPacked, count, transpose,
2286                       value);
2287     }
2288 }
2289 
UniformMatrix2x4fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)2290 void GL_APIENTRY UniformMatrix2x4fv(GLint location,
2291                                     GLsizei count,
2292                                     GLboolean transpose,
2293                                     const GLfloat *value)
2294 {
2295     Context *context = GetValidGlobalContext();
2296     EVENT("glUniformMatrix2x4fv",
2297           "context = %d, GLint location = %d, GLsizei count = %d, GLboolean transpose = %s, const "
2298           "GLfloat *value = 0x%016" PRIxPTR "",
2299           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
2300 
2301     if (context)
2302     {
2303         UniformLocation locationPacked                        = FromGL<UniformLocation>(location);
2304         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2305         bool isCallValid =
2306             (context->skipValidation() ||
2307              ValidateUniformMatrix2x4fv(context, locationPacked, count, transpose, value));
2308         if (isCallValid)
2309         {
2310             context->uniformMatrix2x4fv(locationPacked, count, transpose, value);
2311         }
2312         ANGLE_CAPTURE(UniformMatrix2x4fv, isCallValid, context, locationPacked, count, transpose,
2313                       value);
2314     }
2315 }
2316 
UniformMatrix3x2fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)2317 void GL_APIENTRY UniformMatrix3x2fv(GLint location,
2318                                     GLsizei count,
2319                                     GLboolean transpose,
2320                                     const GLfloat *value)
2321 {
2322     Context *context = GetValidGlobalContext();
2323     EVENT("glUniformMatrix3x2fv",
2324           "context = %d, GLint location = %d, GLsizei count = %d, GLboolean transpose = %s, const "
2325           "GLfloat *value = 0x%016" PRIxPTR "",
2326           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
2327 
2328     if (context)
2329     {
2330         UniformLocation locationPacked                        = FromGL<UniformLocation>(location);
2331         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2332         bool isCallValid =
2333             (context->skipValidation() ||
2334              ValidateUniformMatrix3x2fv(context, locationPacked, count, transpose, value));
2335         if (isCallValid)
2336         {
2337             context->uniformMatrix3x2fv(locationPacked, count, transpose, value);
2338         }
2339         ANGLE_CAPTURE(UniformMatrix3x2fv, isCallValid, context, locationPacked, count, transpose,
2340                       value);
2341     }
2342 }
2343 
UniformMatrix3x4fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)2344 void GL_APIENTRY UniformMatrix3x4fv(GLint location,
2345                                     GLsizei count,
2346                                     GLboolean transpose,
2347                                     const GLfloat *value)
2348 {
2349     Context *context = GetValidGlobalContext();
2350     EVENT("glUniformMatrix3x4fv",
2351           "context = %d, GLint location = %d, GLsizei count = %d, GLboolean transpose = %s, const "
2352           "GLfloat *value = 0x%016" PRIxPTR "",
2353           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
2354 
2355     if (context)
2356     {
2357         UniformLocation locationPacked                        = FromGL<UniformLocation>(location);
2358         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2359         bool isCallValid =
2360             (context->skipValidation() ||
2361              ValidateUniformMatrix3x4fv(context, locationPacked, count, transpose, value));
2362         if (isCallValid)
2363         {
2364             context->uniformMatrix3x4fv(locationPacked, count, transpose, value);
2365         }
2366         ANGLE_CAPTURE(UniformMatrix3x4fv, isCallValid, context, locationPacked, count, transpose,
2367                       value);
2368     }
2369 }
2370 
UniformMatrix4x2fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)2371 void GL_APIENTRY UniformMatrix4x2fv(GLint location,
2372                                     GLsizei count,
2373                                     GLboolean transpose,
2374                                     const GLfloat *value)
2375 {
2376     Context *context = GetValidGlobalContext();
2377     EVENT("glUniformMatrix4x2fv",
2378           "context = %d, GLint location = %d, GLsizei count = %d, GLboolean transpose = %s, const "
2379           "GLfloat *value = 0x%016" PRIxPTR "",
2380           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
2381 
2382     if (context)
2383     {
2384         UniformLocation locationPacked                        = FromGL<UniformLocation>(location);
2385         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2386         bool isCallValid =
2387             (context->skipValidation() ||
2388              ValidateUniformMatrix4x2fv(context, locationPacked, count, transpose, value));
2389         if (isCallValid)
2390         {
2391             context->uniformMatrix4x2fv(locationPacked, count, transpose, value);
2392         }
2393         ANGLE_CAPTURE(UniformMatrix4x2fv, isCallValid, context, locationPacked, count, transpose,
2394                       value);
2395     }
2396 }
2397 
UniformMatrix4x3fv(GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)2398 void GL_APIENTRY UniformMatrix4x3fv(GLint location,
2399                                     GLsizei count,
2400                                     GLboolean transpose,
2401                                     const GLfloat *value)
2402 {
2403     Context *context = GetValidGlobalContext();
2404     EVENT("glUniformMatrix4x3fv",
2405           "context = %d, GLint location = %d, GLsizei count = %d, GLboolean transpose = %s, const "
2406           "GLfloat *value = 0x%016" PRIxPTR "",
2407           CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
2408 
2409     if (context)
2410     {
2411         UniformLocation locationPacked                        = FromGL<UniformLocation>(location);
2412         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2413         bool isCallValid =
2414             (context->skipValidation() ||
2415              ValidateUniformMatrix4x3fv(context, locationPacked, count, transpose, value));
2416         if (isCallValid)
2417         {
2418             context->uniformMatrix4x3fv(locationPacked, count, transpose, value);
2419         }
2420         ANGLE_CAPTURE(UniformMatrix4x3fv, isCallValid, context, locationPacked, count, transpose,
2421                       value);
2422     }
2423 }
2424 
UnmapBuffer(GLenum target)2425 GLboolean GL_APIENTRY UnmapBuffer(GLenum target)
2426 {
2427     Context *context = GetValidGlobalContext();
2428     EVENT("glUnmapBuffer", "context = %d, GLenum target = %s", CID(context),
2429           GLenumToString(GLenumGroup::BufferTargetARB, target));
2430 
2431     GLboolean returnValue;
2432     if (context)
2433     {
2434         BufferBinding targetPacked                            = FromGL<BufferBinding>(target);
2435         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2436         bool isCallValid =
2437             (context->skipValidation() || ValidateUnmapBuffer(context, targetPacked));
2438         if (isCallValid)
2439         {
2440             returnValue = context->unmapBuffer(targetPacked);
2441         }
2442         else
2443         {
2444             returnValue = GetDefaultReturnValue<EntryPoint::UnmapBuffer, GLboolean>();
2445         }
2446         ANGLE_CAPTURE(UnmapBuffer, isCallValid, context, targetPacked, returnValue);
2447     }
2448     else
2449     {
2450         returnValue = GetDefaultReturnValue<EntryPoint::UnmapBuffer, GLboolean>();
2451     }
2452     return returnValue;
2453 }
2454 
VertexAttribDivisor(GLuint index,GLuint divisor)2455 void GL_APIENTRY VertexAttribDivisor(GLuint index, GLuint divisor)
2456 {
2457     Context *context = GetValidGlobalContext();
2458     EVENT("glVertexAttribDivisor", "context = %d, GLuint index = %u, GLuint divisor = %u",
2459           CID(context), index, divisor);
2460 
2461     if (context)
2462     {
2463         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2464         bool isCallValid =
2465             (context->skipValidation() || ValidateVertexAttribDivisor(context, index, divisor));
2466         if (isCallValid)
2467         {
2468             context->vertexAttribDivisor(index, divisor);
2469         }
2470         ANGLE_CAPTURE(VertexAttribDivisor, isCallValid, context, index, divisor);
2471     }
2472 }
2473 
VertexAttribI4i(GLuint index,GLint x,GLint y,GLint z,GLint w)2474 void GL_APIENTRY VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
2475 {
2476     Context *context = GetValidGlobalContext();
2477     EVENT("glVertexAttribI4i",
2478           "context = %d, GLuint index = %u, GLint x = %d, GLint y = %d, GLint z = %d, GLint w = %d",
2479           CID(context), index, x, y, z, w);
2480 
2481     if (context)
2482     {
2483         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2484         bool isCallValid =
2485             (context->skipValidation() || ValidateVertexAttribI4i(context, index, x, y, z, w));
2486         if (isCallValid)
2487         {
2488             context->vertexAttribI4i(index, x, y, z, w);
2489         }
2490         ANGLE_CAPTURE(VertexAttribI4i, isCallValid, context, index, x, y, z, w);
2491     }
2492 }
2493 
VertexAttribI4iv(GLuint index,const GLint * v)2494 void GL_APIENTRY VertexAttribI4iv(GLuint index, const GLint *v)
2495 {
2496     Context *context = GetValidGlobalContext();
2497     EVENT("glVertexAttribI4iv",
2498           "context = %d, GLuint index = %u, const GLint *v = 0x%016" PRIxPTR "", CID(context),
2499           index, (uintptr_t)v);
2500 
2501     if (context)
2502     {
2503         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2504         bool isCallValid =
2505             (context->skipValidation() || ValidateVertexAttribI4iv(context, index, v));
2506         if (isCallValid)
2507         {
2508             context->vertexAttribI4iv(index, v);
2509         }
2510         ANGLE_CAPTURE(VertexAttribI4iv, isCallValid, context, index, v);
2511     }
2512 }
2513 
VertexAttribI4ui(GLuint index,GLuint x,GLuint y,GLuint z,GLuint w)2514 void GL_APIENTRY VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
2515 {
2516     Context *context = GetValidGlobalContext();
2517     EVENT("glVertexAttribI4ui",
2518           "context = %d, GLuint index = %u, GLuint x = %u, GLuint y = %u, GLuint z = %u, GLuint w "
2519           "= %u",
2520           CID(context), index, x, y, z, w);
2521 
2522     if (context)
2523     {
2524         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2525         bool isCallValid =
2526             (context->skipValidation() || ValidateVertexAttribI4ui(context, index, x, y, z, w));
2527         if (isCallValid)
2528         {
2529             context->vertexAttribI4ui(index, x, y, z, w);
2530         }
2531         ANGLE_CAPTURE(VertexAttribI4ui, isCallValid, context, index, x, y, z, w);
2532     }
2533 }
2534 
VertexAttribI4uiv(GLuint index,const GLuint * v)2535 void GL_APIENTRY VertexAttribI4uiv(GLuint index, const GLuint *v)
2536 {
2537     Context *context = GetValidGlobalContext();
2538     EVENT("glVertexAttribI4uiv",
2539           "context = %d, GLuint index = %u, const GLuint *v = 0x%016" PRIxPTR "", CID(context),
2540           index, (uintptr_t)v);
2541 
2542     if (context)
2543     {
2544         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2545         bool isCallValid =
2546             (context->skipValidation() || ValidateVertexAttribI4uiv(context, index, v));
2547         if (isCallValid)
2548         {
2549             context->vertexAttribI4uiv(index, v);
2550         }
2551         ANGLE_CAPTURE(VertexAttribI4uiv, isCallValid, context, index, v);
2552     }
2553 }
2554 
2555 void GL_APIENTRY
VertexAttribIPointer(GLuint index,GLint size,GLenum type,GLsizei stride,const void * pointer)2556 VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer)
2557 {
2558     Context *context = GetValidGlobalContext();
2559     EVENT("glVertexAttribIPointer",
2560           "context = %d, GLuint index = %u, GLint size = %d, GLenum type = %s, GLsizei stride = "
2561           "%d, const void *pointer = 0x%016" PRIxPTR "",
2562           CID(context), index, size, GLenumToString(GLenumGroup::VertexAttribPointerType, type),
2563           stride, (uintptr_t)pointer);
2564 
2565     if (context)
2566     {
2567         VertexAttribType typePacked                           = FromGL<VertexAttribType>(type);
2568         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2569         bool isCallValid =
2570             (context->skipValidation() ||
2571              ValidateVertexAttribIPointer(context, index, size, typePacked, stride, pointer));
2572         if (isCallValid)
2573         {
2574             context->vertexAttribIPointer(index, size, typePacked, stride, pointer);
2575         }
2576         ANGLE_CAPTURE(VertexAttribIPointer, isCallValid, context, index, size, typePacked, stride,
2577                       pointer);
2578     }
2579 }
2580 
WaitSync(GLsync sync,GLbitfield flags,GLuint64 timeout)2581 void GL_APIENTRY WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
2582 {
2583     Context *context = GetValidGlobalContext();
2584     EVENT("glWaitSync",
2585           "context = %d, GLsync sync = 0x%016" PRIxPTR
2586           ", GLbitfield flags = %s, GLuint64 timeout = %llu",
2587           CID(context), (uintptr_t)sync,
2588           GLbitfieldToString(GLenumGroup::DefaultGroup, flags).c_str(),
2589           static_cast<unsigned long long>(timeout));
2590 
2591     if (context)
2592     {
2593         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2594         bool isCallValid =
2595             (context->skipValidation() || ValidateWaitSync(context, sync, flags, timeout));
2596         if (isCallValid)
2597         {
2598             context->waitSync(sync, flags, timeout);
2599         }
2600         ANGLE_CAPTURE(WaitSync, isCallValid, context, sync, flags, timeout);
2601     }
2602 }
2603 }  // namespace gl
2604