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