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