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