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