• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by generate_entry_points.py using data from gl.xml.
3 //
4 // Copyright 2020 The ANGLE Project Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style license that can be
6 // found in the LICENSE file.
7 //
8 // entry_points_gl_4_5_autogen.cpp:
9 //   Defines the GL 4.5 entry points.
10 
11 #include "libGL/entry_points_gl_4_5_autogen.h"
12 
13 #include "libANGLE/Context.h"
14 #include "libANGLE/Context.inl.h"
15 #include "libANGLE/entry_points_utils.h"
16 #include "libANGLE/gl_enum_utils.h"
17 #include "libANGLE/validationEGL.h"
18 #include "libANGLE/validationES.h"
19 #include "libANGLE/validationES1.h"
20 #include "libANGLE/validationES2.h"
21 #include "libANGLE/validationES3.h"
22 #include "libANGLE/validationES31.h"
23 #include "libANGLE/validationES32.h"
24 #include "libANGLE/validationESEXT.h"
25 #include "libANGLE/validationGL45_autogen.h"
26 #include "libGLESv2/global_state.h"
27 
28 namespace gl
29 {
BindTextureUnit(GLuint unit,GLuint texture)30 void GL_APIENTRY BindTextureUnit(GLuint unit, GLuint texture)
31 {
32     Context *context = GetValidGlobalContext();
33     EVENT("glBindTextureUnit", "context = %d, GLuint unit = %u, GLuint texture = %u", CID(context),
34           unit, texture);
35 
36     if (context)
37     {
38         TextureID texturePacked                               = FromGL<TextureID>(texture);
39         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
40         bool isCallValid =
41             (context->skipValidation() || ValidateBindTextureUnit(context, unit, texturePacked));
42         if (isCallValid)
43         {
44             context->bindTextureUnit(unit, texturePacked);
45         }
46         ANGLE_CAPTURE(BindTextureUnit, isCallValid, context, unit, texturePacked);
47     }
48 }
49 
BlitNamedFramebuffer(GLuint readFramebuffer,GLuint drawFramebuffer,GLint srcX0,GLint srcY0,GLint srcX1,GLint srcY1,GLint dstX0,GLint dstY0,GLint dstX1,GLint dstY1,GLbitfield mask,GLenum filter)50 void GL_APIENTRY BlitNamedFramebuffer(GLuint readFramebuffer,
51                                       GLuint drawFramebuffer,
52                                       GLint srcX0,
53                                       GLint srcY0,
54                                       GLint srcX1,
55                                       GLint srcY1,
56                                       GLint dstX0,
57                                       GLint dstY0,
58                                       GLint dstX1,
59                                       GLint dstY1,
60                                       GLbitfield mask,
61                                       GLenum filter)
62 {
63     Context *context = GetValidGlobalContext();
64     EVENT("glBlitNamedFramebuffer",
65           "context = %d, GLuint readFramebuffer = %u, GLuint drawFramebuffer = %u, GLint srcX0 = "
66           "%d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, GLint dstX0 = %d, GLint dstY0 "
67           "= %d, GLint dstX1 = %d, GLint dstY1 = %d, GLbitfield mask = %s, GLenum filter = %s",
68           CID(context), readFramebuffer, drawFramebuffer, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0,
69           dstX1, dstY1, GLbitfieldToString(GLenumGroup::ClearBufferMask, mask).c_str(),
70           GLenumToString(GLenumGroup::BlitFramebufferFilter, filter));
71 
72     if (context)
73     {
74         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
75         bool isCallValid =
76             (context->skipValidation() ||
77              ValidateBlitNamedFramebuffer(context, readFramebuffer, drawFramebuffer, srcX0, srcY0,
78                                           srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter));
79         if (isCallValid)
80         {
81             context->blitNamedFramebuffer(readFramebuffer, drawFramebuffer, srcX0, srcY0, srcX1,
82                                           srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
83         }
84         ANGLE_CAPTURE(BlitNamedFramebuffer, isCallValid, context, readFramebuffer, drawFramebuffer,
85                       srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
86     }
87 }
88 
CheckNamedFramebufferStatus(GLuint framebuffer,GLenum target)89 GLenum GL_APIENTRY CheckNamedFramebufferStatus(GLuint framebuffer, GLenum target)
90 {
91     Context *context = GetValidGlobalContext();
92     EVENT("glCheckNamedFramebufferStatus",
93           "context = %d, GLuint framebuffer = %u, GLenum target = %s", CID(context), framebuffer,
94           GLenumToString(GLenumGroup::FramebufferTarget, target));
95 
96     GLenum returnValue;
97     if (context)
98     {
99         FramebufferID framebufferPacked                       = FromGL<FramebufferID>(framebuffer);
100         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
101         bool isCallValid = (context->skipValidation() || ValidateCheckNamedFramebufferStatus(
102                                                              context, framebufferPacked, target));
103         if (isCallValid)
104         {
105             returnValue = context->checkNamedFramebufferStatus(framebufferPacked, target);
106         }
107         else
108         {
109             returnValue = GetDefaultReturnValue<EntryPoint::CheckNamedFramebufferStatus, GLenum>();
110         }
111         ANGLE_CAPTURE(CheckNamedFramebufferStatus, isCallValid, context, framebufferPacked, target,
112                       returnValue);
113     }
114     else
115     {
116         returnValue = GetDefaultReturnValue<EntryPoint::CheckNamedFramebufferStatus, GLenum>();
117     }
118     return returnValue;
119 }
120 
ClearNamedBufferData(GLuint buffer,GLenum internalformat,GLenum format,GLenum type,const void * data)121 void GL_APIENTRY ClearNamedBufferData(GLuint buffer,
122                                       GLenum internalformat,
123                                       GLenum format,
124                                       GLenum type,
125                                       const void *data)
126 {
127     Context *context = GetValidGlobalContext();
128     EVENT("glClearNamedBufferData",
129           "context = %d, GLuint buffer = %u, GLenum internalformat = %s, GLenum format = %s, "
130           "GLenum type = %s, const void *data = 0x%016" PRIxPTR "",
131           CID(context), buffer, GLenumToString(GLenumGroup::InternalFormat, internalformat),
132           GLenumToString(GLenumGroup::PixelFormat, format),
133           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)data);
134 
135     if (context)
136     {
137         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
138         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
139         bool isCallValid                                      = (context->skipValidation() ||
140                             ValidateClearNamedBufferData(context, bufferPacked, internalformat,
141                                                          format, type, data));
142         if (isCallValid)
143         {
144             context->clearNamedBufferData(bufferPacked, internalformat, format, type, data);
145         }
146         ANGLE_CAPTURE(ClearNamedBufferData, isCallValid, context, bufferPacked, internalformat,
147                       format, type, data);
148     }
149 }
150 
ClearNamedBufferSubData(GLuint buffer,GLenum internalformat,GLintptr offset,GLsizeiptr size,GLenum format,GLenum type,const void * data)151 void GL_APIENTRY ClearNamedBufferSubData(GLuint buffer,
152                                          GLenum internalformat,
153                                          GLintptr offset,
154                                          GLsizeiptr size,
155                                          GLenum format,
156                                          GLenum type,
157                                          const void *data)
158 {
159     Context *context = GetValidGlobalContext();
160     EVENT("glClearNamedBufferSubData",
161           "context = %d, GLuint buffer = %u, GLenum internalformat = %s, GLintptr offset = %llu, "
162           "GLsizeiptr size = %llu, GLenum format = %s, GLenum type = %s, const void *data = "
163           "0x%016" PRIxPTR "",
164           CID(context), buffer, GLenumToString(GLenumGroup::InternalFormat, internalformat),
165           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size),
166           GLenumToString(GLenumGroup::PixelFormat, format),
167           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)data);
168 
169     if (context)
170     {
171         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
172         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
173         bool isCallValid                                      = (context->skipValidation() ||
174                             ValidateClearNamedBufferSubData(context, bufferPacked, internalformat,
175                                                             offset, size, format, type, data));
176         if (isCallValid)
177         {
178             context->clearNamedBufferSubData(bufferPacked, internalformat, offset, size, format,
179                                              type, data);
180         }
181         ANGLE_CAPTURE(ClearNamedBufferSubData, isCallValid, context, bufferPacked, internalformat,
182                       offset, size, format, type, data);
183     }
184 }
185 
ClearNamedFramebufferfi(GLuint framebuffer,GLenum buffer,GLint drawbuffer,GLfloat depth,GLint stencil)186 void GL_APIENTRY ClearNamedFramebufferfi(GLuint framebuffer,
187                                          GLenum buffer,
188                                          GLint drawbuffer,
189                                          GLfloat depth,
190                                          GLint stencil)
191 {
192     Context *context = GetValidGlobalContext();
193     EVENT("glClearNamedFramebufferfi",
194           "context = %d, GLuint framebuffer = %u, GLenum buffer = %s, GLint drawbuffer = %d, "
195           "GLfloat depth = %f, GLint stencil = %d",
196           CID(context), framebuffer, GLenumToString(GLenumGroup::Buffer, buffer), drawbuffer, depth,
197           stencil);
198 
199     if (context)
200     {
201         FramebufferID framebufferPacked                       = FromGL<FramebufferID>(framebuffer);
202         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
203         bool isCallValid                                      = (context->skipValidation() ||
204                             ValidateClearNamedFramebufferfi(context, framebufferPacked, buffer,
205                                                             drawbuffer, depth, stencil));
206         if (isCallValid)
207         {
208             context->clearNamedFramebufferfi(framebufferPacked, buffer, drawbuffer, depth, stencil);
209         }
210         ANGLE_CAPTURE(ClearNamedFramebufferfi, isCallValid, context, framebufferPacked, buffer,
211                       drawbuffer, depth, stencil);
212     }
213 }
214 
ClearNamedFramebufferfv(GLuint framebuffer,GLenum buffer,GLint drawbuffer,const GLfloat * value)215 void GL_APIENTRY ClearNamedFramebufferfv(GLuint framebuffer,
216                                          GLenum buffer,
217                                          GLint drawbuffer,
218                                          const GLfloat *value)
219 {
220     Context *context = GetValidGlobalContext();
221     EVENT("glClearNamedFramebufferfv",
222           "context = %d, GLuint framebuffer = %u, GLenum buffer = %s, GLint drawbuffer = %d, const "
223           "GLfloat *value = 0x%016" PRIxPTR "",
224           CID(context), framebuffer, GLenumToString(GLenumGroup::Buffer, buffer), drawbuffer,
225           (uintptr_t)value);
226 
227     if (context)
228     {
229         FramebufferID framebufferPacked                       = FromGL<FramebufferID>(framebuffer);
230         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
231         bool isCallValid                                      = (context->skipValidation() ||
232                             ValidateClearNamedFramebufferfv(context, framebufferPacked, buffer,
233                                                             drawbuffer, value));
234         if (isCallValid)
235         {
236             context->clearNamedFramebufferfv(framebufferPacked, buffer, drawbuffer, value);
237         }
238         ANGLE_CAPTURE(ClearNamedFramebufferfv, isCallValid, context, framebufferPacked, buffer,
239                       drawbuffer, value);
240     }
241 }
242 
ClearNamedFramebufferiv(GLuint framebuffer,GLenum buffer,GLint drawbuffer,const GLint * value)243 void GL_APIENTRY ClearNamedFramebufferiv(GLuint framebuffer,
244                                          GLenum buffer,
245                                          GLint drawbuffer,
246                                          const GLint *value)
247 {
248     Context *context = GetValidGlobalContext();
249     EVENT("glClearNamedFramebufferiv",
250           "context = %d, GLuint framebuffer = %u, GLenum buffer = %s, GLint drawbuffer = %d, const "
251           "GLint *value = 0x%016" PRIxPTR "",
252           CID(context), framebuffer, GLenumToString(GLenumGroup::Buffer, buffer), drawbuffer,
253           (uintptr_t)value);
254 
255     if (context)
256     {
257         FramebufferID framebufferPacked                       = FromGL<FramebufferID>(framebuffer);
258         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
259         bool isCallValid                                      = (context->skipValidation() ||
260                             ValidateClearNamedFramebufferiv(context, framebufferPacked, buffer,
261                                                             drawbuffer, value));
262         if (isCallValid)
263         {
264             context->clearNamedFramebufferiv(framebufferPacked, buffer, drawbuffer, value);
265         }
266         ANGLE_CAPTURE(ClearNamedFramebufferiv, isCallValid, context, framebufferPacked, buffer,
267                       drawbuffer, value);
268     }
269 }
270 
ClearNamedFramebufferuiv(GLuint framebuffer,GLenum buffer,GLint drawbuffer,const GLuint * value)271 void GL_APIENTRY ClearNamedFramebufferuiv(GLuint framebuffer,
272                                           GLenum buffer,
273                                           GLint drawbuffer,
274                                           const GLuint *value)
275 {
276     Context *context = GetValidGlobalContext();
277     EVENT("glClearNamedFramebufferuiv",
278           "context = %d, GLuint framebuffer = %u, GLenum buffer = %s, GLint drawbuffer = %d, const "
279           "GLuint *value = 0x%016" PRIxPTR "",
280           CID(context), framebuffer, GLenumToString(GLenumGroup::Buffer, buffer), drawbuffer,
281           (uintptr_t)value);
282 
283     if (context)
284     {
285         FramebufferID framebufferPacked                       = FromGL<FramebufferID>(framebuffer);
286         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
287         bool isCallValid                                      = (context->skipValidation() ||
288                             ValidateClearNamedFramebufferuiv(context, framebufferPacked, buffer,
289                                                              drawbuffer, value));
290         if (isCallValid)
291         {
292             context->clearNamedFramebufferuiv(framebufferPacked, buffer, drawbuffer, value);
293         }
294         ANGLE_CAPTURE(ClearNamedFramebufferuiv, isCallValid, context, framebufferPacked, buffer,
295                       drawbuffer, value);
296     }
297 }
298 
ClipControl(GLenum origin,GLenum depth)299 void GL_APIENTRY ClipControl(GLenum origin, GLenum depth)
300 {
301     Context *context = GetValidGlobalContext();
302     EVENT("glClipControl", "context = %d, GLenum origin = %s, GLenum depth = %s", CID(context),
303           GLenumToString(GLenumGroup::ClipControlOrigin, origin),
304           GLenumToString(GLenumGroup::ClipControlDepth, depth));
305 
306     if (context)
307     {
308         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
309         bool isCallValid =
310             (context->skipValidation() || ValidateClipControl(context, origin, depth));
311         if (isCallValid)
312         {
313             context->clipControl(origin, depth);
314         }
315         ANGLE_CAPTURE(ClipControl, isCallValid, context, origin, depth);
316     }
317 }
318 
CompressedTextureSubImage1D(GLuint texture,GLint level,GLint xoffset,GLsizei width,GLenum format,GLsizei imageSize,const void * data)319 void GL_APIENTRY CompressedTextureSubImage1D(GLuint texture,
320                                              GLint level,
321                                              GLint xoffset,
322                                              GLsizei width,
323                                              GLenum format,
324                                              GLsizei imageSize,
325                                              const void *data)
326 {
327     Context *context = GetValidGlobalContext();
328     EVENT("glCompressedTextureSubImage1D",
329           "context = %d, GLuint texture = %u, GLint level = %d, GLint xoffset = %d, GLsizei width "
330           "= %d, GLenum format = %s, GLsizei imageSize = %d, const void *data = 0x%016" PRIxPTR "",
331           CID(context), texture, level, xoffset, width,
332           GLenumToString(GLenumGroup::PixelFormat, format), imageSize, (uintptr_t)data);
333 
334     if (context)
335     {
336         TextureID texturePacked                               = FromGL<TextureID>(texture);
337         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
338         bool isCallValid = (context->skipValidation() || ValidateCompressedTextureSubImage1D(
339                                                              context, texturePacked, level, xoffset,
340                                                              width, format, imageSize, data));
341         if (isCallValid)
342         {
343             context->compressedTextureSubImage1D(texturePacked, level, xoffset, width, format,
344                                                  imageSize, data);
345         }
346         ANGLE_CAPTURE(CompressedTextureSubImage1D, isCallValid, context, texturePacked, level,
347                       xoffset, width, format, imageSize, data);
348     }
349 }
350 
CompressedTextureSubImage2D(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLsizei imageSize,const void * data)351 void GL_APIENTRY CompressedTextureSubImage2D(GLuint texture,
352                                              GLint level,
353                                              GLint xoffset,
354                                              GLint yoffset,
355                                              GLsizei width,
356                                              GLsizei height,
357                                              GLenum format,
358                                              GLsizei imageSize,
359                                              const void *data)
360 {
361     Context *context = GetValidGlobalContext();
362     EVENT("glCompressedTextureSubImage2D",
363           "context = %d, GLuint texture = %u, GLint level = %d, GLint xoffset = %d, GLint yoffset "
364           "= %d, GLsizei width = %d, GLsizei height = %d, GLenum format = %s, GLsizei imageSize = "
365           "%d, const void *data = 0x%016" PRIxPTR "",
366           CID(context), texture, level, xoffset, yoffset, width, height,
367           GLenumToString(GLenumGroup::PixelFormat, format), imageSize, (uintptr_t)data);
368 
369     if (context)
370     {
371         TextureID texturePacked                               = FromGL<TextureID>(texture);
372         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
373         bool isCallValid =
374             (context->skipValidation() ||
375              ValidateCompressedTextureSubImage2D(context, texturePacked, level, xoffset, yoffset,
376                                                  width, height, format, imageSize, data));
377         if (isCallValid)
378         {
379             context->compressedTextureSubImage2D(texturePacked, level, xoffset, yoffset, width,
380                                                  height, format, imageSize, data);
381         }
382         ANGLE_CAPTURE(CompressedTextureSubImage2D, isCallValid, context, texturePacked, level,
383                       xoffset, yoffset, width, height, format, imageSize, data);
384     }
385 }
386 
CompressedTextureSubImage3D(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLsizei imageSize,const void * data)387 void GL_APIENTRY CompressedTextureSubImage3D(GLuint texture,
388                                              GLint level,
389                                              GLint xoffset,
390                                              GLint yoffset,
391                                              GLint zoffset,
392                                              GLsizei width,
393                                              GLsizei height,
394                                              GLsizei depth,
395                                              GLenum format,
396                                              GLsizei imageSize,
397                                              const void *data)
398 {
399     Context *context = GetValidGlobalContext();
400     EVENT("glCompressedTextureSubImage3D",
401           "context = %d, GLuint texture = %u, GLint level = %d, GLint xoffset = %d, GLint yoffset "
402           "= %d, GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, "
403           "GLenum format = %s, GLsizei imageSize = %d, const void *data = 0x%016" PRIxPTR "",
404           CID(context), texture, level, xoffset, yoffset, zoffset, width, height, depth,
405           GLenumToString(GLenumGroup::PixelFormat, format), imageSize, (uintptr_t)data);
406 
407     if (context)
408     {
409         TextureID texturePacked                               = FromGL<TextureID>(texture);
410         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
411         bool isCallValid                                      = (context->skipValidation() ||
412                             ValidateCompressedTextureSubImage3D(
413                                 context, texturePacked, level, xoffset, yoffset, zoffset, width,
414                                 height, depth, format, imageSize, data));
415         if (isCallValid)
416         {
417             context->compressedTextureSubImage3D(texturePacked, level, xoffset, yoffset, zoffset,
418                                                  width, height, depth, format, imageSize, data);
419         }
420         ANGLE_CAPTURE(CompressedTextureSubImage3D, isCallValid, context, texturePacked, level,
421                       xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
422     }
423 }
424 
CopyNamedBufferSubData(GLuint readBuffer,GLuint writeBuffer,GLintptr readOffset,GLintptr writeOffset,GLsizeiptr size)425 void GL_APIENTRY CopyNamedBufferSubData(GLuint readBuffer,
426                                         GLuint writeBuffer,
427                                         GLintptr readOffset,
428                                         GLintptr writeOffset,
429                                         GLsizeiptr size)
430 {
431     Context *context = GetValidGlobalContext();
432     EVENT("glCopyNamedBufferSubData",
433           "context = %d, GLuint readBuffer = %u, GLuint writeBuffer = %u, GLintptr readOffset = "
434           "%llu, GLintptr writeOffset = %llu, GLsizeiptr size = %llu",
435           CID(context), readBuffer, writeBuffer, static_cast<unsigned long long>(readOffset),
436           static_cast<unsigned long long>(writeOffset), static_cast<unsigned long long>(size));
437 
438     if (context)
439     {
440         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
441         bool isCallValid                                      = (context->skipValidation() ||
442                             ValidateCopyNamedBufferSubData(context, readBuffer, writeBuffer,
443                                                            readOffset, writeOffset, size));
444         if (isCallValid)
445         {
446             context->copyNamedBufferSubData(readBuffer, writeBuffer, readOffset, writeOffset, size);
447         }
448         ANGLE_CAPTURE(CopyNamedBufferSubData, isCallValid, context, readBuffer, writeBuffer,
449                       readOffset, writeOffset, size);
450     }
451 }
452 
453 void GL_APIENTRY
CopyTextureSubImage1D(GLuint texture,GLint level,GLint xoffset,GLint x,GLint y,GLsizei width)454 CopyTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
455 {
456     Context *context = GetValidGlobalContext();
457     EVENT("glCopyTextureSubImage1D",
458           "context = %d, GLuint texture = %u, GLint level = %d, GLint xoffset = %d, GLint x = %d, "
459           "GLint y = %d, GLsizei width = %d",
460           CID(context), texture, level, xoffset, x, y, width);
461 
462     if (context)
463     {
464         TextureID texturePacked                               = FromGL<TextureID>(texture);
465         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
466         bool isCallValid =
467             (context->skipValidation() ||
468              ValidateCopyTextureSubImage1D(context, texturePacked, level, xoffset, x, y, width));
469         if (isCallValid)
470         {
471             context->copyTextureSubImage1D(texturePacked, level, xoffset, x, y, width);
472         }
473         ANGLE_CAPTURE(CopyTextureSubImage1D, isCallValid, context, texturePacked, level, xoffset, x,
474                       y, width);
475     }
476 }
477 
CopyTextureSubImage2D(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLint x,GLint y,GLsizei width,GLsizei height)478 void GL_APIENTRY CopyTextureSubImage2D(GLuint texture,
479                                        GLint level,
480                                        GLint xoffset,
481                                        GLint yoffset,
482                                        GLint x,
483                                        GLint y,
484                                        GLsizei width,
485                                        GLsizei height)
486 {
487     Context *context = GetValidGlobalContext();
488     EVENT("glCopyTextureSubImage2D",
489           "context = %d, GLuint texture = %u, GLint level = %d, GLint xoffset = %d, GLint yoffset "
490           "= %d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d",
491           CID(context), texture, level, xoffset, yoffset, x, y, width, height);
492 
493     if (context)
494     {
495         TextureID texturePacked                               = FromGL<TextureID>(texture);
496         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
497         bool isCallValid                                      = (context->skipValidation() ||
498                             ValidateCopyTextureSubImage2D(context, texturePacked, level, xoffset,
499                                                           yoffset, x, y, width, height));
500         if (isCallValid)
501         {
502             context->copyTextureSubImage2D(texturePacked, level, xoffset, yoffset, x, y, width,
503                                            height);
504         }
505         ANGLE_CAPTURE(CopyTextureSubImage2D, isCallValid, context, texturePacked, level, xoffset,
506                       yoffset, x, y, width, height);
507     }
508 }
509 
CopyTextureSubImage3D(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLint x,GLint y,GLsizei width,GLsizei height)510 void GL_APIENTRY CopyTextureSubImage3D(GLuint texture,
511                                        GLint level,
512                                        GLint xoffset,
513                                        GLint yoffset,
514                                        GLint zoffset,
515                                        GLint x,
516                                        GLint y,
517                                        GLsizei width,
518                                        GLsizei height)
519 {
520     Context *context = GetValidGlobalContext();
521     EVENT("glCopyTextureSubImage3D",
522           "context = %d, GLuint texture = %u, GLint level = %d, GLint xoffset = %d, GLint yoffset "
523           "= %d, GLint zoffset = %d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei "
524           "height = %d",
525           CID(context), texture, level, xoffset, yoffset, zoffset, x, y, width, height);
526 
527     if (context)
528     {
529         TextureID texturePacked                               = FromGL<TextureID>(texture);
530         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
531         bool isCallValid                                      = (context->skipValidation() ||
532                             ValidateCopyTextureSubImage3D(context, texturePacked, level, xoffset,
533                                                           yoffset, zoffset, x, y, width, height));
534         if (isCallValid)
535         {
536             context->copyTextureSubImage3D(texturePacked, level, xoffset, yoffset, zoffset, x, y,
537                                            width, height);
538         }
539         ANGLE_CAPTURE(CopyTextureSubImage3D, isCallValid, context, texturePacked, level, xoffset,
540                       yoffset, zoffset, x, y, width, height);
541     }
542 }
543 
CreateBuffers(GLsizei n,GLuint * buffers)544 void GL_APIENTRY CreateBuffers(GLsizei n, GLuint *buffers)
545 {
546     Context *context = GetValidGlobalContext();
547     EVENT("glCreateBuffers", "context = %d, GLsizei n = %d, GLuint *buffers = 0x%016" PRIxPTR "",
548           CID(context), n, (uintptr_t)buffers);
549 
550     if (context)
551     {
552         BufferID *buffersPacked                               = FromGL<BufferID *>(buffers);
553         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
554         bool isCallValid =
555             (context->skipValidation() || ValidateCreateBuffers(context, n, buffersPacked));
556         if (isCallValid)
557         {
558             context->createBuffers(n, buffersPacked);
559         }
560         ANGLE_CAPTURE(CreateBuffers, isCallValid, context, n, buffersPacked);
561     }
562 }
563 
CreateFramebuffers(GLsizei n,GLuint * framebuffers)564 void GL_APIENTRY CreateFramebuffers(GLsizei n, GLuint *framebuffers)
565 {
566     Context *context = GetValidGlobalContext();
567     EVENT("glCreateFramebuffers",
568           "context = %d, GLsizei n = %d, GLuint *framebuffers = 0x%016" PRIxPTR "", CID(context), n,
569           (uintptr_t)framebuffers);
570 
571     if (context)
572     {
573         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
574         bool isCallValid =
575             (context->skipValidation() || ValidateCreateFramebuffers(context, n, framebuffers));
576         if (isCallValid)
577         {
578             context->createFramebuffers(n, framebuffers);
579         }
580         ANGLE_CAPTURE(CreateFramebuffers, isCallValid, context, n, framebuffers);
581     }
582 }
583 
CreateProgramPipelines(GLsizei n,GLuint * pipelines)584 void GL_APIENTRY CreateProgramPipelines(GLsizei n, GLuint *pipelines)
585 {
586     Context *context = GetValidGlobalContext();
587     EVENT("glCreateProgramPipelines",
588           "context = %d, GLsizei n = %d, GLuint *pipelines = 0x%016" PRIxPTR "", CID(context), n,
589           (uintptr_t)pipelines);
590 
591     if (context)
592     {
593         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
594         bool isCallValid =
595             (context->skipValidation() || ValidateCreateProgramPipelines(context, n, pipelines));
596         if (isCallValid)
597         {
598             context->createProgramPipelines(n, pipelines);
599         }
600         ANGLE_CAPTURE(CreateProgramPipelines, isCallValid, context, n, pipelines);
601     }
602 }
603 
CreateQueries(GLenum target,GLsizei n,GLuint * ids)604 void GL_APIENTRY CreateQueries(GLenum target, GLsizei n, GLuint *ids)
605 {
606     Context *context = GetValidGlobalContext();
607     EVENT("glCreateQueries",
608           "context = %d, GLenum target = %s, GLsizei n = %d, GLuint *ids = 0x%016" PRIxPTR "",
609           CID(context), GLenumToString(GLenumGroup::QueryTarget, target), n, (uintptr_t)ids);
610 
611     if (context)
612     {
613         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
614         bool isCallValid =
615             (context->skipValidation() || ValidateCreateQueries(context, target, n, ids));
616         if (isCallValid)
617         {
618             context->createQueries(target, n, ids);
619         }
620         ANGLE_CAPTURE(CreateQueries, isCallValid, context, target, n, ids);
621     }
622 }
623 
CreateRenderbuffers(GLsizei n,GLuint * renderbuffers)624 void GL_APIENTRY CreateRenderbuffers(GLsizei n, GLuint *renderbuffers)
625 {
626     Context *context = GetValidGlobalContext();
627     EVENT("glCreateRenderbuffers",
628           "context = %d, GLsizei n = %d, GLuint *renderbuffers = 0x%016" PRIxPTR "", CID(context),
629           n, (uintptr_t)renderbuffers);
630 
631     if (context)
632     {
633         RenderbufferID *renderbuffersPacked = FromGL<RenderbufferID *>(renderbuffers);
634         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
635         bool isCallValid                                      = (context->skipValidation() ||
636                             ValidateCreateRenderbuffers(context, n, renderbuffersPacked));
637         if (isCallValid)
638         {
639             context->createRenderbuffers(n, renderbuffersPacked);
640         }
641         ANGLE_CAPTURE(CreateRenderbuffers, isCallValid, context, n, renderbuffersPacked);
642     }
643 }
644 
CreateSamplers(GLsizei n,GLuint * samplers)645 void GL_APIENTRY CreateSamplers(GLsizei n, GLuint *samplers)
646 {
647     Context *context = GetValidGlobalContext();
648     EVENT("glCreateSamplers", "context = %d, GLsizei n = %d, GLuint *samplers = 0x%016" PRIxPTR "",
649           CID(context), n, (uintptr_t)samplers);
650 
651     if (context)
652     {
653         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
654         bool isCallValid =
655             (context->skipValidation() || ValidateCreateSamplers(context, n, samplers));
656         if (isCallValid)
657         {
658             context->createSamplers(n, samplers);
659         }
660         ANGLE_CAPTURE(CreateSamplers, isCallValid, context, n, samplers);
661     }
662 }
663 
CreateTextures(GLenum target,GLsizei n,GLuint * textures)664 void GL_APIENTRY CreateTextures(GLenum target, GLsizei n, GLuint *textures)
665 {
666     Context *context = GetValidGlobalContext();
667     EVENT("glCreateTextures",
668           "context = %d, GLenum target = %s, GLsizei n = %d, GLuint *textures = 0x%016" PRIxPTR "",
669           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), n, (uintptr_t)textures);
670 
671     if (context)
672     {
673         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
674         bool isCallValid =
675             (context->skipValidation() || ValidateCreateTextures(context, target, n, textures));
676         if (isCallValid)
677         {
678             context->createTextures(target, n, textures);
679         }
680         ANGLE_CAPTURE(CreateTextures, isCallValid, context, target, n, textures);
681     }
682 }
683 
CreateTransformFeedbacks(GLsizei n,GLuint * ids)684 void GL_APIENTRY CreateTransformFeedbacks(GLsizei n, GLuint *ids)
685 {
686     Context *context = GetValidGlobalContext();
687     EVENT("glCreateTransformFeedbacks",
688           "context = %d, GLsizei n = %d, GLuint *ids = 0x%016" PRIxPTR "", CID(context), n,
689           (uintptr_t)ids);
690 
691     if (context)
692     {
693         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
694         bool isCallValid =
695             (context->skipValidation() || ValidateCreateTransformFeedbacks(context, n, ids));
696         if (isCallValid)
697         {
698             context->createTransformFeedbacks(n, ids);
699         }
700         ANGLE_CAPTURE(CreateTransformFeedbacks, isCallValid, context, n, ids);
701     }
702 }
703 
CreateVertexArrays(GLsizei n,GLuint * arrays)704 void GL_APIENTRY CreateVertexArrays(GLsizei n, GLuint *arrays)
705 {
706     Context *context = GetValidGlobalContext();
707     EVENT("glCreateVertexArrays",
708           "context = %d, GLsizei n = %d, GLuint *arrays = 0x%016" PRIxPTR "", CID(context), n,
709           (uintptr_t)arrays);
710 
711     if (context)
712     {
713         VertexArrayID *arraysPacked                           = FromGL<VertexArrayID *>(arrays);
714         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
715         bool isCallValid =
716             (context->skipValidation() || ValidateCreateVertexArrays(context, n, arraysPacked));
717         if (isCallValid)
718         {
719             context->createVertexArrays(n, arraysPacked);
720         }
721         ANGLE_CAPTURE(CreateVertexArrays, isCallValid, context, n, arraysPacked);
722     }
723 }
724 
DisableVertexArrayAttrib(GLuint vaobj,GLuint index)725 void GL_APIENTRY DisableVertexArrayAttrib(GLuint vaobj, GLuint index)
726 {
727     Context *context = GetValidGlobalContext();
728     EVENT("glDisableVertexArrayAttrib", "context = %d, GLuint vaobj = %u, GLuint index = %u",
729           CID(context), vaobj, index);
730 
731     if (context)
732     {
733         VertexArrayID vaobjPacked                             = FromGL<VertexArrayID>(vaobj);
734         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
735         bool isCallValid                                      = (context->skipValidation() ||
736                             ValidateDisableVertexArrayAttrib(context, vaobjPacked, index));
737         if (isCallValid)
738         {
739             context->disableVertexArrayAttrib(vaobjPacked, index);
740         }
741         ANGLE_CAPTURE(DisableVertexArrayAttrib, isCallValid, context, vaobjPacked, index);
742     }
743 }
744 
EnableVertexArrayAttrib(GLuint vaobj,GLuint index)745 void GL_APIENTRY EnableVertexArrayAttrib(GLuint vaobj, GLuint index)
746 {
747     Context *context = GetValidGlobalContext();
748     EVENT("glEnableVertexArrayAttrib", "context = %d, GLuint vaobj = %u, GLuint index = %u",
749           CID(context), vaobj, index);
750 
751     if (context)
752     {
753         VertexArrayID vaobjPacked                             = FromGL<VertexArrayID>(vaobj);
754         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
755         bool isCallValid                                      = (context->skipValidation() ||
756                             ValidateEnableVertexArrayAttrib(context, vaobjPacked, index));
757         if (isCallValid)
758         {
759             context->enableVertexArrayAttrib(vaobjPacked, index);
760         }
761         ANGLE_CAPTURE(EnableVertexArrayAttrib, isCallValid, context, vaobjPacked, index);
762     }
763 }
764 
FlushMappedNamedBufferRange(GLuint buffer,GLintptr offset,GLsizeiptr length)765 void GL_APIENTRY FlushMappedNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length)
766 {
767     Context *context = GetValidGlobalContext();
768     EVENT("glFlushMappedNamedBufferRange",
769           "context = %d, GLuint buffer = %u, GLintptr offset = %llu, GLsizeiptr length = %llu",
770           CID(context), buffer, static_cast<unsigned long long>(offset),
771           static_cast<unsigned long long>(length));
772 
773     if (context)
774     {
775         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
776         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
777         bool isCallValid =
778             (context->skipValidation() ||
779              ValidateFlushMappedNamedBufferRange(context, bufferPacked, offset, length));
780         if (isCallValid)
781         {
782             context->flushMappedNamedBufferRange(bufferPacked, offset, length);
783         }
784         ANGLE_CAPTURE(FlushMappedNamedBufferRange, isCallValid, context, bufferPacked, offset,
785                       length);
786     }
787 }
788 
GenerateTextureMipmap(GLuint texture)789 void GL_APIENTRY GenerateTextureMipmap(GLuint texture)
790 {
791     Context *context = GetValidGlobalContext();
792     EVENT("glGenerateTextureMipmap", "context = %d, GLuint texture = %u", CID(context), texture);
793 
794     if (context)
795     {
796         TextureID texturePacked                               = FromGL<TextureID>(texture);
797         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
798         bool isCallValid =
799             (context->skipValidation() || ValidateGenerateTextureMipmap(context, texturePacked));
800         if (isCallValid)
801         {
802             context->generateTextureMipmap(texturePacked);
803         }
804         ANGLE_CAPTURE(GenerateTextureMipmap, isCallValid, context, texturePacked);
805     }
806 }
807 
GetCompressedTextureImage(GLuint texture,GLint level,GLsizei bufSize,void * pixels)808 void GL_APIENTRY GetCompressedTextureImage(GLuint texture,
809                                            GLint level,
810                                            GLsizei bufSize,
811                                            void *pixels)
812 {
813     Context *context = GetValidGlobalContext();
814     EVENT("glGetCompressedTextureImage",
815           "context = %d, GLuint texture = %u, GLint level = %d, GLsizei bufSize = %d, void *pixels "
816           "= 0x%016" PRIxPTR "",
817           CID(context), texture, level, bufSize, (uintptr_t)pixels);
818 
819     if (context)
820     {
821         TextureID texturePacked                               = FromGL<TextureID>(texture);
822         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
823         bool isCallValid =
824             (context->skipValidation() ||
825              ValidateGetCompressedTextureImage(context, texturePacked, level, bufSize, pixels));
826         if (isCallValid)
827         {
828             context->getCompressedTextureImage(texturePacked, level, bufSize, pixels);
829         }
830         ANGLE_CAPTURE(GetCompressedTextureImage, isCallValid, context, texturePacked, level,
831                       bufSize, pixels);
832     }
833 }
834 
GetCompressedTextureSubImage(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLsizei bufSize,void * pixels)835 void GL_APIENTRY GetCompressedTextureSubImage(GLuint texture,
836                                               GLint level,
837                                               GLint xoffset,
838                                               GLint yoffset,
839                                               GLint zoffset,
840                                               GLsizei width,
841                                               GLsizei height,
842                                               GLsizei depth,
843                                               GLsizei bufSize,
844                                               void *pixels)
845 {
846     Context *context = GetValidGlobalContext();
847     EVENT("glGetCompressedTextureSubImage",
848           "context = %d, GLuint texture = %u, GLint level = %d, GLint xoffset = %d, GLint yoffset "
849           "= %d, GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, "
850           "GLsizei bufSize = %d, void *pixels = 0x%016" PRIxPTR "",
851           CID(context), texture, level, xoffset, yoffset, zoffset, width, height, depth, bufSize,
852           (uintptr_t)pixels);
853 
854     if (context)
855     {
856         TextureID texturePacked                               = FromGL<TextureID>(texture);
857         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
858         bool isCallValid =
859             (context->skipValidation() ||
860              ValidateGetCompressedTextureSubImage(context, texturePacked, level, xoffset, yoffset,
861                                                   zoffset, width, height, depth, bufSize, pixels));
862         if (isCallValid)
863         {
864             context->getCompressedTextureSubImage(texturePacked, level, xoffset, yoffset, zoffset,
865                                                   width, height, depth, bufSize, pixels);
866         }
867         ANGLE_CAPTURE(GetCompressedTextureSubImage, isCallValid, context, texturePacked, level,
868                       xoffset, yoffset, zoffset, width, height, depth, bufSize, pixels);
869     }
870 }
871 
GetGraphicsResetStatus()872 GLenum GL_APIENTRY GetGraphicsResetStatus()
873 {
874     Context *context = GetGlobalContext();
875     EVENT("glGetGraphicsResetStatus", "context = %d", CID(context));
876 
877     GLenum returnValue;
878     if (context)
879     {
880         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
881         bool isCallValid = (context->skipValidation() || ValidateGetGraphicsResetStatus(context));
882         if (isCallValid)
883         {
884             returnValue = context->getGraphicsResetStatus();
885         }
886         else
887         {
888             returnValue = GetDefaultReturnValue<EntryPoint::GetGraphicsResetStatus, GLenum>();
889         }
890         ANGLE_CAPTURE(GetGraphicsResetStatus, isCallValid, context, returnValue);
891     }
892     else
893     {
894         returnValue = GetDefaultReturnValue<EntryPoint::GetGraphicsResetStatus, GLenum>();
895     }
896     return returnValue;
897 }
898 
GetNamedBufferParameteri64v(GLuint buffer,GLenum pname,GLint64 * params)899 void GL_APIENTRY GetNamedBufferParameteri64v(GLuint buffer, GLenum pname, GLint64 *params)
900 {
901     Context *context = GetValidGlobalContext();
902     EVENT("glGetNamedBufferParameteri64v",
903           "context = %d, GLuint buffer = %u, GLenum pname = %s, GLint64 *params = 0x%016" PRIxPTR
904           "",
905           CID(context), buffer, GLenumToString(GLenumGroup::VertexBufferObjectParameter, pname),
906           (uintptr_t)params);
907 
908     if (context)
909     {
910         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
911         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
912         bool isCallValid = (context->skipValidation() || ValidateGetNamedBufferParameteri64v(
913                                                              context, bufferPacked, pname, params));
914         if (isCallValid)
915         {
916             context->getNamedBufferParameteri64v(bufferPacked, pname, params);
917         }
918         ANGLE_CAPTURE(GetNamedBufferParameteri64v, isCallValid, context, bufferPacked, pname,
919                       params);
920     }
921 }
922 
GetNamedBufferParameteriv(GLuint buffer,GLenum pname,GLint * params)923 void GL_APIENTRY GetNamedBufferParameteriv(GLuint buffer, GLenum pname, GLint *params)
924 {
925     Context *context = GetValidGlobalContext();
926     EVENT("glGetNamedBufferParameteriv",
927           "context = %d, GLuint buffer = %u, GLenum pname = %s, GLint *params = 0x%016" PRIxPTR "",
928           CID(context), buffer, GLenumToString(GLenumGroup::VertexBufferObjectParameter, pname),
929           (uintptr_t)params);
930 
931     if (context)
932     {
933         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
934         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
935         bool isCallValid = (context->skipValidation() || ValidateGetNamedBufferParameteriv(
936                                                              context, bufferPacked, pname, params));
937         if (isCallValid)
938         {
939             context->getNamedBufferParameteriv(bufferPacked, pname, params);
940         }
941         ANGLE_CAPTURE(GetNamedBufferParameteriv, isCallValid, context, bufferPacked, pname, params);
942     }
943 }
944 
GetNamedBufferPointerv(GLuint buffer,GLenum pname,void ** params)945 void GL_APIENTRY GetNamedBufferPointerv(GLuint buffer, GLenum pname, void **params)
946 {
947     Context *context = GetValidGlobalContext();
948     EVENT("glGetNamedBufferPointerv",
949           "context = %d, GLuint buffer = %u, GLenum pname = %s, void **params = 0x%016" PRIxPTR "",
950           CID(context), buffer, GLenumToString(GLenumGroup::VertexBufferObjectParameter, pname),
951           (uintptr_t)params);
952 
953     if (context)
954     {
955         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
956         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
957         bool isCallValid                                      = (context->skipValidation() ||
958                             ValidateGetNamedBufferPointerv(context, bufferPacked, pname, params));
959         if (isCallValid)
960         {
961             context->getNamedBufferPointerv(bufferPacked, pname, params);
962         }
963         ANGLE_CAPTURE(GetNamedBufferPointerv, isCallValid, context, bufferPacked, pname, params);
964     }
965 }
966 
GetNamedBufferSubData(GLuint buffer,GLintptr offset,GLsizeiptr size,void * data)967 void GL_APIENTRY GetNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr size, void *data)
968 {
969     Context *context = GetValidGlobalContext();
970     EVENT("glGetNamedBufferSubData",
971           "context = %d, GLuint buffer = %u, GLintptr offset = %llu, GLsizeiptr size = %llu, void "
972           "*data = 0x%016" PRIxPTR "",
973           CID(context), buffer, static_cast<unsigned long long>(offset),
974           static_cast<unsigned long long>(size), (uintptr_t)data);
975 
976     if (context)
977     {
978         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
979         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
980         bool isCallValid =
981             (context->skipValidation() ||
982              ValidateGetNamedBufferSubData(context, bufferPacked, offset, size, data));
983         if (isCallValid)
984         {
985             context->getNamedBufferSubData(bufferPacked, offset, size, data);
986         }
987         ANGLE_CAPTURE(GetNamedBufferSubData, isCallValid, context, bufferPacked, offset, size,
988                       data);
989     }
990 }
991 
GetNamedFramebufferAttachmentParameteriv(GLuint framebuffer,GLenum attachment,GLenum pname,GLint * params)992 void GL_APIENTRY GetNamedFramebufferAttachmentParameteriv(GLuint framebuffer,
993                                                           GLenum attachment,
994                                                           GLenum pname,
995                                                           GLint *params)
996 {
997     Context *context = GetValidGlobalContext();
998     EVENT("glGetNamedFramebufferAttachmentParameteriv",
999           "context = %d, GLuint framebuffer = %u, GLenum attachment = %s, GLenum pname = %s, GLint "
1000           "*params = 0x%016" PRIxPTR "",
1001           CID(context), framebuffer, GLenumToString(GLenumGroup::FramebufferAttachment, attachment),
1002           GLenumToString(GLenumGroup::FramebufferAttachmentParameterName, pname),
1003           (uintptr_t)params);
1004 
1005     if (context)
1006     {
1007         FramebufferID framebufferPacked                       = FromGL<FramebufferID>(framebuffer);
1008         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1009         bool isCallValid                                      = (context->skipValidation() ||
1010                             ValidateGetNamedFramebufferAttachmentParameteriv(
1011                                 context, framebufferPacked, attachment, pname, params));
1012         if (isCallValid)
1013         {
1014             context->getNamedFramebufferAttachmentParameteriv(framebufferPacked, attachment, pname,
1015                                                               params);
1016         }
1017         ANGLE_CAPTURE(GetNamedFramebufferAttachmentParameteriv, isCallValid, context,
1018                       framebufferPacked, attachment, pname, params);
1019     }
1020 }
1021 
GetNamedFramebufferParameteriv(GLuint framebuffer,GLenum pname,GLint * param)1022 void GL_APIENTRY GetNamedFramebufferParameteriv(GLuint framebuffer, GLenum pname, GLint *param)
1023 {
1024     Context *context = GetValidGlobalContext();
1025     EVENT("glGetNamedFramebufferParameteriv",
1026           "context = %d, GLuint framebuffer = %u, GLenum pname = %s, GLint *param = 0x%016" PRIxPTR
1027           "",
1028           CID(context), framebuffer, GLenumToString(GLenumGroup::GetFramebufferParameter, pname),
1029           (uintptr_t)param);
1030 
1031     if (context)
1032     {
1033         FramebufferID framebufferPacked                       = FromGL<FramebufferID>(framebuffer);
1034         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1035         bool isCallValid =
1036             (context->skipValidation() ||
1037              ValidateGetNamedFramebufferParameteriv(context, framebufferPacked, pname, param));
1038         if (isCallValid)
1039         {
1040             context->getNamedFramebufferParameteriv(framebufferPacked, pname, param);
1041         }
1042         ANGLE_CAPTURE(GetNamedFramebufferParameteriv, isCallValid, context, framebufferPacked,
1043                       pname, param);
1044     }
1045 }
1046 
GetNamedRenderbufferParameteriv(GLuint renderbuffer,GLenum pname,GLint * params)1047 void GL_APIENTRY GetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname, GLint *params)
1048 {
1049     Context *context = GetValidGlobalContext();
1050     EVENT(
1051         "glGetNamedRenderbufferParameteriv",
1052         "context = %d, GLuint renderbuffer = %u, GLenum pname = %s, GLint *params = 0x%016" PRIxPTR
1053         "",
1054         CID(context), renderbuffer, GLenumToString(GLenumGroup::RenderbufferParameterName, pname),
1055         (uintptr_t)params);
1056 
1057     if (context)
1058     {
1059         RenderbufferID renderbufferPacked = FromGL<RenderbufferID>(renderbuffer);
1060         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1061         bool isCallValid =
1062             (context->skipValidation() ||
1063              ValidateGetNamedRenderbufferParameteriv(context, renderbufferPacked, pname, params));
1064         if (isCallValid)
1065         {
1066             context->getNamedRenderbufferParameteriv(renderbufferPacked, pname, params);
1067         }
1068         ANGLE_CAPTURE(GetNamedRenderbufferParameteriv, isCallValid, context, renderbufferPacked,
1069                       pname, params);
1070     }
1071 }
1072 
GetQueryBufferObjecti64v(GLuint id,GLuint buffer,GLenum pname,GLintptr offset)1073 void GL_APIENTRY GetQueryBufferObjecti64v(GLuint id, GLuint buffer, GLenum pname, GLintptr offset)
1074 {
1075     Context *context = GetValidGlobalContext();
1076     EVENT("glGetQueryBufferObjecti64v",
1077           "context = %d, GLuint id = %u, GLuint buffer = %u, GLenum pname = %s, GLintptr offset = "
1078           "%llu",
1079           CID(context), id, buffer, GLenumToString(GLenumGroup::QueryObjectParameterName, pname),
1080           static_cast<unsigned long long>(offset));
1081 
1082     if (context)
1083     {
1084         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
1085         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1086         bool isCallValid =
1087             (context->skipValidation() ||
1088              ValidateGetQueryBufferObjecti64v(context, id, bufferPacked, pname, offset));
1089         if (isCallValid)
1090         {
1091             context->getQueryBufferObjecti64v(id, bufferPacked, pname, offset);
1092         }
1093         ANGLE_CAPTURE(GetQueryBufferObjecti64v, isCallValid, context, id, bufferPacked, pname,
1094                       offset);
1095     }
1096 }
1097 
GetQueryBufferObjectiv(GLuint id,GLuint buffer,GLenum pname,GLintptr offset)1098 void GL_APIENTRY GetQueryBufferObjectiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset)
1099 {
1100     Context *context = GetValidGlobalContext();
1101     EVENT("glGetQueryBufferObjectiv",
1102           "context = %d, GLuint id = %u, GLuint buffer = %u, GLenum pname = %s, GLintptr offset = "
1103           "%llu",
1104           CID(context), id, buffer, GLenumToString(GLenumGroup::QueryObjectParameterName, pname),
1105           static_cast<unsigned long long>(offset));
1106 
1107     if (context)
1108     {
1109         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
1110         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1111         bool isCallValid =
1112             (context->skipValidation() ||
1113              ValidateGetQueryBufferObjectiv(context, id, bufferPacked, pname, offset));
1114         if (isCallValid)
1115         {
1116             context->getQueryBufferObjectiv(id, bufferPacked, pname, offset);
1117         }
1118         ANGLE_CAPTURE(GetQueryBufferObjectiv, isCallValid, context, id, bufferPacked, pname,
1119                       offset);
1120     }
1121 }
1122 
GetQueryBufferObjectui64v(GLuint id,GLuint buffer,GLenum pname,GLintptr offset)1123 void GL_APIENTRY GetQueryBufferObjectui64v(GLuint id, GLuint buffer, GLenum pname, GLintptr offset)
1124 {
1125     Context *context = GetValidGlobalContext();
1126     EVENT("glGetQueryBufferObjectui64v",
1127           "context = %d, GLuint id = %u, GLuint buffer = %u, GLenum pname = %s, GLintptr offset = "
1128           "%llu",
1129           CID(context), id, buffer, GLenumToString(GLenumGroup::QueryObjectParameterName, pname),
1130           static_cast<unsigned long long>(offset));
1131 
1132     if (context)
1133     {
1134         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
1135         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1136         bool isCallValid =
1137             (context->skipValidation() ||
1138              ValidateGetQueryBufferObjectui64v(context, id, bufferPacked, pname, offset));
1139         if (isCallValid)
1140         {
1141             context->getQueryBufferObjectui64v(id, bufferPacked, pname, offset);
1142         }
1143         ANGLE_CAPTURE(GetQueryBufferObjectui64v, isCallValid, context, id, bufferPacked, pname,
1144                       offset);
1145     }
1146 }
1147 
GetQueryBufferObjectuiv(GLuint id,GLuint buffer,GLenum pname,GLintptr offset)1148 void GL_APIENTRY GetQueryBufferObjectuiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset)
1149 {
1150     Context *context = GetValidGlobalContext();
1151     EVENT("glGetQueryBufferObjectuiv",
1152           "context = %d, GLuint id = %u, GLuint buffer = %u, GLenum pname = %s, GLintptr offset = "
1153           "%llu",
1154           CID(context), id, buffer, GLenumToString(GLenumGroup::QueryObjectParameterName, pname),
1155           static_cast<unsigned long long>(offset));
1156 
1157     if (context)
1158     {
1159         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
1160         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1161         bool isCallValid =
1162             (context->skipValidation() ||
1163              ValidateGetQueryBufferObjectuiv(context, id, bufferPacked, pname, offset));
1164         if (isCallValid)
1165         {
1166             context->getQueryBufferObjectuiv(id, bufferPacked, pname, offset);
1167         }
1168         ANGLE_CAPTURE(GetQueryBufferObjectuiv, isCallValid, context, id, bufferPacked, pname,
1169                       offset);
1170     }
1171 }
1172 
GetTextureImage(GLuint texture,GLint level,GLenum format,GLenum type,GLsizei bufSize,void * pixels)1173 void GL_APIENTRY GetTextureImage(GLuint texture,
1174                                  GLint level,
1175                                  GLenum format,
1176                                  GLenum type,
1177                                  GLsizei bufSize,
1178                                  void *pixels)
1179 {
1180     Context *context = GetValidGlobalContext();
1181     EVENT("glGetTextureImage",
1182           "context = %d, GLuint texture = %u, GLint level = %d, GLenum format = %s, GLenum type = "
1183           "%s, GLsizei bufSize = %d, void *pixels = 0x%016" PRIxPTR "",
1184           CID(context), texture, level, GLenumToString(GLenumGroup::PixelFormat, format),
1185           GLenumToString(GLenumGroup::PixelType, type), bufSize, (uintptr_t)pixels);
1186 
1187     if (context)
1188     {
1189         TextureID texturePacked                               = FromGL<TextureID>(texture);
1190         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1191         bool isCallValid =
1192             (context->skipValidation() ||
1193              ValidateGetTextureImage(context, texturePacked, level, format, type, bufSize, pixels));
1194         if (isCallValid)
1195         {
1196             context->getTextureImage(texturePacked, level, format, type, bufSize, pixels);
1197         }
1198         ANGLE_CAPTURE(GetTextureImage, isCallValid, context, texturePacked, level, format, type,
1199                       bufSize, pixels);
1200     }
1201 }
1202 
GetTextureLevelParameterfv(GLuint texture,GLint level,GLenum pname,GLfloat * params)1203 void GL_APIENTRY GetTextureLevelParameterfv(GLuint texture,
1204                                             GLint level,
1205                                             GLenum pname,
1206                                             GLfloat *params)
1207 {
1208     Context *context = GetValidGlobalContext();
1209     EVENT("glGetTextureLevelParameterfv",
1210           "context = %d, GLuint texture = %u, GLint level = %d, GLenum pname = %s, GLfloat *params "
1211           "= 0x%016" PRIxPTR "",
1212           CID(context), texture, level, GLenumToString(GLenumGroup::GetTextureParameter, pname),
1213           (uintptr_t)params);
1214 
1215     if (context)
1216     {
1217         TextureID texturePacked                               = FromGL<TextureID>(texture);
1218         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1219         bool isCallValid =
1220             (context->skipValidation() ||
1221              ValidateGetTextureLevelParameterfv(context, texturePacked, level, pname, params));
1222         if (isCallValid)
1223         {
1224             context->getTextureLevelParameterfv(texturePacked, level, pname, params);
1225         }
1226         ANGLE_CAPTURE(GetTextureLevelParameterfv, isCallValid, context, texturePacked, level, pname,
1227                       params);
1228     }
1229 }
1230 
GetTextureLevelParameteriv(GLuint texture,GLint level,GLenum pname,GLint * params)1231 void GL_APIENTRY GetTextureLevelParameteriv(GLuint texture,
1232                                             GLint level,
1233                                             GLenum pname,
1234                                             GLint *params)
1235 {
1236     Context *context = GetValidGlobalContext();
1237     EVENT("glGetTextureLevelParameteriv",
1238           "context = %d, GLuint texture = %u, GLint level = %d, GLenum pname = %s, GLint *params = "
1239           "0x%016" PRIxPTR "",
1240           CID(context), texture, level, GLenumToString(GLenumGroup::GetTextureParameter, pname),
1241           (uintptr_t)params);
1242 
1243     if (context)
1244     {
1245         TextureID texturePacked                               = FromGL<TextureID>(texture);
1246         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1247         bool isCallValid =
1248             (context->skipValidation() ||
1249              ValidateGetTextureLevelParameteriv(context, texturePacked, level, pname, params));
1250         if (isCallValid)
1251         {
1252             context->getTextureLevelParameteriv(texturePacked, level, pname, params);
1253         }
1254         ANGLE_CAPTURE(GetTextureLevelParameteriv, isCallValid, context, texturePacked, level, pname,
1255                       params);
1256     }
1257 }
1258 
GetTextureParameterIiv(GLuint texture,GLenum pname,GLint * params)1259 void GL_APIENTRY GetTextureParameterIiv(GLuint texture, GLenum pname, GLint *params)
1260 {
1261     Context *context = GetValidGlobalContext();
1262     EVENT("glGetTextureParameterIiv",
1263           "context = %d, GLuint texture = %u, GLenum pname = %s, GLint *params = 0x%016" PRIxPTR "",
1264           CID(context), texture, GLenumToString(GLenumGroup::GetTextureParameter, pname),
1265           (uintptr_t)params);
1266 
1267     if (context)
1268     {
1269         TextureID texturePacked                               = FromGL<TextureID>(texture);
1270         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1271         bool isCallValid                                      = (context->skipValidation() ||
1272                             ValidateGetTextureParameterIiv(context, texturePacked, pname, params));
1273         if (isCallValid)
1274         {
1275             context->getTextureParameterIiv(texturePacked, pname, params);
1276         }
1277         ANGLE_CAPTURE(GetTextureParameterIiv, isCallValid, context, texturePacked, pname, params);
1278     }
1279 }
1280 
GetTextureParameterIuiv(GLuint texture,GLenum pname,GLuint * params)1281 void GL_APIENTRY GetTextureParameterIuiv(GLuint texture, GLenum pname, GLuint *params)
1282 {
1283     Context *context = GetValidGlobalContext();
1284     EVENT("glGetTextureParameterIuiv",
1285           "context = %d, GLuint texture = %u, GLenum pname = %s, GLuint *params = 0x%016" PRIxPTR
1286           "",
1287           CID(context), texture, GLenumToString(GLenumGroup::GetTextureParameter, pname),
1288           (uintptr_t)params);
1289 
1290     if (context)
1291     {
1292         TextureID texturePacked                               = FromGL<TextureID>(texture);
1293         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1294         bool isCallValid                                      = (context->skipValidation() ||
1295                             ValidateGetTextureParameterIuiv(context, texturePacked, pname, params));
1296         if (isCallValid)
1297         {
1298             context->getTextureParameterIuiv(texturePacked, pname, params);
1299         }
1300         ANGLE_CAPTURE(GetTextureParameterIuiv, isCallValid, context, texturePacked, pname, params);
1301     }
1302 }
1303 
GetTextureParameterfv(GLuint texture,GLenum pname,GLfloat * params)1304 void GL_APIENTRY GetTextureParameterfv(GLuint texture, GLenum pname, GLfloat *params)
1305 {
1306     Context *context = GetValidGlobalContext();
1307     EVENT("glGetTextureParameterfv",
1308           "context = %d, GLuint texture = %u, GLenum pname = %s, GLfloat *params = 0x%016" PRIxPTR
1309           "",
1310           CID(context), texture, GLenumToString(GLenumGroup::GetTextureParameter, pname),
1311           (uintptr_t)params);
1312 
1313     if (context)
1314     {
1315         TextureID texturePacked                               = FromGL<TextureID>(texture);
1316         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1317         bool isCallValid                                      = (context->skipValidation() ||
1318                             ValidateGetTextureParameterfv(context, texturePacked, pname, params));
1319         if (isCallValid)
1320         {
1321             context->getTextureParameterfv(texturePacked, pname, params);
1322         }
1323         ANGLE_CAPTURE(GetTextureParameterfv, isCallValid, context, texturePacked, pname, params);
1324     }
1325 }
1326 
GetTextureParameteriv(GLuint texture,GLenum pname,GLint * params)1327 void GL_APIENTRY GetTextureParameteriv(GLuint texture, GLenum pname, GLint *params)
1328 {
1329     Context *context = GetValidGlobalContext();
1330     EVENT("glGetTextureParameteriv",
1331           "context = %d, GLuint texture = %u, GLenum pname = %s, GLint *params = 0x%016" PRIxPTR "",
1332           CID(context), texture, GLenumToString(GLenumGroup::GetTextureParameter, pname),
1333           (uintptr_t)params);
1334 
1335     if (context)
1336     {
1337         TextureID texturePacked                               = FromGL<TextureID>(texture);
1338         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1339         bool isCallValid                                      = (context->skipValidation() ||
1340                             ValidateGetTextureParameteriv(context, texturePacked, pname, params));
1341         if (isCallValid)
1342         {
1343             context->getTextureParameteriv(texturePacked, pname, params);
1344         }
1345         ANGLE_CAPTURE(GetTextureParameteriv, isCallValid, context, texturePacked, pname, params);
1346     }
1347 }
1348 
GetTextureSubImage(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLenum type,GLsizei bufSize,void * pixels)1349 void GL_APIENTRY GetTextureSubImage(GLuint texture,
1350                                     GLint level,
1351                                     GLint xoffset,
1352                                     GLint yoffset,
1353                                     GLint zoffset,
1354                                     GLsizei width,
1355                                     GLsizei height,
1356                                     GLsizei depth,
1357                                     GLenum format,
1358                                     GLenum type,
1359                                     GLsizei bufSize,
1360                                     void *pixels)
1361 {
1362     Context *context = GetValidGlobalContext();
1363     EVENT(
1364         "glGetTextureSubImage",
1365         "context = %d, GLuint texture = %u, GLint level = %d, GLint xoffset = %d, GLint yoffset = "
1366         "%d, GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, "
1367         "GLenum format = %s, GLenum type = %s, GLsizei bufSize = %d, void *pixels = 0x%016" PRIxPTR
1368         "",
1369         CID(context), texture, level, xoffset, yoffset, zoffset, width, height, depth,
1370         GLenumToString(GLenumGroup::PixelFormat, format),
1371         GLenumToString(GLenumGroup::PixelType, type), bufSize, (uintptr_t)pixels);
1372 
1373     if (context)
1374     {
1375         TextureID texturePacked                               = FromGL<TextureID>(texture);
1376         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1377         bool isCallValid =
1378             (context->skipValidation() ||
1379              ValidateGetTextureSubImage(context, texturePacked, level, xoffset, yoffset, zoffset,
1380                                         width, height, depth, format, type, bufSize, pixels));
1381         if (isCallValid)
1382         {
1383             context->getTextureSubImage(texturePacked, level, xoffset, yoffset, zoffset, width,
1384                                         height, depth, format, type, bufSize, pixels);
1385         }
1386         ANGLE_CAPTURE(GetTextureSubImage, isCallValid, context, texturePacked, level, xoffset,
1387                       yoffset, zoffset, width, height, depth, format, type, bufSize, pixels);
1388     }
1389 }
1390 
GetTransformFeedbacki64_v(GLuint xfb,GLenum pname,GLuint index,GLint64 * param)1391 void GL_APIENTRY GetTransformFeedbacki64_v(GLuint xfb, GLenum pname, GLuint index, GLint64 *param)
1392 {
1393     Context *context = GetValidGlobalContext();
1394     EVENT("glGetTransformFeedbacki64_v",
1395           "context = %d, GLuint xfb = %u, GLenum pname = %s, GLuint index = %u, GLint64 *param = "
1396           "0x%016" PRIxPTR "",
1397           CID(context), xfb, GLenumToString(GLenumGroup::TransformFeedbackPName, pname), index,
1398           (uintptr_t)param);
1399 
1400     if (context)
1401     {
1402         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1403         bool isCallValid                                      = (context->skipValidation() ||
1404                             ValidateGetTransformFeedbacki64_v(context, xfb, pname, index, param));
1405         if (isCallValid)
1406         {
1407             context->getTransformFeedbacki64_v(xfb, pname, index, param);
1408         }
1409         ANGLE_CAPTURE(GetTransformFeedbacki64_v, isCallValid, context, xfb, pname, index, param);
1410     }
1411 }
1412 
GetTransformFeedbacki_v(GLuint xfb,GLenum pname,GLuint index,GLint * param)1413 void GL_APIENTRY GetTransformFeedbacki_v(GLuint xfb, GLenum pname, GLuint index, GLint *param)
1414 {
1415     Context *context = GetValidGlobalContext();
1416     EVENT("glGetTransformFeedbacki_v",
1417           "context = %d, GLuint xfb = %u, GLenum pname = %s, GLuint index = %u, GLint *param = "
1418           "0x%016" PRIxPTR "",
1419           CID(context), xfb, GLenumToString(GLenumGroup::TransformFeedbackPName, pname), index,
1420           (uintptr_t)param);
1421 
1422     if (context)
1423     {
1424         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1425         bool isCallValid                                      = (context->skipValidation() ||
1426                             ValidateGetTransformFeedbacki_v(context, xfb, pname, index, param));
1427         if (isCallValid)
1428         {
1429             context->getTransformFeedbacki_v(xfb, pname, index, param);
1430         }
1431         ANGLE_CAPTURE(GetTransformFeedbacki_v, isCallValid, context, xfb, pname, index, param);
1432     }
1433 }
1434 
GetTransformFeedbackiv(GLuint xfb,GLenum pname,GLint * param)1435 void GL_APIENTRY GetTransformFeedbackiv(GLuint xfb, GLenum pname, GLint *param)
1436 {
1437     Context *context = GetValidGlobalContext();
1438     EVENT("glGetTransformFeedbackiv",
1439           "context = %d, GLuint xfb = %u, GLenum pname = %s, GLint *param = 0x%016" PRIxPTR "",
1440           CID(context), xfb, GLenumToString(GLenumGroup::TransformFeedbackPName, pname),
1441           (uintptr_t)param);
1442 
1443     if (context)
1444     {
1445         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1446         bool isCallValid                                      = (context->skipValidation() ||
1447                             ValidateGetTransformFeedbackiv(context, xfb, pname, param));
1448         if (isCallValid)
1449         {
1450             context->getTransformFeedbackiv(xfb, pname, param);
1451         }
1452         ANGLE_CAPTURE(GetTransformFeedbackiv, isCallValid, context, xfb, pname, param);
1453     }
1454 }
1455 
GetVertexArrayIndexed64iv(GLuint vaobj,GLuint index,GLenum pname,GLint64 * param)1456 void GL_APIENTRY GetVertexArrayIndexed64iv(GLuint vaobj, GLuint index, GLenum pname, GLint64 *param)
1457 {
1458     Context *context = GetValidGlobalContext();
1459     EVENT("glGetVertexArrayIndexed64iv",
1460           "context = %d, GLuint vaobj = %u, GLuint index = %u, GLenum pname = %s, GLint64 *param = "
1461           "0x%016" PRIxPTR "",
1462           CID(context), vaobj, index, GLenumToString(GLenumGroup::VertexArrayPName, pname),
1463           (uintptr_t)param);
1464 
1465     if (context)
1466     {
1467         VertexArrayID vaobjPacked                             = FromGL<VertexArrayID>(vaobj);
1468         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1469         bool isCallValid =
1470             (context->skipValidation() ||
1471              ValidateGetVertexArrayIndexed64iv(context, vaobjPacked, index, pname, param));
1472         if (isCallValid)
1473         {
1474             context->getVertexArrayIndexed64iv(vaobjPacked, index, pname, param);
1475         }
1476         ANGLE_CAPTURE(GetVertexArrayIndexed64iv, isCallValid, context, vaobjPacked, index, pname,
1477                       param);
1478     }
1479 }
1480 
GetVertexArrayIndexediv(GLuint vaobj,GLuint index,GLenum pname,GLint * param)1481 void GL_APIENTRY GetVertexArrayIndexediv(GLuint vaobj, GLuint index, GLenum pname, GLint *param)
1482 {
1483     Context *context = GetValidGlobalContext();
1484     EVENT("glGetVertexArrayIndexediv",
1485           "context = %d, GLuint vaobj = %u, GLuint index = %u, GLenum pname = %s, GLint *param = "
1486           "0x%016" PRIxPTR "",
1487           CID(context), vaobj, index, GLenumToString(GLenumGroup::VertexArrayPName, pname),
1488           (uintptr_t)param);
1489 
1490     if (context)
1491     {
1492         VertexArrayID vaobjPacked                             = FromGL<VertexArrayID>(vaobj);
1493         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1494         bool isCallValid =
1495             (context->skipValidation() ||
1496              ValidateGetVertexArrayIndexediv(context, vaobjPacked, index, pname, param));
1497         if (isCallValid)
1498         {
1499             context->getVertexArrayIndexediv(vaobjPacked, index, pname, param);
1500         }
1501         ANGLE_CAPTURE(GetVertexArrayIndexediv, isCallValid, context, vaobjPacked, index, pname,
1502                       param);
1503     }
1504 }
1505 
GetVertexArrayiv(GLuint vaobj,GLenum pname,GLint * param)1506 void GL_APIENTRY GetVertexArrayiv(GLuint vaobj, GLenum pname, GLint *param)
1507 {
1508     Context *context = GetValidGlobalContext();
1509     EVENT("glGetVertexArrayiv",
1510           "context = %d, GLuint vaobj = %u, GLenum pname = %s, GLint *param = 0x%016" PRIxPTR "",
1511           CID(context), vaobj, GLenumToString(GLenumGroup::VertexArrayPName, pname),
1512           (uintptr_t)param);
1513 
1514     if (context)
1515     {
1516         VertexArrayID vaobjPacked                             = FromGL<VertexArrayID>(vaobj);
1517         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1518         bool isCallValid                                      = (context->skipValidation() ||
1519                             ValidateGetVertexArrayiv(context, vaobjPacked, pname, param));
1520         if (isCallValid)
1521         {
1522             context->getVertexArrayiv(vaobjPacked, pname, param);
1523         }
1524         ANGLE_CAPTURE(GetVertexArrayiv, isCallValid, context, vaobjPacked, pname, param);
1525     }
1526 }
1527 
1528 void GL_APIENTRY
GetnColorTable(GLenum target,GLenum format,GLenum type,GLsizei bufSize,void * table)1529 GetnColorTable(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table)
1530 {
1531     Context *context = GetValidGlobalContext();
1532     EVENT("glGetnColorTable",
1533           "context = %d, GLenum target = %s, GLenum format = %s, GLenum type = %s, GLsizei bufSize "
1534           "= %d, void *table = 0x%016" PRIxPTR "",
1535           CID(context), GLenumToString(GLenumGroup::ColorTableTarget, target),
1536           GLenumToString(GLenumGroup::PixelFormat, format),
1537           GLenumToString(GLenumGroup::PixelType, type), bufSize, (uintptr_t)table);
1538 
1539     if (context)
1540     {
1541         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1542         bool isCallValid                                      = (context->skipValidation() ||
1543                             ValidateGetnColorTable(context, target, format, type, bufSize, table));
1544         if (isCallValid)
1545         {
1546             context->getnColorTable(target, format, type, bufSize, table);
1547         }
1548         ANGLE_CAPTURE(GetnColorTable, isCallValid, context, target, format, type, bufSize, table);
1549     }
1550 }
1551 
GetnCompressedTexImage(GLenum target,GLint lod,GLsizei bufSize,void * pixels)1552 void GL_APIENTRY GetnCompressedTexImage(GLenum target, GLint lod, GLsizei bufSize, void *pixels)
1553 {
1554     Context *context = GetValidGlobalContext();
1555     EVENT("glGetnCompressedTexImage",
1556           "context = %d, GLenum target = %s, GLint lod = %d, GLsizei bufSize = %d, void *pixels = "
1557           "0x%016" PRIxPTR "",
1558           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), lod, bufSize,
1559           (uintptr_t)pixels);
1560 
1561     if (context)
1562     {
1563         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1564         bool isCallValid                                      = (context->skipValidation() ||
1565                             ValidateGetnCompressedTexImage(context, target, lod, bufSize, pixels));
1566         if (isCallValid)
1567         {
1568             context->getnCompressedTexImage(target, lod, bufSize, pixels);
1569         }
1570         ANGLE_CAPTURE(GetnCompressedTexImage, isCallValid, context, target, lod, bufSize, pixels);
1571     }
1572 }
1573 
1574 void GL_APIENTRY
GetnConvolutionFilter(GLenum target,GLenum format,GLenum type,GLsizei bufSize,void * image)1575 GetnConvolutionFilter(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image)
1576 {
1577     Context *context = GetValidGlobalContext();
1578     EVENT("glGetnConvolutionFilter",
1579           "context = %d, GLenum target = %s, GLenum format = %s, GLenum type = %s, GLsizei bufSize "
1580           "= %d, void *image = 0x%016" PRIxPTR "",
1581           CID(context), GLenumToString(GLenumGroup::ConvolutionTarget, target),
1582           GLenumToString(GLenumGroup::PixelFormat, format),
1583           GLenumToString(GLenumGroup::PixelType, type), bufSize, (uintptr_t)image);
1584 
1585     if (context)
1586     {
1587         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1588         bool isCallValid =
1589             (context->skipValidation() ||
1590              ValidateGetnConvolutionFilter(context, target, format, type, bufSize, image));
1591         if (isCallValid)
1592         {
1593             context->getnConvolutionFilter(target, format, type, bufSize, image);
1594         }
1595         ANGLE_CAPTURE(GetnConvolutionFilter, isCallValid, context, target, format, type, bufSize,
1596                       image);
1597     }
1598 }
1599 
GetnHistogram(GLenum target,GLboolean reset,GLenum format,GLenum type,GLsizei bufSize,void * values)1600 void GL_APIENTRY GetnHistogram(GLenum target,
1601                                GLboolean reset,
1602                                GLenum format,
1603                                GLenum type,
1604                                GLsizei bufSize,
1605                                void *values)
1606 {
1607     Context *context = GetValidGlobalContext();
1608     EVENT("glGetnHistogram",
1609           "context = %d, GLenum target = %s, GLboolean reset = %s, GLenum format = %s, GLenum type "
1610           "= %s, GLsizei bufSize = %d, void *values = 0x%016" PRIxPTR "",
1611           CID(context), GLenumToString(GLenumGroup::HistogramTargetEXT, target),
1612           GLbooleanToString(reset), GLenumToString(GLenumGroup::PixelFormat, format),
1613           GLenumToString(GLenumGroup::PixelType, type), bufSize, (uintptr_t)values);
1614 
1615     if (context)
1616     {
1617         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1618         bool isCallValid =
1619             (context->skipValidation() ||
1620              ValidateGetnHistogram(context, target, reset, format, type, bufSize, values));
1621         if (isCallValid)
1622         {
1623             context->getnHistogram(target, reset, format, type, bufSize, values);
1624         }
1625         ANGLE_CAPTURE(GetnHistogram, isCallValid, context, target, reset, format, type, bufSize,
1626                       values);
1627     }
1628 }
1629 
GetnMapdv(GLenum target,GLenum query,GLsizei bufSize,GLdouble * v)1630 void GL_APIENTRY GetnMapdv(GLenum target, GLenum query, GLsizei bufSize, GLdouble *v)
1631 {
1632     Context *context = GetValidGlobalContext();
1633     EVENT("glGetnMapdv",
1634           "context = %d, GLenum target = %s, GLenum query = %s, GLsizei bufSize = %d, GLdouble *v "
1635           "= 0x%016" PRIxPTR "",
1636           CID(context), GLenumToString(GLenumGroup::MapTarget, target),
1637           GLenumToString(GLenumGroup::MapQuery, query), bufSize, (uintptr_t)v);
1638 
1639     if (context)
1640     {
1641         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1642         bool isCallValid =
1643             (context->skipValidation() || ValidateGetnMapdv(context, target, query, bufSize, v));
1644         if (isCallValid)
1645         {
1646             context->getnMapdv(target, query, bufSize, v);
1647         }
1648         ANGLE_CAPTURE(GetnMapdv, isCallValid, context, target, query, bufSize, v);
1649     }
1650 }
1651 
GetnMapfv(GLenum target,GLenum query,GLsizei bufSize,GLfloat * v)1652 void GL_APIENTRY GetnMapfv(GLenum target, GLenum query, GLsizei bufSize, GLfloat *v)
1653 {
1654     Context *context = GetValidGlobalContext();
1655     EVENT("glGetnMapfv",
1656           "context = %d, GLenum target = %s, GLenum query = %s, GLsizei bufSize = %d, GLfloat *v = "
1657           "0x%016" PRIxPTR "",
1658           CID(context), GLenumToString(GLenumGroup::MapTarget, target),
1659           GLenumToString(GLenumGroup::MapQuery, query), bufSize, (uintptr_t)v);
1660 
1661     if (context)
1662     {
1663         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1664         bool isCallValid =
1665             (context->skipValidation() || ValidateGetnMapfv(context, target, query, bufSize, v));
1666         if (isCallValid)
1667         {
1668             context->getnMapfv(target, query, bufSize, v);
1669         }
1670         ANGLE_CAPTURE(GetnMapfv, isCallValid, context, target, query, bufSize, v);
1671     }
1672 }
1673 
GetnMapiv(GLenum target,GLenum query,GLsizei bufSize,GLint * v)1674 void GL_APIENTRY GetnMapiv(GLenum target, GLenum query, GLsizei bufSize, GLint *v)
1675 {
1676     Context *context = GetValidGlobalContext();
1677     EVENT("glGetnMapiv",
1678           "context = %d, GLenum target = %s, GLenum query = %s, GLsizei bufSize = %d, GLint *v = "
1679           "0x%016" PRIxPTR "",
1680           CID(context), GLenumToString(GLenumGroup::MapTarget, target),
1681           GLenumToString(GLenumGroup::MapQuery, query), bufSize, (uintptr_t)v);
1682 
1683     if (context)
1684     {
1685         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1686         bool isCallValid =
1687             (context->skipValidation() || ValidateGetnMapiv(context, target, query, bufSize, v));
1688         if (isCallValid)
1689         {
1690             context->getnMapiv(target, query, bufSize, v);
1691         }
1692         ANGLE_CAPTURE(GetnMapiv, isCallValid, context, target, query, bufSize, v);
1693     }
1694 }
1695 
GetnMinmax(GLenum target,GLboolean reset,GLenum format,GLenum type,GLsizei bufSize,void * values)1696 void GL_APIENTRY GetnMinmax(GLenum target,
1697                             GLboolean reset,
1698                             GLenum format,
1699                             GLenum type,
1700                             GLsizei bufSize,
1701                             void *values)
1702 {
1703     Context *context = GetValidGlobalContext();
1704     EVENT("glGetnMinmax",
1705           "context = %d, GLenum target = %s, GLboolean reset = %s, GLenum format = %s, GLenum type "
1706           "= %s, GLsizei bufSize = %d, void *values = 0x%016" PRIxPTR "",
1707           CID(context), GLenumToString(GLenumGroup::MinmaxTargetEXT, target),
1708           GLbooleanToString(reset), GLenumToString(GLenumGroup::PixelFormat, format),
1709           GLenumToString(GLenumGroup::PixelType, type), bufSize, (uintptr_t)values);
1710 
1711     if (context)
1712     {
1713         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1714         bool isCallValid =
1715             (context->skipValidation() ||
1716              ValidateGetnMinmax(context, target, reset, format, type, bufSize, values));
1717         if (isCallValid)
1718         {
1719             context->getnMinmax(target, reset, format, type, bufSize, values);
1720         }
1721         ANGLE_CAPTURE(GetnMinmax, isCallValid, context, target, reset, format, type, bufSize,
1722                       values);
1723     }
1724 }
1725 
GetnPixelMapfv(GLenum map,GLsizei bufSize,GLfloat * values)1726 void GL_APIENTRY GetnPixelMapfv(GLenum map, GLsizei bufSize, GLfloat *values)
1727 {
1728     Context *context = GetValidGlobalContext();
1729     EVENT("glGetnPixelMapfv",
1730           "context = %d, GLenum map = %s, GLsizei bufSize = %d, GLfloat *values = 0x%016" PRIxPTR
1731           "",
1732           CID(context), GLenumToString(GLenumGroup::PixelMap, map), bufSize, (uintptr_t)values);
1733 
1734     if (context)
1735     {
1736         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1737         bool isCallValid =
1738             (context->skipValidation() || ValidateGetnPixelMapfv(context, map, bufSize, values));
1739         if (isCallValid)
1740         {
1741             context->getnPixelMapfv(map, bufSize, values);
1742         }
1743         ANGLE_CAPTURE(GetnPixelMapfv, isCallValid, context, map, bufSize, values);
1744     }
1745 }
1746 
GetnPixelMapuiv(GLenum map,GLsizei bufSize,GLuint * values)1747 void GL_APIENTRY GetnPixelMapuiv(GLenum map, GLsizei bufSize, GLuint *values)
1748 {
1749     Context *context = GetValidGlobalContext();
1750     EVENT("glGetnPixelMapuiv",
1751           "context = %d, GLenum map = %s, GLsizei bufSize = %d, GLuint *values = 0x%016" PRIxPTR "",
1752           CID(context), GLenumToString(GLenumGroup::PixelMap, map), bufSize, (uintptr_t)values);
1753 
1754     if (context)
1755     {
1756         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1757         bool isCallValid =
1758             (context->skipValidation() || ValidateGetnPixelMapuiv(context, map, bufSize, values));
1759         if (isCallValid)
1760         {
1761             context->getnPixelMapuiv(map, bufSize, values);
1762         }
1763         ANGLE_CAPTURE(GetnPixelMapuiv, isCallValid, context, map, bufSize, values);
1764     }
1765 }
1766 
GetnPixelMapusv(GLenum map,GLsizei bufSize,GLushort * values)1767 void GL_APIENTRY GetnPixelMapusv(GLenum map, GLsizei bufSize, GLushort *values)
1768 {
1769     Context *context = GetValidGlobalContext();
1770     EVENT("glGetnPixelMapusv",
1771           "context = %d, GLenum map = %s, GLsizei bufSize = %d, GLushort *values = 0x%016" PRIxPTR
1772           "",
1773           CID(context), GLenumToString(GLenumGroup::PixelMap, map), bufSize, (uintptr_t)values);
1774 
1775     if (context)
1776     {
1777         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1778         bool isCallValid =
1779             (context->skipValidation() || ValidateGetnPixelMapusv(context, map, bufSize, values));
1780         if (isCallValid)
1781         {
1782             context->getnPixelMapusv(map, bufSize, values);
1783         }
1784         ANGLE_CAPTURE(GetnPixelMapusv, isCallValid, context, map, bufSize, values);
1785     }
1786 }
1787 
GetnPolygonStipple(GLsizei bufSize,GLubyte * pattern)1788 void GL_APIENTRY GetnPolygonStipple(GLsizei bufSize, GLubyte *pattern)
1789 {
1790     Context *context = GetValidGlobalContext();
1791     EVENT("glGetnPolygonStipple",
1792           "context = %d, GLsizei bufSize = %d, GLubyte *pattern = 0x%016" PRIxPTR "", CID(context),
1793           bufSize, (uintptr_t)pattern);
1794 
1795     if (context)
1796     {
1797         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1798         bool isCallValid =
1799             (context->skipValidation() || ValidateGetnPolygonStipple(context, bufSize, pattern));
1800         if (isCallValid)
1801         {
1802             context->getnPolygonStipple(bufSize, pattern);
1803         }
1804         ANGLE_CAPTURE(GetnPolygonStipple, isCallValid, context, bufSize, pattern);
1805     }
1806 }
1807 
GetnSeparableFilter(GLenum target,GLenum format,GLenum type,GLsizei rowBufSize,void * row,GLsizei columnBufSize,void * column,void * span)1808 void GL_APIENTRY GetnSeparableFilter(GLenum target,
1809                                      GLenum format,
1810                                      GLenum type,
1811                                      GLsizei rowBufSize,
1812                                      void *row,
1813                                      GLsizei columnBufSize,
1814                                      void *column,
1815                                      void *span)
1816 {
1817     Context *context = GetValidGlobalContext();
1818     EVENT("glGetnSeparableFilter",
1819           "context = %d, GLenum target = %s, GLenum format = %s, GLenum type = %s, GLsizei "
1820           "rowBufSize = %d, void *row = 0x%016" PRIxPTR
1821           ", GLsizei columnBufSize = %d, void *column = 0x%016" PRIxPTR
1822           ", void *span = 0x%016" PRIxPTR "",
1823           CID(context), GLenumToString(GLenumGroup::SeparableTargetEXT, target),
1824           GLenumToString(GLenumGroup::PixelFormat, format),
1825           GLenumToString(GLenumGroup::PixelType, type), rowBufSize, (uintptr_t)row, columnBufSize,
1826           (uintptr_t)column, (uintptr_t)span);
1827 
1828     if (context)
1829     {
1830         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1831         bool isCallValid                                      = (context->skipValidation() ||
1832                             ValidateGetnSeparableFilter(context, target, format, type, rowBufSize,
1833                                                         row, columnBufSize, column, span));
1834         if (isCallValid)
1835         {
1836             context->getnSeparableFilter(target, format, type, rowBufSize, row, columnBufSize,
1837                                          column, span);
1838         }
1839         ANGLE_CAPTURE(GetnSeparableFilter, isCallValid, context, target, format, type, rowBufSize,
1840                       row, columnBufSize, column, span);
1841     }
1842 }
1843 
1844 void GL_APIENTRY
GetnTexImage(GLenum target,GLint level,GLenum format,GLenum type,GLsizei bufSize,void * pixels)1845 GetnTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels)
1846 {
1847     Context *context = GetValidGlobalContext();
1848     EVENT("glGetnTexImage",
1849           "context = %d, GLenum target = %s, GLint level = %d, GLenum format = %s, GLenum type = "
1850           "%s, GLsizei bufSize = %d, void *pixels = 0x%016" PRIxPTR "",
1851           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level,
1852           GLenumToString(GLenumGroup::PixelFormat, format),
1853           GLenumToString(GLenumGroup::PixelType, type), bufSize, (uintptr_t)pixels);
1854 
1855     if (context)
1856     {
1857         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1858         bool isCallValid =
1859             (context->skipValidation() ||
1860              ValidateGetnTexImage(context, target, level, format, type, bufSize, pixels));
1861         if (isCallValid)
1862         {
1863             context->getnTexImage(target, level, format, type, bufSize, pixels);
1864         }
1865         ANGLE_CAPTURE(GetnTexImage, isCallValid, context, target, level, format, type, bufSize,
1866                       pixels);
1867     }
1868 }
1869 
GetnUniformdv(GLuint program,GLint location,GLsizei bufSize,GLdouble * params)1870 void GL_APIENTRY GetnUniformdv(GLuint program, GLint location, GLsizei bufSize, GLdouble *params)
1871 {
1872     Context *context = GetValidGlobalContext();
1873     EVENT("glGetnUniformdv",
1874           "context = %d, GLuint program = %u, GLint location = %d, GLsizei bufSize = %d, GLdouble "
1875           "*params = 0x%016" PRIxPTR "",
1876           CID(context), program, location, bufSize, (uintptr_t)params);
1877 
1878     if (context)
1879     {
1880         ShaderProgramID programPacked                         = FromGL<ShaderProgramID>(program);
1881         UniformLocation locationPacked                        = FromGL<UniformLocation>(location);
1882         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1883         bool isCallValid =
1884             (context->skipValidation() ||
1885              ValidateGetnUniformdv(context, programPacked, locationPacked, bufSize, params));
1886         if (isCallValid)
1887         {
1888             context->getnUniformdv(programPacked, locationPacked, bufSize, params);
1889         }
1890         ANGLE_CAPTURE(GetnUniformdv, isCallValid, context, programPacked, locationPacked, bufSize,
1891                       params);
1892     }
1893 }
1894 
GetnUniformfv(GLuint program,GLint location,GLsizei bufSize,GLfloat * params)1895 void GL_APIENTRY GetnUniformfv(GLuint program, GLint location, GLsizei bufSize, GLfloat *params)
1896 {
1897     Context *context = GetValidGlobalContext();
1898     EVENT("glGetnUniformfv",
1899           "context = %d, GLuint program = %u, GLint location = %d, GLsizei bufSize = %d, GLfloat "
1900           "*params = 0x%016" PRIxPTR "",
1901           CID(context), program, location, bufSize, (uintptr_t)params);
1902 
1903     if (context)
1904     {
1905         ShaderProgramID programPacked                         = FromGL<ShaderProgramID>(program);
1906         UniformLocation locationPacked                        = FromGL<UniformLocation>(location);
1907         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1908         bool isCallValid =
1909             (context->skipValidation() ||
1910              ValidateGetnUniformfv(context, programPacked, locationPacked, bufSize, params));
1911         if (isCallValid)
1912         {
1913             context->getnUniformfv(programPacked, locationPacked, bufSize, params);
1914         }
1915         ANGLE_CAPTURE(GetnUniformfv, isCallValid, context, programPacked, locationPacked, bufSize,
1916                       params);
1917     }
1918 }
1919 
GetnUniformiv(GLuint program,GLint location,GLsizei bufSize,GLint * params)1920 void GL_APIENTRY GetnUniformiv(GLuint program, GLint location, GLsizei bufSize, GLint *params)
1921 {
1922     Context *context = GetValidGlobalContext();
1923     EVENT("glGetnUniformiv",
1924           "context = %d, GLuint program = %u, GLint location = %d, GLsizei bufSize = %d, GLint "
1925           "*params = 0x%016" PRIxPTR "",
1926           CID(context), program, location, bufSize, (uintptr_t)params);
1927 
1928     if (context)
1929     {
1930         ShaderProgramID programPacked                         = FromGL<ShaderProgramID>(program);
1931         UniformLocation locationPacked                        = FromGL<UniformLocation>(location);
1932         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1933         bool isCallValid =
1934             (context->skipValidation() ||
1935              ValidateGetnUniformiv(context, programPacked, locationPacked, bufSize, params));
1936         if (isCallValid)
1937         {
1938             context->getnUniformiv(programPacked, locationPacked, bufSize, params);
1939         }
1940         ANGLE_CAPTURE(GetnUniformiv, isCallValid, context, programPacked, locationPacked, bufSize,
1941                       params);
1942     }
1943 }
1944 
GetnUniformuiv(GLuint program,GLint location,GLsizei bufSize,GLuint * params)1945 void GL_APIENTRY GetnUniformuiv(GLuint program, GLint location, GLsizei bufSize, GLuint *params)
1946 {
1947     Context *context = GetValidGlobalContext();
1948     EVENT("glGetnUniformuiv",
1949           "context = %d, GLuint program = %u, GLint location = %d, GLsizei bufSize = %d, GLuint "
1950           "*params = 0x%016" PRIxPTR "",
1951           CID(context), program, location, bufSize, (uintptr_t)params);
1952 
1953     if (context)
1954     {
1955         ShaderProgramID programPacked                         = FromGL<ShaderProgramID>(program);
1956         UniformLocation locationPacked                        = FromGL<UniformLocation>(location);
1957         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1958         bool isCallValid =
1959             (context->skipValidation() ||
1960              ValidateGetnUniformuiv(context, programPacked, locationPacked, bufSize, params));
1961         if (isCallValid)
1962         {
1963             context->getnUniformuiv(programPacked, locationPacked, bufSize, params);
1964         }
1965         ANGLE_CAPTURE(GetnUniformuiv, isCallValid, context, programPacked, locationPacked, bufSize,
1966                       params);
1967     }
1968 }
1969 
InvalidateNamedFramebufferData(GLuint framebuffer,GLsizei numAttachments,const GLenum * attachments)1970 void GL_APIENTRY InvalidateNamedFramebufferData(GLuint framebuffer,
1971                                                 GLsizei numAttachments,
1972                                                 const GLenum *attachments)
1973 {
1974     Context *context = GetValidGlobalContext();
1975     EVENT("glInvalidateNamedFramebufferData",
1976           "context = %d, GLuint framebuffer = %u, GLsizei numAttachments = %d, const GLenum "
1977           "*attachments = 0x%016" PRIxPTR "",
1978           CID(context), framebuffer, numAttachments, (uintptr_t)attachments);
1979 
1980     if (context)
1981     {
1982         FramebufferID framebufferPacked                       = FromGL<FramebufferID>(framebuffer);
1983         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
1984         bool isCallValid                                      = (context->skipValidation() ||
1985                             ValidateInvalidateNamedFramebufferData(context, framebufferPacked,
1986                                                                    numAttachments, attachments));
1987         if (isCallValid)
1988         {
1989             context->invalidateNamedFramebufferData(framebufferPacked, numAttachments, attachments);
1990         }
1991         ANGLE_CAPTURE(InvalidateNamedFramebufferData, isCallValid, context, framebufferPacked,
1992                       numAttachments, attachments);
1993     }
1994 }
1995 
InvalidateNamedFramebufferSubData(GLuint framebuffer,GLsizei numAttachments,const GLenum * attachments,GLint x,GLint y,GLsizei width,GLsizei height)1996 void GL_APIENTRY InvalidateNamedFramebufferSubData(GLuint framebuffer,
1997                                                    GLsizei numAttachments,
1998                                                    const GLenum *attachments,
1999                                                    GLint x,
2000                                                    GLint y,
2001                                                    GLsizei width,
2002                                                    GLsizei height)
2003 {
2004     Context *context = GetValidGlobalContext();
2005     EVENT("glInvalidateNamedFramebufferSubData",
2006           "context = %d, GLuint framebuffer = %u, GLsizei numAttachments = %d, const GLenum "
2007           "*attachments = 0x%016" PRIxPTR
2008           ", GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d",
2009           CID(context), framebuffer, numAttachments, (uintptr_t)attachments, x, y, width, height);
2010 
2011     if (context)
2012     {
2013         FramebufferID framebufferPacked                       = FromGL<FramebufferID>(framebuffer);
2014         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2015         bool isCallValid =
2016             (context->skipValidation() ||
2017              ValidateInvalidateNamedFramebufferSubData(context, framebufferPacked, numAttachments,
2018                                                        attachments, x, y, width, height));
2019         if (isCallValid)
2020         {
2021             context->invalidateNamedFramebufferSubData(framebufferPacked, numAttachments,
2022                                                        attachments, x, y, width, height);
2023         }
2024         ANGLE_CAPTURE(InvalidateNamedFramebufferSubData, isCallValid, context, framebufferPacked,
2025                       numAttachments, attachments, x, y, width, height);
2026     }
2027 }
2028 
MapNamedBuffer(GLuint buffer,GLenum access)2029 void *GL_APIENTRY MapNamedBuffer(GLuint buffer, GLenum access)
2030 {
2031     Context *context = GetValidGlobalContext();
2032     EVENT("glMapNamedBuffer", "context = %d, GLuint buffer = %u, GLenum access = %s", CID(context),
2033           buffer, GLenumToString(GLenumGroup::BufferAccessARB, access));
2034 
2035     void *returnValue;
2036     if (context)
2037     {
2038         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
2039         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2040         bool isCallValid =
2041             (context->skipValidation() || ValidateMapNamedBuffer(context, bufferPacked, access));
2042         if (isCallValid)
2043         {
2044             returnValue = context->mapNamedBuffer(bufferPacked, access);
2045         }
2046         else
2047         {
2048             returnValue = GetDefaultReturnValue<EntryPoint::MapNamedBuffer, void *>();
2049         }
2050         ANGLE_CAPTURE(MapNamedBuffer, isCallValid, context, bufferPacked, access, returnValue);
2051     }
2052     else
2053     {
2054         returnValue = GetDefaultReturnValue<EntryPoint::MapNamedBuffer, void *>();
2055     }
2056     return returnValue;
2057 }
2058 
MapNamedBufferRange(GLuint buffer,GLintptr offset,GLsizeiptr length,GLbitfield access)2059 void *GL_APIENTRY MapNamedBufferRange(GLuint buffer,
2060                                       GLintptr offset,
2061                                       GLsizeiptr length,
2062                                       GLbitfield access)
2063 {
2064     Context *context = GetValidGlobalContext();
2065     EVENT("glMapNamedBufferRange",
2066           "context = %d, GLuint buffer = %u, GLintptr offset = %llu, GLsizeiptr length = %llu, "
2067           "GLbitfield access = %s",
2068           CID(context), buffer, static_cast<unsigned long long>(offset),
2069           static_cast<unsigned long long>(length),
2070           GLbitfieldToString(GLenumGroup::BufferAccessMask, access).c_str());
2071 
2072     void *returnValue;
2073     if (context)
2074     {
2075         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
2076         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2077         bool isCallValid =
2078             (context->skipValidation() ||
2079              ValidateMapNamedBufferRange(context, bufferPacked, offset, length, access));
2080         if (isCallValid)
2081         {
2082             returnValue = context->mapNamedBufferRange(bufferPacked, offset, length, access);
2083         }
2084         else
2085         {
2086             returnValue = GetDefaultReturnValue<EntryPoint::MapNamedBufferRange, void *>();
2087         }
2088         ANGLE_CAPTURE(MapNamedBufferRange, isCallValid, context, bufferPacked, offset, length,
2089                       access, returnValue);
2090     }
2091     else
2092     {
2093         returnValue = GetDefaultReturnValue<EntryPoint::MapNamedBufferRange, void *>();
2094     }
2095     return returnValue;
2096 }
2097 
MemoryBarrierByRegion(GLbitfield barriers)2098 void GL_APIENTRY MemoryBarrierByRegion(GLbitfield barriers)
2099 {
2100     Context *context = GetValidGlobalContext();
2101     EVENT("glMemoryBarrierByRegion", "context = %d, GLbitfield barriers = %s", CID(context),
2102           GLbitfieldToString(GLenumGroup::MemoryBarrierMask, barriers).c_str());
2103 
2104     if (context)
2105     {
2106         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2107         bool isCallValid =
2108             (context->skipValidation() || ValidateMemoryBarrierByRegion(context, barriers));
2109         if (isCallValid)
2110         {
2111             context->memoryBarrierByRegion(barriers);
2112         }
2113         ANGLE_CAPTURE(MemoryBarrierByRegion, isCallValid, context, barriers);
2114     }
2115 }
2116 
NamedBufferData(GLuint buffer,GLsizeiptr size,const void * data,GLenum usage)2117 void GL_APIENTRY NamedBufferData(GLuint buffer, GLsizeiptr size, const void *data, GLenum usage)
2118 {
2119     Context *context = GetValidGlobalContext();
2120     EVENT("glNamedBufferData",
2121           "context = %d, GLuint buffer = %u, GLsizeiptr size = %llu, const void *data = "
2122           "0x%016" PRIxPTR ", GLenum usage = %s",
2123           CID(context), buffer, static_cast<unsigned long long>(size), (uintptr_t)data,
2124           GLenumToString(GLenumGroup::VertexBufferObjectUsage, usage));
2125 
2126     if (context)
2127     {
2128         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
2129         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2130         bool isCallValid                                      = (context->skipValidation() ||
2131                             ValidateNamedBufferData(context, bufferPacked, size, data, usage));
2132         if (isCallValid)
2133         {
2134             context->namedBufferData(bufferPacked, size, data, usage);
2135         }
2136         ANGLE_CAPTURE(NamedBufferData, isCallValid, context, bufferPacked, size, data, usage);
2137     }
2138 }
2139 
NamedBufferStorage(GLuint buffer,GLsizeiptr size,const void * data,GLbitfield flags)2140 void GL_APIENTRY NamedBufferStorage(GLuint buffer,
2141                                     GLsizeiptr size,
2142                                     const void *data,
2143                                     GLbitfield flags)
2144 {
2145     Context *context = GetValidGlobalContext();
2146     EVENT("glNamedBufferStorage",
2147           "context = %d, GLuint buffer = %u, GLsizeiptr size = %llu, const void *data = "
2148           "0x%016" PRIxPTR ", GLbitfield flags = %s",
2149           CID(context), buffer, static_cast<unsigned long long>(size), (uintptr_t)data,
2150           GLbitfieldToString(GLenumGroup::MapBufferUsageMask, flags).c_str());
2151 
2152     if (context)
2153     {
2154         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
2155         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2156         bool isCallValid                                      = (context->skipValidation() ||
2157                             ValidateNamedBufferStorage(context, bufferPacked, size, data, flags));
2158         if (isCallValid)
2159         {
2160             context->namedBufferStorage(bufferPacked, size, data, flags);
2161         }
2162         ANGLE_CAPTURE(NamedBufferStorage, isCallValid, context, bufferPacked, size, data, flags);
2163     }
2164 }
2165 
NamedBufferSubData(GLuint buffer,GLintptr offset,GLsizeiptr size,const void * data)2166 void GL_APIENTRY NamedBufferSubData(GLuint buffer,
2167                                     GLintptr offset,
2168                                     GLsizeiptr size,
2169                                     const void *data)
2170 {
2171     Context *context = GetValidGlobalContext();
2172     EVENT("glNamedBufferSubData",
2173           "context = %d, GLuint buffer = %u, GLintptr offset = %llu, GLsizeiptr size = %llu, const "
2174           "void *data = 0x%016" PRIxPTR "",
2175           CID(context), buffer, static_cast<unsigned long long>(offset),
2176           static_cast<unsigned long long>(size), (uintptr_t)data);
2177 
2178     if (context)
2179     {
2180         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
2181         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2182         bool isCallValid                                      = (context->skipValidation() ||
2183                             ValidateNamedBufferSubData(context, bufferPacked, offset, size, data));
2184         if (isCallValid)
2185         {
2186             context->namedBufferSubData(bufferPacked, offset, size, data);
2187         }
2188         ANGLE_CAPTURE(NamedBufferSubData, isCallValid, context, bufferPacked, offset, size, data);
2189     }
2190 }
2191 
NamedFramebufferDrawBuffer(GLuint framebuffer,GLenum buf)2192 void GL_APIENTRY NamedFramebufferDrawBuffer(GLuint framebuffer, GLenum buf)
2193 {
2194     Context *context = GetValidGlobalContext();
2195     EVENT("glNamedFramebufferDrawBuffer", "context = %d, GLuint framebuffer = %u, GLenum buf = %s",
2196           CID(context), framebuffer, GLenumToString(GLenumGroup::ColorBuffer, buf));
2197 
2198     if (context)
2199     {
2200         FramebufferID framebufferPacked                       = FromGL<FramebufferID>(framebuffer);
2201         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2202         bool isCallValid                                      = (context->skipValidation() ||
2203                             ValidateNamedFramebufferDrawBuffer(context, framebufferPacked, buf));
2204         if (isCallValid)
2205         {
2206             context->namedFramebufferDrawBuffer(framebufferPacked, buf);
2207         }
2208         ANGLE_CAPTURE(NamedFramebufferDrawBuffer, isCallValid, context, framebufferPacked, buf);
2209     }
2210 }
2211 
NamedFramebufferDrawBuffers(GLuint framebuffer,GLsizei n,const GLenum * bufs)2212 void GL_APIENTRY NamedFramebufferDrawBuffers(GLuint framebuffer, GLsizei n, const GLenum *bufs)
2213 {
2214     Context *context = GetValidGlobalContext();
2215     EVENT(
2216         "glNamedFramebufferDrawBuffers",
2217         "context = %d, GLuint framebuffer = %u, GLsizei n = %d, const GLenum *bufs = 0x%016" PRIxPTR
2218         "",
2219         CID(context), framebuffer, n, (uintptr_t)bufs);
2220 
2221     if (context)
2222     {
2223         FramebufferID framebufferPacked                       = FromGL<FramebufferID>(framebuffer);
2224         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2225         bool isCallValid = (context->skipValidation() || ValidateNamedFramebufferDrawBuffers(
2226                                                              context, framebufferPacked, n, bufs));
2227         if (isCallValid)
2228         {
2229             context->namedFramebufferDrawBuffers(framebufferPacked, n, bufs);
2230         }
2231         ANGLE_CAPTURE(NamedFramebufferDrawBuffers, isCallValid, context, framebufferPacked, n,
2232                       bufs);
2233     }
2234 }
2235 
NamedFramebufferParameteri(GLuint framebuffer,GLenum pname,GLint param)2236 void GL_APIENTRY NamedFramebufferParameteri(GLuint framebuffer, GLenum pname, GLint param)
2237 {
2238     Context *context = GetValidGlobalContext();
2239     EVENT("glNamedFramebufferParameteri",
2240           "context = %d, GLuint framebuffer = %u, GLenum pname = %s, GLint param = %d",
2241           CID(context), framebuffer, GLenumToString(GLenumGroup::FramebufferParameterName, pname),
2242           param);
2243 
2244     if (context)
2245     {
2246         FramebufferID framebufferPacked                       = FromGL<FramebufferID>(framebuffer);
2247         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2248         bool isCallValid =
2249             (context->skipValidation() ||
2250              ValidateNamedFramebufferParameteri(context, framebufferPacked, pname, param));
2251         if (isCallValid)
2252         {
2253             context->namedFramebufferParameteri(framebufferPacked, pname, param);
2254         }
2255         ANGLE_CAPTURE(NamedFramebufferParameteri, isCallValid, context, framebufferPacked, pname,
2256                       param);
2257     }
2258 }
2259 
NamedFramebufferReadBuffer(GLuint framebuffer,GLenum src)2260 void GL_APIENTRY NamedFramebufferReadBuffer(GLuint framebuffer, GLenum src)
2261 {
2262     Context *context = GetValidGlobalContext();
2263     EVENT("glNamedFramebufferReadBuffer", "context = %d, GLuint framebuffer = %u, GLenum src = %s",
2264           CID(context), framebuffer, GLenumToString(GLenumGroup::ColorBuffer, src));
2265 
2266     if (context)
2267     {
2268         FramebufferID framebufferPacked                       = FromGL<FramebufferID>(framebuffer);
2269         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2270         bool isCallValid                                      = (context->skipValidation() ||
2271                             ValidateNamedFramebufferReadBuffer(context, framebufferPacked, src));
2272         if (isCallValid)
2273         {
2274             context->namedFramebufferReadBuffer(framebufferPacked, src);
2275         }
2276         ANGLE_CAPTURE(NamedFramebufferReadBuffer, isCallValid, context, framebufferPacked, src);
2277     }
2278 }
2279 
NamedFramebufferRenderbuffer(GLuint framebuffer,GLenum attachment,GLenum renderbuffertarget,GLuint renderbuffer)2280 void GL_APIENTRY NamedFramebufferRenderbuffer(GLuint framebuffer,
2281                                               GLenum attachment,
2282                                               GLenum renderbuffertarget,
2283                                               GLuint renderbuffer)
2284 {
2285     Context *context = GetValidGlobalContext();
2286     EVENT("glNamedFramebufferRenderbuffer",
2287           "context = %d, GLuint framebuffer = %u, GLenum attachment = %s, GLenum "
2288           "renderbuffertarget = %s, GLuint renderbuffer = %u",
2289           CID(context), framebuffer, GLenumToString(GLenumGroup::FramebufferAttachment, attachment),
2290           GLenumToString(GLenumGroup::RenderbufferTarget, renderbuffertarget), renderbuffer);
2291 
2292     if (context)
2293     {
2294         FramebufferID framebufferPacked   = FromGL<FramebufferID>(framebuffer);
2295         RenderbufferID renderbufferPacked = FromGL<RenderbufferID>(renderbuffer);
2296         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2297         bool isCallValid =
2298             (context->skipValidation() ||
2299              ValidateNamedFramebufferRenderbuffer(context, framebufferPacked, attachment,
2300                                                   renderbuffertarget, renderbufferPacked));
2301         if (isCallValid)
2302         {
2303             context->namedFramebufferRenderbuffer(framebufferPacked, attachment, renderbuffertarget,
2304                                                   renderbufferPacked);
2305         }
2306         ANGLE_CAPTURE(NamedFramebufferRenderbuffer, isCallValid, context, framebufferPacked,
2307                       attachment, renderbuffertarget, renderbufferPacked);
2308     }
2309 }
2310 
NamedFramebufferTexture(GLuint framebuffer,GLenum attachment,GLuint texture,GLint level)2311 void GL_APIENTRY NamedFramebufferTexture(GLuint framebuffer,
2312                                          GLenum attachment,
2313                                          GLuint texture,
2314                                          GLint level)
2315 {
2316     Context *context = GetValidGlobalContext();
2317     EVENT("glNamedFramebufferTexture",
2318           "context = %d, GLuint framebuffer = %u, GLenum attachment = %s, GLuint texture = %u, "
2319           "GLint level = %d",
2320           CID(context), framebuffer, GLenumToString(GLenumGroup::FramebufferAttachment, attachment),
2321           texture, level);
2322 
2323     if (context)
2324     {
2325         FramebufferID framebufferPacked                       = FromGL<FramebufferID>(framebuffer);
2326         TextureID texturePacked                               = FromGL<TextureID>(texture);
2327         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2328         bool isCallValid                                      = (context->skipValidation() ||
2329                             ValidateNamedFramebufferTexture(context, framebufferPacked, attachment,
2330                                                             texturePacked, level));
2331         if (isCallValid)
2332         {
2333             context->namedFramebufferTexture(framebufferPacked, attachment, texturePacked, level);
2334         }
2335         ANGLE_CAPTURE(NamedFramebufferTexture, isCallValid, context, framebufferPacked, attachment,
2336                       texturePacked, level);
2337     }
2338 }
2339 
NamedFramebufferTextureLayer(GLuint framebuffer,GLenum attachment,GLuint texture,GLint level,GLint layer)2340 void GL_APIENTRY NamedFramebufferTextureLayer(GLuint framebuffer,
2341                                               GLenum attachment,
2342                                               GLuint texture,
2343                                               GLint level,
2344                                               GLint layer)
2345 {
2346     Context *context = GetValidGlobalContext();
2347     EVENT("glNamedFramebufferTextureLayer",
2348           "context = %d, GLuint framebuffer = %u, GLenum attachment = %s, GLuint texture = %u, "
2349           "GLint level = %d, GLint layer = %d",
2350           CID(context), framebuffer, GLenumToString(GLenumGroup::FramebufferAttachment, attachment),
2351           texture, level, layer);
2352 
2353     if (context)
2354     {
2355         FramebufferID framebufferPacked                       = FromGL<FramebufferID>(framebuffer);
2356         TextureID texturePacked                               = FromGL<TextureID>(texture);
2357         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2358         bool isCallValid = (context->skipValidation() || ValidateNamedFramebufferTextureLayer(
2359                                                              context, framebufferPacked, attachment,
2360                                                              texturePacked, level, layer));
2361         if (isCallValid)
2362         {
2363             context->namedFramebufferTextureLayer(framebufferPacked, attachment, texturePacked,
2364                                                   level, layer);
2365         }
2366         ANGLE_CAPTURE(NamedFramebufferTextureLayer, isCallValid, context, framebufferPacked,
2367                       attachment, texturePacked, level, layer);
2368     }
2369 }
2370 
NamedRenderbufferStorage(GLuint renderbuffer,GLenum internalformat,GLsizei width,GLsizei height)2371 void GL_APIENTRY NamedRenderbufferStorage(GLuint renderbuffer,
2372                                           GLenum internalformat,
2373                                           GLsizei width,
2374                                           GLsizei height)
2375 {
2376     Context *context = GetValidGlobalContext();
2377     EVENT("glNamedRenderbufferStorage",
2378           "context = %d, GLuint renderbuffer = %u, GLenum internalformat = %s, GLsizei width = %d, "
2379           "GLsizei height = %d",
2380           CID(context), renderbuffer, GLenumToString(GLenumGroup::InternalFormat, internalformat),
2381           width, height);
2382 
2383     if (context)
2384     {
2385         RenderbufferID renderbufferPacked = FromGL<RenderbufferID>(renderbuffer);
2386         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2387         bool isCallValid                                      = (context->skipValidation() ||
2388                             ValidateNamedRenderbufferStorage(context, renderbufferPacked,
2389                                                              internalformat, width, height));
2390         if (isCallValid)
2391         {
2392             context->namedRenderbufferStorage(renderbufferPacked, internalformat, width, height);
2393         }
2394         ANGLE_CAPTURE(NamedRenderbufferStorage, isCallValid, context, renderbufferPacked,
2395                       internalformat, width, height);
2396     }
2397 }
2398 
NamedRenderbufferStorageMultisample(GLuint renderbuffer,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height)2399 void GL_APIENTRY NamedRenderbufferStorageMultisample(GLuint renderbuffer,
2400                                                      GLsizei samples,
2401                                                      GLenum internalformat,
2402                                                      GLsizei width,
2403                                                      GLsizei height)
2404 {
2405     Context *context = GetValidGlobalContext();
2406     EVENT("glNamedRenderbufferStorageMultisample",
2407           "context = %d, GLuint renderbuffer = %u, GLsizei samples = %d, GLenum internalformat = "
2408           "%s, GLsizei width = %d, GLsizei height = %d",
2409           CID(context), renderbuffer, samples,
2410           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height);
2411 
2412     if (context)
2413     {
2414         RenderbufferID renderbufferPacked = FromGL<RenderbufferID>(renderbuffer);
2415         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2416         bool isCallValid =
2417             (context->skipValidation() ||
2418              ValidateNamedRenderbufferStorageMultisample(context, renderbufferPacked, samples,
2419                                                          internalformat, width, height));
2420         if (isCallValid)
2421         {
2422             context->namedRenderbufferStorageMultisample(renderbufferPacked, samples,
2423                                                          internalformat, width, height);
2424         }
2425         ANGLE_CAPTURE(NamedRenderbufferStorageMultisample, isCallValid, context, renderbufferPacked,
2426                       samples, internalformat, width, height);
2427     }
2428 }
2429 
ReadnPixels(GLint x,GLint y,GLsizei width,GLsizei height,GLenum format,GLenum type,GLsizei bufSize,void * data)2430 void GL_APIENTRY ReadnPixels(GLint x,
2431                              GLint y,
2432                              GLsizei width,
2433                              GLsizei height,
2434                              GLenum format,
2435                              GLenum type,
2436                              GLsizei bufSize,
2437                              void *data)
2438 {
2439     Context *context = GetValidGlobalContext();
2440     EVENT("glReadnPixels",
2441           "context = %d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, "
2442           "GLenum format = %s, GLenum type = %s, GLsizei bufSize = %d, void *data = 0x%016" PRIxPTR
2443           "",
2444           CID(context), x, y, width, height, GLenumToString(GLenumGroup::PixelFormat, format),
2445           GLenumToString(GLenumGroup::PixelType, type), bufSize, (uintptr_t)data);
2446 
2447     if (context)
2448     {
2449         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2450         bool isCallValid =
2451             (context->skipValidation() ||
2452              ValidateReadnPixels(context, x, y, width, height, format, type, bufSize, data));
2453         if (isCallValid)
2454         {
2455             context->readnPixels(x, y, width, height, format, type, bufSize, data);
2456         }
2457         ANGLE_CAPTURE(ReadnPixels, isCallValid, context, x, y, width, height, format, type, bufSize,
2458                       data);
2459     }
2460 }
2461 
TextureBarrier()2462 void GL_APIENTRY TextureBarrier()
2463 {
2464     Context *context = GetValidGlobalContext();
2465     EVENT("glTextureBarrier", "context = %d", CID(context));
2466 
2467     if (context)
2468     {
2469         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2470         bool isCallValid = (context->skipValidation() || ValidateTextureBarrier(context));
2471         if (isCallValid)
2472         {
2473             context->textureBarrier();
2474         }
2475         ANGLE_CAPTURE(TextureBarrier, isCallValid, context);
2476     }
2477 }
2478 
TextureBuffer(GLuint texture,GLenum internalformat,GLuint buffer)2479 void GL_APIENTRY TextureBuffer(GLuint texture, GLenum internalformat, GLuint buffer)
2480 {
2481     Context *context = GetValidGlobalContext();
2482     EVENT("glTextureBuffer",
2483           "context = %d, GLuint texture = %u, GLenum internalformat = %s, GLuint buffer = %u",
2484           CID(context), texture, GLenumToString(GLenumGroup::InternalFormat, internalformat),
2485           buffer);
2486 
2487     if (context)
2488     {
2489         TextureID texturePacked                               = FromGL<TextureID>(texture);
2490         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
2491         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2492         bool isCallValid =
2493             (context->skipValidation() ||
2494              ValidateTextureBuffer(context, texturePacked, internalformat, bufferPacked));
2495         if (isCallValid)
2496         {
2497             context->textureBuffer(texturePacked, internalformat, bufferPacked);
2498         }
2499         ANGLE_CAPTURE(TextureBuffer, isCallValid, context, texturePacked, internalformat,
2500                       bufferPacked);
2501     }
2502 }
2503 
TextureBufferRange(GLuint texture,GLenum internalformat,GLuint buffer,GLintptr offset,GLsizeiptr size)2504 void GL_APIENTRY TextureBufferRange(GLuint texture,
2505                                     GLenum internalformat,
2506                                     GLuint buffer,
2507                                     GLintptr offset,
2508                                     GLsizeiptr size)
2509 {
2510     Context *context = GetValidGlobalContext();
2511     EVENT("glTextureBufferRange",
2512           "context = %d, GLuint texture = %u, GLenum internalformat = %s, GLuint buffer = %u, "
2513           "GLintptr offset = %llu, GLsizeiptr size = %llu",
2514           CID(context), texture, GLenumToString(GLenumGroup::InternalFormat, internalformat),
2515           buffer, static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size));
2516 
2517     if (context)
2518     {
2519         TextureID texturePacked                               = FromGL<TextureID>(texture);
2520         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
2521         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2522         bool isCallValid                                      = (context->skipValidation() ||
2523                             ValidateTextureBufferRange(context, texturePacked, internalformat,
2524                                                        bufferPacked, offset, size));
2525         if (isCallValid)
2526         {
2527             context->textureBufferRange(texturePacked, internalformat, bufferPacked, offset, size);
2528         }
2529         ANGLE_CAPTURE(TextureBufferRange, isCallValid, context, texturePacked, internalformat,
2530                       bufferPacked, offset, size);
2531     }
2532 }
2533 
TextureParameterIiv(GLuint texture,GLenum pname,const GLint * params)2534 void GL_APIENTRY TextureParameterIiv(GLuint texture, GLenum pname, const GLint *params)
2535 {
2536     Context *context = GetValidGlobalContext();
2537     EVENT(
2538         "glTextureParameterIiv",
2539         "context = %d, GLuint texture = %u, GLenum pname = %s, const GLint *params = 0x%016" PRIxPTR
2540         "",
2541         CID(context), texture, GLenumToString(GLenumGroup::TextureParameterName, pname),
2542         (uintptr_t)params);
2543 
2544     if (context)
2545     {
2546         TextureID texturePacked                               = FromGL<TextureID>(texture);
2547         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2548         bool isCallValid                                      = (context->skipValidation() ||
2549                             ValidateTextureParameterIiv(context, texturePacked, pname, params));
2550         if (isCallValid)
2551         {
2552             context->textureParameterIiv(texturePacked, pname, params);
2553         }
2554         ANGLE_CAPTURE(TextureParameterIiv, isCallValid, context, texturePacked, pname, params);
2555     }
2556 }
2557 
TextureParameterIuiv(GLuint texture,GLenum pname,const GLuint * params)2558 void GL_APIENTRY TextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params)
2559 {
2560     Context *context = GetValidGlobalContext();
2561     EVENT("glTextureParameterIuiv",
2562           "context = %d, GLuint texture = %u, GLenum pname = %s, const GLuint *params = "
2563           "0x%016" PRIxPTR "",
2564           CID(context), texture, GLenumToString(GLenumGroup::TextureParameterName, pname),
2565           (uintptr_t)params);
2566 
2567     if (context)
2568     {
2569         TextureID texturePacked                               = FromGL<TextureID>(texture);
2570         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2571         bool isCallValid                                      = (context->skipValidation() ||
2572                             ValidateTextureParameterIuiv(context, texturePacked, pname, params));
2573         if (isCallValid)
2574         {
2575             context->textureParameterIuiv(texturePacked, pname, params);
2576         }
2577         ANGLE_CAPTURE(TextureParameterIuiv, isCallValid, context, texturePacked, pname, params);
2578     }
2579 }
2580 
TextureParameterf(GLuint texture,GLenum pname,GLfloat param)2581 void GL_APIENTRY TextureParameterf(GLuint texture, GLenum pname, GLfloat param)
2582 {
2583     Context *context = GetValidGlobalContext();
2584     EVENT("glTextureParameterf",
2585           "context = %d, GLuint texture = %u, GLenum pname = %s, GLfloat param = %f", CID(context),
2586           texture, GLenumToString(GLenumGroup::TextureParameterName, pname), param);
2587 
2588     if (context)
2589     {
2590         TextureID texturePacked                               = FromGL<TextureID>(texture);
2591         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2592         bool isCallValid                                      = (context->skipValidation() ||
2593                             ValidateTextureParameterf(context, texturePacked, pname, param));
2594         if (isCallValid)
2595         {
2596             context->textureParameterf(texturePacked, pname, param);
2597         }
2598         ANGLE_CAPTURE(TextureParameterf, isCallValid, context, texturePacked, pname, param);
2599     }
2600 }
2601 
TextureParameterfv(GLuint texture,GLenum pname,const GLfloat * param)2602 void GL_APIENTRY TextureParameterfv(GLuint texture, GLenum pname, const GLfloat *param)
2603 {
2604     Context *context = GetValidGlobalContext();
2605     EVENT("glTextureParameterfv",
2606           "context = %d, GLuint texture = %u, GLenum pname = %s, const GLfloat *param = "
2607           "0x%016" PRIxPTR "",
2608           CID(context), texture, GLenumToString(GLenumGroup::TextureParameterName, pname),
2609           (uintptr_t)param);
2610 
2611     if (context)
2612     {
2613         TextureID texturePacked                               = FromGL<TextureID>(texture);
2614         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2615         bool isCallValid                                      = (context->skipValidation() ||
2616                             ValidateTextureParameterfv(context, texturePacked, pname, param));
2617         if (isCallValid)
2618         {
2619             context->textureParameterfv(texturePacked, pname, param);
2620         }
2621         ANGLE_CAPTURE(TextureParameterfv, isCallValid, context, texturePacked, pname, param);
2622     }
2623 }
2624 
TextureParameteri(GLuint texture,GLenum pname,GLint param)2625 void GL_APIENTRY TextureParameteri(GLuint texture, GLenum pname, GLint param)
2626 {
2627     Context *context = GetValidGlobalContext();
2628     EVENT("glTextureParameteri",
2629           "context = %d, GLuint texture = %u, GLenum pname = %s, GLint param = %d", CID(context),
2630           texture, GLenumToString(GLenumGroup::TextureParameterName, pname), param);
2631 
2632     if (context)
2633     {
2634         TextureID texturePacked                               = FromGL<TextureID>(texture);
2635         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2636         bool isCallValid                                      = (context->skipValidation() ||
2637                             ValidateTextureParameteri(context, texturePacked, pname, param));
2638         if (isCallValid)
2639         {
2640             context->textureParameteri(texturePacked, pname, param);
2641         }
2642         ANGLE_CAPTURE(TextureParameteri, isCallValid, context, texturePacked, pname, param);
2643     }
2644 }
2645 
TextureParameteriv(GLuint texture,GLenum pname,const GLint * param)2646 void GL_APIENTRY TextureParameteriv(GLuint texture, GLenum pname, const GLint *param)
2647 {
2648     Context *context = GetValidGlobalContext();
2649     EVENT(
2650         "glTextureParameteriv",
2651         "context = %d, GLuint texture = %u, GLenum pname = %s, const GLint *param = 0x%016" PRIxPTR
2652         "",
2653         CID(context), texture, GLenumToString(GLenumGroup::TextureParameterName, pname),
2654         (uintptr_t)param);
2655 
2656     if (context)
2657     {
2658         TextureID texturePacked                               = FromGL<TextureID>(texture);
2659         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2660         bool isCallValid                                      = (context->skipValidation() ||
2661                             ValidateTextureParameteriv(context, texturePacked, pname, param));
2662         if (isCallValid)
2663         {
2664             context->textureParameteriv(texturePacked, pname, param);
2665         }
2666         ANGLE_CAPTURE(TextureParameteriv, isCallValid, context, texturePacked, pname, param);
2667     }
2668 }
2669 
TextureStorage1D(GLuint texture,GLsizei levels,GLenum internalformat,GLsizei width)2670 void GL_APIENTRY TextureStorage1D(GLuint texture,
2671                                   GLsizei levels,
2672                                   GLenum internalformat,
2673                                   GLsizei width)
2674 {
2675     Context *context = GetValidGlobalContext();
2676     EVENT("glTextureStorage1D",
2677           "context = %d, GLuint texture = %u, GLsizei levels = %d, GLenum internalformat = %s, "
2678           "GLsizei width = %d",
2679           CID(context), texture, levels,
2680           GLenumToString(GLenumGroup::InternalFormat, internalformat), width);
2681 
2682     if (context)
2683     {
2684         TextureID texturePacked                               = FromGL<TextureID>(texture);
2685         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2686         bool isCallValid =
2687             (context->skipValidation() ||
2688              ValidateTextureStorage1D(context, texturePacked, levels, internalformat, width));
2689         if (isCallValid)
2690         {
2691             context->textureStorage1D(texturePacked, levels, internalformat, width);
2692         }
2693         ANGLE_CAPTURE(TextureStorage1D, isCallValid, context, texturePacked, levels, internalformat,
2694                       width);
2695     }
2696 }
2697 
TextureStorage2D(GLuint texture,GLsizei levels,GLenum internalformat,GLsizei width,GLsizei height)2698 void GL_APIENTRY TextureStorage2D(GLuint texture,
2699                                   GLsizei levels,
2700                                   GLenum internalformat,
2701                                   GLsizei width,
2702                                   GLsizei height)
2703 {
2704     Context *context = GetValidGlobalContext();
2705     EVENT("glTextureStorage2D",
2706           "context = %d, GLuint texture = %u, GLsizei levels = %d, GLenum internalformat = %s, "
2707           "GLsizei width = %d, GLsizei height = %d",
2708           CID(context), texture, levels,
2709           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height);
2710 
2711     if (context)
2712     {
2713         TextureID texturePacked                               = FromGL<TextureID>(texture);
2714         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2715         bool isCallValid =
2716             (context->skipValidation() || ValidateTextureStorage2D(context, texturePacked, levels,
2717                                                                    internalformat, width, height));
2718         if (isCallValid)
2719         {
2720             context->textureStorage2D(texturePacked, levels, internalformat, width, height);
2721         }
2722         ANGLE_CAPTURE(TextureStorage2D, isCallValid, context, texturePacked, levels, internalformat,
2723                       width, height);
2724     }
2725 }
2726 
TextureStorage2DMultisample(GLuint texture,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height,GLboolean fixedsamplelocations)2727 void GL_APIENTRY TextureStorage2DMultisample(GLuint texture,
2728                                              GLsizei samples,
2729                                              GLenum internalformat,
2730                                              GLsizei width,
2731                                              GLsizei height,
2732                                              GLboolean fixedsamplelocations)
2733 {
2734     Context *context = GetValidGlobalContext();
2735     EVENT("glTextureStorage2DMultisample",
2736           "context = %d, GLuint texture = %u, GLsizei samples = %d, GLenum internalformat = %s, "
2737           "GLsizei width = %d, GLsizei height = %d, GLboolean fixedsamplelocations = %s",
2738           CID(context), texture, samples,
2739           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height,
2740           GLbooleanToString(fixedsamplelocations));
2741 
2742     if (context)
2743     {
2744         TextureID texturePacked                               = FromGL<TextureID>(texture);
2745         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2746         bool isCallValid =
2747             (context->skipValidation() ||
2748              ValidateTextureStorage2DMultisample(context, texturePacked, samples, internalformat,
2749                                                  width, height, fixedsamplelocations));
2750         if (isCallValid)
2751         {
2752             context->textureStorage2DMultisample(texturePacked, samples, internalformat, width,
2753                                                  height, fixedsamplelocations);
2754         }
2755         ANGLE_CAPTURE(TextureStorage2DMultisample, isCallValid, context, texturePacked, samples,
2756                       internalformat, width, height, fixedsamplelocations);
2757     }
2758 }
2759 
TextureStorage3D(GLuint texture,GLsizei levels,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth)2760 void GL_APIENTRY TextureStorage3D(GLuint texture,
2761                                   GLsizei levels,
2762                                   GLenum internalformat,
2763                                   GLsizei width,
2764                                   GLsizei height,
2765                                   GLsizei depth)
2766 {
2767     Context *context = GetValidGlobalContext();
2768     EVENT("glTextureStorage3D",
2769           "context = %d, GLuint texture = %u, GLsizei levels = %d, GLenum internalformat = %s, "
2770           "GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d",
2771           CID(context), texture, levels,
2772           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height, depth);
2773 
2774     if (context)
2775     {
2776         TextureID texturePacked                               = FromGL<TextureID>(texture);
2777         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2778         bool isCallValid                                      = (context->skipValidation() ||
2779                             ValidateTextureStorage3D(context, texturePacked, levels, internalformat,
2780                                                      width, height, depth));
2781         if (isCallValid)
2782         {
2783             context->textureStorage3D(texturePacked, levels, internalformat, width, height, depth);
2784         }
2785         ANGLE_CAPTURE(TextureStorage3D, isCallValid, context, texturePacked, levels, internalformat,
2786                       width, height, depth);
2787     }
2788 }
2789 
TextureStorage3DMultisample(GLuint texture,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLboolean fixedsamplelocations)2790 void GL_APIENTRY TextureStorage3DMultisample(GLuint texture,
2791                                              GLsizei samples,
2792                                              GLenum internalformat,
2793                                              GLsizei width,
2794                                              GLsizei height,
2795                                              GLsizei depth,
2796                                              GLboolean fixedsamplelocations)
2797 {
2798     Context *context = GetValidGlobalContext();
2799     EVENT("glTextureStorage3DMultisample",
2800           "context = %d, GLuint texture = %u, GLsizei samples = %d, GLenum internalformat = %s, "
2801           "GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, GLboolean "
2802           "fixedsamplelocations = %s",
2803           CID(context), texture, samples,
2804           GLenumToString(GLenumGroup::InternalFormat, internalformat), width, height, depth,
2805           GLbooleanToString(fixedsamplelocations));
2806 
2807     if (context)
2808     {
2809         TextureID texturePacked                               = FromGL<TextureID>(texture);
2810         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2811         bool isCallValid =
2812             (context->skipValidation() ||
2813              ValidateTextureStorage3DMultisample(context, texturePacked, samples, internalformat,
2814                                                  width, height, depth, fixedsamplelocations));
2815         if (isCallValid)
2816         {
2817             context->textureStorage3DMultisample(texturePacked, samples, internalformat, width,
2818                                                  height, depth, fixedsamplelocations);
2819         }
2820         ANGLE_CAPTURE(TextureStorage3DMultisample, isCallValid, context, texturePacked, samples,
2821                       internalformat, width, height, depth, fixedsamplelocations);
2822     }
2823 }
2824 
TextureSubImage1D(GLuint texture,GLint level,GLint xoffset,GLsizei width,GLenum format,GLenum type,const void * pixels)2825 void GL_APIENTRY TextureSubImage1D(GLuint texture,
2826                                    GLint level,
2827                                    GLint xoffset,
2828                                    GLsizei width,
2829                                    GLenum format,
2830                                    GLenum type,
2831                                    const void *pixels)
2832 {
2833     Context *context = GetValidGlobalContext();
2834     EVENT("glTextureSubImage1D",
2835           "context = %d, GLuint texture = %u, GLint level = %d, GLint xoffset = %d, GLsizei width "
2836           "= %d, GLenum format = %s, GLenum type = %s, const void *pixels = 0x%016" PRIxPTR "",
2837           CID(context), texture, level, xoffset, width,
2838           GLenumToString(GLenumGroup::PixelFormat, format),
2839           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
2840 
2841     if (context)
2842     {
2843         TextureID texturePacked                               = FromGL<TextureID>(texture);
2844         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2845         bool isCallValid                                      = (context->skipValidation() ||
2846                             ValidateTextureSubImage1D(context, texturePacked, level, xoffset, width,
2847                                                       format, type, pixels));
2848         if (isCallValid)
2849         {
2850             context->textureSubImage1D(texturePacked, level, xoffset, width, format, type, pixels);
2851         }
2852         ANGLE_CAPTURE(TextureSubImage1D, isCallValid, context, texturePacked, level, xoffset, width,
2853                       format, type, pixels);
2854     }
2855 }
2856 
TextureSubImage2D(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLenum type,const void * pixels)2857 void GL_APIENTRY TextureSubImage2D(GLuint texture,
2858                                    GLint level,
2859                                    GLint xoffset,
2860                                    GLint yoffset,
2861                                    GLsizei width,
2862                                    GLsizei height,
2863                                    GLenum format,
2864                                    GLenum type,
2865                                    const void *pixels)
2866 {
2867     Context *context = GetValidGlobalContext();
2868     EVENT("glTextureSubImage2D",
2869           "context = %d, GLuint texture = %u, GLint level = %d, GLint xoffset = %d, GLint yoffset "
2870           "= %d, GLsizei width = %d, GLsizei height = %d, GLenum format = %s, GLenum type = %s, "
2871           "const void *pixels = 0x%016" PRIxPTR "",
2872           CID(context), texture, level, xoffset, yoffset, width, height,
2873           GLenumToString(GLenumGroup::PixelFormat, format),
2874           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
2875 
2876     if (context)
2877     {
2878         TextureID texturePacked                               = FromGL<TextureID>(texture);
2879         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2880         bool isCallValid =
2881             (context->skipValidation() ||
2882              ValidateTextureSubImage2D(context, texturePacked, level, xoffset, yoffset, width,
2883                                        height, format, type, pixels));
2884         if (isCallValid)
2885         {
2886             context->textureSubImage2D(texturePacked, level, xoffset, yoffset, width, height,
2887                                        format, type, pixels);
2888         }
2889         ANGLE_CAPTURE(TextureSubImage2D, isCallValid, context, texturePacked, level, xoffset,
2890                       yoffset, width, height, format, type, pixels);
2891     }
2892 }
2893 
TextureSubImage3D(GLuint texture,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLenum type,const void * pixels)2894 void GL_APIENTRY TextureSubImage3D(GLuint texture,
2895                                    GLint level,
2896                                    GLint xoffset,
2897                                    GLint yoffset,
2898                                    GLint zoffset,
2899                                    GLsizei width,
2900                                    GLsizei height,
2901                                    GLsizei depth,
2902                                    GLenum format,
2903                                    GLenum type,
2904                                    const void *pixels)
2905 {
2906     Context *context = GetValidGlobalContext();
2907     EVENT("glTextureSubImage3D",
2908           "context = %d, GLuint texture = %u, GLint level = %d, GLint xoffset = %d, GLint yoffset "
2909           "= %d, GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, "
2910           "GLenum format = %s, GLenum type = %s, const void *pixels = 0x%016" PRIxPTR "",
2911           CID(context), texture, level, xoffset, yoffset, zoffset, width, height, depth,
2912           GLenumToString(GLenumGroup::PixelFormat, format),
2913           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
2914 
2915     if (context)
2916     {
2917         TextureID texturePacked                               = FromGL<TextureID>(texture);
2918         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2919         bool isCallValid =
2920             (context->skipValidation() ||
2921              ValidateTextureSubImage3D(context, texturePacked, level, xoffset, yoffset, zoffset,
2922                                        width, height, depth, format, type, pixels));
2923         if (isCallValid)
2924         {
2925             context->textureSubImage3D(texturePacked, level, xoffset, yoffset, zoffset, width,
2926                                        height, depth, format, type, pixels);
2927         }
2928         ANGLE_CAPTURE(TextureSubImage3D, isCallValid, context, texturePacked, level, xoffset,
2929                       yoffset, zoffset, width, height, depth, format, type, pixels);
2930     }
2931 }
2932 
TransformFeedbackBufferBase(GLuint xfb,GLuint index,GLuint buffer)2933 void GL_APIENTRY TransformFeedbackBufferBase(GLuint xfb, GLuint index, GLuint buffer)
2934 {
2935     Context *context = GetValidGlobalContext();
2936     EVENT("glTransformFeedbackBufferBase",
2937           "context = %d, GLuint xfb = %u, GLuint index = %u, GLuint buffer = %u", CID(context), xfb,
2938           index, buffer);
2939 
2940     if (context)
2941     {
2942         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
2943         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2944         bool isCallValid                                      = (context->skipValidation() ||
2945                             ValidateTransformFeedbackBufferBase(context, xfb, index, bufferPacked));
2946         if (isCallValid)
2947         {
2948             context->transformFeedbackBufferBase(xfb, index, bufferPacked);
2949         }
2950         ANGLE_CAPTURE(TransformFeedbackBufferBase, isCallValid, context, xfb, index, bufferPacked);
2951     }
2952 }
2953 
TransformFeedbackBufferRange(GLuint xfb,GLuint index,GLuint buffer,GLintptr offset,GLsizeiptr size)2954 void GL_APIENTRY TransformFeedbackBufferRange(GLuint xfb,
2955                                               GLuint index,
2956                                               GLuint buffer,
2957                                               GLintptr offset,
2958                                               GLsizeiptr size)
2959 {
2960     Context *context = GetValidGlobalContext();
2961     EVENT("glTransformFeedbackBufferRange",
2962           "context = %d, GLuint xfb = %u, GLuint index = %u, GLuint buffer = %u, GLintptr offset = "
2963           "%llu, GLsizeiptr size = %llu",
2964           CID(context), xfb, index, buffer, static_cast<unsigned long long>(offset),
2965           static_cast<unsigned long long>(size));
2966 
2967     if (context)
2968     {
2969         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
2970         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2971         bool isCallValid =
2972             (context->skipValidation() ||
2973              ValidateTransformFeedbackBufferRange(context, xfb, index, bufferPacked, offset, size));
2974         if (isCallValid)
2975         {
2976             context->transformFeedbackBufferRange(xfb, index, bufferPacked, offset, size);
2977         }
2978         ANGLE_CAPTURE(TransformFeedbackBufferRange, isCallValid, context, xfb, index, bufferPacked,
2979                       offset, size);
2980     }
2981 }
2982 
UnmapNamedBuffer(GLuint buffer)2983 GLboolean GL_APIENTRY UnmapNamedBuffer(GLuint buffer)
2984 {
2985     Context *context = GetValidGlobalContext();
2986     EVENT("glUnmapNamedBuffer", "context = %d, GLuint buffer = %u", CID(context), buffer);
2987 
2988     GLboolean returnValue;
2989     if (context)
2990     {
2991         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
2992         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
2993         bool isCallValid =
2994             (context->skipValidation() || ValidateUnmapNamedBuffer(context, bufferPacked));
2995         if (isCallValid)
2996         {
2997             returnValue = context->unmapNamedBuffer(bufferPacked);
2998         }
2999         else
3000         {
3001             returnValue = GetDefaultReturnValue<EntryPoint::UnmapNamedBuffer, GLboolean>();
3002         }
3003         ANGLE_CAPTURE(UnmapNamedBuffer, isCallValid, context, bufferPacked, returnValue);
3004     }
3005     else
3006     {
3007         returnValue = GetDefaultReturnValue<EntryPoint::UnmapNamedBuffer, GLboolean>();
3008     }
3009     return returnValue;
3010 }
3011 
VertexArrayAttribBinding(GLuint vaobj,GLuint attribindex,GLuint bindingindex)3012 void GL_APIENTRY VertexArrayAttribBinding(GLuint vaobj, GLuint attribindex, GLuint bindingindex)
3013 {
3014     Context *context = GetValidGlobalContext();
3015     EVENT("glVertexArrayAttribBinding",
3016           "context = %d, GLuint vaobj = %u, GLuint attribindex = %u, GLuint bindingindex = %u",
3017           CID(context), vaobj, attribindex, bindingindex);
3018 
3019     if (context)
3020     {
3021         VertexArrayID vaobjPacked                             = FromGL<VertexArrayID>(vaobj);
3022         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
3023         bool isCallValid =
3024             (context->skipValidation() ||
3025              ValidateVertexArrayAttribBinding(context, vaobjPacked, attribindex, bindingindex));
3026         if (isCallValid)
3027         {
3028             context->vertexArrayAttribBinding(vaobjPacked, attribindex, bindingindex);
3029         }
3030         ANGLE_CAPTURE(VertexArrayAttribBinding, isCallValid, context, vaobjPacked, attribindex,
3031                       bindingindex);
3032     }
3033 }
3034 
VertexArrayAttribFormat(GLuint vaobj,GLuint attribindex,GLint size,GLenum type,GLboolean normalized,GLuint relativeoffset)3035 void GL_APIENTRY VertexArrayAttribFormat(GLuint vaobj,
3036                                          GLuint attribindex,
3037                                          GLint size,
3038                                          GLenum type,
3039                                          GLboolean normalized,
3040                                          GLuint relativeoffset)
3041 {
3042     Context *context = GetValidGlobalContext();
3043     EVENT("glVertexArrayAttribFormat",
3044           "context = %d, GLuint vaobj = %u, GLuint attribindex = %u, GLint size = %d, GLenum type "
3045           "= %s, GLboolean normalized = %s, GLuint relativeoffset = %u",
3046           CID(context), vaobj, attribindex, size,
3047           GLenumToString(GLenumGroup::VertexAttribType, type), GLbooleanToString(normalized),
3048           relativeoffset);
3049 
3050     if (context)
3051     {
3052         VertexArrayID vaobjPacked                             = FromGL<VertexArrayID>(vaobj);
3053         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
3054         bool isCallValid                                      = (context->skipValidation() ||
3055                             ValidateVertexArrayAttribFormat(context, vaobjPacked, attribindex, size,
3056                                                             type, normalized, relativeoffset));
3057         if (isCallValid)
3058         {
3059             context->vertexArrayAttribFormat(vaobjPacked, attribindex, size, type, normalized,
3060                                              relativeoffset);
3061         }
3062         ANGLE_CAPTURE(VertexArrayAttribFormat, isCallValid, context, vaobjPacked, attribindex, size,
3063                       type, normalized, relativeoffset);
3064     }
3065 }
3066 
VertexArrayAttribIFormat(GLuint vaobj,GLuint attribindex,GLint size,GLenum type,GLuint relativeoffset)3067 void GL_APIENTRY VertexArrayAttribIFormat(GLuint vaobj,
3068                                           GLuint attribindex,
3069                                           GLint size,
3070                                           GLenum type,
3071                                           GLuint relativeoffset)
3072 {
3073     Context *context = GetValidGlobalContext();
3074     EVENT("glVertexArrayAttribIFormat",
3075           "context = %d, GLuint vaobj = %u, GLuint attribindex = %u, GLint size = %d, GLenum type "
3076           "= %s, GLuint relativeoffset = %u",
3077           CID(context), vaobj, attribindex, size,
3078           GLenumToString(GLenumGroup::VertexAttribType, type), relativeoffset);
3079 
3080     if (context)
3081     {
3082         VertexArrayID vaobjPacked                             = FromGL<VertexArrayID>(vaobj);
3083         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
3084         bool isCallValid                                      = (context->skipValidation() ||
3085                             ValidateVertexArrayAttribIFormat(context, vaobjPacked, attribindex,
3086                                                              size, type, relativeoffset));
3087         if (isCallValid)
3088         {
3089             context->vertexArrayAttribIFormat(vaobjPacked, attribindex, size, type, relativeoffset);
3090         }
3091         ANGLE_CAPTURE(VertexArrayAttribIFormat, isCallValid, context, vaobjPacked, attribindex,
3092                       size, type, relativeoffset);
3093     }
3094 }
3095 
VertexArrayAttribLFormat(GLuint vaobj,GLuint attribindex,GLint size,GLenum type,GLuint relativeoffset)3096 void GL_APIENTRY VertexArrayAttribLFormat(GLuint vaobj,
3097                                           GLuint attribindex,
3098                                           GLint size,
3099                                           GLenum type,
3100                                           GLuint relativeoffset)
3101 {
3102     Context *context = GetValidGlobalContext();
3103     EVENT("glVertexArrayAttribLFormat",
3104           "context = %d, GLuint vaobj = %u, GLuint attribindex = %u, GLint size = %d, GLenum type "
3105           "= %s, GLuint relativeoffset = %u",
3106           CID(context), vaobj, attribindex, size,
3107           GLenumToString(GLenumGroup::VertexAttribType, type), relativeoffset);
3108 
3109     if (context)
3110     {
3111         VertexArrayID vaobjPacked                             = FromGL<VertexArrayID>(vaobj);
3112         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
3113         bool isCallValid                                      = (context->skipValidation() ||
3114                             ValidateVertexArrayAttribLFormat(context, vaobjPacked, attribindex,
3115                                                              size, type, relativeoffset));
3116         if (isCallValid)
3117         {
3118             context->vertexArrayAttribLFormat(vaobjPacked, attribindex, size, type, relativeoffset);
3119         }
3120         ANGLE_CAPTURE(VertexArrayAttribLFormat, isCallValid, context, vaobjPacked, attribindex,
3121                       size, type, relativeoffset);
3122     }
3123 }
3124 
VertexArrayBindingDivisor(GLuint vaobj,GLuint bindingindex,GLuint divisor)3125 void GL_APIENTRY VertexArrayBindingDivisor(GLuint vaobj, GLuint bindingindex, GLuint divisor)
3126 {
3127     Context *context = GetValidGlobalContext();
3128     EVENT("glVertexArrayBindingDivisor",
3129           "context = %d, GLuint vaobj = %u, GLuint bindingindex = %u, GLuint divisor = %u",
3130           CID(context), vaobj, bindingindex, divisor);
3131 
3132     if (context)
3133     {
3134         VertexArrayID vaobjPacked                             = FromGL<VertexArrayID>(vaobj);
3135         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
3136         bool isCallValid =
3137             (context->skipValidation() ||
3138              ValidateVertexArrayBindingDivisor(context, vaobjPacked, bindingindex, divisor));
3139         if (isCallValid)
3140         {
3141             context->vertexArrayBindingDivisor(vaobjPacked, bindingindex, divisor);
3142         }
3143         ANGLE_CAPTURE(VertexArrayBindingDivisor, isCallValid, context, vaobjPacked, bindingindex,
3144                       divisor);
3145     }
3146 }
3147 
VertexArrayElementBuffer(GLuint vaobj,GLuint buffer)3148 void GL_APIENTRY VertexArrayElementBuffer(GLuint vaobj, GLuint buffer)
3149 {
3150     Context *context = GetValidGlobalContext();
3151     EVENT("glVertexArrayElementBuffer", "context = %d, GLuint vaobj = %u, GLuint buffer = %u",
3152           CID(context), vaobj, buffer);
3153 
3154     if (context)
3155     {
3156         VertexArrayID vaobjPacked                             = FromGL<VertexArrayID>(vaobj);
3157         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
3158         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
3159         bool isCallValid                                      = (context->skipValidation() ||
3160                             ValidateVertexArrayElementBuffer(context, vaobjPacked, bufferPacked));
3161         if (isCallValid)
3162         {
3163             context->vertexArrayElementBuffer(vaobjPacked, bufferPacked);
3164         }
3165         ANGLE_CAPTURE(VertexArrayElementBuffer, isCallValid, context, vaobjPacked, bufferPacked);
3166     }
3167 }
3168 
VertexArrayVertexBuffer(GLuint vaobj,GLuint bindingindex,GLuint buffer,GLintptr offset,GLsizei stride)3169 void GL_APIENTRY VertexArrayVertexBuffer(GLuint vaobj,
3170                                          GLuint bindingindex,
3171                                          GLuint buffer,
3172                                          GLintptr offset,
3173                                          GLsizei stride)
3174 {
3175     Context *context = GetValidGlobalContext();
3176     EVENT("glVertexArrayVertexBuffer",
3177           "context = %d, GLuint vaobj = %u, GLuint bindingindex = %u, GLuint buffer = %u, GLintptr "
3178           "offset = %llu, GLsizei stride = %d",
3179           CID(context), vaobj, bindingindex, buffer, static_cast<unsigned long long>(offset),
3180           stride);
3181 
3182     if (context)
3183     {
3184         VertexArrayID vaobjPacked                             = FromGL<VertexArrayID>(vaobj);
3185         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
3186         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
3187         bool isCallValid                                      = (context->skipValidation() ||
3188                             ValidateVertexArrayVertexBuffer(context, vaobjPacked, bindingindex,
3189                                                             bufferPacked, offset, stride));
3190         if (isCallValid)
3191         {
3192             context->vertexArrayVertexBuffer(vaobjPacked, bindingindex, bufferPacked, offset,
3193                                              stride);
3194         }
3195         ANGLE_CAPTURE(VertexArrayVertexBuffer, isCallValid, context, vaobjPacked, bindingindex,
3196                       bufferPacked, offset, stride);
3197     }
3198 }
3199 
VertexArrayVertexBuffers(GLuint vaobj,GLuint first,GLsizei count,const GLuint * buffers,const GLintptr * offsets,const GLsizei * strides)3200 void GL_APIENTRY VertexArrayVertexBuffers(GLuint vaobj,
3201                                           GLuint first,
3202                                           GLsizei count,
3203                                           const GLuint *buffers,
3204                                           const GLintptr *offsets,
3205                                           const GLsizei *strides)
3206 {
3207     Context *context = GetValidGlobalContext();
3208     EVENT("glVertexArrayVertexBuffers",
3209           "context = %d, GLuint vaobj = %u, GLuint first = %u, GLsizei count = %d, const GLuint "
3210           "*buffers = 0x%016" PRIxPTR ", const GLintptr *offsets = 0x%016" PRIxPTR
3211           ", const GLsizei *strides = 0x%016" PRIxPTR "",
3212           CID(context), vaobj, first, count, (uintptr_t)buffers, (uintptr_t)offsets,
3213           (uintptr_t)strides);
3214 
3215     if (context)
3216     {
3217         VertexArrayID vaobjPacked                             = FromGL<VertexArrayID>(vaobj);
3218         const BufferID *buffersPacked                         = FromGL<const BufferID *>(buffers);
3219         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
3220         bool isCallValid                                      = (context->skipValidation() ||
3221                             ValidateVertexArrayVertexBuffers(context, vaobjPacked, first, count,
3222                                                              buffersPacked, offsets, strides));
3223         if (isCallValid)
3224         {
3225             context->vertexArrayVertexBuffers(vaobjPacked, first, count, buffersPacked, offsets,
3226                                               strides);
3227         }
3228         ANGLE_CAPTURE(VertexArrayVertexBuffers, isCallValid, context, vaobjPacked, first, count,
3229                       buffersPacked, offsets, strides);
3230     }
3231 }
3232 }  // namespace gl
3233