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