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