• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.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_ext_autogen.cpp:
9 //   Defines the GLES extension entry points.
10 
11 #include "libGLESv2/entry_points_gles_ext_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_ext_autogen.h"
18 #include "libANGLE/context_private_call_gles_autogen.h"
19 #include "libANGLE/entry_points_utils.h"
20 #include "libANGLE/validationESEXT.h"
21 #include "libGLESv2/global_state.h"
22 
23 using namespace gl;
24 
25 #include "libANGLE/capture/capture_gles_1_0_autogen.h"
26 #include "libANGLE/capture/capture_gles_2_0_autogen.h"
27 #include "libANGLE/capture/capture_gles_3_0_autogen.h"
28 #include "libANGLE/capture/capture_gles_3_1_autogen.h"
29 #include "libANGLE/capture/capture_gles_3_2_autogen.h"
30 #include "libANGLE/validationES1.h"
31 #include "libANGLE/validationES2.h"
32 #include "libANGLE/validationES3.h"
33 #include "libANGLE/validationES31.h"
34 #include "libANGLE/validationES32.h"
35 
36 using namespace gl;
37 
38 extern "C" {
39 
40 // GL_AMD_performance_monitor
GL_BeginPerfMonitorAMD(GLuint monitor)41 void GL_APIENTRY GL_BeginPerfMonitorAMD(GLuint monitor)
42 {
43     Context *context = GetValidGlobalContext();
44     EVENT(context, GLBeginPerfMonitorAMD, "context = %d, monitor = %u", CID(context), monitor);
45 
46     if (context)
47     {
48         SCOPED_SHARE_CONTEXT_LOCK(context);
49         bool isCallValid =
50             (context->skipValidation() ||
51              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
52                                                 context->getMutableErrorSetForValidation(),
53                                                 angle::EntryPoint::GLBeginPerfMonitorAMD) &&
54               ValidateBeginPerfMonitorAMD(context, angle::EntryPoint::GLBeginPerfMonitorAMD,
55                                           monitor)));
56         if (isCallValid)
57         {
58             context->beginPerfMonitor(monitor);
59         }
60         ANGLE_CAPTURE_GL(BeginPerfMonitorAMD, isCallValid, context, monitor);
61     }
62     else
63     {
64         GenerateContextLostErrorOnCurrentGlobalContext();
65     }
66     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
67 }
68 
GL_DeletePerfMonitorsAMD(GLsizei n,GLuint * monitors)69 void GL_APIENTRY GL_DeletePerfMonitorsAMD(GLsizei n, GLuint *monitors)
70 {
71     Context *context = GetValidGlobalContext();
72     EVENT(context, GLDeletePerfMonitorsAMD, "context = %d, n = %d, monitors = 0x%016" PRIxPTR "",
73           CID(context), n, (uintptr_t)monitors);
74 
75     if (context)
76     {
77         SCOPED_SHARE_CONTEXT_LOCK(context);
78         bool isCallValid = (context->skipValidation() ||
79                             ValidateDeletePerfMonitorsAMD(
80                                 context, angle::EntryPoint::GLDeletePerfMonitorsAMD, n, monitors));
81         if (isCallValid)
82         {
83             context->deletePerfMonitors(n, monitors);
84         }
85         ANGLE_CAPTURE_GL(DeletePerfMonitorsAMD, isCallValid, context, n, monitors);
86     }
87     else
88     {
89         GenerateContextLostErrorOnCurrentGlobalContext();
90     }
91     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
92 }
93 
GL_EndPerfMonitorAMD(GLuint monitor)94 void GL_APIENTRY GL_EndPerfMonitorAMD(GLuint monitor)
95 {
96     Context *context = GetValidGlobalContext();
97     EVENT(context, GLEndPerfMonitorAMD, "context = %d, monitor = %u", CID(context), monitor);
98 
99     if (context)
100     {
101         SCOPED_SHARE_CONTEXT_LOCK(context);
102         bool isCallValid =
103             (context->skipValidation() ||
104              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
105                                                 context->getMutableErrorSetForValidation(),
106                                                 angle::EntryPoint::GLEndPerfMonitorAMD) &&
107               ValidateEndPerfMonitorAMD(context, angle::EntryPoint::GLEndPerfMonitorAMD, monitor)));
108         if (isCallValid)
109         {
110             context->endPerfMonitor(monitor);
111         }
112         ANGLE_CAPTURE_GL(EndPerfMonitorAMD, isCallValid, context, monitor);
113     }
114     else
115     {
116         GenerateContextLostErrorOnCurrentGlobalContext();
117     }
118     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
119 }
120 
GL_GenPerfMonitorsAMD(GLsizei n,GLuint * monitors)121 void GL_APIENTRY GL_GenPerfMonitorsAMD(GLsizei n, GLuint *monitors)
122 {
123     Context *context = GetValidGlobalContext();
124     EVENT(context, GLGenPerfMonitorsAMD, "context = %d, n = %d, monitors = 0x%016" PRIxPTR "",
125           CID(context), n, (uintptr_t)monitors);
126 
127     if (context)
128     {
129         SCOPED_SHARE_CONTEXT_LOCK(context);
130         bool isCallValid = (context->skipValidation() ||
131                             ValidateGenPerfMonitorsAMD(
132                                 context, angle::EntryPoint::GLGenPerfMonitorsAMD, n, monitors));
133         if (isCallValid)
134         {
135             context->genPerfMonitors(n, monitors);
136         }
137         ANGLE_CAPTURE_GL(GenPerfMonitorsAMD, isCallValid, context, n, monitors);
138     }
139     else
140     {
141         GenerateContextLostErrorOnCurrentGlobalContext();
142     }
143     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
144 }
145 
GL_GetPerfMonitorCounterDataAMD(GLuint monitor,GLenum pname,GLsizei dataSize,GLuint * data,GLint * bytesWritten)146 void GL_APIENTRY GL_GetPerfMonitorCounterDataAMD(GLuint monitor,
147                                                  GLenum pname,
148                                                  GLsizei dataSize,
149                                                  GLuint *data,
150                                                  GLint *bytesWritten)
151 {
152     Context *context = GetValidGlobalContext();
153     EVENT(context, GLGetPerfMonitorCounterDataAMD,
154           "context = %d, monitor = %u, pname = %s, dataSize = %d, data = 0x%016" PRIxPTR
155           ", bytesWritten = 0x%016" PRIxPTR "",
156           CID(context), monitor, GLenumToString(GLESEnum::AllEnums, pname), dataSize,
157           (uintptr_t)data, (uintptr_t)bytesWritten);
158 
159     if (context)
160     {
161         SCOPED_SHARE_CONTEXT_LOCK(context);
162         bool isCallValid = (context->skipValidation() ||
163                             ValidateGetPerfMonitorCounterDataAMD(
164                                 context, angle::EntryPoint::GLGetPerfMonitorCounterDataAMD, monitor,
165                                 pname, dataSize, data, bytesWritten));
166         if (isCallValid)
167         {
168             context->getPerfMonitorCounterData(monitor, pname, dataSize, data, bytesWritten);
169         }
170         ANGLE_CAPTURE_GL(GetPerfMonitorCounterDataAMD, isCallValid, context, monitor, pname,
171                          dataSize, data, bytesWritten);
172     }
173     else
174     {
175         GenerateContextLostErrorOnCurrentGlobalContext();
176     }
177     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
178 }
179 
GL_GetPerfMonitorCounterInfoAMD(GLuint group,GLuint counter,GLenum pname,void * data)180 void GL_APIENTRY GL_GetPerfMonitorCounterInfoAMD(GLuint group,
181                                                  GLuint counter,
182                                                  GLenum pname,
183                                                  void *data)
184 {
185     Context *context = GetValidGlobalContext();
186     EVENT(context, GLGetPerfMonitorCounterInfoAMD,
187           "context = %d, group = %u, counter = %u, pname = %s, data = 0x%016" PRIxPTR "",
188           CID(context), group, counter, GLenumToString(GLESEnum::AllEnums, pname), (uintptr_t)data);
189 
190     if (context)
191     {
192         SCOPED_SHARE_CONTEXT_LOCK(context);
193         bool isCallValid = (context->skipValidation() ||
194                             ValidateGetPerfMonitorCounterInfoAMD(
195                                 context, angle::EntryPoint::GLGetPerfMonitorCounterInfoAMD, group,
196                                 counter, pname, data));
197         if (isCallValid)
198         {
199             context->getPerfMonitorCounterInfo(group, counter, pname, data);
200         }
201         ANGLE_CAPTURE_GL(GetPerfMonitorCounterInfoAMD, isCallValid, context, group, counter, pname,
202                          data);
203     }
204     else
205     {
206         GenerateContextLostErrorOnCurrentGlobalContext();
207     }
208     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
209 }
210 
GL_GetPerfMonitorCounterStringAMD(GLuint group,GLuint counter,GLsizei bufSize,GLsizei * length,GLchar * counterString)211 void GL_APIENTRY GL_GetPerfMonitorCounterStringAMD(GLuint group,
212                                                    GLuint counter,
213                                                    GLsizei bufSize,
214                                                    GLsizei *length,
215                                                    GLchar *counterString)
216 {
217     Context *context = GetValidGlobalContext();
218     EVENT(context, GLGetPerfMonitorCounterStringAMD,
219           "context = %d, group = %u, counter = %u, bufSize = %d, length = 0x%016" PRIxPTR
220           ", counterString = 0x%016" PRIxPTR "",
221           CID(context), group, counter, bufSize, (uintptr_t)length, (uintptr_t)counterString);
222 
223     if (context)
224     {
225         SCOPED_SHARE_CONTEXT_LOCK(context);
226         bool isCallValid = (context->skipValidation() ||
227                             ValidateGetPerfMonitorCounterStringAMD(
228                                 context, angle::EntryPoint::GLGetPerfMonitorCounterStringAMD, group,
229                                 counter, bufSize, length, counterString));
230         if (isCallValid)
231         {
232             context->getPerfMonitorCounterString(group, counter, bufSize, length, counterString);
233         }
234         ANGLE_CAPTURE_GL(GetPerfMonitorCounterStringAMD, isCallValid, context, group, counter,
235                          bufSize, length, counterString);
236     }
237     else
238     {
239         GenerateContextLostErrorOnCurrentGlobalContext();
240     }
241     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
242 }
243 
GL_GetPerfMonitorCountersAMD(GLuint group,GLint * numCounters,GLint * maxActiveCounters,GLsizei counterSize,GLuint * counters)244 void GL_APIENTRY GL_GetPerfMonitorCountersAMD(GLuint group,
245                                               GLint *numCounters,
246                                               GLint *maxActiveCounters,
247                                               GLsizei counterSize,
248                                               GLuint *counters)
249 {
250     Context *context = GetValidGlobalContext();
251     EVENT(context, GLGetPerfMonitorCountersAMD,
252           "context = %d, group = %u, numCounters = 0x%016" PRIxPTR
253           ", maxActiveCounters = 0x%016" PRIxPTR ", counterSize = %d, counters = 0x%016" PRIxPTR "",
254           CID(context), group, (uintptr_t)numCounters, (uintptr_t)maxActiveCounters, counterSize,
255           (uintptr_t)counters);
256 
257     if (context)
258     {
259         SCOPED_SHARE_CONTEXT_LOCK(context);
260         bool isCallValid = (context->skipValidation() ||
261                             ValidateGetPerfMonitorCountersAMD(
262                                 context, angle::EntryPoint::GLGetPerfMonitorCountersAMD, group,
263                                 numCounters, maxActiveCounters, counterSize, counters));
264         if (isCallValid)
265         {
266             context->getPerfMonitorCounters(group, numCounters, maxActiveCounters, counterSize,
267                                             counters);
268         }
269         ANGLE_CAPTURE_GL(GetPerfMonitorCountersAMD, isCallValid, context, group, numCounters,
270                          maxActiveCounters, counterSize, counters);
271     }
272     else
273     {
274         GenerateContextLostErrorOnCurrentGlobalContext();
275     }
276     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
277 }
278 
GL_GetPerfMonitorGroupStringAMD(GLuint group,GLsizei bufSize,GLsizei * length,GLchar * groupString)279 void GL_APIENTRY GL_GetPerfMonitorGroupStringAMD(GLuint group,
280                                                  GLsizei bufSize,
281                                                  GLsizei *length,
282                                                  GLchar *groupString)
283 {
284     Context *context = GetValidGlobalContext();
285     EVENT(context, GLGetPerfMonitorGroupStringAMD,
286           "context = %d, group = %u, bufSize = %d, length = 0x%016" PRIxPTR
287           ", groupString = 0x%016" PRIxPTR "",
288           CID(context), group, bufSize, (uintptr_t)length, (uintptr_t)groupString);
289 
290     if (context)
291     {
292         SCOPED_SHARE_CONTEXT_LOCK(context);
293         bool isCallValid = (context->skipValidation() ||
294                             ValidateGetPerfMonitorGroupStringAMD(
295                                 context, angle::EntryPoint::GLGetPerfMonitorGroupStringAMD, group,
296                                 bufSize, length, groupString));
297         if (isCallValid)
298         {
299             context->getPerfMonitorGroupString(group, bufSize, length, groupString);
300         }
301         ANGLE_CAPTURE_GL(GetPerfMonitorGroupStringAMD, isCallValid, context, group, bufSize, length,
302                          groupString);
303     }
304     else
305     {
306         GenerateContextLostErrorOnCurrentGlobalContext();
307     }
308     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
309 }
310 
GL_GetPerfMonitorGroupsAMD(GLint * numGroups,GLsizei groupsSize,GLuint * groups)311 void GL_APIENTRY GL_GetPerfMonitorGroupsAMD(GLint *numGroups, GLsizei groupsSize, GLuint *groups)
312 {
313     Context *context = GetValidGlobalContext();
314     EVENT(context, GLGetPerfMonitorGroupsAMD,
315           "context = %d, numGroups = 0x%016" PRIxPTR ", groupsSize = %d, groups = 0x%016" PRIxPTR
316           "",
317           CID(context), (uintptr_t)numGroups, groupsSize, (uintptr_t)groups);
318 
319     if (context)
320     {
321         SCOPED_SHARE_CONTEXT_LOCK(context);
322         bool isCallValid =
323             (context->skipValidation() ||
324              ValidateGetPerfMonitorGroupsAMD(context, angle::EntryPoint::GLGetPerfMonitorGroupsAMD,
325                                              numGroups, groupsSize, groups));
326         if (isCallValid)
327         {
328             context->getPerfMonitorGroups(numGroups, groupsSize, groups);
329         }
330         ANGLE_CAPTURE_GL(GetPerfMonitorGroupsAMD, isCallValid, context, numGroups, groupsSize,
331                          groups);
332     }
333     else
334     {
335         GenerateContextLostErrorOnCurrentGlobalContext();
336     }
337     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
338 }
339 
GL_SelectPerfMonitorCountersAMD(GLuint monitor,GLboolean enable,GLuint group,GLint numCounters,GLuint * counterList)340 void GL_APIENTRY GL_SelectPerfMonitorCountersAMD(GLuint monitor,
341                                                  GLboolean enable,
342                                                  GLuint group,
343                                                  GLint numCounters,
344                                                  GLuint *counterList)
345 {
346     Context *context = GetValidGlobalContext();
347     EVENT(context, GLSelectPerfMonitorCountersAMD,
348           "context = %d, monitor = %u, enable = %s, group = %u, numCounters = %d, counterList = "
349           "0x%016" PRIxPTR "",
350           CID(context), monitor, GLbooleanToString(enable), group, numCounters,
351           (uintptr_t)counterList);
352 
353     if (context)
354     {
355         SCOPED_SHARE_CONTEXT_LOCK(context);
356         bool isCallValid =
357             (context->skipValidation() ||
358              (ValidatePixelLocalStorageInactive(
359                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
360                   angle::EntryPoint::GLSelectPerfMonitorCountersAMD) &&
361               ValidateSelectPerfMonitorCountersAMD(
362                   context, angle::EntryPoint::GLSelectPerfMonitorCountersAMD, monitor, enable,
363                   group, numCounters, counterList)));
364         if (isCallValid)
365         {
366             context->selectPerfMonitorCounters(monitor, enable, group, numCounters, counterList);
367         }
368         ANGLE_CAPTURE_GL(SelectPerfMonitorCountersAMD, isCallValid, context, monitor, enable, group,
369                          numCounters, counterList);
370     }
371     else
372     {
373         GenerateContextLostErrorOnCurrentGlobalContext();
374     }
375     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
376 }
377 
378 // GL_ANDROID_extension_pack_es31a
379 
380 // GL_ANGLE_base_vertex_base_instance
GL_DrawArraysInstancedBaseInstanceANGLE(GLenum mode,GLint first,GLsizei count,GLsizei instanceCount,GLuint baseInstance)381 void GL_APIENTRY GL_DrawArraysInstancedBaseInstanceANGLE(GLenum mode,
382                                                          GLint first,
383                                                          GLsizei count,
384                                                          GLsizei instanceCount,
385                                                          GLuint baseInstance)
386 {
387     Context *context = GetValidGlobalContext();
388     EVENT(context, GLDrawArraysInstancedBaseInstanceANGLE,
389           "context = %d, mode = %s, first = %d, count = %d, instanceCount = %d, baseInstance = %u",
390           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), first, count, instanceCount,
391           baseInstance);
392 
393     if (context)
394     {
395         PrimitiveMode modePacked = PackParam<PrimitiveMode>(mode);
396         SCOPED_SHARE_CONTEXT_LOCK(context);
397         bool isCallValid = (context->skipValidation() ||
398                             ValidateDrawArraysInstancedBaseInstanceANGLE(
399                                 context, angle::EntryPoint::GLDrawArraysInstancedBaseInstanceANGLE,
400                                 modePacked, first, count, instanceCount, baseInstance));
401         if (isCallValid)
402         {
403             context->drawArraysInstancedBaseInstanceANGLE(modePacked, first, count, instanceCount,
404                                                           baseInstance);
405         }
406         ANGLE_CAPTURE_GL(DrawArraysInstancedBaseInstanceANGLE, isCallValid, context, modePacked,
407                          first, count, instanceCount, baseInstance);
408     }
409     else
410     {
411         GenerateContextLostErrorOnCurrentGlobalContext();
412     }
413     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
414 }
415 
GL_DrawElementsInstancedBaseVertexBaseInstanceANGLE(GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei instanceCount,GLint baseVertex,GLuint baseInstance)416 void GL_APIENTRY GL_DrawElementsInstancedBaseVertexBaseInstanceANGLE(GLenum mode,
417                                                                      GLsizei count,
418                                                                      GLenum type,
419                                                                      const void *indices,
420                                                                      GLsizei instanceCount,
421                                                                      GLint baseVertex,
422                                                                      GLuint baseInstance)
423 {
424     Context *context = GetValidGlobalContext();
425     EVENT(context, GLDrawElementsInstancedBaseVertexBaseInstanceANGLE,
426           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
427           ", instanceCount = %d, baseVertex = %d, baseInstance = %u",
428           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), count,
429           GLenumToString(GLESEnum::DrawElementsType, type), (uintptr_t)indices, instanceCount,
430           baseVertex, baseInstance);
431 
432     if (context)
433     {
434         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
435         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
436         SCOPED_SHARE_CONTEXT_LOCK(context);
437         bool isCallValid =
438             (context->skipValidation() ||
439              ValidateDrawElementsInstancedBaseVertexBaseInstanceANGLE(
440                  context, angle::EntryPoint::GLDrawElementsInstancedBaseVertexBaseInstanceANGLE,
441                  modePacked, count, typePacked, indices, instanceCount, baseVertex, baseInstance));
442         if (isCallValid)
443         {
444             context->drawElementsInstancedBaseVertexBaseInstanceANGLE(
445                 modePacked, count, typePacked, indices, instanceCount, baseVertex, baseInstance);
446         }
447         ANGLE_CAPTURE_GL(DrawElementsInstancedBaseVertexBaseInstanceANGLE, isCallValid, context,
448                          modePacked, count, typePacked, indices, instanceCount, baseVertex,
449                          baseInstance);
450     }
451     else
452     {
453         GenerateContextLostErrorOnCurrentGlobalContext();
454     }
455     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
456 }
457 
GL_MultiDrawArraysInstancedBaseInstanceANGLE(GLenum mode,const GLint * firsts,const GLsizei * counts,const GLsizei * instanceCounts,const GLuint * baseInstances,GLsizei drawcount)458 void GL_APIENTRY GL_MultiDrawArraysInstancedBaseInstanceANGLE(GLenum mode,
459                                                               const GLint *firsts,
460                                                               const GLsizei *counts,
461                                                               const GLsizei *instanceCounts,
462                                                               const GLuint *baseInstances,
463                                                               GLsizei drawcount)
464 {
465     Context *context = GetValidGlobalContext();
466     EVENT(context, GLMultiDrawArraysInstancedBaseInstanceANGLE,
467           "context = %d, mode = %s, firsts = 0x%016" PRIxPTR ", counts = 0x%016" PRIxPTR
468           ", instanceCounts = 0x%016" PRIxPTR ", baseInstances = 0x%016" PRIxPTR ", drawcount = %d",
469           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), (uintptr_t)firsts,
470           (uintptr_t)counts, (uintptr_t)instanceCounts, (uintptr_t)baseInstances, drawcount);
471 
472     if (context)
473     {
474         PrimitiveMode modePacked = PackParam<PrimitiveMode>(mode);
475         SCOPED_SHARE_CONTEXT_LOCK(context);
476         bool isCallValid =
477             (context->skipValidation() ||
478              (ValidatePixelLocalStorageInactive(
479                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
480                   angle::EntryPoint::GLMultiDrawArraysInstancedBaseInstanceANGLE) &&
481               ValidateMultiDrawArraysInstancedBaseInstanceANGLE(
482                   context, angle::EntryPoint::GLMultiDrawArraysInstancedBaseInstanceANGLE,
483                   modePacked, firsts, counts, instanceCounts, baseInstances, drawcount)));
484         if (isCallValid)
485         {
486             context->multiDrawArraysInstancedBaseInstance(modePacked, firsts, counts,
487                                                           instanceCounts, baseInstances, drawcount);
488         }
489         ANGLE_CAPTURE_GL(MultiDrawArraysInstancedBaseInstanceANGLE, isCallValid, context,
490                          modePacked, firsts, counts, instanceCounts, baseInstances, drawcount);
491     }
492     else
493     {
494         GenerateContextLostErrorOnCurrentGlobalContext();
495     }
496     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
497 }
498 
499 void GL_APIENTRY
GL_MultiDrawElementsInstancedBaseVertexBaseInstanceANGLE(GLenum mode,const GLsizei * counts,GLenum type,const void * const * indices,const GLsizei * instanceCounts,const GLint * baseVertices,const GLuint * baseInstances,GLsizei drawcount)500 GL_MultiDrawElementsInstancedBaseVertexBaseInstanceANGLE(GLenum mode,
501                                                          const GLsizei *counts,
502                                                          GLenum type,
503                                                          const void *const *indices,
504                                                          const GLsizei *instanceCounts,
505                                                          const GLint *baseVertices,
506                                                          const GLuint *baseInstances,
507                                                          GLsizei drawcount)
508 {
509     Context *context = GetValidGlobalContext();
510     EVENT(context, GLMultiDrawElementsInstancedBaseVertexBaseInstanceANGLE,
511           "context = %d, mode = %s, counts = 0x%016" PRIxPTR ", type = %s, indices = 0x%016" PRIxPTR
512           ", instanceCounts = 0x%016" PRIxPTR ", baseVertices = 0x%016" PRIxPTR
513           ", baseInstances = 0x%016" PRIxPTR ", drawcount = %d",
514           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), (uintptr_t)counts,
515           GLenumToString(GLESEnum::DrawElementsType, type), (uintptr_t)indices,
516           (uintptr_t)instanceCounts, (uintptr_t)baseVertices, (uintptr_t)baseInstances, drawcount);
517 
518     if (context)
519     {
520         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
521         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
522         SCOPED_SHARE_CONTEXT_LOCK(context);
523         bool isCallValid =
524             (context->skipValidation() ||
525              (ValidatePixelLocalStorageInactive(
526                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
527                   angle::EntryPoint::GLMultiDrawElementsInstancedBaseVertexBaseInstanceANGLE) &&
528               ValidateMultiDrawElementsInstancedBaseVertexBaseInstanceANGLE(
529                   context,
530                   angle::EntryPoint::GLMultiDrawElementsInstancedBaseVertexBaseInstanceANGLE,
531                   modePacked, counts, typePacked, indices, instanceCounts, baseVertices,
532                   baseInstances, drawcount)));
533         if (isCallValid)
534         {
535             context->multiDrawElementsInstancedBaseVertexBaseInstance(
536                 modePacked, counts, typePacked, indices, instanceCounts, baseVertices,
537                 baseInstances, drawcount);
538         }
539         ANGLE_CAPTURE_GL(MultiDrawElementsInstancedBaseVertexBaseInstanceANGLE, isCallValid,
540                          context, modePacked, counts, typePacked, indices, instanceCounts,
541                          baseVertices, baseInstances, drawcount);
542     }
543     else
544     {
545         GenerateContextLostErrorOnCurrentGlobalContext();
546     }
547     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
548 }
549 
550 // GL_ANGLE_clip_cull_distance
551 
552 // GL_ANGLE_copy_texture_3d
GL_CopyTexture3DANGLE(GLuint sourceId,GLint sourceLevel,GLenum destTarget,GLuint destId,GLint destLevel,GLint internalFormat,GLenum destType,GLboolean unpackFlipY,GLboolean unpackPremultiplyAlpha,GLboolean unpackUnmultiplyAlpha)553 void GL_APIENTRY GL_CopyTexture3DANGLE(GLuint sourceId,
554                                        GLint sourceLevel,
555                                        GLenum destTarget,
556                                        GLuint destId,
557                                        GLint destLevel,
558                                        GLint internalFormat,
559                                        GLenum destType,
560                                        GLboolean unpackFlipY,
561                                        GLboolean unpackPremultiplyAlpha,
562                                        GLboolean unpackUnmultiplyAlpha)
563 {
564     Context *context = GetValidGlobalContext();
565     EVENT(context, GLCopyTexture3DANGLE,
566           "context = %d, sourceId = %u, sourceLevel = %d, destTarget = %s, destId = %u, destLevel "
567           "= %d, internalFormat = %d, destType = %s, unpackFlipY = %s, unpackPremultiplyAlpha = "
568           "%s, unpackUnmultiplyAlpha = %s",
569           CID(context), sourceId, sourceLevel, GLenumToString(GLESEnum::AllEnums, destTarget),
570           destId, destLevel, internalFormat, GLenumToString(GLESEnum::AllEnums, destType),
571           GLbooleanToString(unpackFlipY), GLbooleanToString(unpackPremultiplyAlpha),
572           GLbooleanToString(unpackUnmultiplyAlpha));
573 
574     if (context)
575     {
576         TextureID sourceIdPacked       = PackParam<TextureID>(sourceId);
577         TextureTarget destTargetPacked = PackParam<TextureTarget>(destTarget);
578         TextureID destIdPacked         = PackParam<TextureID>(destId);
579         SCOPED_SHARE_CONTEXT_LOCK(context);
580         bool isCallValid =
581             (context->skipValidation() ||
582              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
583                                                 context->getMutableErrorSetForValidation(),
584                                                 angle::EntryPoint::GLCopyTexture3DANGLE) &&
585               ValidateCopyTexture3DANGLE(
586                   context, angle::EntryPoint::GLCopyTexture3DANGLE, sourceIdPacked, sourceLevel,
587                   destTargetPacked, destIdPacked, destLevel, internalFormat, destType, unpackFlipY,
588                   unpackPremultiplyAlpha, unpackUnmultiplyAlpha)));
589         if (isCallValid)
590         {
591             context->copyTexture3D(sourceIdPacked, sourceLevel, destTargetPacked, destIdPacked,
592                                    destLevel, internalFormat, destType, unpackFlipY,
593                                    unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
594         }
595         ANGLE_CAPTURE_GL(CopyTexture3DANGLE, isCallValid, context, sourceIdPacked, sourceLevel,
596                          destTargetPacked, destIdPacked, destLevel, internalFormat, destType,
597                          unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
598     }
599     else
600     {
601         GenerateContextLostErrorOnCurrentGlobalContext();
602     }
603     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
604 }
605 
GL_CopySubTexture3DANGLE(GLuint sourceId,GLint sourceLevel,GLenum destTarget,GLuint destId,GLint destLevel,GLint xoffset,GLint yoffset,GLint zoffset,GLint x,GLint y,GLint z,GLint width,GLint height,GLint depth,GLboolean unpackFlipY,GLboolean unpackPremultiplyAlpha,GLboolean unpackUnmultiplyAlpha)606 void GL_APIENTRY GL_CopySubTexture3DANGLE(GLuint sourceId,
607                                           GLint sourceLevel,
608                                           GLenum destTarget,
609                                           GLuint destId,
610                                           GLint destLevel,
611                                           GLint xoffset,
612                                           GLint yoffset,
613                                           GLint zoffset,
614                                           GLint x,
615                                           GLint y,
616                                           GLint z,
617                                           GLint width,
618                                           GLint height,
619                                           GLint depth,
620                                           GLboolean unpackFlipY,
621                                           GLboolean unpackPremultiplyAlpha,
622                                           GLboolean unpackUnmultiplyAlpha)
623 {
624     Context *context = GetValidGlobalContext();
625     EVENT(context, GLCopySubTexture3DANGLE,
626           "context = %d, sourceId = %u, sourceLevel = %d, destTarget = %s, destId = %u, destLevel "
627           "= %d, xoffset = %d, yoffset = %d, zoffset = %d, x = %d, y = %d, z = %d, width = %d, "
628           "height = %d, depth = %d, unpackFlipY = %s, unpackPremultiplyAlpha = %s, "
629           "unpackUnmultiplyAlpha = %s",
630           CID(context), sourceId, sourceLevel, GLenumToString(GLESEnum::AllEnums, destTarget),
631           destId, destLevel, xoffset, yoffset, zoffset, x, y, z, width, height, depth,
632           GLbooleanToString(unpackFlipY), GLbooleanToString(unpackPremultiplyAlpha),
633           GLbooleanToString(unpackUnmultiplyAlpha));
634 
635     if (context)
636     {
637         TextureID sourceIdPacked       = PackParam<TextureID>(sourceId);
638         TextureTarget destTargetPacked = PackParam<TextureTarget>(destTarget);
639         TextureID destIdPacked         = PackParam<TextureID>(destId);
640         SCOPED_SHARE_CONTEXT_LOCK(context);
641         bool isCallValid =
642             (context->skipValidation() ||
643              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
644                                                 context->getMutableErrorSetForValidation(),
645                                                 angle::EntryPoint::GLCopySubTexture3DANGLE) &&
646               ValidateCopySubTexture3DANGLE(context, angle::EntryPoint::GLCopySubTexture3DANGLE,
647                                             sourceIdPacked, sourceLevel, destTargetPacked,
648                                             destIdPacked, destLevel, xoffset, yoffset, zoffset, x,
649                                             y, z, width, height, depth, unpackFlipY,
650                                             unpackPremultiplyAlpha, unpackUnmultiplyAlpha)));
651         if (isCallValid)
652         {
653             context->copySubTexture3D(sourceIdPacked, sourceLevel, destTargetPacked, destIdPacked,
654                                       destLevel, xoffset, yoffset, zoffset, x, y, z, width, height,
655                                       depth, unpackFlipY, unpackPremultiplyAlpha,
656                                       unpackUnmultiplyAlpha);
657         }
658         ANGLE_CAPTURE_GL(CopySubTexture3DANGLE, isCallValid, context, sourceIdPacked, sourceLevel,
659                          destTargetPacked, destIdPacked, destLevel, xoffset, yoffset, zoffset, x, y,
660                          z, width, height, depth, unpackFlipY, unpackPremultiplyAlpha,
661                          unpackUnmultiplyAlpha);
662     }
663     else
664     {
665         GenerateContextLostErrorOnCurrentGlobalContext();
666     }
667     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
668 }
669 
670 // GL_ANGLE_depth_texture
671 
672 // GL_ANGLE_framebuffer_blit
GL_BlitFramebufferANGLE(GLint srcX0,GLint srcY0,GLint srcX1,GLint srcY1,GLint dstX0,GLint dstY0,GLint dstX1,GLint dstY1,GLbitfield mask,GLenum filter)673 void GL_APIENTRY GL_BlitFramebufferANGLE(GLint srcX0,
674                                          GLint srcY0,
675                                          GLint srcX1,
676                                          GLint srcY1,
677                                          GLint dstX0,
678                                          GLint dstY0,
679                                          GLint dstX1,
680                                          GLint dstY1,
681                                          GLbitfield mask,
682                                          GLenum filter)
683 {
684     Context *context = GetValidGlobalContext();
685     EVENT(context, GLBlitFramebufferANGLE,
686           "context = %d, srcX0 = %d, srcY0 = %d, srcX1 = %d, srcY1 = %d, dstX0 = %d, dstY0 = %d, "
687           "dstX1 = %d, dstY1 = %d, mask = %s, filter = %s",
688           CID(context), srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
689           GLbitfieldToString(GLESEnum::ClearBufferMask, mask).c_str(),
690           GLenumToString(GLESEnum::BlitFramebufferFilter, filter));
691 
692     if (context)
693     {
694         SCOPED_SHARE_CONTEXT_LOCK(context);
695         bool isCallValid =
696             (context->skipValidation() ||
697              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
698                                                 context->getMutableErrorSetForValidation(),
699                                                 angle::EntryPoint::GLBlitFramebufferANGLE) &&
700               ValidateBlitFramebufferANGLE(context, angle::EntryPoint::GLBlitFramebufferANGLE,
701                                            srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
702                                            mask, filter)));
703         if (isCallValid)
704         {
705             context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask,
706                                      filter);
707         }
708         ANGLE_CAPTURE_GL(BlitFramebufferANGLE, isCallValid, context, srcX0, srcY0, srcX1, srcY1,
709                          dstX0, dstY0, dstX1, dstY1, mask, filter);
710     }
711     else
712     {
713         GenerateContextLostErrorOnCurrentGlobalContext();
714     }
715     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
716 }
717 
718 // GL_ANGLE_framebuffer_multisample
GL_RenderbufferStorageMultisampleANGLE(GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height)719 void GL_APIENTRY GL_RenderbufferStorageMultisampleANGLE(GLenum target,
720                                                         GLsizei samples,
721                                                         GLenum internalformat,
722                                                         GLsizei width,
723                                                         GLsizei height)
724 {
725     Context *context = GetValidGlobalContext();
726     EVENT(context, GLRenderbufferStorageMultisampleANGLE,
727           "context = %d, target = %s, samples = %d, internalformat = %s, width = %d, height = %d",
728           CID(context), GLenumToString(GLESEnum::RenderbufferTarget, target), samples,
729           GLenumToString(GLESEnum::InternalFormat, internalformat), width, height);
730 
731     if (context)
732     {
733         SCOPED_SHARE_CONTEXT_LOCK(context);
734         bool isCallValid =
735             (context->skipValidation() ||
736              (ValidatePixelLocalStorageInactive(
737                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
738                   angle::EntryPoint::GLRenderbufferStorageMultisampleANGLE) &&
739               ValidateRenderbufferStorageMultisampleANGLE(
740                   context, angle::EntryPoint::GLRenderbufferStorageMultisampleANGLE, target,
741                   samples, internalformat, width, height)));
742         if (isCallValid)
743         {
744             context->renderbufferStorageMultisample(target, samples, internalformat, width, height);
745         }
746         ANGLE_CAPTURE_GL(RenderbufferStorageMultisampleANGLE, isCallValid, context, target, samples,
747                          internalformat, width, height);
748     }
749     else
750     {
751         GenerateContextLostErrorOnCurrentGlobalContext();
752     }
753     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
754 }
755 
756 // GL_ANGLE_get_image
757 void GL_APIENTRY
GL_GetTexImageANGLE(GLenum target,GLint level,GLenum format,GLenum type,void * pixels)758 GL_GetTexImageANGLE(GLenum target, GLint level, GLenum format, GLenum type, void *pixels)
759 {
760     Context *context = GetValidGlobalContext();
761     EVENT(context, GLGetTexImageANGLE,
762           "context = %d, target = %s, level = %d, format = %s, type = %s, pixels = 0x%016" PRIxPTR
763           "",
764           CID(context), GLenumToString(GLESEnum::TextureTarget, target), level,
765           GLenumToString(GLESEnum::PixelFormat, format), GLenumToString(GLESEnum::PixelType, type),
766           (uintptr_t)pixels);
767 
768     if (context)
769     {
770         TextureTarget targetPacked = PackParam<TextureTarget>(target);
771         SCOPED_SHARE_CONTEXT_LOCK(context);
772         bool isCallValid = (context->skipValidation() ||
773                             ValidateGetTexImageANGLE(context, angle::EntryPoint::GLGetTexImageANGLE,
774                                                      targetPacked, level, format, type, pixels));
775         if (isCallValid)
776         {
777             context->getTexImage(targetPacked, level, format, type, pixels);
778         }
779         ANGLE_CAPTURE_GL(GetTexImageANGLE, isCallValid, context, targetPacked, level, format, type,
780                          pixels);
781     }
782     else
783     {
784         GenerateContextLostErrorOnCurrentGlobalContext();
785     }
786     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
787 }
788 
GL_GetCompressedTexImageANGLE(GLenum target,GLint level,void * pixels)789 void GL_APIENTRY GL_GetCompressedTexImageANGLE(GLenum target, GLint level, void *pixels)
790 {
791     Context *context = GetValidGlobalContext();
792     EVENT(context, GLGetCompressedTexImageANGLE,
793           "context = %d, target = %s, level = %d, pixels = 0x%016" PRIxPTR "", CID(context),
794           GLenumToString(GLESEnum::TextureTarget, target), level, (uintptr_t)pixels);
795 
796     if (context)
797     {
798         TextureTarget targetPacked = PackParam<TextureTarget>(target);
799         SCOPED_SHARE_CONTEXT_LOCK(context);
800         bool isCallValid = (context->skipValidation() ||
801                             ValidateGetCompressedTexImageANGLE(
802                                 context, angle::EntryPoint::GLGetCompressedTexImageANGLE,
803                                 targetPacked, level, pixels));
804         if (isCallValid)
805         {
806             context->getCompressedTexImage(targetPacked, level, pixels);
807         }
808         ANGLE_CAPTURE_GL(GetCompressedTexImageANGLE, isCallValid, context, targetPacked, level,
809                          pixels);
810     }
811     else
812     {
813         GenerateContextLostErrorOnCurrentGlobalContext();
814     }
815     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
816 }
817 
GL_GetRenderbufferImageANGLE(GLenum target,GLenum format,GLenum type,void * pixels)818 void GL_APIENTRY GL_GetRenderbufferImageANGLE(GLenum target,
819                                               GLenum format,
820                                               GLenum type,
821                                               void *pixels)
822 {
823     Context *context = GetValidGlobalContext();
824     EVENT(context, GLGetRenderbufferImageANGLE,
825           "context = %d, target = %s, format = %s, type = %s, pixels = 0x%016" PRIxPTR "",
826           CID(context), GLenumToString(GLESEnum::RenderbufferTarget, target),
827           GLenumToString(GLESEnum::PixelFormat, format), GLenumToString(GLESEnum::PixelType, type),
828           (uintptr_t)pixels);
829 
830     if (context)
831     {
832         SCOPED_SHARE_CONTEXT_LOCK(context);
833         bool isCallValid = (context->skipValidation() ||
834                             ValidateGetRenderbufferImageANGLE(
835                                 context, angle::EntryPoint::GLGetRenderbufferImageANGLE, target,
836                                 format, type, pixels));
837         if (isCallValid)
838         {
839             context->getRenderbufferImage(target, format, type, pixels);
840         }
841         ANGLE_CAPTURE_GL(GetRenderbufferImageANGLE, isCallValid, context, target, format, type,
842                          pixels);
843     }
844     else
845     {
846         GenerateContextLostErrorOnCurrentGlobalContext();
847     }
848     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
849 }
850 
851 // GL_ANGLE_get_tex_level_parameter
GL_GetTexLevelParameterivANGLE(GLenum target,GLint level,GLenum pname,GLint * params)852 void GL_APIENTRY GL_GetTexLevelParameterivANGLE(GLenum target,
853                                                 GLint level,
854                                                 GLenum pname,
855                                                 GLint *params)
856 {
857     Context *context = GetValidGlobalContext();
858     EVENT(context, GLGetTexLevelParameterivANGLE,
859           "context = %d, target = %s, level = %d, pname = %s, params = 0x%016" PRIxPTR "",
860           CID(context), GLenumToString(GLESEnum::TextureTarget, target), level,
861           GLenumToString(GLESEnum::GetTextureParameter, pname), (uintptr_t)params);
862 
863     if (context)
864     {
865         TextureTarget targetPacked = PackParam<TextureTarget>(target);
866         SCOPED_SHARE_CONTEXT_LOCK(context);
867         bool isCallValid = (context->skipValidation() ||
868                             ValidateGetTexLevelParameterivANGLE(
869                                 context, angle::EntryPoint::GLGetTexLevelParameterivANGLE,
870                                 targetPacked, level, pname, params));
871         if (isCallValid)
872         {
873             context->getTexLevelParameteriv(targetPacked, level, pname, params);
874         }
875         ANGLE_CAPTURE_GL(GetTexLevelParameterivANGLE, isCallValid, context, targetPacked, level,
876                          pname, params);
877     }
878     else
879     {
880         GenerateContextLostErrorOnCurrentGlobalContext();
881     }
882     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
883 }
884 
GL_GetTexLevelParameterfvANGLE(GLenum target,GLint level,GLenum pname,GLfloat * params)885 void GL_APIENTRY GL_GetTexLevelParameterfvANGLE(GLenum target,
886                                                 GLint level,
887                                                 GLenum pname,
888                                                 GLfloat *params)
889 {
890     Context *context = GetValidGlobalContext();
891     EVENT(context, GLGetTexLevelParameterfvANGLE,
892           "context = %d, target = %s, level = %d, pname = %s, params = 0x%016" PRIxPTR "",
893           CID(context), GLenumToString(GLESEnum::AllEnums, target), level,
894           GLenumToString(GLESEnum::AllEnums, pname), (uintptr_t)params);
895 
896     if (context)
897     {
898         TextureTarget targetPacked = PackParam<TextureTarget>(target);
899         SCOPED_SHARE_CONTEXT_LOCK(context);
900         bool isCallValid = (context->skipValidation() ||
901                             ValidateGetTexLevelParameterfvANGLE(
902                                 context, angle::EntryPoint::GLGetTexLevelParameterfvANGLE,
903                                 targetPacked, level, pname, params));
904         if (isCallValid)
905         {
906             context->getTexLevelParameterfv(targetPacked, level, pname, params);
907         }
908         ANGLE_CAPTURE_GL(GetTexLevelParameterfvANGLE, isCallValid, context, targetPacked, level,
909                          pname, params);
910     }
911     else
912     {
913         GenerateContextLostErrorOnCurrentGlobalContext();
914     }
915     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
916 }
917 
918 // GL_ANGLE_instanced_arrays
GL_DrawArraysInstancedANGLE(GLenum mode,GLint first,GLsizei count,GLsizei primcount)919 void GL_APIENTRY GL_DrawArraysInstancedANGLE(GLenum mode,
920                                              GLint first,
921                                              GLsizei count,
922                                              GLsizei primcount)
923 {
924     Context *context = GetValidGlobalContext();
925     EVENT(context, GLDrawArraysInstancedANGLE,
926           "context = %d, mode = %s, first = %d, count = %d, primcount = %d", CID(context),
927           GLenumToString(GLESEnum::PrimitiveType, mode), first, count, primcount);
928 
929     if (context)
930     {
931         PrimitiveMode modePacked = PackParam<PrimitiveMode>(mode);
932         SCOPED_SHARE_CONTEXT_LOCK(context);
933         bool isCallValid = (context->skipValidation() ||
934                             ValidateDrawArraysInstancedANGLE(
935                                 context, angle::EntryPoint::GLDrawArraysInstancedANGLE, modePacked,
936                                 first, count, primcount));
937         if (isCallValid)
938         {
939             context->drawArraysInstanced(modePacked, first, count, primcount);
940         }
941         ANGLE_CAPTURE_GL(DrawArraysInstancedANGLE, isCallValid, context, modePacked, first, count,
942                          primcount);
943     }
944     else
945     {
946         GenerateContextLostErrorOnCurrentGlobalContext();
947     }
948     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
949 }
950 
GL_DrawElementsInstancedANGLE(GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei primcount)951 void GL_APIENTRY GL_DrawElementsInstancedANGLE(GLenum mode,
952                                                GLsizei count,
953                                                GLenum type,
954                                                const void *indices,
955                                                GLsizei primcount)
956 {
957     Context *context = GetValidGlobalContext();
958     EVENT(context, GLDrawElementsInstancedANGLE,
959           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
960           ", primcount = %d",
961           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), count,
962           GLenumToString(GLESEnum::PrimitiveType, type), (uintptr_t)indices, primcount);
963 
964     if (context)
965     {
966         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
967         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
968         SCOPED_SHARE_CONTEXT_LOCK(context);
969         bool isCallValid = (context->skipValidation() ||
970                             ValidateDrawElementsInstancedANGLE(
971                                 context, angle::EntryPoint::GLDrawElementsInstancedANGLE,
972                                 modePacked, count, typePacked, indices, primcount));
973         if (isCallValid)
974         {
975             context->drawElementsInstanced(modePacked, count, typePacked, indices, primcount);
976         }
977         ANGLE_CAPTURE_GL(DrawElementsInstancedANGLE, isCallValid, context, modePacked, count,
978                          typePacked, indices, primcount);
979     }
980     else
981     {
982         GenerateContextLostErrorOnCurrentGlobalContext();
983     }
984     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
985 }
986 
GL_VertexAttribDivisorANGLE(GLuint index,GLuint divisor)987 void GL_APIENTRY GL_VertexAttribDivisorANGLE(GLuint index, GLuint divisor)
988 {
989     Context *context = GetValidGlobalContext();
990     EVENT(context, GLVertexAttribDivisorANGLE, "context = %d, index = %u, divisor = %u",
991           CID(context), index, divisor);
992 
993     if (context)
994     {
995         SCOPED_SHARE_CONTEXT_LOCK(context);
996         bool isCallValid =
997             (context->skipValidation() ||
998              ValidateVertexAttribDivisorANGLE(
999                  context, angle::EntryPoint::GLVertexAttribDivisorANGLE, index, divisor));
1000         if (isCallValid)
1001         {
1002             context->vertexAttribDivisor(index, divisor);
1003         }
1004         ANGLE_CAPTURE_GL(VertexAttribDivisorANGLE, isCallValid, context, index, divisor);
1005     }
1006     else
1007     {
1008         GenerateContextLostErrorOnCurrentGlobalContext();
1009     }
1010     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1011 }
1012 
1013 // GL_ANGLE_logic_op
GL_LogicOpANGLE(GLenum opcode)1014 void GL_APIENTRY GL_LogicOpANGLE(GLenum opcode)
1015 {
1016     Context *context = GetValidGlobalContext();
1017     EVENT(context, GLLogicOpANGLE, "context = %d, opcode = %s", CID(context),
1018           GLenumToString(GLESEnum::LogicOp, opcode));
1019 
1020     if (context)
1021     {
1022         LogicalOperation opcodePacked = PackParam<LogicalOperation>(opcode);
1023         bool isCallValid =
1024             (context->skipValidation() ||
1025              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1026                                                 context->getMutableErrorSetForValidation(),
1027                                                 angle::EntryPoint::GLLogicOpANGLE) &&
1028               ValidateLogicOpANGLE(context->getPrivateState(),
1029                                    context->getMutableErrorSetForValidation(),
1030                                    angle::EntryPoint::GLLogicOpANGLE, opcodePacked)));
1031         if (isCallValid)
1032         {
1033             ContextPrivateLogicOpANGLE(context->getMutablePrivateState(),
1034                                        context->getMutablePrivateStateCache(), opcodePacked);
1035         }
1036         ANGLE_CAPTURE_GL(LogicOpANGLE, isCallValid, context, opcodePacked);
1037     }
1038     else
1039     {
1040         GenerateContextLostErrorOnCurrentGlobalContext();
1041     }
1042     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1043 }
1044 
1045 // GL_ANGLE_memory_object_flags
GL_TexStorageMemFlags2DANGLE(GLenum target,GLsizei levels,GLenum internalFormat,GLsizei width,GLsizei height,GLuint memory,GLuint64 offset,GLbitfield createFlags,GLbitfield usageFlags,const void * imageCreateInfoPNext)1046 void GL_APIENTRY GL_TexStorageMemFlags2DANGLE(GLenum target,
1047                                               GLsizei levels,
1048                                               GLenum internalFormat,
1049                                               GLsizei width,
1050                                               GLsizei height,
1051                                               GLuint memory,
1052                                               GLuint64 offset,
1053                                               GLbitfield createFlags,
1054                                               GLbitfield usageFlags,
1055                                               const void *imageCreateInfoPNext)
1056 {
1057     Context *context = GetValidGlobalContext();
1058     EVENT(context, GLTexStorageMemFlags2DANGLE,
1059           "context = %d, target = %s, levels = %d, internalFormat = %s, width = %d, height = %d, "
1060           "memory = %u, offset = %llu, createFlags = %s, usageFlags = %s, imageCreateInfoPNext = "
1061           "0x%016" PRIxPTR "",
1062           CID(context), GLenumToString(GLESEnum::TextureTarget, target), levels,
1063           GLenumToString(GLESEnum::AllEnums, internalFormat), width, height, memory,
1064           static_cast<unsigned long long>(offset),
1065           GLbitfieldToString(GLESEnum::AllEnums, createFlags).c_str(),
1066           GLbitfieldToString(GLESEnum::AllEnums, usageFlags).c_str(),
1067           (uintptr_t)imageCreateInfoPNext);
1068 
1069     if (context)
1070     {
1071         TextureType targetPacked    = PackParam<TextureType>(target);
1072         MemoryObjectID memoryPacked = PackParam<MemoryObjectID>(memory);
1073         SCOPED_SHARE_CONTEXT_LOCK(context);
1074         bool isCallValid =
1075             (context->skipValidation() ||
1076              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1077                                                 context->getMutableErrorSetForValidation(),
1078                                                 angle::EntryPoint::GLTexStorageMemFlags2DANGLE) &&
1079               ValidateTexStorageMemFlags2DANGLE(
1080                   context, angle::EntryPoint::GLTexStorageMemFlags2DANGLE, targetPacked, levels,
1081                   internalFormat, width, height, memoryPacked, offset, createFlags, usageFlags,
1082                   imageCreateInfoPNext)));
1083         if (isCallValid)
1084         {
1085             context->texStorageMemFlags2D(targetPacked, levels, internalFormat, width, height,
1086                                           memoryPacked, offset, createFlags, usageFlags,
1087                                           imageCreateInfoPNext);
1088         }
1089         ANGLE_CAPTURE_GL(TexStorageMemFlags2DANGLE, isCallValid, context, targetPacked, levels,
1090                          internalFormat, width, height, memoryPacked, offset, createFlags,
1091                          usageFlags, imageCreateInfoPNext);
1092     }
1093     else
1094     {
1095         GenerateContextLostErrorOnCurrentGlobalContext();
1096     }
1097     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1098 }
1099 
GL_TexStorageMemFlags2DMultisampleANGLE(GLenum target,GLsizei samples,GLenum internalFormat,GLsizei width,GLsizei height,GLboolean fixedSampleLocations,GLuint memory,GLuint64 offset,GLbitfield createFlags,GLbitfield usageFlags,const void * imageCreateInfoPNext)1100 void GL_APIENTRY GL_TexStorageMemFlags2DMultisampleANGLE(GLenum target,
1101                                                          GLsizei samples,
1102                                                          GLenum internalFormat,
1103                                                          GLsizei width,
1104                                                          GLsizei height,
1105                                                          GLboolean fixedSampleLocations,
1106                                                          GLuint memory,
1107                                                          GLuint64 offset,
1108                                                          GLbitfield createFlags,
1109                                                          GLbitfield usageFlags,
1110                                                          const void *imageCreateInfoPNext)
1111 {
1112     Context *context = GetValidGlobalContext();
1113     EVENT(context, GLTexStorageMemFlags2DMultisampleANGLE,
1114           "context = %d, target = %s, samples = %d, internalFormat = %s, width = %d, height = %d, "
1115           "fixedSampleLocations = %s, memory = %u, offset = %llu, createFlags = %s, usageFlags = "
1116           "%s, imageCreateInfoPNext = 0x%016" PRIxPTR "",
1117           CID(context), GLenumToString(GLESEnum::TextureTarget, target), samples,
1118           GLenumToString(GLESEnum::AllEnums, internalFormat), width, height,
1119           GLbooleanToString(fixedSampleLocations), memory, static_cast<unsigned long long>(offset),
1120           GLbitfieldToString(GLESEnum::AllEnums, createFlags).c_str(),
1121           GLbitfieldToString(GLESEnum::AllEnums, usageFlags).c_str(),
1122           (uintptr_t)imageCreateInfoPNext);
1123 
1124     if (context)
1125     {
1126         TextureType targetPacked    = PackParam<TextureType>(target);
1127         MemoryObjectID memoryPacked = PackParam<MemoryObjectID>(memory);
1128         SCOPED_SHARE_CONTEXT_LOCK(context);
1129         bool isCallValid =
1130             (context->skipValidation() ||
1131              (ValidatePixelLocalStorageInactive(
1132                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
1133                   angle::EntryPoint::GLTexStorageMemFlags2DMultisampleANGLE) &&
1134               ValidateTexStorageMemFlags2DMultisampleANGLE(
1135                   context, angle::EntryPoint::GLTexStorageMemFlags2DMultisampleANGLE, targetPacked,
1136                   samples, internalFormat, width, height, fixedSampleLocations, memoryPacked,
1137                   offset, createFlags, usageFlags, imageCreateInfoPNext)));
1138         if (isCallValid)
1139         {
1140             context->texStorageMemFlags2DMultisample(
1141                 targetPacked, samples, internalFormat, width, height, fixedSampleLocations,
1142                 memoryPacked, offset, createFlags, usageFlags, imageCreateInfoPNext);
1143         }
1144         ANGLE_CAPTURE_GL(TexStorageMemFlags2DMultisampleANGLE, isCallValid, context, targetPacked,
1145                          samples, internalFormat, width, height, fixedSampleLocations, memoryPacked,
1146                          offset, createFlags, usageFlags, imageCreateInfoPNext);
1147     }
1148     else
1149     {
1150         GenerateContextLostErrorOnCurrentGlobalContext();
1151     }
1152     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1153 }
1154 
GL_TexStorageMemFlags3DANGLE(GLenum target,GLsizei levels,GLenum internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLuint memory,GLuint64 offset,GLbitfield createFlags,GLbitfield usageFlags,const void * imageCreateInfoPNext)1155 void GL_APIENTRY GL_TexStorageMemFlags3DANGLE(GLenum target,
1156                                               GLsizei levels,
1157                                               GLenum internalFormat,
1158                                               GLsizei width,
1159                                               GLsizei height,
1160                                               GLsizei depth,
1161                                               GLuint memory,
1162                                               GLuint64 offset,
1163                                               GLbitfield createFlags,
1164                                               GLbitfield usageFlags,
1165                                               const void *imageCreateInfoPNext)
1166 {
1167     Context *context = GetValidGlobalContext();
1168     EVENT(context, GLTexStorageMemFlags3DANGLE,
1169           "context = %d, target = %s, levels = %d, internalFormat = %s, width = %d, height = %d, "
1170           "depth = %d, memory = %u, offset = %llu, createFlags = %s, usageFlags = %s, "
1171           "imageCreateInfoPNext = 0x%016" PRIxPTR "",
1172           CID(context), GLenumToString(GLESEnum::TextureTarget, target), levels,
1173           GLenumToString(GLESEnum::AllEnums, internalFormat), width, height, depth, memory,
1174           static_cast<unsigned long long>(offset),
1175           GLbitfieldToString(GLESEnum::AllEnums, createFlags).c_str(),
1176           GLbitfieldToString(GLESEnum::AllEnums, usageFlags).c_str(),
1177           (uintptr_t)imageCreateInfoPNext);
1178 
1179     if (context)
1180     {
1181         TextureType targetPacked    = PackParam<TextureType>(target);
1182         MemoryObjectID memoryPacked = PackParam<MemoryObjectID>(memory);
1183         SCOPED_SHARE_CONTEXT_LOCK(context);
1184         bool isCallValid =
1185             (context->skipValidation() ||
1186              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1187                                                 context->getMutableErrorSetForValidation(),
1188                                                 angle::EntryPoint::GLTexStorageMemFlags3DANGLE) &&
1189               ValidateTexStorageMemFlags3DANGLE(
1190                   context, angle::EntryPoint::GLTexStorageMemFlags3DANGLE, targetPacked, levels,
1191                   internalFormat, width, height, depth, memoryPacked, offset, createFlags,
1192                   usageFlags, imageCreateInfoPNext)));
1193         if (isCallValid)
1194         {
1195             context->texStorageMemFlags3D(targetPacked, levels, internalFormat, width, height,
1196                                           depth, memoryPacked, offset, createFlags, usageFlags,
1197                                           imageCreateInfoPNext);
1198         }
1199         ANGLE_CAPTURE_GL(TexStorageMemFlags3DANGLE, isCallValid, context, targetPacked, levels,
1200                          internalFormat, width, height, depth, memoryPacked, offset, createFlags,
1201                          usageFlags, imageCreateInfoPNext);
1202     }
1203     else
1204     {
1205         GenerateContextLostErrorOnCurrentGlobalContext();
1206     }
1207     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1208 }
1209 
GL_TexStorageMemFlags3DMultisampleANGLE(GLenum target,GLsizei samples,GLenum internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLboolean fixedSampleLocations,GLuint memory,GLuint64 offset,GLbitfield createFlags,GLbitfield usageFlags,const void * imageCreateInfoPNext)1210 void GL_APIENTRY GL_TexStorageMemFlags3DMultisampleANGLE(GLenum target,
1211                                                          GLsizei samples,
1212                                                          GLenum internalFormat,
1213                                                          GLsizei width,
1214                                                          GLsizei height,
1215                                                          GLsizei depth,
1216                                                          GLboolean fixedSampleLocations,
1217                                                          GLuint memory,
1218                                                          GLuint64 offset,
1219                                                          GLbitfield createFlags,
1220                                                          GLbitfield usageFlags,
1221                                                          const void *imageCreateInfoPNext)
1222 {
1223     Context *context = GetValidGlobalContext();
1224     EVENT(context, GLTexStorageMemFlags3DMultisampleANGLE,
1225           "context = %d, target = %s, samples = %d, internalFormat = %s, width = %d, height = %d, "
1226           "depth = %d, fixedSampleLocations = %s, memory = %u, offset = %llu, createFlags = %s, "
1227           "usageFlags = %s, imageCreateInfoPNext = 0x%016" PRIxPTR "",
1228           CID(context), GLenumToString(GLESEnum::TextureTarget, target), samples,
1229           GLenumToString(GLESEnum::AllEnums, internalFormat), width, height, depth,
1230           GLbooleanToString(fixedSampleLocations), memory, static_cast<unsigned long long>(offset),
1231           GLbitfieldToString(GLESEnum::AllEnums, createFlags).c_str(),
1232           GLbitfieldToString(GLESEnum::AllEnums, usageFlags).c_str(),
1233           (uintptr_t)imageCreateInfoPNext);
1234 
1235     if (context)
1236     {
1237         TextureType targetPacked    = PackParam<TextureType>(target);
1238         MemoryObjectID memoryPacked = PackParam<MemoryObjectID>(memory);
1239         SCOPED_SHARE_CONTEXT_LOCK(context);
1240         bool isCallValid =
1241             (context->skipValidation() ||
1242              (ValidatePixelLocalStorageInactive(
1243                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
1244                   angle::EntryPoint::GLTexStorageMemFlags3DMultisampleANGLE) &&
1245               ValidateTexStorageMemFlags3DMultisampleANGLE(
1246                   context, angle::EntryPoint::GLTexStorageMemFlags3DMultisampleANGLE, targetPacked,
1247                   samples, internalFormat, width, height, depth, fixedSampleLocations, memoryPacked,
1248                   offset, createFlags, usageFlags, imageCreateInfoPNext)));
1249         if (isCallValid)
1250         {
1251             context->texStorageMemFlags3DMultisample(
1252                 targetPacked, samples, internalFormat, width, height, depth, fixedSampleLocations,
1253                 memoryPacked, offset, createFlags, usageFlags, imageCreateInfoPNext);
1254         }
1255         ANGLE_CAPTURE_GL(TexStorageMemFlags3DMultisampleANGLE, isCallValid, context, targetPacked,
1256                          samples, internalFormat, width, height, depth, fixedSampleLocations,
1257                          memoryPacked, offset, createFlags, usageFlags, imageCreateInfoPNext);
1258     }
1259     else
1260     {
1261         GenerateContextLostErrorOnCurrentGlobalContext();
1262     }
1263     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1264 }
1265 
1266 // GL_ANGLE_memory_object_fuchsia
GL_ImportMemoryZirconHandleANGLE(GLuint memory,GLuint64 size,GLenum handleType,GLuint handle)1267 void GL_APIENTRY GL_ImportMemoryZirconHandleANGLE(GLuint memory,
1268                                                   GLuint64 size,
1269                                                   GLenum handleType,
1270                                                   GLuint handle)
1271 {
1272     Context *context = GetValidGlobalContext();
1273     EVENT(context, GLImportMemoryZirconHandleANGLE,
1274           "context = %d, memory = %u, size = %llu, handleType = %s, handle = %u", CID(context),
1275           memory, static_cast<unsigned long long>(size),
1276           GLenumToString(GLESEnum::ExternalHandleType, handleType), handle);
1277 
1278     if (context)
1279     {
1280         MemoryObjectID memoryPacked = PackParam<MemoryObjectID>(memory);
1281         HandleType handleTypePacked = PackParam<HandleType>(handleType);
1282         SCOPED_SHARE_CONTEXT_LOCK(context);
1283         bool isCallValid =
1284             (context->skipValidation() ||
1285              (ValidatePixelLocalStorageInactive(
1286                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
1287                   angle::EntryPoint::GLImportMemoryZirconHandleANGLE) &&
1288               ValidateImportMemoryZirconHandleANGLE(
1289                   context, angle::EntryPoint::GLImportMemoryZirconHandleANGLE, memoryPacked, size,
1290                   handleTypePacked, handle)));
1291         if (isCallValid)
1292         {
1293             context->importMemoryZirconHandle(memoryPacked, size, handleTypePacked, handle);
1294         }
1295         ANGLE_CAPTURE_GL(ImportMemoryZirconHandleANGLE, isCallValid, context, memoryPacked, size,
1296                          handleTypePacked, handle);
1297     }
1298     else
1299     {
1300         GenerateContextLostErrorOnCurrentGlobalContext();
1301     }
1302     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1303 }
1304 
1305 // GL_ANGLE_multi_draw
GL_MultiDrawArraysANGLE(GLenum mode,const GLint * firsts,const GLsizei * counts,GLsizei drawcount)1306 void GL_APIENTRY GL_MultiDrawArraysANGLE(GLenum mode,
1307                                          const GLint *firsts,
1308                                          const GLsizei *counts,
1309                                          GLsizei drawcount)
1310 {
1311     Context *context = GetValidGlobalContext();
1312     EVENT(context, GLMultiDrawArraysANGLE,
1313           "context = %d, mode = %s, firsts = 0x%016" PRIxPTR ", counts = 0x%016" PRIxPTR
1314           ", drawcount = %d",
1315           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), (uintptr_t)firsts,
1316           (uintptr_t)counts, drawcount);
1317 
1318     if (context)
1319     {
1320         PrimitiveMode modePacked = PackParam<PrimitiveMode>(mode);
1321         SCOPED_SHARE_CONTEXT_LOCK(context);
1322         bool isCallValid =
1323             (context->skipValidation() ||
1324              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1325                                                 context->getMutableErrorSetForValidation(),
1326                                                 angle::EntryPoint::GLMultiDrawArraysANGLE) &&
1327               ValidateMultiDrawArraysANGLE(context, angle::EntryPoint::GLMultiDrawArraysANGLE,
1328                                            modePacked, firsts, counts, drawcount)));
1329         if (isCallValid)
1330         {
1331             context->multiDrawArrays(modePacked, firsts, counts, drawcount);
1332         }
1333         ANGLE_CAPTURE_GL(MultiDrawArraysANGLE, isCallValid, context, modePacked, firsts, counts,
1334                          drawcount);
1335     }
1336     else
1337     {
1338         GenerateContextLostErrorOnCurrentGlobalContext();
1339     }
1340     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1341 }
1342 
GL_MultiDrawArraysInstancedANGLE(GLenum mode,const GLint * firsts,const GLsizei * counts,const GLsizei * instanceCounts,GLsizei drawcount)1343 void GL_APIENTRY GL_MultiDrawArraysInstancedANGLE(GLenum mode,
1344                                                   const GLint *firsts,
1345                                                   const GLsizei *counts,
1346                                                   const GLsizei *instanceCounts,
1347                                                   GLsizei drawcount)
1348 {
1349     Context *context = GetValidGlobalContext();
1350     EVENT(context, GLMultiDrawArraysInstancedANGLE,
1351           "context = %d, mode = %s, firsts = 0x%016" PRIxPTR ", counts = 0x%016" PRIxPTR
1352           ", instanceCounts = 0x%016" PRIxPTR ", drawcount = %d",
1353           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), (uintptr_t)firsts,
1354           (uintptr_t)counts, (uintptr_t)instanceCounts, drawcount);
1355 
1356     if (context)
1357     {
1358         PrimitiveMode modePacked = PackParam<PrimitiveMode>(mode);
1359         SCOPED_SHARE_CONTEXT_LOCK(context);
1360         bool isCallValid =
1361             (context->skipValidation() ||
1362              (ValidatePixelLocalStorageInactive(
1363                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
1364                   angle::EntryPoint::GLMultiDrawArraysInstancedANGLE) &&
1365               ValidateMultiDrawArraysInstancedANGLE(
1366                   context, angle::EntryPoint::GLMultiDrawArraysInstancedANGLE, modePacked, firsts,
1367                   counts, instanceCounts, drawcount)));
1368         if (isCallValid)
1369         {
1370             context->multiDrawArraysInstanced(modePacked, firsts, counts, instanceCounts,
1371                                               drawcount);
1372         }
1373         ANGLE_CAPTURE_GL(MultiDrawArraysInstancedANGLE, isCallValid, context, modePacked, firsts,
1374                          counts, instanceCounts, drawcount);
1375     }
1376     else
1377     {
1378         GenerateContextLostErrorOnCurrentGlobalContext();
1379     }
1380     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1381 }
1382 
GL_MultiDrawElementsANGLE(GLenum mode,const GLsizei * counts,GLenum type,const void * const * indices,GLsizei drawcount)1383 void GL_APIENTRY GL_MultiDrawElementsANGLE(GLenum mode,
1384                                            const GLsizei *counts,
1385                                            GLenum type,
1386                                            const void *const *indices,
1387                                            GLsizei drawcount)
1388 {
1389     Context *context = GetValidGlobalContext();
1390     EVENT(context, GLMultiDrawElementsANGLE,
1391           "context = %d, mode = %s, counts = 0x%016" PRIxPTR ", type = %s, indices = 0x%016" PRIxPTR
1392           ", drawcount = %d",
1393           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), (uintptr_t)counts,
1394           GLenumToString(GLESEnum::DrawElementsType, type), (uintptr_t)indices, drawcount);
1395 
1396     if (context)
1397     {
1398         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
1399         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
1400         SCOPED_SHARE_CONTEXT_LOCK(context);
1401         bool isCallValid =
1402             (context->skipValidation() ||
1403              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1404                                                 context->getMutableErrorSetForValidation(),
1405                                                 angle::EntryPoint::GLMultiDrawElementsANGLE) &&
1406               ValidateMultiDrawElementsANGLE(context, angle::EntryPoint::GLMultiDrawElementsANGLE,
1407                                              modePacked, counts, typePacked, indices, drawcount)));
1408         if (isCallValid)
1409         {
1410             context->multiDrawElements(modePacked, counts, typePacked, indices, drawcount);
1411         }
1412         ANGLE_CAPTURE_GL(MultiDrawElementsANGLE, isCallValid, context, modePacked, counts,
1413                          typePacked, indices, drawcount);
1414     }
1415     else
1416     {
1417         GenerateContextLostErrorOnCurrentGlobalContext();
1418     }
1419     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1420 }
1421 
GL_MultiDrawElementsInstancedANGLE(GLenum mode,const GLsizei * counts,GLenum type,const void * const * indices,const GLsizei * instanceCounts,GLsizei drawcount)1422 void GL_APIENTRY GL_MultiDrawElementsInstancedANGLE(GLenum mode,
1423                                                     const GLsizei *counts,
1424                                                     GLenum type,
1425                                                     const void *const *indices,
1426                                                     const GLsizei *instanceCounts,
1427                                                     GLsizei drawcount)
1428 {
1429     Context *context = GetValidGlobalContext();
1430     EVENT(context, GLMultiDrawElementsInstancedANGLE,
1431           "context = %d, mode = %s, counts = 0x%016" PRIxPTR ", type = %s, indices = 0x%016" PRIxPTR
1432           ", instanceCounts = 0x%016" PRIxPTR ", drawcount = %d",
1433           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), (uintptr_t)counts,
1434           GLenumToString(GLESEnum::DrawElementsType, type), (uintptr_t)indices,
1435           (uintptr_t)instanceCounts, drawcount);
1436 
1437     if (context)
1438     {
1439         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
1440         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
1441         SCOPED_SHARE_CONTEXT_LOCK(context);
1442         bool isCallValid =
1443             (context->skipValidation() ||
1444              (ValidatePixelLocalStorageInactive(
1445                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
1446                   angle::EntryPoint::GLMultiDrawElementsInstancedANGLE) &&
1447               ValidateMultiDrawElementsInstancedANGLE(
1448                   context, angle::EntryPoint::GLMultiDrawElementsInstancedANGLE, modePacked, counts,
1449                   typePacked, indices, instanceCounts, drawcount)));
1450         if (isCallValid)
1451         {
1452             context->multiDrawElementsInstanced(modePacked, counts, typePacked, indices,
1453                                                 instanceCounts, drawcount);
1454         }
1455         ANGLE_CAPTURE_GL(MultiDrawElementsInstancedANGLE, isCallValid, context, modePacked, counts,
1456                          typePacked, indices, instanceCounts, drawcount);
1457     }
1458     else
1459     {
1460         GenerateContextLostErrorOnCurrentGlobalContext();
1461     }
1462     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1463 }
1464 
1465 // GL_ANGLE_pack_reverse_row_order
1466 
1467 // GL_ANGLE_polygon_mode
GL_PolygonModeANGLE(GLenum face,GLenum mode)1468 void GL_APIENTRY GL_PolygonModeANGLE(GLenum face, GLenum mode)
1469 {
1470     Context *context = GetValidGlobalContext();
1471     EVENT(context, GLPolygonModeANGLE, "context = %d, face = %s, mode = %s", CID(context),
1472           GLenumToString(GLESEnum::TriangleFace, face),
1473           GLenumToString(GLESEnum::PolygonMode, mode));
1474 
1475     if (context)
1476     {
1477         PolygonMode modePacked = PackParam<PolygonMode>(mode);
1478         bool isCallValid =
1479             (context->skipValidation() ||
1480              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1481                                                 context->getMutableErrorSetForValidation(),
1482                                                 angle::EntryPoint::GLPolygonModeANGLE) &&
1483               ValidatePolygonModeANGLE(context->getPrivateState(),
1484                                        context->getMutableErrorSetForValidation(),
1485                                        angle::EntryPoint::GLPolygonModeANGLE, face, modePacked)));
1486         if (isCallValid)
1487         {
1488             ContextPrivatePolygonMode(context->getMutablePrivateState(),
1489                                       context->getMutablePrivateStateCache(), face, modePacked);
1490         }
1491         ANGLE_CAPTURE_GL(PolygonModeANGLE, isCallValid, context, face, modePacked);
1492     }
1493     else
1494     {
1495         GenerateContextLostErrorOnCurrentGlobalContext();
1496     }
1497     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1498 }
1499 
1500 // GL_ANGLE_program_binary
1501 
1502 // GL_ANGLE_provoking_vertex
GL_ProvokingVertexANGLE(GLenum provokeMode)1503 void GL_APIENTRY GL_ProvokingVertexANGLE(GLenum provokeMode)
1504 {
1505     Context *context = GetValidGlobalContext();
1506     EVENT(context, GLProvokingVertexANGLE, "context = %d, provokeMode = %s", CID(context),
1507           GLenumToString(GLESEnum::VertexProvokingMode, provokeMode));
1508 
1509     if (context)
1510     {
1511         ProvokingVertexConvention provokeModePacked =
1512             PackParam<ProvokingVertexConvention>(provokeMode);
1513         bool isCallValid =
1514             (context->skipValidation() ||
1515              ValidateProvokingVertexANGLE(
1516                  context->getPrivateState(), context->getMutableErrorSetForValidation(),
1517                  angle::EntryPoint::GLProvokingVertexANGLE, provokeModePacked));
1518         if (isCallValid)
1519         {
1520             ContextPrivateProvokingVertex(context->getMutablePrivateState(),
1521                                           context->getMutablePrivateStateCache(),
1522                                           provokeModePacked);
1523         }
1524         ANGLE_CAPTURE_GL(ProvokingVertexANGLE, isCallValid, context, provokeModePacked);
1525     }
1526     else
1527     {
1528         GenerateContextLostErrorOnCurrentGlobalContext();
1529     }
1530     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1531 }
1532 
1533 // GL_ANGLE_renderability_validation
1534 
1535 // GL_ANGLE_request_extension
GL_RequestExtensionANGLE(const GLchar * name)1536 void GL_APIENTRY GL_RequestExtensionANGLE(const GLchar *name)
1537 {
1538     Context *context = GetValidGlobalContext();
1539     EVENT(context, GLRequestExtensionANGLE, "context = %d, name = 0x%016" PRIxPTR "", CID(context),
1540           (uintptr_t)name);
1541 
1542     if (context)
1543     {
1544         SCOPED_SHARE_CONTEXT_LOCK(context);
1545         bool isCallValid =
1546             (context->skipValidation() ||
1547              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1548                                                 context->getMutableErrorSetForValidation(),
1549                                                 angle::EntryPoint::GLRequestExtensionANGLE) &&
1550               ValidateRequestExtensionANGLE(context, angle::EntryPoint::GLRequestExtensionANGLE,
1551                                             name)));
1552         if (isCallValid)
1553         {
1554             context->requestExtension(name);
1555         }
1556         ANGLE_CAPTURE_GL(RequestExtensionANGLE, isCallValid, context, name);
1557     }
1558     else
1559     {
1560         GenerateContextLostErrorOnCurrentGlobalContext();
1561     }
1562     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1563 }
1564 
GL_DisableExtensionANGLE(const GLchar * name)1565 void GL_APIENTRY GL_DisableExtensionANGLE(const GLchar *name)
1566 {
1567     Context *context = GetValidGlobalContext();
1568     EVENT(context, GLDisableExtensionANGLE, "context = %d, name = 0x%016" PRIxPTR "", CID(context),
1569           (uintptr_t)name);
1570 
1571     if (context)
1572     {
1573         SCOPED_SHARE_CONTEXT_LOCK(context);
1574         bool isCallValid =
1575             (context->skipValidation() ||
1576              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1577                                                 context->getMutableErrorSetForValidation(),
1578                                                 angle::EntryPoint::GLDisableExtensionANGLE) &&
1579               ValidateDisableExtensionANGLE(context, angle::EntryPoint::GLDisableExtensionANGLE,
1580                                             name)));
1581         if (isCallValid)
1582         {
1583             context->disableExtension(name);
1584         }
1585         ANGLE_CAPTURE_GL(DisableExtensionANGLE, isCallValid, context, name);
1586     }
1587     else
1588     {
1589         GenerateContextLostErrorOnCurrentGlobalContext();
1590     }
1591     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1592 }
1593 
1594 // GL_ANGLE_robust_client_memory
GL_GetBooleanvRobustANGLE(GLenum pname,GLsizei bufSize,GLsizei * length,GLboolean * params)1595 void GL_APIENTRY GL_GetBooleanvRobustANGLE(GLenum pname,
1596                                            GLsizei bufSize,
1597                                            GLsizei *length,
1598                                            GLboolean *params)
1599 {
1600     Context *context = GetValidGlobalContext();
1601     EVENT(context, GLGetBooleanvRobustANGLE,
1602           "context = %d, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1603           ", params = 0x%016" PRIxPTR "",
1604           CID(context), GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length,
1605           (uintptr_t)params);
1606 
1607     if (context)
1608     {
1609         SCOPED_SHARE_CONTEXT_LOCK(context);
1610         bool isCallValid =
1611             (context->skipValidation() ||
1612              ValidateGetBooleanvRobustANGLE(context, angle::EntryPoint::GLGetBooleanvRobustANGLE,
1613                                             pname, bufSize, length, params));
1614         if (isCallValid)
1615         {
1616             context->getBooleanvRobust(pname, bufSize, length, params);
1617         }
1618         ANGLE_CAPTURE_GL(GetBooleanvRobustANGLE, isCallValid, context, pname, bufSize, length,
1619                          params);
1620     }
1621     else
1622     {
1623         GenerateContextLostErrorOnCurrentGlobalContext();
1624     }
1625     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1626 }
1627 
GL_GetBufferParameterivRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)1628 void GL_APIENTRY GL_GetBufferParameterivRobustANGLE(GLenum target,
1629                                                     GLenum pname,
1630                                                     GLsizei bufSize,
1631                                                     GLsizei *length,
1632                                                     GLint *params)
1633 {
1634     Context *context = GetValidGlobalContext();
1635     EVENT(context, GLGetBufferParameterivRobustANGLE,
1636           "context = %d, target = %s, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1637           ", params = 0x%016" PRIxPTR "",
1638           CID(context), GLenumToString(GLESEnum::AllEnums, target),
1639           GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length, (uintptr_t)params);
1640 
1641     if (context)
1642     {
1643         BufferBinding targetPacked = PackParam<BufferBinding>(target);
1644         SCOPED_SHARE_CONTEXT_LOCK(context);
1645         bool isCallValid = (context->skipValidation() ||
1646                             ValidateGetBufferParameterivRobustANGLE(
1647                                 context, angle::EntryPoint::GLGetBufferParameterivRobustANGLE,
1648                                 targetPacked, pname, bufSize, length, params));
1649         if (isCallValid)
1650         {
1651             context->getBufferParameterivRobust(targetPacked, pname, bufSize, length, params);
1652         }
1653         ANGLE_CAPTURE_GL(GetBufferParameterivRobustANGLE, isCallValid, context, targetPacked, pname,
1654                          bufSize, length, params);
1655     }
1656     else
1657     {
1658         GenerateContextLostErrorOnCurrentGlobalContext();
1659     }
1660     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1661 }
1662 
GL_GetFloatvRobustANGLE(GLenum pname,GLsizei bufSize,GLsizei * length,GLfloat * params)1663 void GL_APIENTRY GL_GetFloatvRobustANGLE(GLenum pname,
1664                                          GLsizei bufSize,
1665                                          GLsizei *length,
1666                                          GLfloat *params)
1667 {
1668     Context *context = GetValidGlobalContext();
1669     EVENT(context, GLGetFloatvRobustANGLE,
1670           "context = %d, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1671           ", params = 0x%016" PRIxPTR "",
1672           CID(context), GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length,
1673           (uintptr_t)params);
1674 
1675     if (context)
1676     {
1677         SCOPED_SHARE_CONTEXT_LOCK(context);
1678         bool isCallValid =
1679             (context->skipValidation() ||
1680              ValidateGetFloatvRobustANGLE(context, angle::EntryPoint::GLGetFloatvRobustANGLE, pname,
1681                                           bufSize, length, params));
1682         if (isCallValid)
1683         {
1684             context->getFloatvRobust(pname, bufSize, length, params);
1685         }
1686         ANGLE_CAPTURE_GL(GetFloatvRobustANGLE, isCallValid, context, pname, bufSize, length,
1687                          params);
1688     }
1689     else
1690     {
1691         GenerateContextLostErrorOnCurrentGlobalContext();
1692     }
1693     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1694 }
1695 
GL_GetFramebufferAttachmentParameterivRobustANGLE(GLenum target,GLenum attachment,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)1696 void GL_APIENTRY GL_GetFramebufferAttachmentParameterivRobustANGLE(GLenum target,
1697                                                                    GLenum attachment,
1698                                                                    GLenum pname,
1699                                                                    GLsizei bufSize,
1700                                                                    GLsizei *length,
1701                                                                    GLint *params)
1702 {
1703     Context *context = GetValidGlobalContext();
1704     EVENT(context, GLGetFramebufferAttachmentParameterivRobustANGLE,
1705           "context = %d, target = %s, attachment = %s, pname = %s, bufSize = %d, length = "
1706           "0x%016" PRIxPTR ", params = 0x%016" PRIxPTR "",
1707           CID(context), GLenumToString(GLESEnum::AllEnums, target),
1708           GLenumToString(GLESEnum::AllEnums, attachment), GLenumToString(GLESEnum::AllEnums, pname),
1709           bufSize, (uintptr_t)length, (uintptr_t)params);
1710 
1711     if (context)
1712     {
1713         SCOPED_SHARE_CONTEXT_LOCK(context);
1714         bool isCallValid =
1715             (context->skipValidation() ||
1716              ValidateGetFramebufferAttachmentParameterivRobustANGLE(
1717                  context, angle::EntryPoint::GLGetFramebufferAttachmentParameterivRobustANGLE,
1718                  target, attachment, pname, bufSize, length, params));
1719         if (isCallValid)
1720         {
1721             context->getFramebufferAttachmentParameterivRobust(target, attachment, pname, bufSize,
1722                                                                length, params);
1723         }
1724         ANGLE_CAPTURE_GL(GetFramebufferAttachmentParameterivRobustANGLE, isCallValid, context,
1725                          target, attachment, pname, bufSize, length, params);
1726     }
1727     else
1728     {
1729         GenerateContextLostErrorOnCurrentGlobalContext();
1730     }
1731     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1732 }
1733 
GL_GetIntegervRobustANGLE(GLenum pname,GLsizei bufSize,GLsizei * length,GLint * data)1734 void GL_APIENTRY GL_GetIntegervRobustANGLE(GLenum pname,
1735                                            GLsizei bufSize,
1736                                            GLsizei *length,
1737                                            GLint *data)
1738 {
1739     Context *context = GetValidGlobalContext();
1740     EVENT(context, GLGetIntegervRobustANGLE,
1741           "context = %d, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1742           ", data = 0x%016" PRIxPTR "",
1743           CID(context), GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length,
1744           (uintptr_t)data);
1745 
1746     if (context)
1747     {
1748         SCOPED_SHARE_CONTEXT_LOCK(context);
1749         bool isCallValid =
1750             (context->skipValidation() ||
1751              ValidateGetIntegervRobustANGLE(context, angle::EntryPoint::GLGetIntegervRobustANGLE,
1752                                             pname, bufSize, length, data));
1753         if (isCallValid)
1754         {
1755             context->getIntegervRobust(pname, bufSize, length, data);
1756         }
1757         ANGLE_CAPTURE_GL(GetIntegervRobustANGLE, isCallValid, context, pname, bufSize, length,
1758                          data);
1759     }
1760     else
1761     {
1762         GenerateContextLostErrorOnCurrentGlobalContext();
1763     }
1764     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1765 }
1766 
GL_GetProgramivRobustANGLE(GLuint program,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)1767 void GL_APIENTRY GL_GetProgramivRobustANGLE(GLuint program,
1768                                             GLenum pname,
1769                                             GLsizei bufSize,
1770                                             GLsizei *length,
1771                                             GLint *params)
1772 {
1773     Context *context = GetGlobalContext();
1774     EVENT(context, GLGetProgramivRobustANGLE,
1775           "context = %d, program = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1776           ", params = 0x%016" PRIxPTR "",
1777           CID(context), program, GLenumToString(GLESEnum::AllEnums, pname), bufSize,
1778           (uintptr_t)length, (uintptr_t)params);
1779 
1780     if (context)
1781     {
1782         ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
1783         SCOPED_SHARE_CONTEXT_LOCK(context);
1784         bool isCallValid =
1785             (context->skipValidation() ||
1786              ValidateGetProgramivRobustANGLE(context, angle::EntryPoint::GLGetProgramivRobustANGLE,
1787                                              programPacked, pname, bufSize, length, params));
1788         if (isCallValid)
1789         {
1790             context->getProgramivRobust(programPacked, pname, bufSize, length, params);
1791         }
1792         ANGLE_CAPTURE_GL(GetProgramivRobustANGLE, isCallValid, context, programPacked, pname,
1793                          bufSize, length, params);
1794     }
1795     else
1796     {
1797     }
1798     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1799 }
1800 
GL_GetRenderbufferParameterivRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)1801 void GL_APIENTRY GL_GetRenderbufferParameterivRobustANGLE(GLenum target,
1802                                                           GLenum pname,
1803                                                           GLsizei bufSize,
1804                                                           GLsizei *length,
1805                                                           GLint *params)
1806 {
1807     Context *context = GetValidGlobalContext();
1808     EVENT(context, GLGetRenderbufferParameterivRobustANGLE,
1809           "context = %d, target = %s, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1810           ", params = 0x%016" PRIxPTR "",
1811           CID(context), GLenumToString(GLESEnum::AllEnums, target),
1812           GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length, (uintptr_t)params);
1813 
1814     if (context)
1815     {
1816         SCOPED_SHARE_CONTEXT_LOCK(context);
1817         bool isCallValid = (context->skipValidation() ||
1818                             ValidateGetRenderbufferParameterivRobustANGLE(
1819                                 context, angle::EntryPoint::GLGetRenderbufferParameterivRobustANGLE,
1820                                 target, pname, bufSize, length, params));
1821         if (isCallValid)
1822         {
1823             context->getRenderbufferParameterivRobust(target, pname, bufSize, length, params);
1824         }
1825         ANGLE_CAPTURE_GL(GetRenderbufferParameterivRobustANGLE, isCallValid, context, target, pname,
1826                          bufSize, length, params);
1827     }
1828     else
1829     {
1830         GenerateContextLostErrorOnCurrentGlobalContext();
1831     }
1832     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1833 }
1834 
GL_GetShaderivRobustANGLE(GLuint shader,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)1835 void GL_APIENTRY GL_GetShaderivRobustANGLE(GLuint shader,
1836                                            GLenum pname,
1837                                            GLsizei bufSize,
1838                                            GLsizei *length,
1839                                            GLint *params)
1840 {
1841     Context *context = GetGlobalContext();
1842     EVENT(context, GLGetShaderivRobustANGLE,
1843           "context = %d, shader = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1844           ", params = 0x%016" PRIxPTR "",
1845           CID(context), shader, GLenumToString(GLESEnum::AllEnums, pname), bufSize,
1846           (uintptr_t)length, (uintptr_t)params);
1847 
1848     if (context)
1849     {
1850         ShaderProgramID shaderPacked = PackParam<ShaderProgramID>(shader);
1851         SCOPED_SHARE_CONTEXT_LOCK(context);
1852         bool isCallValid =
1853             (context->skipValidation() ||
1854              ValidateGetShaderivRobustANGLE(context, angle::EntryPoint::GLGetShaderivRobustANGLE,
1855                                             shaderPacked, pname, bufSize, length, params));
1856         if (isCallValid)
1857         {
1858             context->getShaderivRobust(shaderPacked, pname, bufSize, length, params);
1859         }
1860         ANGLE_CAPTURE_GL(GetShaderivRobustANGLE, isCallValid, context, shaderPacked, pname, bufSize,
1861                          length, params);
1862     }
1863     else
1864     {
1865     }
1866     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1867 }
1868 
GL_GetTexParameterfvRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,GLsizei * length,GLfloat * params)1869 void GL_APIENTRY GL_GetTexParameterfvRobustANGLE(GLenum target,
1870                                                  GLenum pname,
1871                                                  GLsizei bufSize,
1872                                                  GLsizei *length,
1873                                                  GLfloat *params)
1874 {
1875     Context *context = GetValidGlobalContext();
1876     EVENT(context, GLGetTexParameterfvRobustANGLE,
1877           "context = %d, target = %s, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1878           ", params = 0x%016" PRIxPTR "",
1879           CID(context), GLenumToString(GLESEnum::AllEnums, target),
1880           GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length, (uintptr_t)params);
1881 
1882     if (context)
1883     {
1884         TextureType targetPacked = PackParam<TextureType>(target);
1885         SCOPED_SHARE_CONTEXT_LOCK(context);
1886         bool isCallValid = (context->skipValidation() ||
1887                             ValidateGetTexParameterfvRobustANGLE(
1888                                 context, angle::EntryPoint::GLGetTexParameterfvRobustANGLE,
1889                                 targetPacked, pname, bufSize, length, params));
1890         if (isCallValid)
1891         {
1892             context->getTexParameterfvRobust(targetPacked, pname, bufSize, length, params);
1893         }
1894         ANGLE_CAPTURE_GL(GetTexParameterfvRobustANGLE, isCallValid, context, targetPacked, pname,
1895                          bufSize, length, params);
1896     }
1897     else
1898     {
1899         GenerateContextLostErrorOnCurrentGlobalContext();
1900     }
1901     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1902 }
1903 
GL_GetTexParameterivRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)1904 void GL_APIENTRY GL_GetTexParameterivRobustANGLE(GLenum target,
1905                                                  GLenum pname,
1906                                                  GLsizei bufSize,
1907                                                  GLsizei *length,
1908                                                  GLint *params)
1909 {
1910     Context *context = GetValidGlobalContext();
1911     EVENT(context, GLGetTexParameterivRobustANGLE,
1912           "context = %d, target = %s, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
1913           ", params = 0x%016" PRIxPTR "",
1914           CID(context), GLenumToString(GLESEnum::AllEnums, target),
1915           GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length, (uintptr_t)params);
1916 
1917     if (context)
1918     {
1919         TextureType targetPacked = PackParam<TextureType>(target);
1920         SCOPED_SHARE_CONTEXT_LOCK(context);
1921         bool isCallValid = (context->skipValidation() ||
1922                             ValidateGetTexParameterivRobustANGLE(
1923                                 context, angle::EntryPoint::GLGetTexParameterivRobustANGLE,
1924                                 targetPacked, pname, bufSize, length, params));
1925         if (isCallValid)
1926         {
1927             context->getTexParameterivRobust(targetPacked, pname, bufSize, length, params);
1928         }
1929         ANGLE_CAPTURE_GL(GetTexParameterivRobustANGLE, isCallValid, context, targetPacked, pname,
1930                          bufSize, length, params);
1931     }
1932     else
1933     {
1934         GenerateContextLostErrorOnCurrentGlobalContext();
1935     }
1936     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1937 }
1938 
GL_GetUniformfvRobustANGLE(GLuint program,GLint location,GLsizei bufSize,GLsizei * length,GLfloat * params)1939 void GL_APIENTRY GL_GetUniformfvRobustANGLE(GLuint program,
1940                                             GLint location,
1941                                             GLsizei bufSize,
1942                                             GLsizei *length,
1943                                             GLfloat *params)
1944 {
1945     Context *context = GetValidGlobalContext();
1946     EVENT(context, GLGetUniformfvRobustANGLE,
1947           "context = %d, program = %u, location = %d, bufSize = %d, length = 0x%016" PRIxPTR
1948           ", params = 0x%016" PRIxPTR "",
1949           CID(context), program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
1950 
1951     if (context)
1952     {
1953         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1954         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1955         SCOPED_SHARE_CONTEXT_LOCK(context);
1956         bool isCallValid = (context->skipValidation() ||
1957                             ValidateGetUniformfvRobustANGLE(
1958                                 context, angle::EntryPoint::GLGetUniformfvRobustANGLE,
1959                                 programPacked, locationPacked, bufSize, length, params));
1960         if (isCallValid)
1961         {
1962             context->getUniformfvRobust(programPacked, locationPacked, bufSize, length, params);
1963         }
1964         ANGLE_CAPTURE_GL(GetUniformfvRobustANGLE, isCallValid, context, programPacked,
1965                          locationPacked, bufSize, length, params);
1966     }
1967     else
1968     {
1969         GenerateContextLostErrorOnCurrentGlobalContext();
1970     }
1971     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1972 }
1973 
GL_GetUniformivRobustANGLE(GLuint program,GLint location,GLsizei bufSize,GLsizei * length,GLint * params)1974 void GL_APIENTRY GL_GetUniformivRobustANGLE(GLuint program,
1975                                             GLint location,
1976                                             GLsizei bufSize,
1977                                             GLsizei *length,
1978                                             GLint *params)
1979 {
1980     Context *context = GetValidGlobalContext();
1981     EVENT(context, GLGetUniformivRobustANGLE,
1982           "context = %d, program = %u, location = %d, bufSize = %d, length = 0x%016" PRIxPTR
1983           ", params = 0x%016" PRIxPTR "",
1984           CID(context), program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
1985 
1986     if (context)
1987     {
1988         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
1989         UniformLocation locationPacked = PackParam<UniformLocation>(location);
1990         SCOPED_SHARE_CONTEXT_LOCK(context);
1991         bool isCallValid = (context->skipValidation() ||
1992                             ValidateGetUniformivRobustANGLE(
1993                                 context, angle::EntryPoint::GLGetUniformivRobustANGLE,
1994                                 programPacked, locationPacked, bufSize, length, params));
1995         if (isCallValid)
1996         {
1997             context->getUniformivRobust(programPacked, locationPacked, bufSize, length, params);
1998         }
1999         ANGLE_CAPTURE_GL(GetUniformivRobustANGLE, isCallValid, context, programPacked,
2000                          locationPacked, bufSize, length, params);
2001     }
2002     else
2003     {
2004         GenerateContextLostErrorOnCurrentGlobalContext();
2005     }
2006     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2007 }
2008 
GL_GetVertexAttribfvRobustANGLE(GLuint index,GLenum pname,GLsizei bufSize,GLsizei * length,GLfloat * params)2009 void GL_APIENTRY GL_GetVertexAttribfvRobustANGLE(GLuint index,
2010                                                  GLenum pname,
2011                                                  GLsizei bufSize,
2012                                                  GLsizei *length,
2013                                                  GLfloat *params)
2014 {
2015     Context *context = GetValidGlobalContext();
2016     EVENT(context, GLGetVertexAttribfvRobustANGLE,
2017           "context = %d, index = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2018           ", params = 0x%016" PRIxPTR "",
2019           CID(context), index, GLenumToString(GLESEnum::AllEnums, pname), bufSize,
2020           (uintptr_t)length, (uintptr_t)params);
2021 
2022     if (context)
2023     {
2024         SCOPED_SHARE_CONTEXT_LOCK(context);
2025         bool isCallValid = (context->skipValidation() ||
2026                             ValidateGetVertexAttribfvRobustANGLE(
2027                                 context, angle::EntryPoint::GLGetVertexAttribfvRobustANGLE, index,
2028                                 pname, bufSize, length, params));
2029         if (isCallValid)
2030         {
2031             context->getVertexAttribfvRobust(index, pname, bufSize, length, params);
2032         }
2033         ANGLE_CAPTURE_GL(GetVertexAttribfvRobustANGLE, isCallValid, context, index, pname, bufSize,
2034                          length, params);
2035     }
2036     else
2037     {
2038         GenerateContextLostErrorOnCurrentGlobalContext();
2039     }
2040     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2041 }
2042 
GL_GetVertexAttribivRobustANGLE(GLuint index,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)2043 void GL_APIENTRY GL_GetVertexAttribivRobustANGLE(GLuint index,
2044                                                  GLenum pname,
2045                                                  GLsizei bufSize,
2046                                                  GLsizei *length,
2047                                                  GLint *params)
2048 {
2049     Context *context = GetValidGlobalContext();
2050     EVENT(context, GLGetVertexAttribivRobustANGLE,
2051           "context = %d, index = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2052           ", params = 0x%016" PRIxPTR "",
2053           CID(context), index, GLenumToString(GLESEnum::AllEnums, pname), bufSize,
2054           (uintptr_t)length, (uintptr_t)params);
2055 
2056     if (context)
2057     {
2058         SCOPED_SHARE_CONTEXT_LOCK(context);
2059         bool isCallValid = (context->skipValidation() ||
2060                             ValidateGetVertexAttribivRobustANGLE(
2061                                 context, angle::EntryPoint::GLGetVertexAttribivRobustANGLE, index,
2062                                 pname, bufSize, length, params));
2063         if (isCallValid)
2064         {
2065             context->getVertexAttribivRobust(index, pname, bufSize, length, params);
2066         }
2067         ANGLE_CAPTURE_GL(GetVertexAttribivRobustANGLE, isCallValid, context, index, pname, bufSize,
2068                          length, params);
2069     }
2070     else
2071     {
2072         GenerateContextLostErrorOnCurrentGlobalContext();
2073     }
2074     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2075 }
2076 
GL_GetVertexAttribPointervRobustANGLE(GLuint index,GLenum pname,GLsizei bufSize,GLsizei * length,void ** pointer)2077 void GL_APIENTRY GL_GetVertexAttribPointervRobustANGLE(GLuint index,
2078                                                        GLenum pname,
2079                                                        GLsizei bufSize,
2080                                                        GLsizei *length,
2081                                                        void **pointer)
2082 {
2083     Context *context = GetValidGlobalContext();
2084     EVENT(context, GLGetVertexAttribPointervRobustANGLE,
2085           "context = %d, index = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2086           ", pointer = 0x%016" PRIxPTR "",
2087           CID(context), index, GLenumToString(GLESEnum::AllEnums, pname), bufSize,
2088           (uintptr_t)length, (uintptr_t)pointer);
2089 
2090     if (context)
2091     {
2092         SCOPED_SHARE_CONTEXT_LOCK(context);
2093         bool isCallValid = (context->skipValidation() ||
2094                             ValidateGetVertexAttribPointervRobustANGLE(
2095                                 context, angle::EntryPoint::GLGetVertexAttribPointervRobustANGLE,
2096                                 index, pname, bufSize, length, pointer));
2097         if (isCallValid)
2098         {
2099             context->getVertexAttribPointervRobust(index, pname, bufSize, length, pointer);
2100         }
2101         ANGLE_CAPTURE_GL(GetVertexAttribPointervRobustANGLE, isCallValid, context, index, pname,
2102                          bufSize, length, pointer);
2103     }
2104     else
2105     {
2106         GenerateContextLostErrorOnCurrentGlobalContext();
2107     }
2108     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2109 }
2110 
GL_ReadPixelsRobustANGLE(GLint x,GLint y,GLsizei width,GLsizei height,GLenum format,GLenum type,GLsizei bufSize,GLsizei * length,GLsizei * columns,GLsizei * rows,void * pixels)2111 void GL_APIENTRY GL_ReadPixelsRobustANGLE(GLint x,
2112                                           GLint y,
2113                                           GLsizei width,
2114                                           GLsizei height,
2115                                           GLenum format,
2116                                           GLenum type,
2117                                           GLsizei bufSize,
2118                                           GLsizei *length,
2119                                           GLsizei *columns,
2120                                           GLsizei *rows,
2121                                           void *pixels)
2122 {
2123     Context *context = GetValidGlobalContext();
2124     EVENT(context, GLReadPixelsRobustANGLE,
2125           "context = %d, x = %d, y = %d, width = %d, height = %d, format = %s, type = %s, bufSize "
2126           "= %d, length = 0x%016" PRIxPTR ", columns = 0x%016" PRIxPTR ", rows = 0x%016" PRIxPTR
2127           ", pixels = 0x%016" PRIxPTR "",
2128           CID(context), x, y, width, height, GLenumToString(GLESEnum::AllEnums, format),
2129           GLenumToString(GLESEnum::AllEnums, type), bufSize, (uintptr_t)length, (uintptr_t)columns,
2130           (uintptr_t)rows, (uintptr_t)pixels);
2131 
2132     if (context)
2133     {
2134         SCOPED_SHARE_CONTEXT_LOCK(context);
2135         bool isCallValid =
2136             (context->skipValidation() ||
2137              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
2138                                                 context->getMutableErrorSetForValidation(),
2139                                                 angle::EntryPoint::GLReadPixelsRobustANGLE) &&
2140               ValidateReadPixelsRobustANGLE(context, angle::EntryPoint::GLReadPixelsRobustANGLE, x,
2141                                             y, width, height, format, type, bufSize, length,
2142                                             columns, rows, pixels)));
2143         if (isCallValid)
2144         {
2145             context->readPixelsRobust(x, y, width, height, format, type, bufSize, length, columns,
2146                                       rows, pixels);
2147         }
2148         ANGLE_CAPTURE_GL(ReadPixelsRobustANGLE, isCallValid, context, x, y, width, height, format,
2149                          type, bufSize, length, columns, rows, pixels);
2150     }
2151     else
2152     {
2153         GenerateContextLostErrorOnCurrentGlobalContext();
2154     }
2155     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2156 }
2157 
GL_TexImage2DRobustANGLE(GLenum target,GLint level,GLint internalformat,GLsizei width,GLsizei height,GLint border,GLenum format,GLenum type,GLsizei bufSize,const void * pixels)2158 void GL_APIENTRY GL_TexImage2DRobustANGLE(GLenum target,
2159                                           GLint level,
2160                                           GLint internalformat,
2161                                           GLsizei width,
2162                                           GLsizei height,
2163                                           GLint border,
2164                                           GLenum format,
2165                                           GLenum type,
2166                                           GLsizei bufSize,
2167                                           const void *pixels)
2168 {
2169     Context *context = GetValidGlobalContext();
2170     EVENT(context, GLTexImage2DRobustANGLE,
2171           "context = %d, target = %s, level = %d, internalformat = %d, width = %d, height = %d, "
2172           "border = %d, format = %s, type = %s, bufSize = %d, pixels = 0x%016" PRIxPTR "",
2173           CID(context), GLenumToString(GLESEnum::AllEnums, target), level, internalformat, width,
2174           height, border, GLenumToString(GLESEnum::AllEnums, format),
2175           GLenumToString(GLESEnum::AllEnums, type), bufSize, (uintptr_t)pixels);
2176 
2177     if (context)
2178     {
2179         TextureTarget targetPacked = PackParam<TextureTarget>(target);
2180         SCOPED_SHARE_CONTEXT_LOCK(context);
2181         bool isCallValid =
2182             (context->skipValidation() ||
2183              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
2184                                                 context->getMutableErrorSetForValidation(),
2185                                                 angle::EntryPoint::GLTexImage2DRobustANGLE) &&
2186               ValidateTexImage2DRobustANGLE(context, angle::EntryPoint::GLTexImage2DRobustANGLE,
2187                                             targetPacked, level, internalformat, width, height,
2188                                             border, format, type, bufSize, pixels)));
2189         if (isCallValid)
2190         {
2191             context->texImage2DRobust(targetPacked, level, internalformat, width, height, border,
2192                                       format, type, bufSize, pixels);
2193         }
2194         ANGLE_CAPTURE_GL(TexImage2DRobustANGLE, isCallValid, context, targetPacked, level,
2195                          internalformat, width, height, border, format, type, bufSize, pixels);
2196     }
2197     else
2198     {
2199         GenerateContextLostErrorOnCurrentGlobalContext();
2200     }
2201     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2202 }
2203 
GL_TexParameterfvRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,const GLfloat * params)2204 void GL_APIENTRY GL_TexParameterfvRobustANGLE(GLenum target,
2205                                               GLenum pname,
2206                                               GLsizei bufSize,
2207                                               const GLfloat *params)
2208 {
2209     Context *context = GetValidGlobalContext();
2210     EVENT(context, GLTexParameterfvRobustANGLE,
2211           "context = %d, target = %s, pname = %s, bufSize = %d, params = 0x%016" PRIxPTR "",
2212           CID(context), GLenumToString(GLESEnum::AllEnums, target),
2213           GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)params);
2214 
2215     if (context)
2216     {
2217         TextureType targetPacked = PackParam<TextureType>(target);
2218         SCOPED_SHARE_CONTEXT_LOCK(context);
2219         bool isCallValid = (context->skipValidation() ||
2220                             ValidateTexParameterfvRobustANGLE(
2221                                 context, angle::EntryPoint::GLTexParameterfvRobustANGLE,
2222                                 targetPacked, pname, bufSize, params));
2223         if (isCallValid)
2224         {
2225             context->texParameterfvRobust(targetPacked, pname, bufSize, params);
2226         }
2227         ANGLE_CAPTURE_GL(TexParameterfvRobustANGLE, isCallValid, context, targetPacked, pname,
2228                          bufSize, params);
2229     }
2230     else
2231     {
2232         GenerateContextLostErrorOnCurrentGlobalContext();
2233     }
2234     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2235 }
2236 
GL_TexParameterivRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,const GLint * params)2237 void GL_APIENTRY GL_TexParameterivRobustANGLE(GLenum target,
2238                                               GLenum pname,
2239                                               GLsizei bufSize,
2240                                               const GLint *params)
2241 {
2242     Context *context = GetValidGlobalContext();
2243     EVENT(context, GLTexParameterivRobustANGLE,
2244           "context = %d, target = %s, pname = %s, bufSize = %d, params = 0x%016" PRIxPTR "",
2245           CID(context), GLenumToString(GLESEnum::AllEnums, target),
2246           GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)params);
2247 
2248     if (context)
2249     {
2250         TextureType targetPacked = PackParam<TextureType>(target);
2251         SCOPED_SHARE_CONTEXT_LOCK(context);
2252         bool isCallValid = (context->skipValidation() ||
2253                             ValidateTexParameterivRobustANGLE(
2254                                 context, angle::EntryPoint::GLTexParameterivRobustANGLE,
2255                                 targetPacked, pname, bufSize, params));
2256         if (isCallValid)
2257         {
2258             context->texParameterivRobust(targetPacked, pname, bufSize, params);
2259         }
2260         ANGLE_CAPTURE_GL(TexParameterivRobustANGLE, isCallValid, context, targetPacked, pname,
2261                          bufSize, params);
2262     }
2263     else
2264     {
2265         GenerateContextLostErrorOnCurrentGlobalContext();
2266     }
2267     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2268 }
2269 
GL_TexSubImage2DRobustANGLE(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLenum type,GLsizei bufSize,const void * pixels)2270 void GL_APIENTRY GL_TexSubImage2DRobustANGLE(GLenum target,
2271                                              GLint level,
2272                                              GLint xoffset,
2273                                              GLint yoffset,
2274                                              GLsizei width,
2275                                              GLsizei height,
2276                                              GLenum format,
2277                                              GLenum type,
2278                                              GLsizei bufSize,
2279                                              const void *pixels)
2280 {
2281     Context *context = GetValidGlobalContext();
2282     EVENT(context, GLTexSubImage2DRobustANGLE,
2283           "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, width = %d, height = "
2284           "%d, format = %s, type = %s, bufSize = %d, pixels = 0x%016" PRIxPTR "",
2285           CID(context), GLenumToString(GLESEnum::AllEnums, target), level, xoffset, yoffset, width,
2286           height, GLenumToString(GLESEnum::AllEnums, format),
2287           GLenumToString(GLESEnum::AllEnums, type), bufSize, (uintptr_t)pixels);
2288 
2289     if (context)
2290     {
2291         TextureTarget targetPacked = PackParam<TextureTarget>(target);
2292         SCOPED_SHARE_CONTEXT_LOCK(context);
2293         bool isCallValid =
2294             (context->skipValidation() ||
2295              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
2296                                                 context->getMutableErrorSetForValidation(),
2297                                                 angle::EntryPoint::GLTexSubImage2DRobustANGLE) &&
2298               ValidateTexSubImage2DRobustANGLE(
2299                   context, angle::EntryPoint::GLTexSubImage2DRobustANGLE, targetPacked, level,
2300                   xoffset, yoffset, width, height, format, type, bufSize, pixels)));
2301         if (isCallValid)
2302         {
2303             context->texSubImage2DRobust(targetPacked, level, xoffset, yoffset, width, height,
2304                                          format, type, bufSize, pixels);
2305         }
2306         ANGLE_CAPTURE_GL(TexSubImage2DRobustANGLE, isCallValid, context, targetPacked, level,
2307                          xoffset, yoffset, width, height, format, type, bufSize, pixels);
2308     }
2309     else
2310     {
2311         GenerateContextLostErrorOnCurrentGlobalContext();
2312     }
2313     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2314 }
2315 
GL_TexImage3DRobustANGLE(GLenum target,GLint level,GLint internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLenum format,GLenum type,GLsizei bufSize,const void * pixels)2316 void GL_APIENTRY GL_TexImage3DRobustANGLE(GLenum target,
2317                                           GLint level,
2318                                           GLint internalformat,
2319                                           GLsizei width,
2320                                           GLsizei height,
2321                                           GLsizei depth,
2322                                           GLint border,
2323                                           GLenum format,
2324                                           GLenum type,
2325                                           GLsizei bufSize,
2326                                           const void *pixels)
2327 {
2328     Context *context = GetValidGlobalContext();
2329     EVENT(context, GLTexImage3DRobustANGLE,
2330           "context = %d, target = %s, level = %d, internalformat = %d, width = %d, height = %d, "
2331           "depth = %d, border = %d, format = %s, type = %s, bufSize = %d, pixels = 0x%016" PRIxPTR
2332           "",
2333           CID(context), GLenumToString(GLESEnum::AllEnums, target), level, internalformat, width,
2334           height, depth, border, GLenumToString(GLESEnum::AllEnums, format),
2335           GLenumToString(GLESEnum::AllEnums, type), bufSize, (uintptr_t)pixels);
2336 
2337     if (context)
2338     {
2339         TextureTarget targetPacked = PackParam<TextureTarget>(target);
2340         SCOPED_SHARE_CONTEXT_LOCK(context);
2341         bool isCallValid =
2342             (context->skipValidation() ||
2343              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
2344                                                 context->getMutableErrorSetForValidation(),
2345                                                 angle::EntryPoint::GLTexImage3DRobustANGLE) &&
2346               ValidateTexImage3DRobustANGLE(context, angle::EntryPoint::GLTexImage3DRobustANGLE,
2347                                             targetPacked, level, internalformat, width, height,
2348                                             depth, border, format, type, bufSize, pixels)));
2349         if (isCallValid)
2350         {
2351             context->texImage3DRobust(targetPacked, level, internalformat, width, height, depth,
2352                                       border, format, type, bufSize, pixels);
2353         }
2354         ANGLE_CAPTURE_GL(TexImage3DRobustANGLE, isCallValid, context, targetPacked, level,
2355                          internalformat, width, height, depth, border, format, type, bufSize,
2356                          pixels);
2357     }
2358     else
2359     {
2360         GenerateContextLostErrorOnCurrentGlobalContext();
2361     }
2362     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2363 }
2364 
GL_TexSubImage3DRobustANGLE(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLenum type,GLsizei bufSize,const void * pixels)2365 void GL_APIENTRY GL_TexSubImage3DRobustANGLE(GLenum target,
2366                                              GLint level,
2367                                              GLint xoffset,
2368                                              GLint yoffset,
2369                                              GLint zoffset,
2370                                              GLsizei width,
2371                                              GLsizei height,
2372                                              GLsizei depth,
2373                                              GLenum format,
2374                                              GLenum type,
2375                                              GLsizei bufSize,
2376                                              const void *pixels)
2377 {
2378     Context *context = GetValidGlobalContext();
2379     EVENT(
2380         context, GLTexSubImage3DRobustANGLE,
2381         "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width = "
2382         "%d, height = %d, depth = %d, format = %s, type = %s, bufSize = %d, pixels = 0x%016" PRIxPTR
2383         "",
2384         CID(context), GLenumToString(GLESEnum::AllEnums, target), level, xoffset, yoffset, zoffset,
2385         width, height, depth, GLenumToString(GLESEnum::AllEnums, format),
2386         GLenumToString(GLESEnum::AllEnums, type), bufSize, (uintptr_t)pixels);
2387 
2388     if (context)
2389     {
2390         TextureTarget targetPacked = PackParam<TextureTarget>(target);
2391         SCOPED_SHARE_CONTEXT_LOCK(context);
2392         bool isCallValid =
2393             (context->skipValidation() ||
2394              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
2395                                                 context->getMutableErrorSetForValidation(),
2396                                                 angle::EntryPoint::GLTexSubImage3DRobustANGLE) &&
2397               ValidateTexSubImage3DRobustANGLE(
2398                   context, angle::EntryPoint::GLTexSubImage3DRobustANGLE, targetPacked, level,
2399                   xoffset, yoffset, zoffset, width, height, depth, format, type, bufSize, pixels)));
2400         if (isCallValid)
2401         {
2402             context->texSubImage3DRobust(targetPacked, level, xoffset, yoffset, zoffset, width,
2403                                          height, depth, format, type, bufSize, pixels);
2404         }
2405         ANGLE_CAPTURE_GL(TexSubImage3DRobustANGLE, isCallValid, context, targetPacked, level,
2406                          xoffset, yoffset, zoffset, width, height, depth, format, type, bufSize,
2407                          pixels);
2408     }
2409     else
2410     {
2411         GenerateContextLostErrorOnCurrentGlobalContext();
2412     }
2413     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2414 }
2415 
GL_CompressedTexImage2DRobustANGLE(GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLint border,GLsizei imageSize,GLsizei dataSize,const void * data)2416 void GL_APIENTRY GL_CompressedTexImage2DRobustANGLE(GLenum target,
2417                                                     GLint level,
2418                                                     GLenum internalformat,
2419                                                     GLsizei width,
2420                                                     GLsizei height,
2421                                                     GLint border,
2422                                                     GLsizei imageSize,
2423                                                     GLsizei dataSize,
2424                                                     const void *data)
2425 {
2426     Context *context = GetValidGlobalContext();
2427     EVENT(context, GLCompressedTexImage2DRobustANGLE,
2428           "context = %d, target = %s, level = %d, internalformat = %s, width = %d, height = %d, "
2429           "border = %d, imageSize = %d, dataSize = %d, data = 0x%016" PRIxPTR "",
2430           CID(context), GLenumToString(GLESEnum::AllEnums, target), level,
2431           GLenumToString(GLESEnum::AllEnums, internalformat), width, height, border, imageSize,
2432           dataSize, (uintptr_t)data);
2433 
2434     if (context)
2435     {
2436         TextureTarget targetPacked = PackParam<TextureTarget>(target);
2437         SCOPED_SHARE_CONTEXT_LOCK(context);
2438         bool isCallValid =
2439             (context->skipValidation() ||
2440              (ValidatePixelLocalStorageInactive(
2441                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
2442                   angle::EntryPoint::GLCompressedTexImage2DRobustANGLE) &&
2443               ValidateCompressedTexImage2DRobustANGLE(
2444                   context, angle::EntryPoint::GLCompressedTexImage2DRobustANGLE, targetPacked,
2445                   level, internalformat, width, height, border, imageSize, dataSize, data)));
2446         if (isCallValid)
2447         {
2448             context->compressedTexImage2DRobust(targetPacked, level, internalformat, width, height,
2449                                                 border, imageSize, dataSize, data);
2450         }
2451         ANGLE_CAPTURE_GL(CompressedTexImage2DRobustANGLE, isCallValid, context, targetPacked, level,
2452                          internalformat, width, height, border, imageSize, dataSize, data);
2453     }
2454     else
2455     {
2456         GenerateContextLostErrorOnCurrentGlobalContext();
2457     }
2458     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2459 }
2460 
GL_CompressedTexSubImage2DRobustANGLE(GLenum target,GLint level,GLsizei xoffset,GLsizei yoffset,GLsizei width,GLsizei height,GLenum format,GLsizei imageSize,GLsizei dataSize,const void * data)2461 void GL_APIENTRY GL_CompressedTexSubImage2DRobustANGLE(GLenum target,
2462                                                        GLint level,
2463                                                        GLsizei xoffset,
2464                                                        GLsizei yoffset,
2465                                                        GLsizei width,
2466                                                        GLsizei height,
2467                                                        GLenum format,
2468                                                        GLsizei imageSize,
2469                                                        GLsizei dataSize,
2470                                                        const void *data)
2471 {
2472     Context *context = GetValidGlobalContext();
2473     EVENT(context, GLCompressedTexSubImage2DRobustANGLE,
2474           "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, width = %d, height = "
2475           "%d, format = %s, imageSize = %d, dataSize = %d, data = 0x%016" PRIxPTR "",
2476           CID(context), GLenumToString(GLESEnum::AllEnums, target), level, xoffset, yoffset, width,
2477           height, GLenumToString(GLESEnum::AllEnums, format), imageSize, dataSize, (uintptr_t)data);
2478 
2479     if (context)
2480     {
2481         TextureTarget targetPacked = PackParam<TextureTarget>(target);
2482         SCOPED_SHARE_CONTEXT_LOCK(context);
2483         bool isCallValid =
2484             (context->skipValidation() ||
2485              (ValidatePixelLocalStorageInactive(
2486                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
2487                   angle::EntryPoint::GLCompressedTexSubImage2DRobustANGLE) &&
2488               ValidateCompressedTexSubImage2DRobustANGLE(
2489                   context, angle::EntryPoint::GLCompressedTexSubImage2DRobustANGLE, targetPacked,
2490                   level, xoffset, yoffset, width, height, format, imageSize, dataSize, data)));
2491         if (isCallValid)
2492         {
2493             context->compressedTexSubImage2DRobust(targetPacked, level, xoffset, yoffset, width,
2494                                                    height, format, imageSize, dataSize, data);
2495         }
2496         ANGLE_CAPTURE_GL(CompressedTexSubImage2DRobustANGLE, isCallValid, context, targetPacked,
2497                          level, xoffset, yoffset, width, height, format, imageSize, dataSize, data);
2498     }
2499     else
2500     {
2501         GenerateContextLostErrorOnCurrentGlobalContext();
2502     }
2503     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2504 }
2505 
GL_CompressedTexImage3DRobustANGLE(GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLsizei imageSize,GLsizei dataSize,const void * data)2506 void GL_APIENTRY GL_CompressedTexImage3DRobustANGLE(GLenum target,
2507                                                     GLint level,
2508                                                     GLenum internalformat,
2509                                                     GLsizei width,
2510                                                     GLsizei height,
2511                                                     GLsizei depth,
2512                                                     GLint border,
2513                                                     GLsizei imageSize,
2514                                                     GLsizei dataSize,
2515                                                     const void *data)
2516 {
2517     Context *context = GetValidGlobalContext();
2518     EVENT(context, GLCompressedTexImage3DRobustANGLE,
2519           "context = %d, target = %s, level = %d, internalformat = %s, width = %d, height = %d, "
2520           "depth = %d, border = %d, imageSize = %d, dataSize = %d, data = 0x%016" PRIxPTR "",
2521           CID(context), GLenumToString(GLESEnum::AllEnums, target), level,
2522           GLenumToString(GLESEnum::AllEnums, internalformat), width, height, depth, border,
2523           imageSize, dataSize, (uintptr_t)data);
2524 
2525     if (context)
2526     {
2527         TextureTarget targetPacked = PackParam<TextureTarget>(target);
2528         SCOPED_SHARE_CONTEXT_LOCK(context);
2529         bool isCallValid =
2530             (context->skipValidation() ||
2531              (ValidatePixelLocalStorageInactive(
2532                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
2533                   angle::EntryPoint::GLCompressedTexImage3DRobustANGLE) &&
2534               ValidateCompressedTexImage3DRobustANGLE(
2535                   context, angle::EntryPoint::GLCompressedTexImage3DRobustANGLE, targetPacked,
2536                   level, internalformat, width, height, depth, border, imageSize, dataSize, data)));
2537         if (isCallValid)
2538         {
2539             context->compressedTexImage3DRobust(targetPacked, level, internalformat, width, height,
2540                                                 depth, border, imageSize, dataSize, data);
2541         }
2542         ANGLE_CAPTURE_GL(CompressedTexImage3DRobustANGLE, isCallValid, context, targetPacked, level,
2543                          internalformat, width, height, depth, border, imageSize, dataSize, data);
2544     }
2545     else
2546     {
2547         GenerateContextLostErrorOnCurrentGlobalContext();
2548     }
2549     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2550 }
2551 
GL_CompressedTexSubImage3DRobustANGLE(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLsizei imageSize,GLsizei dataSize,const void * data)2552 void GL_APIENTRY GL_CompressedTexSubImage3DRobustANGLE(GLenum target,
2553                                                        GLint level,
2554                                                        GLint xoffset,
2555                                                        GLint yoffset,
2556                                                        GLint zoffset,
2557                                                        GLsizei width,
2558                                                        GLsizei height,
2559                                                        GLsizei depth,
2560                                                        GLenum format,
2561                                                        GLsizei imageSize,
2562                                                        GLsizei dataSize,
2563                                                        const void *data)
2564 {
2565     Context *context = GetValidGlobalContext();
2566     EVENT(context, GLCompressedTexSubImage3DRobustANGLE,
2567           "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width "
2568           "= %d, height = %d, depth = %d, format = %s, imageSize = %d, dataSize = %d, data = "
2569           "0x%016" PRIxPTR "",
2570           CID(context), GLenumToString(GLESEnum::AllEnums, target), level, xoffset, yoffset,
2571           zoffset, width, height, depth, GLenumToString(GLESEnum::AllEnums, format), imageSize,
2572           dataSize, (uintptr_t)data);
2573 
2574     if (context)
2575     {
2576         TextureTarget targetPacked = PackParam<TextureTarget>(target);
2577         SCOPED_SHARE_CONTEXT_LOCK(context);
2578         bool isCallValid =
2579             (context->skipValidation() ||
2580              (ValidatePixelLocalStorageInactive(
2581                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
2582                   angle::EntryPoint::GLCompressedTexSubImage3DRobustANGLE) &&
2583               ValidateCompressedTexSubImage3DRobustANGLE(
2584                   context, angle::EntryPoint::GLCompressedTexSubImage3DRobustANGLE, targetPacked,
2585                   level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize,
2586                   dataSize, data)));
2587         if (isCallValid)
2588         {
2589             context->compressedTexSubImage3DRobust(targetPacked, level, xoffset, yoffset, zoffset,
2590                                                    width, height, depth, format, imageSize,
2591                                                    dataSize, data);
2592         }
2593         ANGLE_CAPTURE_GL(CompressedTexSubImage3DRobustANGLE, isCallValid, context, targetPacked,
2594                          level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize,
2595                          dataSize, data);
2596     }
2597     else
2598     {
2599         GenerateContextLostErrorOnCurrentGlobalContext();
2600     }
2601     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2602 }
2603 
GL_GetQueryivRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)2604 void GL_APIENTRY GL_GetQueryivRobustANGLE(GLenum target,
2605                                           GLenum pname,
2606                                           GLsizei bufSize,
2607                                           GLsizei *length,
2608                                           GLint *params)
2609 {
2610     Context *context = GetValidGlobalContext();
2611     EVENT(context, GLGetQueryivRobustANGLE,
2612           "context = %d, target = %s, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2613           ", params = 0x%016" PRIxPTR "",
2614           CID(context), GLenumToString(GLESEnum::AllEnums, target),
2615           GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length, (uintptr_t)params);
2616 
2617     if (context)
2618     {
2619         QueryType targetPacked = PackParam<QueryType>(target);
2620         SCOPED_SHARE_CONTEXT_LOCK(context);
2621         bool isCallValid =
2622             (context->skipValidation() ||
2623              ValidateGetQueryivRobustANGLE(context, angle::EntryPoint::GLGetQueryivRobustANGLE,
2624                                            targetPacked, pname, bufSize, length, params));
2625         if (isCallValid)
2626         {
2627             context->getQueryivRobust(targetPacked, pname, bufSize, length, params);
2628         }
2629         ANGLE_CAPTURE_GL(GetQueryivRobustANGLE, isCallValid, context, targetPacked, pname, bufSize,
2630                          length, params);
2631     }
2632     else
2633     {
2634         GenerateContextLostErrorOnCurrentGlobalContext();
2635     }
2636     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2637 }
2638 
GL_GetQueryObjectuivRobustANGLE(GLuint id,GLenum pname,GLsizei bufSize,GLsizei * length,GLuint * params)2639 void GL_APIENTRY GL_GetQueryObjectuivRobustANGLE(GLuint id,
2640                                                  GLenum pname,
2641                                                  GLsizei bufSize,
2642                                                  GLsizei *length,
2643                                                  GLuint *params)
2644 {
2645     Context *context = GetValidGlobalContext();
2646     EVENT(context, GLGetQueryObjectuivRobustANGLE,
2647           "context = %d, id = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2648           ", params = 0x%016" PRIxPTR "",
2649           CID(context), id, GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length,
2650           (uintptr_t)params);
2651 
2652     if (context)
2653     {
2654         QueryID idPacked = PackParam<QueryID>(id);
2655         SCOPED_SHARE_CONTEXT_LOCK(context);
2656         bool isCallValid = (context->skipValidation() ||
2657                             ValidateGetQueryObjectuivRobustANGLE(
2658                                 context, angle::EntryPoint::GLGetQueryObjectuivRobustANGLE,
2659                                 idPacked, pname, bufSize, length, params));
2660         if (isCallValid)
2661         {
2662             context->getQueryObjectuivRobust(idPacked, pname, bufSize, length, params);
2663         }
2664         ANGLE_CAPTURE_GL(GetQueryObjectuivRobustANGLE, isCallValid, context, idPacked, pname,
2665                          bufSize, length, params);
2666     }
2667     else
2668     {
2669         GenerateContextLostErrorOnCurrentGlobalContext();
2670     }
2671     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2672 }
2673 
GL_GetBufferPointervRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,GLsizei * length,void ** params)2674 void GL_APIENTRY GL_GetBufferPointervRobustANGLE(GLenum target,
2675                                                  GLenum pname,
2676                                                  GLsizei bufSize,
2677                                                  GLsizei *length,
2678                                                  void **params)
2679 {
2680     Context *context = GetValidGlobalContext();
2681     EVENT(context, GLGetBufferPointervRobustANGLE,
2682           "context = %d, target = %s, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2683           ", params = 0x%016" PRIxPTR "",
2684           CID(context), GLenumToString(GLESEnum::AllEnums, target),
2685           GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length, (uintptr_t)params);
2686 
2687     if (context)
2688     {
2689         BufferBinding targetPacked = PackParam<BufferBinding>(target);
2690         SCOPED_SHARE_CONTEXT_LOCK(context);
2691         bool isCallValid = (context->skipValidation() ||
2692                             ValidateGetBufferPointervRobustANGLE(
2693                                 context, angle::EntryPoint::GLGetBufferPointervRobustANGLE,
2694                                 targetPacked, pname, bufSize, length, params));
2695         if (isCallValid)
2696         {
2697             context->getBufferPointervRobust(targetPacked, pname, bufSize, length, params);
2698         }
2699         ANGLE_CAPTURE_GL(GetBufferPointervRobustANGLE, isCallValid, context, targetPacked, pname,
2700                          bufSize, length, params);
2701     }
2702     else
2703     {
2704         GenerateContextLostErrorOnCurrentGlobalContext();
2705     }
2706     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2707 }
2708 
GL_GetIntegeri_vRobustANGLE(GLenum target,GLuint index,GLsizei bufSize,GLsizei * length,GLint * data)2709 void GL_APIENTRY GL_GetIntegeri_vRobustANGLE(GLenum target,
2710                                              GLuint index,
2711                                              GLsizei bufSize,
2712                                              GLsizei *length,
2713                                              GLint *data)
2714 {
2715     Context *context = GetValidGlobalContext();
2716     EVENT(context, GLGetIntegeri_vRobustANGLE,
2717           "context = %d, target = %s, index = %u, bufSize = %d, length = 0x%016" PRIxPTR
2718           ", data = 0x%016" PRIxPTR "",
2719           CID(context), GLenumToString(GLESEnum::AllEnums, target), index, bufSize,
2720           (uintptr_t)length, (uintptr_t)data);
2721 
2722     if (context)
2723     {
2724         SCOPED_SHARE_CONTEXT_LOCK(context);
2725         bool isCallValid = (context->skipValidation() ||
2726                             ValidateGetIntegeri_vRobustANGLE(
2727                                 context, angle::EntryPoint::GLGetIntegeri_vRobustANGLE, target,
2728                                 index, bufSize, length, data));
2729         if (isCallValid)
2730         {
2731             context->getIntegeri_vRobust(target, index, bufSize, length, data);
2732         }
2733         ANGLE_CAPTURE_GL(GetIntegeri_vRobustANGLE, isCallValid, context, target, index, bufSize,
2734                          length, data);
2735     }
2736     else
2737     {
2738         GenerateContextLostErrorOnCurrentGlobalContext();
2739     }
2740     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2741 }
2742 
GL_GetInternalformativRobustANGLE(GLenum target,GLenum internalformat,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)2743 void GL_APIENTRY GL_GetInternalformativRobustANGLE(GLenum target,
2744                                                    GLenum internalformat,
2745                                                    GLenum pname,
2746                                                    GLsizei bufSize,
2747                                                    GLsizei *length,
2748                                                    GLint *params)
2749 {
2750     Context *context = GetValidGlobalContext();
2751     EVENT(context, GLGetInternalformativRobustANGLE,
2752           "context = %d, target = %s, internalformat = %s, pname = %s, bufSize = %d, length = "
2753           "0x%016" PRIxPTR ", params = 0x%016" PRIxPTR "",
2754           CID(context), GLenumToString(GLESEnum::AllEnums, target),
2755           GLenumToString(GLESEnum::AllEnums, internalformat),
2756           GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length, (uintptr_t)params);
2757 
2758     if (context)
2759     {
2760         SCOPED_SHARE_CONTEXT_LOCK(context);
2761         bool isCallValid = (context->skipValidation() ||
2762                             ValidateGetInternalformativRobustANGLE(
2763                                 context, angle::EntryPoint::GLGetInternalformativRobustANGLE,
2764                                 target, internalformat, pname, bufSize, length, params));
2765         if (isCallValid)
2766         {
2767             context->getInternalformativRobust(target, internalformat, pname, bufSize, length,
2768                                                params);
2769         }
2770         ANGLE_CAPTURE_GL(GetInternalformativRobustANGLE, isCallValid, context, target,
2771                          internalformat, pname, bufSize, length, params);
2772     }
2773     else
2774     {
2775         GenerateContextLostErrorOnCurrentGlobalContext();
2776     }
2777     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2778 }
2779 
GL_GetVertexAttribIivRobustANGLE(GLuint index,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)2780 void GL_APIENTRY GL_GetVertexAttribIivRobustANGLE(GLuint index,
2781                                                   GLenum pname,
2782                                                   GLsizei bufSize,
2783                                                   GLsizei *length,
2784                                                   GLint *params)
2785 {
2786     Context *context = GetValidGlobalContext();
2787     EVENT(context, GLGetVertexAttribIivRobustANGLE,
2788           "context = %d, index = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2789           ", params = 0x%016" PRIxPTR "",
2790           CID(context), index, GLenumToString(GLESEnum::AllEnums, pname), bufSize,
2791           (uintptr_t)length, (uintptr_t)params);
2792 
2793     if (context)
2794     {
2795         SCOPED_SHARE_CONTEXT_LOCK(context);
2796         bool isCallValid = (context->skipValidation() ||
2797                             ValidateGetVertexAttribIivRobustANGLE(
2798                                 context, angle::EntryPoint::GLGetVertexAttribIivRobustANGLE, index,
2799                                 pname, bufSize, length, params));
2800         if (isCallValid)
2801         {
2802             context->getVertexAttribIivRobust(index, pname, bufSize, length, params);
2803         }
2804         ANGLE_CAPTURE_GL(GetVertexAttribIivRobustANGLE, isCallValid, context, index, pname, bufSize,
2805                          length, params);
2806     }
2807     else
2808     {
2809         GenerateContextLostErrorOnCurrentGlobalContext();
2810     }
2811     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2812 }
2813 
GL_GetVertexAttribIuivRobustANGLE(GLuint index,GLenum pname,GLsizei bufSize,GLsizei * length,GLuint * params)2814 void GL_APIENTRY GL_GetVertexAttribIuivRobustANGLE(GLuint index,
2815                                                    GLenum pname,
2816                                                    GLsizei bufSize,
2817                                                    GLsizei *length,
2818                                                    GLuint *params)
2819 {
2820     Context *context = GetValidGlobalContext();
2821     EVENT(context, GLGetVertexAttribIuivRobustANGLE,
2822           "context = %d, index = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2823           ", params = 0x%016" PRIxPTR "",
2824           CID(context), index, GLenumToString(GLESEnum::AllEnums, pname), bufSize,
2825           (uintptr_t)length, (uintptr_t)params);
2826 
2827     if (context)
2828     {
2829         SCOPED_SHARE_CONTEXT_LOCK(context);
2830         bool isCallValid = (context->skipValidation() ||
2831                             ValidateGetVertexAttribIuivRobustANGLE(
2832                                 context, angle::EntryPoint::GLGetVertexAttribIuivRobustANGLE, index,
2833                                 pname, bufSize, length, params));
2834         if (isCallValid)
2835         {
2836             context->getVertexAttribIuivRobust(index, pname, bufSize, length, params);
2837         }
2838         ANGLE_CAPTURE_GL(GetVertexAttribIuivRobustANGLE, isCallValid, context, index, pname,
2839                          bufSize, length, params);
2840     }
2841     else
2842     {
2843         GenerateContextLostErrorOnCurrentGlobalContext();
2844     }
2845     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2846 }
2847 
GL_GetUniformuivRobustANGLE(GLuint program,GLint location,GLsizei bufSize,GLsizei * length,GLuint * params)2848 void GL_APIENTRY GL_GetUniformuivRobustANGLE(GLuint program,
2849                                              GLint location,
2850                                              GLsizei bufSize,
2851                                              GLsizei *length,
2852                                              GLuint *params)
2853 {
2854     Context *context = GetValidGlobalContext();
2855     EVENT(context, GLGetUniformuivRobustANGLE,
2856           "context = %d, program = %u, location = %d, bufSize = %d, length = 0x%016" PRIxPTR
2857           ", params = 0x%016" PRIxPTR "",
2858           CID(context), program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
2859 
2860     if (context)
2861     {
2862         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
2863         UniformLocation locationPacked = PackParam<UniformLocation>(location);
2864         SCOPED_SHARE_CONTEXT_LOCK(context);
2865         bool isCallValid = (context->skipValidation() ||
2866                             ValidateGetUniformuivRobustANGLE(
2867                                 context, angle::EntryPoint::GLGetUniformuivRobustANGLE,
2868                                 programPacked, locationPacked, bufSize, length, params));
2869         if (isCallValid)
2870         {
2871             context->getUniformuivRobust(programPacked, locationPacked, bufSize, length, params);
2872         }
2873         ANGLE_CAPTURE_GL(GetUniformuivRobustANGLE, isCallValid, context, programPacked,
2874                          locationPacked, bufSize, length, params);
2875     }
2876     else
2877     {
2878         GenerateContextLostErrorOnCurrentGlobalContext();
2879     }
2880     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2881 }
2882 
GL_GetActiveUniformBlockivRobustANGLE(GLuint program,GLuint uniformBlockIndex,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)2883 void GL_APIENTRY GL_GetActiveUniformBlockivRobustANGLE(GLuint program,
2884                                                        GLuint uniformBlockIndex,
2885                                                        GLenum pname,
2886                                                        GLsizei bufSize,
2887                                                        GLsizei *length,
2888                                                        GLint *params)
2889 {
2890     Context *context = GetValidGlobalContext();
2891     EVENT(context, GLGetActiveUniformBlockivRobustANGLE,
2892           "context = %d, program = %u, uniformBlockIndex = %u, pname = %s, bufSize = %d, length = "
2893           "0x%016" PRIxPTR ", params = 0x%016" PRIxPTR "",
2894           CID(context), program, uniformBlockIndex, GLenumToString(GLESEnum::AllEnums, pname),
2895           bufSize, (uintptr_t)length, (uintptr_t)params);
2896 
2897     if (context)
2898     {
2899         ShaderProgramID programPacked             = PackParam<ShaderProgramID>(program);
2900         UniformBlockIndex uniformBlockIndexPacked = PackParam<UniformBlockIndex>(uniformBlockIndex);
2901         SCOPED_SHARE_CONTEXT_LOCK(context);
2902         bool isCallValid =
2903             (context->skipValidation() ||
2904              ValidateGetActiveUniformBlockivRobustANGLE(
2905                  context, angle::EntryPoint::GLGetActiveUniformBlockivRobustANGLE, programPacked,
2906                  uniformBlockIndexPacked, pname, bufSize, length, params));
2907         if (isCallValid)
2908         {
2909             context->getActiveUniformBlockivRobust(programPacked, uniformBlockIndexPacked, pname,
2910                                                    bufSize, length, params);
2911         }
2912         ANGLE_CAPTURE_GL(GetActiveUniformBlockivRobustANGLE, isCallValid, context, programPacked,
2913                          uniformBlockIndexPacked, pname, bufSize, length, params);
2914     }
2915     else
2916     {
2917         GenerateContextLostErrorOnCurrentGlobalContext();
2918     }
2919     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2920 }
2921 
GL_GetInteger64vRobustANGLE(GLenum pname,GLsizei bufSize,GLsizei * length,GLint64 * data)2922 void GL_APIENTRY GL_GetInteger64vRobustANGLE(GLenum pname,
2923                                              GLsizei bufSize,
2924                                              GLsizei *length,
2925                                              GLint64 *data)
2926 {
2927     Context *context = GetValidGlobalContext();
2928     EVENT(context, GLGetInteger64vRobustANGLE,
2929           "context = %d, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2930           ", data = 0x%016" PRIxPTR "",
2931           CID(context), GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length,
2932           (uintptr_t)data);
2933 
2934     if (context)
2935     {
2936         SCOPED_SHARE_CONTEXT_LOCK(context);
2937         bool isCallValid = (context->skipValidation() ||
2938                             ValidateGetInteger64vRobustANGLE(
2939                                 context, angle::EntryPoint::GLGetInteger64vRobustANGLE, pname,
2940                                 bufSize, length, data));
2941         if (isCallValid)
2942         {
2943             context->getInteger64vRobust(pname, bufSize, length, data);
2944         }
2945         ANGLE_CAPTURE_GL(GetInteger64vRobustANGLE, isCallValid, context, pname, bufSize, length,
2946                          data);
2947     }
2948     else
2949     {
2950         GenerateContextLostErrorOnCurrentGlobalContext();
2951     }
2952     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2953 }
2954 
GL_GetInteger64i_vRobustANGLE(GLenum target,GLuint index,GLsizei bufSize,GLsizei * length,GLint64 * data)2955 void GL_APIENTRY GL_GetInteger64i_vRobustANGLE(GLenum target,
2956                                                GLuint index,
2957                                                GLsizei bufSize,
2958                                                GLsizei *length,
2959                                                GLint64 *data)
2960 {
2961     Context *context = GetValidGlobalContext();
2962     EVENT(context, GLGetInteger64i_vRobustANGLE,
2963           "context = %d, target = %s, index = %u, bufSize = %d, length = 0x%016" PRIxPTR
2964           ", data = 0x%016" PRIxPTR "",
2965           CID(context), GLenumToString(GLESEnum::AllEnums, target), index, bufSize,
2966           (uintptr_t)length, (uintptr_t)data);
2967 
2968     if (context)
2969     {
2970         SCOPED_SHARE_CONTEXT_LOCK(context);
2971         bool isCallValid = (context->skipValidation() ||
2972                             ValidateGetInteger64i_vRobustANGLE(
2973                                 context, angle::EntryPoint::GLGetInteger64i_vRobustANGLE, target,
2974                                 index, bufSize, length, data));
2975         if (isCallValid)
2976         {
2977             context->getInteger64i_vRobust(target, index, bufSize, length, data);
2978         }
2979         ANGLE_CAPTURE_GL(GetInteger64i_vRobustANGLE, isCallValid, context, target, index, bufSize,
2980                          length, data);
2981     }
2982     else
2983     {
2984         GenerateContextLostErrorOnCurrentGlobalContext();
2985     }
2986     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2987 }
2988 
GL_GetBufferParameteri64vRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,GLsizei * length,GLint64 * params)2989 void GL_APIENTRY GL_GetBufferParameteri64vRobustANGLE(GLenum target,
2990                                                       GLenum pname,
2991                                                       GLsizei bufSize,
2992                                                       GLsizei *length,
2993                                                       GLint64 *params)
2994 {
2995     Context *context = GetValidGlobalContext();
2996     EVENT(context, GLGetBufferParameteri64vRobustANGLE,
2997           "context = %d, target = %s, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
2998           ", params = 0x%016" PRIxPTR "",
2999           CID(context), GLenumToString(GLESEnum::AllEnums, target),
3000           GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length, (uintptr_t)params);
3001 
3002     if (context)
3003     {
3004         BufferBinding targetPacked = PackParam<BufferBinding>(target);
3005         SCOPED_SHARE_CONTEXT_LOCK(context);
3006         bool isCallValid = (context->skipValidation() ||
3007                             ValidateGetBufferParameteri64vRobustANGLE(
3008                                 context, angle::EntryPoint::GLGetBufferParameteri64vRobustANGLE,
3009                                 targetPacked, pname, bufSize, length, params));
3010         if (isCallValid)
3011         {
3012             context->getBufferParameteri64vRobust(targetPacked, pname, bufSize, length, params);
3013         }
3014         ANGLE_CAPTURE_GL(GetBufferParameteri64vRobustANGLE, isCallValid, context, targetPacked,
3015                          pname, bufSize, length, params);
3016     }
3017     else
3018     {
3019         GenerateContextLostErrorOnCurrentGlobalContext();
3020     }
3021     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3022 }
3023 
GL_SamplerParameterivRobustANGLE(GLuint sampler,GLuint pname,GLsizei bufSize,const GLint * param)3024 void GL_APIENTRY GL_SamplerParameterivRobustANGLE(GLuint sampler,
3025                                                   GLuint pname,
3026                                                   GLsizei bufSize,
3027                                                   const GLint *param)
3028 {
3029     Context *context = GetValidGlobalContext();
3030     EVENT(context, GLSamplerParameterivRobustANGLE,
3031           "context = %d, sampler = %u, pname = %u, bufSize = %d, param = 0x%016" PRIxPTR "",
3032           CID(context), sampler, pname, bufSize, (uintptr_t)param);
3033 
3034     if (context)
3035     {
3036         SamplerID samplerPacked = PackParam<SamplerID>(sampler);
3037         SCOPED_SHARE_CONTEXT_LOCK(context);
3038         bool isCallValid = (context->skipValidation() ||
3039                             ValidateSamplerParameterivRobustANGLE(
3040                                 context, angle::EntryPoint::GLSamplerParameterivRobustANGLE,
3041                                 samplerPacked, pname, bufSize, param));
3042         if (isCallValid)
3043         {
3044             context->samplerParameterivRobust(samplerPacked, pname, bufSize, param);
3045         }
3046         ANGLE_CAPTURE_GL(SamplerParameterivRobustANGLE, isCallValid, context, samplerPacked, pname,
3047                          bufSize, param);
3048     }
3049     else
3050     {
3051         GenerateContextLostErrorOnCurrentGlobalContext();
3052     }
3053     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3054 }
3055 
GL_SamplerParameterfvRobustANGLE(GLuint sampler,GLenum pname,GLsizei bufSize,const GLfloat * param)3056 void GL_APIENTRY GL_SamplerParameterfvRobustANGLE(GLuint sampler,
3057                                                   GLenum pname,
3058                                                   GLsizei bufSize,
3059                                                   const GLfloat *param)
3060 {
3061     Context *context = GetValidGlobalContext();
3062     EVENT(context, GLSamplerParameterfvRobustANGLE,
3063           "context = %d, sampler = %u, pname = %s, bufSize = %d, param = 0x%016" PRIxPTR "",
3064           CID(context), sampler, GLenumToString(GLESEnum::AllEnums, pname), bufSize,
3065           (uintptr_t)param);
3066 
3067     if (context)
3068     {
3069         SamplerID samplerPacked = PackParam<SamplerID>(sampler);
3070         SCOPED_SHARE_CONTEXT_LOCK(context);
3071         bool isCallValid = (context->skipValidation() ||
3072                             ValidateSamplerParameterfvRobustANGLE(
3073                                 context, angle::EntryPoint::GLSamplerParameterfvRobustANGLE,
3074                                 samplerPacked, pname, bufSize, param));
3075         if (isCallValid)
3076         {
3077             context->samplerParameterfvRobust(samplerPacked, pname, bufSize, param);
3078         }
3079         ANGLE_CAPTURE_GL(SamplerParameterfvRobustANGLE, isCallValid, context, samplerPacked, pname,
3080                          bufSize, param);
3081     }
3082     else
3083     {
3084         GenerateContextLostErrorOnCurrentGlobalContext();
3085     }
3086     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3087 }
3088 
GL_GetSamplerParameterivRobustANGLE(GLuint sampler,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)3089 void GL_APIENTRY GL_GetSamplerParameterivRobustANGLE(GLuint sampler,
3090                                                      GLenum pname,
3091                                                      GLsizei bufSize,
3092                                                      GLsizei *length,
3093                                                      GLint *params)
3094 {
3095     Context *context = GetValidGlobalContext();
3096     EVENT(context, GLGetSamplerParameterivRobustANGLE,
3097           "context = %d, sampler = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
3098           ", params = 0x%016" PRIxPTR "",
3099           CID(context), sampler, GLenumToString(GLESEnum::AllEnums, pname), bufSize,
3100           (uintptr_t)length, (uintptr_t)params);
3101 
3102     if (context)
3103     {
3104         SamplerID samplerPacked = PackParam<SamplerID>(sampler);
3105         SCOPED_SHARE_CONTEXT_LOCK(context);
3106         bool isCallValid = (context->skipValidation() ||
3107                             ValidateGetSamplerParameterivRobustANGLE(
3108                                 context, angle::EntryPoint::GLGetSamplerParameterivRobustANGLE,
3109                                 samplerPacked, pname, bufSize, length, params));
3110         if (isCallValid)
3111         {
3112             context->getSamplerParameterivRobust(samplerPacked, pname, bufSize, length, params);
3113         }
3114         ANGLE_CAPTURE_GL(GetSamplerParameterivRobustANGLE, isCallValid, context, samplerPacked,
3115                          pname, bufSize, length, params);
3116     }
3117     else
3118     {
3119         GenerateContextLostErrorOnCurrentGlobalContext();
3120     }
3121     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3122 }
3123 
GL_GetSamplerParameterfvRobustANGLE(GLuint sampler,GLenum pname,GLsizei bufSize,GLsizei * length,GLfloat * params)3124 void GL_APIENTRY GL_GetSamplerParameterfvRobustANGLE(GLuint sampler,
3125                                                      GLenum pname,
3126                                                      GLsizei bufSize,
3127                                                      GLsizei *length,
3128                                                      GLfloat *params)
3129 {
3130     Context *context = GetValidGlobalContext();
3131     EVENT(context, GLGetSamplerParameterfvRobustANGLE,
3132           "context = %d, sampler = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
3133           ", params = 0x%016" PRIxPTR "",
3134           CID(context), sampler, GLenumToString(GLESEnum::AllEnums, pname), bufSize,
3135           (uintptr_t)length, (uintptr_t)params);
3136 
3137     if (context)
3138     {
3139         SamplerID samplerPacked = PackParam<SamplerID>(sampler);
3140         SCOPED_SHARE_CONTEXT_LOCK(context);
3141         bool isCallValid = (context->skipValidation() ||
3142                             ValidateGetSamplerParameterfvRobustANGLE(
3143                                 context, angle::EntryPoint::GLGetSamplerParameterfvRobustANGLE,
3144                                 samplerPacked, pname, bufSize, length, params));
3145         if (isCallValid)
3146         {
3147             context->getSamplerParameterfvRobust(samplerPacked, pname, bufSize, length, params);
3148         }
3149         ANGLE_CAPTURE_GL(GetSamplerParameterfvRobustANGLE, isCallValid, context, samplerPacked,
3150                          pname, bufSize, length, params);
3151     }
3152     else
3153     {
3154         GenerateContextLostErrorOnCurrentGlobalContext();
3155     }
3156     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3157 }
3158 
GL_GetFramebufferParameterivRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)3159 void GL_APIENTRY GL_GetFramebufferParameterivRobustANGLE(GLenum target,
3160                                                          GLenum pname,
3161                                                          GLsizei bufSize,
3162                                                          GLsizei *length,
3163                                                          GLint *params)
3164 {
3165     Context *context = GetValidGlobalContext();
3166     EVENT(context, GLGetFramebufferParameterivRobustANGLE,
3167           "context = %d, target = %s, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
3168           ", params = 0x%016" PRIxPTR "",
3169           CID(context), GLenumToString(GLESEnum::AllEnums, target),
3170           GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length, (uintptr_t)params);
3171 
3172     if (context)
3173     {
3174         SCOPED_SHARE_CONTEXT_LOCK(context);
3175         bool isCallValid = (context->skipValidation() ||
3176                             ValidateGetFramebufferParameterivRobustANGLE(
3177                                 context, angle::EntryPoint::GLGetFramebufferParameterivRobustANGLE,
3178                                 target, pname, bufSize, length, params));
3179         if (isCallValid)
3180         {
3181             context->getFramebufferParameterivRobust(target, pname, bufSize, length, params);
3182         }
3183         ANGLE_CAPTURE_GL(GetFramebufferParameterivRobustANGLE, isCallValid, context, target, pname,
3184                          bufSize, length, params);
3185     }
3186     else
3187     {
3188         GenerateContextLostErrorOnCurrentGlobalContext();
3189     }
3190     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3191 }
3192 
GL_GetProgramInterfaceivRobustANGLE(GLuint program,GLenum programInterface,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)3193 void GL_APIENTRY GL_GetProgramInterfaceivRobustANGLE(GLuint program,
3194                                                      GLenum programInterface,
3195                                                      GLenum pname,
3196                                                      GLsizei bufSize,
3197                                                      GLsizei *length,
3198                                                      GLint *params)
3199 {
3200     Context *context = GetValidGlobalContext();
3201     EVENT(context, GLGetProgramInterfaceivRobustANGLE,
3202           "context = %d, program = %u, programInterface = %s, pname = %s, bufSize = %d, length = "
3203           "0x%016" PRIxPTR ", params = 0x%016" PRIxPTR "",
3204           CID(context), program, GLenumToString(GLESEnum::AllEnums, programInterface),
3205           GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length, (uintptr_t)params);
3206 
3207     if (context)
3208     {
3209         ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
3210         SCOPED_SHARE_CONTEXT_LOCK(context);
3211         bool isCallValid = (context->skipValidation() ||
3212                             ValidateGetProgramInterfaceivRobustANGLE(
3213                                 context, angle::EntryPoint::GLGetProgramInterfaceivRobustANGLE,
3214                                 programPacked, programInterface, pname, bufSize, length, params));
3215         if (isCallValid)
3216         {
3217             context->getProgramInterfaceivRobust(programPacked, programInterface, pname, bufSize,
3218                                                  length, params);
3219         }
3220         ANGLE_CAPTURE_GL(GetProgramInterfaceivRobustANGLE, isCallValid, context, programPacked,
3221                          programInterface, pname, bufSize, length, params);
3222     }
3223     else
3224     {
3225         GenerateContextLostErrorOnCurrentGlobalContext();
3226     }
3227     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3228 }
3229 
GL_GetBooleani_vRobustANGLE(GLenum target,GLuint index,GLsizei bufSize,GLsizei * length,GLboolean * data)3230 void GL_APIENTRY GL_GetBooleani_vRobustANGLE(GLenum target,
3231                                              GLuint index,
3232                                              GLsizei bufSize,
3233                                              GLsizei *length,
3234                                              GLboolean *data)
3235 {
3236     Context *context = GetValidGlobalContext();
3237     EVENT(context, GLGetBooleani_vRobustANGLE,
3238           "context = %d, target = %s, index = %u, bufSize = %d, length = 0x%016" PRIxPTR
3239           ", data = 0x%016" PRIxPTR "",
3240           CID(context), GLenumToString(GLESEnum::AllEnums, target), index, bufSize,
3241           (uintptr_t)length, (uintptr_t)data);
3242 
3243     if (context)
3244     {
3245         SCOPED_SHARE_CONTEXT_LOCK(context);
3246         bool isCallValid = (context->skipValidation() ||
3247                             ValidateGetBooleani_vRobustANGLE(
3248                                 context, angle::EntryPoint::GLGetBooleani_vRobustANGLE, target,
3249                                 index, bufSize, length, data));
3250         if (isCallValid)
3251         {
3252             context->getBooleani_vRobust(target, index, bufSize, length, data);
3253         }
3254         ANGLE_CAPTURE_GL(GetBooleani_vRobustANGLE, isCallValid, context, target, index, bufSize,
3255                          length, data);
3256     }
3257     else
3258     {
3259         GenerateContextLostErrorOnCurrentGlobalContext();
3260     }
3261     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3262 }
3263 
GL_GetMultisamplefvRobustANGLE(GLenum pname,GLuint index,GLsizei bufSize,GLsizei * length,GLfloat * val)3264 void GL_APIENTRY GL_GetMultisamplefvRobustANGLE(GLenum pname,
3265                                                 GLuint index,
3266                                                 GLsizei bufSize,
3267                                                 GLsizei *length,
3268                                                 GLfloat *val)
3269 {
3270     Context *context = GetValidGlobalContext();
3271     EVENT(context, GLGetMultisamplefvRobustANGLE,
3272           "context = %d, pname = %s, index = %u, bufSize = %d, length = 0x%016" PRIxPTR
3273           ", val = 0x%016" PRIxPTR "",
3274           CID(context), GLenumToString(GLESEnum::AllEnums, pname), index, bufSize,
3275           (uintptr_t)length, (uintptr_t)val);
3276 
3277     if (context)
3278     {
3279         SCOPED_SHARE_CONTEXT_LOCK(context);
3280         bool isCallValid = (context->skipValidation() ||
3281                             ValidateGetMultisamplefvRobustANGLE(
3282                                 context, angle::EntryPoint::GLGetMultisamplefvRobustANGLE, pname,
3283                                 index, bufSize, length, val));
3284         if (isCallValid)
3285         {
3286             context->getMultisamplefvRobust(pname, index, bufSize, length, val);
3287         }
3288         ANGLE_CAPTURE_GL(GetMultisamplefvRobustANGLE, isCallValid, context, pname, index, bufSize,
3289                          length, val);
3290     }
3291     else
3292     {
3293         GenerateContextLostErrorOnCurrentGlobalContext();
3294     }
3295     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3296 }
3297 
GL_GetTexLevelParameterivRobustANGLE(GLenum target,GLint level,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)3298 void GL_APIENTRY GL_GetTexLevelParameterivRobustANGLE(GLenum target,
3299                                                       GLint level,
3300                                                       GLenum pname,
3301                                                       GLsizei bufSize,
3302                                                       GLsizei *length,
3303                                                       GLint *params)
3304 {
3305     Context *context = GetValidGlobalContext();
3306     EVENT(context, GLGetTexLevelParameterivRobustANGLE,
3307           "context = %d, target = %s, level = %d, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
3308           ", params = 0x%016" PRIxPTR "",
3309           CID(context), GLenumToString(GLESEnum::AllEnums, target), level,
3310           GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length, (uintptr_t)params);
3311 
3312     if (context)
3313     {
3314         TextureTarget targetPacked = PackParam<TextureTarget>(target);
3315         SCOPED_SHARE_CONTEXT_LOCK(context);
3316         bool isCallValid = (context->skipValidation() ||
3317                             ValidateGetTexLevelParameterivRobustANGLE(
3318                                 context, angle::EntryPoint::GLGetTexLevelParameterivRobustANGLE,
3319                                 targetPacked, level, pname, bufSize, length, params));
3320         if (isCallValid)
3321         {
3322             context->getTexLevelParameterivRobust(targetPacked, level, pname, bufSize, length,
3323                                                   params);
3324         }
3325         ANGLE_CAPTURE_GL(GetTexLevelParameterivRobustANGLE, isCallValid, context, targetPacked,
3326                          level, pname, bufSize, length, params);
3327     }
3328     else
3329     {
3330         GenerateContextLostErrorOnCurrentGlobalContext();
3331     }
3332     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3333 }
3334 
GL_GetTexLevelParameterfvRobustANGLE(GLenum target,GLint level,GLenum pname,GLsizei bufSize,GLsizei * length,GLfloat * params)3335 void GL_APIENTRY GL_GetTexLevelParameterfvRobustANGLE(GLenum target,
3336                                                       GLint level,
3337                                                       GLenum pname,
3338                                                       GLsizei bufSize,
3339                                                       GLsizei *length,
3340                                                       GLfloat *params)
3341 {
3342     Context *context = GetValidGlobalContext();
3343     EVENT(context, GLGetTexLevelParameterfvRobustANGLE,
3344           "context = %d, target = %s, level = %d, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
3345           ", params = 0x%016" PRIxPTR "",
3346           CID(context), GLenumToString(GLESEnum::AllEnums, target), level,
3347           GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length, (uintptr_t)params);
3348 
3349     if (context)
3350     {
3351         TextureTarget targetPacked = PackParam<TextureTarget>(target);
3352         SCOPED_SHARE_CONTEXT_LOCK(context);
3353         bool isCallValid = (context->skipValidation() ||
3354                             ValidateGetTexLevelParameterfvRobustANGLE(
3355                                 context, angle::EntryPoint::GLGetTexLevelParameterfvRobustANGLE,
3356                                 targetPacked, level, pname, bufSize, length, params));
3357         if (isCallValid)
3358         {
3359             context->getTexLevelParameterfvRobust(targetPacked, level, pname, bufSize, length,
3360                                                   params);
3361         }
3362         ANGLE_CAPTURE_GL(GetTexLevelParameterfvRobustANGLE, isCallValid, context, targetPacked,
3363                          level, pname, bufSize, length, params);
3364     }
3365     else
3366     {
3367         GenerateContextLostErrorOnCurrentGlobalContext();
3368     }
3369     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3370 }
3371 
GL_GetPointervRobustANGLERobustANGLE(GLenum pname,GLsizei bufSize,GLsizei * length,void ** params)3372 void GL_APIENTRY GL_GetPointervRobustANGLERobustANGLE(GLenum pname,
3373                                                       GLsizei bufSize,
3374                                                       GLsizei *length,
3375                                                       void **params)
3376 {
3377     Context *context = GetValidGlobalContext();
3378     EVENT(context, GLGetPointervRobustANGLERobustANGLE,
3379           "context = %d, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
3380           ", params = 0x%016" PRIxPTR "",
3381           CID(context), GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length,
3382           (uintptr_t)params);
3383 
3384     if (context)
3385     {
3386         SCOPED_SHARE_CONTEXT_LOCK(context);
3387         bool isCallValid = (context->skipValidation() ||
3388                             ValidateGetPointervRobustANGLERobustANGLE(
3389                                 context, angle::EntryPoint::GLGetPointervRobustANGLERobustANGLE,
3390                                 pname, bufSize, length, params));
3391         if (isCallValid)
3392         {
3393             context->getPointervRobustANGLERobust(pname, bufSize, length, params);
3394         }
3395         ANGLE_CAPTURE_GL(GetPointervRobustANGLERobustANGLE, isCallValid, context, pname, bufSize,
3396                          length, params);
3397     }
3398     else
3399     {
3400         GenerateContextLostErrorOnCurrentGlobalContext();
3401     }
3402     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3403 }
3404 
GL_ReadnPixelsRobustANGLE(GLint x,GLint y,GLsizei width,GLsizei height,GLenum format,GLenum type,GLsizei bufSize,GLsizei * length,GLsizei * columns,GLsizei * rows,void * data)3405 void GL_APIENTRY GL_ReadnPixelsRobustANGLE(GLint x,
3406                                            GLint y,
3407                                            GLsizei width,
3408                                            GLsizei height,
3409                                            GLenum format,
3410                                            GLenum type,
3411                                            GLsizei bufSize,
3412                                            GLsizei *length,
3413                                            GLsizei *columns,
3414                                            GLsizei *rows,
3415                                            void *data)
3416 {
3417     Context *context = GetValidGlobalContext();
3418     EVENT(context, GLReadnPixelsRobustANGLE,
3419           "context = %d, x = %d, y = %d, width = %d, height = %d, format = %s, type = %s, bufSize "
3420           "= %d, length = 0x%016" PRIxPTR ", columns = 0x%016" PRIxPTR ", rows = 0x%016" PRIxPTR
3421           ", data = 0x%016" PRIxPTR "",
3422           CID(context), x, y, width, height, GLenumToString(GLESEnum::AllEnums, format),
3423           GLenumToString(GLESEnum::AllEnums, type), bufSize, (uintptr_t)length, (uintptr_t)columns,
3424           (uintptr_t)rows, (uintptr_t)data);
3425 
3426     if (context)
3427     {
3428         SCOPED_SHARE_CONTEXT_LOCK(context);
3429         bool isCallValid =
3430             (context->skipValidation() ||
3431              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
3432                                                 context->getMutableErrorSetForValidation(),
3433                                                 angle::EntryPoint::GLReadnPixelsRobustANGLE) &&
3434               ValidateReadnPixelsRobustANGLE(context, angle::EntryPoint::GLReadnPixelsRobustANGLE,
3435                                              x, y, width, height, format, type, bufSize, length,
3436                                              columns, rows, data)));
3437         if (isCallValid)
3438         {
3439             context->readnPixelsRobust(x, y, width, height, format, type, bufSize, length, columns,
3440                                        rows, data);
3441         }
3442         ANGLE_CAPTURE_GL(ReadnPixelsRobustANGLE, isCallValid, context, x, y, width, height, format,
3443                          type, bufSize, length, columns, rows, data);
3444     }
3445     else
3446     {
3447         GenerateContextLostErrorOnCurrentGlobalContext();
3448     }
3449     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3450 }
3451 
GL_GetnUniformfvRobustANGLE(GLuint program,GLint location,GLsizei bufSize,GLsizei * length,GLfloat * params)3452 void GL_APIENTRY GL_GetnUniformfvRobustANGLE(GLuint program,
3453                                              GLint location,
3454                                              GLsizei bufSize,
3455                                              GLsizei *length,
3456                                              GLfloat *params)
3457 {
3458     Context *context = GetValidGlobalContext();
3459     EVENT(context, GLGetnUniformfvRobustANGLE,
3460           "context = %d, program = %u, location = %d, bufSize = %d, length = 0x%016" PRIxPTR
3461           ", params = 0x%016" PRIxPTR "",
3462           CID(context), program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
3463 
3464     if (context)
3465     {
3466         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
3467         UniformLocation locationPacked = PackParam<UniformLocation>(location);
3468         SCOPED_SHARE_CONTEXT_LOCK(context);
3469         bool isCallValid = (context->skipValidation() ||
3470                             ValidateGetnUniformfvRobustANGLE(
3471                                 context, angle::EntryPoint::GLGetnUniformfvRobustANGLE,
3472                                 programPacked, locationPacked, bufSize, length, params));
3473         if (isCallValid)
3474         {
3475             context->getnUniformfvRobust(programPacked, locationPacked, bufSize, length, params);
3476         }
3477         ANGLE_CAPTURE_GL(GetnUniformfvRobustANGLE, isCallValid, context, programPacked,
3478                          locationPacked, bufSize, length, params);
3479     }
3480     else
3481     {
3482         GenerateContextLostErrorOnCurrentGlobalContext();
3483     }
3484     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3485 }
3486 
GL_GetnUniformivRobustANGLE(GLuint program,GLint location,GLsizei bufSize,GLsizei * length,GLint * params)3487 void GL_APIENTRY GL_GetnUniformivRobustANGLE(GLuint program,
3488                                              GLint location,
3489                                              GLsizei bufSize,
3490                                              GLsizei *length,
3491                                              GLint *params)
3492 {
3493     Context *context = GetValidGlobalContext();
3494     EVENT(context, GLGetnUniformivRobustANGLE,
3495           "context = %d, program = %u, location = %d, bufSize = %d, length = 0x%016" PRIxPTR
3496           ", params = 0x%016" PRIxPTR "",
3497           CID(context), program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
3498 
3499     if (context)
3500     {
3501         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
3502         UniformLocation locationPacked = PackParam<UniformLocation>(location);
3503         SCOPED_SHARE_CONTEXT_LOCK(context);
3504         bool isCallValid = (context->skipValidation() ||
3505                             ValidateGetnUniformivRobustANGLE(
3506                                 context, angle::EntryPoint::GLGetnUniformivRobustANGLE,
3507                                 programPacked, locationPacked, bufSize, length, params));
3508         if (isCallValid)
3509         {
3510             context->getnUniformivRobust(programPacked, locationPacked, bufSize, length, params);
3511         }
3512         ANGLE_CAPTURE_GL(GetnUniformivRobustANGLE, isCallValid, context, programPacked,
3513                          locationPacked, bufSize, length, params);
3514     }
3515     else
3516     {
3517         GenerateContextLostErrorOnCurrentGlobalContext();
3518     }
3519     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3520 }
3521 
GL_GetnUniformuivRobustANGLE(GLuint program,GLint location,GLsizei bufSize,GLsizei * length,GLuint * params)3522 void GL_APIENTRY GL_GetnUniformuivRobustANGLE(GLuint program,
3523                                               GLint location,
3524                                               GLsizei bufSize,
3525                                               GLsizei *length,
3526                                               GLuint *params)
3527 {
3528     Context *context = GetValidGlobalContext();
3529     EVENT(context, GLGetnUniformuivRobustANGLE,
3530           "context = %d, program = %u, location = %d, bufSize = %d, length = 0x%016" PRIxPTR
3531           ", params = 0x%016" PRIxPTR "",
3532           CID(context), program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
3533 
3534     if (context)
3535     {
3536         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
3537         UniformLocation locationPacked = PackParam<UniformLocation>(location);
3538         SCOPED_SHARE_CONTEXT_LOCK(context);
3539         bool isCallValid = (context->skipValidation() ||
3540                             ValidateGetnUniformuivRobustANGLE(
3541                                 context, angle::EntryPoint::GLGetnUniformuivRobustANGLE,
3542                                 programPacked, locationPacked, bufSize, length, params));
3543         if (isCallValid)
3544         {
3545             context->getnUniformuivRobust(programPacked, locationPacked, bufSize, length, params);
3546         }
3547         ANGLE_CAPTURE_GL(GetnUniformuivRobustANGLE, isCallValid, context, programPacked,
3548                          locationPacked, bufSize, length, params);
3549     }
3550     else
3551     {
3552         GenerateContextLostErrorOnCurrentGlobalContext();
3553     }
3554     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3555 }
3556 
GL_TexParameterIivRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,const GLint * params)3557 void GL_APIENTRY GL_TexParameterIivRobustANGLE(GLenum target,
3558                                                GLenum pname,
3559                                                GLsizei bufSize,
3560                                                const GLint *params)
3561 {
3562     Context *context = GetValidGlobalContext();
3563     EVENT(context, GLTexParameterIivRobustANGLE,
3564           "context = %d, target = %s, pname = %s, bufSize = %d, params = 0x%016" PRIxPTR "",
3565           CID(context), GLenumToString(GLESEnum::AllEnums, target),
3566           GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)params);
3567 
3568     if (context)
3569     {
3570         TextureType targetPacked = PackParam<TextureType>(target);
3571         SCOPED_SHARE_CONTEXT_LOCK(context);
3572         bool isCallValid = (context->skipValidation() ||
3573                             ValidateTexParameterIivRobustANGLE(
3574                                 context, angle::EntryPoint::GLTexParameterIivRobustANGLE,
3575                                 targetPacked, pname, bufSize, params));
3576         if (isCallValid)
3577         {
3578             context->texParameterIivRobust(targetPacked, pname, bufSize, params);
3579         }
3580         ANGLE_CAPTURE_GL(TexParameterIivRobustANGLE, isCallValid, context, targetPacked, pname,
3581                          bufSize, params);
3582     }
3583     else
3584     {
3585         GenerateContextLostErrorOnCurrentGlobalContext();
3586     }
3587     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3588 }
3589 
GL_TexParameterIuivRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,const GLuint * params)3590 void GL_APIENTRY GL_TexParameterIuivRobustANGLE(GLenum target,
3591                                                 GLenum pname,
3592                                                 GLsizei bufSize,
3593                                                 const GLuint *params)
3594 {
3595     Context *context = GetValidGlobalContext();
3596     EVENT(context, GLTexParameterIuivRobustANGLE,
3597           "context = %d, target = %s, pname = %s, bufSize = %d, params = 0x%016" PRIxPTR "",
3598           CID(context), GLenumToString(GLESEnum::AllEnums, target),
3599           GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)params);
3600 
3601     if (context)
3602     {
3603         TextureType targetPacked = PackParam<TextureType>(target);
3604         SCOPED_SHARE_CONTEXT_LOCK(context);
3605         bool isCallValid = (context->skipValidation() ||
3606                             ValidateTexParameterIuivRobustANGLE(
3607                                 context, angle::EntryPoint::GLTexParameterIuivRobustANGLE,
3608                                 targetPacked, pname, bufSize, params));
3609         if (isCallValid)
3610         {
3611             context->texParameterIuivRobust(targetPacked, pname, bufSize, params);
3612         }
3613         ANGLE_CAPTURE_GL(TexParameterIuivRobustANGLE, isCallValid, context, targetPacked, pname,
3614                          bufSize, params);
3615     }
3616     else
3617     {
3618         GenerateContextLostErrorOnCurrentGlobalContext();
3619     }
3620     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3621 }
3622 
GL_GetTexParameterIivRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)3623 void GL_APIENTRY GL_GetTexParameterIivRobustANGLE(GLenum target,
3624                                                   GLenum pname,
3625                                                   GLsizei bufSize,
3626                                                   GLsizei *length,
3627                                                   GLint *params)
3628 {
3629     Context *context = GetValidGlobalContext();
3630     EVENT(context, GLGetTexParameterIivRobustANGLE,
3631           "context = %d, target = %s, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
3632           ", params = 0x%016" PRIxPTR "",
3633           CID(context), GLenumToString(GLESEnum::AllEnums, target),
3634           GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length, (uintptr_t)params);
3635 
3636     if (context)
3637     {
3638         TextureType targetPacked = PackParam<TextureType>(target);
3639         SCOPED_SHARE_CONTEXT_LOCK(context);
3640         bool isCallValid = (context->skipValidation() ||
3641                             ValidateGetTexParameterIivRobustANGLE(
3642                                 context, angle::EntryPoint::GLGetTexParameterIivRobustANGLE,
3643                                 targetPacked, pname, bufSize, length, params));
3644         if (isCallValid)
3645         {
3646             context->getTexParameterIivRobust(targetPacked, pname, bufSize, length, params);
3647         }
3648         ANGLE_CAPTURE_GL(GetTexParameterIivRobustANGLE, isCallValid, context, targetPacked, pname,
3649                          bufSize, length, params);
3650     }
3651     else
3652     {
3653         GenerateContextLostErrorOnCurrentGlobalContext();
3654     }
3655     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3656 }
3657 
GL_GetTexParameterIuivRobustANGLE(GLenum target,GLenum pname,GLsizei bufSize,GLsizei * length,GLuint * params)3658 void GL_APIENTRY GL_GetTexParameterIuivRobustANGLE(GLenum target,
3659                                                    GLenum pname,
3660                                                    GLsizei bufSize,
3661                                                    GLsizei *length,
3662                                                    GLuint *params)
3663 {
3664     Context *context = GetValidGlobalContext();
3665     EVENT(context, GLGetTexParameterIuivRobustANGLE,
3666           "context = %d, target = %s, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
3667           ", params = 0x%016" PRIxPTR "",
3668           CID(context), GLenumToString(GLESEnum::AllEnums, target),
3669           GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length, (uintptr_t)params);
3670 
3671     if (context)
3672     {
3673         TextureType targetPacked = PackParam<TextureType>(target);
3674         SCOPED_SHARE_CONTEXT_LOCK(context);
3675         bool isCallValid = (context->skipValidation() ||
3676                             ValidateGetTexParameterIuivRobustANGLE(
3677                                 context, angle::EntryPoint::GLGetTexParameterIuivRobustANGLE,
3678                                 targetPacked, pname, bufSize, length, params));
3679         if (isCallValid)
3680         {
3681             context->getTexParameterIuivRobust(targetPacked, pname, bufSize, length, params);
3682         }
3683         ANGLE_CAPTURE_GL(GetTexParameterIuivRobustANGLE, isCallValid, context, targetPacked, pname,
3684                          bufSize, length, params);
3685     }
3686     else
3687     {
3688         GenerateContextLostErrorOnCurrentGlobalContext();
3689     }
3690     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3691 }
3692 
GL_SamplerParameterIivRobustANGLE(GLuint sampler,GLenum pname,GLsizei bufSize,const GLint * param)3693 void GL_APIENTRY GL_SamplerParameterIivRobustANGLE(GLuint sampler,
3694                                                    GLenum pname,
3695                                                    GLsizei bufSize,
3696                                                    const GLint *param)
3697 {
3698     Context *context = GetValidGlobalContext();
3699     EVENT(context, GLSamplerParameterIivRobustANGLE,
3700           "context = %d, sampler = %u, pname = %s, bufSize = %d, param = 0x%016" PRIxPTR "",
3701           CID(context), sampler, GLenumToString(GLESEnum::AllEnums, pname), bufSize,
3702           (uintptr_t)param);
3703 
3704     if (context)
3705     {
3706         SamplerID samplerPacked = PackParam<SamplerID>(sampler);
3707         SCOPED_SHARE_CONTEXT_LOCK(context);
3708         bool isCallValid = (context->skipValidation() ||
3709                             ValidateSamplerParameterIivRobustANGLE(
3710                                 context, angle::EntryPoint::GLSamplerParameterIivRobustANGLE,
3711                                 samplerPacked, pname, bufSize, param));
3712         if (isCallValid)
3713         {
3714             context->samplerParameterIivRobust(samplerPacked, pname, bufSize, param);
3715         }
3716         ANGLE_CAPTURE_GL(SamplerParameterIivRobustANGLE, isCallValid, context, samplerPacked, pname,
3717                          bufSize, param);
3718     }
3719     else
3720     {
3721         GenerateContextLostErrorOnCurrentGlobalContext();
3722     }
3723     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3724 }
3725 
GL_SamplerParameterIuivRobustANGLE(GLuint sampler,GLenum pname,GLsizei bufSize,const GLuint * param)3726 void GL_APIENTRY GL_SamplerParameterIuivRobustANGLE(GLuint sampler,
3727                                                     GLenum pname,
3728                                                     GLsizei bufSize,
3729                                                     const GLuint *param)
3730 {
3731     Context *context = GetValidGlobalContext();
3732     EVENT(context, GLSamplerParameterIuivRobustANGLE,
3733           "context = %d, sampler = %u, pname = %s, bufSize = %d, param = 0x%016" PRIxPTR "",
3734           CID(context), sampler, GLenumToString(GLESEnum::AllEnums, pname), bufSize,
3735           (uintptr_t)param);
3736 
3737     if (context)
3738     {
3739         SamplerID samplerPacked = PackParam<SamplerID>(sampler);
3740         SCOPED_SHARE_CONTEXT_LOCK(context);
3741         bool isCallValid = (context->skipValidation() ||
3742                             ValidateSamplerParameterIuivRobustANGLE(
3743                                 context, angle::EntryPoint::GLSamplerParameterIuivRobustANGLE,
3744                                 samplerPacked, pname, bufSize, param));
3745         if (isCallValid)
3746         {
3747             context->samplerParameterIuivRobust(samplerPacked, pname, bufSize, param);
3748         }
3749         ANGLE_CAPTURE_GL(SamplerParameterIuivRobustANGLE, isCallValid, context, samplerPacked,
3750                          pname, bufSize, param);
3751     }
3752     else
3753     {
3754         GenerateContextLostErrorOnCurrentGlobalContext();
3755     }
3756     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3757 }
3758 
GL_GetSamplerParameterIivRobustANGLE(GLuint sampler,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)3759 void GL_APIENTRY GL_GetSamplerParameterIivRobustANGLE(GLuint sampler,
3760                                                       GLenum pname,
3761                                                       GLsizei bufSize,
3762                                                       GLsizei *length,
3763                                                       GLint *params)
3764 {
3765     Context *context = GetValidGlobalContext();
3766     EVENT(context, GLGetSamplerParameterIivRobustANGLE,
3767           "context = %d, sampler = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
3768           ", params = 0x%016" PRIxPTR "",
3769           CID(context), sampler, GLenumToString(GLESEnum::AllEnums, pname), bufSize,
3770           (uintptr_t)length, (uintptr_t)params);
3771 
3772     if (context)
3773     {
3774         SamplerID samplerPacked = PackParam<SamplerID>(sampler);
3775         SCOPED_SHARE_CONTEXT_LOCK(context);
3776         bool isCallValid = (context->skipValidation() ||
3777                             ValidateGetSamplerParameterIivRobustANGLE(
3778                                 context, angle::EntryPoint::GLGetSamplerParameterIivRobustANGLE,
3779                                 samplerPacked, pname, bufSize, length, params));
3780         if (isCallValid)
3781         {
3782             context->getSamplerParameterIivRobust(samplerPacked, pname, bufSize, length, params);
3783         }
3784         ANGLE_CAPTURE_GL(GetSamplerParameterIivRobustANGLE, isCallValid, context, samplerPacked,
3785                          pname, bufSize, length, params);
3786     }
3787     else
3788     {
3789         GenerateContextLostErrorOnCurrentGlobalContext();
3790     }
3791     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3792 }
3793 
GL_GetSamplerParameterIuivRobustANGLE(GLuint sampler,GLenum pname,GLsizei bufSize,GLsizei * length,GLuint * params)3794 void GL_APIENTRY GL_GetSamplerParameterIuivRobustANGLE(GLuint sampler,
3795                                                        GLenum pname,
3796                                                        GLsizei bufSize,
3797                                                        GLsizei *length,
3798                                                        GLuint *params)
3799 {
3800     Context *context = GetValidGlobalContext();
3801     EVENT(context, GLGetSamplerParameterIuivRobustANGLE,
3802           "context = %d, sampler = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
3803           ", params = 0x%016" PRIxPTR "",
3804           CID(context), sampler, GLenumToString(GLESEnum::AllEnums, pname), bufSize,
3805           (uintptr_t)length, (uintptr_t)params);
3806 
3807     if (context)
3808     {
3809         SamplerID samplerPacked = PackParam<SamplerID>(sampler);
3810         SCOPED_SHARE_CONTEXT_LOCK(context);
3811         bool isCallValid = (context->skipValidation() ||
3812                             ValidateGetSamplerParameterIuivRobustANGLE(
3813                                 context, angle::EntryPoint::GLGetSamplerParameterIuivRobustANGLE,
3814                                 samplerPacked, pname, bufSize, length, params));
3815         if (isCallValid)
3816         {
3817             context->getSamplerParameterIuivRobust(samplerPacked, pname, bufSize, length, params);
3818         }
3819         ANGLE_CAPTURE_GL(GetSamplerParameterIuivRobustANGLE, isCallValid, context, samplerPacked,
3820                          pname, bufSize, length, params);
3821     }
3822     else
3823     {
3824         GenerateContextLostErrorOnCurrentGlobalContext();
3825     }
3826     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3827 }
3828 
GL_GetQueryObjectivRobustANGLE(GLuint id,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)3829 void GL_APIENTRY GL_GetQueryObjectivRobustANGLE(GLuint id,
3830                                                 GLenum pname,
3831                                                 GLsizei bufSize,
3832                                                 GLsizei *length,
3833                                                 GLint *params)
3834 {
3835     Context *context = GetGlobalContext();
3836     EVENT(context, GLGetQueryObjectivRobustANGLE,
3837           "context = %d, id = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
3838           ", params = 0x%016" PRIxPTR "",
3839           CID(context), id, GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length,
3840           (uintptr_t)params);
3841 
3842     if (context)
3843     {
3844         QueryID idPacked = PackParam<QueryID>(id);
3845         SCOPED_SHARE_CONTEXT_LOCK(context);
3846         bool isCallValid = (context->skipValidation() ||
3847                             ValidateGetQueryObjectivRobustANGLE(
3848                                 context, angle::EntryPoint::GLGetQueryObjectivRobustANGLE, idPacked,
3849                                 pname, bufSize, length, params));
3850         if (isCallValid)
3851         {
3852             context->getQueryObjectivRobust(idPacked, pname, bufSize, length, params);
3853         }
3854         ANGLE_CAPTURE_GL(GetQueryObjectivRobustANGLE, isCallValid, context, idPacked, pname,
3855                          bufSize, length, params);
3856     }
3857     else
3858     {
3859     }
3860     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3861 }
3862 
GL_GetQueryObjecti64vRobustANGLE(GLuint id,GLenum pname,GLsizei bufSize,GLsizei * length,GLint64 * params)3863 void GL_APIENTRY GL_GetQueryObjecti64vRobustANGLE(GLuint id,
3864                                                   GLenum pname,
3865                                                   GLsizei bufSize,
3866                                                   GLsizei *length,
3867                                                   GLint64 *params)
3868 {
3869     Context *context = GetGlobalContext();
3870     EVENT(context, GLGetQueryObjecti64vRobustANGLE,
3871           "context = %d, id = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
3872           ", params = 0x%016" PRIxPTR "",
3873           CID(context), id, GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length,
3874           (uintptr_t)params);
3875 
3876     if (context)
3877     {
3878         QueryID idPacked = PackParam<QueryID>(id);
3879         SCOPED_SHARE_CONTEXT_LOCK(context);
3880         bool isCallValid = (context->skipValidation() ||
3881                             ValidateGetQueryObjecti64vRobustANGLE(
3882                                 context, angle::EntryPoint::GLGetQueryObjecti64vRobustANGLE,
3883                                 idPacked, pname, bufSize, length, params));
3884         if (isCallValid)
3885         {
3886             context->getQueryObjecti64vRobust(idPacked, pname, bufSize, length, params);
3887         }
3888         ANGLE_CAPTURE_GL(GetQueryObjecti64vRobustANGLE, isCallValid, context, idPacked, pname,
3889                          bufSize, length, params);
3890     }
3891     else
3892     {
3893     }
3894     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3895 }
3896 
GL_GetQueryObjectui64vRobustANGLE(GLuint id,GLenum pname,GLsizei bufSize,GLsizei * length,GLuint64 * params)3897 void GL_APIENTRY GL_GetQueryObjectui64vRobustANGLE(GLuint id,
3898                                                    GLenum pname,
3899                                                    GLsizei bufSize,
3900                                                    GLsizei *length,
3901                                                    GLuint64 *params)
3902 {
3903     Context *context = GetValidGlobalContext();
3904     EVENT(context, GLGetQueryObjectui64vRobustANGLE,
3905           "context = %d, id = %u, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
3906           ", params = 0x%016" PRIxPTR "",
3907           CID(context), id, GLenumToString(GLESEnum::AllEnums, pname), bufSize, (uintptr_t)length,
3908           (uintptr_t)params);
3909 
3910     if (context)
3911     {
3912         QueryID idPacked = PackParam<QueryID>(id);
3913         SCOPED_SHARE_CONTEXT_LOCK(context);
3914         bool isCallValid = (context->skipValidation() ||
3915                             ValidateGetQueryObjectui64vRobustANGLE(
3916                                 context, angle::EntryPoint::GLGetQueryObjectui64vRobustANGLE,
3917                                 idPacked, pname, bufSize, length, params));
3918         if (isCallValid)
3919         {
3920             context->getQueryObjectui64vRobust(idPacked, pname, bufSize, length, params);
3921         }
3922         ANGLE_CAPTURE_GL(GetQueryObjectui64vRobustANGLE, isCallValid, context, idPacked, pname,
3923                          bufSize, length, params);
3924     }
3925     else
3926     {
3927         GenerateContextLostErrorOnCurrentGlobalContext();
3928     }
3929     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3930 }
3931 
3932 // GL_ANGLE_robust_resource_initialization
3933 
3934 // GL_ANGLE_semaphore_fuchsia
GL_ImportSemaphoreZirconHandleANGLE(GLuint semaphore,GLenum handleType,GLuint handle)3935 void GL_APIENTRY GL_ImportSemaphoreZirconHandleANGLE(GLuint semaphore,
3936                                                      GLenum handleType,
3937                                                      GLuint handle)
3938 {
3939     Context *context = GetValidGlobalContext();
3940     EVENT(context, GLImportSemaphoreZirconHandleANGLE,
3941           "context = %d, semaphore = %u, handleType = %s, handle = %u", CID(context), semaphore,
3942           GLenumToString(GLESEnum::ExternalHandleType, handleType), handle);
3943 
3944     if (context)
3945     {
3946         SemaphoreID semaphorePacked = PackParam<SemaphoreID>(semaphore);
3947         HandleType handleTypePacked = PackParam<HandleType>(handleType);
3948         SCOPED_SHARE_CONTEXT_LOCK(context);
3949         bool isCallValid =
3950             (context->skipValidation() ||
3951              (ValidatePixelLocalStorageInactive(
3952                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
3953                   angle::EntryPoint::GLImportSemaphoreZirconHandleANGLE) &&
3954               ValidateImportSemaphoreZirconHandleANGLE(
3955                   context, angle::EntryPoint::GLImportSemaphoreZirconHandleANGLE, semaphorePacked,
3956                   handleTypePacked, handle)));
3957         if (isCallValid)
3958         {
3959             context->importSemaphoreZirconHandle(semaphorePacked, handleTypePacked, handle);
3960         }
3961         ANGLE_CAPTURE_GL(ImportSemaphoreZirconHandleANGLE, isCallValid, context, semaphorePacked,
3962                          handleTypePacked, handle);
3963     }
3964     else
3965     {
3966         GenerateContextLostErrorOnCurrentGlobalContext();
3967     }
3968     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
3969 }
3970 
3971 // GL_ANGLE_shader_pixel_local_storage
GL_FramebufferMemorylessPixelLocalStorageANGLE(GLint plane,GLenum internalformat)3972 void GL_APIENTRY GL_FramebufferMemorylessPixelLocalStorageANGLE(GLint plane, GLenum internalformat)
3973 {
3974     Context *context = GetValidGlobalContext();
3975     EVENT(context, GLFramebufferMemorylessPixelLocalStorageANGLE,
3976           "context = %d, plane = %d, internalformat = %s", CID(context), plane,
3977           GLenumToString(GLESEnum::AllEnums, internalformat));
3978 
3979     if (context)
3980     {
3981         SCOPED_SHARE_CONTEXT_LOCK(context);
3982         bool isCallValid =
3983             (context->skipValidation() ||
3984              (ValidatePixelLocalStorageInactive(
3985                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
3986                   angle::EntryPoint::GLFramebufferMemorylessPixelLocalStorageANGLE) &&
3987               ValidateFramebufferMemorylessPixelLocalStorageANGLE(
3988                   context, angle::EntryPoint::GLFramebufferMemorylessPixelLocalStorageANGLE, plane,
3989                   internalformat)));
3990         if (isCallValid)
3991         {
3992             context->framebufferMemorylessPixelLocalStorage(plane, internalformat);
3993         }
3994         ANGLE_CAPTURE_GL(FramebufferMemorylessPixelLocalStorageANGLE, isCallValid, context, plane,
3995                          internalformat);
3996     }
3997     else
3998     {
3999         GenerateContextLostErrorOnCurrentGlobalContext();
4000     }
4001     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4002 }
4003 
GL_FramebufferTexturePixelLocalStorageANGLE(GLint plane,GLuint backingtexture,GLint level,GLint layer)4004 void GL_APIENTRY GL_FramebufferTexturePixelLocalStorageANGLE(GLint plane,
4005                                                              GLuint backingtexture,
4006                                                              GLint level,
4007                                                              GLint layer)
4008 {
4009     Context *context = GetValidGlobalContext();
4010     EVENT(context, GLFramebufferTexturePixelLocalStorageANGLE,
4011           "context = %d, plane = %d, backingtexture = %u, level = %d, layer = %d", CID(context),
4012           plane, backingtexture, level, layer);
4013 
4014     if (context)
4015     {
4016         TextureID backingtexturePacked = PackParam<TextureID>(backingtexture);
4017         SCOPED_SHARE_CONTEXT_LOCK(context);
4018         bool isCallValid =
4019             (context->skipValidation() ||
4020              (ValidatePixelLocalStorageInactive(
4021                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
4022                   angle::EntryPoint::GLFramebufferTexturePixelLocalStorageANGLE) &&
4023               ValidateFramebufferTexturePixelLocalStorageANGLE(
4024                   context, angle::EntryPoint::GLFramebufferTexturePixelLocalStorageANGLE, plane,
4025                   backingtexturePacked, level, layer)));
4026         if (isCallValid)
4027         {
4028             context->framebufferTexturePixelLocalStorage(plane, backingtexturePacked, level, layer);
4029         }
4030         ANGLE_CAPTURE_GL(FramebufferTexturePixelLocalStorageANGLE, isCallValid, context, plane,
4031                          backingtexturePacked, level, layer);
4032     }
4033     else
4034     {
4035         GenerateContextLostErrorOnCurrentGlobalContext();
4036     }
4037     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4038 }
4039 
GL_FramebufferPixelLocalClearValuefvANGLE(GLint plane,const GLfloat * value)4040 void GL_APIENTRY GL_FramebufferPixelLocalClearValuefvANGLE(GLint plane, const GLfloat *value)
4041 {
4042     Context *context = GetValidGlobalContext();
4043     EVENT(context, GLFramebufferPixelLocalClearValuefvANGLE,
4044           "context = %d, plane = %d, value = 0x%016" PRIxPTR "", CID(context), plane,
4045           (uintptr_t)value);
4046 
4047     if (context)
4048     {
4049         SCOPED_SHARE_CONTEXT_LOCK(context);
4050         bool isCallValid =
4051             (context->skipValidation() ||
4052              (ValidatePixelLocalStorageInactive(
4053                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
4054                   angle::EntryPoint::GLFramebufferPixelLocalClearValuefvANGLE) &&
4055               ValidateFramebufferPixelLocalClearValuefvANGLE(
4056                   context, angle::EntryPoint::GLFramebufferPixelLocalClearValuefvANGLE, plane,
4057                   value)));
4058         if (isCallValid)
4059         {
4060             context->framebufferPixelLocalClearValuefv(plane, value);
4061         }
4062         ANGLE_CAPTURE_GL(FramebufferPixelLocalClearValuefvANGLE, isCallValid, context, plane,
4063                          value);
4064     }
4065     else
4066     {
4067         GenerateContextLostErrorOnCurrentGlobalContext();
4068     }
4069     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4070 }
4071 
GL_FramebufferPixelLocalClearValueivANGLE(GLint plane,const GLint * value)4072 void GL_APIENTRY GL_FramebufferPixelLocalClearValueivANGLE(GLint plane, const GLint *value)
4073 {
4074     Context *context = GetValidGlobalContext();
4075     EVENT(context, GLFramebufferPixelLocalClearValueivANGLE,
4076           "context = %d, plane = %d, value = 0x%016" PRIxPTR "", CID(context), plane,
4077           (uintptr_t)value);
4078 
4079     if (context)
4080     {
4081         SCOPED_SHARE_CONTEXT_LOCK(context);
4082         bool isCallValid =
4083             (context->skipValidation() ||
4084              (ValidatePixelLocalStorageInactive(
4085                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
4086                   angle::EntryPoint::GLFramebufferPixelLocalClearValueivANGLE) &&
4087               ValidateFramebufferPixelLocalClearValueivANGLE(
4088                   context, angle::EntryPoint::GLFramebufferPixelLocalClearValueivANGLE, plane,
4089                   value)));
4090         if (isCallValid)
4091         {
4092             context->framebufferPixelLocalClearValueiv(plane, value);
4093         }
4094         ANGLE_CAPTURE_GL(FramebufferPixelLocalClearValueivANGLE, isCallValid, context, plane,
4095                          value);
4096     }
4097     else
4098     {
4099         GenerateContextLostErrorOnCurrentGlobalContext();
4100     }
4101     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4102 }
4103 
GL_FramebufferPixelLocalClearValueuivANGLE(GLint plane,const GLuint * value)4104 void GL_APIENTRY GL_FramebufferPixelLocalClearValueuivANGLE(GLint plane, const GLuint *value)
4105 {
4106     Context *context = GetValidGlobalContext();
4107     EVENT(context, GLFramebufferPixelLocalClearValueuivANGLE,
4108           "context = %d, plane = %d, value = 0x%016" PRIxPTR "", CID(context), plane,
4109           (uintptr_t)value);
4110 
4111     if (context)
4112     {
4113         SCOPED_SHARE_CONTEXT_LOCK(context);
4114         bool isCallValid =
4115             (context->skipValidation() ||
4116              (ValidatePixelLocalStorageInactive(
4117                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
4118                   angle::EntryPoint::GLFramebufferPixelLocalClearValueuivANGLE) &&
4119               ValidateFramebufferPixelLocalClearValueuivANGLE(
4120                   context, angle::EntryPoint::GLFramebufferPixelLocalClearValueuivANGLE, plane,
4121                   value)));
4122         if (isCallValid)
4123         {
4124             context->framebufferPixelLocalClearValueuiv(plane, value);
4125         }
4126         ANGLE_CAPTURE_GL(FramebufferPixelLocalClearValueuivANGLE, isCallValid, context, plane,
4127                          value);
4128     }
4129     else
4130     {
4131         GenerateContextLostErrorOnCurrentGlobalContext();
4132     }
4133     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4134 }
4135 
GL_BeginPixelLocalStorageANGLE(GLsizei n,const GLenum * loadops)4136 void GL_APIENTRY GL_BeginPixelLocalStorageANGLE(GLsizei n, const GLenum *loadops)
4137 {
4138     Context *context = GetValidGlobalContext();
4139     EVENT(context, GLBeginPixelLocalStorageANGLE,
4140           "context = %d, n = %d, loadops = 0x%016" PRIxPTR "", CID(context), n, (uintptr_t)loadops);
4141 
4142     if (context)
4143     {
4144         SCOPED_SHARE_CONTEXT_LOCK(context);
4145         bool isCallValid =
4146             (context->skipValidation() ||
4147              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4148                                                 context->getMutableErrorSetForValidation(),
4149                                                 angle::EntryPoint::GLBeginPixelLocalStorageANGLE) &&
4150               ValidateBeginPixelLocalStorageANGLE(
4151                   context, angle::EntryPoint::GLBeginPixelLocalStorageANGLE, n, loadops)));
4152         if (isCallValid)
4153         {
4154             context->beginPixelLocalStorage(n, loadops);
4155         }
4156         ANGLE_CAPTURE_GL(BeginPixelLocalStorageANGLE, isCallValid, context, n, loadops);
4157     }
4158     else
4159     {
4160         GenerateContextLostErrorOnCurrentGlobalContext();
4161     }
4162     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4163 }
4164 
GL_EndPixelLocalStorageANGLE(GLsizei n,const GLenum * storeops)4165 void GL_APIENTRY GL_EndPixelLocalStorageANGLE(GLsizei n, const GLenum *storeops)
4166 {
4167     Context *context = GetValidGlobalContext();
4168     EVENT(context, GLEndPixelLocalStorageANGLE,
4169           "context = %d, n = %d, storeops = 0x%016" PRIxPTR "", CID(context), n,
4170           (uintptr_t)storeops);
4171 
4172     if (context)
4173     {
4174         SCOPED_SHARE_CONTEXT_LOCK(context);
4175         bool isCallValid =
4176             (context->skipValidation() ||
4177              ValidateEndPixelLocalStorageANGLE(
4178                  context, angle::EntryPoint::GLEndPixelLocalStorageANGLE, n, storeops));
4179         if (isCallValid)
4180         {
4181             context->endPixelLocalStorage(n, storeops);
4182         }
4183         ANGLE_CAPTURE_GL(EndPixelLocalStorageANGLE, isCallValid, context, n, storeops);
4184     }
4185     else
4186     {
4187         GenerateContextLostErrorOnCurrentGlobalContext();
4188     }
4189     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4190 }
4191 
GL_PixelLocalStorageBarrierANGLE()4192 void GL_APIENTRY GL_PixelLocalStorageBarrierANGLE()
4193 {
4194     Context *context = GetValidGlobalContext();
4195     EVENT(context, GLPixelLocalStorageBarrierANGLE, "context = %d", CID(context));
4196 
4197     if (context)
4198     {
4199         SCOPED_SHARE_CONTEXT_LOCK(context);
4200         bool isCallValid = (context->skipValidation() ||
4201                             ValidatePixelLocalStorageBarrierANGLE(
4202                                 context, angle::EntryPoint::GLPixelLocalStorageBarrierANGLE));
4203         if (isCallValid)
4204         {
4205             context->pixelLocalStorageBarrier();
4206         }
4207         ANGLE_CAPTURE_GL(PixelLocalStorageBarrierANGLE, isCallValid, context);
4208     }
4209     else
4210     {
4211         GenerateContextLostErrorOnCurrentGlobalContext();
4212     }
4213     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4214 }
4215 
GL_FramebufferPixelLocalStorageInterruptANGLE()4216 void GL_APIENTRY GL_FramebufferPixelLocalStorageInterruptANGLE()
4217 {
4218     Context *context = GetValidGlobalContext();
4219     EVENT(context, GLFramebufferPixelLocalStorageInterruptANGLE, "context = %d", CID(context));
4220 
4221     if (context)
4222     {
4223         SCOPED_SHARE_CONTEXT_LOCK(context);
4224         bool isCallValid =
4225             (context->skipValidation() ||
4226              ValidateFramebufferPixelLocalStorageInterruptANGLE(
4227                  context, angle::EntryPoint::GLFramebufferPixelLocalStorageInterruptANGLE));
4228         if (isCallValid)
4229         {
4230             context->framebufferPixelLocalStorageInterrupt();
4231         }
4232         ANGLE_CAPTURE_GL(FramebufferPixelLocalStorageInterruptANGLE, isCallValid, context);
4233     }
4234     else
4235     {
4236         GenerateContextLostErrorOnCurrentGlobalContext();
4237     }
4238     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4239 }
4240 
GL_FramebufferPixelLocalStorageRestoreANGLE()4241 void GL_APIENTRY GL_FramebufferPixelLocalStorageRestoreANGLE()
4242 {
4243     Context *context = GetValidGlobalContext();
4244     EVENT(context, GLFramebufferPixelLocalStorageRestoreANGLE, "context = %d", CID(context));
4245 
4246     if (context)
4247     {
4248         SCOPED_SHARE_CONTEXT_LOCK(context);
4249         bool isCallValid =
4250             (context->skipValidation() ||
4251              (ValidatePixelLocalStorageInactive(
4252                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
4253                   angle::EntryPoint::GLFramebufferPixelLocalStorageRestoreANGLE) &&
4254               ValidateFramebufferPixelLocalStorageRestoreANGLE(
4255                   context, angle::EntryPoint::GLFramebufferPixelLocalStorageRestoreANGLE)));
4256         if (isCallValid)
4257         {
4258             context->framebufferPixelLocalStorageRestore();
4259         }
4260         ANGLE_CAPTURE_GL(FramebufferPixelLocalStorageRestoreANGLE, isCallValid, context);
4261     }
4262     else
4263     {
4264         GenerateContextLostErrorOnCurrentGlobalContext();
4265     }
4266     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4267 }
4268 
GL_GetFramebufferPixelLocalStorageParameterfvANGLE(GLint plane,GLenum pname,GLfloat * params)4269 void GL_APIENTRY GL_GetFramebufferPixelLocalStorageParameterfvANGLE(GLint plane,
4270                                                                     GLenum pname,
4271                                                                     GLfloat *params)
4272 {
4273     Context *context = GetValidGlobalContext();
4274     EVENT(context, GLGetFramebufferPixelLocalStorageParameterfvANGLE,
4275           "context = %d, plane = %d, pname = %s, params = 0x%016" PRIxPTR "", CID(context), plane,
4276           GLenumToString(GLESEnum::PLSQueryFloat, pname), (uintptr_t)params);
4277 
4278     if (context)
4279     {
4280         SCOPED_SHARE_CONTEXT_LOCK(context);
4281         bool isCallValid =
4282             (context->skipValidation() ||
4283              ValidateGetFramebufferPixelLocalStorageParameterfvANGLE(
4284                  context, angle::EntryPoint::GLGetFramebufferPixelLocalStorageParameterfvANGLE,
4285                  plane, pname, params));
4286         if (isCallValid)
4287         {
4288             context->getFramebufferPixelLocalStorageParameterfv(plane, pname, params);
4289         }
4290         ANGLE_CAPTURE_GL(GetFramebufferPixelLocalStorageParameterfvANGLE, isCallValid, context,
4291                          plane, pname, params);
4292     }
4293     else
4294     {
4295         GenerateContextLostErrorOnCurrentGlobalContext();
4296     }
4297     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4298 }
4299 
GL_GetFramebufferPixelLocalStorageParameterivANGLE(GLint plane,GLenum pname,GLint * params)4300 void GL_APIENTRY GL_GetFramebufferPixelLocalStorageParameterivANGLE(GLint plane,
4301                                                                     GLenum pname,
4302                                                                     GLint *params)
4303 {
4304     Context *context = GetValidGlobalContext();
4305     EVENT(context, GLGetFramebufferPixelLocalStorageParameterivANGLE,
4306           "context = %d, plane = %d, pname = %s, params = 0x%016" PRIxPTR "", CID(context), plane,
4307           GLenumToString(GLESEnum::PLSQueryInt, pname), (uintptr_t)params);
4308 
4309     if (context)
4310     {
4311         SCOPED_SHARE_CONTEXT_LOCK(context);
4312         bool isCallValid =
4313             (context->skipValidation() ||
4314              ValidateGetFramebufferPixelLocalStorageParameterivANGLE(
4315                  context, angle::EntryPoint::GLGetFramebufferPixelLocalStorageParameterivANGLE,
4316                  plane, pname, params));
4317         if (isCallValid)
4318         {
4319             context->getFramebufferPixelLocalStorageParameteriv(plane, pname, params);
4320         }
4321         ANGLE_CAPTURE_GL(GetFramebufferPixelLocalStorageParameterivANGLE, isCallValid, context,
4322                          plane, pname, params);
4323     }
4324     else
4325     {
4326         GenerateContextLostErrorOnCurrentGlobalContext();
4327     }
4328     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4329 }
4330 
GL_GetFramebufferPixelLocalStorageParameterfvRobustANGLE(GLint plane,GLenum pname,GLsizei bufSize,GLsizei * length,GLfloat * params)4331 void GL_APIENTRY GL_GetFramebufferPixelLocalStorageParameterfvRobustANGLE(GLint plane,
4332                                                                           GLenum pname,
4333                                                                           GLsizei bufSize,
4334                                                                           GLsizei *length,
4335                                                                           GLfloat *params)
4336 {
4337     Context *context = GetValidGlobalContext();
4338     EVENT(context, GLGetFramebufferPixelLocalStorageParameterfvRobustANGLE,
4339           "context = %d, plane = %d, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
4340           ", params = 0x%016" PRIxPTR "",
4341           CID(context), plane, GLenumToString(GLESEnum::PLSQueryFloat, pname), bufSize,
4342           (uintptr_t)length, (uintptr_t)params);
4343 
4344     if (context)
4345     {
4346         SCOPED_SHARE_CONTEXT_LOCK(context);
4347         bool isCallValid =
4348             (context->skipValidation() ||
4349              ValidateGetFramebufferPixelLocalStorageParameterfvRobustANGLE(
4350                  context,
4351                  angle::EntryPoint::GLGetFramebufferPixelLocalStorageParameterfvRobustANGLE, plane,
4352                  pname, bufSize, length, params));
4353         if (isCallValid)
4354         {
4355             context->getFramebufferPixelLocalStorageParameterfvRobust(plane, pname, bufSize, length,
4356                                                                       params);
4357         }
4358         ANGLE_CAPTURE_GL(GetFramebufferPixelLocalStorageParameterfvRobustANGLE, isCallValid,
4359                          context, plane, pname, bufSize, length, params);
4360     }
4361     else
4362     {
4363         GenerateContextLostErrorOnCurrentGlobalContext();
4364     }
4365     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4366 }
4367 
GL_GetFramebufferPixelLocalStorageParameterivRobustANGLE(GLint plane,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * params)4368 void GL_APIENTRY GL_GetFramebufferPixelLocalStorageParameterivRobustANGLE(GLint plane,
4369                                                                           GLenum pname,
4370                                                                           GLsizei bufSize,
4371                                                                           GLsizei *length,
4372                                                                           GLint *params)
4373 {
4374     Context *context = GetValidGlobalContext();
4375     EVENT(context, GLGetFramebufferPixelLocalStorageParameterivRobustANGLE,
4376           "context = %d, plane = %d, pname = %s, bufSize = %d, length = 0x%016" PRIxPTR
4377           ", params = 0x%016" PRIxPTR "",
4378           CID(context), plane, GLenumToString(GLESEnum::PLSQueryInt, pname), bufSize,
4379           (uintptr_t)length, (uintptr_t)params);
4380 
4381     if (context)
4382     {
4383         SCOPED_SHARE_CONTEXT_LOCK(context);
4384         bool isCallValid =
4385             (context->skipValidation() ||
4386              ValidateGetFramebufferPixelLocalStorageParameterivRobustANGLE(
4387                  context,
4388                  angle::EntryPoint::GLGetFramebufferPixelLocalStorageParameterivRobustANGLE, plane,
4389                  pname, bufSize, length, params));
4390         if (isCallValid)
4391         {
4392             context->getFramebufferPixelLocalStorageParameterivRobust(plane, pname, bufSize, length,
4393                                                                       params);
4394         }
4395         ANGLE_CAPTURE_GL(GetFramebufferPixelLocalStorageParameterivRobustANGLE, isCallValid,
4396                          context, plane, pname, bufSize, length, params);
4397     }
4398     else
4399     {
4400         GenerateContextLostErrorOnCurrentGlobalContext();
4401     }
4402     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4403 }
4404 
4405 // GL_ANGLE_stencil_texturing
4406 
4407 // GL_ANGLE_texture_compression_dxt3
4408 
4409 // GL_ANGLE_texture_compression_dxt5
4410 
4411 // GL_ANGLE_texture_external_update
GL_TexImage2DExternalANGLE(GLenum target,GLint level,GLint internalformat,GLsizei width,GLsizei height,GLint border,GLenum format,GLenum type)4412 void GL_APIENTRY GL_TexImage2DExternalANGLE(GLenum target,
4413                                             GLint level,
4414                                             GLint internalformat,
4415                                             GLsizei width,
4416                                             GLsizei height,
4417                                             GLint border,
4418                                             GLenum format,
4419                                             GLenum type)
4420 {
4421     Context *context = GetValidGlobalContext();
4422     EVENT(context, GLTexImage2DExternalANGLE,
4423           "context = %d, target = %s, level = %d, internalformat = %d, width = %d, height = %d, "
4424           "border = %d, format = %s, type = %s",
4425           CID(context), GLenumToString(GLESEnum::TextureTarget, target), level, internalformat,
4426           width, height, border, GLenumToString(GLESEnum::PixelFormat, format),
4427           GLenumToString(GLESEnum::PixelType, type));
4428 
4429     if (context)
4430     {
4431         TextureTarget targetPacked = PackParam<TextureTarget>(target);
4432         SCOPED_SHARE_CONTEXT_LOCK(context);
4433         bool isCallValid =
4434             (context->skipValidation() ||
4435              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4436                                                 context->getMutableErrorSetForValidation(),
4437                                                 angle::EntryPoint::GLTexImage2DExternalANGLE) &&
4438               ValidateTexImage2DExternalANGLE(context, angle::EntryPoint::GLTexImage2DExternalANGLE,
4439                                               targetPacked, level, internalformat, width, height,
4440                                               border, format, type)));
4441         if (isCallValid)
4442         {
4443             context->texImage2DExternal(targetPacked, level, internalformat, width, height, border,
4444                                         format, type);
4445         }
4446         ANGLE_CAPTURE_GL(TexImage2DExternalANGLE, isCallValid, context, targetPacked, level,
4447                          internalformat, width, height, border, format, type);
4448     }
4449     else
4450     {
4451         GenerateContextLostErrorOnCurrentGlobalContext();
4452     }
4453     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4454 }
4455 
GL_InvalidateTextureANGLE(GLenum target)4456 void GL_APIENTRY GL_InvalidateTextureANGLE(GLenum target)
4457 {
4458     Context *context = GetValidGlobalContext();
4459     EVENT(context, GLInvalidateTextureANGLE, "context = %d, target = %s", CID(context),
4460           GLenumToString(GLESEnum::TextureTarget, target));
4461 
4462     if (context)
4463     {
4464         TextureType targetPacked = PackParam<TextureType>(target);
4465         SCOPED_SHARE_CONTEXT_LOCK(context);
4466         bool isCallValid =
4467             (context->skipValidation() ||
4468              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4469                                                 context->getMutableErrorSetForValidation(),
4470                                                 angle::EntryPoint::GLInvalidateTextureANGLE) &&
4471               ValidateInvalidateTextureANGLE(context, angle::EntryPoint::GLInvalidateTextureANGLE,
4472                                              targetPacked)));
4473         if (isCallValid)
4474         {
4475             context->invalidateTexture(targetPacked);
4476         }
4477         ANGLE_CAPTURE_GL(InvalidateTextureANGLE, isCallValid, context, targetPacked);
4478     }
4479     else
4480     {
4481         GenerateContextLostErrorOnCurrentGlobalContext();
4482     }
4483     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4484 }
4485 
4486 // GL_ANGLE_texture_multisample
GL_TexStorage2DMultisampleANGLE(GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height,GLboolean fixedsamplelocations)4487 void GL_APIENTRY GL_TexStorage2DMultisampleANGLE(GLenum target,
4488                                                  GLsizei samples,
4489                                                  GLenum internalformat,
4490                                                  GLsizei width,
4491                                                  GLsizei height,
4492                                                  GLboolean fixedsamplelocations)
4493 {
4494     Context *context = GetValidGlobalContext();
4495     EVENT(context, GLTexStorage2DMultisampleANGLE,
4496           "context = %d, target = %s, samples = %d, internalformat = %s, width = %d, height = %d, "
4497           "fixedsamplelocations = %s",
4498           CID(context), GLenumToString(GLESEnum::AllEnums, target), samples,
4499           GLenumToString(GLESEnum::AllEnums, internalformat), width, height,
4500           GLbooleanToString(fixedsamplelocations));
4501 
4502     if (context)
4503     {
4504         TextureType targetPacked = PackParam<TextureType>(target);
4505         SCOPED_SHARE_CONTEXT_LOCK(context);
4506         bool isCallValid =
4507             (context->skipValidation() ||
4508              (ValidatePixelLocalStorageInactive(
4509                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
4510                   angle::EntryPoint::GLTexStorage2DMultisampleANGLE) &&
4511               ValidateTexStorage2DMultisampleANGLE(
4512                   context, angle::EntryPoint::GLTexStorage2DMultisampleANGLE, targetPacked, samples,
4513                   internalformat, width, height, fixedsamplelocations)));
4514         if (isCallValid)
4515         {
4516             context->texStorage2DMultisample(targetPacked, samples, internalformat, width, height,
4517                                              fixedsamplelocations);
4518         }
4519         ANGLE_CAPTURE_GL(TexStorage2DMultisampleANGLE, isCallValid, context, targetPacked, samples,
4520                          internalformat, width, height, fixedsamplelocations);
4521     }
4522     else
4523     {
4524         GenerateContextLostErrorOnCurrentGlobalContext();
4525     }
4526     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4527 }
4528 
GL_GetMultisamplefvANGLE(GLenum pname,GLuint index,GLfloat * val)4529 void GL_APIENTRY GL_GetMultisamplefvANGLE(GLenum pname, GLuint index, GLfloat *val)
4530 {
4531     Context *context = GetValidGlobalContext();
4532     EVENT(context, GLGetMultisamplefvANGLE,
4533           "context = %d, pname = %s, index = %u, val = 0x%016" PRIxPTR "", CID(context),
4534           GLenumToString(GLESEnum::AllEnums, pname), index, (uintptr_t)val);
4535 
4536     if (context)
4537     {
4538         SCOPED_SHARE_CONTEXT_LOCK(context);
4539         bool isCallValid =
4540             (context->skipValidation() ||
4541              ValidateGetMultisamplefvANGLE(context, angle::EntryPoint::GLGetMultisamplefvANGLE,
4542                                            pname, index, val));
4543         if (isCallValid)
4544         {
4545             context->getMultisamplefv(pname, index, val);
4546         }
4547         ANGLE_CAPTURE_GL(GetMultisamplefvANGLE, isCallValid, context, pname, index, val);
4548     }
4549     else
4550     {
4551         GenerateContextLostErrorOnCurrentGlobalContext();
4552     }
4553     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4554 }
4555 
GL_SampleMaskiANGLE(GLuint maskNumber,GLbitfield mask)4556 void GL_APIENTRY GL_SampleMaskiANGLE(GLuint maskNumber, GLbitfield mask)
4557 {
4558     Context *context = GetValidGlobalContext();
4559     EVENT(context, GLSampleMaskiANGLE, "context = %d, maskNumber = %u, mask = %s", CID(context),
4560           maskNumber, GLbitfieldToString(GLESEnum::AllEnums, mask).c_str());
4561 
4562     if (context)
4563     {
4564         bool isCallValid =
4565             (context->skipValidation() ||
4566              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4567                                                 context->getMutableErrorSetForValidation(),
4568                                                 angle::EntryPoint::GLSampleMaskiANGLE) &&
4569               ValidateSampleMaskiANGLE(context->getPrivateState(),
4570                                        context->getMutableErrorSetForValidation(),
4571                                        angle::EntryPoint::GLSampleMaskiANGLE, maskNumber, mask)));
4572         if (isCallValid)
4573         {
4574             ContextPrivateSampleMaski(context->getMutablePrivateState(),
4575                                       context->getMutablePrivateStateCache(), maskNumber, mask);
4576         }
4577         ANGLE_CAPTURE_GL(SampleMaskiANGLE, isCallValid, context, maskNumber, mask);
4578     }
4579     else
4580     {
4581         GenerateContextLostErrorOnCurrentGlobalContext();
4582     }
4583     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4584 }
4585 
4586 // GetTexLevelParameterfvANGLE is already defined.
4587 
4588 // GetTexLevelParameterivANGLE is already defined.
4589 
4590 // GL_ANGLE_texture_usage
4591 
4592 // GL_ANGLE_translated_shader_source
GL_GetTranslatedShaderSourceANGLE(GLuint shader,GLsizei bufSize,GLsizei * length,GLchar * source)4593 void GL_APIENTRY GL_GetTranslatedShaderSourceANGLE(GLuint shader,
4594                                                    GLsizei bufSize,
4595                                                    GLsizei *length,
4596                                                    GLchar *source)
4597 {
4598     Context *context = GetValidGlobalContext();
4599     EVENT(context, GLGetTranslatedShaderSourceANGLE,
4600           "context = %d, shader = %u, bufSize = %d, length = 0x%016" PRIxPTR
4601           ", source = 0x%016" PRIxPTR "",
4602           CID(context), shader, bufSize, (uintptr_t)length, (uintptr_t)source);
4603 
4604     if (context)
4605     {
4606         ShaderProgramID shaderPacked = PackParam<ShaderProgramID>(shader);
4607         SCOPED_SHARE_CONTEXT_LOCK(context);
4608         bool isCallValid = (context->skipValidation() ||
4609                             ValidateGetTranslatedShaderSourceANGLE(
4610                                 context, angle::EntryPoint::GLGetTranslatedShaderSourceANGLE,
4611                                 shaderPacked, bufSize, length, source));
4612         if (isCallValid)
4613         {
4614             context->getTranslatedShaderSource(shaderPacked, bufSize, length, source);
4615         }
4616         ANGLE_CAPTURE_GL(GetTranslatedShaderSourceANGLE, isCallValid, context, shaderPacked,
4617                          bufSize, length, source);
4618     }
4619     else
4620     {
4621         GenerateContextLostErrorOnCurrentGlobalContext();
4622     }
4623     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4624 }
4625 
4626 // GL_ANGLE_vulkan_image
GL_AcquireTexturesANGLE(GLuint numTextures,const GLuint * textures,const GLenum * layouts)4627 void GL_APIENTRY GL_AcquireTexturesANGLE(GLuint numTextures,
4628                                          const GLuint *textures,
4629                                          const GLenum *layouts)
4630 {
4631     Context *context = GetValidGlobalContext();
4632     EVENT(context, GLAcquireTexturesANGLE,
4633           "context = %d, numTextures = %u, textures = 0x%016" PRIxPTR ", layouts = 0x%016" PRIxPTR
4634           "",
4635           CID(context), numTextures, (uintptr_t)textures, (uintptr_t)layouts);
4636 
4637     if (context)
4638     {
4639         const TextureID *texturesPacked = PackParam<const TextureID *>(textures);
4640         SCOPED_SHARE_CONTEXT_LOCK(context);
4641         bool isCallValid =
4642             (context->skipValidation() ||
4643              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4644                                                 context->getMutableErrorSetForValidation(),
4645                                                 angle::EntryPoint::GLAcquireTexturesANGLE) &&
4646               ValidateAcquireTexturesANGLE(context, angle::EntryPoint::GLAcquireTexturesANGLE,
4647                                            numTextures, texturesPacked, layouts)));
4648         if (isCallValid)
4649         {
4650             context->acquireTextures(numTextures, texturesPacked, layouts);
4651         }
4652         ANGLE_CAPTURE_GL(AcquireTexturesANGLE, isCallValid, context, numTextures, texturesPacked,
4653                          layouts);
4654     }
4655     else
4656     {
4657         GenerateContextLostErrorOnCurrentGlobalContext();
4658     }
4659     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4660 }
4661 
GL_ReleaseTexturesANGLE(GLuint numTextures,const GLuint * textures,GLenum * layouts)4662 void GL_APIENTRY GL_ReleaseTexturesANGLE(GLuint numTextures,
4663                                          const GLuint *textures,
4664                                          GLenum *layouts)
4665 {
4666     Context *context = GetValidGlobalContext();
4667     EVENT(context, GLReleaseTexturesANGLE,
4668           "context = %d, numTextures = %u, textures = 0x%016" PRIxPTR ", layouts = 0x%016" PRIxPTR
4669           "",
4670           CID(context), numTextures, (uintptr_t)textures, (uintptr_t)layouts);
4671 
4672     if (context)
4673     {
4674         const TextureID *texturesPacked = PackParam<const TextureID *>(textures);
4675         SCOPED_SHARE_CONTEXT_LOCK(context);
4676         bool isCallValid =
4677             (context->skipValidation() ||
4678              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4679                                                 context->getMutableErrorSetForValidation(),
4680                                                 angle::EntryPoint::GLReleaseTexturesANGLE) &&
4681               ValidateReleaseTexturesANGLE(context, angle::EntryPoint::GLReleaseTexturesANGLE,
4682                                            numTextures, texturesPacked, layouts)));
4683         if (isCallValid)
4684         {
4685             context->releaseTextures(numTextures, texturesPacked, layouts);
4686         }
4687         ANGLE_CAPTURE_GL(ReleaseTexturesANGLE, isCallValid, context, numTextures, texturesPacked,
4688                          layouts);
4689     }
4690     else
4691     {
4692         GenerateContextLostErrorOnCurrentGlobalContext();
4693     }
4694     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4695 }
4696 
4697 // GL_APPLE_clip_distance
4698 
4699 // GL_ARB_sync
4700 // ClientWaitSync is already defined.
4701 
4702 // DeleteSync is already defined.
4703 
4704 // FenceSync is already defined.
4705 
4706 // GetInteger64v is already defined.
4707 
4708 // GetSynciv is already defined.
4709 
4710 // IsSync is already defined.
4711 
4712 // WaitSync is already defined.
4713 
4714 // GL_ARM_shader_framebuffer_fetch
4715 
4716 // GL_CHROMIUM_bind_uniform_location
GL_BindUniformLocationCHROMIUM(GLuint program,GLint location,const GLchar * name)4717 void GL_APIENTRY GL_BindUniformLocationCHROMIUM(GLuint program, GLint location, const GLchar *name)
4718 {
4719     Context *context = GetValidGlobalContext();
4720     EVENT(context, GLBindUniformLocationCHROMIUM,
4721           "context = %d, program = %u, location = %d, name = 0x%016" PRIxPTR "", CID(context),
4722           program, location, (uintptr_t)name);
4723 
4724     if (context)
4725     {
4726         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
4727         UniformLocation locationPacked = PackParam<UniformLocation>(location);
4728         SCOPED_SHARE_CONTEXT_LOCK(context);
4729         bool isCallValid =
4730             (context->skipValidation() ||
4731              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4732                                                 context->getMutableErrorSetForValidation(),
4733                                                 angle::EntryPoint::GLBindUniformLocationCHROMIUM) &&
4734               ValidateBindUniformLocationCHROMIUM(context,
4735                                                   angle::EntryPoint::GLBindUniformLocationCHROMIUM,
4736                                                   programPacked, locationPacked, name)));
4737         if (isCallValid)
4738         {
4739             context->bindUniformLocation(programPacked, locationPacked, name);
4740         }
4741         ANGLE_CAPTURE_GL(BindUniformLocationCHROMIUM, isCallValid, context, programPacked,
4742                          locationPacked, name);
4743     }
4744     else
4745     {
4746         GenerateContextLostErrorOnCurrentGlobalContext();
4747     }
4748     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4749 }
4750 
4751 // GL_CHROMIUM_copy_compressed_texture
GL_CompressedCopyTextureCHROMIUM(GLuint sourceId,GLuint destId)4752 void GL_APIENTRY GL_CompressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId)
4753 {
4754     Context *context = GetValidGlobalContext();
4755     EVENT(context, GLCompressedCopyTextureCHROMIUM, "context = %d, sourceId = %u, destId = %u",
4756           CID(context), sourceId, destId);
4757 
4758     if (context)
4759     {
4760         TextureID sourceIdPacked = PackParam<TextureID>(sourceId);
4761         TextureID destIdPacked   = PackParam<TextureID>(destId);
4762         SCOPED_SHARE_CONTEXT_LOCK(context);
4763         bool isCallValid =
4764             (context->skipValidation() ||
4765              (ValidatePixelLocalStorageInactive(
4766                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
4767                   angle::EntryPoint::GLCompressedCopyTextureCHROMIUM) &&
4768               ValidateCompressedCopyTextureCHROMIUM(
4769                   context, angle::EntryPoint::GLCompressedCopyTextureCHROMIUM, sourceIdPacked,
4770                   destIdPacked)));
4771         if (isCallValid)
4772         {
4773             context->compressedCopyTexture(sourceIdPacked, destIdPacked);
4774         }
4775         ANGLE_CAPTURE_GL(CompressedCopyTextureCHROMIUM, isCallValid, context, sourceIdPacked,
4776                          destIdPacked);
4777     }
4778     else
4779     {
4780         GenerateContextLostErrorOnCurrentGlobalContext();
4781     }
4782     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4783 }
4784 
4785 // GL_CHROMIUM_copy_texture
GL_CopyTextureCHROMIUM(GLuint sourceId,GLint sourceLevel,GLenum destTarget,GLuint destId,GLint destLevel,GLint internalFormat,GLenum destType,GLboolean unpackFlipY,GLboolean unpackPremultiplyAlpha,GLboolean unpackUnmultiplyAlpha)4786 void GL_APIENTRY GL_CopyTextureCHROMIUM(GLuint sourceId,
4787                                         GLint sourceLevel,
4788                                         GLenum destTarget,
4789                                         GLuint destId,
4790                                         GLint destLevel,
4791                                         GLint internalFormat,
4792                                         GLenum destType,
4793                                         GLboolean unpackFlipY,
4794                                         GLboolean unpackPremultiplyAlpha,
4795                                         GLboolean unpackUnmultiplyAlpha)
4796 {
4797     Context *context = GetValidGlobalContext();
4798     EVENT(context, GLCopyTextureCHROMIUM,
4799           "context = %d, sourceId = %u, sourceLevel = %d, destTarget = %s, destId = %u, destLevel "
4800           "= %d, internalFormat = %d, destType = %s, unpackFlipY = %s, unpackPremultiplyAlpha = "
4801           "%s, unpackUnmultiplyAlpha = %s",
4802           CID(context), sourceId, sourceLevel, GLenumToString(GLESEnum::AllEnums, destTarget),
4803           destId, destLevel, internalFormat, GLenumToString(GLESEnum::AllEnums, destType),
4804           GLbooleanToString(unpackFlipY), GLbooleanToString(unpackPremultiplyAlpha),
4805           GLbooleanToString(unpackUnmultiplyAlpha));
4806 
4807     if (context)
4808     {
4809         TextureID sourceIdPacked       = PackParam<TextureID>(sourceId);
4810         TextureTarget destTargetPacked = PackParam<TextureTarget>(destTarget);
4811         TextureID destIdPacked         = PackParam<TextureID>(destId);
4812         SCOPED_SHARE_CONTEXT_LOCK(context);
4813         bool isCallValid =
4814             (context->skipValidation() ||
4815              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4816                                                 context->getMutableErrorSetForValidation(),
4817                                                 angle::EntryPoint::GLCopyTextureCHROMIUM) &&
4818               ValidateCopyTextureCHROMIUM(
4819                   context, angle::EntryPoint::GLCopyTextureCHROMIUM, sourceIdPacked, sourceLevel,
4820                   destTargetPacked, destIdPacked, destLevel, internalFormat, destType, unpackFlipY,
4821                   unpackPremultiplyAlpha, unpackUnmultiplyAlpha)));
4822         if (isCallValid)
4823         {
4824             context->copyTexture(sourceIdPacked, sourceLevel, destTargetPacked, destIdPacked,
4825                                  destLevel, internalFormat, destType, unpackFlipY,
4826                                  unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
4827         }
4828         ANGLE_CAPTURE_GL(CopyTextureCHROMIUM, isCallValid, context, sourceIdPacked, sourceLevel,
4829                          destTargetPacked, destIdPacked, destLevel, internalFormat, destType,
4830                          unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
4831     }
4832     else
4833     {
4834         GenerateContextLostErrorOnCurrentGlobalContext();
4835     }
4836     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4837 }
4838 
GL_CopySubTextureCHROMIUM(GLuint sourceId,GLint sourceLevel,GLenum destTarget,GLuint destId,GLint destLevel,GLint xoffset,GLint yoffset,GLint x,GLint y,GLint width,GLint height,GLboolean unpackFlipY,GLboolean unpackPremultiplyAlpha,GLboolean unpackUnmultiplyAlpha)4839 void GL_APIENTRY GL_CopySubTextureCHROMIUM(GLuint sourceId,
4840                                            GLint sourceLevel,
4841                                            GLenum destTarget,
4842                                            GLuint destId,
4843                                            GLint destLevel,
4844                                            GLint xoffset,
4845                                            GLint yoffset,
4846                                            GLint x,
4847                                            GLint y,
4848                                            GLint width,
4849                                            GLint height,
4850                                            GLboolean unpackFlipY,
4851                                            GLboolean unpackPremultiplyAlpha,
4852                                            GLboolean unpackUnmultiplyAlpha)
4853 {
4854     Context *context = GetValidGlobalContext();
4855     EVENT(context, GLCopySubTextureCHROMIUM,
4856           "context = %d, sourceId = %u, sourceLevel = %d, destTarget = %s, destId = %u, destLevel "
4857           "= %d, xoffset = %d, yoffset = %d, x = %d, y = %d, width = %d, height = %d, unpackFlipY "
4858           "= %s, unpackPremultiplyAlpha = %s, unpackUnmultiplyAlpha = %s",
4859           CID(context), sourceId, sourceLevel, GLenumToString(GLESEnum::AllEnums, destTarget),
4860           destId, destLevel, xoffset, yoffset, x, y, width, height, GLbooleanToString(unpackFlipY),
4861           GLbooleanToString(unpackPremultiplyAlpha), GLbooleanToString(unpackUnmultiplyAlpha));
4862 
4863     if (context)
4864     {
4865         TextureID sourceIdPacked       = PackParam<TextureID>(sourceId);
4866         TextureTarget destTargetPacked = PackParam<TextureTarget>(destTarget);
4867         TextureID destIdPacked         = PackParam<TextureID>(destId);
4868         SCOPED_SHARE_CONTEXT_LOCK(context);
4869         bool isCallValid =
4870             (context->skipValidation() ||
4871              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4872                                                 context->getMutableErrorSetForValidation(),
4873                                                 angle::EntryPoint::GLCopySubTextureCHROMIUM) &&
4874               ValidateCopySubTextureCHROMIUM(
4875                   context, angle::EntryPoint::GLCopySubTextureCHROMIUM, sourceIdPacked, sourceLevel,
4876                   destTargetPacked, destIdPacked, destLevel, xoffset, yoffset, x, y, width, height,
4877                   unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha)));
4878         if (isCallValid)
4879         {
4880             context->copySubTexture(sourceIdPacked, sourceLevel, destTargetPacked, destIdPacked,
4881                                     destLevel, xoffset, yoffset, x, y, width, height, unpackFlipY,
4882                                     unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
4883         }
4884         ANGLE_CAPTURE_GL(CopySubTextureCHROMIUM, isCallValid, context, sourceIdPacked, sourceLevel,
4885                          destTargetPacked, destIdPacked, destLevel, xoffset, yoffset, x, y, width,
4886                          height, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
4887     }
4888     else
4889     {
4890         GenerateContextLostErrorOnCurrentGlobalContext();
4891     }
4892     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4893 }
4894 
4895 // GL_CHROMIUM_framebuffer_mixed_samples
GL_CoverageModulationCHROMIUM(GLenum components)4896 void GL_APIENTRY GL_CoverageModulationCHROMIUM(GLenum components)
4897 {
4898     Context *context = GetValidGlobalContext();
4899     EVENT(context, GLCoverageModulationCHROMIUM, "context = %d, components = %s", CID(context),
4900           GLenumToString(GLESEnum::AllEnums, components));
4901 
4902     if (context)
4903     {
4904         bool isCallValid =
4905             (context->skipValidation() ||
4906              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4907                                                 context->getMutableErrorSetForValidation(),
4908                                                 angle::EntryPoint::GLCoverageModulationCHROMIUM) &&
4909               ValidateCoverageModulationCHROMIUM(
4910                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
4911                   angle::EntryPoint::GLCoverageModulationCHROMIUM, components)));
4912         if (isCallValid)
4913         {
4914             ContextPrivateCoverageModulation(context->getMutablePrivateState(),
4915                                              context->getMutablePrivateStateCache(), components);
4916         }
4917         ANGLE_CAPTURE_GL(CoverageModulationCHROMIUM, isCallValid, context, components);
4918     }
4919     else
4920     {
4921         GenerateContextLostErrorOnCurrentGlobalContext();
4922     }
4923     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4924 }
4925 
4926 // GL_CHROMIUM_lose_context
GL_LoseContextCHROMIUM(GLenum current,GLenum other)4927 void GL_APIENTRY GL_LoseContextCHROMIUM(GLenum current, GLenum other)
4928 {
4929     Context *context = GetValidGlobalContext();
4930     EVENT(context, GLLoseContextCHROMIUM, "context = %d, current = %s, other = %s", CID(context),
4931           GLenumToString(GLESEnum::GraphicsResetStatus, current),
4932           GLenumToString(GLESEnum::GraphicsResetStatus, other));
4933 
4934     if (context)
4935     {
4936         GraphicsResetStatus currentPacked = PackParam<GraphicsResetStatus>(current);
4937         GraphicsResetStatus otherPacked   = PackParam<GraphicsResetStatus>(other);
4938         SCOPED_SHARE_CONTEXT_LOCK(context);
4939         bool isCallValid =
4940             (context->skipValidation() ||
4941              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4942                                                 context->getMutableErrorSetForValidation(),
4943                                                 angle::EntryPoint::GLLoseContextCHROMIUM) &&
4944               ValidateLoseContextCHROMIUM(context, angle::EntryPoint::GLLoseContextCHROMIUM,
4945                                           currentPacked, otherPacked)));
4946         if (isCallValid)
4947         {
4948             context->loseContext(currentPacked, otherPacked);
4949         }
4950         ANGLE_CAPTURE_GL(LoseContextCHROMIUM, isCallValid, context, currentPacked, otherPacked);
4951     }
4952     else
4953     {
4954         GenerateContextLostErrorOnCurrentGlobalContext();
4955     }
4956     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4957 }
4958 
4959 // GL_EXT_EGL_image_array
4960 
4961 // GL_EXT_EGL_image_storage
GL_EGLImageTargetTexStorageEXT(GLenum target,GLeglImageOES image,const GLint * attrib_list)4962 void GL_APIENTRY GL_EGLImageTargetTexStorageEXT(GLenum target,
4963                                                 GLeglImageOES image,
4964                                                 const GLint *attrib_list)
4965 {
4966     Context *context = GetValidGlobalContext();
4967     EVENT(context, GLEGLImageTargetTexStorageEXT,
4968           "context = %d, target = %s, image = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
4969           CID(context), GLenumToString(GLESEnum::AllEnums, target), (uintptr_t)image,
4970           (uintptr_t)attrib_list);
4971 
4972     if (context)
4973     {
4974         egl::ImageID imagePacked = PackParam<egl::ImageID>(image);
4975         SCOPED_EGL_IMAGE_SHARE_CONTEXT_LOCK(context, imagePacked);
4976         bool isCallValid =
4977             (context->skipValidation() ||
4978              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
4979                                                 context->getMutableErrorSetForValidation(),
4980                                                 angle::EntryPoint::GLEGLImageTargetTexStorageEXT) &&
4981               ValidateEGLImageTargetTexStorageEXT(context,
4982                                                   angle::EntryPoint::GLEGLImageTargetTexStorageEXT,
4983                                                   target, imagePacked, attrib_list)));
4984         if (isCallValid)
4985         {
4986             context->eGLImageTargetTexStorage(target, imagePacked, attrib_list);
4987         }
4988         ANGLE_CAPTURE_GL(EGLImageTargetTexStorageEXT, isCallValid, context, target, imagePacked,
4989                          attrib_list);
4990     }
4991     else
4992     {
4993         GenerateContextLostErrorOnCurrentGlobalContext();
4994     }
4995     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
4996 }
4997 
GL_EGLImageTargetTextureStorageEXT(GLuint texture,GLeglImageOES image,const GLint * attrib_list)4998 void GL_APIENTRY GL_EGLImageTargetTextureStorageEXT(GLuint texture,
4999                                                     GLeglImageOES image,
5000                                                     const GLint *attrib_list)
5001 {
5002     Context *context = GetValidGlobalContext();
5003     EVENT(context, GLEGLImageTargetTextureStorageEXT,
5004           "context = %d, texture = %u, image = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
5005           CID(context), texture, (uintptr_t)image, (uintptr_t)attrib_list);
5006 
5007     if (context)
5008     {
5009         egl::ImageID imagePacked = PackParam<egl::ImageID>(image);
5010         SCOPED_EGL_IMAGE_SHARE_CONTEXT_LOCK(context, imagePacked);
5011         bool isCallValid =
5012             (context->skipValidation() ||
5013              (ValidatePixelLocalStorageInactive(
5014                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
5015                   angle::EntryPoint::GLEGLImageTargetTextureStorageEXT) &&
5016               ValidateEGLImageTargetTextureStorageEXT(
5017                   context, angle::EntryPoint::GLEGLImageTargetTextureStorageEXT, texture,
5018                   imagePacked, attrib_list)));
5019         if (isCallValid)
5020         {
5021             context->eGLImageTargetTextureStorage(texture, imagePacked, attrib_list);
5022         }
5023         ANGLE_CAPTURE_GL(EGLImageTargetTextureStorageEXT, isCallValid, context, texture,
5024                          imagePacked, attrib_list);
5025     }
5026     else
5027     {
5028         GenerateContextLostErrorOnCurrentGlobalContext();
5029     }
5030     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5031 }
5032 
5033 // GL_EXT_YUV_target
5034 
5035 // GL_EXT_base_instance
GL_DrawArraysInstancedBaseInstanceEXT(GLenum mode,GLint first,GLsizei count,GLsizei instancecount,GLuint baseinstance)5036 void GL_APIENTRY GL_DrawArraysInstancedBaseInstanceEXT(GLenum mode,
5037                                                        GLint first,
5038                                                        GLsizei count,
5039                                                        GLsizei instancecount,
5040                                                        GLuint baseinstance)
5041 {
5042     Context *context = GetValidGlobalContext();
5043     EVENT(context, GLDrawArraysInstancedBaseInstanceEXT,
5044           "context = %d, mode = %s, first = %d, count = %d, instancecount = %d, baseinstance = %u",
5045           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), first, count, instancecount,
5046           baseinstance);
5047 
5048     if (context)
5049     {
5050         PrimitiveMode modePacked = PackParam<PrimitiveMode>(mode);
5051         SCOPED_SHARE_CONTEXT_LOCK(context);
5052         bool isCallValid = (context->skipValidation() ||
5053                             ValidateDrawArraysInstancedBaseInstanceEXT(
5054                                 context, angle::EntryPoint::GLDrawArraysInstancedBaseInstanceEXT,
5055                                 modePacked, first, count, instancecount, baseinstance));
5056         if (isCallValid)
5057         {
5058             context->drawArraysInstancedBaseInstance(modePacked, first, count, instancecount,
5059                                                      baseinstance);
5060         }
5061         ANGLE_CAPTURE_GL(DrawArraysInstancedBaseInstanceEXT, isCallValid, context, modePacked,
5062                          first, count, instancecount, baseinstance);
5063     }
5064     else
5065     {
5066         GenerateContextLostErrorOnCurrentGlobalContext();
5067     }
5068     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5069 }
5070 
GL_DrawElementsInstancedBaseInstanceEXT(GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei instancecount,GLuint baseinstance)5071 void GL_APIENTRY GL_DrawElementsInstancedBaseInstanceEXT(GLenum mode,
5072                                                          GLsizei count,
5073                                                          GLenum type,
5074                                                          const void *indices,
5075                                                          GLsizei instancecount,
5076                                                          GLuint baseinstance)
5077 {
5078     Context *context = GetValidGlobalContext();
5079     EVENT(context, GLDrawElementsInstancedBaseInstanceEXT,
5080           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
5081           ", instancecount = %d, baseinstance = %u",
5082           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), count,
5083           GLenumToString(GLESEnum::PrimitiveType, type), (uintptr_t)indices, instancecount,
5084           baseinstance);
5085 
5086     if (context)
5087     {
5088         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
5089         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
5090         SCOPED_SHARE_CONTEXT_LOCK(context);
5091         bool isCallValid =
5092             (context->skipValidation() ||
5093              ValidateDrawElementsInstancedBaseInstanceEXT(
5094                  context, angle::EntryPoint::GLDrawElementsInstancedBaseInstanceEXT, modePacked,
5095                  count, typePacked, indices, instancecount, baseinstance));
5096         if (isCallValid)
5097         {
5098             context->drawElementsInstancedBaseInstance(modePacked, count, typePacked, indices,
5099                                                        instancecount, baseinstance);
5100         }
5101         ANGLE_CAPTURE_GL(DrawElementsInstancedBaseInstanceEXT, isCallValid, context, modePacked,
5102                          count, typePacked, indices, instancecount, baseinstance);
5103     }
5104     else
5105     {
5106         GenerateContextLostErrorOnCurrentGlobalContext();
5107     }
5108     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5109 }
5110 
GL_DrawElementsInstancedBaseVertexBaseInstanceEXT(GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei instancecount,GLint basevertex,GLuint baseinstance)5111 void GL_APIENTRY GL_DrawElementsInstancedBaseVertexBaseInstanceEXT(GLenum mode,
5112                                                                    GLsizei count,
5113                                                                    GLenum type,
5114                                                                    const void *indices,
5115                                                                    GLsizei instancecount,
5116                                                                    GLint basevertex,
5117                                                                    GLuint baseinstance)
5118 {
5119     Context *context = GetValidGlobalContext();
5120     EVENT(context, GLDrawElementsInstancedBaseVertexBaseInstanceEXT,
5121           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
5122           ", instancecount = %d, basevertex = %d, baseinstance = %u",
5123           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), count,
5124           GLenumToString(GLESEnum::DrawElementsType, type), (uintptr_t)indices, instancecount,
5125           basevertex, baseinstance);
5126 
5127     if (context)
5128     {
5129         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
5130         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
5131         SCOPED_SHARE_CONTEXT_LOCK(context);
5132         bool isCallValid =
5133             (context->skipValidation() ||
5134              ValidateDrawElementsInstancedBaseVertexBaseInstanceEXT(
5135                  context, angle::EntryPoint::GLDrawElementsInstancedBaseVertexBaseInstanceEXT,
5136                  modePacked, count, typePacked, indices, instancecount, basevertex, baseinstance));
5137         if (isCallValid)
5138         {
5139             context->drawElementsInstancedBaseVertexBaseInstance(
5140                 modePacked, count, typePacked, indices, instancecount, basevertex, baseinstance);
5141         }
5142         ANGLE_CAPTURE_GL(DrawElementsInstancedBaseVertexBaseInstanceEXT, isCallValid, context,
5143                          modePacked, count, typePacked, indices, instancecount, basevertex,
5144                          baseinstance);
5145     }
5146     else
5147     {
5148         GenerateContextLostErrorOnCurrentGlobalContext();
5149     }
5150     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5151 }
5152 
5153 // GL_EXT_blend_func_extended
GL_BindFragDataLocationEXT(GLuint program,GLuint color,const GLchar * name)5154 void GL_APIENTRY GL_BindFragDataLocationEXT(GLuint program, GLuint color, const GLchar *name)
5155 {
5156     Context *context = GetValidGlobalContext();
5157     EVENT(context, GLBindFragDataLocationEXT,
5158           "context = %d, program = %u, color = %u, name = 0x%016" PRIxPTR "", CID(context), program,
5159           color, (uintptr_t)name);
5160 
5161     if (context)
5162     {
5163         ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
5164         SCOPED_SHARE_CONTEXT_LOCK(context);
5165         bool isCallValid =
5166             (context->skipValidation() ||
5167              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
5168                                                 context->getMutableErrorSetForValidation(),
5169                                                 angle::EntryPoint::GLBindFragDataLocationEXT) &&
5170               ValidateBindFragDataLocationEXT(context, angle::EntryPoint::GLBindFragDataLocationEXT,
5171                                               programPacked, color, name)));
5172         if (isCallValid)
5173         {
5174             context->bindFragDataLocation(programPacked, color, name);
5175         }
5176         ANGLE_CAPTURE_GL(BindFragDataLocationEXT, isCallValid, context, programPacked, color, name);
5177     }
5178     else
5179     {
5180         GenerateContextLostErrorOnCurrentGlobalContext();
5181     }
5182     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5183 }
5184 
GL_BindFragDataLocationIndexedEXT(GLuint program,GLuint colorNumber,GLuint index,const GLchar * name)5185 void GL_APIENTRY GL_BindFragDataLocationIndexedEXT(GLuint program,
5186                                                    GLuint colorNumber,
5187                                                    GLuint index,
5188                                                    const GLchar *name)
5189 {
5190     Context *context = GetValidGlobalContext();
5191     EVENT(context, GLBindFragDataLocationIndexedEXT,
5192           "context = %d, program = %u, colorNumber = %u, index = %u, name = 0x%016" PRIxPTR "",
5193           CID(context), program, colorNumber, index, (uintptr_t)name);
5194 
5195     if (context)
5196     {
5197         ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
5198         SCOPED_SHARE_CONTEXT_LOCK(context);
5199         bool isCallValid =
5200             (context->skipValidation() ||
5201              (ValidatePixelLocalStorageInactive(
5202                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
5203                   angle::EntryPoint::GLBindFragDataLocationIndexedEXT) &&
5204               ValidateBindFragDataLocationIndexedEXT(
5205                   context, angle::EntryPoint::GLBindFragDataLocationIndexedEXT, programPacked,
5206                   colorNumber, index, name)));
5207         if (isCallValid)
5208         {
5209             context->bindFragDataLocationIndexed(programPacked, colorNumber, index, name);
5210         }
5211         ANGLE_CAPTURE_GL(BindFragDataLocationIndexedEXT, isCallValid, context, programPacked,
5212                          colorNumber, index, name);
5213     }
5214     else
5215     {
5216         GenerateContextLostErrorOnCurrentGlobalContext();
5217     }
5218     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5219 }
5220 
GL_GetFragDataIndexEXT(GLuint program,const GLchar * name)5221 GLint GL_APIENTRY GL_GetFragDataIndexEXT(GLuint program, const GLchar *name)
5222 {
5223     Context *context = GetValidGlobalContext();
5224     EVENT(context, GLGetFragDataIndexEXT, "context = %d, program = %u, name = 0x%016" PRIxPTR "",
5225           CID(context), program, (uintptr_t)name);
5226 
5227     GLint returnValue;
5228     if (context)
5229     {
5230         ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
5231         SCOPED_SHARE_CONTEXT_LOCK(context);
5232         bool isCallValid =
5233             (context->skipValidation() ||
5234              ValidateGetFragDataIndexEXT(context, angle::EntryPoint::GLGetFragDataIndexEXT,
5235                                          programPacked, name));
5236         if (isCallValid)
5237         {
5238             returnValue = context->getFragDataIndex(programPacked, name);
5239         }
5240         else
5241         {
5242             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetFragDataIndexEXT, GLint>();
5243         }
5244         ANGLE_CAPTURE_GL(GetFragDataIndexEXT, isCallValid, context, programPacked, name,
5245                          returnValue);
5246     }
5247     else
5248     {
5249         GenerateContextLostErrorOnCurrentGlobalContext();
5250         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetFragDataIndexEXT, GLint>();
5251     }
5252     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5253     return returnValue;
5254 }
5255 
GL_GetProgramResourceLocationIndexEXT(GLuint program,GLenum programInterface,const GLchar * name)5256 GLint GL_APIENTRY GL_GetProgramResourceLocationIndexEXT(GLuint program,
5257                                                         GLenum programInterface,
5258                                                         const GLchar *name)
5259 {
5260     Context *context = GetValidGlobalContext();
5261     EVENT(context, GLGetProgramResourceLocationIndexEXT,
5262           "context = %d, program = %u, programInterface = %s, name = 0x%016" PRIxPTR "",
5263           CID(context), program, GLenumToString(GLESEnum::ProgramInterface, programInterface),
5264           (uintptr_t)name);
5265 
5266     GLint returnValue;
5267     if (context)
5268     {
5269         ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
5270         SCOPED_SHARE_CONTEXT_LOCK(context);
5271         bool isCallValid = (context->skipValidation() ||
5272                             ValidateGetProgramResourceLocationIndexEXT(
5273                                 context, angle::EntryPoint::GLGetProgramResourceLocationIndexEXT,
5274                                 programPacked, programInterface, name));
5275         if (isCallValid)
5276         {
5277             returnValue =
5278                 context->getProgramResourceLocationIndex(programPacked, programInterface, name);
5279         }
5280         else
5281         {
5282             returnValue =
5283                 GetDefaultReturnValue<angle::EntryPoint::GLGetProgramResourceLocationIndexEXT,
5284                                       GLint>();
5285         }
5286         ANGLE_CAPTURE_GL(GetProgramResourceLocationIndexEXT, isCallValid, context, programPacked,
5287                          programInterface, name, returnValue);
5288     }
5289     else
5290     {
5291         GenerateContextLostErrorOnCurrentGlobalContext();
5292         returnValue =
5293             GetDefaultReturnValue<angle::EntryPoint::GLGetProgramResourceLocationIndexEXT, GLint>();
5294     }
5295     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5296     return returnValue;
5297 }
5298 
5299 // GL_EXT_blend_minmax
5300 
5301 // GL_EXT_buffer_storage
GL_BufferStorageEXT(GLenum target,GLsizeiptr size,const void * data,GLbitfield flags)5302 void GL_APIENTRY GL_BufferStorageEXT(GLenum target,
5303                                      GLsizeiptr size,
5304                                      const void *data,
5305                                      GLbitfield flags)
5306 {
5307     Context *context = GetValidGlobalContext();
5308     EVENT(context, GLBufferStorageEXT,
5309           "context = %d, target = %s, size = %llu, data = 0x%016" PRIxPTR ", flags = %s",
5310           CID(context), GLenumToString(GLESEnum::BufferStorageTarget, target),
5311           static_cast<unsigned long long>(size), (uintptr_t)data,
5312           GLbitfieldToString(GLESEnum::BufferStorageMask, flags).c_str());
5313 
5314     if (context)
5315     {
5316         BufferBinding targetPacked = PackParam<BufferBinding>(target);
5317         SCOPED_SHARE_CONTEXT_LOCK(context);
5318         bool isCallValid =
5319             (context->skipValidation() ||
5320              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
5321                                                 context->getMutableErrorSetForValidation(),
5322                                                 angle::EntryPoint::GLBufferStorageEXT) &&
5323               ValidateBufferStorageEXT(context, angle::EntryPoint::GLBufferStorageEXT, targetPacked,
5324                                        size, data, flags)));
5325         if (isCallValid)
5326         {
5327             context->bufferStorage(targetPacked, size, data, flags);
5328         }
5329         ANGLE_CAPTURE_GL(BufferStorageEXT, isCallValid, context, targetPacked, size, data, flags);
5330     }
5331     else
5332     {
5333         GenerateContextLostErrorOnCurrentGlobalContext();
5334     }
5335     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5336 }
5337 
5338 // GL_EXT_clip_control
GL_ClipControlEXT(GLenum origin,GLenum depth)5339 void GL_APIENTRY GL_ClipControlEXT(GLenum origin, GLenum depth)
5340 {
5341     Context *context = GetValidGlobalContext();
5342     EVENT(context, GLClipControlEXT, "context = %d, origin = %s, depth = %s", CID(context),
5343           GLenumToString(GLESEnum::AllEnums, origin), GLenumToString(GLESEnum::AllEnums, depth));
5344 
5345     if (context)
5346     {
5347         ClipOrigin originPacked   = PackParam<ClipOrigin>(origin);
5348         ClipDepthMode depthPacked = PackParam<ClipDepthMode>(depth);
5349         bool isCallValid =
5350             (context->skipValidation() ||
5351              ValidateClipControlEXT(
5352                  context->getPrivateState(), context->getMutableErrorSetForValidation(),
5353                  angle::EntryPoint::GLClipControlEXT, originPacked, depthPacked));
5354         if (isCallValid)
5355         {
5356             ContextPrivateClipControl(context->getMutablePrivateState(),
5357                                       context->getMutablePrivateStateCache(), originPacked,
5358                                       depthPacked);
5359         }
5360         ANGLE_CAPTURE_GL(ClipControlEXT, isCallValid, context, originPacked, depthPacked);
5361     }
5362     else
5363     {
5364         GenerateContextLostErrorOnCurrentGlobalContext();
5365     }
5366     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5367 }
5368 
5369 // GL_EXT_clip_cull_distance
5370 
5371 // GL_EXT_color_buffer_float
5372 
5373 // GL_EXT_color_buffer_half_float
5374 
5375 // GL_EXT_conservative_depth
5376 
5377 // GL_EXT_copy_image
GL_CopyImageSubDataEXT(GLuint srcName,GLenum srcTarget,GLint srcLevel,GLint srcX,GLint srcY,GLint srcZ,GLuint dstName,GLenum dstTarget,GLint dstLevel,GLint dstX,GLint dstY,GLint dstZ,GLsizei srcWidth,GLsizei srcHeight,GLsizei srcDepth)5378 void GL_APIENTRY GL_CopyImageSubDataEXT(GLuint srcName,
5379                                         GLenum srcTarget,
5380                                         GLint srcLevel,
5381                                         GLint srcX,
5382                                         GLint srcY,
5383                                         GLint srcZ,
5384                                         GLuint dstName,
5385                                         GLenum dstTarget,
5386                                         GLint dstLevel,
5387                                         GLint dstX,
5388                                         GLint dstY,
5389                                         GLint dstZ,
5390                                         GLsizei srcWidth,
5391                                         GLsizei srcHeight,
5392                                         GLsizei srcDepth)
5393 {
5394     Context *context = GetValidGlobalContext();
5395     EVENT(context, GLCopyImageSubDataEXT,
5396           "context = %d, srcName = %u, srcTarget = %s, srcLevel = %d, srcX = %d, srcY = %d, srcZ = "
5397           "%d, dstName = %u, dstTarget = %s, dstLevel = %d, dstX = %d, dstY = %d, dstZ = %d, "
5398           "srcWidth = %d, srcHeight = %d, srcDepth = %d",
5399           CID(context), srcName, GLenumToString(GLESEnum::CopyBufferSubDataTarget, srcTarget),
5400           srcLevel, srcX, srcY, srcZ, dstName,
5401           GLenumToString(GLESEnum::CopyBufferSubDataTarget, dstTarget), dstLevel, dstX, dstY, dstZ,
5402           srcWidth, srcHeight, srcDepth);
5403 
5404     if (context)
5405     {
5406         SCOPED_SHARE_CONTEXT_LOCK(context);
5407         bool isCallValid =
5408             (context->skipValidation() ||
5409              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
5410                                                 context->getMutableErrorSetForValidation(),
5411                                                 angle::EntryPoint::GLCopyImageSubDataEXT) &&
5412               ValidateCopyImageSubDataEXT(context, angle::EntryPoint::GLCopyImageSubDataEXT,
5413                                           srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName,
5414                                           dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth,
5415                                           srcHeight, srcDepth)));
5416         if (isCallValid)
5417         {
5418             context->copyImageSubData(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName,
5419                                       dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight,
5420                                       srcDepth);
5421         }
5422         ANGLE_CAPTURE_GL(CopyImageSubDataEXT, isCallValid, context, srcName, srcTarget, srcLevel,
5423                          srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth,
5424                          srcHeight, srcDepth);
5425     }
5426     else
5427     {
5428         GenerateContextLostErrorOnCurrentGlobalContext();
5429     }
5430     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5431 }
5432 
5433 // GL_EXT_debug_label
5434 void GL_APIENTRY
GL_GetObjectLabelEXT(GLenum type,GLuint object,GLsizei bufSize,GLsizei * length,GLchar * label)5435 GL_GetObjectLabelEXT(GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label)
5436 {
5437     Context *context = GetValidGlobalContext();
5438     EVENT(context, GLGetObjectLabelEXT,
5439           "context = %d, type = %s, object = %u, bufSize = %d, length = 0x%016" PRIxPTR
5440           ", label = 0x%016" PRIxPTR "",
5441           CID(context), GLenumToString(GLESEnum::AllEnums, type), object, bufSize,
5442           (uintptr_t)length, (uintptr_t)label);
5443 
5444     if (context)
5445     {
5446         SCOPED_SHARE_CONTEXT_LOCK(context);
5447         bool isCallValid =
5448             (context->skipValidation() ||
5449              ValidateGetObjectLabelEXT(context, angle::EntryPoint::GLGetObjectLabelEXT, type,
5450                                        object, bufSize, length, label));
5451         if (isCallValid)
5452         {
5453             context->getObjectLabel(type, object, bufSize, length, label);
5454         }
5455         ANGLE_CAPTURE_GL(GetObjectLabelEXT, isCallValid, context, type, object, bufSize, length,
5456                          label);
5457     }
5458     else
5459     {
5460         GenerateContextLostErrorOnCurrentGlobalContext();
5461     }
5462     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5463 }
5464 
GL_LabelObjectEXT(GLenum type,GLuint object,GLsizei length,const GLchar * label)5465 void GL_APIENTRY GL_LabelObjectEXT(GLenum type, GLuint object, GLsizei length, const GLchar *label)
5466 {
5467     Context *context = GetValidGlobalContext();
5468     EVENT(context, GLLabelObjectEXT,
5469           "context = %d, type = %s, object = %u, length = %d, label = 0x%016" PRIxPTR "",
5470           CID(context), GLenumToString(GLESEnum::AllEnums, type), object, length, (uintptr_t)label);
5471 
5472     if (context)
5473     {
5474         SCOPED_SHARE_CONTEXT_LOCK(context);
5475         bool isCallValid =
5476             (context->skipValidation() ||
5477              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
5478                                                 context->getMutableErrorSetForValidation(),
5479                                                 angle::EntryPoint::GLLabelObjectEXT) &&
5480               ValidateLabelObjectEXT(context, angle::EntryPoint::GLLabelObjectEXT, type, object,
5481                                      length, label)));
5482         if (isCallValid)
5483         {
5484             context->labelObject(type, object, length, label);
5485         }
5486         ANGLE_CAPTURE_GL(LabelObjectEXT, isCallValid, context, type, object, length, label);
5487     }
5488     else
5489     {
5490         GenerateContextLostErrorOnCurrentGlobalContext();
5491     }
5492     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5493 }
5494 
5495 // GL_EXT_debug_marker
GL_InsertEventMarkerEXT(GLsizei length,const GLchar * marker)5496 void GL_APIENTRY GL_InsertEventMarkerEXT(GLsizei length, const GLchar *marker)
5497 {
5498     Context *context = GetValidGlobalContext();
5499     // Don't run the EVENT() macro on the EXT_debug_marker entry points.
5500     // It can interfere with the debug events being set by the caller.
5501     // EVENT(context, GLInsertEventMarkerEXT, "context = %d, length = %d, marker = 0x%016" PRIxPTR
5502     // "", CID(context), length, (uintptr_t)marker);
5503 
5504     if (context)
5505     {
5506         SCOPED_SHARE_CONTEXT_LOCK(context);
5507         bool isCallValid =
5508             (context->skipValidation() ||
5509              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
5510                                                 context->getMutableErrorSetForValidation(),
5511                                                 angle::EntryPoint::GLInsertEventMarkerEXT) &&
5512               ValidateInsertEventMarkerEXT(context, angle::EntryPoint::GLInsertEventMarkerEXT,
5513                                            length, marker)));
5514         if (isCallValid)
5515         {
5516             context->insertEventMarker(length, marker);
5517         }
5518         ANGLE_CAPTURE_GL(InsertEventMarkerEXT, isCallValid, context, length, marker);
5519     }
5520     else
5521     {
5522         GenerateContextLostErrorOnCurrentGlobalContext();
5523     }
5524     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5525 }
5526 
GL_PopGroupMarkerEXT()5527 void GL_APIENTRY GL_PopGroupMarkerEXT()
5528 {
5529     Context *context = GetValidGlobalContext();
5530     // Don't run the EVENT() macro on the EXT_debug_marker entry points.
5531     // It can interfere with the debug events being set by the caller.
5532     // EVENT(context, GLPopGroupMarkerEXT, "context = %d", CID(context));
5533 
5534     if (context)
5535     {
5536         SCOPED_SHARE_CONTEXT_LOCK(context);
5537         bool isCallValid =
5538             (context->skipValidation() ||
5539              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
5540                                                 context->getMutableErrorSetForValidation(),
5541                                                 angle::EntryPoint::GLPopGroupMarkerEXT) &&
5542               ValidatePopGroupMarkerEXT(context, angle::EntryPoint::GLPopGroupMarkerEXT)));
5543         if (isCallValid)
5544         {
5545             context->popGroupMarker();
5546         }
5547         ANGLE_CAPTURE_GL(PopGroupMarkerEXT, isCallValid, context);
5548     }
5549     else
5550     {
5551         GenerateContextLostErrorOnCurrentGlobalContext();
5552     }
5553     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5554 }
5555 
GL_PushGroupMarkerEXT(GLsizei length,const GLchar * marker)5556 void GL_APIENTRY GL_PushGroupMarkerEXT(GLsizei length, const GLchar *marker)
5557 {
5558     Context *context = GetValidGlobalContext();
5559     // Don't run the EVENT() macro on the EXT_debug_marker entry points.
5560     // It can interfere with the debug events being set by the caller.
5561     // EVENT(context, GLPushGroupMarkerEXT, "context = %d, length = %d, marker = 0x%016" PRIxPTR "",
5562     // CID(context), length, (uintptr_t)marker);
5563 
5564     if (context)
5565     {
5566         SCOPED_SHARE_CONTEXT_LOCK(context);
5567         bool isCallValid =
5568             (context->skipValidation() ||
5569              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
5570                                                 context->getMutableErrorSetForValidation(),
5571                                                 angle::EntryPoint::GLPushGroupMarkerEXT) &&
5572               ValidatePushGroupMarkerEXT(context, angle::EntryPoint::GLPushGroupMarkerEXT, length,
5573                                          marker)));
5574         if (isCallValid)
5575         {
5576             context->pushGroupMarker(length, marker);
5577         }
5578         ANGLE_CAPTURE_GL(PushGroupMarkerEXT, isCallValid, context, length, marker);
5579     }
5580     else
5581     {
5582         GenerateContextLostErrorOnCurrentGlobalContext();
5583     }
5584     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5585 }
5586 
5587 // GL_EXT_depth_clamp
5588 
5589 // GL_EXT_discard_framebuffer
GL_DiscardFramebufferEXT(GLenum target,GLsizei numAttachments,const GLenum * attachments)5590 void GL_APIENTRY GL_DiscardFramebufferEXT(GLenum target,
5591                                           GLsizei numAttachments,
5592                                           const GLenum *attachments)
5593 {
5594     Context *context = GetValidGlobalContext();
5595     EVENT(context, GLDiscardFramebufferEXT,
5596           "context = %d, target = %s, numAttachments = %d, attachments = 0x%016" PRIxPTR "",
5597           CID(context), GLenumToString(GLESEnum::FramebufferTarget, target), numAttachments,
5598           (uintptr_t)attachments);
5599 
5600     if (context)
5601     {
5602         SCOPED_SHARE_CONTEXT_LOCK(context);
5603         bool isCallValid =
5604             (context->skipValidation() ||
5605              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
5606                                                 context->getMutableErrorSetForValidation(),
5607                                                 angle::EntryPoint::GLDiscardFramebufferEXT) &&
5608               ValidateDiscardFramebufferEXT(context, angle::EntryPoint::GLDiscardFramebufferEXT,
5609                                             target, numAttachments, attachments)));
5610         if (isCallValid)
5611         {
5612             context->discardFramebuffer(target, numAttachments, attachments);
5613         }
5614         ANGLE_CAPTURE_GL(DiscardFramebufferEXT, isCallValid, context, target, numAttachments,
5615                          attachments);
5616     }
5617     else
5618     {
5619         GenerateContextLostErrorOnCurrentGlobalContext();
5620     }
5621     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5622 }
5623 
5624 // GL_EXT_disjoint_timer_query
GL_BeginQueryEXT(GLenum target,GLuint id)5625 void GL_APIENTRY GL_BeginQueryEXT(GLenum target, GLuint id)
5626 {
5627     Context *context = GetValidGlobalContext();
5628     EVENT(context, GLBeginQueryEXT, "context = %d, target = %s, id = %u", CID(context),
5629           GLenumToString(GLESEnum::QueryTarget, target), id);
5630 
5631     if (context)
5632     {
5633         QueryType targetPacked = PackParam<QueryType>(target);
5634         QueryID idPacked       = PackParam<QueryID>(id);
5635         SCOPED_SHARE_CONTEXT_LOCK(context);
5636         bool isCallValid =
5637             (context->skipValidation() ||
5638              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
5639                                                 context->getMutableErrorSetForValidation(),
5640                                                 angle::EntryPoint::GLBeginQueryEXT) &&
5641               ValidateBeginQueryEXT(context, angle::EntryPoint::GLBeginQueryEXT, targetPacked,
5642                                     idPacked)));
5643         if (isCallValid)
5644         {
5645             context->beginQuery(targetPacked, idPacked);
5646         }
5647         ANGLE_CAPTURE_GL(BeginQueryEXT, isCallValid, context, targetPacked, idPacked);
5648     }
5649     else
5650     {
5651         GenerateContextLostErrorOnCurrentGlobalContext();
5652     }
5653     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5654 }
5655 
GL_DeleteQueriesEXT(GLsizei n,const GLuint * ids)5656 void GL_APIENTRY GL_DeleteQueriesEXT(GLsizei n, const GLuint *ids)
5657 {
5658     Context *context = GetValidGlobalContext();
5659     EVENT(context, GLDeleteQueriesEXT, "context = %d, n = %d, ids = 0x%016" PRIxPTR "",
5660           CID(context), n, (uintptr_t)ids);
5661 
5662     if (context)
5663     {
5664         const QueryID *idsPacked = PackParam<const QueryID *>(ids);
5665         SCOPED_SHARE_CONTEXT_LOCK(context);
5666         bool isCallValid = (context->skipValidation() ||
5667                             ValidateDeleteQueriesEXT(context, angle::EntryPoint::GLDeleteQueriesEXT,
5668                                                      n, idsPacked));
5669         if (isCallValid)
5670         {
5671             context->deleteQueries(n, idsPacked);
5672         }
5673         ANGLE_CAPTURE_GL(DeleteQueriesEXT, isCallValid, context, n, idsPacked);
5674     }
5675     else
5676     {
5677         GenerateContextLostErrorOnCurrentGlobalContext();
5678     }
5679     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5680 }
5681 
GL_EndQueryEXT(GLenum target)5682 void GL_APIENTRY GL_EndQueryEXT(GLenum target)
5683 {
5684     Context *context = GetValidGlobalContext();
5685     EVENT(context, GLEndQueryEXT, "context = %d, target = %s", CID(context),
5686           GLenumToString(GLESEnum::QueryTarget, target));
5687 
5688     if (context)
5689     {
5690         QueryType targetPacked = PackParam<QueryType>(target);
5691         SCOPED_SHARE_CONTEXT_LOCK(context);
5692         bool isCallValid =
5693             (context->skipValidation() ||
5694              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
5695                                                 context->getMutableErrorSetForValidation(),
5696                                                 angle::EntryPoint::GLEndQueryEXT) &&
5697               ValidateEndQueryEXT(context, angle::EntryPoint::GLEndQueryEXT, targetPacked)));
5698         if (isCallValid)
5699         {
5700             context->endQuery(targetPacked);
5701         }
5702         ANGLE_CAPTURE_GL(EndQueryEXT, isCallValid, context, targetPacked);
5703     }
5704     else
5705     {
5706         GenerateContextLostErrorOnCurrentGlobalContext();
5707     }
5708     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5709 }
5710 
GL_GenQueriesEXT(GLsizei n,GLuint * ids)5711 void GL_APIENTRY GL_GenQueriesEXT(GLsizei n, GLuint *ids)
5712 {
5713     Context *context = GetValidGlobalContext();
5714     EVENT(context, GLGenQueriesEXT, "context = %d, n = %d, ids = 0x%016" PRIxPTR "", CID(context),
5715           n, (uintptr_t)ids);
5716 
5717     if (context)
5718     {
5719         QueryID *idsPacked = PackParam<QueryID *>(ids);
5720         SCOPED_SHARE_CONTEXT_LOCK(context);
5721         bool isCallValid =
5722             (context->skipValidation() ||
5723              ValidateGenQueriesEXT(context, angle::EntryPoint::GLGenQueriesEXT, n, idsPacked));
5724         if (isCallValid)
5725         {
5726             context->genQueries(n, idsPacked);
5727         }
5728         ANGLE_CAPTURE_GL(GenQueriesEXT, isCallValid, context, n, idsPacked);
5729     }
5730     else
5731     {
5732         GenerateContextLostErrorOnCurrentGlobalContext();
5733     }
5734     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5735 }
5736 
GL_GetInteger64vEXT(GLenum pname,GLint64 * data)5737 void GL_APIENTRY GL_GetInteger64vEXT(GLenum pname, GLint64 *data)
5738 {
5739     Context *context = GetValidGlobalContext();
5740     EVENT(context, GLGetInteger64vEXT, "context = %d, pname = %s, data = 0x%016" PRIxPTR "",
5741           CID(context), GLenumToString(GLESEnum::GetPName, pname), (uintptr_t)data);
5742 
5743     if (context)
5744     {
5745         SCOPED_SHARE_CONTEXT_LOCK(context);
5746         bool isCallValid =
5747             (context->skipValidation() ||
5748              ValidateGetInteger64vEXT(context, angle::EntryPoint::GLGetInteger64vEXT, pname, data));
5749         if (isCallValid)
5750         {
5751             context->getInteger64v(pname, data);
5752         }
5753         ANGLE_CAPTURE_GL(GetInteger64vEXT, isCallValid, context, pname, data);
5754     }
5755     else
5756     {
5757         GenerateContextLostErrorOnCurrentGlobalContext();
5758     }
5759     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5760 }
5761 
GL_GetQueryObjecti64vEXT(GLuint id,GLenum pname,GLint64 * params)5762 void GL_APIENTRY GL_GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64 *params)
5763 {
5764     Context *context = GetGlobalContext();
5765     EVENT(context, GLGetQueryObjecti64vEXT,
5766           "context = %d, id = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), id,
5767           GLenumToString(GLESEnum::QueryObjectParameterName, pname), (uintptr_t)params);
5768 
5769     if (context)
5770     {
5771         QueryID idPacked = PackParam<QueryID>(id);
5772         SCOPED_SHARE_CONTEXT_LOCK(context);
5773         bool isCallValid =
5774             (context->skipValidation() ||
5775              ValidateGetQueryObjecti64vEXT(context, angle::EntryPoint::GLGetQueryObjecti64vEXT,
5776                                            idPacked, pname, params));
5777         if (isCallValid)
5778         {
5779             context->getQueryObjecti64v(idPacked, pname, params);
5780         }
5781         ANGLE_CAPTURE_GL(GetQueryObjecti64vEXT, isCallValid, context, idPacked, pname, params);
5782     }
5783     else
5784     {
5785     }
5786     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5787 }
5788 
GL_GetQueryObjectivEXT(GLuint id,GLenum pname,GLint * params)5789 void GL_APIENTRY GL_GetQueryObjectivEXT(GLuint id, GLenum pname, GLint *params)
5790 {
5791     Context *context = GetGlobalContext();
5792     EVENT(context, GLGetQueryObjectivEXT,
5793           "context = %d, id = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), id,
5794           GLenumToString(GLESEnum::QueryObjectParameterName, pname), (uintptr_t)params);
5795 
5796     if (context)
5797     {
5798         QueryID idPacked = PackParam<QueryID>(id);
5799         SCOPED_SHARE_CONTEXT_LOCK(context);
5800         bool isCallValid =
5801             (context->skipValidation() ||
5802              ValidateGetQueryObjectivEXT(context, angle::EntryPoint::GLGetQueryObjectivEXT,
5803                                          idPacked, pname, params));
5804         if (isCallValid)
5805         {
5806             context->getQueryObjectiv(idPacked, pname, params);
5807         }
5808         ANGLE_CAPTURE_GL(GetQueryObjectivEXT, isCallValid, context, idPacked, pname, params);
5809     }
5810     else
5811     {
5812     }
5813     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5814 }
5815 
GL_GetQueryObjectui64vEXT(GLuint id,GLenum pname,GLuint64 * params)5816 void GL_APIENTRY GL_GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64 *params)
5817 {
5818     Context *context = GetValidGlobalContext();
5819     EVENT(context, GLGetQueryObjectui64vEXT,
5820           "context = %d, id = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), id,
5821           GLenumToString(GLESEnum::QueryObjectParameterName, pname), (uintptr_t)params);
5822 
5823     if (context)
5824     {
5825         QueryID idPacked = PackParam<QueryID>(id);
5826         SCOPED_SHARE_CONTEXT_LOCK(context);
5827         bool isCallValid =
5828             (context->skipValidation() ||
5829              ValidateGetQueryObjectui64vEXT(context, angle::EntryPoint::GLGetQueryObjectui64vEXT,
5830                                             idPacked, pname, params));
5831         if (isCallValid)
5832         {
5833             context->getQueryObjectui64v(idPacked, pname, params);
5834         }
5835         ANGLE_CAPTURE_GL(GetQueryObjectui64vEXT, isCallValid, context, idPacked, pname, params);
5836     }
5837     else
5838     {
5839         GenerateContextLostErrorOnCurrentGlobalContext();
5840     }
5841     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5842 }
5843 
GL_GetQueryObjectuivEXT(GLuint id,GLenum pname,GLuint * params)5844 void GL_APIENTRY GL_GetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params)
5845 {
5846     Context *context = GetValidGlobalContext();
5847     EVENT(context, GLGetQueryObjectuivEXT,
5848           "context = %d, id = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), id,
5849           GLenumToString(GLESEnum::QueryObjectParameterName, pname), (uintptr_t)params);
5850 
5851     if (context)
5852     {
5853         QueryID idPacked = PackParam<QueryID>(id);
5854         SCOPED_SHARE_CONTEXT_LOCK(context);
5855         bool isCallValid =
5856             (context->skipValidation() ||
5857              ValidateGetQueryObjectuivEXT(context, angle::EntryPoint::GLGetQueryObjectuivEXT,
5858                                           idPacked, pname, params));
5859         if (isCallValid)
5860         {
5861             context->getQueryObjectuiv(idPacked, pname, params);
5862         }
5863         ANGLE_CAPTURE_GL(GetQueryObjectuivEXT, isCallValid, context, idPacked, pname, params);
5864     }
5865     else
5866     {
5867         GenerateContextLostErrorOnCurrentGlobalContext();
5868     }
5869     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5870 }
5871 
GL_GetQueryivEXT(GLenum target,GLenum pname,GLint * params)5872 void GL_APIENTRY GL_GetQueryivEXT(GLenum target, GLenum pname, GLint *params)
5873 {
5874     Context *context = GetValidGlobalContext();
5875     EVENT(context, GLGetQueryivEXT,
5876           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
5877           GLenumToString(GLESEnum::QueryTarget, target),
5878           GLenumToString(GLESEnum::QueryParameterName, pname), (uintptr_t)params);
5879 
5880     if (context)
5881     {
5882         QueryType targetPacked = PackParam<QueryType>(target);
5883         SCOPED_SHARE_CONTEXT_LOCK(context);
5884         bool isCallValid = (context->skipValidation() ||
5885                             ValidateGetQueryivEXT(context, angle::EntryPoint::GLGetQueryivEXT,
5886                                                   targetPacked, pname, params));
5887         if (isCallValid)
5888         {
5889             context->getQueryiv(targetPacked, pname, params);
5890         }
5891         ANGLE_CAPTURE_GL(GetQueryivEXT, isCallValid, context, targetPacked, pname, params);
5892     }
5893     else
5894     {
5895         GenerateContextLostErrorOnCurrentGlobalContext();
5896     }
5897     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5898 }
5899 
GL_IsQueryEXT(GLuint id)5900 GLboolean GL_APIENTRY GL_IsQueryEXT(GLuint id)
5901 {
5902     Context *context = GetValidGlobalContext();
5903     EVENT(context, GLIsQueryEXT, "context = %d, id = %u", CID(context), id);
5904 
5905     GLboolean returnValue;
5906     if (context)
5907     {
5908         QueryID idPacked = PackParam<QueryID>(id);
5909         SCOPED_SHARE_CONTEXT_LOCK(context);
5910         bool isCallValid = (context->skipValidation() ||
5911                             ValidateIsQueryEXT(context, angle::EntryPoint::GLIsQueryEXT, idPacked));
5912         if (isCallValid)
5913         {
5914             returnValue = context->isQuery(idPacked);
5915         }
5916         else
5917         {
5918             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsQueryEXT, GLboolean>();
5919         }
5920         ANGLE_CAPTURE_GL(IsQueryEXT, isCallValid, context, idPacked, returnValue);
5921     }
5922     else
5923     {
5924         GenerateContextLostErrorOnCurrentGlobalContext();
5925         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsQueryEXT, GLboolean>();
5926     }
5927     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5928     return returnValue;
5929 }
5930 
GL_QueryCounterEXT(GLuint id,GLenum target)5931 void GL_APIENTRY GL_QueryCounterEXT(GLuint id, GLenum target)
5932 {
5933     Context *context = GetValidGlobalContext();
5934     EVENT(context, GLQueryCounterEXT, "context = %d, id = %u, target = %s", CID(context), id,
5935           GLenumToString(GLESEnum::QueryCounterTarget, target));
5936 
5937     if (context)
5938     {
5939         QueryID idPacked       = PackParam<QueryID>(id);
5940         QueryType targetPacked = PackParam<QueryType>(target);
5941         SCOPED_SHARE_CONTEXT_LOCK(context);
5942         bool isCallValid =
5943             (context->skipValidation() ||
5944              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
5945                                                 context->getMutableErrorSetForValidation(),
5946                                                 angle::EntryPoint::GLQueryCounterEXT) &&
5947               ValidateQueryCounterEXT(context, angle::EntryPoint::GLQueryCounterEXT, idPacked,
5948                                       targetPacked)));
5949         if (isCallValid)
5950         {
5951             context->queryCounter(idPacked, targetPacked);
5952         }
5953         ANGLE_CAPTURE_GL(QueryCounterEXT, isCallValid, context, idPacked, targetPacked);
5954     }
5955     else
5956     {
5957         GenerateContextLostErrorOnCurrentGlobalContext();
5958     }
5959     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5960 }
5961 
5962 // GL_EXT_draw_buffers
GL_DrawBuffersEXT(GLsizei n,const GLenum * bufs)5963 void GL_APIENTRY GL_DrawBuffersEXT(GLsizei n, const GLenum *bufs)
5964 {
5965     Context *context = GetValidGlobalContext();
5966     EVENT(context, GLDrawBuffersEXT, "context = %d, n = %d, bufs = 0x%016" PRIxPTR "", CID(context),
5967           n, (uintptr_t)bufs);
5968 
5969     if (context)
5970     {
5971         SCOPED_SHARE_CONTEXT_LOCK(context);
5972         bool isCallValid =
5973             (context->skipValidation() ||
5974              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
5975                                                 context->getMutableErrorSetForValidation(),
5976                                                 angle::EntryPoint::GLDrawBuffersEXT) &&
5977               ValidateDrawBuffersEXT(context, angle::EntryPoint::GLDrawBuffersEXT, n, bufs)));
5978         if (isCallValid)
5979         {
5980             context->drawBuffers(n, bufs);
5981         }
5982         ANGLE_CAPTURE_GL(DrawBuffersEXT, isCallValid, context, n, bufs);
5983     }
5984     else
5985     {
5986         GenerateContextLostErrorOnCurrentGlobalContext();
5987     }
5988     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
5989 }
5990 
5991 // GL_EXT_draw_buffers_indexed
GL_BlendEquationSeparateiEXT(GLuint buf,GLenum modeRGB,GLenum modeAlpha)5992 void GL_APIENTRY GL_BlendEquationSeparateiEXT(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
5993 {
5994     Context *context = GetValidGlobalContext();
5995     EVENT(context, GLBlendEquationSeparateiEXT,
5996           "context = %d, buf = %u, modeRGB = %s, modeAlpha = %s", CID(context), buf,
5997           GLenumToString(GLESEnum::BlendEquationModeEXT, modeRGB),
5998           GLenumToString(GLESEnum::BlendEquationModeEXT, modeAlpha));
5999 
6000     if (context)
6001     {
6002         bool isCallValid =
6003             (context->skipValidation() ||
6004              ValidateBlendEquationSeparateiEXT(
6005                  context->getPrivateState(), context->getMutableErrorSetForValidation(),
6006                  angle::EntryPoint::GLBlendEquationSeparateiEXT, buf, modeRGB, modeAlpha));
6007         if (isCallValid)
6008         {
6009             ContextPrivateBlendEquationSeparatei(context->getMutablePrivateState(),
6010                                                  context->getMutablePrivateStateCache(), buf,
6011                                                  modeRGB, modeAlpha);
6012         }
6013         ANGLE_CAPTURE_GL(BlendEquationSeparateiEXT, isCallValid, context, buf, modeRGB, modeAlpha);
6014     }
6015     else
6016     {
6017         GenerateContextLostErrorOnCurrentGlobalContext();
6018     }
6019     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6020 }
6021 
GL_BlendEquationiEXT(GLuint buf,GLenum mode)6022 void GL_APIENTRY GL_BlendEquationiEXT(GLuint buf, GLenum mode)
6023 {
6024     Context *context = GetValidGlobalContext();
6025     EVENT(context, GLBlendEquationiEXT, "context = %d, buf = %u, mode = %s", CID(context), buf,
6026           GLenumToString(GLESEnum::BlendEquationModeEXT, mode));
6027 
6028     if (context)
6029     {
6030         bool isCallValid =
6031             (context->skipValidation() ||
6032              ValidateBlendEquationiEXT(context->getPrivateState(),
6033                                        context->getMutableErrorSetForValidation(),
6034                                        angle::EntryPoint::GLBlendEquationiEXT, buf, mode));
6035         if (isCallValid)
6036         {
6037             ContextPrivateBlendEquationi(context->getMutablePrivateState(),
6038                                          context->getMutablePrivateStateCache(), buf, mode);
6039         }
6040         ANGLE_CAPTURE_GL(BlendEquationiEXT, isCallValid, context, buf, mode);
6041     }
6042     else
6043     {
6044         GenerateContextLostErrorOnCurrentGlobalContext();
6045     }
6046     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6047 }
6048 
6049 void GL_APIENTRY
GL_BlendFuncSeparateiEXT(GLuint buf,GLenum srcRGB,GLenum dstRGB,GLenum srcAlpha,GLenum dstAlpha)6050 GL_BlendFuncSeparateiEXT(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
6051 {
6052     Context *context = GetValidGlobalContext();
6053     EVENT(context, GLBlendFuncSeparateiEXT,
6054           "context = %d, buf = %u, srcRGB = %s, dstRGB = %s, srcAlpha = %s, dstAlpha = %s",
6055           CID(context), buf, GLenumToString(GLESEnum::BlendingFactor, srcRGB),
6056           GLenumToString(GLESEnum::BlendingFactor, dstRGB),
6057           GLenumToString(GLESEnum::BlendingFactor, srcAlpha),
6058           GLenumToString(GLESEnum::BlendingFactor, dstAlpha));
6059 
6060     if (context)
6061     {
6062         bool isCallValid =
6063             (context->skipValidation() ||
6064              ValidateBlendFuncSeparateiEXT(context->getPrivateState(),
6065                                            context->getMutableErrorSetForValidation(),
6066                                            angle::EntryPoint::GLBlendFuncSeparateiEXT, buf, srcRGB,
6067                                            dstRGB, srcAlpha, dstAlpha));
6068         if (isCallValid)
6069         {
6070             ContextPrivateBlendFuncSeparatei(context->getMutablePrivateState(),
6071                                              context->getMutablePrivateStateCache(), buf, srcRGB,
6072                                              dstRGB, srcAlpha, dstAlpha);
6073         }
6074         ANGLE_CAPTURE_GL(BlendFuncSeparateiEXT, isCallValid, context, buf, srcRGB, dstRGB, srcAlpha,
6075                          dstAlpha);
6076     }
6077     else
6078     {
6079         GenerateContextLostErrorOnCurrentGlobalContext();
6080     }
6081     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6082 }
6083 
GL_BlendFunciEXT(GLuint buf,GLenum src,GLenum dst)6084 void GL_APIENTRY GL_BlendFunciEXT(GLuint buf, GLenum src, GLenum dst)
6085 {
6086     Context *context = GetValidGlobalContext();
6087     EVENT(context, GLBlendFunciEXT, "context = %d, buf = %u, src = %s, dst = %s", CID(context), buf,
6088           GLenumToString(GLESEnum::BlendingFactor, src),
6089           GLenumToString(GLESEnum::BlendingFactor, dst));
6090 
6091     if (context)
6092     {
6093         bool isCallValid =
6094             (context->skipValidation() ||
6095              ValidateBlendFunciEXT(context->getPrivateState(),
6096                                    context->getMutableErrorSetForValidation(),
6097                                    angle::EntryPoint::GLBlendFunciEXT, buf, src, dst));
6098         if (isCallValid)
6099         {
6100             ContextPrivateBlendFunci(context->getMutablePrivateState(),
6101                                      context->getMutablePrivateStateCache(), buf, src, dst);
6102         }
6103         ANGLE_CAPTURE_GL(BlendFunciEXT, isCallValid, context, buf, src, dst);
6104     }
6105     else
6106     {
6107         GenerateContextLostErrorOnCurrentGlobalContext();
6108     }
6109     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6110 }
6111 
GL_ColorMaskiEXT(GLuint index,GLboolean r,GLboolean g,GLboolean b,GLboolean a)6112 void GL_APIENTRY GL_ColorMaskiEXT(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
6113 {
6114     Context *context = GetValidGlobalContext();
6115     EVENT(context, GLColorMaskiEXT, "context = %d, index = %u, r = %s, g = %s, b = %s, a = %s",
6116           CID(context), index, GLbooleanToString(r), GLbooleanToString(g), GLbooleanToString(b),
6117           GLbooleanToString(a));
6118 
6119     if (context)
6120     {
6121         bool isCallValid =
6122             (context->skipValidation() ||
6123              ValidateColorMaskiEXT(context->getPrivateState(),
6124                                    context->getMutableErrorSetForValidation(),
6125                                    angle::EntryPoint::GLColorMaskiEXT, index, r, g, b, a));
6126         if (isCallValid)
6127         {
6128             ContextPrivateColorMaski(context->getMutablePrivateState(),
6129                                      context->getMutablePrivateStateCache(), index, r, g, b, a);
6130         }
6131         ANGLE_CAPTURE_GL(ColorMaskiEXT, isCallValid, context, index, r, g, b, a);
6132     }
6133     else
6134     {
6135         GenerateContextLostErrorOnCurrentGlobalContext();
6136     }
6137     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6138 }
6139 
GL_DisableiEXT(GLenum target,GLuint index)6140 void GL_APIENTRY GL_DisableiEXT(GLenum target, GLuint index)
6141 {
6142     Context *context = GetValidGlobalContext();
6143     EVENT(context, GLDisableiEXT, "context = %d, target = %s, index = %u", CID(context),
6144           GLenumToString(GLESEnum::EnableCap, target), index);
6145 
6146     if (context)
6147     {
6148         bool isCallValid = (context->skipValidation() ||
6149                             ValidateDisableiEXT(context->getPrivateState(),
6150                                                 context->getMutableErrorSetForValidation(),
6151                                                 angle::EntryPoint::GLDisableiEXT, target, index));
6152         if (isCallValid)
6153         {
6154             ContextPrivateDisablei(context->getMutablePrivateState(),
6155                                    context->getMutablePrivateStateCache(), target, index);
6156         }
6157         ANGLE_CAPTURE_GL(DisableiEXT, isCallValid, context, target, index);
6158     }
6159     else
6160     {
6161         GenerateContextLostErrorOnCurrentGlobalContext();
6162     }
6163     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6164 }
6165 
GL_EnableiEXT(GLenum target,GLuint index)6166 void GL_APIENTRY GL_EnableiEXT(GLenum target, GLuint index)
6167 {
6168     Context *context = GetValidGlobalContext();
6169     EVENT(context, GLEnableiEXT, "context = %d, target = %s, index = %u", CID(context),
6170           GLenumToString(GLESEnum::EnableCap, target), index);
6171 
6172     if (context)
6173     {
6174         bool isCallValid = (context->skipValidation() ||
6175                             ValidateEnableiEXT(context->getPrivateState(),
6176                                                context->getMutableErrorSetForValidation(),
6177                                                angle::EntryPoint::GLEnableiEXT, target, index));
6178         if (isCallValid)
6179         {
6180             ContextPrivateEnablei(context->getMutablePrivateState(),
6181                                   context->getMutablePrivateStateCache(), target, index);
6182         }
6183         ANGLE_CAPTURE_GL(EnableiEXT, isCallValid, context, target, index);
6184     }
6185     else
6186     {
6187         GenerateContextLostErrorOnCurrentGlobalContext();
6188     }
6189     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6190 }
6191 
GL_IsEnablediEXT(GLenum target,GLuint index)6192 GLboolean GL_APIENTRY GL_IsEnablediEXT(GLenum target, GLuint index)
6193 {
6194     Context *context = GetValidGlobalContext();
6195     EVENT(context, GLIsEnablediEXT, "context = %d, target = %s, index = %u", CID(context),
6196           GLenumToString(GLESEnum::EnableCap, target), index);
6197 
6198     GLboolean returnValue;
6199     if (context)
6200     {
6201         bool isCallValid =
6202             (context->skipValidation() ||
6203              ValidateIsEnablediEXT(context->getPrivateState(),
6204                                    context->getMutableErrorSetForValidation(),
6205                                    angle::EntryPoint::GLIsEnablediEXT, target, index));
6206         if (isCallValid)
6207         {
6208             returnValue =
6209                 ContextPrivateIsEnabledi(context->getMutablePrivateState(),
6210                                          context->getMutablePrivateStateCache(), target, index);
6211         }
6212         else
6213         {
6214             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsEnablediEXT, GLboolean>();
6215         }
6216         ANGLE_CAPTURE_GL(IsEnablediEXT, isCallValid, context, target, index, returnValue);
6217     }
6218     else
6219     {
6220         GenerateContextLostErrorOnCurrentGlobalContext();
6221         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsEnablediEXT, GLboolean>();
6222     }
6223     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6224     return returnValue;
6225 }
6226 
6227 // GL_EXT_draw_elements_base_vertex
GL_DrawElementsBaseVertexEXT(GLenum mode,GLsizei count,GLenum type,const void * indices,GLint basevertex)6228 void GL_APIENTRY GL_DrawElementsBaseVertexEXT(GLenum mode,
6229                                               GLsizei count,
6230                                               GLenum type,
6231                                               const void *indices,
6232                                               GLint basevertex)
6233 {
6234     Context *context = GetValidGlobalContext();
6235     EVENT(context, GLDrawElementsBaseVertexEXT,
6236           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
6237           ", basevertex = %d",
6238           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), count,
6239           GLenumToString(GLESEnum::DrawElementsType, type), (uintptr_t)indices, basevertex);
6240 
6241     if (context)
6242     {
6243         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
6244         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
6245         SCOPED_SHARE_CONTEXT_LOCK(context);
6246         bool isCallValid = (context->skipValidation() ||
6247                             ValidateDrawElementsBaseVertexEXT(
6248                                 context, angle::EntryPoint::GLDrawElementsBaseVertexEXT, modePacked,
6249                                 count, typePacked, indices, basevertex));
6250         if (isCallValid)
6251         {
6252             context->drawElementsBaseVertex(modePacked, count, typePacked, indices, basevertex);
6253         }
6254         ANGLE_CAPTURE_GL(DrawElementsBaseVertexEXT, isCallValid, context, modePacked, count,
6255                          typePacked, indices, basevertex);
6256     }
6257     else
6258     {
6259         GenerateContextLostErrorOnCurrentGlobalContext();
6260     }
6261     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6262 }
6263 
GL_DrawElementsInstancedBaseVertexEXT(GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei instancecount,GLint basevertex)6264 void GL_APIENTRY GL_DrawElementsInstancedBaseVertexEXT(GLenum mode,
6265                                                        GLsizei count,
6266                                                        GLenum type,
6267                                                        const void *indices,
6268                                                        GLsizei instancecount,
6269                                                        GLint basevertex)
6270 {
6271     Context *context = GetValidGlobalContext();
6272     EVENT(context, GLDrawElementsInstancedBaseVertexEXT,
6273           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
6274           ", instancecount = %d, basevertex = %d",
6275           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), count,
6276           GLenumToString(GLESEnum::DrawElementsType, type), (uintptr_t)indices, instancecount,
6277           basevertex);
6278 
6279     if (context)
6280     {
6281         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
6282         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
6283         SCOPED_SHARE_CONTEXT_LOCK(context);
6284         bool isCallValid = (context->skipValidation() ||
6285                             ValidateDrawElementsInstancedBaseVertexEXT(
6286                                 context, angle::EntryPoint::GLDrawElementsInstancedBaseVertexEXT,
6287                                 modePacked, count, typePacked, indices, instancecount, basevertex));
6288         if (isCallValid)
6289         {
6290             context->drawElementsInstancedBaseVertex(modePacked, count, typePacked, indices,
6291                                                      instancecount, basevertex);
6292         }
6293         ANGLE_CAPTURE_GL(DrawElementsInstancedBaseVertexEXT, isCallValid, context, modePacked,
6294                          count, typePacked, indices, instancecount, basevertex);
6295     }
6296     else
6297     {
6298         GenerateContextLostErrorOnCurrentGlobalContext();
6299     }
6300     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6301 }
6302 
GL_DrawRangeElementsBaseVertexEXT(GLenum mode,GLuint start,GLuint end,GLsizei count,GLenum type,const void * indices,GLint basevertex)6303 void GL_APIENTRY GL_DrawRangeElementsBaseVertexEXT(GLenum mode,
6304                                                    GLuint start,
6305                                                    GLuint end,
6306                                                    GLsizei count,
6307                                                    GLenum type,
6308                                                    const void *indices,
6309                                                    GLint basevertex)
6310 {
6311     Context *context = GetValidGlobalContext();
6312     EVENT(context, GLDrawRangeElementsBaseVertexEXT,
6313           "context = %d, mode = %s, start = %u, end = %u, count = %d, type = %s, indices = "
6314           "0x%016" PRIxPTR ", basevertex = %d",
6315           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), start, end, count,
6316           GLenumToString(GLESEnum::DrawElementsType, type), (uintptr_t)indices, basevertex);
6317 
6318     if (context)
6319     {
6320         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
6321         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
6322         SCOPED_SHARE_CONTEXT_LOCK(context);
6323         bool isCallValid = (context->skipValidation() ||
6324                             ValidateDrawRangeElementsBaseVertexEXT(
6325                                 context, angle::EntryPoint::GLDrawRangeElementsBaseVertexEXT,
6326                                 modePacked, start, end, count, typePacked, indices, basevertex));
6327         if (isCallValid)
6328         {
6329             context->drawRangeElementsBaseVertex(modePacked, start, end, count, typePacked, indices,
6330                                                  basevertex);
6331         }
6332         ANGLE_CAPTURE_GL(DrawRangeElementsBaseVertexEXT, isCallValid, context, modePacked, start,
6333                          end, count, typePacked, indices, basevertex);
6334     }
6335     else
6336     {
6337         GenerateContextLostErrorOnCurrentGlobalContext();
6338     }
6339     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6340 }
6341 
GL_MultiDrawElementsBaseVertexEXT(GLenum mode,const GLsizei * count,GLenum type,const void * const * indices,GLsizei drawcount,const GLint * basevertex)6342 void GL_APIENTRY GL_MultiDrawElementsBaseVertexEXT(GLenum mode,
6343                                                    const GLsizei *count,
6344                                                    GLenum type,
6345                                                    const void *const *indices,
6346                                                    GLsizei drawcount,
6347                                                    const GLint *basevertex)
6348 {
6349     Context *context = GetValidGlobalContext();
6350     EVENT(context, GLMultiDrawElementsBaseVertexEXT,
6351           "context = %d, mode = %s, count = 0x%016" PRIxPTR ", type = %s, indices = 0x%016" PRIxPTR
6352           ", drawcount = %d, basevertex = 0x%016" PRIxPTR "",
6353           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), (uintptr_t)count,
6354           GLenumToString(GLESEnum::DrawElementsType, type), (uintptr_t)indices, drawcount,
6355           (uintptr_t)basevertex);
6356 
6357     if (context)
6358     {
6359         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
6360         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
6361         SCOPED_SHARE_CONTEXT_LOCK(context);
6362         bool isCallValid =
6363             (context->skipValidation() ||
6364              (ValidatePixelLocalStorageInactive(
6365                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
6366                   angle::EntryPoint::GLMultiDrawElementsBaseVertexEXT) &&
6367               ValidateMultiDrawElementsBaseVertexEXT(
6368                   context, angle::EntryPoint::GLMultiDrawElementsBaseVertexEXT, modePacked, count,
6369                   typePacked, indices, drawcount, basevertex)));
6370         if (isCallValid)
6371         {
6372             context->multiDrawElementsBaseVertex(modePacked, count, typePacked, indices, drawcount,
6373                                                  basevertex);
6374         }
6375         ANGLE_CAPTURE_GL(MultiDrawElementsBaseVertexEXT, isCallValid, context, modePacked, count,
6376                          typePacked, indices, drawcount, basevertex);
6377     }
6378     else
6379     {
6380         GenerateContextLostErrorOnCurrentGlobalContext();
6381     }
6382     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6383 }
6384 
6385 // GL_EXT_external_buffer
GL_BufferStorageExternalEXT(GLenum target,GLintptr offset,GLsizeiptr size,GLeglClientBufferEXT clientBuffer,GLbitfield flags)6386 void GL_APIENTRY GL_BufferStorageExternalEXT(GLenum target,
6387                                              GLintptr offset,
6388                                              GLsizeiptr size,
6389                                              GLeglClientBufferEXT clientBuffer,
6390                                              GLbitfield flags)
6391 {
6392     Context *context = GetValidGlobalContext();
6393     EVENT(context, GLBufferStorageExternalEXT,
6394           "context = %d, target = %s, offset = %llu, size = %llu, clientBuffer = 0x%016" PRIxPTR
6395           ", flags = %s",
6396           CID(context), GLenumToString(GLESEnum::AllEnums, target),
6397           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size),
6398           (uintptr_t)clientBuffer, GLbitfieldToString(GLESEnum::BufferStorageMask, flags).c_str());
6399 
6400     if (context)
6401     {
6402         BufferBinding targetPacked = PackParam<BufferBinding>(target);
6403         SCOPED_SHARE_CONTEXT_LOCK(context);
6404         bool isCallValid =
6405             (context->skipValidation() ||
6406              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6407                                                 context->getMutableErrorSetForValidation(),
6408                                                 angle::EntryPoint::GLBufferStorageExternalEXT) &&
6409               ValidateBufferStorageExternalEXT(context,
6410                                                angle::EntryPoint::GLBufferStorageExternalEXT,
6411                                                targetPacked, offset, size, clientBuffer, flags)));
6412         if (isCallValid)
6413         {
6414             context->bufferStorageExternal(targetPacked, offset, size, clientBuffer, flags);
6415         }
6416         ANGLE_CAPTURE_GL(BufferStorageExternalEXT, isCallValid, context, targetPacked, offset, size,
6417                          clientBuffer, flags);
6418     }
6419     else
6420     {
6421         GenerateContextLostErrorOnCurrentGlobalContext();
6422     }
6423     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6424 }
6425 
GL_NamedBufferStorageExternalEXT(GLuint buffer,GLintptr offset,GLsizeiptr size,GLeglClientBufferEXT clientBuffer,GLbitfield flags)6426 void GL_APIENTRY GL_NamedBufferStorageExternalEXT(GLuint buffer,
6427                                                   GLintptr offset,
6428                                                   GLsizeiptr size,
6429                                                   GLeglClientBufferEXT clientBuffer,
6430                                                   GLbitfield flags)
6431 {
6432     Context *context = GetValidGlobalContext();
6433     EVENT(context, GLNamedBufferStorageExternalEXT,
6434           "context = %d, buffer = %u, offset = %llu, size = %llu, clientBuffer = 0x%016" PRIxPTR
6435           ", flags = %s",
6436           CID(context), buffer, static_cast<unsigned long long>(offset),
6437           static_cast<unsigned long long>(size), (uintptr_t)clientBuffer,
6438           GLbitfieldToString(GLESEnum::BufferStorageMask, flags).c_str());
6439 
6440     if (context)
6441     {
6442         SCOPED_SHARE_CONTEXT_LOCK(context);
6443         bool isCallValid =
6444             (context->skipValidation() ||
6445              (ValidatePixelLocalStorageInactive(
6446                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
6447                   angle::EntryPoint::GLNamedBufferStorageExternalEXT) &&
6448               ValidateNamedBufferStorageExternalEXT(
6449                   context, angle::EntryPoint::GLNamedBufferStorageExternalEXT, buffer, offset, size,
6450                   clientBuffer, flags)));
6451         if (isCallValid)
6452         {
6453             context->namedBufferStorageExternal(buffer, offset, size, clientBuffer, flags);
6454         }
6455         ANGLE_CAPTURE_GL(NamedBufferStorageExternalEXT, isCallValid, context, buffer, offset, size,
6456                          clientBuffer, flags);
6457     }
6458     else
6459     {
6460         GenerateContextLostErrorOnCurrentGlobalContext();
6461     }
6462     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6463 }
6464 
6465 // GL_EXT_float_blend
6466 
6467 // GL_EXT_geometry_shader
GL_FramebufferTextureEXT(GLenum target,GLenum attachment,GLuint texture,GLint level)6468 void GL_APIENTRY GL_FramebufferTextureEXT(GLenum target,
6469                                           GLenum attachment,
6470                                           GLuint texture,
6471                                           GLint level)
6472 {
6473     Context *context = GetValidGlobalContext();
6474     EVENT(context, GLFramebufferTextureEXT,
6475           "context = %d, target = %s, attachment = %s, texture = %u, level = %d", CID(context),
6476           GLenumToString(GLESEnum::FramebufferTarget, target),
6477           GLenumToString(GLESEnum::FramebufferAttachment, attachment), texture, level);
6478 
6479     if (context)
6480     {
6481         TextureID texturePacked = PackParam<TextureID>(texture);
6482         SCOPED_SHARE_CONTEXT_LOCK(context);
6483         bool isCallValid =
6484             (context->skipValidation() ||
6485              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6486                                                 context->getMutableErrorSetForValidation(),
6487                                                 angle::EntryPoint::GLFramebufferTextureEXT) &&
6488               ValidateFramebufferTextureEXT(context, angle::EntryPoint::GLFramebufferTextureEXT,
6489                                             target, attachment, texturePacked, level)));
6490         if (isCallValid)
6491         {
6492             context->framebufferTexture(target, attachment, texturePacked, level);
6493         }
6494         ANGLE_CAPTURE_GL(FramebufferTextureEXT, isCallValid, context, target, attachment,
6495                          texturePacked, level);
6496     }
6497     else
6498     {
6499         GenerateContextLostErrorOnCurrentGlobalContext();
6500     }
6501     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6502 }
6503 
6504 // GL_EXT_gpu_shader5
6505 
6506 // GL_EXT_instanced_arrays
GL_DrawArraysInstancedEXT(GLenum mode,GLint start,GLsizei count,GLsizei primcount)6507 void GL_APIENTRY GL_DrawArraysInstancedEXT(GLenum mode,
6508                                            GLint start,
6509                                            GLsizei count,
6510                                            GLsizei primcount)
6511 {
6512     Context *context = GetValidGlobalContext();
6513     EVENT(context, GLDrawArraysInstancedEXT,
6514           "context = %d, mode = %s, start = %d, count = %d, primcount = %d", CID(context),
6515           GLenumToString(GLESEnum::PrimitiveType, mode), start, count, primcount);
6516 
6517     if (context)
6518     {
6519         PrimitiveMode modePacked = PackParam<PrimitiveMode>(mode);
6520         SCOPED_SHARE_CONTEXT_LOCK(context);
6521         bool isCallValid =
6522             (context->skipValidation() ||
6523              ValidateDrawArraysInstancedEXT(context, angle::EntryPoint::GLDrawArraysInstancedEXT,
6524                                             modePacked, start, count, primcount));
6525         if (isCallValid)
6526         {
6527             context->drawArraysInstanced(modePacked, start, count, primcount);
6528         }
6529         ANGLE_CAPTURE_GL(DrawArraysInstancedEXT, isCallValid, context, modePacked, start, count,
6530                          primcount);
6531     }
6532     else
6533     {
6534         GenerateContextLostErrorOnCurrentGlobalContext();
6535     }
6536     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6537 }
6538 
GL_DrawElementsInstancedEXT(GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei primcount)6539 void GL_APIENTRY GL_DrawElementsInstancedEXT(GLenum mode,
6540                                              GLsizei count,
6541                                              GLenum type,
6542                                              const void *indices,
6543                                              GLsizei primcount)
6544 {
6545     Context *context = GetValidGlobalContext();
6546     EVENT(context, GLDrawElementsInstancedEXT,
6547           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
6548           ", primcount = %d",
6549           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), count,
6550           GLenumToString(GLESEnum::DrawElementsType, type), (uintptr_t)indices, primcount);
6551 
6552     if (context)
6553     {
6554         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
6555         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
6556         SCOPED_SHARE_CONTEXT_LOCK(context);
6557         bool isCallValid = (context->skipValidation() ||
6558                             ValidateDrawElementsInstancedEXT(
6559                                 context, angle::EntryPoint::GLDrawElementsInstancedEXT, modePacked,
6560                                 count, typePacked, indices, primcount));
6561         if (isCallValid)
6562         {
6563             context->drawElementsInstanced(modePacked, count, typePacked, indices, primcount);
6564         }
6565         ANGLE_CAPTURE_GL(DrawElementsInstancedEXT, isCallValid, context, modePacked, count,
6566                          typePacked, indices, primcount);
6567     }
6568     else
6569     {
6570         GenerateContextLostErrorOnCurrentGlobalContext();
6571     }
6572     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6573 }
6574 
GL_VertexAttribDivisorEXT(GLuint index,GLuint divisor)6575 void GL_APIENTRY GL_VertexAttribDivisorEXT(GLuint index, GLuint divisor)
6576 {
6577     Context *context = GetValidGlobalContext();
6578     EVENT(context, GLVertexAttribDivisorEXT, "context = %d, index = %u, divisor = %u", CID(context),
6579           index, divisor);
6580 
6581     if (context)
6582     {
6583         SCOPED_SHARE_CONTEXT_LOCK(context);
6584         bool isCallValid =
6585             (context->skipValidation() ||
6586              ValidateVertexAttribDivisorEXT(context, angle::EntryPoint::GLVertexAttribDivisorEXT,
6587                                             index, divisor));
6588         if (isCallValid)
6589         {
6590             context->vertexAttribDivisor(index, divisor);
6591         }
6592         ANGLE_CAPTURE_GL(VertexAttribDivisorEXT, isCallValid, context, index, divisor);
6593     }
6594     else
6595     {
6596         GenerateContextLostErrorOnCurrentGlobalContext();
6597     }
6598     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6599 }
6600 
6601 // GL_EXT_map_buffer_range
GL_FlushMappedBufferRangeEXT(GLenum target,GLintptr offset,GLsizeiptr length)6602 void GL_APIENTRY GL_FlushMappedBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length)
6603 {
6604     Context *context = GetValidGlobalContext();
6605     EVENT(context, GLFlushMappedBufferRangeEXT,
6606           "context = %d, target = %s, offset = %llu, length = %llu", CID(context),
6607           GLenumToString(GLESEnum::BufferTargetARB, target),
6608           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length));
6609 
6610     if (context)
6611     {
6612         BufferBinding targetPacked = PackParam<BufferBinding>(target);
6613         SCOPED_SHARE_CONTEXT_LOCK(context);
6614         bool isCallValid =
6615             (context->skipValidation() ||
6616              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6617                                                 context->getMutableErrorSetForValidation(),
6618                                                 angle::EntryPoint::GLFlushMappedBufferRangeEXT) &&
6619               ValidateFlushMappedBufferRangeEXT(context,
6620                                                 angle::EntryPoint::GLFlushMappedBufferRangeEXT,
6621                                                 targetPacked, offset, length)));
6622         if (isCallValid)
6623         {
6624             context->flushMappedBufferRange(targetPacked, offset, length);
6625         }
6626         ANGLE_CAPTURE_GL(FlushMappedBufferRangeEXT, isCallValid, context, targetPacked, offset,
6627                          length);
6628     }
6629     else
6630     {
6631         GenerateContextLostErrorOnCurrentGlobalContext();
6632     }
6633     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6634 }
6635 
GL_MapBufferRangeEXT(GLenum target,GLintptr offset,GLsizeiptr length,GLbitfield access)6636 void *GL_APIENTRY GL_MapBufferRangeEXT(GLenum target,
6637                                        GLintptr offset,
6638                                        GLsizeiptr length,
6639                                        GLbitfield access)
6640 {
6641     Context *context = GetValidGlobalContext();
6642     EVENT(context, GLMapBufferRangeEXT,
6643           "context = %d, target = %s, offset = %llu, length = %llu, access = %s", CID(context),
6644           GLenumToString(GLESEnum::BufferTargetARB, target),
6645           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length),
6646           GLbitfieldToString(GLESEnum::MapBufferAccessMask, access).c_str());
6647 
6648     void *returnValue;
6649     if (context)
6650     {
6651         BufferBinding targetPacked = PackParam<BufferBinding>(target);
6652         SCOPED_SHARE_CONTEXT_LOCK(context);
6653         bool isCallValid =
6654             (context->skipValidation() ||
6655              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6656                                                 context->getMutableErrorSetForValidation(),
6657                                                 angle::EntryPoint::GLMapBufferRangeEXT) &&
6658               ValidateMapBufferRangeEXT(context, angle::EntryPoint::GLMapBufferRangeEXT,
6659                                         targetPacked, offset, length, access)));
6660         if (isCallValid)
6661         {
6662             returnValue = context->mapBufferRange(targetPacked, offset, length, access);
6663         }
6664         else
6665         {
6666             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapBufferRangeEXT, void *>();
6667         }
6668         ANGLE_CAPTURE_GL(MapBufferRangeEXT, isCallValid, context, targetPacked, offset, length,
6669                          access, returnValue);
6670     }
6671     else
6672     {
6673         GenerateContextLostErrorOnCurrentGlobalContext();
6674         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapBufferRangeEXT, void *>();
6675     }
6676     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6677     return returnValue;
6678 }
6679 
6680 // GL_EXT_memory_object
GL_BufferStorageMemEXT(GLenum target,GLsizeiptr size,GLuint memory,GLuint64 offset)6681 void GL_APIENTRY GL_BufferStorageMemEXT(GLenum target,
6682                                         GLsizeiptr size,
6683                                         GLuint memory,
6684                                         GLuint64 offset)
6685 {
6686     Context *context = GetValidGlobalContext();
6687     EVENT(context, GLBufferStorageMemEXT,
6688           "context = %d, target = %s, size = %llu, memory = %u, offset = %llu", CID(context),
6689           GLenumToString(GLESEnum::BufferTargetARB, target), static_cast<unsigned long long>(size),
6690           memory, static_cast<unsigned long long>(offset));
6691 
6692     if (context)
6693     {
6694         TextureType targetPacked    = PackParam<TextureType>(target);
6695         MemoryObjectID memoryPacked = PackParam<MemoryObjectID>(memory);
6696         SCOPED_SHARE_CONTEXT_LOCK(context);
6697         bool isCallValid =
6698             (context->skipValidation() ||
6699              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6700                                                 context->getMutableErrorSetForValidation(),
6701                                                 angle::EntryPoint::GLBufferStorageMemEXT) &&
6702               ValidateBufferStorageMemEXT(context, angle::EntryPoint::GLBufferStorageMemEXT,
6703                                           targetPacked, size, memoryPacked, offset)));
6704         if (isCallValid)
6705         {
6706             context->bufferStorageMem(targetPacked, size, memoryPacked, offset);
6707         }
6708         ANGLE_CAPTURE_GL(BufferStorageMemEXT, isCallValid, context, targetPacked, size,
6709                          memoryPacked, offset);
6710     }
6711     else
6712     {
6713         GenerateContextLostErrorOnCurrentGlobalContext();
6714     }
6715     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6716 }
6717 
GL_CreateMemoryObjectsEXT(GLsizei n,GLuint * memoryObjects)6718 void GL_APIENTRY GL_CreateMemoryObjectsEXT(GLsizei n, GLuint *memoryObjects)
6719 {
6720     Context *context = GetValidGlobalContext();
6721     EVENT(context, GLCreateMemoryObjectsEXT,
6722           "context = %d, n = %d, memoryObjects = 0x%016" PRIxPTR "", CID(context), n,
6723           (uintptr_t)memoryObjects);
6724 
6725     if (context)
6726     {
6727         MemoryObjectID *memoryObjectsPacked = PackParam<MemoryObjectID *>(memoryObjects);
6728         SCOPED_SHARE_CONTEXT_LOCK(context);
6729         bool isCallValid =
6730             (context->skipValidation() ||
6731              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6732                                                 context->getMutableErrorSetForValidation(),
6733                                                 angle::EntryPoint::GLCreateMemoryObjectsEXT) &&
6734               ValidateCreateMemoryObjectsEXT(context, angle::EntryPoint::GLCreateMemoryObjectsEXT,
6735                                              n, memoryObjectsPacked)));
6736         if (isCallValid)
6737         {
6738             context->createMemoryObjects(n, memoryObjectsPacked);
6739         }
6740         ANGLE_CAPTURE_GL(CreateMemoryObjectsEXT, isCallValid, context, n, memoryObjectsPacked);
6741     }
6742     else
6743     {
6744         GenerateContextLostErrorOnCurrentGlobalContext();
6745     }
6746     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6747 }
6748 
GL_DeleteMemoryObjectsEXT(GLsizei n,const GLuint * memoryObjects)6749 void GL_APIENTRY GL_DeleteMemoryObjectsEXT(GLsizei n, const GLuint *memoryObjects)
6750 {
6751     Context *context = GetValidGlobalContext();
6752     EVENT(context, GLDeleteMemoryObjectsEXT,
6753           "context = %d, n = %d, memoryObjects = 0x%016" PRIxPTR "", CID(context), n,
6754           (uintptr_t)memoryObjects);
6755 
6756     if (context)
6757     {
6758         const MemoryObjectID *memoryObjectsPacked =
6759             PackParam<const MemoryObjectID *>(memoryObjects);
6760         SCOPED_SHARE_CONTEXT_LOCK(context);
6761         bool isCallValid =
6762             (context->skipValidation() ||
6763              ValidateDeleteMemoryObjectsEXT(context, angle::EntryPoint::GLDeleteMemoryObjectsEXT, n,
6764                                             memoryObjectsPacked));
6765         if (isCallValid)
6766         {
6767             context->deleteMemoryObjects(n, memoryObjectsPacked);
6768         }
6769         ANGLE_CAPTURE_GL(DeleteMemoryObjectsEXT, isCallValid, context, n, memoryObjectsPacked);
6770     }
6771     else
6772     {
6773         GenerateContextLostErrorOnCurrentGlobalContext();
6774     }
6775     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6776 }
6777 
GL_GetMemoryObjectParameterivEXT(GLuint memoryObject,GLenum pname,GLint * params)6778 void GL_APIENTRY GL_GetMemoryObjectParameterivEXT(GLuint memoryObject, GLenum pname, GLint *params)
6779 {
6780     Context *context = GetValidGlobalContext();
6781     EVENT(context, GLGetMemoryObjectParameterivEXT,
6782           "context = %d, memoryObject = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
6783           memoryObject, GLenumToString(GLESEnum::MemoryObjectParameterName, pname),
6784           (uintptr_t)params);
6785 
6786     if (context)
6787     {
6788         MemoryObjectID memoryObjectPacked = PackParam<MemoryObjectID>(memoryObject);
6789         SCOPED_SHARE_CONTEXT_LOCK(context);
6790         bool isCallValid = (context->skipValidation() ||
6791                             ValidateGetMemoryObjectParameterivEXT(
6792                                 context, angle::EntryPoint::GLGetMemoryObjectParameterivEXT,
6793                                 memoryObjectPacked, pname, params));
6794         if (isCallValid)
6795         {
6796             context->getMemoryObjectParameteriv(memoryObjectPacked, pname, params);
6797         }
6798         ANGLE_CAPTURE_GL(GetMemoryObjectParameterivEXT, isCallValid, context, memoryObjectPacked,
6799                          pname, params);
6800     }
6801     else
6802     {
6803         GenerateContextLostErrorOnCurrentGlobalContext();
6804     }
6805     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6806 }
6807 
GL_GetUnsignedBytevEXT(GLenum pname,GLubyte * data)6808 void GL_APIENTRY GL_GetUnsignedBytevEXT(GLenum pname, GLubyte *data)
6809 {
6810     Context *context = GetValidGlobalContext();
6811     EVENT(context, GLGetUnsignedBytevEXT, "context = %d, pname = %s, data = 0x%016" PRIxPTR "",
6812           CID(context), GLenumToString(GLESEnum::GetPName, pname), (uintptr_t)data);
6813 
6814     if (context)
6815     {
6816         SCOPED_SHARE_CONTEXT_LOCK(context);
6817         bool isCallValid = (context->skipValidation() ||
6818                             ValidateGetUnsignedBytevEXT(
6819                                 context, angle::EntryPoint::GLGetUnsignedBytevEXT, pname, data));
6820         if (isCallValid)
6821         {
6822             context->getUnsignedBytev(pname, data);
6823         }
6824         ANGLE_CAPTURE_GL(GetUnsignedBytevEXT, isCallValid, context, pname, data);
6825     }
6826     else
6827     {
6828         GenerateContextLostErrorOnCurrentGlobalContext();
6829     }
6830     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6831 }
6832 
GL_GetUnsignedBytei_vEXT(GLenum target,GLuint index,GLubyte * data)6833 void GL_APIENTRY GL_GetUnsignedBytei_vEXT(GLenum target, GLuint index, GLubyte *data)
6834 {
6835     Context *context = GetValidGlobalContext();
6836     EVENT(context, GLGetUnsignedBytei_vEXT,
6837           "context = %d, target = %s, index = %u, data = 0x%016" PRIxPTR "", CID(context),
6838           GLenumToString(GLESEnum::AllEnums, target), index, (uintptr_t)data);
6839 
6840     if (context)
6841     {
6842         SCOPED_SHARE_CONTEXT_LOCK(context);
6843         bool isCallValid =
6844             (context->skipValidation() ||
6845              ValidateGetUnsignedBytei_vEXT(context, angle::EntryPoint::GLGetUnsignedBytei_vEXT,
6846                                            target, index, data));
6847         if (isCallValid)
6848         {
6849             context->getUnsignedBytei_v(target, index, data);
6850         }
6851         ANGLE_CAPTURE_GL(GetUnsignedBytei_vEXT, isCallValid, context, target, index, data);
6852     }
6853     else
6854     {
6855         GenerateContextLostErrorOnCurrentGlobalContext();
6856     }
6857     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6858 }
6859 
GL_IsMemoryObjectEXT(GLuint memoryObject)6860 GLboolean GL_APIENTRY GL_IsMemoryObjectEXT(GLuint memoryObject)
6861 {
6862     Context *context = GetValidGlobalContext();
6863     EVENT(context, GLIsMemoryObjectEXT, "context = %d, memoryObject = %u", CID(context),
6864           memoryObject);
6865 
6866     GLboolean returnValue;
6867     if (context)
6868     {
6869         MemoryObjectID memoryObjectPacked = PackParam<MemoryObjectID>(memoryObject);
6870         SCOPED_SHARE_CONTEXT_LOCK(context);
6871         bool isCallValid =
6872             (context->skipValidation() ||
6873              ValidateIsMemoryObjectEXT(context, angle::EntryPoint::GLIsMemoryObjectEXT,
6874                                        memoryObjectPacked));
6875         if (isCallValid)
6876         {
6877             returnValue = context->isMemoryObject(memoryObjectPacked);
6878         }
6879         else
6880         {
6881             returnValue =
6882                 GetDefaultReturnValue<angle::EntryPoint::GLIsMemoryObjectEXT, GLboolean>();
6883         }
6884         ANGLE_CAPTURE_GL(IsMemoryObjectEXT, isCallValid, context, memoryObjectPacked, returnValue);
6885     }
6886     else
6887     {
6888         GenerateContextLostErrorOnCurrentGlobalContext();
6889         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsMemoryObjectEXT, GLboolean>();
6890     }
6891     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6892     return returnValue;
6893 }
6894 
GL_MemoryObjectParameterivEXT(GLuint memoryObject,GLenum pname,const GLint * params)6895 void GL_APIENTRY GL_MemoryObjectParameterivEXT(GLuint memoryObject,
6896                                                GLenum pname,
6897                                                const GLint *params)
6898 {
6899     Context *context = GetValidGlobalContext();
6900     EVENT(context, GLMemoryObjectParameterivEXT,
6901           "context = %d, memoryObject = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
6902           memoryObject, GLenumToString(GLESEnum::MemoryObjectParameterName, pname),
6903           (uintptr_t)params);
6904 
6905     if (context)
6906     {
6907         MemoryObjectID memoryObjectPacked = PackParam<MemoryObjectID>(memoryObject);
6908         SCOPED_SHARE_CONTEXT_LOCK(context);
6909         bool isCallValid =
6910             (context->skipValidation() ||
6911              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6912                                                 context->getMutableErrorSetForValidation(),
6913                                                 angle::EntryPoint::GLMemoryObjectParameterivEXT) &&
6914               ValidateMemoryObjectParameterivEXT(context,
6915                                                  angle::EntryPoint::GLMemoryObjectParameterivEXT,
6916                                                  memoryObjectPacked, pname, params)));
6917         if (isCallValid)
6918         {
6919             context->memoryObjectParameteriv(memoryObjectPacked, pname, params);
6920         }
6921         ANGLE_CAPTURE_GL(MemoryObjectParameterivEXT, isCallValid, context, memoryObjectPacked,
6922                          pname, params);
6923     }
6924     else
6925     {
6926         GenerateContextLostErrorOnCurrentGlobalContext();
6927     }
6928     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6929 }
6930 
GL_TexStorageMem2DEXT(GLenum target,GLsizei levels,GLenum internalFormat,GLsizei width,GLsizei height,GLuint memory,GLuint64 offset)6931 void GL_APIENTRY GL_TexStorageMem2DEXT(GLenum target,
6932                                        GLsizei levels,
6933                                        GLenum internalFormat,
6934                                        GLsizei width,
6935                                        GLsizei height,
6936                                        GLuint memory,
6937                                        GLuint64 offset)
6938 {
6939     Context *context = GetValidGlobalContext();
6940     EVENT(context, GLTexStorageMem2DEXT,
6941           "context = %d, target = %s, levels = %d, internalFormat = %s, width = %d, height = %d, "
6942           "memory = %u, offset = %llu",
6943           CID(context), GLenumToString(GLESEnum::TextureTarget, target), levels,
6944           GLenumToString(GLESEnum::SizedInternalFormat, internalFormat), width, height, memory,
6945           static_cast<unsigned long long>(offset));
6946 
6947     if (context)
6948     {
6949         TextureType targetPacked    = PackParam<TextureType>(target);
6950         MemoryObjectID memoryPacked = PackParam<MemoryObjectID>(memory);
6951         SCOPED_SHARE_CONTEXT_LOCK(context);
6952         bool isCallValid =
6953             (context->skipValidation() ||
6954              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
6955                                                 context->getMutableErrorSetForValidation(),
6956                                                 angle::EntryPoint::GLTexStorageMem2DEXT) &&
6957               ValidateTexStorageMem2DEXT(context, angle::EntryPoint::GLTexStorageMem2DEXT,
6958                                          targetPacked, levels, internalFormat, width, height,
6959                                          memoryPacked, offset)));
6960         if (isCallValid)
6961         {
6962             context->texStorageMem2D(targetPacked, levels, internalFormat, width, height,
6963                                      memoryPacked, offset);
6964         }
6965         ANGLE_CAPTURE_GL(TexStorageMem2DEXT, isCallValid, context, targetPacked, levels,
6966                          internalFormat, width, height, memoryPacked, offset);
6967     }
6968     else
6969     {
6970         GenerateContextLostErrorOnCurrentGlobalContext();
6971     }
6972     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
6973 }
6974 
GL_TexStorageMem2DMultisampleEXT(GLenum target,GLsizei samples,GLenum internalFormat,GLsizei width,GLsizei height,GLboolean fixedSampleLocations,GLuint memory,GLuint64 offset)6975 void GL_APIENTRY GL_TexStorageMem2DMultisampleEXT(GLenum target,
6976                                                   GLsizei samples,
6977                                                   GLenum internalFormat,
6978                                                   GLsizei width,
6979                                                   GLsizei height,
6980                                                   GLboolean fixedSampleLocations,
6981                                                   GLuint memory,
6982                                                   GLuint64 offset)
6983 {
6984     Context *context = GetValidGlobalContext();
6985     EVENT(context, GLTexStorageMem2DMultisampleEXT,
6986           "context = %d, target = %s, samples = %d, internalFormat = %s, width = %d, height = %d, "
6987           "fixedSampleLocations = %s, memory = %u, offset = %llu",
6988           CID(context), GLenumToString(GLESEnum::TextureTarget, target), samples,
6989           GLenumToString(GLESEnum::SizedInternalFormat, internalFormat), width, height,
6990           GLbooleanToString(fixedSampleLocations), memory, static_cast<unsigned long long>(offset));
6991 
6992     if (context)
6993     {
6994         TextureType targetPacked    = PackParam<TextureType>(target);
6995         MemoryObjectID memoryPacked = PackParam<MemoryObjectID>(memory);
6996         SCOPED_SHARE_CONTEXT_LOCK(context);
6997         bool isCallValid =
6998             (context->skipValidation() ||
6999              (ValidatePixelLocalStorageInactive(
7000                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
7001                   angle::EntryPoint::GLTexStorageMem2DMultisampleEXT) &&
7002               ValidateTexStorageMem2DMultisampleEXT(
7003                   context, angle::EntryPoint::GLTexStorageMem2DMultisampleEXT, targetPacked,
7004                   samples, internalFormat, width, height, fixedSampleLocations, memoryPacked,
7005                   offset)));
7006         if (isCallValid)
7007         {
7008             context->texStorageMem2DMultisample(targetPacked, samples, internalFormat, width,
7009                                                 height, fixedSampleLocations, memoryPacked, offset);
7010         }
7011         ANGLE_CAPTURE_GL(TexStorageMem2DMultisampleEXT, isCallValid, context, targetPacked, samples,
7012                          internalFormat, width, height, fixedSampleLocations, memoryPacked, offset);
7013     }
7014     else
7015     {
7016         GenerateContextLostErrorOnCurrentGlobalContext();
7017     }
7018     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7019 }
7020 
GL_TexStorageMem3DEXT(GLenum target,GLsizei levels,GLenum internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLuint memory,GLuint64 offset)7021 void GL_APIENTRY GL_TexStorageMem3DEXT(GLenum target,
7022                                        GLsizei levels,
7023                                        GLenum internalFormat,
7024                                        GLsizei width,
7025                                        GLsizei height,
7026                                        GLsizei depth,
7027                                        GLuint memory,
7028                                        GLuint64 offset)
7029 {
7030     Context *context = GetValidGlobalContext();
7031     EVENT(context, GLTexStorageMem3DEXT,
7032           "context = %d, target = %s, levels = %d, internalFormat = %s, width = %d, height = %d, "
7033           "depth = %d, memory = %u, offset = %llu",
7034           CID(context), GLenumToString(GLESEnum::TextureTarget, target), levels,
7035           GLenumToString(GLESEnum::SizedInternalFormat, internalFormat), width, height, depth,
7036           memory, static_cast<unsigned long long>(offset));
7037 
7038     if (context)
7039     {
7040         TextureType targetPacked    = PackParam<TextureType>(target);
7041         MemoryObjectID memoryPacked = PackParam<MemoryObjectID>(memory);
7042         SCOPED_SHARE_CONTEXT_LOCK(context);
7043         bool isCallValid =
7044             (context->skipValidation() ||
7045              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
7046                                                 context->getMutableErrorSetForValidation(),
7047                                                 angle::EntryPoint::GLTexStorageMem3DEXT) &&
7048               ValidateTexStorageMem3DEXT(context, angle::EntryPoint::GLTexStorageMem3DEXT,
7049                                          targetPacked, levels, internalFormat, width, height, depth,
7050                                          memoryPacked, offset)));
7051         if (isCallValid)
7052         {
7053             context->texStorageMem3D(targetPacked, levels, internalFormat, width, height, depth,
7054                                      memoryPacked, offset);
7055         }
7056         ANGLE_CAPTURE_GL(TexStorageMem3DEXT, isCallValid, context, targetPacked, levels,
7057                          internalFormat, width, height, depth, memoryPacked, offset);
7058     }
7059     else
7060     {
7061         GenerateContextLostErrorOnCurrentGlobalContext();
7062     }
7063     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7064 }
7065 
GL_TexStorageMem3DMultisampleEXT(GLenum target,GLsizei samples,GLenum internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLboolean fixedSampleLocations,GLuint memory,GLuint64 offset)7066 void GL_APIENTRY GL_TexStorageMem3DMultisampleEXT(GLenum target,
7067                                                   GLsizei samples,
7068                                                   GLenum internalFormat,
7069                                                   GLsizei width,
7070                                                   GLsizei height,
7071                                                   GLsizei depth,
7072                                                   GLboolean fixedSampleLocations,
7073                                                   GLuint memory,
7074                                                   GLuint64 offset)
7075 {
7076     Context *context = GetValidGlobalContext();
7077     EVENT(context, GLTexStorageMem3DMultisampleEXT,
7078           "context = %d, target = %s, samples = %d, internalFormat = %s, width = %d, height = %d, "
7079           "depth = %d, fixedSampleLocations = %s, memory = %u, offset = %llu",
7080           CID(context), GLenumToString(GLESEnum::TextureTarget, target), samples,
7081           GLenumToString(GLESEnum::SizedInternalFormat, internalFormat), width, height, depth,
7082           GLbooleanToString(fixedSampleLocations), memory, static_cast<unsigned long long>(offset));
7083 
7084     if (context)
7085     {
7086         TextureType targetPacked    = PackParam<TextureType>(target);
7087         MemoryObjectID memoryPacked = PackParam<MemoryObjectID>(memory);
7088         SCOPED_SHARE_CONTEXT_LOCK(context);
7089         bool isCallValid =
7090             (context->skipValidation() ||
7091              (ValidatePixelLocalStorageInactive(
7092                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
7093                   angle::EntryPoint::GLTexStorageMem3DMultisampleEXT) &&
7094               ValidateTexStorageMem3DMultisampleEXT(
7095                   context, angle::EntryPoint::GLTexStorageMem3DMultisampleEXT, targetPacked,
7096                   samples, internalFormat, width, height, depth, fixedSampleLocations, memoryPacked,
7097                   offset)));
7098         if (isCallValid)
7099         {
7100             context->texStorageMem3DMultisample(targetPacked, samples, internalFormat, width,
7101                                                 height, depth, fixedSampleLocations, memoryPacked,
7102                                                 offset);
7103         }
7104         ANGLE_CAPTURE_GL(TexStorageMem3DMultisampleEXT, isCallValid, context, targetPacked, samples,
7105                          internalFormat, width, height, depth, fixedSampleLocations, memoryPacked,
7106                          offset);
7107     }
7108     else
7109     {
7110         GenerateContextLostErrorOnCurrentGlobalContext();
7111     }
7112     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7113 }
7114 
7115 // GL_EXT_memory_object_fd
GL_ImportMemoryFdEXT(GLuint memory,GLuint64 size,GLenum handleType,GLint fd)7116 void GL_APIENTRY GL_ImportMemoryFdEXT(GLuint memory, GLuint64 size, GLenum handleType, GLint fd)
7117 {
7118     Context *context = GetValidGlobalContext();
7119     EVENT(context, GLImportMemoryFdEXT,
7120           "context = %d, memory = %u, size = %llu, handleType = %s, fd = %d", CID(context), memory,
7121           static_cast<unsigned long long>(size),
7122           GLenumToString(GLESEnum::ExternalHandleType, handleType), fd);
7123 
7124     if (context)
7125     {
7126         MemoryObjectID memoryPacked = PackParam<MemoryObjectID>(memory);
7127         HandleType handleTypePacked = PackParam<HandleType>(handleType);
7128         SCOPED_SHARE_CONTEXT_LOCK(context);
7129         bool isCallValid =
7130             (context->skipValidation() ||
7131              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
7132                                                 context->getMutableErrorSetForValidation(),
7133                                                 angle::EntryPoint::GLImportMemoryFdEXT) &&
7134               ValidateImportMemoryFdEXT(context, angle::EntryPoint::GLImportMemoryFdEXT,
7135                                         memoryPacked, size, handleTypePacked, fd)));
7136         if (isCallValid)
7137         {
7138             context->importMemoryFd(memoryPacked, size, handleTypePacked, fd);
7139         }
7140         ANGLE_CAPTURE_GL(ImportMemoryFdEXT, isCallValid, context, memoryPacked, size,
7141                          handleTypePacked, fd);
7142     }
7143     else
7144     {
7145         GenerateContextLostErrorOnCurrentGlobalContext();
7146     }
7147     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7148 }
7149 
7150 // GL_EXT_multi_draw_indirect
GL_MultiDrawArraysIndirectEXT(GLenum mode,const void * indirect,GLsizei drawcount,GLsizei stride)7151 void GL_APIENTRY GL_MultiDrawArraysIndirectEXT(GLenum mode,
7152                                                const void *indirect,
7153                                                GLsizei drawcount,
7154                                                GLsizei stride)
7155 {
7156     Context *context = GetValidGlobalContext();
7157     EVENT(context, GLMultiDrawArraysIndirectEXT,
7158           "context = %d, mode = %s, indirect = 0x%016" PRIxPTR ", drawcount = %d, stride = %d",
7159           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), (uintptr_t)indirect,
7160           drawcount, stride);
7161 
7162     if (context)
7163     {
7164         PrimitiveMode modePacked = PackParam<PrimitiveMode>(mode);
7165         SCOPED_SHARE_CONTEXT_LOCK(context);
7166         bool isCallValid =
7167             (context->skipValidation() ||
7168              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
7169                                                 context->getMutableErrorSetForValidation(),
7170                                                 angle::EntryPoint::GLMultiDrawArraysIndirectEXT) &&
7171               ValidateMultiDrawArraysIndirectEXT(context,
7172                                                  angle::EntryPoint::GLMultiDrawArraysIndirectEXT,
7173                                                  modePacked, indirect, drawcount, stride)));
7174         if (isCallValid)
7175         {
7176             context->multiDrawArraysIndirect(modePacked, indirect, drawcount, stride);
7177         }
7178         ANGLE_CAPTURE_GL(MultiDrawArraysIndirectEXT, isCallValid, context, modePacked, indirect,
7179                          drawcount, stride);
7180     }
7181     else
7182     {
7183         GenerateContextLostErrorOnCurrentGlobalContext();
7184     }
7185     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7186 }
7187 
GL_MultiDrawElementsIndirectEXT(GLenum mode,GLenum type,const void * indirect,GLsizei drawcount,GLsizei stride)7188 void GL_APIENTRY GL_MultiDrawElementsIndirectEXT(GLenum mode,
7189                                                  GLenum type,
7190                                                  const void *indirect,
7191                                                  GLsizei drawcount,
7192                                                  GLsizei stride)
7193 {
7194     Context *context = GetValidGlobalContext();
7195     EVENT(context, GLMultiDrawElementsIndirectEXT,
7196           "context = %d, mode = %s, type = %s, indirect = 0x%016" PRIxPTR
7197           ", drawcount = %d, stride = %d",
7198           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode),
7199           GLenumToString(GLESEnum::DrawElementsType, type), (uintptr_t)indirect, drawcount, stride);
7200 
7201     if (context)
7202     {
7203         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
7204         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
7205         SCOPED_SHARE_CONTEXT_LOCK(context);
7206         bool isCallValid =
7207             (context->skipValidation() ||
7208              (ValidatePixelLocalStorageInactive(
7209                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
7210                   angle::EntryPoint::GLMultiDrawElementsIndirectEXT) &&
7211               ValidateMultiDrawElementsIndirectEXT(
7212                   context, angle::EntryPoint::GLMultiDrawElementsIndirectEXT, modePacked,
7213                   typePacked, indirect, drawcount, stride)));
7214         if (isCallValid)
7215         {
7216             context->multiDrawElementsIndirect(modePacked, typePacked, indirect, drawcount, stride);
7217         }
7218         ANGLE_CAPTURE_GL(MultiDrawElementsIndirectEXT, isCallValid, context, modePacked, typePacked,
7219                          indirect, drawcount, stride);
7220     }
7221     else
7222     {
7223         GenerateContextLostErrorOnCurrentGlobalContext();
7224     }
7225     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7226 }
7227 
7228 // GL_EXT_multisampled_render_to_texture
GL_FramebufferTexture2DMultisampleEXT(GLenum target,GLenum attachment,GLenum textarget,GLuint texture,GLint level,GLsizei samples)7229 void GL_APIENTRY GL_FramebufferTexture2DMultisampleEXT(GLenum target,
7230                                                        GLenum attachment,
7231                                                        GLenum textarget,
7232                                                        GLuint texture,
7233                                                        GLint level,
7234                                                        GLsizei samples)
7235 {
7236     Context *context = GetValidGlobalContext();
7237     EVENT(context, GLFramebufferTexture2DMultisampleEXT,
7238           "context = %d, target = %s, attachment = %s, textarget = %s, texture = %u, level = %d, "
7239           "samples = %d",
7240           CID(context), GLenumToString(GLESEnum::FramebufferTarget, target),
7241           GLenumToString(GLESEnum::FramebufferAttachment, attachment),
7242           GLenumToString(GLESEnum::TextureTarget, textarget), texture, level, samples);
7243 
7244     if (context)
7245     {
7246         TextureTarget textargetPacked = PackParam<TextureTarget>(textarget);
7247         TextureID texturePacked       = PackParam<TextureID>(texture);
7248         SCOPED_SHARE_CONTEXT_LOCK(context);
7249         bool isCallValid =
7250             (context->skipValidation() ||
7251              (ValidatePixelLocalStorageInactive(
7252                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
7253                   angle::EntryPoint::GLFramebufferTexture2DMultisampleEXT) &&
7254               ValidateFramebufferTexture2DMultisampleEXT(
7255                   context, angle::EntryPoint::GLFramebufferTexture2DMultisampleEXT, target,
7256                   attachment, textargetPacked, texturePacked, level, samples)));
7257         if (isCallValid)
7258         {
7259             context->framebufferTexture2DMultisample(target, attachment, textargetPacked,
7260                                                      texturePacked, level, samples);
7261         }
7262         ANGLE_CAPTURE_GL(FramebufferTexture2DMultisampleEXT, isCallValid, context, target,
7263                          attachment, textargetPacked, texturePacked, level, samples);
7264     }
7265     else
7266     {
7267         GenerateContextLostErrorOnCurrentGlobalContext();
7268     }
7269     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7270 }
7271 
GL_RenderbufferStorageMultisampleEXT(GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height)7272 void GL_APIENTRY GL_RenderbufferStorageMultisampleEXT(GLenum target,
7273                                                       GLsizei samples,
7274                                                       GLenum internalformat,
7275                                                       GLsizei width,
7276                                                       GLsizei height)
7277 {
7278     Context *context = GetValidGlobalContext();
7279     EVENT(context, GLRenderbufferStorageMultisampleEXT,
7280           "context = %d, target = %s, samples = %d, internalformat = %s, width = %d, height = %d",
7281           CID(context), GLenumToString(GLESEnum::RenderbufferTarget, target), samples,
7282           GLenumToString(GLESEnum::InternalFormat, internalformat), width, height);
7283 
7284     if (context)
7285     {
7286         SCOPED_SHARE_CONTEXT_LOCK(context);
7287         bool isCallValid =
7288             (context->skipValidation() ||
7289              (ValidatePixelLocalStorageInactive(
7290                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
7291                   angle::EntryPoint::GLRenderbufferStorageMultisampleEXT) &&
7292               ValidateRenderbufferStorageMultisampleEXT(
7293                   context, angle::EntryPoint::GLRenderbufferStorageMultisampleEXT, target, samples,
7294                   internalformat, width, height)));
7295         if (isCallValid)
7296         {
7297             context->renderbufferStorageMultisampleEXT(target, samples, internalformat, width,
7298                                                        height);
7299         }
7300         ANGLE_CAPTURE_GL(RenderbufferStorageMultisampleEXT, isCallValid, context, target, samples,
7301                          internalformat, width, height);
7302     }
7303     else
7304     {
7305         GenerateContextLostErrorOnCurrentGlobalContext();
7306     }
7307     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7308 }
7309 
7310 // GL_EXT_multisampled_render_to_texture2
7311 
7312 // GL_EXT_occlusion_query_boolean
7313 // BeginQueryEXT is already defined.
7314 
7315 // DeleteQueriesEXT is already defined.
7316 
7317 // EndQueryEXT is already defined.
7318 
7319 // GenQueriesEXT is already defined.
7320 
7321 // GetQueryObjectuivEXT is already defined.
7322 
7323 // GetQueryivEXT is already defined.
7324 
7325 // IsQueryEXT is already defined.
7326 
7327 // GL_EXT_polygon_offset_clamp
GL_PolygonOffsetClampEXT(GLfloat factor,GLfloat units,GLfloat clamp)7328 void GL_APIENTRY GL_PolygonOffsetClampEXT(GLfloat factor, GLfloat units, GLfloat clamp)
7329 {
7330     Context *context = GetValidGlobalContext();
7331     EVENT(context, GLPolygonOffsetClampEXT, "context = %d, factor = %f, units = %f, clamp = %f",
7332           CID(context), factor, units, clamp);
7333 
7334     if (context)
7335     {
7336         bool isCallValid =
7337             (context->skipValidation() ||
7338              ValidatePolygonOffsetClampEXT(
7339                  context->getPrivateState(), context->getMutableErrorSetForValidation(),
7340                  angle::EntryPoint::GLPolygonOffsetClampEXT, factor, units, clamp));
7341         if (isCallValid)
7342         {
7343             ContextPrivatePolygonOffsetClamp(context->getMutablePrivateState(),
7344                                              context->getMutablePrivateStateCache(), factor, units,
7345                                              clamp);
7346         }
7347         ANGLE_CAPTURE_GL(PolygonOffsetClampEXT, isCallValid, context, factor, units, clamp);
7348     }
7349     else
7350     {
7351         GenerateContextLostErrorOnCurrentGlobalContext();
7352     }
7353     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7354 }
7355 
7356 // GL_EXT_primitive_bounding_box
GL_PrimitiveBoundingBoxEXT(GLfloat minX,GLfloat minY,GLfloat minZ,GLfloat minW,GLfloat maxX,GLfloat maxY,GLfloat maxZ,GLfloat maxW)7357 void GL_APIENTRY GL_PrimitiveBoundingBoxEXT(GLfloat minX,
7358                                             GLfloat minY,
7359                                             GLfloat minZ,
7360                                             GLfloat minW,
7361                                             GLfloat maxX,
7362                                             GLfloat maxY,
7363                                             GLfloat maxZ,
7364                                             GLfloat maxW)
7365 {
7366     Context *context = GetValidGlobalContext();
7367     EVENT(context, GLPrimitiveBoundingBoxEXT,
7368           "context = %d, minX = %f, minY = %f, minZ = %f, minW = %f, maxX = %f, maxY = %f, maxZ = "
7369           "%f, maxW = %f",
7370           CID(context), minX, minY, minZ, minW, maxX, maxY, maxZ, maxW);
7371 
7372     if (context)
7373     {
7374         bool isCallValid =
7375             (context->skipValidation() ||
7376              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
7377                                                 context->getMutableErrorSetForValidation(),
7378                                                 angle::EntryPoint::GLPrimitiveBoundingBoxEXT) &&
7379               ValidatePrimitiveBoundingBoxEXT(context->getPrivateState(),
7380                                               context->getMutableErrorSetForValidation(),
7381                                               angle::EntryPoint::GLPrimitiveBoundingBoxEXT, minX,
7382                                               minY, minZ, minW, maxX, maxY, maxZ, maxW)));
7383         if (isCallValid)
7384         {
7385             ContextPrivatePrimitiveBoundingBox(context->getMutablePrivateState(),
7386                                                context->getMutablePrivateStateCache(), minX, minY,
7387                                                minZ, minW, maxX, maxY, maxZ, maxW);
7388         }
7389         ANGLE_CAPTURE_GL(PrimitiveBoundingBoxEXT, isCallValid, context, minX, minY, minZ, minW,
7390                          maxX, maxY, maxZ, maxW);
7391     }
7392     else
7393     {
7394         GenerateContextLostErrorOnCurrentGlobalContext();
7395     }
7396     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7397 }
7398 
7399 // GL_EXT_protected_textures
7400 
7401 // GL_EXT_pvrtc_sRGB
7402 
7403 // GL_EXT_read_format_bgra
7404 
7405 // GL_EXT_render_snorm
7406 
7407 // GL_EXT_robustness
GL_GetGraphicsResetStatusEXT()7408 GLenum GL_APIENTRY GL_GetGraphicsResetStatusEXT()
7409 {
7410     Context *context = GetGlobalContext();
7411     EVENT(context, GLGetGraphicsResetStatusEXT, "context = %d", CID(context));
7412 
7413     GLenum returnValue;
7414     if (context)
7415     {
7416         SCOPED_SHARE_CONTEXT_LOCK(context);
7417         bool isCallValid = (context->skipValidation() ||
7418                             ValidateGetGraphicsResetStatusEXT(
7419                                 context, angle::EntryPoint::GLGetGraphicsResetStatusEXT));
7420         if (isCallValid)
7421         {
7422             returnValue = context->getGraphicsResetStatus();
7423         }
7424         else
7425         {
7426             returnValue =
7427                 GetDefaultReturnValue<angle::EntryPoint::GLGetGraphicsResetStatusEXT, GLenum>();
7428         }
7429         ANGLE_CAPTURE_GL(GetGraphicsResetStatusEXT, isCallValid, context, returnValue);
7430     }
7431     else
7432     {
7433 
7434         returnValue =
7435             GetDefaultReturnValue<angle::EntryPoint::GLGetGraphicsResetStatusEXT, GLenum>();
7436     }
7437     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7438     return returnValue;
7439 }
7440 
GL_GetnUniformfvEXT(GLuint program,GLint location,GLsizei bufSize,GLfloat * params)7441 void GL_APIENTRY GL_GetnUniformfvEXT(GLuint program,
7442                                      GLint location,
7443                                      GLsizei bufSize,
7444                                      GLfloat *params)
7445 {
7446     Context *context = GetValidGlobalContext();
7447     EVENT(context, GLGetnUniformfvEXT,
7448           "context = %d, program = %u, location = %d, bufSize = %d, params = 0x%016" PRIxPTR "",
7449           CID(context), program, location, bufSize, (uintptr_t)params);
7450 
7451     if (context)
7452     {
7453         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
7454         UniformLocation locationPacked = PackParam<UniformLocation>(location);
7455         SCOPED_SHARE_CONTEXT_LOCK(context);
7456         bool isCallValid =
7457             (context->skipValidation() ||
7458              ValidateGetnUniformfvEXT(context, angle::EntryPoint::GLGetnUniformfvEXT, programPacked,
7459                                       locationPacked, bufSize, params));
7460         if (isCallValid)
7461         {
7462             context->getnUniformfv(programPacked, locationPacked, bufSize, params);
7463         }
7464         ANGLE_CAPTURE_GL(GetnUniformfvEXT, isCallValid, context, programPacked, locationPacked,
7465                          bufSize, params);
7466     }
7467     else
7468     {
7469         GenerateContextLostErrorOnCurrentGlobalContext();
7470     }
7471     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7472 }
7473 
GL_GetnUniformivEXT(GLuint program,GLint location,GLsizei bufSize,GLint * params)7474 void GL_APIENTRY GL_GetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint *params)
7475 {
7476     Context *context = GetValidGlobalContext();
7477     EVENT(context, GLGetnUniformivEXT,
7478           "context = %d, program = %u, location = %d, bufSize = %d, params = 0x%016" PRIxPTR "",
7479           CID(context), program, location, bufSize, (uintptr_t)params);
7480 
7481     if (context)
7482     {
7483         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
7484         UniformLocation locationPacked = PackParam<UniformLocation>(location);
7485         SCOPED_SHARE_CONTEXT_LOCK(context);
7486         bool isCallValid =
7487             (context->skipValidation() ||
7488              ValidateGetnUniformivEXT(context, angle::EntryPoint::GLGetnUniformivEXT, programPacked,
7489                                       locationPacked, bufSize, params));
7490         if (isCallValid)
7491         {
7492             context->getnUniformiv(programPacked, locationPacked, bufSize, params);
7493         }
7494         ANGLE_CAPTURE_GL(GetnUniformivEXT, isCallValid, context, programPacked, locationPacked,
7495                          bufSize, params);
7496     }
7497     else
7498     {
7499         GenerateContextLostErrorOnCurrentGlobalContext();
7500     }
7501     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7502 }
7503 
GL_ReadnPixelsEXT(GLint x,GLint y,GLsizei width,GLsizei height,GLenum format,GLenum type,GLsizei bufSize,void * data)7504 void GL_APIENTRY GL_ReadnPixelsEXT(GLint x,
7505                                    GLint y,
7506                                    GLsizei width,
7507                                    GLsizei height,
7508                                    GLenum format,
7509                                    GLenum type,
7510                                    GLsizei bufSize,
7511                                    void *data)
7512 {
7513     Context *context = GetValidGlobalContext();
7514     EVENT(context, GLReadnPixelsEXT,
7515           "context = %d, x = %d, y = %d, width = %d, height = %d, format = %s, type = %s, bufSize "
7516           "= %d, data = 0x%016" PRIxPTR "",
7517           CID(context), x, y, width, height, GLenumToString(GLESEnum::PixelFormat, format),
7518           GLenumToString(GLESEnum::PixelType, type), bufSize, (uintptr_t)data);
7519 
7520     if (context)
7521     {
7522         SCOPED_SHARE_CONTEXT_LOCK(context);
7523         bool isCallValid =
7524             (context->skipValidation() ||
7525              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
7526                                                 context->getMutableErrorSetForValidation(),
7527                                                 angle::EntryPoint::GLReadnPixelsEXT) &&
7528               ValidateReadnPixelsEXT(context, angle::EntryPoint::GLReadnPixelsEXT, x, y, width,
7529                                      height, format, type, bufSize, data)));
7530         if (isCallValid)
7531         {
7532             context->readnPixels(x, y, width, height, format, type, bufSize, data);
7533         }
7534         ANGLE_CAPTURE_GL(ReadnPixelsEXT, isCallValid, context, x, y, width, height, format, type,
7535                          bufSize, data);
7536     }
7537     else
7538     {
7539         GenerateContextLostErrorOnCurrentGlobalContext();
7540     }
7541     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7542 }
7543 
7544 // GL_EXT_sRGB
7545 
7546 // GL_EXT_sRGB_write_control
7547 
7548 // GL_EXT_semaphore
GL_DeleteSemaphoresEXT(GLsizei n,const GLuint * semaphores)7549 void GL_APIENTRY GL_DeleteSemaphoresEXT(GLsizei n, const GLuint *semaphores)
7550 {
7551     Context *context = GetValidGlobalContext();
7552     EVENT(context, GLDeleteSemaphoresEXT, "context = %d, n = %d, semaphores = 0x%016" PRIxPTR "",
7553           CID(context), n, (uintptr_t)semaphores);
7554 
7555     if (context)
7556     {
7557         const SemaphoreID *semaphoresPacked = PackParam<const SemaphoreID *>(semaphores);
7558         SCOPED_SHARE_CONTEXT_LOCK(context);
7559         bool isCallValid =
7560             (context->skipValidation() ||
7561              ValidateDeleteSemaphoresEXT(context, angle::EntryPoint::GLDeleteSemaphoresEXT, n,
7562                                          semaphoresPacked));
7563         if (isCallValid)
7564         {
7565             context->deleteSemaphores(n, semaphoresPacked);
7566         }
7567         ANGLE_CAPTURE_GL(DeleteSemaphoresEXT, isCallValid, context, n, semaphoresPacked);
7568     }
7569     else
7570     {
7571         GenerateContextLostErrorOnCurrentGlobalContext();
7572     }
7573     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7574 }
7575 
GL_GenSemaphoresEXT(GLsizei n,GLuint * semaphores)7576 void GL_APIENTRY GL_GenSemaphoresEXT(GLsizei n, GLuint *semaphores)
7577 {
7578     Context *context = GetValidGlobalContext();
7579     EVENT(context, GLGenSemaphoresEXT, "context = %d, n = %d, semaphores = 0x%016" PRIxPTR "",
7580           CID(context), n, (uintptr_t)semaphores);
7581 
7582     if (context)
7583     {
7584         SemaphoreID *semaphoresPacked = PackParam<SemaphoreID *>(semaphores);
7585         SCOPED_SHARE_CONTEXT_LOCK(context);
7586         bool isCallValid = (context->skipValidation() ||
7587                             ValidateGenSemaphoresEXT(context, angle::EntryPoint::GLGenSemaphoresEXT,
7588                                                      n, semaphoresPacked));
7589         if (isCallValid)
7590         {
7591             context->genSemaphores(n, semaphoresPacked);
7592         }
7593         ANGLE_CAPTURE_GL(GenSemaphoresEXT, isCallValid, context, n, semaphoresPacked);
7594     }
7595     else
7596     {
7597         GenerateContextLostErrorOnCurrentGlobalContext();
7598     }
7599     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7600 }
7601 
GL_GetSemaphoreParameterui64vEXT(GLuint semaphore,GLenum pname,GLuint64 * params)7602 void GL_APIENTRY GL_GetSemaphoreParameterui64vEXT(GLuint semaphore, GLenum pname, GLuint64 *params)
7603 {
7604     Context *context = GetValidGlobalContext();
7605     EVENT(context, GLGetSemaphoreParameterui64vEXT,
7606           "context = %d, semaphore = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
7607           semaphore, GLenumToString(GLESEnum::SemaphoreParameterName, pname), (uintptr_t)params);
7608 
7609     if (context)
7610     {
7611         SemaphoreID semaphorePacked = PackParam<SemaphoreID>(semaphore);
7612         SCOPED_SHARE_CONTEXT_LOCK(context);
7613         bool isCallValid = (context->skipValidation() ||
7614                             ValidateGetSemaphoreParameterui64vEXT(
7615                                 context, angle::EntryPoint::GLGetSemaphoreParameterui64vEXT,
7616                                 semaphorePacked, pname, params));
7617         if (isCallValid)
7618         {
7619             context->getSemaphoreParameterui64v(semaphorePacked, pname, params);
7620         }
7621         ANGLE_CAPTURE_GL(GetSemaphoreParameterui64vEXT, isCallValid, context, semaphorePacked,
7622                          pname, params);
7623     }
7624     else
7625     {
7626         GenerateContextLostErrorOnCurrentGlobalContext();
7627     }
7628     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7629 }
7630 
GL_IsSemaphoreEXT(GLuint semaphore)7631 GLboolean GL_APIENTRY GL_IsSemaphoreEXT(GLuint semaphore)
7632 {
7633     Context *context = GetValidGlobalContext();
7634     EVENT(context, GLIsSemaphoreEXT, "context = %d, semaphore = %u", CID(context), semaphore);
7635 
7636     GLboolean returnValue;
7637     if (context)
7638     {
7639         SemaphoreID semaphorePacked = PackParam<SemaphoreID>(semaphore);
7640         SCOPED_SHARE_CONTEXT_LOCK(context);
7641         bool isCallValid =
7642             (context->skipValidation() ||
7643              ValidateIsSemaphoreEXT(context, angle::EntryPoint::GLIsSemaphoreEXT, semaphorePacked));
7644         if (isCallValid)
7645         {
7646             returnValue = context->isSemaphore(semaphorePacked);
7647         }
7648         else
7649         {
7650             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsSemaphoreEXT, GLboolean>();
7651         }
7652         ANGLE_CAPTURE_GL(IsSemaphoreEXT, isCallValid, context, semaphorePacked, returnValue);
7653     }
7654     else
7655     {
7656         GenerateContextLostErrorOnCurrentGlobalContext();
7657         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsSemaphoreEXT, GLboolean>();
7658     }
7659     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7660     return returnValue;
7661 }
7662 
GL_SemaphoreParameterui64vEXT(GLuint semaphore,GLenum pname,const GLuint64 * params)7663 void GL_APIENTRY GL_SemaphoreParameterui64vEXT(GLuint semaphore,
7664                                                GLenum pname,
7665                                                const GLuint64 *params)
7666 {
7667     Context *context = GetValidGlobalContext();
7668     EVENT(context, GLSemaphoreParameterui64vEXT,
7669           "context = %d, semaphore = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
7670           semaphore, GLenumToString(GLESEnum::SemaphoreParameterName, pname), (uintptr_t)params);
7671 
7672     if (context)
7673     {
7674         SemaphoreID semaphorePacked = PackParam<SemaphoreID>(semaphore);
7675         SCOPED_SHARE_CONTEXT_LOCK(context);
7676         bool isCallValid =
7677             (context->skipValidation() ||
7678              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
7679                                                 context->getMutableErrorSetForValidation(),
7680                                                 angle::EntryPoint::GLSemaphoreParameterui64vEXT) &&
7681               ValidateSemaphoreParameterui64vEXT(context,
7682                                                  angle::EntryPoint::GLSemaphoreParameterui64vEXT,
7683                                                  semaphorePacked, pname, params)));
7684         if (isCallValid)
7685         {
7686             context->semaphoreParameterui64v(semaphorePacked, pname, params);
7687         }
7688         ANGLE_CAPTURE_GL(SemaphoreParameterui64vEXT, isCallValid, context, semaphorePacked, pname,
7689                          params);
7690     }
7691     else
7692     {
7693         GenerateContextLostErrorOnCurrentGlobalContext();
7694     }
7695     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7696 }
7697 
GL_SignalSemaphoreEXT(GLuint semaphore,GLuint numBufferBarriers,const GLuint * buffers,GLuint numTextureBarriers,const GLuint * textures,const GLenum * dstLayouts)7698 void GL_APIENTRY GL_SignalSemaphoreEXT(GLuint semaphore,
7699                                        GLuint numBufferBarriers,
7700                                        const GLuint *buffers,
7701                                        GLuint numTextureBarriers,
7702                                        const GLuint *textures,
7703                                        const GLenum *dstLayouts)
7704 {
7705     Context *context = GetValidGlobalContext();
7706     EVENT(context, GLSignalSemaphoreEXT,
7707           "context = %d, semaphore = %u, numBufferBarriers = %u, buffers = 0x%016" PRIxPTR
7708           ", numTextureBarriers = %u, textures = 0x%016" PRIxPTR ", dstLayouts = 0x%016" PRIxPTR "",
7709           CID(context), semaphore, numBufferBarriers, (uintptr_t)buffers, numTextureBarriers,
7710           (uintptr_t)textures, (uintptr_t)dstLayouts);
7711 
7712     if (context)
7713     {
7714         SemaphoreID semaphorePacked     = PackParam<SemaphoreID>(semaphore);
7715         const BufferID *buffersPacked   = PackParam<const BufferID *>(buffers);
7716         const TextureID *texturesPacked = PackParam<const TextureID *>(textures);
7717         SCOPED_SHARE_CONTEXT_LOCK(context);
7718         bool isCallValid =
7719             (context->skipValidation() ||
7720              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
7721                                                 context->getMutableErrorSetForValidation(),
7722                                                 angle::EntryPoint::GLSignalSemaphoreEXT) &&
7723               ValidateSignalSemaphoreEXT(context, angle::EntryPoint::GLSignalSemaphoreEXT,
7724                                          semaphorePacked, numBufferBarriers, buffersPacked,
7725                                          numTextureBarriers, texturesPacked, dstLayouts)));
7726         if (isCallValid)
7727         {
7728             context->signalSemaphore(semaphorePacked, numBufferBarriers, buffersPacked,
7729                                      numTextureBarriers, texturesPacked, dstLayouts);
7730         }
7731         ANGLE_CAPTURE_GL(SignalSemaphoreEXT, isCallValid, context, semaphorePacked,
7732                          numBufferBarriers, buffersPacked, numTextureBarriers, texturesPacked,
7733                          dstLayouts);
7734     }
7735     else
7736     {
7737         GenerateContextLostErrorOnCurrentGlobalContext();
7738     }
7739     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7740 }
7741 
GL_WaitSemaphoreEXT(GLuint semaphore,GLuint numBufferBarriers,const GLuint * buffers,GLuint numTextureBarriers,const GLuint * textures,const GLenum * srcLayouts)7742 void GL_APIENTRY GL_WaitSemaphoreEXT(GLuint semaphore,
7743                                      GLuint numBufferBarriers,
7744                                      const GLuint *buffers,
7745                                      GLuint numTextureBarriers,
7746                                      const GLuint *textures,
7747                                      const GLenum *srcLayouts)
7748 {
7749     Context *context = GetValidGlobalContext();
7750     EVENT(context, GLWaitSemaphoreEXT,
7751           "context = %d, semaphore = %u, numBufferBarriers = %u, buffers = 0x%016" PRIxPTR
7752           ", numTextureBarriers = %u, textures = 0x%016" PRIxPTR ", srcLayouts = 0x%016" PRIxPTR "",
7753           CID(context), semaphore, numBufferBarriers, (uintptr_t)buffers, numTextureBarriers,
7754           (uintptr_t)textures, (uintptr_t)srcLayouts);
7755 
7756     if (context)
7757     {
7758         SemaphoreID semaphorePacked     = PackParam<SemaphoreID>(semaphore);
7759         const BufferID *buffersPacked   = PackParam<const BufferID *>(buffers);
7760         const TextureID *texturesPacked = PackParam<const TextureID *>(textures);
7761         SCOPED_SHARE_CONTEXT_LOCK(context);
7762         bool isCallValid =
7763             (context->skipValidation() ||
7764              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
7765                                                 context->getMutableErrorSetForValidation(),
7766                                                 angle::EntryPoint::GLWaitSemaphoreEXT) &&
7767               ValidateWaitSemaphoreEXT(context, angle::EntryPoint::GLWaitSemaphoreEXT,
7768                                        semaphorePacked, numBufferBarriers, buffersPacked,
7769                                        numTextureBarriers, texturesPacked, srcLayouts)));
7770         if (isCallValid)
7771         {
7772             context->waitSemaphore(semaphorePacked, numBufferBarriers, buffersPacked,
7773                                    numTextureBarriers, texturesPacked, srcLayouts);
7774         }
7775         ANGLE_CAPTURE_GL(WaitSemaphoreEXT, isCallValid, context, semaphorePacked, numBufferBarriers,
7776                          buffersPacked, numTextureBarriers, texturesPacked, srcLayouts);
7777     }
7778     else
7779     {
7780         GenerateContextLostErrorOnCurrentGlobalContext();
7781     }
7782     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7783 }
7784 
7785 // GetUnsignedBytei_vEXT is already defined.
7786 
7787 // GetUnsignedBytevEXT is already defined.
7788 
7789 // GL_EXT_semaphore_fd
GL_ImportSemaphoreFdEXT(GLuint semaphore,GLenum handleType,GLint fd)7790 void GL_APIENTRY GL_ImportSemaphoreFdEXT(GLuint semaphore, GLenum handleType, GLint fd)
7791 {
7792     Context *context = GetValidGlobalContext();
7793     EVENT(context, GLImportSemaphoreFdEXT, "context = %d, semaphore = %u, handleType = %s, fd = %d",
7794           CID(context), semaphore, GLenumToString(GLESEnum::ExternalHandleType, handleType), fd);
7795 
7796     if (context)
7797     {
7798         SemaphoreID semaphorePacked = PackParam<SemaphoreID>(semaphore);
7799         HandleType handleTypePacked = PackParam<HandleType>(handleType);
7800         SCOPED_SHARE_CONTEXT_LOCK(context);
7801         bool isCallValid =
7802             (context->skipValidation() ||
7803              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
7804                                                 context->getMutableErrorSetForValidation(),
7805                                                 angle::EntryPoint::GLImportSemaphoreFdEXT) &&
7806               ValidateImportSemaphoreFdEXT(context, angle::EntryPoint::GLImportSemaphoreFdEXT,
7807                                            semaphorePacked, handleTypePacked, fd)));
7808         if (isCallValid)
7809         {
7810             context->importSemaphoreFd(semaphorePacked, handleTypePacked, fd);
7811         }
7812         ANGLE_CAPTURE_GL(ImportSemaphoreFdEXT, isCallValid, context, semaphorePacked,
7813                          handleTypePacked, fd);
7814     }
7815     else
7816     {
7817         GenerateContextLostErrorOnCurrentGlobalContext();
7818     }
7819     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7820 }
7821 
7822 // GL_EXT_separate_shader_objects
GL_ActiveShaderProgramEXT(GLuint pipeline,GLuint program)7823 void GL_APIENTRY GL_ActiveShaderProgramEXT(GLuint pipeline, GLuint program)
7824 {
7825     Context *context = GetValidGlobalContext();
7826     EVENT(context, GLActiveShaderProgramEXT, "context = %d, pipeline = %u, program = %u",
7827           CID(context), pipeline, program);
7828 
7829     if (context)
7830     {
7831         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
7832         ShaderProgramID programPacked    = PackParam<ShaderProgramID>(program);
7833         SCOPED_SHARE_CONTEXT_LOCK(context);
7834         bool isCallValid =
7835             (context->skipValidation() ||
7836              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
7837                                                 context->getMutableErrorSetForValidation(),
7838                                                 angle::EntryPoint::GLActiveShaderProgramEXT) &&
7839               ValidateActiveShaderProgramEXT(context, angle::EntryPoint::GLActiveShaderProgramEXT,
7840                                              pipelinePacked, programPacked)));
7841         if (isCallValid)
7842         {
7843             context->activeShaderProgram(pipelinePacked, programPacked);
7844         }
7845         ANGLE_CAPTURE_GL(ActiveShaderProgramEXT, isCallValid, context, pipelinePacked,
7846                          programPacked);
7847     }
7848     else
7849     {
7850         GenerateContextLostErrorOnCurrentGlobalContext();
7851     }
7852     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7853 }
7854 
GL_BindProgramPipelineEXT(GLuint pipeline)7855 void GL_APIENTRY GL_BindProgramPipelineEXT(GLuint pipeline)
7856 {
7857     Context *context = GetValidGlobalContext();
7858     EVENT(context, GLBindProgramPipelineEXT, "context = %d, pipeline = %u", CID(context), pipeline);
7859 
7860     if (context)
7861     {
7862         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
7863         SCOPED_SHARE_CONTEXT_LOCK(context);
7864         bool isCallValid =
7865             (context->skipValidation() ||
7866              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
7867                                                 context->getMutableErrorSetForValidation(),
7868                                                 angle::EntryPoint::GLBindProgramPipelineEXT) &&
7869               ValidateBindProgramPipelineEXT(context, angle::EntryPoint::GLBindProgramPipelineEXT,
7870                                              pipelinePacked)));
7871         if (isCallValid)
7872         {
7873             context->bindProgramPipeline(pipelinePacked);
7874         }
7875         ANGLE_CAPTURE_GL(BindProgramPipelineEXT, isCallValid, context, pipelinePacked);
7876     }
7877     else
7878     {
7879         GenerateContextLostErrorOnCurrentGlobalContext();
7880     }
7881     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7882 }
7883 
GL_CreateShaderProgramvEXT(GLenum type,GLsizei count,const GLchar ** strings)7884 GLuint GL_APIENTRY GL_CreateShaderProgramvEXT(GLenum type, GLsizei count, const GLchar **strings)
7885 {
7886     Context *context = GetValidGlobalContext();
7887     EVENT(context, GLCreateShaderProgramvEXT,
7888           "context = %d, type = %s, count = %d, strings = 0x%016" PRIxPTR "", CID(context),
7889           GLenumToString(GLESEnum::ShaderType, type), count, (uintptr_t)strings);
7890 
7891     GLuint returnValue;
7892     if (context)
7893     {
7894         ShaderType typePacked = PackParam<ShaderType>(type);
7895         SCOPED_SHARE_CONTEXT_LOCK(context);
7896         bool isCallValid =
7897             (context->skipValidation() ||
7898              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
7899                                                 context->getMutableErrorSetForValidation(),
7900                                                 angle::EntryPoint::GLCreateShaderProgramvEXT) &&
7901               ValidateCreateShaderProgramvEXT(context, angle::EntryPoint::GLCreateShaderProgramvEXT,
7902                                               typePacked, count, strings)));
7903         if (isCallValid)
7904         {
7905             returnValue = context->createShaderProgramv(typePacked, count, strings);
7906         }
7907         else
7908         {
7909             returnValue =
7910                 GetDefaultReturnValue<angle::EntryPoint::GLCreateShaderProgramvEXT, GLuint>();
7911         }
7912         ANGLE_CAPTURE_GL(CreateShaderProgramvEXT, isCallValid, context, typePacked, count, strings,
7913                          returnValue);
7914     }
7915     else
7916     {
7917         GenerateContextLostErrorOnCurrentGlobalContext();
7918         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLCreateShaderProgramvEXT, GLuint>();
7919     }
7920     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7921     return returnValue;
7922 }
7923 
GL_DeleteProgramPipelinesEXT(GLsizei n,const GLuint * pipelines)7924 void GL_APIENTRY GL_DeleteProgramPipelinesEXT(GLsizei n, const GLuint *pipelines)
7925 {
7926     Context *context = GetValidGlobalContext();
7927     EVENT(context, GLDeleteProgramPipelinesEXT,
7928           "context = %d, n = %d, pipelines = 0x%016" PRIxPTR "", CID(context), n,
7929           (uintptr_t)pipelines);
7930 
7931     if (context)
7932     {
7933         const ProgramPipelineID *pipelinesPacked = PackParam<const ProgramPipelineID *>(pipelines);
7934         SCOPED_SHARE_CONTEXT_LOCK(context);
7935         bool isCallValid =
7936             (context->skipValidation() ||
7937              ValidateDeleteProgramPipelinesEXT(
7938                  context, angle::EntryPoint::GLDeleteProgramPipelinesEXT, n, pipelinesPacked));
7939         if (isCallValid)
7940         {
7941             context->deleteProgramPipelines(n, pipelinesPacked);
7942         }
7943         ANGLE_CAPTURE_GL(DeleteProgramPipelinesEXT, isCallValid, context, n, pipelinesPacked);
7944     }
7945     else
7946     {
7947         GenerateContextLostErrorOnCurrentGlobalContext();
7948     }
7949     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7950 }
7951 
GL_GenProgramPipelinesEXT(GLsizei n,GLuint * pipelines)7952 void GL_APIENTRY GL_GenProgramPipelinesEXT(GLsizei n, GLuint *pipelines)
7953 {
7954     Context *context = GetValidGlobalContext();
7955     EVENT(context, GLGenProgramPipelinesEXT, "context = %d, n = %d, pipelines = 0x%016" PRIxPTR "",
7956           CID(context), n, (uintptr_t)pipelines);
7957 
7958     if (context)
7959     {
7960         ProgramPipelineID *pipelinesPacked = PackParam<ProgramPipelineID *>(pipelines);
7961         SCOPED_SHARE_CONTEXT_LOCK(context);
7962         bool isCallValid =
7963             (context->skipValidation() ||
7964              ValidateGenProgramPipelinesEXT(context, angle::EntryPoint::GLGenProgramPipelinesEXT, n,
7965                                             pipelinesPacked));
7966         if (isCallValid)
7967         {
7968             context->genProgramPipelines(n, pipelinesPacked);
7969         }
7970         ANGLE_CAPTURE_GL(GenProgramPipelinesEXT, isCallValid, context, n, pipelinesPacked);
7971     }
7972     else
7973     {
7974         GenerateContextLostErrorOnCurrentGlobalContext();
7975     }
7976     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
7977 }
7978 
GL_GetProgramPipelineInfoLogEXT(GLuint pipeline,GLsizei bufSize,GLsizei * length,GLchar * infoLog)7979 void GL_APIENTRY GL_GetProgramPipelineInfoLogEXT(GLuint pipeline,
7980                                                  GLsizei bufSize,
7981                                                  GLsizei *length,
7982                                                  GLchar *infoLog)
7983 {
7984     Context *context = GetValidGlobalContext();
7985     EVENT(context, GLGetProgramPipelineInfoLogEXT,
7986           "context = %d, pipeline = %u, bufSize = %d, length = 0x%016" PRIxPTR
7987           ", infoLog = 0x%016" PRIxPTR "",
7988           CID(context), pipeline, bufSize, (uintptr_t)length, (uintptr_t)infoLog);
7989 
7990     if (context)
7991     {
7992         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
7993         SCOPED_SHARE_CONTEXT_LOCK(context);
7994         bool isCallValid = (context->skipValidation() ||
7995                             ValidateGetProgramPipelineInfoLogEXT(
7996                                 context, angle::EntryPoint::GLGetProgramPipelineInfoLogEXT,
7997                                 pipelinePacked, bufSize, length, infoLog));
7998         if (isCallValid)
7999         {
8000             context->getProgramPipelineInfoLog(pipelinePacked, bufSize, length, infoLog);
8001         }
8002         ANGLE_CAPTURE_GL(GetProgramPipelineInfoLogEXT, isCallValid, context, pipelinePacked,
8003                          bufSize, length, infoLog);
8004     }
8005     else
8006     {
8007         GenerateContextLostErrorOnCurrentGlobalContext();
8008     }
8009     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8010 }
8011 
GL_GetProgramPipelineivEXT(GLuint pipeline,GLenum pname,GLint * params)8012 void GL_APIENTRY GL_GetProgramPipelineivEXT(GLuint pipeline, GLenum pname, GLint *params)
8013 {
8014     Context *context = GetValidGlobalContext();
8015     EVENT(context, GLGetProgramPipelineivEXT,
8016           "context = %d, pipeline = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
8017           pipeline, GLenumToString(GLESEnum::PipelineParameterName, pname), (uintptr_t)params);
8018 
8019     if (context)
8020     {
8021         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
8022         SCOPED_SHARE_CONTEXT_LOCK(context);
8023         bool isCallValid =
8024             (context->skipValidation() ||
8025              ValidateGetProgramPipelineivEXT(context, angle::EntryPoint::GLGetProgramPipelineivEXT,
8026                                              pipelinePacked, pname, params));
8027         if (isCallValid)
8028         {
8029             context->getProgramPipelineiv(pipelinePacked, pname, params);
8030         }
8031         ANGLE_CAPTURE_GL(GetProgramPipelineivEXT, isCallValid, context, pipelinePacked, pname,
8032                          params);
8033     }
8034     else
8035     {
8036         GenerateContextLostErrorOnCurrentGlobalContext();
8037     }
8038     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8039 }
8040 
GL_IsProgramPipelineEXT(GLuint pipeline)8041 GLboolean GL_APIENTRY GL_IsProgramPipelineEXT(GLuint pipeline)
8042 {
8043     Context *context = GetValidGlobalContext();
8044     EVENT(context, GLIsProgramPipelineEXT, "context = %d, pipeline = %u", CID(context), pipeline);
8045 
8046     GLboolean returnValue;
8047     if (context)
8048     {
8049         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
8050         SCOPED_SHARE_CONTEXT_LOCK(context);
8051         bool isCallValid =
8052             (context->skipValidation() ||
8053              ValidateIsProgramPipelineEXT(context, angle::EntryPoint::GLIsProgramPipelineEXT,
8054                                           pipelinePacked));
8055         if (isCallValid)
8056         {
8057             returnValue = context->isProgramPipeline(pipelinePacked);
8058         }
8059         else
8060         {
8061             returnValue =
8062                 GetDefaultReturnValue<angle::EntryPoint::GLIsProgramPipelineEXT, GLboolean>();
8063         }
8064         ANGLE_CAPTURE_GL(IsProgramPipelineEXT, isCallValid, context, pipelinePacked, returnValue);
8065     }
8066     else
8067     {
8068         GenerateContextLostErrorOnCurrentGlobalContext();
8069         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsProgramPipelineEXT, GLboolean>();
8070     }
8071     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8072     return returnValue;
8073 }
8074 
GL_ProgramParameteriEXT(GLuint program,GLenum pname,GLint value)8075 void GL_APIENTRY GL_ProgramParameteriEXT(GLuint program, GLenum pname, GLint value)
8076 {
8077     Context *context = GetValidGlobalContext();
8078     EVENT(context, GLProgramParameteriEXT, "context = %d, program = %u, pname = %s, value = %d",
8079           CID(context), program, GLenumToString(GLESEnum::ProgramParameterPName, pname), value);
8080 
8081     if (context)
8082     {
8083         ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
8084         SCOPED_SHARE_CONTEXT_LOCK(context);
8085         bool isCallValid =
8086             (context->skipValidation() ||
8087              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8088                                                 context->getMutableErrorSetForValidation(),
8089                                                 angle::EntryPoint::GLProgramParameteriEXT) &&
8090               ValidateProgramParameteriEXT(context, angle::EntryPoint::GLProgramParameteriEXT,
8091                                            programPacked, pname, value)));
8092         if (isCallValid)
8093         {
8094             context->programParameteri(programPacked, pname, value);
8095         }
8096         ANGLE_CAPTURE_GL(ProgramParameteriEXT, isCallValid, context, programPacked, pname, value);
8097     }
8098     else
8099     {
8100         GenerateContextLostErrorOnCurrentGlobalContext();
8101     }
8102     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8103 }
8104 
GL_ProgramUniform1fEXT(GLuint program,GLint location,GLfloat v0)8105 void GL_APIENTRY GL_ProgramUniform1fEXT(GLuint program, GLint location, GLfloat v0)
8106 {
8107     Context *context = GetValidGlobalContext();
8108     EVENT(context, GLProgramUniform1fEXT, "context = %d, program = %u, location = %d, v0 = %f",
8109           CID(context), program, location, v0);
8110 
8111     if (context)
8112     {
8113         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8114         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8115         SCOPED_SHARE_CONTEXT_LOCK(context);
8116         bool isCallValid =
8117             (context->skipValidation() ||
8118              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8119                                                 context->getMutableErrorSetForValidation(),
8120                                                 angle::EntryPoint::GLProgramUniform1fEXT) &&
8121               ValidateProgramUniform1fEXT(context, angle::EntryPoint::GLProgramUniform1fEXT,
8122                                           programPacked, locationPacked, v0)));
8123         if (isCallValid)
8124         {
8125             context->programUniform1f(programPacked, locationPacked, v0);
8126         }
8127         ANGLE_CAPTURE_GL(ProgramUniform1fEXT, isCallValid, context, programPacked, locationPacked,
8128                          v0);
8129     }
8130     else
8131     {
8132         GenerateContextLostErrorOnCurrentGlobalContext();
8133     }
8134     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8135 }
8136 
GL_ProgramUniform1fvEXT(GLuint program,GLint location,GLsizei count,const GLfloat * value)8137 void GL_APIENTRY GL_ProgramUniform1fvEXT(GLuint program,
8138                                          GLint location,
8139                                          GLsizei count,
8140                                          const GLfloat *value)
8141 {
8142     Context *context = GetValidGlobalContext();
8143     EVENT(context, GLProgramUniform1fvEXT,
8144           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
8145           CID(context), program, location, count, (uintptr_t)value);
8146 
8147     if (context)
8148     {
8149         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8150         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8151         SCOPED_SHARE_CONTEXT_LOCK(context);
8152         bool isCallValid =
8153             (context->skipValidation() ||
8154              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8155                                                 context->getMutableErrorSetForValidation(),
8156                                                 angle::EntryPoint::GLProgramUniform1fvEXT) &&
8157               ValidateProgramUniform1fvEXT(context, angle::EntryPoint::GLProgramUniform1fvEXT,
8158                                            programPacked, locationPacked, count, value)));
8159         if (isCallValid)
8160         {
8161             context->programUniform1fv(programPacked, locationPacked, count, value);
8162         }
8163         ANGLE_CAPTURE_GL(ProgramUniform1fvEXT, isCallValid, context, programPacked, locationPacked,
8164                          count, value);
8165     }
8166     else
8167     {
8168         GenerateContextLostErrorOnCurrentGlobalContext();
8169     }
8170     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8171 }
8172 
GL_ProgramUniform1iEXT(GLuint program,GLint location,GLint v0)8173 void GL_APIENTRY GL_ProgramUniform1iEXT(GLuint program, GLint location, GLint v0)
8174 {
8175     Context *context = GetValidGlobalContext();
8176     EVENT(context, GLProgramUniform1iEXT, "context = %d, program = %u, location = %d, v0 = %d",
8177           CID(context), program, location, v0);
8178 
8179     if (context)
8180     {
8181         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8182         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8183         SCOPED_SHARE_CONTEXT_LOCK(context);
8184         bool isCallValid =
8185             (context->skipValidation() ||
8186              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8187                                                 context->getMutableErrorSetForValidation(),
8188                                                 angle::EntryPoint::GLProgramUniform1iEXT) &&
8189               ValidateProgramUniform1iEXT(context, angle::EntryPoint::GLProgramUniform1iEXT,
8190                                           programPacked, locationPacked, v0)));
8191         if (isCallValid)
8192         {
8193             context->programUniform1i(programPacked, locationPacked, v0);
8194         }
8195         ANGLE_CAPTURE_GL(ProgramUniform1iEXT, isCallValid, context, programPacked, locationPacked,
8196                          v0);
8197     }
8198     else
8199     {
8200         GenerateContextLostErrorOnCurrentGlobalContext();
8201     }
8202     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8203 }
8204 
GL_ProgramUniform1ivEXT(GLuint program,GLint location,GLsizei count,const GLint * value)8205 void GL_APIENTRY GL_ProgramUniform1ivEXT(GLuint program,
8206                                          GLint location,
8207                                          GLsizei count,
8208                                          const GLint *value)
8209 {
8210     Context *context = GetValidGlobalContext();
8211     EVENT(context, GLProgramUniform1ivEXT,
8212           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
8213           CID(context), program, location, count, (uintptr_t)value);
8214 
8215     if (context)
8216     {
8217         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8218         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8219         SCOPED_SHARE_CONTEXT_LOCK(context);
8220         bool isCallValid =
8221             (context->skipValidation() ||
8222              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8223                                                 context->getMutableErrorSetForValidation(),
8224                                                 angle::EntryPoint::GLProgramUniform1ivEXT) &&
8225               ValidateProgramUniform1ivEXT(context, angle::EntryPoint::GLProgramUniform1ivEXT,
8226                                            programPacked, locationPacked, count, value)));
8227         if (isCallValid)
8228         {
8229             context->programUniform1iv(programPacked, locationPacked, count, value);
8230         }
8231         ANGLE_CAPTURE_GL(ProgramUniform1ivEXT, isCallValid, context, programPacked, locationPacked,
8232                          count, value);
8233     }
8234     else
8235     {
8236         GenerateContextLostErrorOnCurrentGlobalContext();
8237     }
8238     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8239 }
8240 
GL_ProgramUniform1uiEXT(GLuint program,GLint location,GLuint v0)8241 void GL_APIENTRY GL_ProgramUniform1uiEXT(GLuint program, GLint location, GLuint v0)
8242 {
8243     Context *context = GetValidGlobalContext();
8244     EVENT(context, GLProgramUniform1uiEXT, "context = %d, program = %u, location = %d, v0 = %u",
8245           CID(context), program, location, v0);
8246 
8247     if (context)
8248     {
8249         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8250         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8251         SCOPED_SHARE_CONTEXT_LOCK(context);
8252         bool isCallValid =
8253             (context->skipValidation() ||
8254              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8255                                                 context->getMutableErrorSetForValidation(),
8256                                                 angle::EntryPoint::GLProgramUniform1uiEXT) &&
8257               ValidateProgramUniform1uiEXT(context, angle::EntryPoint::GLProgramUniform1uiEXT,
8258                                            programPacked, locationPacked, v0)));
8259         if (isCallValid)
8260         {
8261             context->programUniform1ui(programPacked, locationPacked, v0);
8262         }
8263         ANGLE_CAPTURE_GL(ProgramUniform1uiEXT, isCallValid, context, programPacked, locationPacked,
8264                          v0);
8265     }
8266     else
8267     {
8268         GenerateContextLostErrorOnCurrentGlobalContext();
8269     }
8270     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8271 }
8272 
GL_ProgramUniform1uivEXT(GLuint program,GLint location,GLsizei count,const GLuint * value)8273 void GL_APIENTRY GL_ProgramUniform1uivEXT(GLuint program,
8274                                           GLint location,
8275                                           GLsizei count,
8276                                           const GLuint *value)
8277 {
8278     Context *context = GetValidGlobalContext();
8279     EVENT(context, GLProgramUniform1uivEXT,
8280           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
8281           CID(context), program, location, count, (uintptr_t)value);
8282 
8283     if (context)
8284     {
8285         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8286         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8287         SCOPED_SHARE_CONTEXT_LOCK(context);
8288         bool isCallValid =
8289             (context->skipValidation() ||
8290              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8291                                                 context->getMutableErrorSetForValidation(),
8292                                                 angle::EntryPoint::GLProgramUniform1uivEXT) &&
8293               ValidateProgramUniform1uivEXT(context, angle::EntryPoint::GLProgramUniform1uivEXT,
8294                                             programPacked, locationPacked, count, value)));
8295         if (isCallValid)
8296         {
8297             context->programUniform1uiv(programPacked, locationPacked, count, value);
8298         }
8299         ANGLE_CAPTURE_GL(ProgramUniform1uivEXT, isCallValid, context, programPacked, locationPacked,
8300                          count, value);
8301     }
8302     else
8303     {
8304         GenerateContextLostErrorOnCurrentGlobalContext();
8305     }
8306     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8307 }
8308 
GL_ProgramUniform2fEXT(GLuint program,GLint location,GLfloat v0,GLfloat v1)8309 void GL_APIENTRY GL_ProgramUniform2fEXT(GLuint program, GLint location, GLfloat v0, GLfloat v1)
8310 {
8311     Context *context = GetValidGlobalContext();
8312     EVENT(context, GLProgramUniform2fEXT,
8313           "context = %d, program = %u, location = %d, v0 = %f, v1 = %f", CID(context), program,
8314           location, v0, v1);
8315 
8316     if (context)
8317     {
8318         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8319         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8320         SCOPED_SHARE_CONTEXT_LOCK(context);
8321         bool isCallValid =
8322             (context->skipValidation() ||
8323              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8324                                                 context->getMutableErrorSetForValidation(),
8325                                                 angle::EntryPoint::GLProgramUniform2fEXT) &&
8326               ValidateProgramUniform2fEXT(context, angle::EntryPoint::GLProgramUniform2fEXT,
8327                                           programPacked, locationPacked, v0, v1)));
8328         if (isCallValid)
8329         {
8330             context->programUniform2f(programPacked, locationPacked, v0, v1);
8331         }
8332         ANGLE_CAPTURE_GL(ProgramUniform2fEXT, isCallValid, context, programPacked, locationPacked,
8333                          v0, v1);
8334     }
8335     else
8336     {
8337         GenerateContextLostErrorOnCurrentGlobalContext();
8338     }
8339     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8340 }
8341 
GL_ProgramUniform2fvEXT(GLuint program,GLint location,GLsizei count,const GLfloat * value)8342 void GL_APIENTRY GL_ProgramUniform2fvEXT(GLuint program,
8343                                          GLint location,
8344                                          GLsizei count,
8345                                          const GLfloat *value)
8346 {
8347     Context *context = GetValidGlobalContext();
8348     EVENT(context, GLProgramUniform2fvEXT,
8349           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
8350           CID(context), program, location, count, (uintptr_t)value);
8351 
8352     if (context)
8353     {
8354         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8355         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8356         SCOPED_SHARE_CONTEXT_LOCK(context);
8357         bool isCallValid =
8358             (context->skipValidation() ||
8359              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8360                                                 context->getMutableErrorSetForValidation(),
8361                                                 angle::EntryPoint::GLProgramUniform2fvEXT) &&
8362               ValidateProgramUniform2fvEXT(context, angle::EntryPoint::GLProgramUniform2fvEXT,
8363                                            programPacked, locationPacked, count, value)));
8364         if (isCallValid)
8365         {
8366             context->programUniform2fv(programPacked, locationPacked, count, value);
8367         }
8368         ANGLE_CAPTURE_GL(ProgramUniform2fvEXT, isCallValid, context, programPacked, locationPacked,
8369                          count, value);
8370     }
8371     else
8372     {
8373         GenerateContextLostErrorOnCurrentGlobalContext();
8374     }
8375     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8376 }
8377 
GL_ProgramUniform2iEXT(GLuint program,GLint location,GLint v0,GLint v1)8378 void GL_APIENTRY GL_ProgramUniform2iEXT(GLuint program, GLint location, GLint v0, GLint v1)
8379 {
8380     Context *context = GetValidGlobalContext();
8381     EVENT(context, GLProgramUniform2iEXT,
8382           "context = %d, program = %u, location = %d, v0 = %d, v1 = %d", CID(context), program,
8383           location, v0, v1);
8384 
8385     if (context)
8386     {
8387         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8388         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8389         SCOPED_SHARE_CONTEXT_LOCK(context);
8390         bool isCallValid =
8391             (context->skipValidation() ||
8392              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8393                                                 context->getMutableErrorSetForValidation(),
8394                                                 angle::EntryPoint::GLProgramUniform2iEXT) &&
8395               ValidateProgramUniform2iEXT(context, angle::EntryPoint::GLProgramUniform2iEXT,
8396                                           programPacked, locationPacked, v0, v1)));
8397         if (isCallValid)
8398         {
8399             context->programUniform2i(programPacked, locationPacked, v0, v1);
8400         }
8401         ANGLE_CAPTURE_GL(ProgramUniform2iEXT, isCallValid, context, programPacked, locationPacked,
8402                          v0, v1);
8403     }
8404     else
8405     {
8406         GenerateContextLostErrorOnCurrentGlobalContext();
8407     }
8408     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8409 }
8410 
GL_ProgramUniform2ivEXT(GLuint program,GLint location,GLsizei count,const GLint * value)8411 void GL_APIENTRY GL_ProgramUniform2ivEXT(GLuint program,
8412                                          GLint location,
8413                                          GLsizei count,
8414                                          const GLint *value)
8415 {
8416     Context *context = GetValidGlobalContext();
8417     EVENT(context, GLProgramUniform2ivEXT,
8418           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
8419           CID(context), program, location, count, (uintptr_t)value);
8420 
8421     if (context)
8422     {
8423         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8424         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8425         SCOPED_SHARE_CONTEXT_LOCK(context);
8426         bool isCallValid =
8427             (context->skipValidation() ||
8428              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8429                                                 context->getMutableErrorSetForValidation(),
8430                                                 angle::EntryPoint::GLProgramUniform2ivEXT) &&
8431               ValidateProgramUniform2ivEXT(context, angle::EntryPoint::GLProgramUniform2ivEXT,
8432                                            programPacked, locationPacked, count, value)));
8433         if (isCallValid)
8434         {
8435             context->programUniform2iv(programPacked, locationPacked, count, value);
8436         }
8437         ANGLE_CAPTURE_GL(ProgramUniform2ivEXT, isCallValid, context, programPacked, locationPacked,
8438                          count, value);
8439     }
8440     else
8441     {
8442         GenerateContextLostErrorOnCurrentGlobalContext();
8443     }
8444     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8445 }
8446 
GL_ProgramUniform2uiEXT(GLuint program,GLint location,GLuint v0,GLuint v1)8447 void GL_APIENTRY GL_ProgramUniform2uiEXT(GLuint program, GLint location, GLuint v0, GLuint v1)
8448 {
8449     Context *context = GetValidGlobalContext();
8450     EVENT(context, GLProgramUniform2uiEXT,
8451           "context = %d, program = %u, location = %d, v0 = %u, v1 = %u", CID(context), program,
8452           location, v0, v1);
8453 
8454     if (context)
8455     {
8456         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8457         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8458         SCOPED_SHARE_CONTEXT_LOCK(context);
8459         bool isCallValid =
8460             (context->skipValidation() ||
8461              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8462                                                 context->getMutableErrorSetForValidation(),
8463                                                 angle::EntryPoint::GLProgramUniform2uiEXT) &&
8464               ValidateProgramUniform2uiEXT(context, angle::EntryPoint::GLProgramUniform2uiEXT,
8465                                            programPacked, locationPacked, v0, v1)));
8466         if (isCallValid)
8467         {
8468             context->programUniform2ui(programPacked, locationPacked, v0, v1);
8469         }
8470         ANGLE_CAPTURE_GL(ProgramUniform2uiEXT, isCallValid, context, programPacked, locationPacked,
8471                          v0, v1);
8472     }
8473     else
8474     {
8475         GenerateContextLostErrorOnCurrentGlobalContext();
8476     }
8477     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8478 }
8479 
GL_ProgramUniform2uivEXT(GLuint program,GLint location,GLsizei count,const GLuint * value)8480 void GL_APIENTRY GL_ProgramUniform2uivEXT(GLuint program,
8481                                           GLint location,
8482                                           GLsizei count,
8483                                           const GLuint *value)
8484 {
8485     Context *context = GetValidGlobalContext();
8486     EVENT(context, GLProgramUniform2uivEXT,
8487           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
8488           CID(context), program, location, count, (uintptr_t)value);
8489 
8490     if (context)
8491     {
8492         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8493         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8494         SCOPED_SHARE_CONTEXT_LOCK(context);
8495         bool isCallValid =
8496             (context->skipValidation() ||
8497              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8498                                                 context->getMutableErrorSetForValidation(),
8499                                                 angle::EntryPoint::GLProgramUniform2uivEXT) &&
8500               ValidateProgramUniform2uivEXT(context, angle::EntryPoint::GLProgramUniform2uivEXT,
8501                                             programPacked, locationPacked, count, value)));
8502         if (isCallValid)
8503         {
8504             context->programUniform2uiv(programPacked, locationPacked, count, value);
8505         }
8506         ANGLE_CAPTURE_GL(ProgramUniform2uivEXT, isCallValid, context, programPacked, locationPacked,
8507                          count, value);
8508     }
8509     else
8510     {
8511         GenerateContextLostErrorOnCurrentGlobalContext();
8512     }
8513     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8514 }
8515 
8516 void GL_APIENTRY
GL_ProgramUniform3fEXT(GLuint program,GLint location,GLfloat v0,GLfloat v1,GLfloat v2)8517 GL_ProgramUniform3fEXT(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
8518 {
8519     Context *context = GetValidGlobalContext();
8520     EVENT(context, GLProgramUniform3fEXT,
8521           "context = %d, program = %u, location = %d, v0 = %f, v1 = %f, v2 = %f", CID(context),
8522           program, location, v0, v1, v2);
8523 
8524     if (context)
8525     {
8526         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8527         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8528         SCOPED_SHARE_CONTEXT_LOCK(context);
8529         bool isCallValid =
8530             (context->skipValidation() ||
8531              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8532                                                 context->getMutableErrorSetForValidation(),
8533                                                 angle::EntryPoint::GLProgramUniform3fEXT) &&
8534               ValidateProgramUniform3fEXT(context, angle::EntryPoint::GLProgramUniform3fEXT,
8535                                           programPacked, locationPacked, v0, v1, v2)));
8536         if (isCallValid)
8537         {
8538             context->programUniform3f(programPacked, locationPacked, v0, v1, v2);
8539         }
8540         ANGLE_CAPTURE_GL(ProgramUniform3fEXT, isCallValid, context, programPacked, locationPacked,
8541                          v0, v1, v2);
8542     }
8543     else
8544     {
8545         GenerateContextLostErrorOnCurrentGlobalContext();
8546     }
8547     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8548 }
8549 
GL_ProgramUniform3fvEXT(GLuint program,GLint location,GLsizei count,const GLfloat * value)8550 void GL_APIENTRY GL_ProgramUniform3fvEXT(GLuint program,
8551                                          GLint location,
8552                                          GLsizei count,
8553                                          const GLfloat *value)
8554 {
8555     Context *context = GetValidGlobalContext();
8556     EVENT(context, GLProgramUniform3fvEXT,
8557           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
8558           CID(context), program, location, count, (uintptr_t)value);
8559 
8560     if (context)
8561     {
8562         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8563         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8564         SCOPED_SHARE_CONTEXT_LOCK(context);
8565         bool isCallValid =
8566             (context->skipValidation() ||
8567              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8568                                                 context->getMutableErrorSetForValidation(),
8569                                                 angle::EntryPoint::GLProgramUniform3fvEXT) &&
8570               ValidateProgramUniform3fvEXT(context, angle::EntryPoint::GLProgramUniform3fvEXT,
8571                                            programPacked, locationPacked, count, value)));
8572         if (isCallValid)
8573         {
8574             context->programUniform3fv(programPacked, locationPacked, count, value);
8575         }
8576         ANGLE_CAPTURE_GL(ProgramUniform3fvEXT, isCallValid, context, programPacked, locationPacked,
8577                          count, value);
8578     }
8579     else
8580     {
8581         GenerateContextLostErrorOnCurrentGlobalContext();
8582     }
8583     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8584 }
8585 
8586 void GL_APIENTRY
GL_ProgramUniform3iEXT(GLuint program,GLint location,GLint v0,GLint v1,GLint v2)8587 GL_ProgramUniform3iEXT(GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
8588 {
8589     Context *context = GetValidGlobalContext();
8590     EVENT(context, GLProgramUniform3iEXT,
8591           "context = %d, program = %u, location = %d, v0 = %d, v1 = %d, v2 = %d", CID(context),
8592           program, location, v0, v1, v2);
8593 
8594     if (context)
8595     {
8596         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8597         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8598         SCOPED_SHARE_CONTEXT_LOCK(context);
8599         bool isCallValid =
8600             (context->skipValidation() ||
8601              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8602                                                 context->getMutableErrorSetForValidation(),
8603                                                 angle::EntryPoint::GLProgramUniform3iEXT) &&
8604               ValidateProgramUniform3iEXT(context, angle::EntryPoint::GLProgramUniform3iEXT,
8605                                           programPacked, locationPacked, v0, v1, v2)));
8606         if (isCallValid)
8607         {
8608             context->programUniform3i(programPacked, locationPacked, v0, v1, v2);
8609         }
8610         ANGLE_CAPTURE_GL(ProgramUniform3iEXT, isCallValid, context, programPacked, locationPacked,
8611                          v0, v1, v2);
8612     }
8613     else
8614     {
8615         GenerateContextLostErrorOnCurrentGlobalContext();
8616     }
8617     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8618 }
8619 
GL_ProgramUniform3ivEXT(GLuint program,GLint location,GLsizei count,const GLint * value)8620 void GL_APIENTRY GL_ProgramUniform3ivEXT(GLuint program,
8621                                          GLint location,
8622                                          GLsizei count,
8623                                          const GLint *value)
8624 {
8625     Context *context = GetValidGlobalContext();
8626     EVENT(context, GLProgramUniform3ivEXT,
8627           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
8628           CID(context), program, location, count, (uintptr_t)value);
8629 
8630     if (context)
8631     {
8632         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8633         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8634         SCOPED_SHARE_CONTEXT_LOCK(context);
8635         bool isCallValid =
8636             (context->skipValidation() ||
8637              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8638                                                 context->getMutableErrorSetForValidation(),
8639                                                 angle::EntryPoint::GLProgramUniform3ivEXT) &&
8640               ValidateProgramUniform3ivEXT(context, angle::EntryPoint::GLProgramUniform3ivEXT,
8641                                            programPacked, locationPacked, count, value)));
8642         if (isCallValid)
8643         {
8644             context->programUniform3iv(programPacked, locationPacked, count, value);
8645         }
8646         ANGLE_CAPTURE_GL(ProgramUniform3ivEXT, isCallValid, context, programPacked, locationPacked,
8647                          count, value);
8648     }
8649     else
8650     {
8651         GenerateContextLostErrorOnCurrentGlobalContext();
8652     }
8653     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8654 }
8655 
8656 void GL_APIENTRY
GL_ProgramUniform3uiEXT(GLuint program,GLint location,GLuint v0,GLuint v1,GLuint v2)8657 GL_ProgramUniform3uiEXT(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)
8658 {
8659     Context *context = GetValidGlobalContext();
8660     EVENT(context, GLProgramUniform3uiEXT,
8661           "context = %d, program = %u, location = %d, v0 = %u, v1 = %u, v2 = %u", CID(context),
8662           program, location, v0, v1, v2);
8663 
8664     if (context)
8665     {
8666         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8667         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8668         SCOPED_SHARE_CONTEXT_LOCK(context);
8669         bool isCallValid =
8670             (context->skipValidation() ||
8671              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8672                                                 context->getMutableErrorSetForValidation(),
8673                                                 angle::EntryPoint::GLProgramUniform3uiEXT) &&
8674               ValidateProgramUniform3uiEXT(context, angle::EntryPoint::GLProgramUniform3uiEXT,
8675                                            programPacked, locationPacked, v0, v1, v2)));
8676         if (isCallValid)
8677         {
8678             context->programUniform3ui(programPacked, locationPacked, v0, v1, v2);
8679         }
8680         ANGLE_CAPTURE_GL(ProgramUniform3uiEXT, isCallValid, context, programPacked, locationPacked,
8681                          v0, v1, v2);
8682     }
8683     else
8684     {
8685         GenerateContextLostErrorOnCurrentGlobalContext();
8686     }
8687     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8688 }
8689 
GL_ProgramUniform3uivEXT(GLuint program,GLint location,GLsizei count,const GLuint * value)8690 void GL_APIENTRY GL_ProgramUniform3uivEXT(GLuint program,
8691                                           GLint location,
8692                                           GLsizei count,
8693                                           const GLuint *value)
8694 {
8695     Context *context = GetValidGlobalContext();
8696     EVENT(context, GLProgramUniform3uivEXT,
8697           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
8698           CID(context), program, location, count, (uintptr_t)value);
8699 
8700     if (context)
8701     {
8702         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8703         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8704         SCOPED_SHARE_CONTEXT_LOCK(context);
8705         bool isCallValid =
8706             (context->skipValidation() ||
8707              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8708                                                 context->getMutableErrorSetForValidation(),
8709                                                 angle::EntryPoint::GLProgramUniform3uivEXT) &&
8710               ValidateProgramUniform3uivEXT(context, angle::EntryPoint::GLProgramUniform3uivEXT,
8711                                             programPacked, locationPacked, count, value)));
8712         if (isCallValid)
8713         {
8714             context->programUniform3uiv(programPacked, locationPacked, count, value);
8715         }
8716         ANGLE_CAPTURE_GL(ProgramUniform3uivEXT, isCallValid, context, programPacked, locationPacked,
8717                          count, value);
8718     }
8719     else
8720     {
8721         GenerateContextLostErrorOnCurrentGlobalContext();
8722     }
8723     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8724 }
8725 
GL_ProgramUniform4fEXT(GLuint program,GLint location,GLfloat v0,GLfloat v1,GLfloat v2,GLfloat v3)8726 void GL_APIENTRY GL_ProgramUniform4fEXT(GLuint program,
8727                                         GLint location,
8728                                         GLfloat v0,
8729                                         GLfloat v1,
8730                                         GLfloat v2,
8731                                         GLfloat v3)
8732 {
8733     Context *context = GetValidGlobalContext();
8734     EVENT(context, GLProgramUniform4fEXT,
8735           "context = %d, program = %u, location = %d, v0 = %f, v1 = %f, v2 = %f, v3 = %f",
8736           CID(context), program, location, v0, v1, v2, v3);
8737 
8738     if (context)
8739     {
8740         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8741         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8742         SCOPED_SHARE_CONTEXT_LOCK(context);
8743         bool isCallValid =
8744             (context->skipValidation() ||
8745              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8746                                                 context->getMutableErrorSetForValidation(),
8747                                                 angle::EntryPoint::GLProgramUniform4fEXT) &&
8748               ValidateProgramUniform4fEXT(context, angle::EntryPoint::GLProgramUniform4fEXT,
8749                                           programPacked, locationPacked, v0, v1, v2, v3)));
8750         if (isCallValid)
8751         {
8752             context->programUniform4f(programPacked, locationPacked, v0, v1, v2, v3);
8753         }
8754         ANGLE_CAPTURE_GL(ProgramUniform4fEXT, isCallValid, context, programPacked, locationPacked,
8755                          v0, v1, v2, v3);
8756     }
8757     else
8758     {
8759         GenerateContextLostErrorOnCurrentGlobalContext();
8760     }
8761     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8762 }
8763 
GL_ProgramUniform4fvEXT(GLuint program,GLint location,GLsizei count,const GLfloat * value)8764 void GL_APIENTRY GL_ProgramUniform4fvEXT(GLuint program,
8765                                          GLint location,
8766                                          GLsizei count,
8767                                          const GLfloat *value)
8768 {
8769     Context *context = GetValidGlobalContext();
8770     EVENT(context, GLProgramUniform4fvEXT,
8771           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
8772           CID(context), program, location, count, (uintptr_t)value);
8773 
8774     if (context)
8775     {
8776         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8777         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8778         SCOPED_SHARE_CONTEXT_LOCK(context);
8779         bool isCallValid =
8780             (context->skipValidation() ||
8781              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8782                                                 context->getMutableErrorSetForValidation(),
8783                                                 angle::EntryPoint::GLProgramUniform4fvEXT) &&
8784               ValidateProgramUniform4fvEXT(context, angle::EntryPoint::GLProgramUniform4fvEXT,
8785                                            programPacked, locationPacked, count, value)));
8786         if (isCallValid)
8787         {
8788             context->programUniform4fv(programPacked, locationPacked, count, value);
8789         }
8790         ANGLE_CAPTURE_GL(ProgramUniform4fvEXT, isCallValid, context, programPacked, locationPacked,
8791                          count, value);
8792     }
8793     else
8794     {
8795         GenerateContextLostErrorOnCurrentGlobalContext();
8796     }
8797     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8798 }
8799 
8800 void GL_APIENTRY
GL_ProgramUniform4iEXT(GLuint program,GLint location,GLint v0,GLint v1,GLint v2,GLint v3)8801 GL_ProgramUniform4iEXT(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
8802 {
8803     Context *context = GetValidGlobalContext();
8804     EVENT(context, GLProgramUniform4iEXT,
8805           "context = %d, program = %u, location = %d, v0 = %d, v1 = %d, v2 = %d, v3 = %d",
8806           CID(context), program, location, v0, v1, v2, v3);
8807 
8808     if (context)
8809     {
8810         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8811         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8812         SCOPED_SHARE_CONTEXT_LOCK(context);
8813         bool isCallValid =
8814             (context->skipValidation() ||
8815              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8816                                                 context->getMutableErrorSetForValidation(),
8817                                                 angle::EntryPoint::GLProgramUniform4iEXT) &&
8818               ValidateProgramUniform4iEXT(context, angle::EntryPoint::GLProgramUniform4iEXT,
8819                                           programPacked, locationPacked, v0, v1, v2, v3)));
8820         if (isCallValid)
8821         {
8822             context->programUniform4i(programPacked, locationPacked, v0, v1, v2, v3);
8823         }
8824         ANGLE_CAPTURE_GL(ProgramUniform4iEXT, isCallValid, context, programPacked, locationPacked,
8825                          v0, v1, v2, v3);
8826     }
8827     else
8828     {
8829         GenerateContextLostErrorOnCurrentGlobalContext();
8830     }
8831     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8832 }
8833 
GL_ProgramUniform4ivEXT(GLuint program,GLint location,GLsizei count,const GLint * value)8834 void GL_APIENTRY GL_ProgramUniform4ivEXT(GLuint program,
8835                                          GLint location,
8836                                          GLsizei count,
8837                                          const GLint *value)
8838 {
8839     Context *context = GetValidGlobalContext();
8840     EVENT(context, GLProgramUniform4ivEXT,
8841           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
8842           CID(context), program, location, count, (uintptr_t)value);
8843 
8844     if (context)
8845     {
8846         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8847         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8848         SCOPED_SHARE_CONTEXT_LOCK(context);
8849         bool isCallValid =
8850             (context->skipValidation() ||
8851              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8852                                                 context->getMutableErrorSetForValidation(),
8853                                                 angle::EntryPoint::GLProgramUniform4ivEXT) &&
8854               ValidateProgramUniform4ivEXT(context, angle::EntryPoint::GLProgramUniform4ivEXT,
8855                                            programPacked, locationPacked, count, value)));
8856         if (isCallValid)
8857         {
8858             context->programUniform4iv(programPacked, locationPacked, count, value);
8859         }
8860         ANGLE_CAPTURE_GL(ProgramUniform4ivEXT, isCallValid, context, programPacked, locationPacked,
8861                          count, value);
8862     }
8863     else
8864     {
8865         GenerateContextLostErrorOnCurrentGlobalContext();
8866     }
8867     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8868 }
8869 
8870 void GL_APIENTRY
GL_ProgramUniform4uiEXT(GLuint program,GLint location,GLuint v0,GLuint v1,GLuint v2,GLuint v3)8871 GL_ProgramUniform4uiEXT(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
8872 {
8873     Context *context = GetValidGlobalContext();
8874     EVENT(context, GLProgramUniform4uiEXT,
8875           "context = %d, program = %u, location = %d, v0 = %u, v1 = %u, v2 = %u, v3 = %u",
8876           CID(context), program, location, v0, v1, v2, v3);
8877 
8878     if (context)
8879     {
8880         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8881         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8882         SCOPED_SHARE_CONTEXT_LOCK(context);
8883         bool isCallValid =
8884             (context->skipValidation() ||
8885              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8886                                                 context->getMutableErrorSetForValidation(),
8887                                                 angle::EntryPoint::GLProgramUniform4uiEXT) &&
8888               ValidateProgramUniform4uiEXT(context, angle::EntryPoint::GLProgramUniform4uiEXT,
8889                                            programPacked, locationPacked, v0, v1, v2, v3)));
8890         if (isCallValid)
8891         {
8892             context->programUniform4ui(programPacked, locationPacked, v0, v1, v2, v3);
8893         }
8894         ANGLE_CAPTURE_GL(ProgramUniform4uiEXT, isCallValid, context, programPacked, locationPacked,
8895                          v0, v1, v2, v3);
8896     }
8897     else
8898     {
8899         GenerateContextLostErrorOnCurrentGlobalContext();
8900     }
8901     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8902 }
8903 
GL_ProgramUniform4uivEXT(GLuint program,GLint location,GLsizei count,const GLuint * value)8904 void GL_APIENTRY GL_ProgramUniform4uivEXT(GLuint program,
8905                                           GLint location,
8906                                           GLsizei count,
8907                                           const GLuint *value)
8908 {
8909     Context *context = GetValidGlobalContext();
8910     EVENT(context, GLProgramUniform4uivEXT,
8911           "context = %d, program = %u, location = %d, count = %d, value = 0x%016" PRIxPTR "",
8912           CID(context), program, location, count, (uintptr_t)value);
8913 
8914     if (context)
8915     {
8916         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8917         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8918         SCOPED_SHARE_CONTEXT_LOCK(context);
8919         bool isCallValid =
8920             (context->skipValidation() ||
8921              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8922                                                 context->getMutableErrorSetForValidation(),
8923                                                 angle::EntryPoint::GLProgramUniform4uivEXT) &&
8924               ValidateProgramUniform4uivEXT(context, angle::EntryPoint::GLProgramUniform4uivEXT,
8925                                             programPacked, locationPacked, count, value)));
8926         if (isCallValid)
8927         {
8928             context->programUniform4uiv(programPacked, locationPacked, count, value);
8929         }
8930         ANGLE_CAPTURE_GL(ProgramUniform4uivEXT, isCallValid, context, programPacked, locationPacked,
8931                          count, value);
8932     }
8933     else
8934     {
8935         GenerateContextLostErrorOnCurrentGlobalContext();
8936     }
8937     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8938 }
8939 
GL_ProgramUniformMatrix2fvEXT(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)8940 void GL_APIENTRY GL_ProgramUniformMatrix2fvEXT(GLuint program,
8941                                                GLint location,
8942                                                GLsizei count,
8943                                                GLboolean transpose,
8944                                                const GLfloat *value)
8945 {
8946     Context *context = GetValidGlobalContext();
8947     EVENT(context, GLProgramUniformMatrix2fvEXT,
8948           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
8949           "0x%016" PRIxPTR "",
8950           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
8951 
8952     if (context)
8953     {
8954         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8955         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8956         SCOPED_SHARE_CONTEXT_LOCK(context);
8957         bool isCallValid =
8958             (context->skipValidation() ||
8959              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
8960                                                 context->getMutableErrorSetForValidation(),
8961                                                 angle::EntryPoint::GLProgramUniformMatrix2fvEXT) &&
8962               ValidateProgramUniformMatrix2fvEXT(
8963                   context, angle::EntryPoint::GLProgramUniformMatrix2fvEXT, programPacked,
8964                   locationPacked, count, transpose, value)));
8965         if (isCallValid)
8966         {
8967             context->programUniformMatrix2fv(programPacked, locationPacked, count, transpose,
8968                                              value);
8969         }
8970         ANGLE_CAPTURE_GL(ProgramUniformMatrix2fvEXT, isCallValid, context, programPacked,
8971                          locationPacked, count, transpose, value);
8972     }
8973     else
8974     {
8975         GenerateContextLostErrorOnCurrentGlobalContext();
8976     }
8977     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
8978 }
8979 
GL_ProgramUniformMatrix2x3fvEXT(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)8980 void GL_APIENTRY GL_ProgramUniformMatrix2x3fvEXT(GLuint program,
8981                                                  GLint location,
8982                                                  GLsizei count,
8983                                                  GLboolean transpose,
8984                                                  const GLfloat *value)
8985 {
8986     Context *context = GetValidGlobalContext();
8987     EVENT(context, GLProgramUniformMatrix2x3fvEXT,
8988           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
8989           "0x%016" PRIxPTR "",
8990           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
8991 
8992     if (context)
8993     {
8994         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
8995         UniformLocation locationPacked = PackParam<UniformLocation>(location);
8996         SCOPED_SHARE_CONTEXT_LOCK(context);
8997         bool isCallValid =
8998             (context->skipValidation() ||
8999              (ValidatePixelLocalStorageInactive(
9000                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
9001                   angle::EntryPoint::GLProgramUniformMatrix2x3fvEXT) &&
9002               ValidateProgramUniformMatrix2x3fvEXT(
9003                   context, angle::EntryPoint::GLProgramUniformMatrix2x3fvEXT, programPacked,
9004                   locationPacked, count, transpose, value)));
9005         if (isCallValid)
9006         {
9007             context->programUniformMatrix2x3fv(programPacked, locationPacked, count, transpose,
9008                                                value);
9009         }
9010         ANGLE_CAPTURE_GL(ProgramUniformMatrix2x3fvEXT, isCallValid, context, programPacked,
9011                          locationPacked, count, transpose, value);
9012     }
9013     else
9014     {
9015         GenerateContextLostErrorOnCurrentGlobalContext();
9016     }
9017     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9018 }
9019 
GL_ProgramUniformMatrix2x4fvEXT(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)9020 void GL_APIENTRY GL_ProgramUniformMatrix2x4fvEXT(GLuint program,
9021                                                  GLint location,
9022                                                  GLsizei count,
9023                                                  GLboolean transpose,
9024                                                  const GLfloat *value)
9025 {
9026     Context *context = GetValidGlobalContext();
9027     EVENT(context, GLProgramUniformMatrix2x4fvEXT,
9028           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
9029           "0x%016" PRIxPTR "",
9030           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
9031 
9032     if (context)
9033     {
9034         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
9035         UniformLocation locationPacked = PackParam<UniformLocation>(location);
9036         SCOPED_SHARE_CONTEXT_LOCK(context);
9037         bool isCallValid =
9038             (context->skipValidation() ||
9039              (ValidatePixelLocalStorageInactive(
9040                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
9041                   angle::EntryPoint::GLProgramUniformMatrix2x4fvEXT) &&
9042               ValidateProgramUniformMatrix2x4fvEXT(
9043                   context, angle::EntryPoint::GLProgramUniformMatrix2x4fvEXT, programPacked,
9044                   locationPacked, count, transpose, value)));
9045         if (isCallValid)
9046         {
9047             context->programUniformMatrix2x4fv(programPacked, locationPacked, count, transpose,
9048                                                value);
9049         }
9050         ANGLE_CAPTURE_GL(ProgramUniformMatrix2x4fvEXT, isCallValid, context, programPacked,
9051                          locationPacked, count, transpose, value);
9052     }
9053     else
9054     {
9055         GenerateContextLostErrorOnCurrentGlobalContext();
9056     }
9057     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9058 }
9059 
GL_ProgramUniformMatrix3fvEXT(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)9060 void GL_APIENTRY GL_ProgramUniformMatrix3fvEXT(GLuint program,
9061                                                GLint location,
9062                                                GLsizei count,
9063                                                GLboolean transpose,
9064                                                const GLfloat *value)
9065 {
9066     Context *context = GetValidGlobalContext();
9067     EVENT(context, GLProgramUniformMatrix3fvEXT,
9068           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
9069           "0x%016" PRIxPTR "",
9070           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
9071 
9072     if (context)
9073     {
9074         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
9075         UniformLocation locationPacked = PackParam<UniformLocation>(location);
9076         SCOPED_SHARE_CONTEXT_LOCK(context);
9077         bool isCallValid =
9078             (context->skipValidation() ||
9079              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
9080                                                 context->getMutableErrorSetForValidation(),
9081                                                 angle::EntryPoint::GLProgramUniformMatrix3fvEXT) &&
9082               ValidateProgramUniformMatrix3fvEXT(
9083                   context, angle::EntryPoint::GLProgramUniformMatrix3fvEXT, programPacked,
9084                   locationPacked, count, transpose, value)));
9085         if (isCallValid)
9086         {
9087             context->programUniformMatrix3fv(programPacked, locationPacked, count, transpose,
9088                                              value);
9089         }
9090         ANGLE_CAPTURE_GL(ProgramUniformMatrix3fvEXT, isCallValid, context, programPacked,
9091                          locationPacked, count, transpose, value);
9092     }
9093     else
9094     {
9095         GenerateContextLostErrorOnCurrentGlobalContext();
9096     }
9097     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9098 }
9099 
GL_ProgramUniformMatrix3x2fvEXT(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)9100 void GL_APIENTRY GL_ProgramUniformMatrix3x2fvEXT(GLuint program,
9101                                                  GLint location,
9102                                                  GLsizei count,
9103                                                  GLboolean transpose,
9104                                                  const GLfloat *value)
9105 {
9106     Context *context = GetValidGlobalContext();
9107     EVENT(context, GLProgramUniformMatrix3x2fvEXT,
9108           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
9109           "0x%016" PRIxPTR "",
9110           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
9111 
9112     if (context)
9113     {
9114         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
9115         UniformLocation locationPacked = PackParam<UniformLocation>(location);
9116         SCOPED_SHARE_CONTEXT_LOCK(context);
9117         bool isCallValid =
9118             (context->skipValidation() ||
9119              (ValidatePixelLocalStorageInactive(
9120                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
9121                   angle::EntryPoint::GLProgramUniformMatrix3x2fvEXT) &&
9122               ValidateProgramUniformMatrix3x2fvEXT(
9123                   context, angle::EntryPoint::GLProgramUniformMatrix3x2fvEXT, programPacked,
9124                   locationPacked, count, transpose, value)));
9125         if (isCallValid)
9126         {
9127             context->programUniformMatrix3x2fv(programPacked, locationPacked, count, transpose,
9128                                                value);
9129         }
9130         ANGLE_CAPTURE_GL(ProgramUniformMatrix3x2fvEXT, isCallValid, context, programPacked,
9131                          locationPacked, count, transpose, value);
9132     }
9133     else
9134     {
9135         GenerateContextLostErrorOnCurrentGlobalContext();
9136     }
9137     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9138 }
9139 
GL_ProgramUniformMatrix3x4fvEXT(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)9140 void GL_APIENTRY GL_ProgramUniformMatrix3x4fvEXT(GLuint program,
9141                                                  GLint location,
9142                                                  GLsizei count,
9143                                                  GLboolean transpose,
9144                                                  const GLfloat *value)
9145 {
9146     Context *context = GetValidGlobalContext();
9147     EVENT(context, GLProgramUniformMatrix3x4fvEXT,
9148           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
9149           "0x%016" PRIxPTR "",
9150           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
9151 
9152     if (context)
9153     {
9154         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
9155         UniformLocation locationPacked = PackParam<UniformLocation>(location);
9156         SCOPED_SHARE_CONTEXT_LOCK(context);
9157         bool isCallValid =
9158             (context->skipValidation() ||
9159              (ValidatePixelLocalStorageInactive(
9160                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
9161                   angle::EntryPoint::GLProgramUniformMatrix3x4fvEXT) &&
9162               ValidateProgramUniformMatrix3x4fvEXT(
9163                   context, angle::EntryPoint::GLProgramUniformMatrix3x4fvEXT, programPacked,
9164                   locationPacked, count, transpose, value)));
9165         if (isCallValid)
9166         {
9167             context->programUniformMatrix3x4fv(programPacked, locationPacked, count, transpose,
9168                                                value);
9169         }
9170         ANGLE_CAPTURE_GL(ProgramUniformMatrix3x4fvEXT, isCallValid, context, programPacked,
9171                          locationPacked, count, transpose, value);
9172     }
9173     else
9174     {
9175         GenerateContextLostErrorOnCurrentGlobalContext();
9176     }
9177     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9178 }
9179 
GL_ProgramUniformMatrix4fvEXT(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)9180 void GL_APIENTRY GL_ProgramUniformMatrix4fvEXT(GLuint program,
9181                                                GLint location,
9182                                                GLsizei count,
9183                                                GLboolean transpose,
9184                                                const GLfloat *value)
9185 {
9186     Context *context = GetValidGlobalContext();
9187     EVENT(context, GLProgramUniformMatrix4fvEXT,
9188           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
9189           "0x%016" PRIxPTR "",
9190           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
9191 
9192     if (context)
9193     {
9194         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
9195         UniformLocation locationPacked = PackParam<UniformLocation>(location);
9196         SCOPED_SHARE_CONTEXT_LOCK(context);
9197         bool isCallValid =
9198             (context->skipValidation() ||
9199              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
9200                                                 context->getMutableErrorSetForValidation(),
9201                                                 angle::EntryPoint::GLProgramUniformMatrix4fvEXT) &&
9202               ValidateProgramUniformMatrix4fvEXT(
9203                   context, angle::EntryPoint::GLProgramUniformMatrix4fvEXT, programPacked,
9204                   locationPacked, count, transpose, value)));
9205         if (isCallValid)
9206         {
9207             context->programUniformMatrix4fv(programPacked, locationPacked, count, transpose,
9208                                              value);
9209         }
9210         ANGLE_CAPTURE_GL(ProgramUniformMatrix4fvEXT, isCallValid, context, programPacked,
9211                          locationPacked, count, transpose, value);
9212     }
9213     else
9214     {
9215         GenerateContextLostErrorOnCurrentGlobalContext();
9216     }
9217     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9218 }
9219 
GL_ProgramUniformMatrix4x2fvEXT(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)9220 void GL_APIENTRY GL_ProgramUniformMatrix4x2fvEXT(GLuint program,
9221                                                  GLint location,
9222                                                  GLsizei count,
9223                                                  GLboolean transpose,
9224                                                  const GLfloat *value)
9225 {
9226     Context *context = GetValidGlobalContext();
9227     EVENT(context, GLProgramUniformMatrix4x2fvEXT,
9228           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
9229           "0x%016" PRIxPTR "",
9230           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
9231 
9232     if (context)
9233     {
9234         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
9235         UniformLocation locationPacked = PackParam<UniformLocation>(location);
9236         SCOPED_SHARE_CONTEXT_LOCK(context);
9237         bool isCallValid =
9238             (context->skipValidation() ||
9239              (ValidatePixelLocalStorageInactive(
9240                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
9241                   angle::EntryPoint::GLProgramUniformMatrix4x2fvEXT) &&
9242               ValidateProgramUniformMatrix4x2fvEXT(
9243                   context, angle::EntryPoint::GLProgramUniformMatrix4x2fvEXT, programPacked,
9244                   locationPacked, count, transpose, value)));
9245         if (isCallValid)
9246         {
9247             context->programUniformMatrix4x2fv(programPacked, locationPacked, count, transpose,
9248                                                value);
9249         }
9250         ANGLE_CAPTURE_GL(ProgramUniformMatrix4x2fvEXT, isCallValid, context, programPacked,
9251                          locationPacked, count, transpose, value);
9252     }
9253     else
9254     {
9255         GenerateContextLostErrorOnCurrentGlobalContext();
9256     }
9257     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9258 }
9259 
GL_ProgramUniformMatrix4x3fvEXT(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)9260 void GL_APIENTRY GL_ProgramUniformMatrix4x3fvEXT(GLuint program,
9261                                                  GLint location,
9262                                                  GLsizei count,
9263                                                  GLboolean transpose,
9264                                                  const GLfloat *value)
9265 {
9266     Context *context = GetValidGlobalContext();
9267     EVENT(context, GLProgramUniformMatrix4x3fvEXT,
9268           "context = %d, program = %u, location = %d, count = %d, transpose = %s, value = "
9269           "0x%016" PRIxPTR "",
9270           CID(context), program, location, count, GLbooleanToString(transpose), (uintptr_t)value);
9271 
9272     if (context)
9273     {
9274         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
9275         UniformLocation locationPacked = PackParam<UniformLocation>(location);
9276         SCOPED_SHARE_CONTEXT_LOCK(context);
9277         bool isCallValid =
9278             (context->skipValidation() ||
9279              (ValidatePixelLocalStorageInactive(
9280                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
9281                   angle::EntryPoint::GLProgramUniformMatrix4x3fvEXT) &&
9282               ValidateProgramUniformMatrix4x3fvEXT(
9283                   context, angle::EntryPoint::GLProgramUniformMatrix4x3fvEXT, programPacked,
9284                   locationPacked, count, transpose, value)));
9285         if (isCallValid)
9286         {
9287             context->programUniformMatrix4x3fv(programPacked, locationPacked, count, transpose,
9288                                                value);
9289         }
9290         ANGLE_CAPTURE_GL(ProgramUniformMatrix4x3fvEXT, isCallValid, context, programPacked,
9291                          locationPacked, count, transpose, value);
9292     }
9293     else
9294     {
9295         GenerateContextLostErrorOnCurrentGlobalContext();
9296     }
9297     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9298 }
9299 
GL_UseProgramStagesEXT(GLuint pipeline,GLbitfield stages,GLuint program)9300 void GL_APIENTRY GL_UseProgramStagesEXT(GLuint pipeline, GLbitfield stages, GLuint program)
9301 {
9302     Context *context = GetValidGlobalContext();
9303     EVENT(context, GLUseProgramStagesEXT, "context = %d, pipeline = %u, stages = %s, program = %u",
9304           CID(context), pipeline, GLbitfieldToString(GLESEnum::UseProgramStageMask, stages).c_str(),
9305           program);
9306 
9307     if (context)
9308     {
9309         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
9310         ShaderProgramID programPacked    = PackParam<ShaderProgramID>(program);
9311         SCOPED_SHARE_CONTEXT_LOCK(context);
9312         bool isCallValid =
9313             (context->skipValidation() ||
9314              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
9315                                                 context->getMutableErrorSetForValidation(),
9316                                                 angle::EntryPoint::GLUseProgramStagesEXT) &&
9317               ValidateUseProgramStagesEXT(context, angle::EntryPoint::GLUseProgramStagesEXT,
9318                                           pipelinePacked, stages, programPacked)));
9319         if (isCallValid)
9320         {
9321             context->useProgramStages(pipelinePacked, stages, programPacked);
9322         }
9323         ANGLE_CAPTURE_GL(UseProgramStagesEXT, isCallValid, context, pipelinePacked, stages,
9324                          programPacked);
9325     }
9326     else
9327     {
9328         GenerateContextLostErrorOnCurrentGlobalContext();
9329     }
9330     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9331 }
9332 
GL_ValidateProgramPipelineEXT(GLuint pipeline)9333 void GL_APIENTRY GL_ValidateProgramPipelineEXT(GLuint pipeline)
9334 {
9335     Context *context = GetValidGlobalContext();
9336     EVENT(context, GLValidateProgramPipelineEXT, "context = %d, pipeline = %u", CID(context),
9337           pipeline);
9338 
9339     if (context)
9340     {
9341         ProgramPipelineID pipelinePacked = PackParam<ProgramPipelineID>(pipeline);
9342         SCOPED_SHARE_CONTEXT_LOCK(context);
9343         bool isCallValid =
9344             (context->skipValidation() ||
9345              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
9346                                                 context->getMutableErrorSetForValidation(),
9347                                                 angle::EntryPoint::GLValidateProgramPipelineEXT) &&
9348               ValidateValidateProgramPipelineEXT(
9349                   context, angle::EntryPoint::GLValidateProgramPipelineEXT, pipelinePacked)));
9350         if (isCallValid)
9351         {
9352             context->validateProgramPipeline(pipelinePacked);
9353         }
9354         ANGLE_CAPTURE_GL(ValidateProgramPipelineEXT, isCallValid, context, pipelinePacked);
9355     }
9356     else
9357     {
9358         GenerateContextLostErrorOnCurrentGlobalContext();
9359     }
9360     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9361 }
9362 
9363 // GL_EXT_shader_framebuffer_fetch
9364 
9365 // GL_EXT_shader_framebuffer_fetch_non_coherent
GL_FramebufferFetchBarrierEXT()9366 void GL_APIENTRY GL_FramebufferFetchBarrierEXT()
9367 {
9368     Context *context = GetValidGlobalContext();
9369     EVENT(context, GLFramebufferFetchBarrierEXT, "context = %d", CID(context));
9370 
9371     if (context)
9372     {
9373         SCOPED_SHARE_CONTEXT_LOCK(context);
9374         bool isCallValid =
9375             (context->skipValidation() ||
9376              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
9377                                                 context->getMutableErrorSetForValidation(),
9378                                                 angle::EntryPoint::GLFramebufferFetchBarrierEXT) &&
9379               ValidateFramebufferFetchBarrierEXT(context,
9380                                                  angle::EntryPoint::GLFramebufferFetchBarrierEXT)));
9381         if (isCallValid)
9382         {
9383             context->framebufferFetchBarrier();
9384         }
9385         ANGLE_CAPTURE_GL(FramebufferFetchBarrierEXT, isCallValid, context);
9386     }
9387     else
9388     {
9389         GenerateContextLostErrorOnCurrentGlobalContext();
9390     }
9391     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9392 }
9393 
9394 // GL_EXT_shader_io_blocks
9395 
9396 // GL_EXT_shader_non_constant_global_initializers
9397 
9398 // GL_EXT_shader_texture_lod
9399 
9400 // GL_EXT_shadow_samplers
9401 
9402 // GL_EXT_tessellation_shader
GL_PatchParameteriEXT(GLenum pname,GLint value)9403 void GL_APIENTRY GL_PatchParameteriEXT(GLenum pname, GLint value)
9404 {
9405     Context *context = GetValidGlobalContext();
9406     EVENT(context, GLPatchParameteriEXT, "context = %d, pname = %s, value = %d", CID(context),
9407           GLenumToString(GLESEnum::PatchParameterName, pname), value);
9408 
9409     if (context)
9410     {
9411         bool isCallValid =
9412             (context->skipValidation() ||
9413              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
9414                                                 context->getMutableErrorSetForValidation(),
9415                                                 angle::EntryPoint::GLPatchParameteriEXT) &&
9416               ValidatePatchParameteriEXT(context->getPrivateState(),
9417                                          context->getMutableErrorSetForValidation(),
9418                                          angle::EntryPoint::GLPatchParameteriEXT, pname, value)));
9419         if (isCallValid)
9420         {
9421             ContextPrivatePatchParameteri(context->getMutablePrivateState(),
9422                                           context->getMutablePrivateStateCache(), pname, value);
9423         }
9424         ANGLE_CAPTURE_GL(PatchParameteriEXT, isCallValid, context, pname, value);
9425     }
9426     else
9427     {
9428         GenerateContextLostErrorOnCurrentGlobalContext();
9429     }
9430     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9431 }
9432 
9433 // GL_EXT_texture_border_clamp
GL_GetSamplerParameterIivEXT(GLuint sampler,GLenum pname,GLint * params)9434 void GL_APIENTRY GL_GetSamplerParameterIivEXT(GLuint sampler, GLenum pname, GLint *params)
9435 {
9436     Context *context = GetValidGlobalContext();
9437     EVENT(context, GLGetSamplerParameterIivEXT,
9438           "context = %d, sampler = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
9439           sampler, GLenumToString(GLESEnum::SamplerParameterI, pname), (uintptr_t)params);
9440 
9441     if (context)
9442     {
9443         SamplerID samplerPacked = PackParam<SamplerID>(sampler);
9444         SCOPED_SHARE_CONTEXT_LOCK(context);
9445         bool isCallValid = (context->skipValidation() ||
9446                             ValidateGetSamplerParameterIivEXT(
9447                                 context, angle::EntryPoint::GLGetSamplerParameterIivEXT,
9448                                 samplerPacked, pname, params));
9449         if (isCallValid)
9450         {
9451             context->getSamplerParameterIiv(samplerPacked, pname, params);
9452         }
9453         ANGLE_CAPTURE_GL(GetSamplerParameterIivEXT, isCallValid, context, samplerPacked, pname,
9454                          params);
9455     }
9456     else
9457     {
9458         GenerateContextLostErrorOnCurrentGlobalContext();
9459     }
9460     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9461 }
9462 
GL_GetSamplerParameterIuivEXT(GLuint sampler,GLenum pname,GLuint * params)9463 void GL_APIENTRY GL_GetSamplerParameterIuivEXT(GLuint sampler, GLenum pname, GLuint *params)
9464 {
9465     Context *context = GetValidGlobalContext();
9466     EVENT(context, GLGetSamplerParameterIuivEXT,
9467           "context = %d, sampler = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
9468           sampler, GLenumToString(GLESEnum::SamplerParameterI, pname), (uintptr_t)params);
9469 
9470     if (context)
9471     {
9472         SamplerID samplerPacked = PackParam<SamplerID>(sampler);
9473         SCOPED_SHARE_CONTEXT_LOCK(context);
9474         bool isCallValid = (context->skipValidation() ||
9475                             ValidateGetSamplerParameterIuivEXT(
9476                                 context, angle::EntryPoint::GLGetSamplerParameterIuivEXT,
9477                                 samplerPacked, pname, params));
9478         if (isCallValid)
9479         {
9480             context->getSamplerParameterIuiv(samplerPacked, pname, params);
9481         }
9482         ANGLE_CAPTURE_GL(GetSamplerParameterIuivEXT, isCallValid, context, samplerPacked, pname,
9483                          params);
9484     }
9485     else
9486     {
9487         GenerateContextLostErrorOnCurrentGlobalContext();
9488     }
9489     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9490 }
9491 
GL_GetTexParameterIivEXT(GLenum target,GLenum pname,GLint * params)9492 void GL_APIENTRY GL_GetTexParameterIivEXT(GLenum target, GLenum pname, GLint *params)
9493 {
9494     Context *context = GetValidGlobalContext();
9495     EVENT(context, GLGetTexParameterIivEXT,
9496           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
9497           GLenumToString(GLESEnum::TextureTarget, target),
9498           GLenumToString(GLESEnum::GetTextureParameter, pname), (uintptr_t)params);
9499 
9500     if (context)
9501     {
9502         TextureType targetPacked = PackParam<TextureType>(target);
9503         SCOPED_SHARE_CONTEXT_LOCK(context);
9504         bool isCallValid =
9505             (context->skipValidation() ||
9506              ValidateGetTexParameterIivEXT(context, angle::EntryPoint::GLGetTexParameterIivEXT,
9507                                            targetPacked, pname, params));
9508         if (isCallValid)
9509         {
9510             context->getTexParameterIiv(targetPacked, pname, params);
9511         }
9512         ANGLE_CAPTURE_GL(GetTexParameterIivEXT, isCallValid, context, targetPacked, pname, params);
9513     }
9514     else
9515     {
9516         GenerateContextLostErrorOnCurrentGlobalContext();
9517     }
9518     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9519 }
9520 
GL_GetTexParameterIuivEXT(GLenum target,GLenum pname,GLuint * params)9521 void GL_APIENTRY GL_GetTexParameterIuivEXT(GLenum target, GLenum pname, GLuint *params)
9522 {
9523     Context *context = GetValidGlobalContext();
9524     EVENT(context, GLGetTexParameterIuivEXT,
9525           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
9526           GLenumToString(GLESEnum::TextureTarget, target),
9527           GLenumToString(GLESEnum::GetTextureParameter, pname), (uintptr_t)params);
9528 
9529     if (context)
9530     {
9531         TextureType targetPacked = PackParam<TextureType>(target);
9532         SCOPED_SHARE_CONTEXT_LOCK(context);
9533         bool isCallValid =
9534             (context->skipValidation() ||
9535              ValidateGetTexParameterIuivEXT(context, angle::EntryPoint::GLGetTexParameterIuivEXT,
9536                                             targetPacked, pname, params));
9537         if (isCallValid)
9538         {
9539             context->getTexParameterIuiv(targetPacked, pname, params);
9540         }
9541         ANGLE_CAPTURE_GL(GetTexParameterIuivEXT, isCallValid, context, targetPacked, pname, params);
9542     }
9543     else
9544     {
9545         GenerateContextLostErrorOnCurrentGlobalContext();
9546     }
9547     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9548 }
9549 
GL_SamplerParameterIivEXT(GLuint sampler,GLenum pname,const GLint * param)9550 void GL_APIENTRY GL_SamplerParameterIivEXT(GLuint sampler, GLenum pname, const GLint *param)
9551 {
9552     Context *context = GetValidGlobalContext();
9553     EVENT(context, GLSamplerParameterIivEXT,
9554           "context = %d, sampler = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
9555           sampler, GLenumToString(GLESEnum::SamplerParameterI, pname), (uintptr_t)param);
9556 
9557     if (context)
9558     {
9559         SamplerID samplerPacked = PackParam<SamplerID>(sampler);
9560         SCOPED_SHARE_CONTEXT_LOCK(context);
9561         bool isCallValid =
9562             (context->skipValidation() ||
9563              ValidateSamplerParameterIivEXT(context, angle::EntryPoint::GLSamplerParameterIivEXT,
9564                                             samplerPacked, pname, param));
9565         if (isCallValid)
9566         {
9567             context->samplerParameterIiv(samplerPacked, pname, param);
9568         }
9569         ANGLE_CAPTURE_GL(SamplerParameterIivEXT, isCallValid, context, samplerPacked, pname, param);
9570     }
9571     else
9572     {
9573         GenerateContextLostErrorOnCurrentGlobalContext();
9574     }
9575     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9576 }
9577 
GL_SamplerParameterIuivEXT(GLuint sampler,GLenum pname,const GLuint * param)9578 void GL_APIENTRY GL_SamplerParameterIuivEXT(GLuint sampler, GLenum pname, const GLuint *param)
9579 {
9580     Context *context = GetValidGlobalContext();
9581     EVENT(context, GLSamplerParameterIuivEXT,
9582           "context = %d, sampler = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
9583           sampler, GLenumToString(GLESEnum::SamplerParameterI, pname), (uintptr_t)param);
9584 
9585     if (context)
9586     {
9587         SamplerID samplerPacked = PackParam<SamplerID>(sampler);
9588         SCOPED_SHARE_CONTEXT_LOCK(context);
9589         bool isCallValid =
9590             (context->skipValidation() ||
9591              ValidateSamplerParameterIuivEXT(context, angle::EntryPoint::GLSamplerParameterIuivEXT,
9592                                              samplerPacked, pname, param));
9593         if (isCallValid)
9594         {
9595             context->samplerParameterIuiv(samplerPacked, pname, param);
9596         }
9597         ANGLE_CAPTURE_GL(SamplerParameterIuivEXT, isCallValid, context, samplerPacked, pname,
9598                          param);
9599     }
9600     else
9601     {
9602         GenerateContextLostErrorOnCurrentGlobalContext();
9603     }
9604     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9605 }
9606 
GL_TexParameterIivEXT(GLenum target,GLenum pname,const GLint * params)9607 void GL_APIENTRY GL_TexParameterIivEXT(GLenum target, GLenum pname, const GLint *params)
9608 {
9609     Context *context = GetValidGlobalContext();
9610     EVENT(context, GLTexParameterIivEXT,
9611           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
9612           GLenumToString(GLESEnum::TextureTarget, target),
9613           GLenumToString(GLESEnum::TextureParameterName, pname), (uintptr_t)params);
9614 
9615     if (context)
9616     {
9617         TextureType targetPacked = PackParam<TextureType>(target);
9618         SCOPED_SHARE_CONTEXT_LOCK(context);
9619         bool isCallValid =
9620             (context->skipValidation() ||
9621              ValidateTexParameterIivEXT(context, angle::EntryPoint::GLTexParameterIivEXT,
9622                                         targetPacked, pname, params));
9623         if (isCallValid)
9624         {
9625             context->texParameterIiv(targetPacked, pname, params);
9626         }
9627         ANGLE_CAPTURE_GL(TexParameterIivEXT, isCallValid, context, targetPacked, pname, params);
9628     }
9629     else
9630     {
9631         GenerateContextLostErrorOnCurrentGlobalContext();
9632     }
9633     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9634 }
9635 
GL_TexParameterIuivEXT(GLenum target,GLenum pname,const GLuint * params)9636 void GL_APIENTRY GL_TexParameterIuivEXT(GLenum target, GLenum pname, const GLuint *params)
9637 {
9638     Context *context = GetValidGlobalContext();
9639     EVENT(context, GLTexParameterIuivEXT,
9640           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
9641           GLenumToString(GLESEnum::TextureTarget, target),
9642           GLenumToString(GLESEnum::TextureParameterName, pname), (uintptr_t)params);
9643 
9644     if (context)
9645     {
9646         TextureType targetPacked = PackParam<TextureType>(target);
9647         SCOPED_SHARE_CONTEXT_LOCK(context);
9648         bool isCallValid =
9649             (context->skipValidation() ||
9650              ValidateTexParameterIuivEXT(context, angle::EntryPoint::GLTexParameterIuivEXT,
9651                                          targetPacked, pname, params));
9652         if (isCallValid)
9653         {
9654             context->texParameterIuiv(targetPacked, pname, params);
9655         }
9656         ANGLE_CAPTURE_GL(TexParameterIuivEXT, isCallValid, context, targetPacked, pname, params);
9657     }
9658     else
9659     {
9660         GenerateContextLostErrorOnCurrentGlobalContext();
9661     }
9662     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9663 }
9664 
9665 // GL_EXT_texture_buffer
GL_TexBufferEXT(GLenum target,GLenum internalformat,GLuint buffer)9666 void GL_APIENTRY GL_TexBufferEXT(GLenum target, GLenum internalformat, GLuint buffer)
9667 {
9668     Context *context = GetValidGlobalContext();
9669     EVENT(context, GLTexBufferEXT, "context = %d, target = %s, internalformat = %s, buffer = %u",
9670           CID(context), GLenumToString(GLESEnum::TextureTarget, target),
9671           GLenumToString(GLESEnum::SizedInternalFormat, internalformat), buffer);
9672 
9673     if (context)
9674     {
9675         TextureType targetPacked = PackParam<TextureType>(target);
9676         BufferID bufferPacked    = PackParam<BufferID>(buffer);
9677         SCOPED_SHARE_CONTEXT_LOCK(context);
9678         bool isCallValid =
9679             (context->skipValidation() ||
9680              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
9681                                                 context->getMutableErrorSetForValidation(),
9682                                                 angle::EntryPoint::GLTexBufferEXT) &&
9683               ValidateTexBufferEXT(context, angle::EntryPoint::GLTexBufferEXT, targetPacked,
9684                                    internalformat, bufferPacked)));
9685         if (isCallValid)
9686         {
9687             context->texBuffer(targetPacked, internalformat, bufferPacked);
9688         }
9689         ANGLE_CAPTURE_GL(TexBufferEXT, isCallValid, context, targetPacked, internalformat,
9690                          bufferPacked);
9691     }
9692     else
9693     {
9694         GenerateContextLostErrorOnCurrentGlobalContext();
9695     }
9696     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9697 }
9698 
GL_TexBufferRangeEXT(GLenum target,GLenum internalformat,GLuint buffer,GLintptr offset,GLsizeiptr size)9699 void GL_APIENTRY GL_TexBufferRangeEXT(GLenum target,
9700                                       GLenum internalformat,
9701                                       GLuint buffer,
9702                                       GLintptr offset,
9703                                       GLsizeiptr size)
9704 {
9705     Context *context = GetValidGlobalContext();
9706     EVENT(context, GLTexBufferRangeEXT,
9707           "context = %d, target = %s, internalformat = %s, buffer = %u, offset = %llu, size = %llu",
9708           CID(context), GLenumToString(GLESEnum::TextureTarget, target),
9709           GLenumToString(GLESEnum::SizedInternalFormat, internalformat), buffer,
9710           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size));
9711 
9712     if (context)
9713     {
9714         TextureType targetPacked = PackParam<TextureType>(target);
9715         BufferID bufferPacked    = PackParam<BufferID>(buffer);
9716         SCOPED_SHARE_CONTEXT_LOCK(context);
9717         bool isCallValid =
9718             (context->skipValidation() ||
9719              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
9720                                                 context->getMutableErrorSetForValidation(),
9721                                                 angle::EntryPoint::GLTexBufferRangeEXT) &&
9722               ValidateTexBufferRangeEXT(context, angle::EntryPoint::GLTexBufferRangeEXT,
9723                                         targetPacked, internalformat, bufferPacked, offset, size)));
9724         if (isCallValid)
9725         {
9726             context->texBufferRange(targetPacked, internalformat, bufferPacked, offset, size);
9727         }
9728         ANGLE_CAPTURE_GL(TexBufferRangeEXT, isCallValid, context, targetPacked, internalformat,
9729                          bufferPacked, offset, size);
9730     }
9731     else
9732     {
9733         GenerateContextLostErrorOnCurrentGlobalContext();
9734     }
9735     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9736 }
9737 
9738 // GL_EXT_texture_compression_astc_decode_mode
9739 
9740 // GL_EXT_texture_compression_bptc
9741 
9742 // GL_EXT_texture_compression_dxt1
9743 
9744 // GL_EXT_texture_compression_rgtc
9745 
9746 // GL_EXT_texture_compression_s3tc
9747 
9748 // GL_EXT_texture_compression_s3tc_srgb
9749 
9750 // GL_EXT_texture_cube_map_array
9751 
9752 // GL_EXT_texture_filter_anisotropic
9753 
9754 // GL_EXT_texture_filter_minmax
9755 
9756 // GL_EXT_texture_format_BGRA8888
9757 
9758 // GL_EXT_texture_format_sRGB_override
9759 
9760 // GL_EXT_texture_mirror_clamp_to_edge
9761 
9762 // GL_EXT_texture_norm16
9763 
9764 // GL_EXT_texture_rg
9765 
9766 // GL_EXT_texture_sRGB_R8
9767 
9768 // GL_EXT_texture_sRGB_RG8
9769 
9770 // GL_EXT_texture_sRGB_decode
9771 
9772 // GL_EXT_texture_storage
GL_TexStorage1DEXT(GLenum target,GLsizei levels,GLenum internalformat,GLsizei width)9773 void GL_APIENTRY GL_TexStorage1DEXT(GLenum target,
9774                                     GLsizei levels,
9775                                     GLenum internalformat,
9776                                     GLsizei width)
9777 {
9778     Context *context = GetValidGlobalContext();
9779     EVENT(context, GLTexStorage1DEXT,
9780           "context = %d, target = %s, levels = %d, internalformat = %s, width = %d", CID(context),
9781           GLenumToString(GLESEnum::TextureTarget, target), levels,
9782           GLenumToString(GLESEnum::SizedInternalFormat, internalformat), width);
9783 
9784     if (context)
9785     {
9786         SCOPED_SHARE_CONTEXT_LOCK(context);
9787         bool isCallValid =
9788             (context->skipValidation() ||
9789              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
9790                                                 context->getMutableErrorSetForValidation(),
9791                                                 angle::EntryPoint::GLTexStorage1DEXT) &&
9792               ValidateTexStorage1DEXT(context, angle::EntryPoint::GLTexStorage1DEXT, target, levels,
9793                                       internalformat, width)));
9794         if (isCallValid)
9795         {
9796             context->texStorage1D(target, levels, internalformat, width);
9797         }
9798         ANGLE_CAPTURE_GL(TexStorage1DEXT, isCallValid, context, target, levels, internalformat,
9799                          width);
9800     }
9801     else
9802     {
9803         GenerateContextLostErrorOnCurrentGlobalContext();
9804     }
9805     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9806 }
9807 
GL_TexStorage2DEXT(GLenum target,GLsizei levels,GLenum internalformat,GLsizei width,GLsizei height)9808 void GL_APIENTRY GL_TexStorage2DEXT(GLenum target,
9809                                     GLsizei levels,
9810                                     GLenum internalformat,
9811                                     GLsizei width,
9812                                     GLsizei height)
9813 {
9814     Context *context = GetValidGlobalContext();
9815     EVENT(context, GLTexStorage2DEXT,
9816           "context = %d, target = %s, levels = %d, internalformat = %s, width = %d, height = %d",
9817           CID(context), GLenumToString(GLESEnum::TextureTarget, target), levels,
9818           GLenumToString(GLESEnum::SizedInternalFormat, internalformat), width, height);
9819 
9820     if (context)
9821     {
9822         TextureType targetPacked = PackParam<TextureType>(target);
9823         SCOPED_SHARE_CONTEXT_LOCK(context);
9824         bool isCallValid =
9825             (context->skipValidation() ||
9826              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
9827                                                 context->getMutableErrorSetForValidation(),
9828                                                 angle::EntryPoint::GLTexStorage2DEXT) &&
9829               ValidateTexStorage2DEXT(context, angle::EntryPoint::GLTexStorage2DEXT, targetPacked,
9830                                       levels, internalformat, width, height)));
9831         if (isCallValid)
9832         {
9833             context->texStorage2D(targetPacked, levels, internalformat, width, height);
9834         }
9835         ANGLE_CAPTURE_GL(TexStorage2DEXT, isCallValid, context, targetPacked, levels,
9836                          internalformat, width, height);
9837     }
9838     else
9839     {
9840         GenerateContextLostErrorOnCurrentGlobalContext();
9841     }
9842     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9843 }
9844 
GL_TexStorage3DEXT(GLenum target,GLsizei levels,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth)9845 void GL_APIENTRY GL_TexStorage3DEXT(GLenum target,
9846                                     GLsizei levels,
9847                                     GLenum internalformat,
9848                                     GLsizei width,
9849                                     GLsizei height,
9850                                     GLsizei depth)
9851 {
9852     Context *context = GetValidGlobalContext();
9853     EVENT(context, GLTexStorage3DEXT,
9854           "context = %d, target = %s, levels = %d, internalformat = %s, width = %d, height = %d, "
9855           "depth = %d",
9856           CID(context), GLenumToString(GLESEnum::TextureTarget, target), levels,
9857           GLenumToString(GLESEnum::SizedInternalFormat, internalformat), width, height, depth);
9858 
9859     if (context)
9860     {
9861         TextureType targetPacked = PackParam<TextureType>(target);
9862         SCOPED_SHARE_CONTEXT_LOCK(context);
9863         bool isCallValid =
9864             (context->skipValidation() ||
9865              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
9866                                                 context->getMutableErrorSetForValidation(),
9867                                                 angle::EntryPoint::GLTexStorage3DEXT) &&
9868               ValidateTexStorage3DEXT(context, angle::EntryPoint::GLTexStorage3DEXT, targetPacked,
9869                                       levels, internalformat, width, height, depth)));
9870         if (isCallValid)
9871         {
9872             context->texStorage3D(targetPacked, levels, internalformat, width, height, depth);
9873         }
9874         ANGLE_CAPTURE_GL(TexStorage3DEXT, isCallValid, context, targetPacked, levels,
9875                          internalformat, width, height, depth);
9876     }
9877     else
9878     {
9879         GenerateContextLostErrorOnCurrentGlobalContext();
9880     }
9881     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9882 }
9883 
9884 // GL_EXT_texture_type_2_10_10_10_REV
9885 
9886 // GL_EXT_unpack_subimage
9887 
9888 // GL_IMG_texture_compression_pvrtc
9889 
9890 // GL_IMG_texture_compression_pvrtc2
9891 
9892 // GL_KHR_blend_equation_advanced
GL_BlendBarrierKHR()9893 void GL_APIENTRY GL_BlendBarrierKHR()
9894 {
9895     Context *context = GetValidGlobalContext();
9896     EVENT(context, GLBlendBarrierKHR, "context = %d", CID(context));
9897 
9898     if (context)
9899     {
9900         SCOPED_SHARE_CONTEXT_LOCK(context);
9901         bool isCallValid =
9902             (context->skipValidation() ||
9903              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
9904                                                 context->getMutableErrorSetForValidation(),
9905                                                 angle::EntryPoint::GLBlendBarrierKHR) &&
9906               ValidateBlendBarrierKHR(context, angle::EntryPoint::GLBlendBarrierKHR)));
9907         if (isCallValid)
9908         {
9909             context->blendBarrier();
9910         }
9911         ANGLE_CAPTURE_GL(BlendBarrierKHR, isCallValid, context);
9912     }
9913     else
9914     {
9915         GenerateContextLostErrorOnCurrentGlobalContext();
9916     }
9917     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9918 }
9919 
9920 // GL_KHR_debug
GL_DebugMessageCallbackKHR(GLDEBUGPROCKHR callback,const void * userParam)9921 void GL_APIENTRY GL_DebugMessageCallbackKHR(GLDEBUGPROCKHR callback, const void *userParam)
9922 {
9923     Context *context = GetValidGlobalContext();
9924     EVENT(context, GLDebugMessageCallbackKHR,
9925           "context = %d, callback = 0x%016" PRIxPTR ", userParam = 0x%016" PRIxPTR "", CID(context),
9926           (uintptr_t)callback, (uintptr_t)userParam);
9927 
9928     if (context)
9929     {
9930         SCOPED_SHARE_CONTEXT_LOCK(context);
9931         bool isCallValid =
9932             (context->skipValidation() ||
9933              ValidateDebugMessageCallbackKHR(context, angle::EntryPoint::GLDebugMessageCallbackKHR,
9934                                              callback, userParam));
9935         if (isCallValid)
9936         {
9937             context->debugMessageCallback(callback, userParam);
9938         }
9939         ANGLE_CAPTURE_GL(DebugMessageCallbackKHR, isCallValid, context, callback, userParam);
9940     }
9941     else
9942     {
9943         GenerateContextLostErrorOnCurrentGlobalContext();
9944     }
9945     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9946 }
9947 
GL_DebugMessageControlKHR(GLenum source,GLenum type,GLenum severity,GLsizei count,const GLuint * ids,GLboolean enabled)9948 void GL_APIENTRY GL_DebugMessageControlKHR(GLenum source,
9949                                            GLenum type,
9950                                            GLenum severity,
9951                                            GLsizei count,
9952                                            const GLuint *ids,
9953                                            GLboolean enabled)
9954 {
9955     Context *context = GetValidGlobalContext();
9956     EVENT(context, GLDebugMessageControlKHR,
9957           "context = %d, source = %s, type = %s, severity = %s, count = %d, ids = 0x%016" PRIxPTR
9958           ", enabled = %s",
9959           CID(context), GLenumToString(GLESEnum::DebugSource, source),
9960           GLenumToString(GLESEnum::DebugType, type),
9961           GLenumToString(GLESEnum::DebugSeverity, severity), count, (uintptr_t)ids,
9962           GLbooleanToString(enabled));
9963 
9964     if (context)
9965     {
9966         SCOPED_SHARE_CONTEXT_LOCK(context);
9967         bool isCallValid =
9968             (context->skipValidation() ||
9969              ValidateDebugMessageControlKHR(context, angle::EntryPoint::GLDebugMessageControlKHR,
9970                                             source, type, severity, count, ids, enabled));
9971         if (isCallValid)
9972         {
9973             context->debugMessageControl(source, type, severity, count, ids, enabled);
9974         }
9975         ANGLE_CAPTURE_GL(DebugMessageControlKHR, isCallValid, context, source, type, severity,
9976                          count, ids, enabled);
9977     }
9978     else
9979     {
9980         GenerateContextLostErrorOnCurrentGlobalContext();
9981     }
9982     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
9983 }
9984 
GL_DebugMessageInsertKHR(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar * buf)9985 void GL_APIENTRY GL_DebugMessageInsertKHR(GLenum source,
9986                                           GLenum type,
9987                                           GLuint id,
9988                                           GLenum severity,
9989                                           GLsizei length,
9990                                           const GLchar *buf)
9991 {
9992     Context *context = GetValidGlobalContext();
9993     EVENT(context, GLDebugMessageInsertKHR,
9994           "context = %d, source = %s, type = %s, id = %u, severity = %s, length = %d, buf = "
9995           "0x%016" PRIxPTR "",
9996           CID(context), GLenumToString(GLESEnum::DebugSource, source),
9997           GLenumToString(GLESEnum::DebugType, type), id,
9998           GLenumToString(GLESEnum::DebugSeverity, severity), length, (uintptr_t)buf);
9999 
10000     if (context)
10001     {
10002         SCOPED_SHARE_CONTEXT_LOCK(context);
10003         bool isCallValid =
10004             (context->skipValidation() ||
10005              ValidateDebugMessageInsertKHR(context, angle::EntryPoint::GLDebugMessageInsertKHR,
10006                                            source, type, id, severity, length, buf));
10007         if (isCallValid)
10008         {
10009             context->debugMessageInsert(source, type, id, severity, length, buf);
10010         }
10011         ANGLE_CAPTURE_GL(DebugMessageInsertKHR, isCallValid, context, source, type, id, severity,
10012                          length, buf);
10013     }
10014     else
10015     {
10016         GenerateContextLostErrorOnCurrentGlobalContext();
10017     }
10018     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10019 }
10020 
GL_GetDebugMessageLogKHR(GLuint count,GLsizei bufSize,GLenum * sources,GLenum * types,GLuint * ids,GLenum * severities,GLsizei * lengths,GLchar * messageLog)10021 GLuint GL_APIENTRY GL_GetDebugMessageLogKHR(GLuint count,
10022                                             GLsizei bufSize,
10023                                             GLenum *sources,
10024                                             GLenum *types,
10025                                             GLuint *ids,
10026                                             GLenum *severities,
10027                                             GLsizei *lengths,
10028                                             GLchar *messageLog)
10029 {
10030     Context *context = GetValidGlobalContext();
10031     EVENT(context, GLGetDebugMessageLogKHR,
10032           "context = %d, count = %u, bufSize = %d, sources = 0x%016" PRIxPTR
10033           ", types = 0x%016" PRIxPTR ", ids = 0x%016" PRIxPTR ", severities = 0x%016" PRIxPTR
10034           ", lengths = 0x%016" PRIxPTR ", messageLog = 0x%016" PRIxPTR "",
10035           CID(context), count, bufSize, (uintptr_t)sources, (uintptr_t)types, (uintptr_t)ids,
10036           (uintptr_t)severities, (uintptr_t)lengths, (uintptr_t)messageLog);
10037 
10038     GLuint returnValue;
10039     if (context)
10040     {
10041         SCOPED_SHARE_CONTEXT_LOCK(context);
10042         bool isCallValid = (context->skipValidation() ||
10043                             ValidateGetDebugMessageLogKHR(
10044                                 context, angle::EntryPoint::GLGetDebugMessageLogKHR, count, bufSize,
10045                                 sources, types, ids, severities, lengths, messageLog));
10046         if (isCallValid)
10047         {
10048             returnValue = context->getDebugMessageLog(count, bufSize, sources, types, ids,
10049                                                       severities, lengths, messageLog);
10050         }
10051         else
10052         {
10053             returnValue =
10054                 GetDefaultReturnValue<angle::EntryPoint::GLGetDebugMessageLogKHR, GLuint>();
10055         }
10056         ANGLE_CAPTURE_GL(GetDebugMessageLogKHR, isCallValid, context, count, bufSize, sources,
10057                          types, ids, severities, lengths, messageLog, returnValue);
10058     }
10059     else
10060     {
10061         GenerateContextLostErrorOnCurrentGlobalContext();
10062         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetDebugMessageLogKHR, GLuint>();
10063     }
10064     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10065     return returnValue;
10066 }
10067 
GL_GetObjectLabelKHR(GLenum identifier,GLuint name,GLsizei bufSize,GLsizei * length,GLchar * label)10068 void GL_APIENTRY GL_GetObjectLabelKHR(GLenum identifier,
10069                                       GLuint name,
10070                                       GLsizei bufSize,
10071                                       GLsizei *length,
10072                                       GLchar *label)
10073 {
10074     Context *context = GetValidGlobalContext();
10075     EVENT(context, GLGetObjectLabelKHR,
10076           "context = %d, identifier = %s, name = %u, bufSize = %d, length = 0x%016" PRIxPTR
10077           ", label = 0x%016" PRIxPTR "",
10078           CID(context), GLenumToString(GLESEnum::AllEnums, identifier), name, bufSize,
10079           (uintptr_t)length, (uintptr_t)label);
10080 
10081     if (context)
10082     {
10083         SCOPED_SHARE_CONTEXT_LOCK(context);
10084         bool isCallValid =
10085             (context->skipValidation() ||
10086              ValidateGetObjectLabelKHR(context, angle::EntryPoint::GLGetObjectLabelKHR, identifier,
10087                                        name, bufSize, length, label));
10088         if (isCallValid)
10089         {
10090             context->getObjectLabel(identifier, name, bufSize, length, label);
10091         }
10092         ANGLE_CAPTURE_GL(GetObjectLabelKHR, isCallValid, context, identifier, name, bufSize, length,
10093                          label);
10094     }
10095     else
10096     {
10097         GenerateContextLostErrorOnCurrentGlobalContext();
10098     }
10099     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10100 }
10101 
GL_GetObjectPtrLabelKHR(const void * ptr,GLsizei bufSize,GLsizei * length,GLchar * label)10102 void GL_APIENTRY GL_GetObjectPtrLabelKHR(const void *ptr,
10103                                          GLsizei bufSize,
10104                                          GLsizei *length,
10105                                          GLchar *label)
10106 {
10107     Context *context = GetValidGlobalContext();
10108     EVENT(context, GLGetObjectPtrLabelKHR,
10109           "context = %d, ptr = 0x%016" PRIxPTR ", bufSize = %d, length = 0x%016" PRIxPTR
10110           ", label = 0x%016" PRIxPTR "",
10111           CID(context), (uintptr_t)ptr, bufSize, (uintptr_t)length, (uintptr_t)label);
10112 
10113     if (context)
10114     {
10115         SCOPED_SHARE_CONTEXT_LOCK(context);
10116         bool isCallValid =
10117             (context->skipValidation() ||
10118              ValidateGetObjectPtrLabelKHR(context, angle::EntryPoint::GLGetObjectPtrLabelKHR, ptr,
10119                                           bufSize, length, label));
10120         if (isCallValid)
10121         {
10122             context->getObjectPtrLabel(ptr, bufSize, length, label);
10123         }
10124         ANGLE_CAPTURE_GL(GetObjectPtrLabelKHR, isCallValid, context, ptr, bufSize, length, label);
10125     }
10126     else
10127     {
10128         GenerateContextLostErrorOnCurrentGlobalContext();
10129     }
10130     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10131 }
10132 
GL_GetPointervKHR(GLenum pname,void ** params)10133 void GL_APIENTRY GL_GetPointervKHR(GLenum pname, void **params)
10134 {
10135     Context *context = GetValidGlobalContext();
10136     EVENT(context, GLGetPointervKHR, "context = %d, pname = %s, params = 0x%016" PRIxPTR "",
10137           CID(context), GLenumToString(GLESEnum::AllEnums, pname), (uintptr_t)params);
10138 
10139     if (context)
10140     {
10141         SCOPED_SHARE_CONTEXT_LOCK(context);
10142         bool isCallValid =
10143             (context->skipValidation() ||
10144              ValidateGetPointervKHR(context, angle::EntryPoint::GLGetPointervKHR, pname, params));
10145         if (isCallValid)
10146         {
10147             context->getPointerv(pname, params);
10148         }
10149         ANGLE_CAPTURE_GL(GetPointervKHR, isCallValid, context, pname, params);
10150     }
10151     else
10152     {
10153         GenerateContextLostErrorOnCurrentGlobalContext();
10154     }
10155     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10156 }
10157 
GL_ObjectLabelKHR(GLenum identifier,GLuint name,GLsizei length,const GLchar * label)10158 void GL_APIENTRY GL_ObjectLabelKHR(GLenum identifier,
10159                                    GLuint name,
10160                                    GLsizei length,
10161                                    const GLchar *label)
10162 {
10163     Context *context = GetValidGlobalContext();
10164     EVENT(context, GLObjectLabelKHR,
10165           "context = %d, identifier = %s, name = %u, length = %d, label = 0x%016" PRIxPTR "",
10166           CID(context), GLenumToString(GLESEnum::ObjectIdentifier, identifier), name, length,
10167           (uintptr_t)label);
10168 
10169     if (context)
10170     {
10171         SCOPED_SHARE_CONTEXT_LOCK(context);
10172         bool isCallValid = (context->skipValidation() ||
10173                             ValidateObjectLabelKHR(context, angle::EntryPoint::GLObjectLabelKHR,
10174                                                    identifier, name, length, label));
10175         if (isCallValid)
10176         {
10177             context->objectLabel(identifier, name, length, label);
10178         }
10179         ANGLE_CAPTURE_GL(ObjectLabelKHR, isCallValid, context, identifier, name, length, label);
10180     }
10181     else
10182     {
10183         GenerateContextLostErrorOnCurrentGlobalContext();
10184     }
10185     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10186 }
10187 
GL_ObjectPtrLabelKHR(const void * ptr,GLsizei length,const GLchar * label)10188 void GL_APIENTRY GL_ObjectPtrLabelKHR(const void *ptr, GLsizei length, const GLchar *label)
10189 {
10190     Context *context = GetValidGlobalContext();
10191     EVENT(context, GLObjectPtrLabelKHR,
10192           "context = %d, ptr = 0x%016" PRIxPTR ", length = %d, label = 0x%016" PRIxPTR "",
10193           CID(context), (uintptr_t)ptr, length, (uintptr_t)label);
10194 
10195     if (context)
10196     {
10197         SCOPED_SHARE_CONTEXT_LOCK(context);
10198         bool isCallValid =
10199             (context->skipValidation() ||
10200              ValidateObjectPtrLabelKHR(context, angle::EntryPoint::GLObjectPtrLabelKHR, ptr, length,
10201                                        label));
10202         if (isCallValid)
10203         {
10204             context->objectPtrLabel(ptr, length, label);
10205         }
10206         ANGLE_CAPTURE_GL(ObjectPtrLabelKHR, isCallValid, context, ptr, length, label);
10207     }
10208     else
10209     {
10210         GenerateContextLostErrorOnCurrentGlobalContext();
10211     }
10212     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10213 }
10214 
GL_PopDebugGroupKHR()10215 void GL_APIENTRY GL_PopDebugGroupKHR()
10216 {
10217     Context *context = GetValidGlobalContext();
10218     EVENT(context, GLPopDebugGroupKHR, "context = %d", CID(context));
10219 
10220     if (context)
10221     {
10222         SCOPED_SHARE_CONTEXT_LOCK(context);
10223         bool isCallValid =
10224             (context->skipValidation() ||
10225              ValidatePopDebugGroupKHR(context, angle::EntryPoint::GLPopDebugGroupKHR));
10226         if (isCallValid)
10227         {
10228             context->popDebugGroup();
10229         }
10230         ANGLE_CAPTURE_GL(PopDebugGroupKHR, isCallValid, context);
10231     }
10232     else
10233     {
10234         GenerateContextLostErrorOnCurrentGlobalContext();
10235     }
10236     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10237 }
10238 
GL_PushDebugGroupKHR(GLenum source,GLuint id,GLsizei length,const GLchar * message)10239 void GL_APIENTRY GL_PushDebugGroupKHR(GLenum source,
10240                                       GLuint id,
10241                                       GLsizei length,
10242                                       const GLchar *message)
10243 {
10244     Context *context = GetValidGlobalContext();
10245     EVENT(context, GLPushDebugGroupKHR,
10246           "context = %d, source = %s, id = %u, length = %d, message = 0x%016" PRIxPTR "",
10247           CID(context), GLenumToString(GLESEnum::DebugSource, source), id, length,
10248           (uintptr_t)message);
10249 
10250     if (context)
10251     {
10252         SCOPED_SHARE_CONTEXT_LOCK(context);
10253         bool isCallValid =
10254             (context->skipValidation() ||
10255              ValidatePushDebugGroupKHR(context, angle::EntryPoint::GLPushDebugGroupKHR, source, id,
10256                                        length, message));
10257         if (isCallValid)
10258         {
10259             context->pushDebugGroup(source, id, length, message);
10260         }
10261         ANGLE_CAPTURE_GL(PushDebugGroupKHR, isCallValid, context, source, id, length, message);
10262     }
10263     else
10264     {
10265         GenerateContextLostErrorOnCurrentGlobalContext();
10266     }
10267     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10268 }
10269 
10270 // GL_KHR_no_error
10271 
10272 // GL_KHR_parallel_shader_compile
GL_MaxShaderCompilerThreadsKHR(GLuint count)10273 void GL_APIENTRY GL_MaxShaderCompilerThreadsKHR(GLuint count)
10274 {
10275     Context *context = GetValidGlobalContext();
10276     EVENT(context, GLMaxShaderCompilerThreadsKHR, "context = %d, count = %u", CID(context), count);
10277 
10278     if (context)
10279     {
10280         SCOPED_SHARE_CONTEXT_LOCK(context);
10281         bool isCallValid =
10282             (context->skipValidation() ||
10283              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
10284                                                 context->getMutableErrorSetForValidation(),
10285                                                 angle::EntryPoint::GLMaxShaderCompilerThreadsKHR) &&
10286               ValidateMaxShaderCompilerThreadsKHR(
10287                   context, angle::EntryPoint::GLMaxShaderCompilerThreadsKHR, count)));
10288         if (isCallValid)
10289         {
10290             context->maxShaderCompilerThreads(count);
10291         }
10292         ANGLE_CAPTURE_GL(MaxShaderCompilerThreadsKHR, isCallValid, context, count);
10293     }
10294     else
10295     {
10296         GenerateContextLostErrorOnCurrentGlobalContext();
10297     }
10298     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10299 }
10300 
10301 // GL_KHR_robust_buffer_access_behavior
10302 
10303 // GL_KHR_texture_compression_astc_hdr
10304 
10305 // GL_KHR_texture_compression_astc_ldr
10306 
10307 // GL_KHR_texture_compression_astc_sliced_3d
10308 
10309 // GL_MESA_framebuffer_flip_y
GL_FramebufferParameteriMESA(GLenum target,GLenum pname,GLint param)10310 void GL_APIENTRY GL_FramebufferParameteriMESA(GLenum target, GLenum pname, GLint param)
10311 {
10312     Context *context = GetValidGlobalContext();
10313     EVENT(context, GLFramebufferParameteriMESA, "context = %d, target = %s, pname = %s, param = %d",
10314           CID(context), GLenumToString(GLESEnum::FramebufferTarget, target),
10315           GLenumToString(GLESEnum::FramebufferParameterName, pname), param);
10316 
10317     if (context)
10318     {
10319         SCOPED_SHARE_CONTEXT_LOCK(context);
10320         bool isCallValid =
10321             (context->skipValidation() ||
10322              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
10323                                                 context->getMutableErrorSetForValidation(),
10324                                                 angle::EntryPoint::GLFramebufferParameteriMESA) &&
10325               ValidateFramebufferParameteriMESA(
10326                   context, angle::EntryPoint::GLFramebufferParameteriMESA, target, pname, param)));
10327         if (isCallValid)
10328         {
10329             context->framebufferParameteriMESA(target, pname, param);
10330         }
10331         ANGLE_CAPTURE_GL(FramebufferParameteriMESA, isCallValid, context, target, pname, param);
10332     }
10333     else
10334     {
10335         GenerateContextLostErrorOnCurrentGlobalContext();
10336     }
10337     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10338 }
10339 
GL_GetFramebufferParameterivMESA(GLenum target,GLenum pname,GLint * params)10340 void GL_APIENTRY GL_GetFramebufferParameterivMESA(GLenum target, GLenum pname, GLint *params)
10341 {
10342     Context *context = GetValidGlobalContext();
10343     EVENT(context, GLGetFramebufferParameterivMESA,
10344           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
10345           GLenumToString(GLESEnum::FramebufferTarget, target),
10346           GLenumToString(GLESEnum::FramebufferAttachmentParameterName, pname), (uintptr_t)params);
10347 
10348     if (context)
10349     {
10350         SCOPED_SHARE_CONTEXT_LOCK(context);
10351         bool isCallValid = (context->skipValidation() ||
10352                             ValidateGetFramebufferParameterivMESA(
10353                                 context, angle::EntryPoint::GLGetFramebufferParameterivMESA, target,
10354                                 pname, params));
10355         if (isCallValid)
10356         {
10357             context->getFramebufferParameterivMESA(target, pname, params);
10358         }
10359         ANGLE_CAPTURE_GL(GetFramebufferParameterivMESA, isCallValid, context, target, pname,
10360                          params);
10361     }
10362     else
10363     {
10364         GenerateContextLostErrorOnCurrentGlobalContext();
10365     }
10366     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10367 }
10368 
10369 // GL_NV_fence
GL_DeleteFencesNV(GLsizei n,const GLuint * fences)10370 void GL_APIENTRY GL_DeleteFencesNV(GLsizei n, const GLuint *fences)
10371 {
10372     Context *context = GetValidGlobalContext();
10373     EVENT(context, GLDeleteFencesNV, "context = %d, n = %d, fences = 0x%016" PRIxPTR "",
10374           CID(context), n, (uintptr_t)fences);
10375 
10376     if (context)
10377     {
10378         const FenceNVID *fencesPacked = PackParam<const FenceNVID *>(fences);
10379         SCOPED_SHARE_CONTEXT_LOCK(context);
10380         bool isCallValid =
10381             (context->skipValidation() ||
10382              ValidateDeleteFencesNV(context, angle::EntryPoint::GLDeleteFencesNV, n, fencesPacked));
10383         if (isCallValid)
10384         {
10385             context->deleteFencesNV(n, fencesPacked);
10386         }
10387         ANGLE_CAPTURE_GL(DeleteFencesNV, isCallValid, context, n, fencesPacked);
10388     }
10389     else
10390     {
10391         GenerateContextLostErrorOnCurrentGlobalContext();
10392     }
10393     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10394 }
10395 
GL_FinishFenceNV(GLuint fence)10396 void GL_APIENTRY GL_FinishFenceNV(GLuint fence)
10397 {
10398     Context *context = GetValidGlobalContext();
10399     EVENT(context, GLFinishFenceNV, "context = %d, fence = %u", CID(context), fence);
10400 
10401     if (context)
10402     {
10403         FenceNVID fencePacked = PackParam<FenceNVID>(fence);
10404         SCOPED_SHARE_CONTEXT_LOCK(context);
10405         bool isCallValid =
10406             (context->skipValidation() ||
10407              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
10408                                                 context->getMutableErrorSetForValidation(),
10409                                                 angle::EntryPoint::GLFinishFenceNV) &&
10410               ValidateFinishFenceNV(context, angle::EntryPoint::GLFinishFenceNV, fencePacked)));
10411         if (isCallValid)
10412         {
10413             context->finishFenceNV(fencePacked);
10414         }
10415         ANGLE_CAPTURE_GL(FinishFenceNV, isCallValid, context, fencePacked);
10416     }
10417     else
10418     {
10419         GenerateContextLostErrorOnCurrentGlobalContext();
10420     }
10421     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10422 }
10423 
GL_GenFencesNV(GLsizei n,GLuint * fences)10424 void GL_APIENTRY GL_GenFencesNV(GLsizei n, GLuint *fences)
10425 {
10426     Context *context = GetValidGlobalContext();
10427     EVENT(context, GLGenFencesNV, "context = %d, n = %d, fences = 0x%016" PRIxPTR "", CID(context),
10428           n, (uintptr_t)fences);
10429 
10430     if (context)
10431     {
10432         FenceNVID *fencesPacked = PackParam<FenceNVID *>(fences);
10433         SCOPED_SHARE_CONTEXT_LOCK(context);
10434         bool isCallValid =
10435             (context->skipValidation() ||
10436              ValidateGenFencesNV(context, angle::EntryPoint::GLGenFencesNV, n, fencesPacked));
10437         if (isCallValid)
10438         {
10439             context->genFencesNV(n, fencesPacked);
10440         }
10441         ANGLE_CAPTURE_GL(GenFencesNV, isCallValid, context, n, fencesPacked);
10442     }
10443     else
10444     {
10445         GenerateContextLostErrorOnCurrentGlobalContext();
10446     }
10447     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10448 }
10449 
GL_GetFenceivNV(GLuint fence,GLenum pname,GLint * params)10450 void GL_APIENTRY GL_GetFenceivNV(GLuint fence, GLenum pname, GLint *params)
10451 {
10452     Context *context = GetValidGlobalContext();
10453     EVENT(context, GLGetFenceivNV,
10454           "context = %d, fence = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), fence,
10455           GLenumToString(GLESEnum::AllEnums, pname), (uintptr_t)params);
10456 
10457     if (context)
10458     {
10459         FenceNVID fencePacked = PackParam<FenceNVID>(fence);
10460         SCOPED_SHARE_CONTEXT_LOCK(context);
10461         bool isCallValid = (context->skipValidation() ||
10462                             ValidateGetFenceivNV(context, angle::EntryPoint::GLGetFenceivNV,
10463                                                  fencePacked, pname, params));
10464         if (isCallValid)
10465         {
10466             context->getFenceivNV(fencePacked, pname, params);
10467         }
10468         ANGLE_CAPTURE_GL(GetFenceivNV, isCallValid, context, fencePacked, pname, params);
10469     }
10470     else
10471     {
10472         GenerateContextLostErrorOnCurrentGlobalContext();
10473     }
10474     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10475 }
10476 
GL_IsFenceNV(GLuint fence)10477 GLboolean GL_APIENTRY GL_IsFenceNV(GLuint fence)
10478 {
10479     Context *context = GetValidGlobalContext();
10480     EVENT(context, GLIsFenceNV, "context = %d, fence = %u", CID(context), fence);
10481 
10482     GLboolean returnValue;
10483     if (context)
10484     {
10485         FenceNVID fencePacked = PackParam<FenceNVID>(fence);
10486         SCOPED_SHARE_CONTEXT_LOCK(context);
10487         bool isCallValid =
10488             (context->skipValidation() ||
10489              ValidateIsFenceNV(context, angle::EntryPoint::GLIsFenceNV, fencePacked));
10490         if (isCallValid)
10491         {
10492             returnValue = context->isFenceNV(fencePacked);
10493         }
10494         else
10495         {
10496             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsFenceNV, GLboolean>();
10497         }
10498         ANGLE_CAPTURE_GL(IsFenceNV, isCallValid, context, fencePacked, returnValue);
10499     }
10500     else
10501     {
10502         GenerateContextLostErrorOnCurrentGlobalContext();
10503         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsFenceNV, GLboolean>();
10504     }
10505     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10506     return returnValue;
10507 }
10508 
GL_SetFenceNV(GLuint fence,GLenum condition)10509 void GL_APIENTRY GL_SetFenceNV(GLuint fence, GLenum condition)
10510 {
10511     Context *context = GetValidGlobalContext();
10512     EVENT(context, GLSetFenceNV, "context = %d, fence = %u, condition = %s", CID(context), fence,
10513           GLenumToString(GLESEnum::AllEnums, condition));
10514 
10515     if (context)
10516     {
10517         FenceNVID fencePacked = PackParam<FenceNVID>(fence);
10518         SCOPED_SHARE_CONTEXT_LOCK(context);
10519         bool isCallValid =
10520             (context->skipValidation() ||
10521              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
10522                                                 context->getMutableErrorSetForValidation(),
10523                                                 angle::EntryPoint::GLSetFenceNV) &&
10524               ValidateSetFenceNV(context, angle::EntryPoint::GLSetFenceNV, fencePacked,
10525                                  condition)));
10526         if (isCallValid)
10527         {
10528             context->setFenceNV(fencePacked, condition);
10529         }
10530         ANGLE_CAPTURE_GL(SetFenceNV, isCallValid, context, fencePacked, condition);
10531     }
10532     else
10533     {
10534         GenerateContextLostErrorOnCurrentGlobalContext();
10535     }
10536     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10537 }
10538 
GL_TestFenceNV(GLuint fence)10539 GLboolean GL_APIENTRY GL_TestFenceNV(GLuint fence)
10540 {
10541     Context *context = GetValidGlobalContext();
10542     EVENT(context, GLTestFenceNV, "context = %d, fence = %u", CID(context), fence);
10543 
10544     GLboolean returnValue;
10545     if (context)
10546     {
10547         FenceNVID fencePacked = PackParam<FenceNVID>(fence);
10548         SCOPED_SHARE_CONTEXT_LOCK(context);
10549         bool isCallValid =
10550             (context->skipValidation() ||
10551              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
10552                                                 context->getMutableErrorSetForValidation(),
10553                                                 angle::EntryPoint::GLTestFenceNV) &&
10554               ValidateTestFenceNV(context, angle::EntryPoint::GLTestFenceNV, fencePacked)));
10555         if (isCallValid)
10556         {
10557             returnValue = context->testFenceNV(fencePacked);
10558         }
10559         else
10560         {
10561             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLTestFenceNV, GLboolean>();
10562         }
10563         ANGLE_CAPTURE_GL(TestFenceNV, isCallValid, context, fencePacked, returnValue);
10564     }
10565     else
10566     {
10567         GenerateContextLostErrorOnCurrentGlobalContext();
10568         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLTestFenceNV, GLboolean>();
10569     }
10570     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10571     return returnValue;
10572 }
10573 
10574 // GL_NV_framebuffer_blit
GL_BlitFramebufferNV(GLint srcX0,GLint srcY0,GLint srcX1,GLint srcY1,GLint dstX0,GLint dstY0,GLint dstX1,GLint dstY1,GLbitfield mask,GLenum filter)10575 void GL_APIENTRY GL_BlitFramebufferNV(GLint srcX0,
10576                                       GLint srcY0,
10577                                       GLint srcX1,
10578                                       GLint srcY1,
10579                                       GLint dstX0,
10580                                       GLint dstY0,
10581                                       GLint dstX1,
10582                                       GLint dstY1,
10583                                       GLbitfield mask,
10584                                       GLenum filter)
10585 {
10586     Context *context = GetValidGlobalContext();
10587     EVENT(context, GLBlitFramebufferNV,
10588           "context = %d, srcX0 = %d, srcY0 = %d, srcX1 = %d, srcY1 = %d, dstX0 = %d, dstY0 = %d, "
10589           "dstX1 = %d, dstY1 = %d, mask = %s, filter = %s",
10590           CID(context), srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
10591           GLbitfieldToString(GLESEnum::ClearBufferMask, mask).c_str(),
10592           GLenumToString(GLESEnum::BlitFramebufferFilter, filter));
10593 
10594     if (context)
10595     {
10596         SCOPED_SHARE_CONTEXT_LOCK(context);
10597         bool isCallValid =
10598             (context->skipValidation() ||
10599              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
10600                                                 context->getMutableErrorSetForValidation(),
10601                                                 angle::EntryPoint::GLBlitFramebufferNV) &&
10602               ValidateBlitFramebufferNV(context, angle::EntryPoint::GLBlitFramebufferNV, srcX0,
10603                                         srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask,
10604                                         filter)));
10605         if (isCallValid)
10606         {
10607             context->blitFramebufferNV(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask,
10608                                        filter);
10609         }
10610         ANGLE_CAPTURE_GL(BlitFramebufferNV, isCallValid, context, srcX0, srcY0, srcX1, srcY1, dstX0,
10611                          dstY0, dstX1, dstY1, mask, filter);
10612     }
10613     else
10614     {
10615         GenerateContextLostErrorOnCurrentGlobalContext();
10616     }
10617     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10618 }
10619 
10620 // GL_NV_pixel_buffer_object
10621 
10622 // GL_NV_polygon_mode
GL_PolygonModeNV(GLenum face,GLenum mode)10623 void GL_APIENTRY GL_PolygonModeNV(GLenum face, GLenum mode)
10624 {
10625     Context *context = GetValidGlobalContext();
10626     EVENT(context, GLPolygonModeNV, "context = %d, face = %s, mode = %s", CID(context),
10627           GLenumToString(GLESEnum::TriangleFace, face),
10628           GLenumToString(GLESEnum::PolygonMode, mode));
10629 
10630     if (context)
10631     {
10632         PolygonMode modePacked = PackParam<PolygonMode>(mode);
10633         bool isCallValid =
10634             (context->skipValidation() ||
10635              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
10636                                                 context->getMutableErrorSetForValidation(),
10637                                                 angle::EntryPoint::GLPolygonModeNV) &&
10638               ValidatePolygonModeNV(context->getPrivateState(),
10639                                     context->getMutableErrorSetForValidation(),
10640                                     angle::EntryPoint::GLPolygonModeNV, face, modePacked)));
10641         if (isCallValid)
10642         {
10643             ContextPrivatePolygonModeNV(context->getMutablePrivateState(),
10644                                         context->getMutablePrivateStateCache(), face, modePacked);
10645         }
10646         ANGLE_CAPTURE_GL(PolygonModeNV, isCallValid, context, face, modePacked);
10647     }
10648     else
10649     {
10650         GenerateContextLostErrorOnCurrentGlobalContext();
10651     }
10652     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10653 }
10654 
10655 // GL_NV_read_depth
10656 
10657 // GL_NV_read_depth_stencil
10658 
10659 // GL_NV_read_stencil
10660 
10661 // GL_NV_robustness_video_memory_purge
10662 
10663 // GL_NV_shader_noperspective_interpolation
10664 
10665 // GL_OES_EGL_image
GL_EGLImageTargetRenderbufferStorageOES(GLenum target,GLeglImageOES image)10666 void GL_APIENTRY GL_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
10667 {
10668     Context *context = GetValidGlobalContext();
10669     EVENT(context, GLEGLImageTargetRenderbufferStorageOES,
10670           "context = %d, target = %s, image = 0x%016" PRIxPTR "", CID(context),
10671           GLenumToString(GLESEnum::AllEnums, target), (uintptr_t)image);
10672 
10673     if (context)
10674     {
10675         egl::ImageID imagePacked = PackParam<egl::ImageID>(image);
10676         SCOPED_EGL_IMAGE_SHARE_CONTEXT_LOCK(context, imagePacked);
10677         bool isCallValid =
10678             (context->skipValidation() ||
10679              (ValidatePixelLocalStorageInactive(
10680                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
10681                   angle::EntryPoint::GLEGLImageTargetRenderbufferStorageOES) &&
10682               ValidateEGLImageTargetRenderbufferStorageOES(
10683                   context, angle::EntryPoint::GLEGLImageTargetRenderbufferStorageOES, target,
10684                   imagePacked)));
10685         if (isCallValid)
10686         {
10687             context->eGLImageTargetRenderbufferStorage(target, imagePacked);
10688         }
10689         ANGLE_CAPTURE_GL(EGLImageTargetRenderbufferStorageOES, isCallValid, context, target,
10690                          imagePacked);
10691     }
10692     else
10693     {
10694         GenerateContextLostErrorOnCurrentGlobalContext();
10695     }
10696     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10697 }
10698 
GL_EGLImageTargetTexture2DOES(GLenum target,GLeglImageOES image)10699 void GL_APIENTRY GL_EGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
10700 {
10701     Context *context = GetValidGlobalContext();
10702     EVENT(context, GLEGLImageTargetTexture2DOES,
10703           "context = %d, target = %s, image = 0x%016" PRIxPTR "", CID(context),
10704           GLenumToString(GLESEnum::AllEnums, target), (uintptr_t)image);
10705 
10706     if (context)
10707     {
10708         TextureType targetPacked = PackParam<TextureType>(target);
10709         egl::ImageID imagePacked = PackParam<egl::ImageID>(image);
10710         SCOPED_EGL_IMAGE_SHARE_CONTEXT_LOCK(context, imagePacked);
10711         bool isCallValid =
10712             (context->skipValidation() ||
10713              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
10714                                                 context->getMutableErrorSetForValidation(),
10715                                                 angle::EntryPoint::GLEGLImageTargetTexture2DOES) &&
10716               ValidateEGLImageTargetTexture2DOES(context,
10717                                                  angle::EntryPoint::GLEGLImageTargetTexture2DOES,
10718                                                  targetPacked, imagePacked)));
10719         if (isCallValid)
10720         {
10721             context->eGLImageTargetTexture2D(targetPacked, imagePacked);
10722         }
10723         ANGLE_CAPTURE_GL(EGLImageTargetTexture2DOES, isCallValid, context, targetPacked,
10724                          imagePacked);
10725     }
10726     else
10727     {
10728         GenerateContextLostErrorOnCurrentGlobalContext();
10729     }
10730     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10731 }
10732 
10733 // GL_OES_EGL_image_external
10734 
10735 // GL_OES_EGL_image_external_essl3
10736 
10737 // GL_OES_compressed_ETC1_RGB8_texture
10738 
10739 // GL_OES_compressed_paletted_texture
10740 
10741 // GL_OES_copy_image
GL_CopyImageSubDataOES(GLuint srcName,GLenum srcTarget,GLint srcLevel,GLint srcX,GLint srcY,GLint srcZ,GLuint dstName,GLenum dstTarget,GLint dstLevel,GLint dstX,GLint dstY,GLint dstZ,GLsizei srcWidth,GLsizei srcHeight,GLsizei srcDepth)10742 void GL_APIENTRY GL_CopyImageSubDataOES(GLuint srcName,
10743                                         GLenum srcTarget,
10744                                         GLint srcLevel,
10745                                         GLint srcX,
10746                                         GLint srcY,
10747                                         GLint srcZ,
10748                                         GLuint dstName,
10749                                         GLenum dstTarget,
10750                                         GLint dstLevel,
10751                                         GLint dstX,
10752                                         GLint dstY,
10753                                         GLint dstZ,
10754                                         GLsizei srcWidth,
10755                                         GLsizei srcHeight,
10756                                         GLsizei srcDepth)
10757 {
10758     Context *context = GetValidGlobalContext();
10759     EVENT(context, GLCopyImageSubDataOES,
10760           "context = %d, srcName = %u, srcTarget = %s, srcLevel = %d, srcX = %d, srcY = %d, srcZ = "
10761           "%d, dstName = %u, dstTarget = %s, dstLevel = %d, dstX = %d, dstY = %d, dstZ = %d, "
10762           "srcWidth = %d, srcHeight = %d, srcDepth = %d",
10763           CID(context), srcName, GLenumToString(GLESEnum::CopyBufferSubDataTarget, srcTarget),
10764           srcLevel, srcX, srcY, srcZ, dstName,
10765           GLenumToString(GLESEnum::CopyBufferSubDataTarget, dstTarget), dstLevel, dstX, dstY, dstZ,
10766           srcWidth, srcHeight, srcDepth);
10767 
10768     if (context)
10769     {
10770         SCOPED_SHARE_CONTEXT_LOCK(context);
10771         bool isCallValid =
10772             (context->skipValidation() ||
10773              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
10774                                                 context->getMutableErrorSetForValidation(),
10775                                                 angle::EntryPoint::GLCopyImageSubDataOES) &&
10776               ValidateCopyImageSubDataOES(context, angle::EntryPoint::GLCopyImageSubDataOES,
10777                                           srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName,
10778                                           dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth,
10779                                           srcHeight, srcDepth)));
10780         if (isCallValid)
10781         {
10782             context->copyImageSubData(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName,
10783                                       dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight,
10784                                       srcDepth);
10785         }
10786         ANGLE_CAPTURE_GL(CopyImageSubDataOES, isCallValid, context, srcName, srcTarget, srcLevel,
10787                          srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth,
10788                          srcHeight, srcDepth);
10789     }
10790     else
10791     {
10792         GenerateContextLostErrorOnCurrentGlobalContext();
10793     }
10794     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10795 }
10796 
10797 // GL_OES_depth24
10798 
10799 // GL_OES_depth32
10800 
10801 // GL_OES_depth_texture
10802 
10803 // GL_OES_draw_buffers_indexed
GL_BlendEquationSeparateiOES(GLuint buf,GLenum modeRGB,GLenum modeAlpha)10804 void GL_APIENTRY GL_BlendEquationSeparateiOES(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
10805 {
10806     Context *context = GetValidGlobalContext();
10807     EVENT(context, GLBlendEquationSeparateiOES,
10808           "context = %d, buf = %u, modeRGB = %s, modeAlpha = %s", CID(context), buf,
10809           GLenumToString(GLESEnum::BlendEquationModeEXT, modeRGB),
10810           GLenumToString(GLESEnum::BlendEquationModeEXT, modeAlpha));
10811 
10812     if (context)
10813     {
10814         bool isCallValid =
10815             (context->skipValidation() ||
10816              ValidateBlendEquationSeparateiOES(
10817                  context->getPrivateState(), context->getMutableErrorSetForValidation(),
10818                  angle::EntryPoint::GLBlendEquationSeparateiOES, buf, modeRGB, modeAlpha));
10819         if (isCallValid)
10820         {
10821             ContextPrivateBlendEquationSeparatei(context->getMutablePrivateState(),
10822                                                  context->getMutablePrivateStateCache(), buf,
10823                                                  modeRGB, modeAlpha);
10824         }
10825         ANGLE_CAPTURE_GL(BlendEquationSeparateiOES, isCallValid, context, buf, modeRGB, modeAlpha);
10826     }
10827     else
10828     {
10829         GenerateContextLostErrorOnCurrentGlobalContext();
10830     }
10831     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10832 }
10833 
GL_BlendEquationiOES(GLuint buf,GLenum mode)10834 void GL_APIENTRY GL_BlendEquationiOES(GLuint buf, GLenum mode)
10835 {
10836     Context *context = GetValidGlobalContext();
10837     EVENT(context, GLBlendEquationiOES, "context = %d, buf = %u, mode = %s", CID(context), buf,
10838           GLenumToString(GLESEnum::BlendEquationModeEXT, mode));
10839 
10840     if (context)
10841     {
10842         bool isCallValid =
10843             (context->skipValidation() ||
10844              ValidateBlendEquationiOES(context->getPrivateState(),
10845                                        context->getMutableErrorSetForValidation(),
10846                                        angle::EntryPoint::GLBlendEquationiOES, buf, mode));
10847         if (isCallValid)
10848         {
10849             ContextPrivateBlendEquationi(context->getMutablePrivateState(),
10850                                          context->getMutablePrivateStateCache(), buf, mode);
10851         }
10852         ANGLE_CAPTURE_GL(BlendEquationiOES, isCallValid, context, buf, mode);
10853     }
10854     else
10855     {
10856         GenerateContextLostErrorOnCurrentGlobalContext();
10857     }
10858     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10859 }
10860 
10861 void GL_APIENTRY
GL_BlendFuncSeparateiOES(GLuint buf,GLenum srcRGB,GLenum dstRGB,GLenum srcAlpha,GLenum dstAlpha)10862 GL_BlendFuncSeparateiOES(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
10863 {
10864     Context *context = GetValidGlobalContext();
10865     EVENT(context, GLBlendFuncSeparateiOES,
10866           "context = %d, buf = %u, srcRGB = %s, dstRGB = %s, srcAlpha = %s, dstAlpha = %s",
10867           CID(context), buf, GLenumToString(GLESEnum::BlendingFactor, srcRGB),
10868           GLenumToString(GLESEnum::BlendingFactor, dstRGB),
10869           GLenumToString(GLESEnum::BlendingFactor, srcAlpha),
10870           GLenumToString(GLESEnum::BlendingFactor, dstAlpha));
10871 
10872     if (context)
10873     {
10874         bool isCallValid =
10875             (context->skipValidation() ||
10876              ValidateBlendFuncSeparateiOES(context->getPrivateState(),
10877                                            context->getMutableErrorSetForValidation(),
10878                                            angle::EntryPoint::GLBlendFuncSeparateiOES, buf, srcRGB,
10879                                            dstRGB, srcAlpha, dstAlpha));
10880         if (isCallValid)
10881         {
10882             ContextPrivateBlendFuncSeparatei(context->getMutablePrivateState(),
10883                                              context->getMutablePrivateStateCache(), buf, srcRGB,
10884                                              dstRGB, srcAlpha, dstAlpha);
10885         }
10886         ANGLE_CAPTURE_GL(BlendFuncSeparateiOES, isCallValid, context, buf, srcRGB, dstRGB, srcAlpha,
10887                          dstAlpha);
10888     }
10889     else
10890     {
10891         GenerateContextLostErrorOnCurrentGlobalContext();
10892     }
10893     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10894 }
10895 
GL_BlendFunciOES(GLuint buf,GLenum src,GLenum dst)10896 void GL_APIENTRY GL_BlendFunciOES(GLuint buf, GLenum src, GLenum dst)
10897 {
10898     Context *context = GetValidGlobalContext();
10899     EVENT(context, GLBlendFunciOES, "context = %d, buf = %u, src = %s, dst = %s", CID(context), buf,
10900           GLenumToString(GLESEnum::BlendingFactor, src),
10901           GLenumToString(GLESEnum::BlendingFactor, dst));
10902 
10903     if (context)
10904     {
10905         bool isCallValid =
10906             (context->skipValidation() ||
10907              ValidateBlendFunciOES(context->getPrivateState(),
10908                                    context->getMutableErrorSetForValidation(),
10909                                    angle::EntryPoint::GLBlendFunciOES, buf, src, dst));
10910         if (isCallValid)
10911         {
10912             ContextPrivateBlendFunci(context->getMutablePrivateState(),
10913                                      context->getMutablePrivateStateCache(), buf, src, dst);
10914         }
10915         ANGLE_CAPTURE_GL(BlendFunciOES, isCallValid, context, buf, src, dst);
10916     }
10917     else
10918     {
10919         GenerateContextLostErrorOnCurrentGlobalContext();
10920     }
10921     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10922 }
10923 
GL_ColorMaskiOES(GLuint index,GLboolean r,GLboolean g,GLboolean b,GLboolean a)10924 void GL_APIENTRY GL_ColorMaskiOES(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
10925 {
10926     Context *context = GetValidGlobalContext();
10927     EVENT(context, GLColorMaskiOES, "context = %d, index = %u, r = %s, g = %s, b = %s, a = %s",
10928           CID(context), index, GLbooleanToString(r), GLbooleanToString(g), GLbooleanToString(b),
10929           GLbooleanToString(a));
10930 
10931     if (context)
10932     {
10933         bool isCallValid =
10934             (context->skipValidation() ||
10935              ValidateColorMaskiOES(context->getPrivateState(),
10936                                    context->getMutableErrorSetForValidation(),
10937                                    angle::EntryPoint::GLColorMaskiOES, index, r, g, b, a));
10938         if (isCallValid)
10939         {
10940             ContextPrivateColorMaski(context->getMutablePrivateState(),
10941                                      context->getMutablePrivateStateCache(), index, r, g, b, a);
10942         }
10943         ANGLE_CAPTURE_GL(ColorMaskiOES, isCallValid, context, index, r, g, b, a);
10944     }
10945     else
10946     {
10947         GenerateContextLostErrorOnCurrentGlobalContext();
10948     }
10949     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10950 }
10951 
GL_DisableiOES(GLenum target,GLuint index)10952 void GL_APIENTRY GL_DisableiOES(GLenum target, GLuint index)
10953 {
10954     Context *context = GetValidGlobalContext();
10955     EVENT(context, GLDisableiOES, "context = %d, target = %s, index = %u", CID(context),
10956           GLenumToString(GLESEnum::EnableCap, target), index);
10957 
10958     if (context)
10959     {
10960         bool isCallValid = (context->skipValidation() ||
10961                             ValidateDisableiOES(context->getPrivateState(),
10962                                                 context->getMutableErrorSetForValidation(),
10963                                                 angle::EntryPoint::GLDisableiOES, target, index));
10964         if (isCallValid)
10965         {
10966             ContextPrivateDisablei(context->getMutablePrivateState(),
10967                                    context->getMutablePrivateStateCache(), target, index);
10968         }
10969         ANGLE_CAPTURE_GL(DisableiOES, isCallValid, context, target, index);
10970     }
10971     else
10972     {
10973         GenerateContextLostErrorOnCurrentGlobalContext();
10974     }
10975     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
10976 }
10977 
GL_EnableiOES(GLenum target,GLuint index)10978 void GL_APIENTRY GL_EnableiOES(GLenum target, GLuint index)
10979 {
10980     Context *context = GetValidGlobalContext();
10981     EVENT(context, GLEnableiOES, "context = %d, target = %s, index = %u", CID(context),
10982           GLenumToString(GLESEnum::EnableCap, target), index);
10983 
10984     if (context)
10985     {
10986         bool isCallValid = (context->skipValidation() ||
10987                             ValidateEnableiOES(context->getPrivateState(),
10988                                                context->getMutableErrorSetForValidation(),
10989                                                angle::EntryPoint::GLEnableiOES, target, index));
10990         if (isCallValid)
10991         {
10992             ContextPrivateEnablei(context->getMutablePrivateState(),
10993                                   context->getMutablePrivateStateCache(), target, index);
10994         }
10995         ANGLE_CAPTURE_GL(EnableiOES, isCallValid, context, target, index);
10996     }
10997     else
10998     {
10999         GenerateContextLostErrorOnCurrentGlobalContext();
11000     }
11001     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11002 }
11003 
GL_IsEnablediOES(GLenum target,GLuint index)11004 GLboolean GL_APIENTRY GL_IsEnablediOES(GLenum target, GLuint index)
11005 {
11006     Context *context = GetValidGlobalContext();
11007     EVENT(context, GLIsEnablediOES, "context = %d, target = %s, index = %u", CID(context),
11008           GLenumToString(GLESEnum::EnableCap, target), index);
11009 
11010     GLboolean returnValue;
11011     if (context)
11012     {
11013         bool isCallValid =
11014             (context->skipValidation() ||
11015              ValidateIsEnablediOES(context->getPrivateState(),
11016                                    context->getMutableErrorSetForValidation(),
11017                                    angle::EntryPoint::GLIsEnablediOES, target, index));
11018         if (isCallValid)
11019         {
11020             returnValue =
11021                 ContextPrivateIsEnabledi(context->getMutablePrivateState(),
11022                                          context->getMutablePrivateStateCache(), target, index);
11023         }
11024         else
11025         {
11026             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsEnablediOES, GLboolean>();
11027         }
11028         ANGLE_CAPTURE_GL(IsEnablediOES, isCallValid, context, target, index, returnValue);
11029     }
11030     else
11031     {
11032         GenerateContextLostErrorOnCurrentGlobalContext();
11033         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsEnablediOES, GLboolean>();
11034     }
11035     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11036     return returnValue;
11037 }
11038 
11039 // GL_OES_draw_elements_base_vertex
GL_DrawElementsBaseVertexOES(GLenum mode,GLsizei count,GLenum type,const void * indices,GLint basevertex)11040 void GL_APIENTRY GL_DrawElementsBaseVertexOES(GLenum mode,
11041                                               GLsizei count,
11042                                               GLenum type,
11043                                               const void *indices,
11044                                               GLint basevertex)
11045 {
11046     Context *context = GetValidGlobalContext();
11047     EVENT(context, GLDrawElementsBaseVertexOES,
11048           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
11049           ", basevertex = %d",
11050           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), count,
11051           GLenumToString(GLESEnum::DrawElementsType, type), (uintptr_t)indices, basevertex);
11052 
11053     if (context)
11054     {
11055         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
11056         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
11057         SCOPED_SHARE_CONTEXT_LOCK(context);
11058         bool isCallValid = (context->skipValidation() ||
11059                             ValidateDrawElementsBaseVertexOES(
11060                                 context, angle::EntryPoint::GLDrawElementsBaseVertexOES, modePacked,
11061                                 count, typePacked, indices, basevertex));
11062         if (isCallValid)
11063         {
11064             context->drawElementsBaseVertex(modePacked, count, typePacked, indices, basevertex);
11065         }
11066         ANGLE_CAPTURE_GL(DrawElementsBaseVertexOES, isCallValid, context, modePacked, count,
11067                          typePacked, indices, basevertex);
11068     }
11069     else
11070     {
11071         GenerateContextLostErrorOnCurrentGlobalContext();
11072     }
11073     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11074 }
11075 
GL_DrawElementsInstancedBaseVertexOES(GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei instancecount,GLint basevertex)11076 void GL_APIENTRY GL_DrawElementsInstancedBaseVertexOES(GLenum mode,
11077                                                        GLsizei count,
11078                                                        GLenum type,
11079                                                        const void *indices,
11080                                                        GLsizei instancecount,
11081                                                        GLint basevertex)
11082 {
11083     Context *context = GetValidGlobalContext();
11084     EVENT(context, GLDrawElementsInstancedBaseVertexOES,
11085           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
11086           ", instancecount = %d, basevertex = %d",
11087           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), count,
11088           GLenumToString(GLESEnum::DrawElementsType, type), (uintptr_t)indices, instancecount,
11089           basevertex);
11090 
11091     if (context)
11092     {
11093         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
11094         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
11095         SCOPED_SHARE_CONTEXT_LOCK(context);
11096         bool isCallValid = (context->skipValidation() ||
11097                             ValidateDrawElementsInstancedBaseVertexOES(
11098                                 context, angle::EntryPoint::GLDrawElementsInstancedBaseVertexOES,
11099                                 modePacked, count, typePacked, indices, instancecount, basevertex));
11100         if (isCallValid)
11101         {
11102             context->drawElementsInstancedBaseVertex(modePacked, count, typePacked, indices,
11103                                                      instancecount, basevertex);
11104         }
11105         ANGLE_CAPTURE_GL(DrawElementsInstancedBaseVertexOES, isCallValid, context, modePacked,
11106                          count, typePacked, indices, instancecount, basevertex);
11107     }
11108     else
11109     {
11110         GenerateContextLostErrorOnCurrentGlobalContext();
11111     }
11112     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11113 }
11114 
GL_DrawRangeElementsBaseVertexOES(GLenum mode,GLuint start,GLuint end,GLsizei count,GLenum type,const void * indices,GLint basevertex)11115 void GL_APIENTRY GL_DrawRangeElementsBaseVertexOES(GLenum mode,
11116                                                    GLuint start,
11117                                                    GLuint end,
11118                                                    GLsizei count,
11119                                                    GLenum type,
11120                                                    const void *indices,
11121                                                    GLint basevertex)
11122 {
11123     Context *context = GetValidGlobalContext();
11124     EVENT(context, GLDrawRangeElementsBaseVertexOES,
11125           "context = %d, mode = %s, start = %u, end = %u, count = %d, type = %s, indices = "
11126           "0x%016" PRIxPTR ", basevertex = %d",
11127           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), start, end, count,
11128           GLenumToString(GLESEnum::DrawElementsType, type), (uintptr_t)indices, basevertex);
11129 
11130     if (context)
11131     {
11132         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
11133         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
11134         SCOPED_SHARE_CONTEXT_LOCK(context);
11135         bool isCallValid = (context->skipValidation() ||
11136                             ValidateDrawRangeElementsBaseVertexOES(
11137                                 context, angle::EntryPoint::GLDrawRangeElementsBaseVertexOES,
11138                                 modePacked, start, end, count, typePacked, indices, basevertex));
11139         if (isCallValid)
11140         {
11141             context->drawRangeElementsBaseVertex(modePacked, start, end, count, typePacked, indices,
11142                                                  basevertex);
11143         }
11144         ANGLE_CAPTURE_GL(DrawRangeElementsBaseVertexOES, isCallValid, context, modePacked, start,
11145                          end, count, typePacked, indices, basevertex);
11146     }
11147     else
11148     {
11149         GenerateContextLostErrorOnCurrentGlobalContext();
11150     }
11151     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11152 }
11153 
11154 // MultiDrawElementsBaseVertexEXT is already defined.
11155 
11156 // GL_OES_draw_texture
GL_DrawTexfOES(GLfloat x,GLfloat y,GLfloat z,GLfloat width,GLfloat height)11157 void GL_APIENTRY GL_DrawTexfOES(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height)
11158 {
11159     Context *context = GetValidGlobalContext();
11160     EVENT(context, GLDrawTexfOES, "context = %d, x = %f, y = %f, z = %f, width = %f, height = %f",
11161           CID(context), x, y, z, width, height);
11162 
11163     if (context)
11164     {
11165         SCOPED_SHARE_CONTEXT_LOCK(context);
11166         bool isCallValid =
11167             (context->skipValidation() ||
11168              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
11169                                                 context->getMutableErrorSetForValidation(),
11170                                                 angle::EntryPoint::GLDrawTexfOES) &&
11171               ValidateDrawTexfOES(context, angle::EntryPoint::GLDrawTexfOES, x, y, z, width,
11172                                   height)));
11173         if (isCallValid)
11174         {
11175             context->drawTexf(x, y, z, width, height);
11176         }
11177         ANGLE_CAPTURE_GL(DrawTexfOES, isCallValid, context, x, y, z, width, height);
11178     }
11179     else
11180     {
11181         GenerateContextLostErrorOnCurrentGlobalContext();
11182     }
11183     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11184 }
11185 
GL_DrawTexfvOES(const GLfloat * coords)11186 void GL_APIENTRY GL_DrawTexfvOES(const GLfloat *coords)
11187 {
11188     Context *context = GetValidGlobalContext();
11189     EVENT(context, GLDrawTexfvOES, "context = %d, coords = 0x%016" PRIxPTR "", CID(context),
11190           (uintptr_t)coords);
11191 
11192     if (context)
11193     {
11194         SCOPED_SHARE_CONTEXT_LOCK(context);
11195         bool isCallValid =
11196             (context->skipValidation() ||
11197              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
11198                                                 context->getMutableErrorSetForValidation(),
11199                                                 angle::EntryPoint::GLDrawTexfvOES) &&
11200               ValidateDrawTexfvOES(context, angle::EntryPoint::GLDrawTexfvOES, coords)));
11201         if (isCallValid)
11202         {
11203             context->drawTexfv(coords);
11204         }
11205         ANGLE_CAPTURE_GL(DrawTexfvOES, isCallValid, context, coords);
11206     }
11207     else
11208     {
11209         GenerateContextLostErrorOnCurrentGlobalContext();
11210     }
11211     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11212 }
11213 
GL_DrawTexiOES(GLint x,GLint y,GLint z,GLint width,GLint height)11214 void GL_APIENTRY GL_DrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height)
11215 {
11216     Context *context = GetValidGlobalContext();
11217     EVENT(context, GLDrawTexiOES, "context = %d, x = %d, y = %d, z = %d, width = %d, height = %d",
11218           CID(context), x, y, z, width, height);
11219 
11220     if (context)
11221     {
11222         SCOPED_SHARE_CONTEXT_LOCK(context);
11223         bool isCallValid =
11224             (context->skipValidation() ||
11225              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
11226                                                 context->getMutableErrorSetForValidation(),
11227                                                 angle::EntryPoint::GLDrawTexiOES) &&
11228               ValidateDrawTexiOES(context, angle::EntryPoint::GLDrawTexiOES, x, y, z, width,
11229                                   height)));
11230         if (isCallValid)
11231         {
11232             context->drawTexi(x, y, z, width, height);
11233         }
11234         ANGLE_CAPTURE_GL(DrawTexiOES, isCallValid, context, x, y, z, width, height);
11235     }
11236     else
11237     {
11238         GenerateContextLostErrorOnCurrentGlobalContext();
11239     }
11240     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11241 }
11242 
GL_DrawTexivOES(const GLint * coords)11243 void GL_APIENTRY GL_DrawTexivOES(const GLint *coords)
11244 {
11245     Context *context = GetValidGlobalContext();
11246     EVENT(context, GLDrawTexivOES, "context = %d, coords = 0x%016" PRIxPTR "", CID(context),
11247           (uintptr_t)coords);
11248 
11249     if (context)
11250     {
11251         SCOPED_SHARE_CONTEXT_LOCK(context);
11252         bool isCallValid =
11253             (context->skipValidation() ||
11254              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
11255                                                 context->getMutableErrorSetForValidation(),
11256                                                 angle::EntryPoint::GLDrawTexivOES) &&
11257               ValidateDrawTexivOES(context, angle::EntryPoint::GLDrawTexivOES, coords)));
11258         if (isCallValid)
11259         {
11260             context->drawTexiv(coords);
11261         }
11262         ANGLE_CAPTURE_GL(DrawTexivOES, isCallValid, context, coords);
11263     }
11264     else
11265     {
11266         GenerateContextLostErrorOnCurrentGlobalContext();
11267     }
11268     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11269 }
11270 
GL_DrawTexsOES(GLshort x,GLshort y,GLshort z,GLshort width,GLshort height)11271 void GL_APIENTRY GL_DrawTexsOES(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height)
11272 {
11273     Context *context = GetValidGlobalContext();
11274     EVENT(context, GLDrawTexsOES, "context = %d, x = %d, y = %d, z = %d, width = %d, height = %d",
11275           CID(context), x, y, z, width, height);
11276 
11277     if (context)
11278     {
11279         SCOPED_SHARE_CONTEXT_LOCK(context);
11280         bool isCallValid =
11281             (context->skipValidation() ||
11282              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
11283                                                 context->getMutableErrorSetForValidation(),
11284                                                 angle::EntryPoint::GLDrawTexsOES) &&
11285               ValidateDrawTexsOES(context, angle::EntryPoint::GLDrawTexsOES, x, y, z, width,
11286                                   height)));
11287         if (isCallValid)
11288         {
11289             context->drawTexs(x, y, z, width, height);
11290         }
11291         ANGLE_CAPTURE_GL(DrawTexsOES, isCallValid, context, x, y, z, width, height);
11292     }
11293     else
11294     {
11295         GenerateContextLostErrorOnCurrentGlobalContext();
11296     }
11297     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11298 }
11299 
GL_DrawTexsvOES(const GLshort * coords)11300 void GL_APIENTRY GL_DrawTexsvOES(const GLshort *coords)
11301 {
11302     Context *context = GetValidGlobalContext();
11303     EVENT(context, GLDrawTexsvOES, "context = %d, coords = 0x%016" PRIxPTR "", CID(context),
11304           (uintptr_t)coords);
11305 
11306     if (context)
11307     {
11308         SCOPED_SHARE_CONTEXT_LOCK(context);
11309         bool isCallValid =
11310             (context->skipValidation() ||
11311              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
11312                                                 context->getMutableErrorSetForValidation(),
11313                                                 angle::EntryPoint::GLDrawTexsvOES) &&
11314               ValidateDrawTexsvOES(context, angle::EntryPoint::GLDrawTexsvOES, coords)));
11315         if (isCallValid)
11316         {
11317             context->drawTexsv(coords);
11318         }
11319         ANGLE_CAPTURE_GL(DrawTexsvOES, isCallValid, context, coords);
11320     }
11321     else
11322     {
11323         GenerateContextLostErrorOnCurrentGlobalContext();
11324     }
11325     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11326 }
11327 
GL_DrawTexxOES(GLfixed x,GLfixed y,GLfixed z,GLfixed width,GLfixed height)11328 void GL_APIENTRY GL_DrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height)
11329 {
11330     Context *context = GetValidGlobalContext();
11331     EVENT(context, GLDrawTexxOES,
11332           "context = %d, x = 0x%X, y = 0x%X, z = 0x%X, width = 0x%X, height = 0x%X", CID(context),
11333           x, y, z, width, height);
11334 
11335     if (context)
11336     {
11337         SCOPED_SHARE_CONTEXT_LOCK(context);
11338         bool isCallValid =
11339             (context->skipValidation() ||
11340              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
11341                                                 context->getMutableErrorSetForValidation(),
11342                                                 angle::EntryPoint::GLDrawTexxOES) &&
11343               ValidateDrawTexxOES(context, angle::EntryPoint::GLDrawTexxOES, x, y, z, width,
11344                                   height)));
11345         if (isCallValid)
11346         {
11347             context->drawTexx(x, y, z, width, height);
11348         }
11349         ANGLE_CAPTURE_GL(DrawTexxOES, isCallValid, context, x, y, z, width, height);
11350     }
11351     else
11352     {
11353         GenerateContextLostErrorOnCurrentGlobalContext();
11354     }
11355     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11356 }
11357 
GL_DrawTexxvOES(const GLfixed * coords)11358 void GL_APIENTRY GL_DrawTexxvOES(const GLfixed *coords)
11359 {
11360     Context *context = GetValidGlobalContext();
11361     EVENT(context, GLDrawTexxvOES, "context = %d, coords = 0x%016" PRIxPTR "", CID(context),
11362           (uintptr_t)coords);
11363 
11364     if (context)
11365     {
11366         SCOPED_SHARE_CONTEXT_LOCK(context);
11367         bool isCallValid =
11368             (context->skipValidation() ||
11369              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
11370                                                 context->getMutableErrorSetForValidation(),
11371                                                 angle::EntryPoint::GLDrawTexxvOES) &&
11372               ValidateDrawTexxvOES(context, angle::EntryPoint::GLDrawTexxvOES, coords)));
11373         if (isCallValid)
11374         {
11375             context->drawTexxv(coords);
11376         }
11377         ANGLE_CAPTURE_GL(DrawTexxvOES, isCallValid, context, coords);
11378     }
11379     else
11380     {
11381         GenerateContextLostErrorOnCurrentGlobalContext();
11382     }
11383     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11384 }
11385 
11386 // GL_OES_element_index_uint
11387 
11388 // GL_OES_fbo_render_mipmap
11389 
11390 // GL_OES_framebuffer_object
GL_BindFramebufferOES(GLenum target,GLuint framebuffer)11391 void GL_APIENTRY GL_BindFramebufferOES(GLenum target, GLuint framebuffer)
11392 {
11393     Context *context = GetValidGlobalContext();
11394     EVENT(context, GLBindFramebufferOES, "context = %d, target = %s, framebuffer = %u",
11395           CID(context), GLenumToString(GLESEnum::FramebufferTarget, target), framebuffer);
11396 
11397     if (context)
11398     {
11399         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
11400         SCOPED_SHARE_CONTEXT_LOCK(context);
11401         bool isCallValid =
11402             (context->skipValidation() ||
11403              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
11404                                                 context->getMutableErrorSetForValidation(),
11405                                                 angle::EntryPoint::GLBindFramebufferOES) &&
11406               ValidateBindFramebufferOES(context, angle::EntryPoint::GLBindFramebufferOES, target,
11407                                          framebufferPacked)));
11408         if (isCallValid)
11409         {
11410             context->bindFramebuffer(target, framebufferPacked);
11411         }
11412         ANGLE_CAPTURE_GL(BindFramebufferOES, isCallValid, context, target, framebufferPacked);
11413     }
11414     else
11415     {
11416         GenerateContextLostErrorOnCurrentGlobalContext();
11417     }
11418     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11419 }
11420 
GL_BindRenderbufferOES(GLenum target,GLuint renderbuffer)11421 void GL_APIENTRY GL_BindRenderbufferOES(GLenum target, GLuint renderbuffer)
11422 {
11423     Context *context = GetValidGlobalContext();
11424     EVENT(context, GLBindRenderbufferOES, "context = %d, target = %s, renderbuffer = %u",
11425           CID(context), GLenumToString(GLESEnum::RenderbufferTarget, target), renderbuffer);
11426 
11427     if (context)
11428     {
11429         RenderbufferID renderbufferPacked = PackParam<RenderbufferID>(renderbuffer);
11430         SCOPED_SHARE_CONTEXT_LOCK(context);
11431         bool isCallValid =
11432             (context->skipValidation() ||
11433              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
11434                                                 context->getMutableErrorSetForValidation(),
11435                                                 angle::EntryPoint::GLBindRenderbufferOES) &&
11436               ValidateBindRenderbufferOES(context, angle::EntryPoint::GLBindRenderbufferOES, target,
11437                                           renderbufferPacked)));
11438         if (isCallValid)
11439         {
11440             context->bindRenderbuffer(target, renderbufferPacked);
11441         }
11442         ANGLE_CAPTURE_GL(BindRenderbufferOES, isCallValid, context, target, renderbufferPacked);
11443     }
11444     else
11445     {
11446         GenerateContextLostErrorOnCurrentGlobalContext();
11447     }
11448     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11449 }
11450 
GL_CheckFramebufferStatusOES(GLenum target)11451 GLenum GL_APIENTRY GL_CheckFramebufferStatusOES(GLenum target)
11452 {
11453     Context *context = GetValidGlobalContext();
11454     EVENT(context, GLCheckFramebufferStatusOES, "context = %d, target = %s", CID(context),
11455           GLenumToString(GLESEnum::FramebufferTarget, target));
11456 
11457     GLenum returnValue;
11458     if (context)
11459     {
11460         SCOPED_SHARE_CONTEXT_LOCK(context);
11461         bool isCallValid =
11462             (context->skipValidation() ||
11463              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
11464                                                 context->getMutableErrorSetForValidation(),
11465                                                 angle::EntryPoint::GLCheckFramebufferStatusOES) &&
11466               ValidateCheckFramebufferStatusOES(
11467                   context, angle::EntryPoint::GLCheckFramebufferStatusOES, target)));
11468         if (isCallValid)
11469         {
11470             returnValue = context->checkFramebufferStatus(target);
11471         }
11472         else
11473         {
11474             returnValue =
11475                 GetDefaultReturnValue<angle::EntryPoint::GLCheckFramebufferStatusOES, GLenum>();
11476         }
11477         ANGLE_CAPTURE_GL(CheckFramebufferStatusOES, isCallValid, context, target, returnValue);
11478     }
11479     else
11480     {
11481         GenerateContextLostErrorOnCurrentGlobalContext();
11482         returnValue =
11483             GetDefaultReturnValue<angle::EntryPoint::GLCheckFramebufferStatusOES, GLenum>();
11484     }
11485     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11486     return returnValue;
11487 }
11488 
GL_DeleteFramebuffersOES(GLsizei n,const GLuint * framebuffers)11489 void GL_APIENTRY GL_DeleteFramebuffersOES(GLsizei n, const GLuint *framebuffers)
11490 {
11491     Context *context = GetValidGlobalContext();
11492     EVENT(context, GLDeleteFramebuffersOES,
11493           "context = %d, n = %d, framebuffers = 0x%016" PRIxPTR "", CID(context), n,
11494           (uintptr_t)framebuffers);
11495 
11496     if (context)
11497     {
11498         const FramebufferID *framebuffersPacked = PackParam<const FramebufferID *>(framebuffers);
11499         SCOPED_SHARE_CONTEXT_LOCK(context);
11500         bool isCallValid =
11501             (context->skipValidation() ||
11502              ValidateDeleteFramebuffersOES(context, angle::EntryPoint::GLDeleteFramebuffersOES, n,
11503                                            framebuffersPacked));
11504         if (isCallValid)
11505         {
11506             context->deleteFramebuffers(n, framebuffersPacked);
11507         }
11508         ANGLE_CAPTURE_GL(DeleteFramebuffersOES, isCallValid, context, n, framebuffersPacked);
11509     }
11510     else
11511     {
11512         GenerateContextLostErrorOnCurrentGlobalContext();
11513     }
11514     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11515 }
11516 
GL_DeleteRenderbuffersOES(GLsizei n,const GLuint * renderbuffers)11517 void GL_APIENTRY GL_DeleteRenderbuffersOES(GLsizei n, const GLuint *renderbuffers)
11518 {
11519     Context *context = GetValidGlobalContext();
11520     EVENT(context, GLDeleteRenderbuffersOES,
11521           "context = %d, n = %d, renderbuffers = 0x%016" PRIxPTR "", CID(context), n,
11522           (uintptr_t)renderbuffers);
11523 
11524     if (context)
11525     {
11526         const RenderbufferID *renderbuffersPacked =
11527             PackParam<const RenderbufferID *>(renderbuffers);
11528         SCOPED_SHARE_CONTEXT_LOCK(context);
11529         bool isCallValid =
11530             (context->skipValidation() ||
11531              ValidateDeleteRenderbuffersOES(context, angle::EntryPoint::GLDeleteRenderbuffersOES, n,
11532                                             renderbuffersPacked));
11533         if (isCallValid)
11534         {
11535             context->deleteRenderbuffers(n, renderbuffersPacked);
11536         }
11537         ANGLE_CAPTURE_GL(DeleteRenderbuffersOES, isCallValid, context, n, renderbuffersPacked);
11538     }
11539     else
11540     {
11541         GenerateContextLostErrorOnCurrentGlobalContext();
11542     }
11543     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11544 }
11545 
GL_FramebufferRenderbufferOES(GLenum target,GLenum attachment,GLenum renderbuffertarget,GLuint renderbuffer)11546 void GL_APIENTRY GL_FramebufferRenderbufferOES(GLenum target,
11547                                                GLenum attachment,
11548                                                GLenum renderbuffertarget,
11549                                                GLuint renderbuffer)
11550 {
11551     Context *context = GetValidGlobalContext();
11552     EVENT(context, GLFramebufferRenderbufferOES,
11553           "context = %d, target = %s, attachment = %s, renderbuffertarget = %s, renderbuffer = %u",
11554           CID(context), GLenumToString(GLESEnum::FramebufferTarget, target),
11555           GLenumToString(GLESEnum::FramebufferAttachment, attachment),
11556           GLenumToString(GLESEnum::RenderbufferTarget, renderbuffertarget), renderbuffer);
11557 
11558     if (context)
11559     {
11560         RenderbufferID renderbufferPacked = PackParam<RenderbufferID>(renderbuffer);
11561         SCOPED_SHARE_CONTEXT_LOCK(context);
11562         bool isCallValid =
11563             (context->skipValidation() ||
11564              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
11565                                                 context->getMutableErrorSetForValidation(),
11566                                                 angle::EntryPoint::GLFramebufferRenderbufferOES) &&
11567               ValidateFramebufferRenderbufferOES(
11568                   context, angle::EntryPoint::GLFramebufferRenderbufferOES, target, attachment,
11569                   renderbuffertarget, renderbufferPacked)));
11570         if (isCallValid)
11571         {
11572             context->framebufferRenderbuffer(target, attachment, renderbuffertarget,
11573                                              renderbufferPacked);
11574         }
11575         ANGLE_CAPTURE_GL(FramebufferRenderbufferOES, isCallValid, context, target, attachment,
11576                          renderbuffertarget, renderbufferPacked);
11577     }
11578     else
11579     {
11580         GenerateContextLostErrorOnCurrentGlobalContext();
11581     }
11582     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11583 }
11584 
GL_FramebufferTexture2DOES(GLenum target,GLenum attachment,GLenum textarget,GLuint texture,GLint level)11585 void GL_APIENTRY GL_FramebufferTexture2DOES(GLenum target,
11586                                             GLenum attachment,
11587                                             GLenum textarget,
11588                                             GLuint texture,
11589                                             GLint level)
11590 {
11591     Context *context = GetValidGlobalContext();
11592     EVENT(context, GLFramebufferTexture2DOES,
11593           "context = %d, target = %s, attachment = %s, textarget = %s, texture = %u, level = %d",
11594           CID(context), GLenumToString(GLESEnum::FramebufferTarget, target),
11595           GLenumToString(GLESEnum::FramebufferAttachment, attachment),
11596           GLenumToString(GLESEnum::TextureTarget, textarget), texture, level);
11597 
11598     if (context)
11599     {
11600         TextureTarget textargetPacked = PackParam<TextureTarget>(textarget);
11601         TextureID texturePacked       = PackParam<TextureID>(texture);
11602         SCOPED_SHARE_CONTEXT_LOCK(context);
11603         bool isCallValid =
11604             (context->skipValidation() ||
11605              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
11606                                                 context->getMutableErrorSetForValidation(),
11607                                                 angle::EntryPoint::GLFramebufferTexture2DOES) &&
11608               ValidateFramebufferTexture2DOES(context, angle::EntryPoint::GLFramebufferTexture2DOES,
11609                                               target, attachment, textargetPacked, texturePacked,
11610                                               level)));
11611         if (isCallValid)
11612         {
11613             context->framebufferTexture2D(target, attachment, textargetPacked, texturePacked,
11614                                           level);
11615         }
11616         ANGLE_CAPTURE_GL(FramebufferTexture2DOES, isCallValid, context, target, attachment,
11617                          textargetPacked, texturePacked, level);
11618     }
11619     else
11620     {
11621         GenerateContextLostErrorOnCurrentGlobalContext();
11622     }
11623     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11624 }
11625 
GL_GenFramebuffersOES(GLsizei n,GLuint * framebuffers)11626 void GL_APIENTRY GL_GenFramebuffersOES(GLsizei n, GLuint *framebuffers)
11627 {
11628     Context *context = GetValidGlobalContext();
11629     EVENT(context, GLGenFramebuffersOES, "context = %d, n = %d, framebuffers = 0x%016" PRIxPTR "",
11630           CID(context), n, (uintptr_t)framebuffers);
11631 
11632     if (context)
11633     {
11634         FramebufferID *framebuffersPacked = PackParam<FramebufferID *>(framebuffers);
11635         SCOPED_SHARE_CONTEXT_LOCK(context);
11636         bool isCallValid =
11637             (context->skipValidation() ||
11638              ValidateGenFramebuffersOES(context, angle::EntryPoint::GLGenFramebuffersOES, n,
11639                                         framebuffersPacked));
11640         if (isCallValid)
11641         {
11642             context->genFramebuffers(n, framebuffersPacked);
11643         }
11644         ANGLE_CAPTURE_GL(GenFramebuffersOES, isCallValid, context, n, framebuffersPacked);
11645     }
11646     else
11647     {
11648         GenerateContextLostErrorOnCurrentGlobalContext();
11649     }
11650     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11651 }
11652 
GL_GenRenderbuffersOES(GLsizei n,GLuint * renderbuffers)11653 void GL_APIENTRY GL_GenRenderbuffersOES(GLsizei n, GLuint *renderbuffers)
11654 {
11655     Context *context = GetValidGlobalContext();
11656     EVENT(context, GLGenRenderbuffersOES, "context = %d, n = %d, renderbuffers = 0x%016" PRIxPTR "",
11657           CID(context), n, (uintptr_t)renderbuffers);
11658 
11659     if (context)
11660     {
11661         RenderbufferID *renderbuffersPacked = PackParam<RenderbufferID *>(renderbuffers);
11662         SCOPED_SHARE_CONTEXT_LOCK(context);
11663         bool isCallValid =
11664             (context->skipValidation() ||
11665              ValidateGenRenderbuffersOES(context, angle::EntryPoint::GLGenRenderbuffersOES, n,
11666                                          renderbuffersPacked));
11667         if (isCallValid)
11668         {
11669             context->genRenderbuffers(n, renderbuffersPacked);
11670         }
11671         ANGLE_CAPTURE_GL(GenRenderbuffersOES, isCallValid, context, n, renderbuffersPacked);
11672     }
11673     else
11674     {
11675         GenerateContextLostErrorOnCurrentGlobalContext();
11676     }
11677     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11678 }
11679 
GL_GenerateMipmapOES(GLenum target)11680 void GL_APIENTRY GL_GenerateMipmapOES(GLenum target)
11681 {
11682     Context *context = GetValidGlobalContext();
11683     EVENT(context, GLGenerateMipmapOES, "context = %d, target = %s", CID(context),
11684           GLenumToString(GLESEnum::TextureTarget, target));
11685 
11686     if (context)
11687     {
11688         TextureType targetPacked = PackParam<TextureType>(target);
11689         SCOPED_SHARE_CONTEXT_LOCK(context);
11690         bool isCallValid = (context->skipValidation() ||
11691                             ValidateGenerateMipmapOES(
11692                                 context, angle::EntryPoint::GLGenerateMipmapOES, targetPacked));
11693         if (isCallValid)
11694         {
11695             context->generateMipmap(targetPacked);
11696         }
11697         ANGLE_CAPTURE_GL(GenerateMipmapOES, isCallValid, context, targetPacked);
11698     }
11699     else
11700     {
11701         GenerateContextLostErrorOnCurrentGlobalContext();
11702     }
11703     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11704 }
11705 
GL_GetFramebufferAttachmentParameterivOES(GLenum target,GLenum attachment,GLenum pname,GLint * params)11706 void GL_APIENTRY GL_GetFramebufferAttachmentParameterivOES(GLenum target,
11707                                                            GLenum attachment,
11708                                                            GLenum pname,
11709                                                            GLint *params)
11710 {
11711     Context *context = GetValidGlobalContext();
11712     EVENT(context, GLGetFramebufferAttachmentParameterivOES,
11713           "context = %d, target = %s, attachment = %s, pname = %s, params = 0x%016" PRIxPTR "",
11714           CID(context), GLenumToString(GLESEnum::FramebufferTarget, target),
11715           GLenumToString(GLESEnum::FramebufferAttachment, attachment),
11716           GLenumToString(GLESEnum::FramebufferAttachmentParameterName, pname), (uintptr_t)params);
11717 
11718     if (context)
11719     {
11720         SCOPED_SHARE_CONTEXT_LOCK(context);
11721         bool isCallValid =
11722             (context->skipValidation() ||
11723              ValidateGetFramebufferAttachmentParameterivOES(
11724                  context, angle::EntryPoint::GLGetFramebufferAttachmentParameterivOES, target,
11725                  attachment, pname, params));
11726         if (isCallValid)
11727         {
11728             context->getFramebufferAttachmentParameteriv(target, attachment, pname, params);
11729         }
11730         ANGLE_CAPTURE_GL(GetFramebufferAttachmentParameterivOES, isCallValid, context, target,
11731                          attachment, pname, params);
11732     }
11733     else
11734     {
11735         GenerateContextLostErrorOnCurrentGlobalContext();
11736     }
11737     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11738 }
11739 
GL_GetRenderbufferParameterivOES(GLenum target,GLenum pname,GLint * params)11740 void GL_APIENTRY GL_GetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint *params)
11741 {
11742     Context *context = GetValidGlobalContext();
11743     EVENT(context, GLGetRenderbufferParameterivOES,
11744           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
11745           GLenumToString(GLESEnum::RenderbufferTarget, target),
11746           GLenumToString(GLESEnum::RenderbufferParameterName, pname), (uintptr_t)params);
11747 
11748     if (context)
11749     {
11750         SCOPED_SHARE_CONTEXT_LOCK(context);
11751         bool isCallValid = (context->skipValidation() ||
11752                             ValidateGetRenderbufferParameterivOES(
11753                                 context, angle::EntryPoint::GLGetRenderbufferParameterivOES, target,
11754                                 pname, params));
11755         if (isCallValid)
11756         {
11757             context->getRenderbufferParameteriv(target, pname, params);
11758         }
11759         ANGLE_CAPTURE_GL(GetRenderbufferParameterivOES, isCallValid, context, target, pname,
11760                          params);
11761     }
11762     else
11763     {
11764         GenerateContextLostErrorOnCurrentGlobalContext();
11765     }
11766     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11767 }
11768 
GL_IsFramebufferOES(GLuint framebuffer)11769 GLboolean GL_APIENTRY GL_IsFramebufferOES(GLuint framebuffer)
11770 {
11771     Context *context = GetValidGlobalContext();
11772     EVENT(context, GLIsFramebufferOES, "context = %d, framebuffer = %u", CID(context), framebuffer);
11773 
11774     GLboolean returnValue;
11775     if (context)
11776     {
11777         FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
11778         SCOPED_SHARE_CONTEXT_LOCK(context);
11779         bool isCallValid = (context->skipValidation() ||
11780                             ValidateIsFramebufferOES(context, angle::EntryPoint::GLIsFramebufferOES,
11781                                                      framebufferPacked));
11782         if (isCallValid)
11783         {
11784             returnValue = context->isFramebuffer(framebufferPacked);
11785         }
11786         else
11787         {
11788             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsFramebufferOES, GLboolean>();
11789         }
11790         ANGLE_CAPTURE_GL(IsFramebufferOES, isCallValid, context, framebufferPacked, returnValue);
11791     }
11792     else
11793     {
11794         GenerateContextLostErrorOnCurrentGlobalContext();
11795         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsFramebufferOES, GLboolean>();
11796     }
11797     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11798     return returnValue;
11799 }
11800 
GL_IsRenderbufferOES(GLuint renderbuffer)11801 GLboolean GL_APIENTRY GL_IsRenderbufferOES(GLuint renderbuffer)
11802 {
11803     Context *context = GetValidGlobalContext();
11804     EVENT(context, GLIsRenderbufferOES, "context = %d, renderbuffer = %u", CID(context),
11805           renderbuffer);
11806 
11807     GLboolean returnValue;
11808     if (context)
11809     {
11810         RenderbufferID renderbufferPacked = PackParam<RenderbufferID>(renderbuffer);
11811         SCOPED_SHARE_CONTEXT_LOCK(context);
11812         bool isCallValid =
11813             (context->skipValidation() ||
11814              ValidateIsRenderbufferOES(context, angle::EntryPoint::GLIsRenderbufferOES,
11815                                        renderbufferPacked));
11816         if (isCallValid)
11817         {
11818             returnValue = context->isRenderbuffer(renderbufferPacked);
11819         }
11820         else
11821         {
11822             returnValue =
11823                 GetDefaultReturnValue<angle::EntryPoint::GLIsRenderbufferOES, GLboolean>();
11824         }
11825         ANGLE_CAPTURE_GL(IsRenderbufferOES, isCallValid, context, renderbufferPacked, returnValue);
11826     }
11827     else
11828     {
11829         GenerateContextLostErrorOnCurrentGlobalContext();
11830         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsRenderbufferOES, GLboolean>();
11831     }
11832     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11833     return returnValue;
11834 }
11835 
GL_RenderbufferStorageOES(GLenum target,GLenum internalformat,GLsizei width,GLsizei height)11836 void GL_APIENTRY GL_RenderbufferStorageOES(GLenum target,
11837                                            GLenum internalformat,
11838                                            GLsizei width,
11839                                            GLsizei height)
11840 {
11841     Context *context = GetValidGlobalContext();
11842     EVENT(context, GLRenderbufferStorageOES,
11843           "context = %d, target = %s, internalformat = %s, width = %d, height = %d", CID(context),
11844           GLenumToString(GLESEnum::RenderbufferTarget, target),
11845           GLenumToString(GLESEnum::InternalFormat, internalformat), width, height);
11846 
11847     if (context)
11848     {
11849         SCOPED_SHARE_CONTEXT_LOCK(context);
11850         bool isCallValid =
11851             (context->skipValidation() ||
11852              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
11853                                                 context->getMutableErrorSetForValidation(),
11854                                                 angle::EntryPoint::GLRenderbufferStorageOES) &&
11855               ValidateRenderbufferStorageOES(context, angle::EntryPoint::GLRenderbufferStorageOES,
11856                                              target, internalformat, width, height)));
11857         if (isCallValid)
11858         {
11859             context->renderbufferStorage(target, internalformat, width, height);
11860         }
11861         ANGLE_CAPTURE_GL(RenderbufferStorageOES, isCallValid, context, target, internalformat,
11862                          width, height);
11863     }
11864     else
11865     {
11866         GenerateContextLostErrorOnCurrentGlobalContext();
11867     }
11868     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11869 }
11870 
11871 // GL_OES_geometry_shader
GL_FramebufferTextureOES(GLenum target,GLenum attachment,GLuint texture,GLint level)11872 void GL_APIENTRY GL_FramebufferTextureOES(GLenum target,
11873                                           GLenum attachment,
11874                                           GLuint texture,
11875                                           GLint level)
11876 {
11877     Context *context = GetValidGlobalContext();
11878     EVENT(context, GLFramebufferTextureOES,
11879           "context = %d, target = %s, attachment = %s, texture = %u, level = %d", CID(context),
11880           GLenumToString(GLESEnum::FramebufferTarget, target),
11881           GLenumToString(GLESEnum::FramebufferAttachment, attachment), texture, level);
11882 
11883     if (context)
11884     {
11885         TextureID texturePacked = PackParam<TextureID>(texture);
11886         SCOPED_SHARE_CONTEXT_LOCK(context);
11887         bool isCallValid =
11888             (context->skipValidation() ||
11889              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
11890                                                 context->getMutableErrorSetForValidation(),
11891                                                 angle::EntryPoint::GLFramebufferTextureOES) &&
11892               ValidateFramebufferTextureOES(context, angle::EntryPoint::GLFramebufferTextureOES,
11893                                             target, attachment, texturePacked, level)));
11894         if (isCallValid)
11895         {
11896             context->framebufferTexture(target, attachment, texturePacked, level);
11897         }
11898         ANGLE_CAPTURE_GL(FramebufferTextureOES, isCallValid, context, target, attachment,
11899                          texturePacked, level);
11900     }
11901     else
11902     {
11903         GenerateContextLostErrorOnCurrentGlobalContext();
11904     }
11905     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11906 }
11907 
11908 // GL_OES_get_program_binary
GL_GetProgramBinaryOES(GLuint program,GLsizei bufSize,GLsizei * length,GLenum * binaryFormat,void * binary)11909 void GL_APIENTRY GL_GetProgramBinaryOES(GLuint program,
11910                                         GLsizei bufSize,
11911                                         GLsizei *length,
11912                                         GLenum *binaryFormat,
11913                                         void *binary)
11914 {
11915     Context *context = GetValidGlobalContext();
11916     EVENT(context, GLGetProgramBinaryOES,
11917           "context = %d, program = %u, bufSize = %d, length = 0x%016" PRIxPTR
11918           ", binaryFormat = 0x%016" PRIxPTR ", binary = 0x%016" PRIxPTR "",
11919           CID(context), program, bufSize, (uintptr_t)length, (uintptr_t)binaryFormat,
11920           (uintptr_t)binary);
11921 
11922     if (context)
11923     {
11924         ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
11925         SCOPED_SHARE_CONTEXT_LOCK(context);
11926         bool isCallValid =
11927             (context->skipValidation() ||
11928              ValidateGetProgramBinaryOES(context, angle::EntryPoint::GLGetProgramBinaryOES,
11929                                          programPacked, bufSize, length, binaryFormat, binary));
11930         if (isCallValid)
11931         {
11932             context->getProgramBinary(programPacked, bufSize, length, binaryFormat, binary);
11933         }
11934         ANGLE_CAPTURE_GL(GetProgramBinaryOES, isCallValid, context, programPacked, bufSize, length,
11935                          binaryFormat, binary);
11936     }
11937     else
11938     {
11939         GenerateContextLostErrorOnCurrentGlobalContext();
11940     }
11941     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11942 }
11943 
GL_ProgramBinaryOES(GLuint program,GLenum binaryFormat,const void * binary,GLint length)11944 void GL_APIENTRY GL_ProgramBinaryOES(GLuint program,
11945                                      GLenum binaryFormat,
11946                                      const void *binary,
11947                                      GLint length)
11948 {
11949     Context *context = GetValidGlobalContext();
11950     EVENT(context, GLProgramBinaryOES,
11951           "context = %d, program = %u, binaryFormat = %s, binary = 0x%016" PRIxPTR ", length = %d",
11952           CID(context), program, GLenumToString(GLESEnum::AllEnums, binaryFormat),
11953           (uintptr_t)binary, length);
11954 
11955     if (context)
11956     {
11957         ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
11958         SCOPED_SHARE_CONTEXT_LOCK(context);
11959         bool isCallValid =
11960             (context->skipValidation() ||
11961              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
11962                                                 context->getMutableErrorSetForValidation(),
11963                                                 angle::EntryPoint::GLProgramBinaryOES) &&
11964               ValidateProgramBinaryOES(context, angle::EntryPoint::GLProgramBinaryOES,
11965                                        programPacked, binaryFormat, binary, length)));
11966         if (isCallValid)
11967         {
11968             context->programBinary(programPacked, binaryFormat, binary, length);
11969         }
11970         ANGLE_CAPTURE_GL(ProgramBinaryOES, isCallValid, context, programPacked, binaryFormat,
11971                          binary, length);
11972     }
11973     else
11974     {
11975         GenerateContextLostErrorOnCurrentGlobalContext();
11976     }
11977     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
11978 }
11979 
11980 // GL_OES_mapbuffer
GL_GetBufferPointervOES(GLenum target,GLenum pname,void ** params)11981 void GL_APIENTRY GL_GetBufferPointervOES(GLenum target, GLenum pname, void **params)
11982 {
11983     Context *context = GetValidGlobalContext();
11984     EVENT(context, GLGetBufferPointervOES,
11985           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
11986           GLenumToString(GLESEnum::BufferTargetARB, target),
11987           GLenumToString(GLESEnum::AllEnums, pname), (uintptr_t)params);
11988 
11989     if (context)
11990     {
11991         BufferBinding targetPacked = PackParam<BufferBinding>(target);
11992         SCOPED_SHARE_CONTEXT_LOCK(context);
11993         bool isCallValid =
11994             (context->skipValidation() ||
11995              ValidateGetBufferPointervOES(context, angle::EntryPoint::GLGetBufferPointervOES,
11996                                           targetPacked, pname, params));
11997         if (isCallValid)
11998         {
11999             context->getBufferPointerv(targetPacked, pname, params);
12000         }
12001         ANGLE_CAPTURE_GL(GetBufferPointervOES, isCallValid, context, targetPacked, pname, params);
12002     }
12003     else
12004     {
12005         GenerateContextLostErrorOnCurrentGlobalContext();
12006     }
12007     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12008 }
12009 
GL_MapBufferOES(GLenum target,GLenum access)12010 void *GL_APIENTRY GL_MapBufferOES(GLenum target, GLenum access)
12011 {
12012     Context *context = GetValidGlobalContext();
12013     EVENT(context, GLMapBufferOES, "context = %d, target = %s, access = %s", CID(context),
12014           GLenumToString(GLESEnum::BufferTargetARB, target),
12015           GLenumToString(GLESEnum::BufferAccessARB, access));
12016 
12017     void *returnValue;
12018     if (context)
12019     {
12020         BufferBinding targetPacked = PackParam<BufferBinding>(target);
12021         SCOPED_SHARE_CONTEXT_LOCK(context);
12022         bool isCallValid =
12023             (context->skipValidation() ||
12024              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
12025                                                 context->getMutableErrorSetForValidation(),
12026                                                 angle::EntryPoint::GLMapBufferOES) &&
12027               ValidateMapBufferOES(context, angle::EntryPoint::GLMapBufferOES, targetPacked,
12028                                    access)));
12029         if (isCallValid)
12030         {
12031             returnValue = context->mapBuffer(targetPacked, access);
12032         }
12033         else
12034         {
12035             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapBufferOES, void *>();
12036         }
12037         ANGLE_CAPTURE_GL(MapBufferOES, isCallValid, context, targetPacked, access, returnValue);
12038     }
12039     else
12040     {
12041         GenerateContextLostErrorOnCurrentGlobalContext();
12042         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapBufferOES, void *>();
12043     }
12044     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12045     return returnValue;
12046 }
12047 
GL_UnmapBufferOES(GLenum target)12048 GLboolean GL_APIENTRY GL_UnmapBufferOES(GLenum target)
12049 {
12050     Context *context = GetValidGlobalContext();
12051     EVENT(context, GLUnmapBufferOES, "context = %d, target = %s", CID(context),
12052           GLenumToString(GLESEnum::AllEnums, target));
12053 
12054     GLboolean returnValue;
12055     if (context)
12056     {
12057         BufferBinding targetPacked = PackParam<BufferBinding>(target);
12058         SCOPED_SHARE_CONTEXT_LOCK(context);
12059         bool isCallValid =
12060             (context->skipValidation() ||
12061              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
12062                                                 context->getMutableErrorSetForValidation(),
12063                                                 angle::EntryPoint::GLUnmapBufferOES) &&
12064               ValidateUnmapBufferOES(context, angle::EntryPoint::GLUnmapBufferOES, targetPacked)));
12065         if (isCallValid)
12066         {
12067             returnValue = context->unmapBuffer(targetPacked);
12068         }
12069         else
12070         {
12071             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLUnmapBufferOES, GLboolean>();
12072         }
12073         ANGLE_CAPTURE_GL(UnmapBufferOES, isCallValid, context, targetPacked, returnValue);
12074     }
12075     else
12076     {
12077         GenerateContextLostErrorOnCurrentGlobalContext();
12078         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLUnmapBufferOES, GLboolean>();
12079     }
12080     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12081     return returnValue;
12082 }
12083 
12084 // GL_OES_matrix_palette
GL_CurrentPaletteMatrixOES(GLuint matrixpaletteindex)12085 void GL_APIENTRY GL_CurrentPaletteMatrixOES(GLuint matrixpaletteindex)
12086 {
12087     Context *context = GetValidGlobalContext();
12088     EVENT(context, GLCurrentPaletteMatrixOES, "context = %d, matrixpaletteindex = %u", CID(context),
12089           matrixpaletteindex);
12090 
12091     if (context)
12092     {
12093         SCOPED_SHARE_CONTEXT_LOCK(context);
12094         bool isCallValid =
12095             (context->skipValidation() ||
12096              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
12097                                                 context->getMutableErrorSetForValidation(),
12098                                                 angle::EntryPoint::GLCurrentPaletteMatrixOES) &&
12099               ValidateCurrentPaletteMatrixOES(context, angle::EntryPoint::GLCurrentPaletteMatrixOES,
12100                                               matrixpaletteindex)));
12101         if (isCallValid)
12102         {
12103             context->currentPaletteMatrix(matrixpaletteindex);
12104         }
12105         ANGLE_CAPTURE_GL(CurrentPaletteMatrixOES, isCallValid, context, matrixpaletteindex);
12106     }
12107     else
12108     {
12109         GenerateContextLostErrorOnCurrentGlobalContext();
12110     }
12111     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12112 }
12113 
GL_LoadPaletteFromModelViewMatrixOES()12114 void GL_APIENTRY GL_LoadPaletteFromModelViewMatrixOES()
12115 {
12116     Context *context = GetValidGlobalContext();
12117     EVENT(context, GLLoadPaletteFromModelViewMatrixOES, "context = %d", CID(context));
12118 
12119     if (context)
12120     {
12121         SCOPED_SHARE_CONTEXT_LOCK(context);
12122         bool isCallValid =
12123             (context->skipValidation() ||
12124              (ValidatePixelLocalStorageInactive(
12125                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
12126                   angle::EntryPoint::GLLoadPaletteFromModelViewMatrixOES) &&
12127               ValidateLoadPaletteFromModelViewMatrixOES(
12128                   context, angle::EntryPoint::GLLoadPaletteFromModelViewMatrixOES)));
12129         if (isCallValid)
12130         {
12131             context->loadPaletteFromModelViewMatrix();
12132         }
12133         ANGLE_CAPTURE_GL(LoadPaletteFromModelViewMatrixOES, isCallValid, context);
12134     }
12135     else
12136     {
12137         GenerateContextLostErrorOnCurrentGlobalContext();
12138     }
12139     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12140 }
12141 
GL_MatrixIndexPointerOES(GLint size,GLenum type,GLsizei stride,const void * pointer)12142 void GL_APIENTRY GL_MatrixIndexPointerOES(GLint size,
12143                                           GLenum type,
12144                                           GLsizei stride,
12145                                           const void *pointer)
12146 {
12147     Context *context = GetValidGlobalContext();
12148     EVENT(context, GLMatrixIndexPointerOES,
12149           "context = %d, size = %d, type = %s, stride = %d, pointer = 0x%016" PRIxPTR "",
12150           CID(context), size, GLenumToString(GLESEnum::AllEnums, type), stride, (uintptr_t)pointer);
12151 
12152     if (context)
12153     {
12154         SCOPED_SHARE_CONTEXT_LOCK(context);
12155         bool isCallValid =
12156             (context->skipValidation() ||
12157              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
12158                                                 context->getMutableErrorSetForValidation(),
12159                                                 angle::EntryPoint::GLMatrixIndexPointerOES) &&
12160               ValidateMatrixIndexPointerOES(context, angle::EntryPoint::GLMatrixIndexPointerOES,
12161                                             size, type, stride, pointer)));
12162         if (isCallValid)
12163         {
12164             context->matrixIndexPointer(size, type, stride, pointer);
12165         }
12166         ANGLE_CAPTURE_GL(MatrixIndexPointerOES, isCallValid, context, size, type, stride, pointer);
12167     }
12168     else
12169     {
12170         GenerateContextLostErrorOnCurrentGlobalContext();
12171     }
12172     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12173 }
12174 
GL_WeightPointerOES(GLint size,GLenum type,GLsizei stride,const void * pointer)12175 void GL_APIENTRY GL_WeightPointerOES(GLint size, GLenum type, GLsizei stride, const void *pointer)
12176 {
12177     Context *context = GetValidGlobalContext();
12178     EVENT(context, GLWeightPointerOES,
12179           "context = %d, size = %d, type = %s, stride = %d, pointer = 0x%016" PRIxPTR "",
12180           CID(context), size, GLenumToString(GLESEnum::AllEnums, type), stride, (uintptr_t)pointer);
12181 
12182     if (context)
12183     {
12184         SCOPED_SHARE_CONTEXT_LOCK(context);
12185         bool isCallValid =
12186             (context->skipValidation() ||
12187              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
12188                                                 context->getMutableErrorSetForValidation(),
12189                                                 angle::EntryPoint::GLWeightPointerOES) &&
12190               ValidateWeightPointerOES(context, angle::EntryPoint::GLWeightPointerOES, size, type,
12191                                        stride, pointer)));
12192         if (isCallValid)
12193         {
12194             context->weightPointer(size, type, stride, pointer);
12195         }
12196         ANGLE_CAPTURE_GL(WeightPointerOES, isCallValid, context, size, type, stride, pointer);
12197     }
12198     else
12199     {
12200         GenerateContextLostErrorOnCurrentGlobalContext();
12201     }
12202     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12203 }
12204 
12205 // GL_OES_packed_depth_stencil
12206 
12207 // GL_OES_point_size_array
GL_PointSizePointerOES(GLenum type,GLsizei stride,const void * pointer)12208 void GL_APIENTRY GL_PointSizePointerOES(GLenum type, GLsizei stride, const void *pointer)
12209 {
12210     Context *context = GetValidGlobalContext();
12211     EVENT(context, GLPointSizePointerOES,
12212           "context = %d, type = %s, stride = %d, pointer = 0x%016" PRIxPTR "", CID(context),
12213           GLenumToString(GLESEnum::AllEnums, type), stride, (uintptr_t)pointer);
12214 
12215     if (context)
12216     {
12217         VertexAttribType typePacked = PackParam<VertexAttribType>(type);
12218         SCOPED_SHARE_CONTEXT_LOCK(context);
12219         bool isCallValid =
12220             (context->skipValidation() ||
12221              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
12222                                                 context->getMutableErrorSetForValidation(),
12223                                                 angle::EntryPoint::GLPointSizePointerOES) &&
12224               ValidatePointSizePointerOES(context, angle::EntryPoint::GLPointSizePointerOES,
12225                                           typePacked, stride, pointer)));
12226         if (isCallValid)
12227         {
12228             context->pointSizePointer(typePacked, stride, pointer);
12229         }
12230         ANGLE_CAPTURE_GL(PointSizePointerOES, isCallValid, context, typePacked, stride, pointer);
12231     }
12232     else
12233     {
12234         GenerateContextLostErrorOnCurrentGlobalContext();
12235     }
12236     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12237 }
12238 
12239 // GL_OES_point_sprite
12240 
12241 // GL_OES_primitive_bounding_box
GL_PrimitiveBoundingBoxOES(GLfloat minX,GLfloat minY,GLfloat minZ,GLfloat minW,GLfloat maxX,GLfloat maxY,GLfloat maxZ,GLfloat maxW)12242 void GL_APIENTRY GL_PrimitiveBoundingBoxOES(GLfloat minX,
12243                                             GLfloat minY,
12244                                             GLfloat minZ,
12245                                             GLfloat minW,
12246                                             GLfloat maxX,
12247                                             GLfloat maxY,
12248                                             GLfloat maxZ,
12249                                             GLfloat maxW)
12250 {
12251     Context *context = GetValidGlobalContext();
12252     EVENT(context, GLPrimitiveBoundingBoxOES,
12253           "context = %d, minX = %f, minY = %f, minZ = %f, minW = %f, maxX = %f, maxY = %f, maxZ = "
12254           "%f, maxW = %f",
12255           CID(context), minX, minY, minZ, minW, maxX, maxY, maxZ, maxW);
12256 
12257     if (context)
12258     {
12259         bool isCallValid =
12260             (context->skipValidation() ||
12261              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
12262                                                 context->getMutableErrorSetForValidation(),
12263                                                 angle::EntryPoint::GLPrimitiveBoundingBoxOES) &&
12264               ValidatePrimitiveBoundingBoxOES(context->getPrivateState(),
12265                                               context->getMutableErrorSetForValidation(),
12266                                               angle::EntryPoint::GLPrimitiveBoundingBoxOES, minX,
12267                                               minY, minZ, minW, maxX, maxY, maxZ, maxW)));
12268         if (isCallValid)
12269         {
12270             ContextPrivatePrimitiveBoundingBox(context->getMutablePrivateState(),
12271                                                context->getMutablePrivateStateCache(), minX, minY,
12272                                                minZ, minW, maxX, maxY, maxZ, maxW);
12273         }
12274         ANGLE_CAPTURE_GL(PrimitiveBoundingBoxOES, isCallValid, context, minX, minY, minZ, minW,
12275                          maxX, maxY, maxZ, maxW);
12276     }
12277     else
12278     {
12279         GenerateContextLostErrorOnCurrentGlobalContext();
12280     }
12281     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12282 }
12283 
12284 // GL_OES_query_matrix
GL_QueryMatrixxOES(GLfixed * mantissa,GLint * exponent)12285 GLbitfield GL_APIENTRY GL_QueryMatrixxOES(GLfixed *mantissa, GLint *exponent)
12286 {
12287     Context *context = GetValidGlobalContext();
12288     EVENT(context, GLQueryMatrixxOES,
12289           "context = %d, mantissa = 0x%016" PRIxPTR ", exponent = 0x%016" PRIxPTR "", CID(context),
12290           (uintptr_t)mantissa, (uintptr_t)exponent);
12291 
12292     GLbitfield returnValue;
12293     if (context)
12294     {
12295         SCOPED_SHARE_CONTEXT_LOCK(context);
12296         bool isCallValid =
12297             (context->skipValidation() ||
12298              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
12299                                                 context->getMutableErrorSetForValidation(),
12300                                                 angle::EntryPoint::GLQueryMatrixxOES) &&
12301               ValidateQueryMatrixxOES(context, angle::EntryPoint::GLQueryMatrixxOES, mantissa,
12302                                       exponent)));
12303         if (isCallValid)
12304         {
12305             returnValue = context->queryMatrixx(mantissa, exponent);
12306         }
12307         else
12308         {
12309             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLQueryMatrixxOES, GLbitfield>();
12310         }
12311         ANGLE_CAPTURE_GL(QueryMatrixxOES, isCallValid, context, mantissa, exponent, returnValue);
12312     }
12313     else
12314     {
12315         GenerateContextLostErrorOnCurrentGlobalContext();
12316         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLQueryMatrixxOES, GLbitfield>();
12317     }
12318     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12319     return returnValue;
12320 }
12321 
12322 // GL_OES_rgb8_rgba8
12323 
12324 // GL_OES_sample_shading
GL_MinSampleShadingOES(GLfloat value)12325 void GL_APIENTRY GL_MinSampleShadingOES(GLfloat value)
12326 {
12327     Context *context = GetValidGlobalContext();
12328     EVENT(context, GLMinSampleShadingOES, "context = %d, value = %f", CID(context), value);
12329 
12330     if (context)
12331     {
12332         bool isCallValid =
12333             (context->skipValidation() ||
12334              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
12335                                                 context->getMutableErrorSetForValidation(),
12336                                                 angle::EntryPoint::GLMinSampleShadingOES) &&
12337               ValidateMinSampleShadingOES(context->getPrivateState(),
12338                                           context->getMutableErrorSetForValidation(),
12339                                           angle::EntryPoint::GLMinSampleShadingOES, value)));
12340         if (isCallValid)
12341         {
12342             ContextPrivateMinSampleShading(context->getMutablePrivateState(),
12343                                            context->getMutablePrivateStateCache(), value);
12344         }
12345         ANGLE_CAPTURE_GL(MinSampleShadingOES, isCallValid, context, value);
12346     }
12347     else
12348     {
12349         GenerateContextLostErrorOnCurrentGlobalContext();
12350     }
12351     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12352 }
12353 
12354 // GL_OES_sample_variables
12355 
12356 // GL_OES_shader_image_atomic
12357 
12358 // GL_OES_shader_io_blocks
12359 
12360 // GL_OES_shader_multisample_interpolation
12361 
12362 // GL_OES_standard_derivatives
12363 
12364 // GL_OES_surfaceless_context
12365 
12366 // GL_OES_texture_3D
GL_CompressedTexImage3DOES(GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLsizei imageSize,const void * data)12367 void GL_APIENTRY GL_CompressedTexImage3DOES(GLenum target,
12368                                             GLint level,
12369                                             GLenum internalformat,
12370                                             GLsizei width,
12371                                             GLsizei height,
12372                                             GLsizei depth,
12373                                             GLint border,
12374                                             GLsizei imageSize,
12375                                             const void *data)
12376 {
12377     Context *context = GetValidGlobalContext();
12378     EVENT(context, GLCompressedTexImage3DOES,
12379           "context = %d, target = %s, level = %d, internalformat = %s, width = %d, height = %d, "
12380           "depth = %d, border = %d, imageSize = %d, data = 0x%016" PRIxPTR "",
12381           CID(context), GLenumToString(GLESEnum::TextureTarget, target), level,
12382           GLenumToString(GLESEnum::InternalFormat, internalformat), width, height, depth, border,
12383           imageSize, (uintptr_t)data);
12384 
12385     if (context)
12386     {
12387         TextureTarget targetPacked = PackParam<TextureTarget>(target);
12388         SCOPED_SHARE_CONTEXT_LOCK(context);
12389         bool isCallValid =
12390             (context->skipValidation() ||
12391              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
12392                                                 context->getMutableErrorSetForValidation(),
12393                                                 angle::EntryPoint::GLCompressedTexImage3DOES) &&
12394               ValidateCompressedTexImage3DOES(context, angle::EntryPoint::GLCompressedTexImage3DOES,
12395                                               targetPacked, level, internalformat, width, height,
12396                                               depth, border, imageSize, data)));
12397         if (isCallValid)
12398         {
12399             context->compressedTexImage3D(targetPacked, level, internalformat, width, height, depth,
12400                                           border, imageSize, data);
12401         }
12402         ANGLE_CAPTURE_GL(CompressedTexImage3DOES, isCallValid, context, targetPacked, level,
12403                          internalformat, width, height, depth, border, imageSize, data);
12404     }
12405     else
12406     {
12407         GenerateContextLostErrorOnCurrentGlobalContext();
12408     }
12409     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12410 }
12411 
GL_CompressedTexSubImage3DOES(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLsizei imageSize,const void * data)12412 void GL_APIENTRY GL_CompressedTexSubImage3DOES(GLenum target,
12413                                                GLint level,
12414                                                GLint xoffset,
12415                                                GLint yoffset,
12416                                                GLint zoffset,
12417                                                GLsizei width,
12418                                                GLsizei height,
12419                                                GLsizei depth,
12420                                                GLenum format,
12421                                                GLsizei imageSize,
12422                                                const void *data)
12423 {
12424     Context *context = GetValidGlobalContext();
12425     EVENT(context, GLCompressedTexSubImage3DOES,
12426           "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width "
12427           "= %d, height = %d, depth = %d, format = %s, imageSize = %d, data = 0x%016" PRIxPTR "",
12428           CID(context), GLenumToString(GLESEnum::TextureTarget, target), level, xoffset, yoffset,
12429           zoffset, width, height, depth, GLenumToString(GLESEnum::InternalFormat, format),
12430           imageSize, (uintptr_t)data);
12431 
12432     if (context)
12433     {
12434         TextureTarget targetPacked = PackParam<TextureTarget>(target);
12435         SCOPED_SHARE_CONTEXT_LOCK(context);
12436         bool isCallValid =
12437             (context->skipValidation() ||
12438              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
12439                                                 context->getMutableErrorSetForValidation(),
12440                                                 angle::EntryPoint::GLCompressedTexSubImage3DOES) &&
12441               ValidateCompressedTexSubImage3DOES(
12442                   context, angle::EntryPoint::GLCompressedTexSubImage3DOES, targetPacked, level,
12443                   xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data)));
12444         if (isCallValid)
12445         {
12446             context->compressedTexSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, width,
12447                                              height, depth, format, imageSize, data);
12448         }
12449         ANGLE_CAPTURE_GL(CompressedTexSubImage3DOES, isCallValid, context, targetPacked, level,
12450                          xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
12451     }
12452     else
12453     {
12454         GenerateContextLostErrorOnCurrentGlobalContext();
12455     }
12456     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12457 }
12458 
GL_CopyTexSubImage3DOES(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLint x,GLint y,GLsizei width,GLsizei height)12459 void GL_APIENTRY GL_CopyTexSubImage3DOES(GLenum target,
12460                                          GLint level,
12461                                          GLint xoffset,
12462                                          GLint yoffset,
12463                                          GLint zoffset,
12464                                          GLint x,
12465                                          GLint y,
12466                                          GLsizei width,
12467                                          GLsizei height)
12468 {
12469     Context *context = GetValidGlobalContext();
12470     EVENT(context, GLCopyTexSubImage3DOES,
12471           "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, x = "
12472           "%d, y = %d, width = %d, height = %d",
12473           CID(context), GLenumToString(GLESEnum::AllEnums, target), level, xoffset, yoffset,
12474           zoffset, x, y, width, height);
12475 
12476     if (context)
12477     {
12478         TextureTarget targetPacked = PackParam<TextureTarget>(target);
12479         SCOPED_SHARE_CONTEXT_LOCK(context);
12480         bool isCallValid =
12481             (context->skipValidation() ||
12482              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
12483                                                 context->getMutableErrorSetForValidation(),
12484                                                 angle::EntryPoint::GLCopyTexSubImage3DOES) &&
12485               ValidateCopyTexSubImage3DOES(context, angle::EntryPoint::GLCopyTexSubImage3DOES,
12486                                            targetPacked, level, xoffset, yoffset, zoffset, x, y,
12487                                            width, height)));
12488         if (isCallValid)
12489         {
12490             context->copyTexSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, x, y, width,
12491                                        height);
12492         }
12493         ANGLE_CAPTURE_GL(CopyTexSubImage3DOES, isCallValid, context, targetPacked, level, xoffset,
12494                          yoffset, zoffset, x, y, width, height);
12495     }
12496     else
12497     {
12498         GenerateContextLostErrorOnCurrentGlobalContext();
12499     }
12500     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12501 }
12502 
GL_FramebufferTexture3DOES(GLenum target,GLenum attachment,GLenum textarget,GLuint texture,GLint level,GLint zoffset)12503 void GL_APIENTRY GL_FramebufferTexture3DOES(GLenum target,
12504                                             GLenum attachment,
12505                                             GLenum textarget,
12506                                             GLuint texture,
12507                                             GLint level,
12508                                             GLint zoffset)
12509 {
12510     Context *context = GetValidGlobalContext();
12511     EVENT(context, GLFramebufferTexture3DOES,
12512           "context = %d, target = %s, attachment = %s, textarget = %s, texture = %u, level = %d, "
12513           "zoffset = %d",
12514           CID(context), GLenumToString(GLESEnum::FramebufferTarget, target),
12515           GLenumToString(GLESEnum::FramebufferAttachment, attachment),
12516           GLenumToString(GLESEnum::TextureTarget, textarget), texture, level, zoffset);
12517 
12518     if (context)
12519     {
12520         TextureTarget textargetPacked = PackParam<TextureTarget>(textarget);
12521         TextureID texturePacked       = PackParam<TextureID>(texture);
12522         SCOPED_SHARE_CONTEXT_LOCK(context);
12523         bool isCallValid =
12524             (context->skipValidation() ||
12525              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
12526                                                 context->getMutableErrorSetForValidation(),
12527                                                 angle::EntryPoint::GLFramebufferTexture3DOES) &&
12528               ValidateFramebufferTexture3DOES(context, angle::EntryPoint::GLFramebufferTexture3DOES,
12529                                               target, attachment, textargetPacked, texturePacked,
12530                                               level, zoffset)));
12531         if (isCallValid)
12532         {
12533             context->framebufferTexture3D(target, attachment, textargetPacked, texturePacked, level,
12534                                           zoffset);
12535         }
12536         ANGLE_CAPTURE_GL(FramebufferTexture3DOES, isCallValid, context, target, attachment,
12537                          textargetPacked, texturePacked, level, zoffset);
12538     }
12539     else
12540     {
12541         GenerateContextLostErrorOnCurrentGlobalContext();
12542     }
12543     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12544 }
12545 
GL_TexImage3DOES(GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLenum format,GLenum type,const void * pixels)12546 void GL_APIENTRY GL_TexImage3DOES(GLenum target,
12547                                   GLint level,
12548                                   GLenum internalformat,
12549                                   GLsizei width,
12550                                   GLsizei height,
12551                                   GLsizei depth,
12552                                   GLint border,
12553                                   GLenum format,
12554                                   GLenum type,
12555                                   const void *pixels)
12556 {
12557     Context *context = GetValidGlobalContext();
12558     EVENT(context, GLTexImage3DOES,
12559           "context = %d, target = %s, level = %d, internalformat = %s, width = %d, height = %d, "
12560           "depth = %d, border = %d, format = %s, type = %s, pixels = 0x%016" PRIxPTR "",
12561           CID(context), GLenumToString(GLESEnum::TextureTarget, target), level,
12562           GLenumToString(GLESEnum::InternalFormat, internalformat), width, height, depth, border,
12563           GLenumToString(GLESEnum::PixelFormat, format), GLenumToString(GLESEnum::PixelType, type),
12564           (uintptr_t)pixels);
12565 
12566     if (context)
12567     {
12568         TextureTarget targetPacked = PackParam<TextureTarget>(target);
12569         SCOPED_SHARE_CONTEXT_LOCK(context);
12570         bool isCallValid =
12571             (context->skipValidation() ||
12572              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
12573                                                 context->getMutableErrorSetForValidation(),
12574                                                 angle::EntryPoint::GLTexImage3DOES) &&
12575               ValidateTexImage3DOES(context, angle::EntryPoint::GLTexImage3DOES, targetPacked,
12576                                     level, internalformat, width, height, depth, border, format,
12577                                     type, pixels)));
12578         if (isCallValid)
12579         {
12580             context->texImage3D(targetPacked, level, internalformat, width, height, depth, border,
12581                                 format, type, pixels);
12582         }
12583         ANGLE_CAPTURE_GL(TexImage3DOES, isCallValid, context, targetPacked, level, internalformat,
12584                          width, height, depth, border, format, type, pixels);
12585     }
12586     else
12587     {
12588         GenerateContextLostErrorOnCurrentGlobalContext();
12589     }
12590     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12591 }
12592 
GL_TexSubImage3DOES(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLenum type,const void * pixels)12593 void GL_APIENTRY GL_TexSubImage3DOES(GLenum target,
12594                                      GLint level,
12595                                      GLint xoffset,
12596                                      GLint yoffset,
12597                                      GLint zoffset,
12598                                      GLsizei width,
12599                                      GLsizei height,
12600                                      GLsizei depth,
12601                                      GLenum format,
12602                                      GLenum type,
12603                                      const void *pixels)
12604 {
12605     Context *context = GetValidGlobalContext();
12606     EVENT(context, GLTexSubImage3DOES,
12607           "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width "
12608           "= %d, height = %d, depth = %d, format = %s, type = %s, pixels = 0x%016" PRIxPTR "",
12609           CID(context), GLenumToString(GLESEnum::TextureTarget, target), level, xoffset, yoffset,
12610           zoffset, width, height, depth, GLenumToString(GLESEnum::PixelFormat, format),
12611           GLenumToString(GLESEnum::PixelType, type), (uintptr_t)pixels);
12612 
12613     if (context)
12614     {
12615         TextureTarget targetPacked = PackParam<TextureTarget>(target);
12616         SCOPED_SHARE_CONTEXT_LOCK(context);
12617         bool isCallValid =
12618             (context->skipValidation() ||
12619              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
12620                                                 context->getMutableErrorSetForValidation(),
12621                                                 angle::EntryPoint::GLTexSubImage3DOES) &&
12622               ValidateTexSubImage3DOES(context, angle::EntryPoint::GLTexSubImage3DOES, targetPacked,
12623                                        level, xoffset, yoffset, zoffset, width, height, depth,
12624                                        format, type, pixels)));
12625         if (isCallValid)
12626         {
12627             context->texSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, width, height,
12628                                    depth, format, type, pixels);
12629         }
12630         ANGLE_CAPTURE_GL(TexSubImage3DOES, isCallValid, context, targetPacked, level, xoffset,
12631                          yoffset, zoffset, width, height, depth, format, type, pixels);
12632     }
12633     else
12634     {
12635         GenerateContextLostErrorOnCurrentGlobalContext();
12636     }
12637     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12638 }
12639 
12640 // GL_OES_texture_border_clamp
GL_GetSamplerParameterIivOES(GLuint sampler,GLenum pname,GLint * params)12641 void GL_APIENTRY GL_GetSamplerParameterIivOES(GLuint sampler, GLenum pname, GLint *params)
12642 {
12643     Context *context = GetValidGlobalContext();
12644     EVENT(context, GLGetSamplerParameterIivOES,
12645           "context = %d, sampler = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
12646           sampler, GLenumToString(GLESEnum::SamplerParameterI, pname), (uintptr_t)params);
12647 
12648     if (context)
12649     {
12650         SamplerID samplerPacked = PackParam<SamplerID>(sampler);
12651         SCOPED_SHARE_CONTEXT_LOCK(context);
12652         bool isCallValid = (context->skipValidation() ||
12653                             ValidateGetSamplerParameterIivOES(
12654                                 context, angle::EntryPoint::GLGetSamplerParameterIivOES,
12655                                 samplerPacked, pname, params));
12656         if (isCallValid)
12657         {
12658             context->getSamplerParameterIiv(samplerPacked, pname, params);
12659         }
12660         ANGLE_CAPTURE_GL(GetSamplerParameterIivOES, isCallValid, context, samplerPacked, pname,
12661                          params);
12662     }
12663     else
12664     {
12665         GenerateContextLostErrorOnCurrentGlobalContext();
12666     }
12667     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12668 }
12669 
GL_GetSamplerParameterIuivOES(GLuint sampler,GLenum pname,GLuint * params)12670 void GL_APIENTRY GL_GetSamplerParameterIuivOES(GLuint sampler, GLenum pname, GLuint *params)
12671 {
12672     Context *context = GetValidGlobalContext();
12673     EVENT(context, GLGetSamplerParameterIuivOES,
12674           "context = %d, sampler = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
12675           sampler, GLenumToString(GLESEnum::SamplerParameterI, pname), (uintptr_t)params);
12676 
12677     if (context)
12678     {
12679         SamplerID samplerPacked = PackParam<SamplerID>(sampler);
12680         SCOPED_SHARE_CONTEXT_LOCK(context);
12681         bool isCallValid = (context->skipValidation() ||
12682                             ValidateGetSamplerParameterIuivOES(
12683                                 context, angle::EntryPoint::GLGetSamplerParameterIuivOES,
12684                                 samplerPacked, pname, params));
12685         if (isCallValid)
12686         {
12687             context->getSamplerParameterIuiv(samplerPacked, pname, params);
12688         }
12689         ANGLE_CAPTURE_GL(GetSamplerParameterIuivOES, isCallValid, context, samplerPacked, pname,
12690                          params);
12691     }
12692     else
12693     {
12694         GenerateContextLostErrorOnCurrentGlobalContext();
12695     }
12696     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12697 }
12698 
GL_GetTexParameterIivOES(GLenum target,GLenum pname,GLint * params)12699 void GL_APIENTRY GL_GetTexParameterIivOES(GLenum target, GLenum pname, GLint *params)
12700 {
12701     Context *context = GetValidGlobalContext();
12702     EVENT(context, GLGetTexParameterIivOES,
12703           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
12704           GLenumToString(GLESEnum::TextureTarget, target),
12705           GLenumToString(GLESEnum::GetTextureParameter, pname), (uintptr_t)params);
12706 
12707     if (context)
12708     {
12709         TextureType targetPacked = PackParam<TextureType>(target);
12710         SCOPED_SHARE_CONTEXT_LOCK(context);
12711         bool isCallValid =
12712             (context->skipValidation() ||
12713              ValidateGetTexParameterIivOES(context, angle::EntryPoint::GLGetTexParameterIivOES,
12714                                            targetPacked, pname, params));
12715         if (isCallValid)
12716         {
12717             context->getTexParameterIiv(targetPacked, pname, params);
12718         }
12719         ANGLE_CAPTURE_GL(GetTexParameterIivOES, isCallValid, context, targetPacked, pname, params);
12720     }
12721     else
12722     {
12723         GenerateContextLostErrorOnCurrentGlobalContext();
12724     }
12725     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12726 }
12727 
GL_GetTexParameterIuivOES(GLenum target,GLenum pname,GLuint * params)12728 void GL_APIENTRY GL_GetTexParameterIuivOES(GLenum target, GLenum pname, GLuint *params)
12729 {
12730     Context *context = GetValidGlobalContext();
12731     EVENT(context, GLGetTexParameterIuivOES,
12732           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
12733           GLenumToString(GLESEnum::TextureTarget, target),
12734           GLenumToString(GLESEnum::GetTextureParameter, pname), (uintptr_t)params);
12735 
12736     if (context)
12737     {
12738         TextureType targetPacked = PackParam<TextureType>(target);
12739         SCOPED_SHARE_CONTEXT_LOCK(context);
12740         bool isCallValid =
12741             (context->skipValidation() ||
12742              ValidateGetTexParameterIuivOES(context, angle::EntryPoint::GLGetTexParameterIuivOES,
12743                                             targetPacked, pname, params));
12744         if (isCallValid)
12745         {
12746             context->getTexParameterIuiv(targetPacked, pname, params);
12747         }
12748         ANGLE_CAPTURE_GL(GetTexParameterIuivOES, isCallValid, context, targetPacked, pname, params);
12749     }
12750     else
12751     {
12752         GenerateContextLostErrorOnCurrentGlobalContext();
12753     }
12754     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12755 }
12756 
GL_SamplerParameterIivOES(GLuint sampler,GLenum pname,const GLint * param)12757 void GL_APIENTRY GL_SamplerParameterIivOES(GLuint sampler, GLenum pname, const GLint *param)
12758 {
12759     Context *context = GetValidGlobalContext();
12760     EVENT(context, GLSamplerParameterIivOES,
12761           "context = %d, sampler = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
12762           sampler, GLenumToString(GLESEnum::SamplerParameterI, pname), (uintptr_t)param);
12763 
12764     if (context)
12765     {
12766         SamplerID samplerPacked = PackParam<SamplerID>(sampler);
12767         SCOPED_SHARE_CONTEXT_LOCK(context);
12768         bool isCallValid =
12769             (context->skipValidation() ||
12770              ValidateSamplerParameterIivOES(context, angle::EntryPoint::GLSamplerParameterIivOES,
12771                                             samplerPacked, pname, param));
12772         if (isCallValid)
12773         {
12774             context->samplerParameterIiv(samplerPacked, pname, param);
12775         }
12776         ANGLE_CAPTURE_GL(SamplerParameterIivOES, isCallValid, context, samplerPacked, pname, param);
12777     }
12778     else
12779     {
12780         GenerateContextLostErrorOnCurrentGlobalContext();
12781     }
12782     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12783 }
12784 
GL_SamplerParameterIuivOES(GLuint sampler,GLenum pname,const GLuint * param)12785 void GL_APIENTRY GL_SamplerParameterIuivOES(GLuint sampler, GLenum pname, const GLuint *param)
12786 {
12787     Context *context = GetValidGlobalContext();
12788     EVENT(context, GLSamplerParameterIuivOES,
12789           "context = %d, sampler = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
12790           sampler, GLenumToString(GLESEnum::SamplerParameterI, pname), (uintptr_t)param);
12791 
12792     if (context)
12793     {
12794         SamplerID samplerPacked = PackParam<SamplerID>(sampler);
12795         SCOPED_SHARE_CONTEXT_LOCK(context);
12796         bool isCallValid =
12797             (context->skipValidation() ||
12798              ValidateSamplerParameterIuivOES(context, angle::EntryPoint::GLSamplerParameterIuivOES,
12799                                              samplerPacked, pname, param));
12800         if (isCallValid)
12801         {
12802             context->samplerParameterIuiv(samplerPacked, pname, param);
12803         }
12804         ANGLE_CAPTURE_GL(SamplerParameterIuivOES, isCallValid, context, samplerPacked, pname,
12805                          param);
12806     }
12807     else
12808     {
12809         GenerateContextLostErrorOnCurrentGlobalContext();
12810     }
12811     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12812 }
12813 
GL_TexParameterIivOES(GLenum target,GLenum pname,const GLint * params)12814 void GL_APIENTRY GL_TexParameterIivOES(GLenum target, GLenum pname, const GLint *params)
12815 {
12816     Context *context = GetValidGlobalContext();
12817     EVENT(context, GLTexParameterIivOES,
12818           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
12819           GLenumToString(GLESEnum::TextureTarget, target),
12820           GLenumToString(GLESEnum::TextureParameterName, pname), (uintptr_t)params);
12821 
12822     if (context)
12823     {
12824         TextureType targetPacked = PackParam<TextureType>(target);
12825         SCOPED_SHARE_CONTEXT_LOCK(context);
12826         bool isCallValid =
12827             (context->skipValidation() ||
12828              ValidateTexParameterIivOES(context, angle::EntryPoint::GLTexParameterIivOES,
12829                                         targetPacked, pname, params));
12830         if (isCallValid)
12831         {
12832             context->texParameterIiv(targetPacked, pname, params);
12833         }
12834         ANGLE_CAPTURE_GL(TexParameterIivOES, isCallValid, context, targetPacked, pname, params);
12835     }
12836     else
12837     {
12838         GenerateContextLostErrorOnCurrentGlobalContext();
12839     }
12840     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12841 }
12842 
GL_TexParameterIuivOES(GLenum target,GLenum pname,const GLuint * params)12843 void GL_APIENTRY GL_TexParameterIuivOES(GLenum target, GLenum pname, const GLuint *params)
12844 {
12845     Context *context = GetValidGlobalContext();
12846     EVENT(context, GLTexParameterIuivOES,
12847           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
12848           GLenumToString(GLESEnum::TextureTarget, target),
12849           GLenumToString(GLESEnum::TextureParameterName, pname), (uintptr_t)params);
12850 
12851     if (context)
12852     {
12853         TextureType targetPacked = PackParam<TextureType>(target);
12854         SCOPED_SHARE_CONTEXT_LOCK(context);
12855         bool isCallValid =
12856             (context->skipValidation() ||
12857              ValidateTexParameterIuivOES(context, angle::EntryPoint::GLTexParameterIuivOES,
12858                                          targetPacked, pname, params));
12859         if (isCallValid)
12860         {
12861             context->texParameterIuiv(targetPacked, pname, params);
12862         }
12863         ANGLE_CAPTURE_GL(TexParameterIuivOES, isCallValid, context, targetPacked, pname, params);
12864     }
12865     else
12866     {
12867         GenerateContextLostErrorOnCurrentGlobalContext();
12868     }
12869     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12870 }
12871 
12872 // GL_OES_texture_buffer
GL_TexBufferOES(GLenum target,GLenum internalformat,GLuint buffer)12873 void GL_APIENTRY GL_TexBufferOES(GLenum target, GLenum internalformat, GLuint buffer)
12874 {
12875     Context *context = GetValidGlobalContext();
12876     EVENT(context, GLTexBufferOES, "context = %d, target = %s, internalformat = %s, buffer = %u",
12877           CID(context), GLenumToString(GLESEnum::TextureTarget, target),
12878           GLenumToString(GLESEnum::SizedInternalFormat, internalformat), buffer);
12879 
12880     if (context)
12881     {
12882         TextureType targetPacked = PackParam<TextureType>(target);
12883         BufferID bufferPacked    = PackParam<BufferID>(buffer);
12884         SCOPED_SHARE_CONTEXT_LOCK(context);
12885         bool isCallValid =
12886             (context->skipValidation() ||
12887              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
12888                                                 context->getMutableErrorSetForValidation(),
12889                                                 angle::EntryPoint::GLTexBufferOES) &&
12890               ValidateTexBufferOES(context, angle::EntryPoint::GLTexBufferOES, targetPacked,
12891                                    internalformat, bufferPacked)));
12892         if (isCallValid)
12893         {
12894             context->texBuffer(targetPacked, internalformat, bufferPacked);
12895         }
12896         ANGLE_CAPTURE_GL(TexBufferOES, isCallValid, context, targetPacked, internalformat,
12897                          bufferPacked);
12898     }
12899     else
12900     {
12901         GenerateContextLostErrorOnCurrentGlobalContext();
12902     }
12903     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12904 }
12905 
GL_TexBufferRangeOES(GLenum target,GLenum internalformat,GLuint buffer,GLintptr offset,GLsizeiptr size)12906 void GL_APIENTRY GL_TexBufferRangeOES(GLenum target,
12907                                       GLenum internalformat,
12908                                       GLuint buffer,
12909                                       GLintptr offset,
12910                                       GLsizeiptr size)
12911 {
12912     Context *context = GetValidGlobalContext();
12913     EVENT(context, GLTexBufferRangeOES,
12914           "context = %d, target = %s, internalformat = %s, buffer = %u, offset = %llu, size = %llu",
12915           CID(context), GLenumToString(GLESEnum::TextureTarget, target),
12916           GLenumToString(GLESEnum::SizedInternalFormat, internalformat), buffer,
12917           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size));
12918 
12919     if (context)
12920     {
12921         TextureType targetPacked = PackParam<TextureType>(target);
12922         BufferID bufferPacked    = PackParam<BufferID>(buffer);
12923         SCOPED_SHARE_CONTEXT_LOCK(context);
12924         bool isCallValid =
12925             (context->skipValidation() ||
12926              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
12927                                                 context->getMutableErrorSetForValidation(),
12928                                                 angle::EntryPoint::GLTexBufferRangeOES) &&
12929               ValidateTexBufferRangeOES(context, angle::EntryPoint::GLTexBufferRangeOES,
12930                                         targetPacked, internalformat, bufferPacked, offset, size)));
12931         if (isCallValid)
12932         {
12933             context->texBufferRange(targetPacked, internalformat, bufferPacked, offset, size);
12934         }
12935         ANGLE_CAPTURE_GL(TexBufferRangeOES, isCallValid, context, targetPacked, internalformat,
12936                          bufferPacked, offset, size);
12937     }
12938     else
12939     {
12940         GenerateContextLostErrorOnCurrentGlobalContext();
12941     }
12942     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12943 }
12944 
12945 // GL_OES_texture_compression_astc
12946 
12947 // GL_OES_texture_cube_map
GL_GetTexGenfvOES(GLenum coord,GLenum pname,GLfloat * params)12948 void GL_APIENTRY GL_GetTexGenfvOES(GLenum coord, GLenum pname, GLfloat *params)
12949 {
12950     Context *context = GetValidGlobalContext();
12951     EVENT(context, GLGetTexGenfvOES,
12952           "context = %d, coord = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
12953           GLenumToString(GLESEnum::TextureCoordName, coord),
12954           GLenumToString(GLESEnum::TextureGenParameter, pname), (uintptr_t)params);
12955 
12956     if (context)
12957     {
12958         SCOPED_SHARE_CONTEXT_LOCK(context);
12959         bool isCallValid = (context->skipValidation() ||
12960                             ValidateGetTexGenfvOES(context, angle::EntryPoint::GLGetTexGenfvOES,
12961                                                    coord, pname, params));
12962         if (isCallValid)
12963         {
12964             context->getTexGenfv(coord, pname, params);
12965         }
12966         ANGLE_CAPTURE_GL(GetTexGenfvOES, isCallValid, context, coord, pname, params);
12967     }
12968     else
12969     {
12970         GenerateContextLostErrorOnCurrentGlobalContext();
12971     }
12972     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
12973 }
12974 
GL_GetTexGenivOES(GLenum coord,GLenum pname,GLint * params)12975 void GL_APIENTRY GL_GetTexGenivOES(GLenum coord, GLenum pname, GLint *params)
12976 {
12977     Context *context = GetValidGlobalContext();
12978     EVENT(context, GLGetTexGenivOES,
12979           "context = %d, coord = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
12980           GLenumToString(GLESEnum::TextureCoordName, coord),
12981           GLenumToString(GLESEnum::TextureGenParameter, pname), (uintptr_t)params);
12982 
12983     if (context)
12984     {
12985         SCOPED_SHARE_CONTEXT_LOCK(context);
12986         bool isCallValid = (context->skipValidation() ||
12987                             ValidateGetTexGenivOES(context, angle::EntryPoint::GLGetTexGenivOES,
12988                                                    coord, pname, params));
12989         if (isCallValid)
12990         {
12991             context->getTexGeniv(coord, pname, params);
12992         }
12993         ANGLE_CAPTURE_GL(GetTexGenivOES, isCallValid, context, coord, pname, params);
12994     }
12995     else
12996     {
12997         GenerateContextLostErrorOnCurrentGlobalContext();
12998     }
12999     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
13000 }
13001 
GL_GetTexGenxvOES(GLenum coord,GLenum pname,GLfixed * params)13002 void GL_APIENTRY GL_GetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params)
13003 {
13004     Context *context = GetValidGlobalContext();
13005     EVENT(context, GLGetTexGenxvOES,
13006           "context = %d, coord = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
13007           GLenumToString(GLESEnum::TextureCoordName, coord),
13008           GLenumToString(GLESEnum::TextureGenParameter, pname), (uintptr_t)params);
13009 
13010     if (context)
13011     {
13012         SCOPED_SHARE_CONTEXT_LOCK(context);
13013         bool isCallValid = (context->skipValidation() ||
13014                             ValidateGetTexGenxvOES(context, angle::EntryPoint::GLGetTexGenxvOES,
13015                                                    coord, pname, params));
13016         if (isCallValid)
13017         {
13018             context->getTexGenxv(coord, pname, params);
13019         }
13020         ANGLE_CAPTURE_GL(GetTexGenxvOES, isCallValid, context, coord, pname, params);
13021     }
13022     else
13023     {
13024         GenerateContextLostErrorOnCurrentGlobalContext();
13025     }
13026     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
13027 }
13028 
GL_TexGenfOES(GLenum coord,GLenum pname,GLfloat param)13029 void GL_APIENTRY GL_TexGenfOES(GLenum coord, GLenum pname, GLfloat param)
13030 {
13031     Context *context = GetValidGlobalContext();
13032     EVENT(context, GLTexGenfOES, "context = %d, coord = %s, pname = %s, param = %f", CID(context),
13033           GLenumToString(GLESEnum::TextureCoordName, coord),
13034           GLenumToString(GLESEnum::TextureGenParameter, pname), param);
13035 
13036     if (context)
13037     {
13038         SCOPED_SHARE_CONTEXT_LOCK(context);
13039         bool isCallValid =
13040             (context->skipValidation() ||
13041              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
13042                                                 context->getMutableErrorSetForValidation(),
13043                                                 angle::EntryPoint::GLTexGenfOES) &&
13044               ValidateTexGenfOES(context, angle::EntryPoint::GLTexGenfOES, coord, pname, param)));
13045         if (isCallValid)
13046         {
13047             context->texGenf(coord, pname, param);
13048         }
13049         ANGLE_CAPTURE_GL(TexGenfOES, isCallValid, context, coord, pname, param);
13050     }
13051     else
13052     {
13053         GenerateContextLostErrorOnCurrentGlobalContext();
13054     }
13055     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
13056 }
13057 
GL_TexGenfvOES(GLenum coord,GLenum pname,const GLfloat * params)13058 void GL_APIENTRY GL_TexGenfvOES(GLenum coord, GLenum pname, const GLfloat *params)
13059 {
13060     Context *context = GetValidGlobalContext();
13061     EVENT(context, GLTexGenfvOES,
13062           "context = %d, coord = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
13063           GLenumToString(GLESEnum::TextureCoordName, coord),
13064           GLenumToString(GLESEnum::TextureGenParameter, pname), (uintptr_t)params);
13065 
13066     if (context)
13067     {
13068         SCOPED_SHARE_CONTEXT_LOCK(context);
13069         bool isCallValid =
13070             (context->skipValidation() ||
13071              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
13072                                                 context->getMutableErrorSetForValidation(),
13073                                                 angle::EntryPoint::GLTexGenfvOES) &&
13074               ValidateTexGenfvOES(context, angle::EntryPoint::GLTexGenfvOES, coord, pname,
13075                                   params)));
13076         if (isCallValid)
13077         {
13078             context->texGenfv(coord, pname, params);
13079         }
13080         ANGLE_CAPTURE_GL(TexGenfvOES, isCallValid, context, coord, pname, params);
13081     }
13082     else
13083     {
13084         GenerateContextLostErrorOnCurrentGlobalContext();
13085     }
13086     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
13087 }
13088 
GL_TexGeniOES(GLenum coord,GLenum pname,GLint param)13089 void GL_APIENTRY GL_TexGeniOES(GLenum coord, GLenum pname, GLint param)
13090 {
13091     Context *context = GetValidGlobalContext();
13092     EVENT(context, GLTexGeniOES, "context = %d, coord = %s, pname = %s, param = %d", CID(context),
13093           GLenumToString(GLESEnum::TextureCoordName, coord),
13094           GLenumToString(GLESEnum::TextureGenParameter, pname), param);
13095 
13096     if (context)
13097     {
13098         SCOPED_SHARE_CONTEXT_LOCK(context);
13099         bool isCallValid =
13100             (context->skipValidation() ||
13101              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
13102                                                 context->getMutableErrorSetForValidation(),
13103                                                 angle::EntryPoint::GLTexGeniOES) &&
13104               ValidateTexGeniOES(context, angle::EntryPoint::GLTexGeniOES, coord, pname, param)));
13105         if (isCallValid)
13106         {
13107             context->texGeni(coord, pname, param);
13108         }
13109         ANGLE_CAPTURE_GL(TexGeniOES, isCallValid, context, coord, pname, param);
13110     }
13111     else
13112     {
13113         GenerateContextLostErrorOnCurrentGlobalContext();
13114     }
13115     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
13116 }
13117 
GL_TexGenivOES(GLenum coord,GLenum pname,const GLint * params)13118 void GL_APIENTRY GL_TexGenivOES(GLenum coord, GLenum pname, const GLint *params)
13119 {
13120     Context *context = GetValidGlobalContext();
13121     EVENT(context, GLTexGenivOES,
13122           "context = %d, coord = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
13123           GLenumToString(GLESEnum::TextureCoordName, coord),
13124           GLenumToString(GLESEnum::TextureGenParameter, pname), (uintptr_t)params);
13125 
13126     if (context)
13127     {
13128         SCOPED_SHARE_CONTEXT_LOCK(context);
13129         bool isCallValid =
13130             (context->skipValidation() ||
13131              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
13132                                                 context->getMutableErrorSetForValidation(),
13133                                                 angle::EntryPoint::GLTexGenivOES) &&
13134               ValidateTexGenivOES(context, angle::EntryPoint::GLTexGenivOES, coord, pname,
13135                                   params)));
13136         if (isCallValid)
13137         {
13138             context->texGeniv(coord, pname, params);
13139         }
13140         ANGLE_CAPTURE_GL(TexGenivOES, isCallValid, context, coord, pname, params);
13141     }
13142     else
13143     {
13144         GenerateContextLostErrorOnCurrentGlobalContext();
13145     }
13146     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
13147 }
13148 
GL_TexGenxOES(GLenum coord,GLenum pname,GLfixed param)13149 void GL_APIENTRY GL_TexGenxOES(GLenum coord, GLenum pname, GLfixed param)
13150 {
13151     Context *context = GetValidGlobalContext();
13152     EVENT(context, GLTexGenxOES, "context = %d, coord = %s, pname = %s, param = 0x%X", CID(context),
13153           GLenumToString(GLESEnum::TextureCoordName, coord),
13154           GLenumToString(GLESEnum::TextureGenParameter, pname), param);
13155 
13156     if (context)
13157     {
13158         SCOPED_SHARE_CONTEXT_LOCK(context);
13159         bool isCallValid =
13160             (context->skipValidation() ||
13161              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
13162                                                 context->getMutableErrorSetForValidation(),
13163                                                 angle::EntryPoint::GLTexGenxOES) &&
13164               ValidateTexGenxOES(context, angle::EntryPoint::GLTexGenxOES, coord, pname, param)));
13165         if (isCallValid)
13166         {
13167             context->texGenx(coord, pname, param);
13168         }
13169         ANGLE_CAPTURE_GL(TexGenxOES, isCallValid, context, coord, pname, param);
13170     }
13171     else
13172     {
13173         GenerateContextLostErrorOnCurrentGlobalContext();
13174     }
13175     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
13176 }
13177 
GL_TexGenxvOES(GLenum coord,GLenum pname,const GLfixed * params)13178 void GL_APIENTRY GL_TexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params)
13179 {
13180     Context *context = GetValidGlobalContext();
13181     EVENT(context, GLTexGenxvOES,
13182           "context = %d, coord = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
13183           GLenumToString(GLESEnum::TextureCoordName, coord),
13184           GLenumToString(GLESEnum::TextureGenParameter, pname), (uintptr_t)params);
13185 
13186     if (context)
13187     {
13188         SCOPED_SHARE_CONTEXT_LOCK(context);
13189         bool isCallValid =
13190             (context->skipValidation() ||
13191              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
13192                                                 context->getMutableErrorSetForValidation(),
13193                                                 angle::EntryPoint::GLTexGenxvOES) &&
13194               ValidateTexGenxvOES(context, angle::EntryPoint::GLTexGenxvOES, coord, pname,
13195                                   params)));
13196         if (isCallValid)
13197         {
13198             context->texGenxv(coord, pname, params);
13199         }
13200         ANGLE_CAPTURE_GL(TexGenxvOES, isCallValid, context, coord, pname, params);
13201     }
13202     else
13203     {
13204         GenerateContextLostErrorOnCurrentGlobalContext();
13205     }
13206     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
13207 }
13208 
13209 // GL_OES_texture_cube_map_array
13210 
13211 // GL_OES_texture_float
13212 
13213 // GL_OES_texture_float_linear
13214 
13215 // GL_OES_texture_half_float
13216 
13217 // GL_OES_texture_half_float_linear
13218 
13219 // GL_OES_texture_npot
13220 
13221 // GL_OES_texture_stencil8
13222 
13223 // GL_OES_texture_storage_multisample_2d_array
GL_TexStorage3DMultisampleOES(GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLboolean fixedsamplelocations)13224 void GL_APIENTRY GL_TexStorage3DMultisampleOES(GLenum target,
13225                                                GLsizei samples,
13226                                                GLenum internalformat,
13227                                                GLsizei width,
13228                                                GLsizei height,
13229                                                GLsizei depth,
13230                                                GLboolean fixedsamplelocations)
13231 {
13232     Context *context = GetValidGlobalContext();
13233     EVENT(context, GLTexStorage3DMultisampleOES,
13234           "context = %d, target = %s, samples = %d, internalformat = %s, width = %d, height = %d, "
13235           "depth = %d, fixedsamplelocations = %s",
13236           CID(context), GLenumToString(GLESEnum::TextureTarget, target), samples,
13237           GLenumToString(GLESEnum::SizedInternalFormat, internalformat), width, height, depth,
13238           GLbooleanToString(fixedsamplelocations));
13239 
13240     if (context)
13241     {
13242         TextureType targetPacked = PackParam<TextureType>(target);
13243         SCOPED_SHARE_CONTEXT_LOCK(context);
13244         bool isCallValid =
13245             (context->skipValidation() ||
13246              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
13247                                                 context->getMutableErrorSetForValidation(),
13248                                                 angle::EntryPoint::GLTexStorage3DMultisampleOES) &&
13249               ValidateTexStorage3DMultisampleOES(
13250                   context, angle::EntryPoint::GLTexStorage3DMultisampleOES, targetPacked, samples,
13251                   internalformat, width, height, depth, fixedsamplelocations)));
13252         if (isCallValid)
13253         {
13254             context->texStorage3DMultisample(targetPacked, samples, internalformat, width, height,
13255                                              depth, fixedsamplelocations);
13256         }
13257         ANGLE_CAPTURE_GL(TexStorage3DMultisampleOES, isCallValid, context, targetPacked, samples,
13258                          internalformat, width, height, depth, fixedsamplelocations);
13259     }
13260     else
13261     {
13262         GenerateContextLostErrorOnCurrentGlobalContext();
13263     }
13264     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
13265 }
13266 
13267 // GL_OES_vertex_array_object
GL_BindVertexArrayOES(GLuint array)13268 void GL_APIENTRY GL_BindVertexArrayOES(GLuint array)
13269 {
13270     Context *context = GetValidGlobalContext();
13271     EVENT(context, GLBindVertexArrayOES, "context = %d, array = %u", CID(context), array);
13272 
13273     if (context)
13274     {
13275         VertexArrayID arrayPacked = PackParam<VertexArrayID>(array);
13276         SCOPED_SHARE_CONTEXT_LOCK(context);
13277         bool isCallValid =
13278             (context->skipValidation() ||
13279              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
13280                                                 context->getMutableErrorSetForValidation(),
13281                                                 angle::EntryPoint::GLBindVertexArrayOES) &&
13282               ValidateBindVertexArrayOES(context, angle::EntryPoint::GLBindVertexArrayOES,
13283                                          arrayPacked)));
13284         if (isCallValid)
13285         {
13286             context->bindVertexArray(arrayPacked);
13287         }
13288         ANGLE_CAPTURE_GL(BindVertexArrayOES, isCallValid, context, arrayPacked);
13289     }
13290     else
13291     {
13292         GenerateContextLostErrorOnCurrentGlobalContext();
13293     }
13294     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
13295 }
13296 
GL_DeleteVertexArraysOES(GLsizei n,const GLuint * arrays)13297 void GL_APIENTRY GL_DeleteVertexArraysOES(GLsizei n, const GLuint *arrays)
13298 {
13299     Context *context = GetValidGlobalContext();
13300     EVENT(context, GLDeleteVertexArraysOES, "context = %d, n = %d, arrays = 0x%016" PRIxPTR "",
13301           CID(context), n, (uintptr_t)arrays);
13302 
13303     if (context)
13304     {
13305         const VertexArrayID *arraysPacked = PackParam<const VertexArrayID *>(arrays);
13306         SCOPED_SHARE_CONTEXT_LOCK(context);
13307         bool isCallValid =
13308             (context->skipValidation() ||
13309              ValidateDeleteVertexArraysOES(context, angle::EntryPoint::GLDeleteVertexArraysOES, n,
13310                                            arraysPacked));
13311         if (isCallValid)
13312         {
13313             context->deleteVertexArrays(n, arraysPacked);
13314         }
13315         ANGLE_CAPTURE_GL(DeleteVertexArraysOES, isCallValid, context, n, arraysPacked);
13316     }
13317     else
13318     {
13319         GenerateContextLostErrorOnCurrentGlobalContext();
13320     }
13321     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
13322 }
13323 
GL_GenVertexArraysOES(GLsizei n,GLuint * arrays)13324 void GL_APIENTRY GL_GenVertexArraysOES(GLsizei n, GLuint *arrays)
13325 {
13326     Context *context = GetValidGlobalContext();
13327     EVENT(context, GLGenVertexArraysOES, "context = %d, n = %d, arrays = 0x%016" PRIxPTR "",
13328           CID(context), n, (uintptr_t)arrays);
13329 
13330     if (context)
13331     {
13332         VertexArrayID *arraysPacked = PackParam<VertexArrayID *>(arrays);
13333         SCOPED_SHARE_CONTEXT_LOCK(context);
13334         bool isCallValid = (context->skipValidation() ||
13335                             ValidateGenVertexArraysOES(
13336                                 context, angle::EntryPoint::GLGenVertexArraysOES, n, arraysPacked));
13337         if (isCallValid)
13338         {
13339             context->genVertexArrays(n, arraysPacked);
13340         }
13341         ANGLE_CAPTURE_GL(GenVertexArraysOES, isCallValid, context, n, arraysPacked);
13342     }
13343     else
13344     {
13345         GenerateContextLostErrorOnCurrentGlobalContext();
13346     }
13347     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
13348 }
13349 
GL_IsVertexArrayOES(GLuint array)13350 GLboolean GL_APIENTRY GL_IsVertexArrayOES(GLuint array)
13351 {
13352     Context *context = GetValidGlobalContext();
13353     EVENT(context, GLIsVertexArrayOES, "context = %d, array = %u", CID(context), array);
13354 
13355     GLboolean returnValue;
13356     if (context)
13357     {
13358         VertexArrayID arrayPacked = PackParam<VertexArrayID>(array);
13359         SCOPED_SHARE_CONTEXT_LOCK(context);
13360         bool isCallValid =
13361             (context->skipValidation() ||
13362              ValidateIsVertexArrayOES(context, angle::EntryPoint::GLIsVertexArrayOES, arrayPacked));
13363         if (isCallValid)
13364         {
13365             returnValue = context->isVertexArray(arrayPacked);
13366         }
13367         else
13368         {
13369             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsVertexArrayOES, GLboolean>();
13370         }
13371         ANGLE_CAPTURE_GL(IsVertexArrayOES, isCallValid, context, arrayPacked, returnValue);
13372     }
13373     else
13374     {
13375         GenerateContextLostErrorOnCurrentGlobalContext();
13376         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsVertexArrayOES, GLboolean>();
13377     }
13378     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
13379     return returnValue;
13380 }
13381 
13382 // GL_OES_vertex_half_float
13383 
13384 // GL_OES_vertex_type_10_10_10_2
13385 
13386 // GL_OVR_multiview
GL_FramebufferTextureMultiviewOVR(GLenum target,GLenum attachment,GLuint texture,GLint level,GLint baseViewIndex,GLsizei numViews)13387 void GL_APIENTRY GL_FramebufferTextureMultiviewOVR(GLenum target,
13388                                                    GLenum attachment,
13389                                                    GLuint texture,
13390                                                    GLint level,
13391                                                    GLint baseViewIndex,
13392                                                    GLsizei numViews)
13393 {
13394     Context *context = GetValidGlobalContext();
13395     EVENT(context, GLFramebufferTextureMultiviewOVR,
13396           "context = %d, target = %s, attachment = %s, texture = %u, level = %d, baseViewIndex = "
13397           "%d, numViews = %d",
13398           CID(context), GLenumToString(GLESEnum::FramebufferTarget, target),
13399           GLenumToString(GLESEnum::FramebufferAttachment, attachment), texture, level,
13400           baseViewIndex, numViews);
13401 
13402     if (context)
13403     {
13404         TextureID texturePacked = PackParam<TextureID>(texture);
13405         SCOPED_SHARE_CONTEXT_LOCK(context);
13406         bool isCallValid =
13407             (context->skipValidation() ||
13408              (ValidatePixelLocalStorageInactive(
13409                   context->getPrivateState(), context->getMutableErrorSetForValidation(),
13410                   angle::EntryPoint::GLFramebufferTextureMultiviewOVR) &&
13411               ValidateFramebufferTextureMultiviewOVR(
13412                   context, angle::EntryPoint::GLFramebufferTextureMultiviewOVR, target, attachment,
13413                   texturePacked, level, baseViewIndex, numViews)));
13414         if (isCallValid)
13415         {
13416             context->framebufferTextureMultiview(target, attachment, texturePacked, level,
13417                                                  baseViewIndex, numViews);
13418         }
13419         ANGLE_CAPTURE_GL(FramebufferTextureMultiviewOVR, isCallValid, context, target, attachment,
13420                          texturePacked, level, baseViewIndex, numViews);
13421     }
13422     else
13423     {
13424         GenerateContextLostErrorOnCurrentGlobalContext();
13425     }
13426     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
13427 }
13428 
13429 // GL_OVR_multiview2
13430 
13431 // GL_QCOM_render_shared_exponent
13432 
13433 // GL_QCOM_shading_rate
GL_ShadingRateQCOM(GLenum rate)13434 void GL_APIENTRY GL_ShadingRateQCOM(GLenum rate)
13435 {
13436     Context *context = GetValidGlobalContext();
13437     EVENT(context, GLShadingRateQCOM, "context = %d, rate = %s", CID(context),
13438           GLenumToString(GLESEnum::ShadingRateQCOM, rate));
13439 
13440     if (context)
13441     {
13442         bool isCallValid =
13443             (context->skipValidation() ||
13444              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
13445                                                 context->getMutableErrorSetForValidation(),
13446                                                 angle::EntryPoint::GLShadingRateQCOM) &&
13447               ValidateShadingRateQCOM(context->getPrivateState(),
13448                                       context->getMutableErrorSetForValidation(),
13449                                       angle::EntryPoint::GLShadingRateQCOM, rate)));
13450         if (isCallValid)
13451         {
13452             ContextPrivateShadingRate(context->getMutablePrivateState(),
13453                                       context->getMutablePrivateStateCache(), rate);
13454         }
13455         ANGLE_CAPTURE_GL(ShadingRateQCOM, isCallValid, context, rate);
13456     }
13457     else
13458     {
13459         GenerateContextLostErrorOnCurrentGlobalContext();
13460     }
13461     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
13462 }
13463 
13464 }  // extern "C"
13465