• 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_1_1_autogen.cpp:
9 //   Defines the GL 1.1 entry points.
10 
11 #include "libGL/entry_points_gl_1_1_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/validationGL11_autogen.h"
26 #include "libGLESv2/global_state.h"
27 
28 namespace gl
29 {
AreTexturesResident(GLsizei n,const GLuint * textures,GLboolean * residences)30 GLboolean GL_APIENTRY AreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences)
31 {
32     Context *context = GetValidGlobalContext();
33     EVENT("glAreTexturesResident",
34           "context = %d, GLsizei n = %d, const GLuint *textures = 0x%016" PRIxPTR
35           ", GLboolean *residences = 0x%016" PRIxPTR "",
36           CID(context), n, (uintptr_t)textures, (uintptr_t)residences);
37 
38     GLboolean returnValue;
39     if (context)
40     {
41         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
42         bool isCallValid                                      = (context->skipValidation() ||
43                             ValidateAreTexturesResident(context, n, textures, residences));
44         if (isCallValid)
45         {
46             returnValue = context->areTexturesResident(n, textures, residences);
47         }
48         else
49         {
50             returnValue = GetDefaultReturnValue<EntryPoint::AreTexturesResident, GLboolean>();
51         }
52         ANGLE_CAPTURE(AreTexturesResident, isCallValid, context, n, textures, residences,
53                       returnValue);
54     }
55     else
56     {
57         returnValue = GetDefaultReturnValue<EntryPoint::AreTexturesResident, GLboolean>();
58     }
59     return returnValue;
60 }
61 
ArrayElement(GLint i)62 void GL_APIENTRY ArrayElement(GLint i)
63 {
64     Context *context = GetValidGlobalContext();
65     EVENT("glArrayElement", "context = %d, GLint i = %d", CID(context), i);
66 
67     if (context)
68     {
69         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
70         bool isCallValid = (context->skipValidation() || ValidateArrayElement(context, i));
71         if (isCallValid)
72         {
73             context->arrayElement(i);
74         }
75         ANGLE_CAPTURE(ArrayElement, isCallValid, context, i);
76     }
77 }
78 
BindTexture(GLenum target,GLuint texture)79 void GL_APIENTRY BindTexture(GLenum target, GLuint texture)
80 {
81     Context *context = GetValidGlobalContext();
82     EVENT("glBindTexture", "context = %d, GLenum target = %s, GLuint texture = %u", CID(context),
83           GLenumToString(GLenumGroup::TextureTarget, target), texture);
84 
85     if (context)
86     {
87         TextureType targetPacked                              = FromGL<TextureType>(target);
88         TextureID texturePacked                               = FromGL<TextureID>(texture);
89         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
90         bool isCallValid                                      = (context->skipValidation() ||
91                             ValidateBindTexture(context, targetPacked, texturePacked));
92         if (isCallValid)
93         {
94             context->bindTexture(targetPacked, texturePacked);
95         }
96         ANGLE_CAPTURE(BindTexture, isCallValid, context, targetPacked, texturePacked);
97     }
98 }
99 
ColorPointer(GLint size,GLenum type,GLsizei stride,const void * pointer)100 void GL_APIENTRY ColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
101 {
102     Context *context = GetValidGlobalContext();
103     EVENT("glColorPointer",
104           "context = %d, GLint size = %d, GLenum type = %s, GLsizei stride = %d, const void "
105           "*pointer = 0x%016" PRIxPTR "",
106           CID(context), size, GLenumToString(GLenumGroup::ColorPointerType, type), stride,
107           (uintptr_t)pointer);
108 
109     if (context)
110     {
111         VertexAttribType typePacked                           = FromGL<VertexAttribType>(type);
112         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
113         bool isCallValid                                      = (context->skipValidation() ||
114                             ValidateColorPointer(context, size, typePacked, stride, pointer));
115         if (isCallValid)
116         {
117             context->colorPointer(size, typePacked, stride, pointer);
118         }
119         ANGLE_CAPTURE(ColorPointer, isCallValid, context, size, typePacked, stride, pointer);
120     }
121 }
122 
CopyTexImage1D(GLenum target,GLint level,GLenum internalformat,GLint x,GLint y,GLsizei width,GLint border)123 void GL_APIENTRY CopyTexImage1D(GLenum target,
124                                 GLint level,
125                                 GLenum internalformat,
126                                 GLint x,
127                                 GLint y,
128                                 GLsizei width,
129                                 GLint border)
130 {
131     Context *context = GetValidGlobalContext();
132     EVENT("glCopyTexImage1D",
133           "context = %d, GLenum target = %s, GLint level = %d, GLenum internalformat = %s, GLint x "
134           "= %d, GLint y = %d, GLsizei width = %d, GLint border = %d",
135           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level,
136           GLenumToString(GLenumGroup::InternalFormat, internalformat), x, y, width, border);
137 
138     if (context)
139     {
140         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
141         bool isCallValid =
142             (context->skipValidation() ||
143              ValidateCopyTexImage1D(context, target, level, internalformat, x, y, width, border));
144         if (isCallValid)
145         {
146             context->copyTexImage1D(target, level, internalformat, x, y, width, border);
147         }
148         ANGLE_CAPTURE(CopyTexImage1D, isCallValid, context, target, level, internalformat, x, y,
149                       width, border);
150     }
151 }
152 
CopyTexImage2D(GLenum target,GLint level,GLenum internalformat,GLint x,GLint y,GLsizei width,GLsizei height,GLint border)153 void GL_APIENTRY CopyTexImage2D(GLenum target,
154                                 GLint level,
155                                 GLenum internalformat,
156                                 GLint x,
157                                 GLint y,
158                                 GLsizei width,
159                                 GLsizei height,
160                                 GLint border)
161 {
162     Context *context = GetValidGlobalContext();
163     EVENT("glCopyTexImage2D",
164           "context = %d, GLenum target = %s, GLint level = %d, GLenum internalformat = %s, GLint x "
165           "= %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLint border = %d",
166           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level,
167           GLenumToString(GLenumGroup::InternalFormat, internalformat), x, y, width, height, border);
168 
169     if (context)
170     {
171         TextureTarget targetPacked                            = FromGL<TextureTarget>(target);
172         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
173         bool isCallValid                                      = (context->skipValidation() ||
174                             ValidateCopyTexImage2D(context, targetPacked, level, internalformat, x,
175                                                    y, width, height, border));
176         if (isCallValid)
177         {
178             context->copyTexImage2D(targetPacked, level, internalformat, x, y, width, height,
179                                     border);
180         }
181         ANGLE_CAPTURE(CopyTexImage2D, isCallValid, context, targetPacked, level, internalformat, x,
182                       y, width, height, border);
183     }
184 }
185 
186 void GL_APIENTRY
CopyTexSubImage1D(GLenum target,GLint level,GLint xoffset,GLint x,GLint y,GLsizei width)187 CopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
188 {
189     Context *context = GetValidGlobalContext();
190     EVENT("glCopyTexSubImage1D",
191           "context = %d, GLenum target = %s, GLint level = %d, GLint xoffset = %d, GLint x = %d, "
192           "GLint y = %d, GLsizei width = %d",
193           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, xoffset, x, y,
194           width);
195 
196     if (context)
197     {
198         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
199         bool isCallValid =
200             (context->skipValidation() ||
201              ValidateCopyTexSubImage1D(context, target, level, xoffset, x, y, width));
202         if (isCallValid)
203         {
204             context->copyTexSubImage1D(target, level, xoffset, x, y, width);
205         }
206         ANGLE_CAPTURE(CopyTexSubImage1D, isCallValid, context, target, level, xoffset, x, y, width);
207     }
208 }
209 
CopyTexSubImage2D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint x,GLint y,GLsizei width,GLsizei height)210 void GL_APIENTRY CopyTexSubImage2D(GLenum target,
211                                    GLint level,
212                                    GLint xoffset,
213                                    GLint yoffset,
214                                    GLint x,
215                                    GLint y,
216                                    GLsizei width,
217                                    GLsizei height)
218 {
219     Context *context = GetValidGlobalContext();
220     EVENT("glCopyTexSubImage2D",
221           "context = %d, GLenum target = %s, GLint level = %d, GLint xoffset = %d, GLint yoffset = "
222           "%d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d",
223           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, xoffset, yoffset,
224           x, y, width, height);
225 
226     if (context)
227     {
228         TextureTarget targetPacked                            = FromGL<TextureTarget>(target);
229         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
230         bool isCallValid                                      = (context->skipValidation() ||
231                             ValidateCopyTexSubImage2D(context, targetPacked, level, xoffset,
232                                                       yoffset, x, y, width, height));
233         if (isCallValid)
234         {
235             context->copyTexSubImage2D(targetPacked, level, xoffset, yoffset, x, y, width, height);
236         }
237         ANGLE_CAPTURE(CopyTexSubImage2D, isCallValid, context, targetPacked, level, xoffset,
238                       yoffset, x, y, width, height);
239     }
240 }
241 
DeleteTextures(GLsizei n,const GLuint * textures)242 void GL_APIENTRY DeleteTextures(GLsizei n, const GLuint *textures)
243 {
244     Context *context = GetValidGlobalContext();
245     EVENT("glDeleteTextures",
246           "context = %d, GLsizei n = %d, const GLuint *textures = 0x%016" PRIxPTR "", CID(context),
247           n, (uintptr_t)textures);
248 
249     if (context)
250     {
251         const TextureID *texturesPacked                       = FromGL<const TextureID *>(textures);
252         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
253         bool isCallValid =
254             (context->skipValidation() || ValidateDeleteTextures(context, n, texturesPacked));
255         if (isCallValid)
256         {
257             context->deleteTextures(n, texturesPacked);
258         }
259         ANGLE_CAPTURE(DeleteTextures, isCallValid, context, n, texturesPacked);
260     }
261 }
262 
DisableClientState(GLenum array)263 void GL_APIENTRY DisableClientState(GLenum array)
264 {
265     Context *context = GetValidGlobalContext();
266     EVENT("glDisableClientState", "context = %d, GLenum array = %s", CID(context),
267           GLenumToString(GLenumGroup::EnableCap, array));
268 
269     if (context)
270     {
271         ClientVertexArrayType arrayPacked = FromGL<ClientVertexArrayType>(array);
272         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
273         bool isCallValid =
274             (context->skipValidation() || ValidateDisableClientState(context, arrayPacked));
275         if (isCallValid)
276         {
277             context->disableClientState(arrayPacked);
278         }
279         ANGLE_CAPTURE(DisableClientState, isCallValid, context, arrayPacked);
280     }
281 }
282 
DrawArrays(GLenum mode,GLint first,GLsizei count)283 void GL_APIENTRY DrawArrays(GLenum mode, GLint first, GLsizei count)
284 {
285     Context *context = GetValidGlobalContext();
286     EVENT("glDrawArrays", "context = %d, GLenum mode = %s, GLint first = %d, GLsizei count = %d",
287           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), first, count);
288 
289     if (context)
290     {
291         PrimitiveMode modePacked                              = FromGL<PrimitiveMode>(mode);
292         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
293         bool isCallValid =
294             (context->skipValidation() || ValidateDrawArrays(context, modePacked, first, count));
295         if (isCallValid)
296         {
297             context->drawArrays(modePacked, first, count);
298         }
299         ANGLE_CAPTURE(DrawArrays, isCallValid, context, modePacked, first, count);
300     }
301 }
302 
DrawElements(GLenum mode,GLsizei count,GLenum type,const void * indices)303 void GL_APIENTRY DrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices)
304 {
305     Context *context = GetValidGlobalContext();
306     EVENT("glDrawElements",
307           "context = %d, GLenum mode = %s, GLsizei count = %d, GLenum type = %s, const void "
308           "*indices = 0x%016" PRIxPTR "",
309           CID(context), GLenumToString(GLenumGroup::PrimitiveType, mode), count,
310           GLenumToString(GLenumGroup::DrawElementsType, type), (uintptr_t)indices);
311 
312     if (context)
313     {
314         PrimitiveMode modePacked                              = FromGL<PrimitiveMode>(mode);
315         DrawElementsType typePacked                           = FromGL<DrawElementsType>(type);
316         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
317         bool isCallValid                                      = (context->skipValidation() ||
318                             ValidateDrawElements(context, modePacked, count, typePacked, indices));
319         if (isCallValid)
320         {
321             context->drawElements(modePacked, count, typePacked, indices);
322         }
323         ANGLE_CAPTURE(DrawElements, isCallValid, context, modePacked, count, typePacked, indices);
324     }
325 }
326 
EdgeFlagPointer(GLsizei stride,const void * pointer)327 void GL_APIENTRY EdgeFlagPointer(GLsizei stride, const void *pointer)
328 {
329     Context *context = GetValidGlobalContext();
330     EVENT("glEdgeFlagPointer",
331           "context = %d, GLsizei stride = %d, const void *pointer = 0x%016" PRIxPTR "",
332           CID(context), stride, (uintptr_t)pointer);
333 
334     if (context)
335     {
336         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
337         bool isCallValid =
338             (context->skipValidation() || ValidateEdgeFlagPointer(context, stride, pointer));
339         if (isCallValid)
340         {
341             context->edgeFlagPointer(stride, pointer);
342         }
343         ANGLE_CAPTURE(EdgeFlagPointer, isCallValid, context, stride, pointer);
344     }
345 }
346 
EnableClientState(GLenum array)347 void GL_APIENTRY EnableClientState(GLenum array)
348 {
349     Context *context = GetValidGlobalContext();
350     EVENT("glEnableClientState", "context = %d, GLenum array = %s", CID(context),
351           GLenumToString(GLenumGroup::EnableCap, array));
352 
353     if (context)
354     {
355         ClientVertexArrayType arrayPacked = FromGL<ClientVertexArrayType>(array);
356         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
357         bool isCallValid =
358             (context->skipValidation() || ValidateEnableClientState(context, arrayPacked));
359         if (isCallValid)
360         {
361             context->enableClientState(arrayPacked);
362         }
363         ANGLE_CAPTURE(EnableClientState, isCallValid, context, arrayPacked);
364     }
365 }
366 
GenTextures(GLsizei n,GLuint * textures)367 void GL_APIENTRY GenTextures(GLsizei n, GLuint *textures)
368 {
369     Context *context = GetValidGlobalContext();
370     EVENT("glGenTextures", "context = %d, GLsizei n = %d, GLuint *textures = 0x%016" PRIxPTR "",
371           CID(context), n, (uintptr_t)textures);
372 
373     if (context)
374     {
375         TextureID *texturesPacked                             = FromGL<TextureID *>(textures);
376         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
377         bool isCallValid =
378             (context->skipValidation() || ValidateGenTextures(context, n, texturesPacked));
379         if (isCallValid)
380         {
381             context->genTextures(n, texturesPacked);
382         }
383         ANGLE_CAPTURE(GenTextures, isCallValid, context, n, texturesPacked);
384     }
385 }
386 
GetPointerv(GLenum pname,void ** params)387 void GL_APIENTRY GetPointerv(GLenum pname, void **params)
388 {
389     Context *context = GetValidGlobalContext();
390     EVENT("glGetPointerv", "context = %d, GLenum pname = %s, void **params = 0x%016" PRIxPTR "",
391           CID(context), GLenumToString(GLenumGroup::GetPointervPName, pname), (uintptr_t)params);
392 
393     if (context)
394     {
395         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
396         bool isCallValid =
397             (context->skipValidation() || ValidateGetPointerv(context, pname, params));
398         if (isCallValid)
399         {
400             context->getPointerv(pname, params);
401         }
402         ANGLE_CAPTURE(GetPointerv, isCallValid, context, pname, params);
403     }
404 }
405 
IndexPointer(GLenum type,GLsizei stride,const void * pointer)406 void GL_APIENTRY IndexPointer(GLenum type, GLsizei stride, const void *pointer)
407 {
408     Context *context = GetValidGlobalContext();
409     EVENT(
410         "glIndexPointer",
411         "context = %d, GLenum type = %s, GLsizei stride = %d, const void *pointer = 0x%016" PRIxPTR
412         "",
413         CID(context), GLenumToString(GLenumGroup::IndexPointerType, type), stride,
414         (uintptr_t)pointer);
415 
416     if (context)
417     {
418         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
419         bool isCallValid =
420             (context->skipValidation() || ValidateIndexPointer(context, type, stride, pointer));
421         if (isCallValid)
422         {
423             context->indexPointer(type, stride, pointer);
424         }
425         ANGLE_CAPTURE(IndexPointer, isCallValid, context, type, stride, pointer);
426     }
427 }
428 
Indexub(GLubyte c)429 void GL_APIENTRY Indexub(GLubyte c)
430 {
431     Context *context = GetValidGlobalContext();
432     EVENT("glIndexub", "context = %d, GLubyte c = %d", CID(context), c);
433 
434     if (context)
435     {
436         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
437         bool isCallValid = (context->skipValidation() || ValidateIndexub(context, c));
438         if (isCallValid)
439         {
440             context->indexub(c);
441         }
442         ANGLE_CAPTURE(Indexub, isCallValid, context, c);
443     }
444 }
445 
Indexubv(const GLubyte * c)446 void GL_APIENTRY Indexubv(const GLubyte *c)
447 {
448     Context *context = GetValidGlobalContext();
449     EVENT("glIndexubv", "context = %d, const GLubyte *c = 0x%016" PRIxPTR "", CID(context),
450           (uintptr_t)c);
451 
452     if (context)
453     {
454         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
455         bool isCallValid = (context->skipValidation() || ValidateIndexubv(context, c));
456         if (isCallValid)
457         {
458             context->indexubv(c);
459         }
460         ANGLE_CAPTURE(Indexubv, isCallValid, context, c);
461     }
462 }
463 
InterleavedArrays(GLenum format,GLsizei stride,const void * pointer)464 void GL_APIENTRY InterleavedArrays(GLenum format, GLsizei stride, const void *pointer)
465 {
466     Context *context = GetValidGlobalContext();
467     EVENT("glInterleavedArrays",
468           "context = %d, GLenum format = %s, GLsizei stride = %d, const void *pointer = "
469           "0x%016" PRIxPTR "",
470           CID(context), GLenumToString(GLenumGroup::InterleavedArrayFormat, format), stride,
471           (uintptr_t)pointer);
472 
473     if (context)
474     {
475         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
476         bool isCallValid                                      = (context->skipValidation() ||
477                             ValidateInterleavedArrays(context, format, stride, pointer));
478         if (isCallValid)
479         {
480             context->interleavedArrays(format, stride, pointer);
481         }
482         ANGLE_CAPTURE(InterleavedArrays, isCallValid, context, format, stride, pointer);
483     }
484 }
485 
IsTexture(GLuint texture)486 GLboolean GL_APIENTRY IsTexture(GLuint texture)
487 {
488     Context *context = GetValidGlobalContext();
489     EVENT("glIsTexture", "context = %d, GLuint texture = %u", CID(context), texture);
490 
491     GLboolean returnValue;
492     if (context)
493     {
494         TextureID texturePacked                               = FromGL<TextureID>(texture);
495         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
496         bool isCallValid = (context->skipValidation() || ValidateIsTexture(context, texturePacked));
497         if (isCallValid)
498         {
499             returnValue = context->isTexture(texturePacked);
500         }
501         else
502         {
503             returnValue = GetDefaultReturnValue<EntryPoint::IsTexture, GLboolean>();
504         }
505         ANGLE_CAPTURE(IsTexture, isCallValid, context, texturePacked, returnValue);
506     }
507     else
508     {
509         returnValue = GetDefaultReturnValue<EntryPoint::IsTexture, GLboolean>();
510     }
511     return returnValue;
512 }
513 
NormalPointer(GLenum type,GLsizei stride,const void * pointer)514 void GL_APIENTRY NormalPointer(GLenum type, GLsizei stride, const void *pointer)
515 {
516     Context *context = GetValidGlobalContext();
517     EVENT(
518         "glNormalPointer",
519         "context = %d, GLenum type = %s, GLsizei stride = %d, const void *pointer = 0x%016" PRIxPTR
520         "",
521         CID(context), GLenumToString(GLenumGroup::NormalPointerType, type), stride,
522         (uintptr_t)pointer);
523 
524     if (context)
525     {
526         VertexAttribType typePacked                           = FromGL<VertexAttribType>(type);
527         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
528         bool isCallValid                                      = (context->skipValidation() ||
529                             ValidateNormalPointer(context, typePacked, stride, pointer));
530         if (isCallValid)
531         {
532             context->normalPointer(typePacked, stride, pointer);
533         }
534         ANGLE_CAPTURE(NormalPointer, isCallValid, context, typePacked, stride, pointer);
535     }
536 }
537 
PolygonOffset(GLfloat factor,GLfloat units)538 void GL_APIENTRY PolygonOffset(GLfloat factor, GLfloat units)
539 {
540     Context *context = GetValidGlobalContext();
541     EVENT("glPolygonOffset", "context = %d, GLfloat factor = %f, GLfloat units = %f", CID(context),
542           factor, units);
543 
544     if (context)
545     {
546         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
547         bool isCallValid =
548             (context->skipValidation() || ValidatePolygonOffset(context, factor, units));
549         if (isCallValid)
550         {
551             context->polygonOffset(factor, units);
552         }
553         ANGLE_CAPTURE(PolygonOffset, isCallValid, context, factor, units);
554     }
555 }
556 
PopClientAttrib()557 void GL_APIENTRY PopClientAttrib()
558 {
559     Context *context = GetValidGlobalContext();
560     EVENT("glPopClientAttrib", "context = %d", CID(context));
561 
562     if (context)
563     {
564         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
565         bool isCallValid = (context->skipValidation() || ValidatePopClientAttrib(context));
566         if (isCallValid)
567         {
568             context->popClientAttrib();
569         }
570         ANGLE_CAPTURE(PopClientAttrib, isCallValid, context);
571     }
572 }
573 
PrioritizeTextures(GLsizei n,const GLuint * textures,const GLfloat * priorities)574 void GL_APIENTRY PrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities)
575 {
576     Context *context = GetValidGlobalContext();
577     EVENT("glPrioritizeTextures",
578           "context = %d, GLsizei n = %d, const GLuint *textures = 0x%016" PRIxPTR
579           ", const GLfloat *priorities = 0x%016" PRIxPTR "",
580           CID(context), n, (uintptr_t)textures, (uintptr_t)priorities);
581 
582     if (context)
583     {
584         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
585         bool isCallValid                                      = (context->skipValidation() ||
586                             ValidatePrioritizeTextures(context, n, textures, priorities));
587         if (isCallValid)
588         {
589             context->prioritizeTextures(n, textures, priorities);
590         }
591         ANGLE_CAPTURE(PrioritizeTextures, isCallValid, context, n, textures, priorities);
592     }
593 }
594 
PushClientAttrib(GLbitfield mask)595 void GL_APIENTRY PushClientAttrib(GLbitfield mask)
596 {
597     Context *context = GetValidGlobalContext();
598     EVENT("glPushClientAttrib", "context = %d, GLbitfield mask = %s", CID(context),
599           GLbitfieldToString(GLenumGroup::ClientAttribMask, mask).c_str());
600 
601     if (context)
602     {
603         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
604         bool isCallValid = (context->skipValidation() || ValidatePushClientAttrib(context, mask));
605         if (isCallValid)
606         {
607             context->pushClientAttrib(mask);
608         }
609         ANGLE_CAPTURE(PushClientAttrib, isCallValid, context, mask);
610     }
611 }
612 
TexCoordPointer(GLint size,GLenum type,GLsizei stride,const void * pointer)613 void GL_APIENTRY TexCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
614 {
615     Context *context = GetValidGlobalContext();
616     EVENT("glTexCoordPointer",
617           "context = %d, GLint size = %d, GLenum type = %s, GLsizei stride = %d, const void "
618           "*pointer = 0x%016" PRIxPTR "",
619           CID(context), size, GLenumToString(GLenumGroup::TexCoordPointerType, type), stride,
620           (uintptr_t)pointer);
621 
622     if (context)
623     {
624         VertexAttribType typePacked                           = FromGL<VertexAttribType>(type);
625         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
626         bool isCallValid                                      = (context->skipValidation() ||
627                             ValidateTexCoordPointer(context, size, typePacked, stride, pointer));
628         if (isCallValid)
629         {
630             context->texCoordPointer(size, typePacked, stride, pointer);
631         }
632         ANGLE_CAPTURE(TexCoordPointer, isCallValid, context, size, typePacked, stride, pointer);
633     }
634 }
635 
TexSubImage1D(GLenum target,GLint level,GLint xoffset,GLsizei width,GLenum format,GLenum type,const void * pixels)636 void GL_APIENTRY TexSubImage1D(GLenum target,
637                                GLint level,
638                                GLint xoffset,
639                                GLsizei width,
640                                GLenum format,
641                                GLenum type,
642                                const void *pixels)
643 {
644     Context *context = GetValidGlobalContext();
645     EVENT("glTexSubImage1D",
646           "context = %d, GLenum target = %s, GLint level = %d, GLint xoffset = %d, GLsizei width = "
647           "%d, GLenum format = %s, GLenum type = %s, const void *pixels = 0x%016" PRIxPTR "",
648           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, xoffset, width,
649           GLenumToString(GLenumGroup::PixelFormat, format),
650           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
651 
652     if (context)
653     {
654         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
655         bool isCallValid =
656             (context->skipValidation() ||
657              ValidateTexSubImage1D(context, target, level, xoffset, width, format, type, pixels));
658         if (isCallValid)
659         {
660             context->texSubImage1D(target, level, xoffset, width, format, type, pixels);
661         }
662         ANGLE_CAPTURE(TexSubImage1D, isCallValid, context, target, level, xoffset, width, format,
663                       type, pixels);
664     }
665 }
666 
TexSubImage2D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLenum type,const void * pixels)667 void GL_APIENTRY TexSubImage2D(GLenum target,
668                                GLint level,
669                                GLint xoffset,
670                                GLint yoffset,
671                                GLsizei width,
672                                GLsizei height,
673                                GLenum format,
674                                GLenum type,
675                                const void *pixels)
676 {
677     Context *context = GetValidGlobalContext();
678     EVENT("glTexSubImage2D",
679           "context = %d, GLenum target = %s, GLint level = %d, GLint xoffset = %d, GLint yoffset = "
680           "%d, GLsizei width = %d, GLsizei height = %d, GLenum format = %s, GLenum type = %s, "
681           "const void *pixels = 0x%016" PRIxPTR "",
682           CID(context), GLenumToString(GLenumGroup::TextureTarget, target), level, xoffset, yoffset,
683           width, height, GLenumToString(GLenumGroup::PixelFormat, format),
684           GLenumToString(GLenumGroup::PixelType, type), (uintptr_t)pixels);
685 
686     if (context)
687     {
688         TextureTarget targetPacked                            = FromGL<TextureTarget>(target);
689         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
690         bool isCallValid                                      = (context->skipValidation() ||
691                             ValidateTexSubImage2D(context, targetPacked, level, xoffset, yoffset,
692                                                   width, height, format, type, pixels));
693         if (isCallValid)
694         {
695             context->texSubImage2D(targetPacked, level, xoffset, yoffset, width, height, format,
696                                    type, pixels);
697         }
698         ANGLE_CAPTURE(TexSubImage2D, isCallValid, context, targetPacked, level, xoffset, yoffset,
699                       width, height, format, type, pixels);
700     }
701 }
702 
VertexPointer(GLint size,GLenum type,GLsizei stride,const void * pointer)703 void GL_APIENTRY VertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
704 {
705     Context *context = GetValidGlobalContext();
706     EVENT("glVertexPointer",
707           "context = %d, GLint size = %d, GLenum type = %s, GLsizei stride = %d, const void "
708           "*pointer = 0x%016" PRIxPTR "",
709           CID(context), size, GLenumToString(GLenumGroup::VertexPointerType, type), stride,
710           (uintptr_t)pointer);
711 
712     if (context)
713     {
714         VertexAttribType typePacked                           = FromGL<VertexAttribType>(type);
715         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
716         bool isCallValid                                      = (context->skipValidation() ||
717                             ValidateVertexPointer(context, size, typePacked, stride, pointer));
718         if (isCallValid)
719         {
720             context->vertexPointer(size, typePacked, stride, pointer);
721         }
722         ANGLE_CAPTURE(VertexPointer, isCallValid, context, size, typePacked, stride, pointer);
723     }
724 }
725 }  // namespace gl
726