• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by generate_entry_points.py using data from gl.xml.
3 //
4 // Copyright 2020 The ANGLE Project Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style license that can be
6 // found in the LICENSE file.
7 //
8 // entry_points_gles_3_2_autogen.cpp:
9 //   Defines the GLES 3.2 entry points.
10 
11 #include "libGLESv2/entry_points_gles_3_2_autogen.h"
12 
13 #include "common/entry_points_enum_autogen.h"
14 #include "common/gl_enum_utils.h"
15 #include "libANGLE/Context.h"
16 #include "libANGLE/Context.inl.h"
17 #include "libANGLE/capture/capture_gles_3_2_autogen.h"
18 #include "libANGLE/context_private_call_gles_autogen.h"
19 #include "libANGLE/entry_points_utils.h"
20 #include "libANGLE/validationES32.h"
21 #include "libGLESv2/global_state.h"
22 
23 using namespace gl;
24 
25 extern "C" {
GL_BlendBarrier()26 void GL_APIENTRY GL_BlendBarrier()
27 {
28     Context *context = GetValidGlobalContext();
29     EVENT(context, GLBlendBarrier, "context = %d", CID(context));
30 
31     if (context)
32     {
33         SCOPED_SHARE_CONTEXT_LOCK(context);
34         bool isCallValid =
35             (context->skipValidation() ||
36              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
37                                                 context->getMutableErrorSetForValidation(),
38                                                 angle::EntryPoint::GLBlendBarrier) &&
39               ValidateBlendBarrier(context, angle::EntryPoint::GLBlendBarrier)));
40         if (isCallValid)
41         {
42             context->blendBarrier();
43         }
44         ANGLE_CAPTURE_GL(BlendBarrier, isCallValid, context);
45     }
46     else
47     {
48         GenerateContextLostErrorOnCurrentGlobalContext();
49     }
50     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
51 }
52 
GL_BlendEquationSeparatei(GLuint buf,GLenum modeRGB,GLenum modeAlpha)53 void GL_APIENTRY GL_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
54 {
55     Context *context = GetValidGlobalContext();
56     EVENT(context, GLBlendEquationSeparatei, "context = %d, buf = %u, modeRGB = %s, modeAlpha = %s",
57           CID(context), buf, GLenumToString(GLESEnum::BlendEquationModeEXT, modeRGB),
58           GLenumToString(GLESEnum::BlendEquationModeEXT, modeAlpha));
59 
60     if (context)
61     {
62         bool isCallValid =
63             (context->skipValidation() ||
64              ValidateBlendEquationSeparatei(
65                  context->getPrivateState(), context->getMutableErrorSetForValidation(),
66                  angle::EntryPoint::GLBlendEquationSeparatei, buf, modeRGB, modeAlpha));
67         if (isCallValid)
68         {
69             ContextPrivateBlendEquationSeparatei(context->getMutablePrivateState(),
70                                                  context->getMutablePrivateStateCache(), buf,
71                                                  modeRGB, modeAlpha);
72         }
73         ANGLE_CAPTURE_GL(BlendEquationSeparatei, isCallValid, context, buf, modeRGB, modeAlpha);
74     }
75     else
76     {
77         GenerateContextLostErrorOnCurrentGlobalContext();
78     }
79     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
80 }
81 
GL_BlendEquationi(GLuint buf,GLenum mode)82 void GL_APIENTRY GL_BlendEquationi(GLuint buf, GLenum mode)
83 {
84     Context *context = GetValidGlobalContext();
85     EVENT(context, GLBlendEquationi, "context = %d, buf = %u, mode = %s", CID(context), buf,
86           GLenumToString(GLESEnum::BlendEquationModeEXT, mode));
87 
88     if (context)
89     {
90         bool isCallValid = (context->skipValidation() ||
91                             ValidateBlendEquationi(context->getPrivateState(),
92                                                    context->getMutableErrorSetForValidation(),
93                                                    angle::EntryPoint::GLBlendEquationi, buf, mode));
94         if (isCallValid)
95         {
96             ContextPrivateBlendEquationi(context->getMutablePrivateState(),
97                                          context->getMutablePrivateStateCache(), buf, mode);
98         }
99         ANGLE_CAPTURE_GL(BlendEquationi, isCallValid, context, buf, mode);
100     }
101     else
102     {
103         GenerateContextLostErrorOnCurrentGlobalContext();
104     }
105     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
106 }
107 
108 void GL_APIENTRY
GL_BlendFuncSeparatei(GLuint buf,GLenum srcRGB,GLenum dstRGB,GLenum srcAlpha,GLenum dstAlpha)109 GL_BlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
110 {
111     Context *context = GetValidGlobalContext();
112     EVENT(context, GLBlendFuncSeparatei,
113           "context = %d, buf = %u, srcRGB = %s, dstRGB = %s, srcAlpha = %s, dstAlpha = %s",
114           CID(context), buf, GLenumToString(GLESEnum::BlendingFactor, srcRGB),
115           GLenumToString(GLESEnum::BlendingFactor, dstRGB),
116           GLenumToString(GLESEnum::BlendingFactor, srcAlpha),
117           GLenumToString(GLESEnum::BlendingFactor, dstAlpha));
118 
119     if (context)
120     {
121         bool isCallValid =
122             (context->skipValidation() ||
123              ValidateBlendFuncSeparatei(
124                  context->getPrivateState(), context->getMutableErrorSetForValidation(),
125                  angle::EntryPoint::GLBlendFuncSeparatei, buf, srcRGB, dstRGB, srcAlpha, dstAlpha));
126         if (isCallValid)
127         {
128             ContextPrivateBlendFuncSeparatei(context->getMutablePrivateState(),
129                                              context->getMutablePrivateStateCache(), buf, srcRGB,
130                                              dstRGB, srcAlpha, dstAlpha);
131         }
132         ANGLE_CAPTURE_GL(BlendFuncSeparatei, isCallValid, context, buf, srcRGB, dstRGB, srcAlpha,
133                          dstAlpha);
134     }
135     else
136     {
137         GenerateContextLostErrorOnCurrentGlobalContext();
138     }
139     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
140 }
141 
GL_BlendFunci(GLuint buf,GLenum src,GLenum dst)142 void GL_APIENTRY GL_BlendFunci(GLuint buf, GLenum src, GLenum dst)
143 {
144     Context *context = GetValidGlobalContext();
145     EVENT(context, GLBlendFunci, "context = %d, buf = %u, src = %s, dst = %s", CID(context), buf,
146           GLenumToString(GLESEnum::BlendingFactor, src),
147           GLenumToString(GLESEnum::BlendingFactor, dst));
148 
149     if (context)
150     {
151         bool isCallValid = (context->skipValidation() ||
152                             ValidateBlendFunci(context->getPrivateState(),
153                                                context->getMutableErrorSetForValidation(),
154                                                angle::EntryPoint::GLBlendFunci, buf, src, dst));
155         if (isCallValid)
156         {
157             ContextPrivateBlendFunci(context->getMutablePrivateState(),
158                                      context->getMutablePrivateStateCache(), buf, src, dst);
159         }
160         ANGLE_CAPTURE_GL(BlendFunci, isCallValid, context, buf, src, dst);
161     }
162     else
163     {
164         GenerateContextLostErrorOnCurrentGlobalContext();
165     }
166     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
167 }
168 
GL_ColorMaski(GLuint index,GLboolean r,GLboolean g,GLboolean b,GLboolean a)169 void GL_APIENTRY GL_ColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
170 {
171     Context *context = GetValidGlobalContext();
172     EVENT(context, GLColorMaski, "context = %d, index = %u, r = %s, g = %s, b = %s, a = %s",
173           CID(context), index, GLbooleanToString(r), GLbooleanToString(g), GLbooleanToString(b),
174           GLbooleanToString(a));
175 
176     if (context)
177     {
178         bool isCallValid = (context->skipValidation() ||
179                             ValidateColorMaski(context->getPrivateState(),
180                                                context->getMutableErrorSetForValidation(),
181                                                angle::EntryPoint::GLColorMaski, index, r, g, b, a));
182         if (isCallValid)
183         {
184             ContextPrivateColorMaski(context->getMutablePrivateState(),
185                                      context->getMutablePrivateStateCache(), index, r, g, b, a);
186         }
187         ANGLE_CAPTURE_GL(ColorMaski, isCallValid, context, index, r, g, b, a);
188     }
189     else
190     {
191         GenerateContextLostErrorOnCurrentGlobalContext();
192     }
193     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
194 }
195 
GL_CopyImageSubData(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)196 void GL_APIENTRY GL_CopyImageSubData(GLuint srcName,
197                                      GLenum srcTarget,
198                                      GLint srcLevel,
199                                      GLint srcX,
200                                      GLint srcY,
201                                      GLint srcZ,
202                                      GLuint dstName,
203                                      GLenum dstTarget,
204                                      GLint dstLevel,
205                                      GLint dstX,
206                                      GLint dstY,
207                                      GLint dstZ,
208                                      GLsizei srcWidth,
209                                      GLsizei srcHeight,
210                                      GLsizei srcDepth)
211 {
212     Context *context = GetValidGlobalContext();
213     EVENT(context, GLCopyImageSubData,
214           "context = %d, srcName = %u, srcTarget = %s, srcLevel = %d, srcX = %d, srcY = %d, srcZ = "
215           "%d, dstName = %u, dstTarget = %s, dstLevel = %d, dstX = %d, dstY = %d, dstZ = %d, "
216           "srcWidth = %d, srcHeight = %d, srcDepth = %d",
217           CID(context), srcName, GLenumToString(GLESEnum::CopyImageSubDataTarget, srcTarget),
218           srcLevel, srcX, srcY, srcZ, dstName,
219           GLenumToString(GLESEnum::CopyImageSubDataTarget, dstTarget), dstLevel, dstX, dstY, dstZ,
220           srcWidth, srcHeight, srcDepth);
221 
222     if (context)
223     {
224         SCOPED_SHARE_CONTEXT_LOCK(context);
225         bool isCallValid =
226             (context->skipValidation() ||
227              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
228                                                 context->getMutableErrorSetForValidation(),
229                                                 angle::EntryPoint::GLCopyImageSubData) &&
230               ValidateCopyImageSubData(context, angle::EntryPoint::GLCopyImageSubData, srcName,
231                                        srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget,
232                                        dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth)));
233         if (isCallValid)
234         {
235             context->copyImageSubData(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName,
236                                       dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight,
237                                       srcDepth);
238         }
239         ANGLE_CAPTURE_GL(CopyImageSubData, isCallValid, context, srcName, srcTarget, srcLevel, srcX,
240                          srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth,
241                          srcHeight, srcDepth);
242     }
243     else
244     {
245         GenerateContextLostErrorOnCurrentGlobalContext();
246     }
247     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
248 }
249 
GL_DebugMessageCallback(GLDEBUGPROC callback,const void * userParam)250 void GL_APIENTRY GL_DebugMessageCallback(GLDEBUGPROC callback, const void *userParam)
251 {
252     Context *context = GetValidGlobalContext();
253     EVENT(context, GLDebugMessageCallback,
254           "context = %d, callback = 0x%016" PRIxPTR ", userParam = 0x%016" PRIxPTR "", CID(context),
255           (uintptr_t)callback, (uintptr_t)userParam);
256 
257     if (context)
258     {
259         SCOPED_SHARE_CONTEXT_LOCK(context);
260         bool isCallValid =
261             (context->skipValidation() ||
262              ValidateDebugMessageCallback(context, angle::EntryPoint::GLDebugMessageCallback,
263                                           callback, userParam));
264         if (isCallValid)
265         {
266             context->debugMessageCallback(callback, userParam);
267         }
268         ANGLE_CAPTURE_GL(DebugMessageCallback, isCallValid, context, callback, userParam);
269     }
270     else
271     {
272         GenerateContextLostErrorOnCurrentGlobalContext();
273     }
274     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
275 }
276 
GL_DebugMessageControl(GLenum source,GLenum type,GLenum severity,GLsizei count,const GLuint * ids,GLboolean enabled)277 void GL_APIENTRY GL_DebugMessageControl(GLenum source,
278                                         GLenum type,
279                                         GLenum severity,
280                                         GLsizei count,
281                                         const GLuint *ids,
282                                         GLboolean enabled)
283 {
284     Context *context = GetValidGlobalContext();
285     EVENT(context, GLDebugMessageControl,
286           "context = %d, source = %s, type = %s, severity = %s, count = %d, ids = 0x%016" PRIxPTR
287           ", enabled = %s",
288           CID(context), GLenumToString(GLESEnum::DebugSource, source),
289           GLenumToString(GLESEnum::DebugType, type),
290           GLenumToString(GLESEnum::DebugSeverity, severity), count, (uintptr_t)ids,
291           GLbooleanToString(enabled));
292 
293     if (context)
294     {
295         SCOPED_SHARE_CONTEXT_LOCK(context);
296         bool isCallValid =
297             (context->skipValidation() ||
298              ValidateDebugMessageControl(context, angle::EntryPoint::GLDebugMessageControl, source,
299                                          type, severity, count, ids, enabled));
300         if (isCallValid)
301         {
302             context->debugMessageControl(source, type, severity, count, ids, enabled);
303         }
304         ANGLE_CAPTURE_GL(DebugMessageControl, isCallValid, context, source, type, severity, count,
305                          ids, enabled);
306     }
307     else
308     {
309         GenerateContextLostErrorOnCurrentGlobalContext();
310     }
311     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
312 }
313 
GL_DebugMessageInsert(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar * buf)314 void GL_APIENTRY GL_DebugMessageInsert(GLenum source,
315                                        GLenum type,
316                                        GLuint id,
317                                        GLenum severity,
318                                        GLsizei length,
319                                        const GLchar *buf)
320 {
321     Context *context = GetValidGlobalContext();
322     EVENT(context, GLDebugMessageInsert,
323           "context = %d, source = %s, type = %s, id = %u, severity = %s, length = %d, buf = "
324           "0x%016" PRIxPTR "",
325           CID(context), GLenumToString(GLESEnum::DebugSource, source),
326           GLenumToString(GLESEnum::DebugType, type), id,
327           GLenumToString(GLESEnum::DebugSeverity, severity), length, (uintptr_t)buf);
328 
329     if (context)
330     {
331         SCOPED_SHARE_CONTEXT_LOCK(context);
332         bool isCallValid =
333             (context->skipValidation() ||
334              ValidateDebugMessageInsert(context, angle::EntryPoint::GLDebugMessageInsert, source,
335                                         type, id, severity, length, buf));
336         if (isCallValid)
337         {
338             context->debugMessageInsert(source, type, id, severity, length, buf);
339         }
340         ANGLE_CAPTURE_GL(DebugMessageInsert, isCallValid, context, source, type, id, severity,
341                          length, buf);
342     }
343     else
344     {
345         GenerateContextLostErrorOnCurrentGlobalContext();
346     }
347     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
348 }
349 
GL_Disablei(GLenum target,GLuint index)350 void GL_APIENTRY GL_Disablei(GLenum target, GLuint index)
351 {
352     Context *context = GetValidGlobalContext();
353     EVENT(context, GLDisablei, "context = %d, target = %s, index = %u", CID(context),
354           GLenumToString(GLESEnum::EnableCap, target), index);
355 
356     if (context)
357     {
358         bool isCallValid = (context->skipValidation() ||
359                             ValidateDisablei(context->getPrivateState(),
360                                              context->getMutableErrorSetForValidation(),
361                                              angle::EntryPoint::GLDisablei, target, index));
362         if (isCallValid)
363         {
364             ContextPrivateDisablei(context->getMutablePrivateState(),
365                                    context->getMutablePrivateStateCache(), target, index);
366         }
367         ANGLE_CAPTURE_GL(Disablei, isCallValid, context, target, index);
368     }
369     else
370     {
371         GenerateContextLostErrorOnCurrentGlobalContext();
372     }
373     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
374 }
375 
GL_DrawElementsBaseVertex(GLenum mode,GLsizei count,GLenum type,const void * indices,GLint basevertex)376 void GL_APIENTRY GL_DrawElementsBaseVertex(GLenum mode,
377                                            GLsizei count,
378                                            GLenum type,
379                                            const void *indices,
380                                            GLint basevertex)
381 {
382     Context *context = GetValidGlobalContext();
383     EVENT(context, GLDrawElementsBaseVertex,
384           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
385           ", basevertex = %d",
386           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), count,
387           GLenumToString(GLESEnum::DrawElementsType, type), (uintptr_t)indices, basevertex);
388 
389     if (context)
390     {
391         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
392         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
393         SCOPED_SHARE_CONTEXT_LOCK(context);
394         bool isCallValid =
395             (context->skipValidation() ||
396              ValidateDrawElementsBaseVertex(context, angle::EntryPoint::GLDrawElementsBaseVertex,
397                                             modePacked, count, typePacked, indices, basevertex));
398         if (isCallValid)
399         {
400             context->drawElementsBaseVertex(modePacked, count, typePacked, indices, basevertex);
401         }
402         ANGLE_CAPTURE_GL(DrawElementsBaseVertex, isCallValid, context, modePacked, count,
403                          typePacked, indices, basevertex);
404     }
405     else
406     {
407         GenerateContextLostErrorOnCurrentGlobalContext();
408     }
409     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
410 }
411 
GL_DrawElementsInstancedBaseVertex(GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei instancecount,GLint basevertex)412 void GL_APIENTRY GL_DrawElementsInstancedBaseVertex(GLenum mode,
413                                                     GLsizei count,
414                                                     GLenum type,
415                                                     const void *indices,
416                                                     GLsizei instancecount,
417                                                     GLint basevertex)
418 {
419     Context *context = GetValidGlobalContext();
420     EVENT(context, GLDrawElementsInstancedBaseVertex,
421           "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
422           ", instancecount = %d, basevertex = %d",
423           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), count,
424           GLenumToString(GLESEnum::DrawElementsType, type), (uintptr_t)indices, instancecount,
425           basevertex);
426 
427     if (context)
428     {
429         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
430         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
431         SCOPED_SHARE_CONTEXT_LOCK(context);
432         bool isCallValid = (context->skipValidation() ||
433                             ValidateDrawElementsInstancedBaseVertex(
434                                 context, angle::EntryPoint::GLDrawElementsInstancedBaseVertex,
435                                 modePacked, count, typePacked, indices, instancecount, basevertex));
436         if (isCallValid)
437         {
438             context->drawElementsInstancedBaseVertex(modePacked, count, typePacked, indices,
439                                                      instancecount, basevertex);
440         }
441         ANGLE_CAPTURE_GL(DrawElementsInstancedBaseVertex, isCallValid, context, modePacked, count,
442                          typePacked, indices, instancecount, basevertex);
443     }
444     else
445     {
446         GenerateContextLostErrorOnCurrentGlobalContext();
447     }
448     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
449 }
450 
GL_DrawRangeElementsBaseVertex(GLenum mode,GLuint start,GLuint end,GLsizei count,GLenum type,const void * indices,GLint basevertex)451 void GL_APIENTRY GL_DrawRangeElementsBaseVertex(GLenum mode,
452                                                 GLuint start,
453                                                 GLuint end,
454                                                 GLsizei count,
455                                                 GLenum type,
456                                                 const void *indices,
457                                                 GLint basevertex)
458 {
459     Context *context = GetValidGlobalContext();
460     EVENT(context, GLDrawRangeElementsBaseVertex,
461           "context = %d, mode = %s, start = %u, end = %u, count = %d, type = %s, indices = "
462           "0x%016" PRIxPTR ", basevertex = %d",
463           CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), start, end, count,
464           GLenumToString(GLESEnum::DrawElementsType, type), (uintptr_t)indices, basevertex);
465 
466     if (context)
467     {
468         PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
469         DrawElementsType typePacked = PackParam<DrawElementsType>(type);
470         SCOPED_SHARE_CONTEXT_LOCK(context);
471         bool isCallValid = (context->skipValidation() ||
472                             ValidateDrawRangeElementsBaseVertex(
473                                 context, angle::EntryPoint::GLDrawRangeElementsBaseVertex,
474                                 modePacked, start, end, count, typePacked, indices, basevertex));
475         if (isCallValid)
476         {
477             context->drawRangeElementsBaseVertex(modePacked, start, end, count, typePacked, indices,
478                                                  basevertex);
479         }
480         ANGLE_CAPTURE_GL(DrawRangeElementsBaseVertex, isCallValid, context, modePacked, start, end,
481                          count, typePacked, indices, basevertex);
482     }
483     else
484     {
485         GenerateContextLostErrorOnCurrentGlobalContext();
486     }
487     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
488 }
489 
GL_Enablei(GLenum target,GLuint index)490 void GL_APIENTRY GL_Enablei(GLenum target, GLuint index)
491 {
492     Context *context = GetValidGlobalContext();
493     EVENT(context, GLEnablei, "context = %d, target = %s, index = %u", CID(context),
494           GLenumToString(GLESEnum::EnableCap, target), index);
495 
496     if (context)
497     {
498         bool isCallValid =
499             (context->skipValidation() ||
500              ValidateEnablei(context->getPrivateState(), context->getMutableErrorSetForValidation(),
501                              angle::EntryPoint::GLEnablei, target, index));
502         if (isCallValid)
503         {
504             ContextPrivateEnablei(context->getMutablePrivateState(),
505                                   context->getMutablePrivateStateCache(), target, index);
506         }
507         ANGLE_CAPTURE_GL(Enablei, isCallValid, context, target, index);
508     }
509     else
510     {
511         GenerateContextLostErrorOnCurrentGlobalContext();
512     }
513     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
514 }
515 
GL_FramebufferTexture(GLenum target,GLenum attachment,GLuint texture,GLint level)516 void GL_APIENTRY GL_FramebufferTexture(GLenum target,
517                                        GLenum attachment,
518                                        GLuint texture,
519                                        GLint level)
520 {
521     Context *context = GetValidGlobalContext();
522     EVENT(context, GLFramebufferTexture,
523           "context = %d, target = %s, attachment = %s, texture = %u, level = %d", CID(context),
524           GLenumToString(GLESEnum::FramebufferTarget, target),
525           GLenumToString(GLESEnum::FramebufferAttachment, attachment), texture, level);
526 
527     if (context)
528     {
529         TextureID texturePacked = PackParam<TextureID>(texture);
530         SCOPED_SHARE_CONTEXT_LOCK(context);
531         bool isCallValid =
532             (context->skipValidation() ||
533              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
534                                                 context->getMutableErrorSetForValidation(),
535                                                 angle::EntryPoint::GLFramebufferTexture) &&
536               ValidateFramebufferTexture(context, angle::EntryPoint::GLFramebufferTexture, target,
537                                          attachment, texturePacked, level)));
538         if (isCallValid)
539         {
540             context->framebufferTexture(target, attachment, texturePacked, level);
541         }
542         ANGLE_CAPTURE_GL(FramebufferTexture, isCallValid, context, target, attachment,
543                          texturePacked, level);
544     }
545     else
546     {
547         GenerateContextLostErrorOnCurrentGlobalContext();
548     }
549     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
550 }
551 
GL_GetDebugMessageLog(GLuint count,GLsizei bufSize,GLenum * sources,GLenum * types,GLuint * ids,GLenum * severities,GLsizei * lengths,GLchar * messageLog)552 GLuint GL_APIENTRY GL_GetDebugMessageLog(GLuint count,
553                                          GLsizei bufSize,
554                                          GLenum *sources,
555                                          GLenum *types,
556                                          GLuint *ids,
557                                          GLenum *severities,
558                                          GLsizei *lengths,
559                                          GLchar *messageLog)
560 {
561     Context *context = GetValidGlobalContext();
562     EVENT(context, GLGetDebugMessageLog,
563           "context = %d, count = %u, bufSize = %d, sources = 0x%016" PRIxPTR
564           ", types = 0x%016" PRIxPTR ", ids = 0x%016" PRIxPTR ", severities = 0x%016" PRIxPTR
565           ", lengths = 0x%016" PRIxPTR ", messageLog = 0x%016" PRIxPTR "",
566           CID(context), count, bufSize, (uintptr_t)sources, (uintptr_t)types, (uintptr_t)ids,
567           (uintptr_t)severities, (uintptr_t)lengths, (uintptr_t)messageLog);
568 
569     GLuint returnValue;
570     if (context)
571     {
572         SCOPED_SHARE_CONTEXT_LOCK(context);
573         bool isCallValid = (context->skipValidation() ||
574                             ValidateGetDebugMessageLog(
575                                 context, angle::EntryPoint::GLGetDebugMessageLog, count, bufSize,
576                                 sources, types, ids, severities, lengths, messageLog));
577         if (isCallValid)
578         {
579             returnValue = context->getDebugMessageLog(count, bufSize, sources, types, ids,
580                                                       severities, lengths, messageLog);
581         }
582         else
583         {
584             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetDebugMessageLog, GLuint>();
585         }
586         ANGLE_CAPTURE_GL(GetDebugMessageLog, isCallValid, context, count, bufSize, sources, types,
587                          ids, severities, lengths, messageLog, returnValue);
588     }
589     else
590     {
591         GenerateContextLostErrorOnCurrentGlobalContext();
592         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetDebugMessageLog, GLuint>();
593     }
594     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
595     return returnValue;
596 }
597 
GL_GetGraphicsResetStatus()598 GLenum GL_APIENTRY GL_GetGraphicsResetStatus()
599 {
600     Context *context = GetGlobalContext();
601     EVENT(context, GLGetGraphicsResetStatus, "context = %d", CID(context));
602 
603     GLenum returnValue;
604     if (context)
605     {
606         SCOPED_SHARE_CONTEXT_LOCK(context);
607         bool isCallValid =
608             (context->skipValidation() ||
609              ValidateGetGraphicsResetStatus(context, angle::EntryPoint::GLGetGraphicsResetStatus));
610         if (isCallValid)
611         {
612             returnValue = context->getGraphicsResetStatus();
613         }
614         else
615         {
616             returnValue =
617                 GetDefaultReturnValue<angle::EntryPoint::GLGetGraphicsResetStatus, GLenum>();
618         }
619         ANGLE_CAPTURE_GL(GetGraphicsResetStatus, isCallValid, context, returnValue);
620     }
621     else
622     {
623 
624         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetGraphicsResetStatus, GLenum>();
625     }
626     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
627     return returnValue;
628 }
629 
630 void GL_APIENTRY
GL_GetObjectLabel(GLenum identifier,GLuint name,GLsizei bufSize,GLsizei * length,GLchar * label)631 GL_GetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label)
632 {
633     Context *context = GetValidGlobalContext();
634     EVENT(context, GLGetObjectLabel,
635           "context = %d, identifier = %s, name = %u, bufSize = %d, length = 0x%016" PRIxPTR
636           ", label = 0x%016" PRIxPTR "",
637           CID(context), GLenumToString(GLESEnum::ObjectIdentifier, identifier), name, bufSize,
638           (uintptr_t)length, (uintptr_t)label);
639 
640     if (context)
641     {
642         SCOPED_SHARE_CONTEXT_LOCK(context);
643         bool isCallValid = (context->skipValidation() ||
644                             ValidateGetObjectLabel(context, angle::EntryPoint::GLGetObjectLabel,
645                                                    identifier, name, bufSize, length, label));
646         if (isCallValid)
647         {
648             context->getObjectLabel(identifier, name, bufSize, length, label);
649         }
650         ANGLE_CAPTURE_GL(GetObjectLabel, isCallValid, context, identifier, name, bufSize, length,
651                          label);
652     }
653     else
654     {
655         GenerateContextLostErrorOnCurrentGlobalContext();
656     }
657     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
658 }
659 
GL_GetObjectPtrLabel(const void * ptr,GLsizei bufSize,GLsizei * length,GLchar * label)660 void GL_APIENTRY GL_GetObjectPtrLabel(const void *ptr,
661                                       GLsizei bufSize,
662                                       GLsizei *length,
663                                       GLchar *label)
664 {
665     Context *context = GetValidGlobalContext();
666     EVENT(context, GLGetObjectPtrLabel,
667           "context = %d, ptr = 0x%016" PRIxPTR ", bufSize = %d, length = 0x%016" PRIxPTR
668           ", label = 0x%016" PRIxPTR "",
669           CID(context), (uintptr_t)ptr, bufSize, (uintptr_t)length, (uintptr_t)label);
670 
671     if (context)
672     {
673         SCOPED_SHARE_CONTEXT_LOCK(context);
674         bool isCallValid =
675             (context->skipValidation() ||
676              ValidateGetObjectPtrLabel(context, angle::EntryPoint::GLGetObjectPtrLabel, ptr,
677                                        bufSize, length, label));
678         if (isCallValid)
679         {
680             context->getObjectPtrLabel(ptr, bufSize, length, label);
681         }
682         ANGLE_CAPTURE_GL(GetObjectPtrLabel, isCallValid, context, ptr, bufSize, length, label);
683     }
684     else
685     {
686         GenerateContextLostErrorOnCurrentGlobalContext();
687     }
688     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
689 }
690 
GL_GetPointerv(GLenum pname,void ** params)691 void GL_APIENTRY GL_GetPointerv(GLenum pname, void **params)
692 {
693     Context *context = GetValidGlobalContext();
694     EVENT(context, GLGetPointerv, "context = %d, pname = %s, params = 0x%016" PRIxPTR "",
695           CID(context), GLenumToString(GLESEnum::GetPointervPName, pname), (uintptr_t)params);
696 
697     if (context)
698     {
699         SCOPED_SHARE_CONTEXT_LOCK(context);
700         bool isCallValid =
701             (context->skipValidation() ||
702              ValidateGetPointerv(context, angle::EntryPoint::GLGetPointerv, pname, params));
703         if (isCallValid)
704         {
705             context->getPointerv(pname, params);
706         }
707         ANGLE_CAPTURE_GL(GetPointerv, isCallValid, context, pname, params);
708     }
709     else
710     {
711         GenerateContextLostErrorOnCurrentGlobalContext();
712     }
713     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
714 }
715 
GL_GetSamplerParameterIiv(GLuint sampler,GLenum pname,GLint * params)716 void GL_APIENTRY GL_GetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
717 {
718     Context *context = GetValidGlobalContext();
719     EVENT(context, GLGetSamplerParameterIiv,
720           "context = %d, sampler = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
721           sampler, GLenumToString(GLESEnum::SamplerParameterI, pname), (uintptr_t)params);
722 
723     if (context)
724     {
725         SamplerID samplerPacked = PackParam<SamplerID>(sampler);
726         SCOPED_SHARE_CONTEXT_LOCK(context);
727         bool isCallValid =
728             (context->skipValidation() ||
729              ValidateGetSamplerParameterIiv(context, angle::EntryPoint::GLGetSamplerParameterIiv,
730                                             samplerPacked, pname, params));
731         if (isCallValid)
732         {
733             context->getSamplerParameterIiv(samplerPacked, pname, params);
734         }
735         ANGLE_CAPTURE_GL(GetSamplerParameterIiv, isCallValid, context, samplerPacked, pname,
736                          params);
737     }
738     else
739     {
740         GenerateContextLostErrorOnCurrentGlobalContext();
741     }
742     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
743 }
744 
GL_GetSamplerParameterIuiv(GLuint sampler,GLenum pname,GLuint * params)745 void GL_APIENTRY GL_GetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
746 {
747     Context *context = GetValidGlobalContext();
748     EVENT(context, GLGetSamplerParameterIuiv,
749           "context = %d, sampler = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
750           sampler, GLenumToString(GLESEnum::SamplerParameterI, pname), (uintptr_t)params);
751 
752     if (context)
753     {
754         SamplerID samplerPacked = PackParam<SamplerID>(sampler);
755         SCOPED_SHARE_CONTEXT_LOCK(context);
756         bool isCallValid =
757             (context->skipValidation() ||
758              ValidateGetSamplerParameterIuiv(context, angle::EntryPoint::GLGetSamplerParameterIuiv,
759                                              samplerPacked, pname, params));
760         if (isCallValid)
761         {
762             context->getSamplerParameterIuiv(samplerPacked, pname, params);
763         }
764         ANGLE_CAPTURE_GL(GetSamplerParameterIuiv, isCallValid, context, samplerPacked, pname,
765                          params);
766     }
767     else
768     {
769         GenerateContextLostErrorOnCurrentGlobalContext();
770     }
771     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
772 }
773 
GL_GetTexParameterIiv(GLenum target,GLenum pname,GLint * params)774 void GL_APIENTRY GL_GetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
775 {
776     Context *context = GetValidGlobalContext();
777     EVENT(context, GLGetTexParameterIiv,
778           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
779           GLenumToString(GLESEnum::TextureTarget, target),
780           GLenumToString(GLESEnum::GetTextureParameter, pname), (uintptr_t)params);
781 
782     if (context)
783     {
784         TextureType targetPacked = PackParam<TextureType>(target);
785         SCOPED_SHARE_CONTEXT_LOCK(context);
786         bool isCallValid =
787             (context->skipValidation() ||
788              ValidateGetTexParameterIiv(context, angle::EntryPoint::GLGetTexParameterIiv,
789                                         targetPacked, pname, params));
790         if (isCallValid)
791         {
792             context->getTexParameterIiv(targetPacked, pname, params);
793         }
794         ANGLE_CAPTURE_GL(GetTexParameterIiv, isCallValid, context, targetPacked, pname, params);
795     }
796     else
797     {
798         GenerateContextLostErrorOnCurrentGlobalContext();
799     }
800     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
801 }
802 
GL_GetTexParameterIuiv(GLenum target,GLenum pname,GLuint * params)803 void GL_APIENTRY GL_GetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
804 {
805     Context *context = GetValidGlobalContext();
806     EVENT(context, GLGetTexParameterIuiv,
807           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
808           GLenumToString(GLESEnum::TextureTarget, target),
809           GLenumToString(GLESEnum::GetTextureParameter, pname), (uintptr_t)params);
810 
811     if (context)
812     {
813         TextureType targetPacked = PackParam<TextureType>(target);
814         SCOPED_SHARE_CONTEXT_LOCK(context);
815         bool isCallValid =
816             (context->skipValidation() ||
817              ValidateGetTexParameterIuiv(context, angle::EntryPoint::GLGetTexParameterIuiv,
818                                          targetPacked, pname, params));
819         if (isCallValid)
820         {
821             context->getTexParameterIuiv(targetPacked, pname, params);
822         }
823         ANGLE_CAPTURE_GL(GetTexParameterIuiv, isCallValid, context, targetPacked, pname, params);
824     }
825     else
826     {
827         GenerateContextLostErrorOnCurrentGlobalContext();
828     }
829     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
830 }
831 
GL_GetnUniformfv(GLuint program,GLint location,GLsizei bufSize,GLfloat * params)832 void GL_APIENTRY GL_GetnUniformfv(GLuint program, GLint location, GLsizei bufSize, GLfloat *params)
833 {
834     Context *context = GetValidGlobalContext();
835     EVENT(context, GLGetnUniformfv,
836           "context = %d, program = %u, location = %d, bufSize = %d, params = 0x%016" PRIxPTR "",
837           CID(context), program, location, bufSize, (uintptr_t)params);
838 
839     if (context)
840     {
841         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
842         UniformLocation locationPacked = PackParam<UniformLocation>(location);
843         SCOPED_SHARE_CONTEXT_LOCK(context);
844         bool isCallValid = (context->skipValidation() ||
845                             ValidateGetnUniformfv(context, angle::EntryPoint::GLGetnUniformfv,
846                                                   programPacked, locationPacked, bufSize, params));
847         if (isCallValid)
848         {
849             context->getnUniformfv(programPacked, locationPacked, bufSize, params);
850         }
851         ANGLE_CAPTURE_GL(GetnUniformfv, isCallValid, context, programPacked, locationPacked,
852                          bufSize, params);
853     }
854     else
855     {
856         GenerateContextLostErrorOnCurrentGlobalContext();
857     }
858     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
859 }
860 
GL_GetnUniformiv(GLuint program,GLint location,GLsizei bufSize,GLint * params)861 void GL_APIENTRY GL_GetnUniformiv(GLuint program, GLint location, GLsizei bufSize, GLint *params)
862 {
863     Context *context = GetValidGlobalContext();
864     EVENT(context, GLGetnUniformiv,
865           "context = %d, program = %u, location = %d, bufSize = %d, params = 0x%016" PRIxPTR "",
866           CID(context), program, location, bufSize, (uintptr_t)params);
867 
868     if (context)
869     {
870         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
871         UniformLocation locationPacked = PackParam<UniformLocation>(location);
872         SCOPED_SHARE_CONTEXT_LOCK(context);
873         bool isCallValid = (context->skipValidation() ||
874                             ValidateGetnUniformiv(context, angle::EntryPoint::GLGetnUniformiv,
875                                                   programPacked, locationPacked, bufSize, params));
876         if (isCallValid)
877         {
878             context->getnUniformiv(programPacked, locationPacked, bufSize, params);
879         }
880         ANGLE_CAPTURE_GL(GetnUniformiv, isCallValid, context, programPacked, locationPacked,
881                          bufSize, params);
882     }
883     else
884     {
885         GenerateContextLostErrorOnCurrentGlobalContext();
886     }
887     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
888 }
889 
GL_GetnUniformuiv(GLuint program,GLint location,GLsizei bufSize,GLuint * params)890 void GL_APIENTRY GL_GetnUniformuiv(GLuint program, GLint location, GLsizei bufSize, GLuint *params)
891 {
892     Context *context = GetValidGlobalContext();
893     EVENT(context, GLGetnUniformuiv,
894           "context = %d, program = %u, location = %d, bufSize = %d, params = 0x%016" PRIxPTR "",
895           CID(context), program, location, bufSize, (uintptr_t)params);
896 
897     if (context)
898     {
899         ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
900         UniformLocation locationPacked = PackParam<UniformLocation>(location);
901         SCOPED_SHARE_CONTEXT_LOCK(context);
902         bool isCallValid = (context->skipValidation() ||
903                             ValidateGetnUniformuiv(context, angle::EntryPoint::GLGetnUniformuiv,
904                                                    programPacked, locationPacked, bufSize, params));
905         if (isCallValid)
906         {
907             context->getnUniformuiv(programPacked, locationPacked, bufSize, params);
908         }
909         ANGLE_CAPTURE_GL(GetnUniformuiv, isCallValid, context, programPacked, locationPacked,
910                          bufSize, params);
911     }
912     else
913     {
914         GenerateContextLostErrorOnCurrentGlobalContext();
915     }
916     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
917 }
918 
GL_IsEnabledi(GLenum target,GLuint index)919 GLboolean GL_APIENTRY GL_IsEnabledi(GLenum target, GLuint index)
920 {
921     Context *context = GetValidGlobalContext();
922     EVENT(context, GLIsEnabledi, "context = %d, target = %s, index = %u", CID(context),
923           GLenumToString(GLESEnum::EnableCap, target), index);
924 
925     GLboolean returnValue;
926     if (context)
927     {
928         bool isCallValid = (context->skipValidation() ||
929                             ValidateIsEnabledi(context->getPrivateState(),
930                                                context->getMutableErrorSetForValidation(),
931                                                angle::EntryPoint::GLIsEnabledi, target, index));
932         if (isCallValid)
933         {
934             returnValue =
935                 ContextPrivateIsEnabledi(context->getMutablePrivateState(),
936                                          context->getMutablePrivateStateCache(), target, index);
937         }
938         else
939         {
940             returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsEnabledi, GLboolean>();
941         }
942         ANGLE_CAPTURE_GL(IsEnabledi, isCallValid, context, target, index, returnValue);
943     }
944     else
945     {
946         GenerateContextLostErrorOnCurrentGlobalContext();
947         returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsEnabledi, GLboolean>();
948     }
949     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
950     return returnValue;
951 }
952 
GL_MinSampleShading(GLfloat value)953 void GL_APIENTRY GL_MinSampleShading(GLfloat value)
954 {
955     Context *context = GetValidGlobalContext();
956     EVENT(context, GLMinSampleShading, "context = %d, value = %f", CID(context), value);
957 
958     if (context)
959     {
960         bool isCallValid =
961             (context->skipValidation() ||
962              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
963                                                 context->getMutableErrorSetForValidation(),
964                                                 angle::EntryPoint::GLMinSampleShading) &&
965               ValidateMinSampleShading(context->getPrivateState(),
966                                        context->getMutableErrorSetForValidation(),
967                                        angle::EntryPoint::GLMinSampleShading, value)));
968         if (isCallValid)
969         {
970             ContextPrivateMinSampleShading(context->getMutablePrivateState(),
971                                            context->getMutablePrivateStateCache(), value);
972         }
973         ANGLE_CAPTURE_GL(MinSampleShading, isCallValid, context, value);
974     }
975     else
976     {
977         GenerateContextLostErrorOnCurrentGlobalContext();
978     }
979     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
980 }
981 
GL_ObjectLabel(GLenum identifier,GLuint name,GLsizei length,const GLchar * label)982 void GL_APIENTRY GL_ObjectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label)
983 {
984     Context *context = GetValidGlobalContext();
985     EVENT(context, GLObjectLabel,
986           "context = %d, identifier = %s, name = %u, length = %d, label = 0x%016" PRIxPTR "",
987           CID(context), GLenumToString(GLESEnum::ObjectIdentifier, identifier), name, length,
988           (uintptr_t)label);
989 
990     if (context)
991     {
992         SCOPED_SHARE_CONTEXT_LOCK(context);
993         bool isCallValid = (context->skipValidation() ||
994                             ValidateObjectLabel(context, angle::EntryPoint::GLObjectLabel,
995                                                 identifier, name, length, label));
996         if (isCallValid)
997         {
998             context->objectLabel(identifier, name, length, label);
999         }
1000         ANGLE_CAPTURE_GL(ObjectLabel, isCallValid, context, identifier, name, length, label);
1001     }
1002     else
1003     {
1004         GenerateContextLostErrorOnCurrentGlobalContext();
1005     }
1006     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1007 }
1008 
GL_ObjectPtrLabel(const void * ptr,GLsizei length,const GLchar * label)1009 void GL_APIENTRY GL_ObjectPtrLabel(const void *ptr, GLsizei length, const GLchar *label)
1010 {
1011     Context *context = GetValidGlobalContext();
1012     EVENT(context, GLObjectPtrLabel,
1013           "context = %d, ptr = 0x%016" PRIxPTR ", length = %d, label = 0x%016" PRIxPTR "",
1014           CID(context), (uintptr_t)ptr, length, (uintptr_t)label);
1015 
1016     if (context)
1017     {
1018         SCOPED_SHARE_CONTEXT_LOCK(context);
1019         bool isCallValid = (context->skipValidation() ||
1020                             ValidateObjectPtrLabel(context, angle::EntryPoint::GLObjectPtrLabel,
1021                                                    ptr, length, label));
1022         if (isCallValid)
1023         {
1024             context->objectPtrLabel(ptr, length, label);
1025         }
1026         ANGLE_CAPTURE_GL(ObjectPtrLabel, isCallValid, context, ptr, length, label);
1027     }
1028     else
1029     {
1030         GenerateContextLostErrorOnCurrentGlobalContext();
1031     }
1032     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1033 }
1034 
GL_PatchParameteri(GLenum pname,GLint value)1035 void GL_APIENTRY GL_PatchParameteri(GLenum pname, GLint value)
1036 {
1037     Context *context = GetValidGlobalContext();
1038     EVENT(context, GLPatchParameteri, "context = %d, pname = %s, value = %d", CID(context),
1039           GLenumToString(GLESEnum::PatchParameterName, pname), value);
1040 
1041     if (context)
1042     {
1043         bool isCallValid =
1044             (context->skipValidation() ||
1045              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1046                                                 context->getMutableErrorSetForValidation(),
1047                                                 angle::EntryPoint::GLPatchParameteri) &&
1048               ValidatePatchParameteri(context->getPrivateState(),
1049                                       context->getMutableErrorSetForValidation(),
1050                                       angle::EntryPoint::GLPatchParameteri, pname, value)));
1051         if (isCallValid)
1052         {
1053             ContextPrivatePatchParameteri(context->getMutablePrivateState(),
1054                                           context->getMutablePrivateStateCache(), pname, value);
1055         }
1056         ANGLE_CAPTURE_GL(PatchParameteri, isCallValid, context, pname, value);
1057     }
1058     else
1059     {
1060         GenerateContextLostErrorOnCurrentGlobalContext();
1061     }
1062     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1063 }
1064 
GL_PopDebugGroup()1065 void GL_APIENTRY GL_PopDebugGroup()
1066 {
1067     Context *context = GetValidGlobalContext();
1068     EVENT(context, GLPopDebugGroup, "context = %d", CID(context));
1069 
1070     if (context)
1071     {
1072         SCOPED_SHARE_CONTEXT_LOCK(context);
1073         bool isCallValid = (context->skipValidation() ||
1074                             ValidatePopDebugGroup(context, angle::EntryPoint::GLPopDebugGroup));
1075         if (isCallValid)
1076         {
1077             context->popDebugGroup();
1078         }
1079         ANGLE_CAPTURE_GL(PopDebugGroup, isCallValid, context);
1080     }
1081     else
1082     {
1083         GenerateContextLostErrorOnCurrentGlobalContext();
1084     }
1085     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1086 }
1087 
GL_PrimitiveBoundingBox(GLfloat minX,GLfloat minY,GLfloat minZ,GLfloat minW,GLfloat maxX,GLfloat maxY,GLfloat maxZ,GLfloat maxW)1088 void GL_APIENTRY GL_PrimitiveBoundingBox(GLfloat minX,
1089                                          GLfloat minY,
1090                                          GLfloat minZ,
1091                                          GLfloat minW,
1092                                          GLfloat maxX,
1093                                          GLfloat maxY,
1094                                          GLfloat maxZ,
1095                                          GLfloat maxW)
1096 {
1097     Context *context = GetValidGlobalContext();
1098     EVENT(context, GLPrimitiveBoundingBox,
1099           "context = %d, minX = %f, minY = %f, minZ = %f, minW = %f, maxX = %f, maxY = %f, maxZ = "
1100           "%f, maxW = %f",
1101           CID(context), minX, minY, minZ, minW, maxX, maxY, maxZ, maxW);
1102 
1103     if (context)
1104     {
1105         bool isCallValid =
1106             (context->skipValidation() ||
1107              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1108                                                 context->getMutableErrorSetForValidation(),
1109                                                 angle::EntryPoint::GLPrimitiveBoundingBox) &&
1110               ValidatePrimitiveBoundingBox(context->getPrivateState(),
1111                                            context->getMutableErrorSetForValidation(),
1112                                            angle::EntryPoint::GLPrimitiveBoundingBox, minX, minY,
1113                                            minZ, minW, maxX, maxY, maxZ, maxW)));
1114         if (isCallValid)
1115         {
1116             ContextPrivatePrimitiveBoundingBox(context->getMutablePrivateState(),
1117                                                context->getMutablePrivateStateCache(), minX, minY,
1118                                                minZ, minW, maxX, maxY, maxZ, maxW);
1119         }
1120         ANGLE_CAPTURE_GL(PrimitiveBoundingBox, isCallValid, context, minX, minY, minZ, minW, maxX,
1121                          maxY, maxZ, maxW);
1122     }
1123     else
1124     {
1125         GenerateContextLostErrorOnCurrentGlobalContext();
1126     }
1127     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1128 }
1129 
GL_PushDebugGroup(GLenum source,GLuint id,GLsizei length,const GLchar * message)1130 void GL_APIENTRY GL_PushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message)
1131 {
1132     Context *context = GetValidGlobalContext();
1133     EVENT(context, GLPushDebugGroup,
1134           "context = %d, source = %s, id = %u, length = %d, message = 0x%016" PRIxPTR "",
1135           CID(context), GLenumToString(GLESEnum::DebugSource, source), id, length,
1136           (uintptr_t)message);
1137 
1138     if (context)
1139     {
1140         SCOPED_SHARE_CONTEXT_LOCK(context);
1141         bool isCallValid = (context->skipValidation() ||
1142                             ValidatePushDebugGroup(context, angle::EntryPoint::GLPushDebugGroup,
1143                                                    source, id, length, message));
1144         if (isCallValid)
1145         {
1146             context->pushDebugGroup(source, id, length, message);
1147         }
1148         ANGLE_CAPTURE_GL(PushDebugGroup, isCallValid, context, source, id, length, message);
1149     }
1150     else
1151     {
1152         GenerateContextLostErrorOnCurrentGlobalContext();
1153     }
1154     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1155 }
1156 
GL_ReadnPixels(GLint x,GLint y,GLsizei width,GLsizei height,GLenum format,GLenum type,GLsizei bufSize,void * data)1157 void GL_APIENTRY GL_ReadnPixels(GLint x,
1158                                 GLint y,
1159                                 GLsizei width,
1160                                 GLsizei height,
1161                                 GLenum format,
1162                                 GLenum type,
1163                                 GLsizei bufSize,
1164                                 void *data)
1165 {
1166     Context *context = GetValidGlobalContext();
1167     EVENT(context, GLReadnPixels,
1168           "context = %d, x = %d, y = %d, width = %d, height = %d, format = %s, type = %s, bufSize "
1169           "= %d, data = 0x%016" PRIxPTR "",
1170           CID(context), x, y, width, height, GLenumToString(GLESEnum::PixelFormat, format),
1171           GLenumToString(GLESEnum::PixelType, type), bufSize, (uintptr_t)data);
1172 
1173     if (context)
1174     {
1175         SCOPED_SHARE_CONTEXT_LOCK(context);
1176         bool isCallValid =
1177             (context->skipValidation() ||
1178              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1179                                                 context->getMutableErrorSetForValidation(),
1180                                                 angle::EntryPoint::GLReadnPixels) &&
1181               ValidateReadnPixels(context, angle::EntryPoint::GLReadnPixels, x, y, width, height,
1182                                   format, type, bufSize, data)));
1183         if (isCallValid)
1184         {
1185             context->readnPixels(x, y, width, height, format, type, bufSize, data);
1186         }
1187         ANGLE_CAPTURE_GL(ReadnPixels, isCallValid, context, x, y, width, height, format, type,
1188                          bufSize, data);
1189     }
1190     else
1191     {
1192         GenerateContextLostErrorOnCurrentGlobalContext();
1193     }
1194     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1195 }
1196 
GL_SamplerParameterIiv(GLuint sampler,GLenum pname,const GLint * param)1197 void GL_APIENTRY GL_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param)
1198 {
1199     Context *context = GetValidGlobalContext();
1200     EVENT(context, GLSamplerParameterIiv,
1201           "context = %d, sampler = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
1202           sampler, GLenumToString(GLESEnum::SamplerParameterI, pname), (uintptr_t)param);
1203 
1204     if (context)
1205     {
1206         SamplerID samplerPacked = PackParam<SamplerID>(sampler);
1207         SCOPED_SHARE_CONTEXT_LOCK(context);
1208         bool isCallValid =
1209             (context->skipValidation() ||
1210              ValidateSamplerParameterIiv(context, angle::EntryPoint::GLSamplerParameterIiv,
1211                                          samplerPacked, pname, param));
1212         if (isCallValid)
1213         {
1214             context->samplerParameterIiv(samplerPacked, pname, param);
1215         }
1216         ANGLE_CAPTURE_GL(SamplerParameterIiv, isCallValid, context, samplerPacked, pname, param);
1217     }
1218     else
1219     {
1220         GenerateContextLostErrorOnCurrentGlobalContext();
1221     }
1222     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1223 }
1224 
GL_SamplerParameterIuiv(GLuint sampler,GLenum pname,const GLuint * param)1225 void GL_APIENTRY GL_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param)
1226 {
1227     Context *context = GetValidGlobalContext();
1228     EVENT(context, GLSamplerParameterIuiv,
1229           "context = %d, sampler = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
1230           sampler, GLenumToString(GLESEnum::SamplerParameterI, pname), (uintptr_t)param);
1231 
1232     if (context)
1233     {
1234         SamplerID samplerPacked = PackParam<SamplerID>(sampler);
1235         SCOPED_SHARE_CONTEXT_LOCK(context);
1236         bool isCallValid =
1237             (context->skipValidation() ||
1238              ValidateSamplerParameterIuiv(context, angle::EntryPoint::GLSamplerParameterIuiv,
1239                                           samplerPacked, pname, param));
1240         if (isCallValid)
1241         {
1242             context->samplerParameterIuiv(samplerPacked, pname, param);
1243         }
1244         ANGLE_CAPTURE_GL(SamplerParameterIuiv, isCallValid, context, samplerPacked, pname, param);
1245     }
1246     else
1247     {
1248         GenerateContextLostErrorOnCurrentGlobalContext();
1249     }
1250     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1251 }
1252 
GL_TexBuffer(GLenum target,GLenum internalformat,GLuint buffer)1253 void GL_APIENTRY GL_TexBuffer(GLenum target, GLenum internalformat, GLuint buffer)
1254 {
1255     Context *context = GetValidGlobalContext();
1256     EVENT(context, GLTexBuffer, "context = %d, target = %s, internalformat = %s, buffer = %u",
1257           CID(context), GLenumToString(GLESEnum::TextureTarget, target),
1258           GLenumToString(GLESEnum::SizedInternalFormat, internalformat), buffer);
1259 
1260     if (context)
1261     {
1262         TextureType targetPacked = PackParam<TextureType>(target);
1263         BufferID bufferPacked    = PackParam<BufferID>(buffer);
1264         SCOPED_SHARE_CONTEXT_LOCK(context);
1265         bool isCallValid =
1266             (context->skipValidation() ||
1267              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1268                                                 context->getMutableErrorSetForValidation(),
1269                                                 angle::EntryPoint::GLTexBuffer) &&
1270               ValidateTexBuffer(context, angle::EntryPoint::GLTexBuffer, targetPacked,
1271                                 internalformat, bufferPacked)));
1272         if (isCallValid)
1273         {
1274             context->texBuffer(targetPacked, internalformat, bufferPacked);
1275         }
1276         ANGLE_CAPTURE_GL(TexBuffer, isCallValid, context, targetPacked, internalformat,
1277                          bufferPacked);
1278     }
1279     else
1280     {
1281         GenerateContextLostErrorOnCurrentGlobalContext();
1282     }
1283     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1284 }
1285 
GL_TexBufferRange(GLenum target,GLenum internalformat,GLuint buffer,GLintptr offset,GLsizeiptr size)1286 void GL_APIENTRY GL_TexBufferRange(GLenum target,
1287                                    GLenum internalformat,
1288                                    GLuint buffer,
1289                                    GLintptr offset,
1290                                    GLsizeiptr size)
1291 {
1292     Context *context = GetValidGlobalContext();
1293     EVENT(context, GLTexBufferRange,
1294           "context = %d, target = %s, internalformat = %s, buffer = %u, offset = %llu, size = %llu",
1295           CID(context), GLenumToString(GLESEnum::TextureTarget, target),
1296           GLenumToString(GLESEnum::SizedInternalFormat, internalformat), buffer,
1297           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size));
1298 
1299     if (context)
1300     {
1301         TextureType targetPacked = PackParam<TextureType>(target);
1302         BufferID bufferPacked    = PackParam<BufferID>(buffer);
1303         SCOPED_SHARE_CONTEXT_LOCK(context);
1304         bool isCallValid =
1305             (context->skipValidation() ||
1306              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1307                                                 context->getMutableErrorSetForValidation(),
1308                                                 angle::EntryPoint::GLTexBufferRange) &&
1309               ValidateTexBufferRange(context, angle::EntryPoint::GLTexBufferRange, targetPacked,
1310                                      internalformat, bufferPacked, offset, size)));
1311         if (isCallValid)
1312         {
1313             context->texBufferRange(targetPacked, internalformat, bufferPacked, offset, size);
1314         }
1315         ANGLE_CAPTURE_GL(TexBufferRange, isCallValid, context, targetPacked, internalformat,
1316                          bufferPacked, offset, size);
1317     }
1318     else
1319     {
1320         GenerateContextLostErrorOnCurrentGlobalContext();
1321     }
1322     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1323 }
1324 
GL_TexParameterIiv(GLenum target,GLenum pname,const GLint * params)1325 void GL_APIENTRY GL_TexParameterIiv(GLenum target, GLenum pname, const GLint *params)
1326 {
1327     Context *context = GetValidGlobalContext();
1328     EVENT(context, GLTexParameterIiv,
1329           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
1330           GLenumToString(GLESEnum::TextureTarget, target),
1331           GLenumToString(GLESEnum::TextureParameterName, pname), (uintptr_t)params);
1332 
1333     if (context)
1334     {
1335         TextureType targetPacked = PackParam<TextureType>(target);
1336         SCOPED_SHARE_CONTEXT_LOCK(context);
1337         bool isCallValid = (context->skipValidation() ||
1338                             ValidateTexParameterIiv(context, angle::EntryPoint::GLTexParameterIiv,
1339                                                     targetPacked, pname, params));
1340         if (isCallValid)
1341         {
1342             context->texParameterIiv(targetPacked, pname, params);
1343         }
1344         ANGLE_CAPTURE_GL(TexParameterIiv, isCallValid, context, targetPacked, pname, params);
1345     }
1346     else
1347     {
1348         GenerateContextLostErrorOnCurrentGlobalContext();
1349     }
1350     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1351 }
1352 
GL_TexParameterIuiv(GLenum target,GLenum pname,const GLuint * params)1353 void GL_APIENTRY GL_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
1354 {
1355     Context *context = GetValidGlobalContext();
1356     EVENT(context, GLTexParameterIuiv,
1357           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
1358           GLenumToString(GLESEnum::TextureTarget, target),
1359           GLenumToString(GLESEnum::TextureParameterName, pname), (uintptr_t)params);
1360 
1361     if (context)
1362     {
1363         TextureType targetPacked = PackParam<TextureType>(target);
1364         SCOPED_SHARE_CONTEXT_LOCK(context);
1365         bool isCallValid = (context->skipValidation() ||
1366                             ValidateTexParameterIuiv(context, angle::EntryPoint::GLTexParameterIuiv,
1367                                                      targetPacked, pname, params));
1368         if (isCallValid)
1369         {
1370             context->texParameterIuiv(targetPacked, pname, params);
1371         }
1372         ANGLE_CAPTURE_GL(TexParameterIuiv, isCallValid, context, targetPacked, pname, params);
1373     }
1374     else
1375     {
1376         GenerateContextLostErrorOnCurrentGlobalContext();
1377     }
1378     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1379 }
1380 
GL_TexStorage3DMultisample(GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLboolean fixedsamplelocations)1381 void GL_APIENTRY GL_TexStorage3DMultisample(GLenum target,
1382                                             GLsizei samples,
1383                                             GLenum internalformat,
1384                                             GLsizei width,
1385                                             GLsizei height,
1386                                             GLsizei depth,
1387                                             GLboolean fixedsamplelocations)
1388 {
1389     Context *context = GetValidGlobalContext();
1390     EVENT(context, GLTexStorage3DMultisample,
1391           "context = %d, target = %s, samples = %d, internalformat = %s, width = %d, height = %d, "
1392           "depth = %d, fixedsamplelocations = %s",
1393           CID(context), GLenumToString(GLESEnum::TextureTarget, target), samples,
1394           GLenumToString(GLESEnum::SizedInternalFormat, internalformat), width, height, depth,
1395           GLbooleanToString(fixedsamplelocations));
1396 
1397     if (context)
1398     {
1399         TextureType targetPacked = PackParam<TextureType>(target);
1400         SCOPED_SHARE_CONTEXT_LOCK(context);
1401         bool isCallValid =
1402             (context->skipValidation() ||
1403              (ValidatePixelLocalStorageInactive(context->getPrivateState(),
1404                                                 context->getMutableErrorSetForValidation(),
1405                                                 angle::EntryPoint::GLTexStorage3DMultisample) &&
1406               ValidateTexStorage3DMultisample(context, angle::EntryPoint::GLTexStorage3DMultisample,
1407                                               targetPacked, samples, internalformat, width, height,
1408                                               depth, fixedsamplelocations)));
1409         if (isCallValid)
1410         {
1411             context->texStorage3DMultisample(targetPacked, samples, internalformat, width, height,
1412                                              depth, fixedsamplelocations);
1413         }
1414         ANGLE_CAPTURE_GL(TexStorage3DMultisample, isCallValid, context, targetPacked, samples,
1415                          internalformat, width, height, depth, fixedsamplelocations);
1416     }
1417     else
1418     {
1419         GenerateContextLostErrorOnCurrentGlobalContext();
1420     }
1421     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1422 }
1423 
1424 }  // extern "C"
1425