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