tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

entry_points_gles_2_0_autogen.cpp (139852B)


      1 // GENERATED FILE - DO NOT EDIT.
      2 // Generated by generate_entry_points.py using data from gl.xml.
      3 //
      4 // Copyright 2020 The ANGLE Project Authors. All rights reserved.
      5 // Use of this source code is governed by a BSD-style license that can be
      6 // found in the LICENSE file.
      7 //
      8 // entry_points_gles_2_0_autogen.cpp:
      9 //   Defines the GLES 2.0 entry points.
     10 
     11 #include "libGLESv2/entry_points_gles_2_0_autogen.h"
     12 
     13 #include "common/entry_points_enum_autogen.h"
     14 #include "libANGLE/Context.h"
     15 #include "libANGLE/Context.inl.h"
     16 #include "libANGLE/capture/capture_gles_2_0_autogen.h"
     17 #include "libANGLE/capture/gl_enum_utils.h"
     18 #include "libANGLE/entry_points_utils.h"
     19 #include "libANGLE/validationES2.h"
     20 #include "libGLESv2/global_state.h"
     21 
     22 using namespace gl;
     23 
     24 extern "C" {
     25 void GL_APIENTRY GL_ActiveTexture(GLenum texture)
     26 {
     27    Context *context = GetValidGlobalContext();
     28    EVENT(context, GLActiveTexture, "context = %d, texture = %s", CID(context),
     29          GLenumToString(GLESEnum::TextureUnit, texture));
     30 
     31    if (context)
     32    {
     33        SCOPED_SHARE_CONTEXT_LOCK(context);
     34        bool isCallValid =
     35            (context->skipValidation() ||
     36             ValidateActiveTexture(context, angle::EntryPoint::GLActiveTexture, texture));
     37        if (isCallValid)
     38        {
     39            context->activeTexture(texture);
     40        }
     41        ANGLE_CAPTURE_GL(ActiveTexture, isCallValid, context, texture);
     42    }
     43    else
     44    {
     45        GenerateContextLostErrorOnCurrentGlobalContext();
     46    }
     47 }
     48 
     49 void GL_APIENTRY GL_AttachShader(GLuint program, GLuint shader)
     50 {
     51    Context *context = GetValidGlobalContext();
     52    EVENT(context, GLAttachShader, "context = %d, program = %u, shader = %u", CID(context), program,
     53          shader);
     54 
     55    if (context)
     56    {
     57        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
     58        ShaderProgramID shaderPacked  = PackParam<ShaderProgramID>(shader);
     59        SCOPED_SHARE_CONTEXT_LOCK(context);
     60        bool isCallValid = (context->skipValidation() ||
     61                            ValidateAttachShader(context, angle::EntryPoint::GLAttachShader,
     62                                                 programPacked, shaderPacked));
     63        if (isCallValid)
     64        {
     65            context->attachShader(programPacked, shaderPacked);
     66        }
     67        ANGLE_CAPTURE_GL(AttachShader, isCallValid, context, programPacked, shaderPacked);
     68    }
     69    else
     70    {
     71        GenerateContextLostErrorOnCurrentGlobalContext();
     72    }
     73 }
     74 
     75 void GL_APIENTRY GL_BindAttribLocation(GLuint program, GLuint index, const GLchar *name)
     76 {
     77    Context *context = GetValidGlobalContext();
     78    EVENT(context, GLBindAttribLocation,
     79          "context = %d, program = %u, index = %u, name = 0x%016" PRIxPTR "", CID(context), program,
     80          index, (uintptr_t)name);
     81 
     82    if (context)
     83    {
     84        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
     85        SCOPED_SHARE_CONTEXT_LOCK(context);
     86        bool isCallValid =
     87            (context->skipValidation() ||
     88             ValidateBindAttribLocation(context, angle::EntryPoint::GLBindAttribLocation,
     89                                        programPacked, index, name));
     90        if (isCallValid)
     91        {
     92            context->bindAttribLocation(programPacked, index, name);
     93        }
     94        ANGLE_CAPTURE_GL(BindAttribLocation, isCallValid, context, programPacked, index, name);
     95    }
     96    else
     97    {
     98        GenerateContextLostErrorOnCurrentGlobalContext();
     99    }
    100 }
    101 
    102 void GL_APIENTRY GL_BindBuffer(GLenum target, GLuint buffer)
    103 {
    104    Context *context = GetValidGlobalContext();
    105    EVENT(context, GLBindBuffer, "context = %d, target = %s, buffer = %u", CID(context),
    106          GLenumToString(GLESEnum::BufferTargetARB, target), buffer);
    107 
    108    if (context)
    109    {
    110        BufferBinding targetPacked = PackParam<BufferBinding>(target);
    111        BufferID bufferPacked      = PackParam<BufferID>(buffer);
    112        SCOPED_SHARE_CONTEXT_LOCK(context);
    113        bool isCallValid = (context->skipValidation() ||
    114                            ValidateBindBuffer(context, angle::EntryPoint::GLBindBuffer,
    115                                               targetPacked, bufferPacked));
    116        if (isCallValid)
    117        {
    118            context->bindBuffer(targetPacked, bufferPacked);
    119        }
    120        ANGLE_CAPTURE_GL(BindBuffer, isCallValid, context, targetPacked, bufferPacked);
    121    }
    122    else
    123    {
    124        GenerateContextLostErrorOnCurrentGlobalContext();
    125    }
    126 }
    127 
    128 void GL_APIENTRY GL_BindFramebuffer(GLenum target, GLuint framebuffer)
    129 {
    130    Context *context = GetValidGlobalContext();
    131    EVENT(context, GLBindFramebuffer, "context = %d, target = %s, framebuffer = %u", CID(context),
    132          GLenumToString(GLESEnum::FramebufferTarget, target), framebuffer);
    133 
    134    if (context)
    135    {
    136        FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
    137        SCOPED_SHARE_CONTEXT_LOCK(context);
    138        bool isCallValid = (context->skipValidation() ||
    139                            ValidateBindFramebuffer(context, angle::EntryPoint::GLBindFramebuffer,
    140                                                    target, framebufferPacked));
    141        if (isCallValid)
    142        {
    143            context->bindFramebuffer(target, framebufferPacked);
    144        }
    145        ANGLE_CAPTURE_GL(BindFramebuffer, isCallValid, context, target, framebufferPacked);
    146    }
    147    else
    148    {
    149        GenerateContextLostErrorOnCurrentGlobalContext();
    150    }
    151 }
    152 
    153 void GL_APIENTRY GL_BindRenderbuffer(GLenum target, GLuint renderbuffer)
    154 {
    155    Context *context = GetValidGlobalContext();
    156    EVENT(context, GLBindRenderbuffer, "context = %d, target = %s, renderbuffer = %u", CID(context),
    157          GLenumToString(GLESEnum::RenderbufferTarget, target), renderbuffer);
    158 
    159    if (context)
    160    {
    161        RenderbufferID renderbufferPacked = PackParam<RenderbufferID>(renderbuffer);
    162        SCOPED_SHARE_CONTEXT_LOCK(context);
    163        bool isCallValid = (context->skipValidation() ||
    164                            ValidateBindRenderbuffer(context, angle::EntryPoint::GLBindRenderbuffer,
    165                                                     target, renderbufferPacked));
    166        if (isCallValid)
    167        {
    168            context->bindRenderbuffer(target, renderbufferPacked);
    169        }
    170        ANGLE_CAPTURE_GL(BindRenderbuffer, isCallValid, context, target, renderbufferPacked);
    171    }
    172    else
    173    {
    174        GenerateContextLostErrorOnCurrentGlobalContext();
    175    }
    176 }
    177 
    178 void GL_APIENTRY GL_BindTexture(GLenum target, GLuint texture)
    179 {
    180    Context *context = GetValidGlobalContext();
    181    EVENT(context, GLBindTexture, "context = %d, target = %s, texture = %u", CID(context),
    182          GLenumToString(GLESEnum::TextureTarget, target), texture);
    183 
    184    if (context)
    185    {
    186        TextureType targetPacked = PackParam<TextureType>(target);
    187        TextureID texturePacked  = PackParam<TextureID>(texture);
    188        SCOPED_SHARE_CONTEXT_LOCK(context);
    189        bool isCallValid = (context->skipValidation() ||
    190                            ValidateBindTexture(context, angle::EntryPoint::GLBindTexture,
    191                                                targetPacked, texturePacked));
    192        if (isCallValid)
    193        {
    194            context->bindTexture(targetPacked, texturePacked);
    195        }
    196        ANGLE_CAPTURE_GL(BindTexture, isCallValid, context, targetPacked, texturePacked);
    197    }
    198    else
    199    {
    200        GenerateContextLostErrorOnCurrentGlobalContext();
    201    }
    202 }
    203 
    204 void GL_APIENTRY GL_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
    205 {
    206    Context *context = GetValidGlobalContext();
    207    EVENT(context, GLBlendColor, "context = %d, red = %f, green = %f, blue = %f, alpha = %f",
    208          CID(context), red, green, blue, alpha);
    209 
    210    if (context)
    211    {
    212        SCOPED_SHARE_CONTEXT_LOCK(context);
    213        bool isCallValid =
    214            (context->skipValidation() ||
    215             ValidateBlendColor(context, angle::EntryPoint::GLBlendColor, red, green, blue, alpha));
    216        if (isCallValid)
    217        {
    218            context->blendColor(red, green, blue, alpha);
    219        }
    220        ANGLE_CAPTURE_GL(BlendColor, isCallValid, context, red, green, blue, alpha);
    221    }
    222    else
    223    {
    224        GenerateContextLostErrorOnCurrentGlobalContext();
    225    }
    226 }
    227 
    228 void GL_APIENTRY GL_BlendEquation(GLenum mode)
    229 {
    230    Context *context = GetValidGlobalContext();
    231    EVENT(context, GLBlendEquation, "context = %d, mode = %s", CID(context),
    232          GLenumToString(GLESEnum::BlendEquationModeEXT, mode));
    233 
    234    if (context)
    235    {
    236        SCOPED_SHARE_CONTEXT_LOCK(context);
    237        bool isCallValid =
    238            (context->skipValidation() ||
    239             ValidateBlendEquation(context, angle::EntryPoint::GLBlendEquation, mode));
    240        if (isCallValid)
    241        {
    242            context->blendEquation(mode);
    243        }
    244        ANGLE_CAPTURE_GL(BlendEquation, isCallValid, context, mode);
    245    }
    246    else
    247    {
    248        GenerateContextLostErrorOnCurrentGlobalContext();
    249    }
    250 }
    251 
    252 void GL_APIENTRY GL_BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
    253 {
    254    Context *context = GetValidGlobalContext();
    255    EVENT(context, GLBlendEquationSeparate, "context = %d, modeRGB = %s, modeAlpha = %s",
    256          CID(context), GLenumToString(GLESEnum::BlendEquationModeEXT, modeRGB),
    257          GLenumToString(GLESEnum::BlendEquationModeEXT, modeAlpha));
    258 
    259    if (context)
    260    {
    261        SCOPED_SHARE_CONTEXT_LOCK(context);
    262        bool isCallValid =
    263            (context->skipValidation() ||
    264             ValidateBlendEquationSeparate(context, angle::EntryPoint::GLBlendEquationSeparate,
    265                                           modeRGB, modeAlpha));
    266        if (isCallValid)
    267        {
    268            context->blendEquationSeparate(modeRGB, modeAlpha);
    269        }
    270        ANGLE_CAPTURE_GL(BlendEquationSeparate, isCallValid, context, modeRGB, modeAlpha);
    271    }
    272    else
    273    {
    274        GenerateContextLostErrorOnCurrentGlobalContext();
    275    }
    276 }
    277 
    278 void GL_APIENTRY GL_BlendFunc(GLenum sfactor, GLenum dfactor)
    279 {
    280    Context *context = GetValidGlobalContext();
    281    EVENT(context, GLBlendFunc, "context = %d, sfactor = %s, dfactor = %s", CID(context),
    282          GLenumToString(GLESEnum::BlendingFactor, sfactor),
    283          GLenumToString(GLESEnum::BlendingFactor, dfactor));
    284 
    285    if (context)
    286    {
    287        SCOPED_SHARE_CONTEXT_LOCK(context);
    288        bool isCallValid =
    289            (context->skipValidation() ||
    290             ValidateBlendFunc(context, angle::EntryPoint::GLBlendFunc, sfactor, dfactor));
    291        if (isCallValid)
    292        {
    293            context->blendFunc(sfactor, dfactor);
    294        }
    295        ANGLE_CAPTURE_GL(BlendFunc, isCallValid, context, sfactor, dfactor);
    296    }
    297    else
    298    {
    299        GenerateContextLostErrorOnCurrentGlobalContext();
    300    }
    301 }
    302 
    303 void GL_APIENTRY GL_BlendFuncSeparate(GLenum sfactorRGB,
    304                                      GLenum dfactorRGB,
    305                                      GLenum sfactorAlpha,
    306                                      GLenum dfactorAlpha)
    307 {
    308    Context *context = GetValidGlobalContext();
    309    EVENT(context, GLBlendFuncSeparate,
    310          "context = %d, sfactorRGB = %s, dfactorRGB = %s, sfactorAlpha = %s, dfactorAlpha = %s",
    311          CID(context), GLenumToString(GLESEnum::BlendingFactor, sfactorRGB),
    312          GLenumToString(GLESEnum::BlendingFactor, dfactorRGB),
    313          GLenumToString(GLESEnum::BlendingFactor, sfactorAlpha),
    314          GLenumToString(GLESEnum::BlendingFactor, dfactorAlpha));
    315 
    316    if (context)
    317    {
    318        SCOPED_SHARE_CONTEXT_LOCK(context);
    319        bool isCallValid =
    320            (context->skipValidation() ||
    321             ValidateBlendFuncSeparate(context, angle::EntryPoint::GLBlendFuncSeparate, sfactorRGB,
    322                                       dfactorRGB, sfactorAlpha, dfactorAlpha));
    323        if (isCallValid)
    324        {
    325            context->blendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
    326        }
    327        ANGLE_CAPTURE_GL(BlendFuncSeparate, isCallValid, context, sfactorRGB, dfactorRGB,
    328                         sfactorAlpha, dfactorAlpha);
    329    }
    330    else
    331    {
    332        GenerateContextLostErrorOnCurrentGlobalContext();
    333    }
    334 }
    335 
    336 void GL_APIENTRY GL_BufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage)
    337 {
    338    Context *context = GetValidGlobalContext();
    339    EVENT(context, GLBufferData,
    340          "context = %d, target = %s, size = %llu, data = 0x%016" PRIxPTR ", usage = %s",
    341          CID(context), GLenumToString(GLESEnum::BufferTargetARB, target),
    342          static_cast<unsigned long long>(size), (uintptr_t)data,
    343          GLenumToString(GLESEnum::BufferUsageARB, usage));
    344 
    345    if (context)
    346    {
    347        BufferBinding targetPacked = PackParam<BufferBinding>(target);
    348        BufferUsage usagePacked    = PackParam<BufferUsage>(usage);
    349        SCOPED_SHARE_CONTEXT_LOCK(context);
    350        bool isCallValid = (context->skipValidation() ||
    351                            ValidateBufferData(context, angle::EntryPoint::GLBufferData,
    352                                               targetPacked, size, data, usagePacked));
    353        if (isCallValid)
    354        {
    355            context->bufferData(targetPacked, size, data, usagePacked);
    356        }
    357        ANGLE_CAPTURE_GL(BufferData, isCallValid, context, targetPacked, size, data, usagePacked);
    358    }
    359    else
    360    {
    361        GenerateContextLostErrorOnCurrentGlobalContext();
    362    }
    363 }
    364 
    365 void GL_APIENTRY GL_BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data)
    366 {
    367    Context *context = GetValidGlobalContext();
    368    EVENT(context, GLBufferSubData,
    369          "context = %d, target = %s, offset = %llu, size = %llu, data = 0x%016" PRIxPTR "",
    370          CID(context), GLenumToString(GLESEnum::BufferTargetARB, target),
    371          static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size),
    372          (uintptr_t)data);
    373 
    374    if (context)
    375    {
    376        BufferBinding targetPacked = PackParam<BufferBinding>(target);
    377        SCOPED_SHARE_CONTEXT_LOCK(context);
    378        bool isCallValid = (context->skipValidation() ||
    379                            ValidateBufferSubData(context, angle::EntryPoint::GLBufferSubData,
    380                                                  targetPacked, offset, size, data));
    381        if (isCallValid)
    382        {
    383            context->bufferSubData(targetPacked, offset, size, data);
    384        }
    385        ANGLE_CAPTURE_GL(BufferSubData, isCallValid, context, targetPacked, offset, size, data);
    386    }
    387    else
    388    {
    389        GenerateContextLostErrorOnCurrentGlobalContext();
    390    }
    391 }
    392 
    393 GLenum GL_APIENTRY GL_CheckFramebufferStatus(GLenum target)
    394 {
    395    Context *context = GetValidGlobalContext();
    396    EVENT(context, GLCheckFramebufferStatus, "context = %d, target = %s", CID(context),
    397          GLenumToString(GLESEnum::FramebufferTarget, target));
    398 
    399    GLenum returnValue;
    400    if (context)
    401    {
    402        SCOPED_SHARE_CONTEXT_LOCK(context);
    403        bool isCallValid = (context->skipValidation() ||
    404                            ValidateCheckFramebufferStatus(
    405                                context, angle::EntryPoint::GLCheckFramebufferStatus, target));
    406        if (isCallValid)
    407        {
    408            returnValue = context->checkFramebufferStatus(target);
    409        }
    410        else
    411        {
    412            returnValue =
    413                GetDefaultReturnValue<angle::EntryPoint::GLCheckFramebufferStatus, GLenum>();
    414        }
    415        ANGLE_CAPTURE_GL(CheckFramebufferStatus, isCallValid, context, target, returnValue);
    416    }
    417    else
    418    {
    419        GenerateContextLostErrorOnCurrentGlobalContext();
    420        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLCheckFramebufferStatus, GLenum>();
    421    }
    422    return returnValue;
    423 }
    424 
    425 void GL_APIENTRY GL_Clear(GLbitfield mask)
    426 {
    427    Context *context = GetValidGlobalContext();
    428    EVENT(context, GLClear, "context = %d, mask = %s", CID(context),
    429          GLbitfieldToString(GLESEnum::ClearBufferMask, mask).c_str());
    430 
    431    if (context)
    432    {
    433        SCOPED_SHARE_CONTEXT_LOCK(context);
    434        bool isCallValid =
    435            (context->skipValidation() || ValidateClear(context, angle::EntryPoint::GLClear, mask));
    436        if (isCallValid)
    437        {
    438            context->clear(mask);
    439        }
    440        ANGLE_CAPTURE_GL(Clear, isCallValid, context, mask);
    441    }
    442    else
    443    {
    444        GenerateContextLostErrorOnCurrentGlobalContext();
    445    }
    446 }
    447 
    448 void GL_APIENTRY GL_ClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
    449 {
    450    Context *context = GetValidGlobalContext();
    451    EVENT(context, GLClearColor, "context = %d, red = %f, green = %f, blue = %f, alpha = %f",
    452          CID(context), red, green, blue, alpha);
    453 
    454    if (context)
    455    {
    456        SCOPED_SHARE_CONTEXT_LOCK(context);
    457        bool isCallValid =
    458            (context->skipValidation() ||
    459             ValidateClearColor(context, angle::EntryPoint::GLClearColor, red, green, blue, alpha));
    460        if (isCallValid)
    461        {
    462            context->clearColor(red, green, blue, alpha);
    463        }
    464        ANGLE_CAPTURE_GL(ClearColor, isCallValid, context, red, green, blue, alpha);
    465    }
    466    else
    467    {
    468        GenerateContextLostErrorOnCurrentGlobalContext();
    469    }
    470 }
    471 
    472 void GL_APIENTRY GL_ClearDepthf(GLfloat d)
    473 {
    474    Context *context = GetValidGlobalContext();
    475    EVENT(context, GLClearDepthf, "context = %d, d = %f", CID(context), d);
    476 
    477    if (context)
    478    {
    479        SCOPED_SHARE_CONTEXT_LOCK(context);
    480        bool isCallValid = (context->skipValidation() ||
    481                            ValidateClearDepthf(context, angle::EntryPoint::GLClearDepthf, d));
    482        if (isCallValid)
    483        {
    484            context->clearDepthf(d);
    485        }
    486        ANGLE_CAPTURE_GL(ClearDepthf, isCallValid, context, d);
    487    }
    488    else
    489    {
    490        GenerateContextLostErrorOnCurrentGlobalContext();
    491    }
    492 }
    493 
    494 void GL_APIENTRY GL_ClearStencil(GLint s)
    495 {
    496    Context *context = GetValidGlobalContext();
    497    EVENT(context, GLClearStencil, "context = %d, s = %d", CID(context), s);
    498 
    499    if (context)
    500    {
    501        SCOPED_SHARE_CONTEXT_LOCK(context);
    502        bool isCallValid = (context->skipValidation() ||
    503                            ValidateClearStencil(context, angle::EntryPoint::GLClearStencil, s));
    504        if (isCallValid)
    505        {
    506            context->clearStencil(s);
    507        }
    508        ANGLE_CAPTURE_GL(ClearStencil, isCallValid, context, s);
    509    }
    510    else
    511    {
    512        GenerateContextLostErrorOnCurrentGlobalContext();
    513    }
    514 }
    515 
    516 void GL_APIENTRY GL_ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
    517 {
    518    Context *context = GetValidGlobalContext();
    519    EVENT(context, GLColorMask, "context = %d, red = %s, green = %s, blue = %s, alpha = %s",
    520          CID(context), GLbooleanToString(red), GLbooleanToString(green), GLbooleanToString(blue),
    521          GLbooleanToString(alpha));
    522 
    523    if (context)
    524    {
    525        SCOPED_SHARE_CONTEXT_LOCK(context);
    526        bool isCallValid =
    527            (context->skipValidation() ||
    528             ValidateColorMask(context, angle::EntryPoint::GLColorMask, red, green, blue, alpha));
    529        if (isCallValid)
    530        {
    531            context->colorMask(red, green, blue, alpha);
    532        }
    533        ANGLE_CAPTURE_GL(ColorMask, isCallValid, context, red, green, blue, alpha);
    534    }
    535    else
    536    {
    537        GenerateContextLostErrorOnCurrentGlobalContext();
    538    }
    539 }
    540 
    541 void GL_APIENTRY GL_CompileShader(GLuint shader)
    542 {
    543    Context *context = GetValidGlobalContext();
    544    EVENT(context, GLCompileShader, "context = %d, shader = %u", CID(context), shader);
    545 
    546    if (context)
    547    {
    548        ShaderProgramID shaderPacked = PackParam<ShaderProgramID>(shader);
    549        SCOPED_SHARE_CONTEXT_LOCK(context);
    550        bool isCallValid =
    551            (context->skipValidation() ||
    552             ValidateCompileShader(context, angle::EntryPoint::GLCompileShader, shaderPacked));
    553        if (isCallValid)
    554        {
    555            context->compileShader(shaderPacked);
    556        }
    557        ANGLE_CAPTURE_GL(CompileShader, isCallValid, context, shaderPacked);
    558    }
    559    else
    560    {
    561        GenerateContextLostErrorOnCurrentGlobalContext();
    562    }
    563 }
    564 
    565 void GL_APIENTRY GL_CompressedTexImage2D(GLenum target,
    566                                         GLint level,
    567                                         GLenum internalformat,
    568                                         GLsizei width,
    569                                         GLsizei height,
    570                                         GLint border,
    571                                         GLsizei imageSize,
    572                                         const void *data)
    573 {
    574    Context *context = GetValidGlobalContext();
    575    EVENT(context, GLCompressedTexImage2D,
    576          "context = %d, target = %s, level = %d, internalformat = %s, width = %d, height = %d, "
    577          "border = %d, imageSize = %d, data = 0x%016" PRIxPTR "",
    578          CID(context), GLenumToString(GLESEnum::TextureTarget, target), level,
    579          GLenumToString(GLESEnum::InternalFormat, internalformat), width, height, border,
    580          imageSize, (uintptr_t)data);
    581 
    582    if (context)
    583    {
    584        TextureTarget targetPacked = PackParam<TextureTarget>(target);
    585        SCOPED_SHARE_CONTEXT_LOCK(context);
    586        bool isCallValid = (context->skipValidation() ||
    587                            ValidateCompressedTexImage2D(
    588                                context, angle::EntryPoint::GLCompressedTexImage2D, targetPacked,
    589                                level, internalformat, width, height, border, imageSize, data));
    590        if (isCallValid)
    591        {
    592            context->compressedTexImage2D(targetPacked, level, internalformat, width, height,
    593                                          border, imageSize, data);
    594        }
    595        ANGLE_CAPTURE_GL(CompressedTexImage2D, isCallValid, context, targetPacked, level,
    596                         internalformat, width, height, border, imageSize, data);
    597    }
    598    else
    599    {
    600        GenerateContextLostErrorOnCurrentGlobalContext();
    601    }
    602 }
    603 
    604 void GL_APIENTRY GL_CompressedTexSubImage2D(GLenum target,
    605                                            GLint level,
    606                                            GLint xoffset,
    607                                            GLint yoffset,
    608                                            GLsizei width,
    609                                            GLsizei height,
    610                                            GLenum format,
    611                                            GLsizei imageSize,
    612                                            const void *data)
    613 {
    614    Context *context = GetValidGlobalContext();
    615    EVENT(context, GLCompressedTexSubImage2D,
    616          "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, width = %d, height = "
    617          "%d, format = %s, imageSize = %d, data = 0x%016" PRIxPTR "",
    618          CID(context), GLenumToString(GLESEnum::TextureTarget, target), level, xoffset, yoffset,
    619          width, height, GLenumToString(GLESEnum::InternalFormat, format), imageSize,
    620          (uintptr_t)data);
    621 
    622    if (context)
    623    {
    624        TextureTarget targetPacked = PackParam<TextureTarget>(target);
    625        SCOPED_SHARE_CONTEXT_LOCK(context);
    626        bool isCallValid = (context->skipValidation() ||
    627                            ValidateCompressedTexSubImage2D(
    628                                context, angle::EntryPoint::GLCompressedTexSubImage2D, targetPacked,
    629                                level, xoffset, yoffset, width, height, format, imageSize, data));
    630        if (isCallValid)
    631        {
    632            context->compressedTexSubImage2D(targetPacked, level, xoffset, yoffset, width, height,
    633                                             format, imageSize, data);
    634        }
    635        ANGLE_CAPTURE_GL(CompressedTexSubImage2D, isCallValid, context, targetPacked, level,
    636                         xoffset, yoffset, width, height, format, imageSize, data);
    637    }
    638    else
    639    {
    640        GenerateContextLostErrorOnCurrentGlobalContext();
    641    }
    642 }
    643 
    644 void GL_APIENTRY GL_CopyTexImage2D(GLenum target,
    645                                   GLint level,
    646                                   GLenum internalformat,
    647                                   GLint x,
    648                                   GLint y,
    649                                   GLsizei width,
    650                                   GLsizei height,
    651                                   GLint border)
    652 {
    653    Context *context = GetValidGlobalContext();
    654    EVENT(context, GLCopyTexImage2D,
    655          "context = %d, target = %s, level = %d, internalformat = %s, x = %d, y = %d, width = %d, "
    656          "height = %d, border = %d",
    657          CID(context), GLenumToString(GLESEnum::TextureTarget, target), level,
    658          GLenumToString(GLESEnum::InternalFormat, internalformat), x, y, width, height, border);
    659 
    660    if (context)
    661    {
    662        TextureTarget targetPacked = PackParam<TextureTarget>(target);
    663        SCOPED_SHARE_CONTEXT_LOCK(context);
    664        bool isCallValid =
    665            (context->skipValidation() ||
    666             ValidateCopyTexImage2D(context, angle::EntryPoint::GLCopyTexImage2D, targetPacked,
    667                                    level, internalformat, x, y, width, height, border));
    668        if (isCallValid)
    669        {
    670            context->copyTexImage2D(targetPacked, level, internalformat, x, y, width, height,
    671                                    border);
    672        }
    673        ANGLE_CAPTURE_GL(CopyTexImage2D, isCallValid, context, targetPacked, level, internalformat,
    674                         x, y, width, height, border);
    675    }
    676    else
    677    {
    678        GenerateContextLostErrorOnCurrentGlobalContext();
    679    }
    680 }
    681 
    682 void GL_APIENTRY GL_CopyTexSubImage2D(GLenum target,
    683                                      GLint level,
    684                                      GLint xoffset,
    685                                      GLint yoffset,
    686                                      GLint x,
    687                                      GLint y,
    688                                      GLsizei width,
    689                                      GLsizei height)
    690 {
    691    Context *context = GetValidGlobalContext();
    692    EVENT(context, GLCopyTexSubImage2D,
    693          "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, x = %d, y = %d, "
    694          "width = %d, height = %d",
    695          CID(context), GLenumToString(GLESEnum::TextureTarget, target), level, xoffset, yoffset, x,
    696          y, width, height);
    697 
    698    if (context)
    699    {
    700        TextureTarget targetPacked = PackParam<TextureTarget>(target);
    701        SCOPED_SHARE_CONTEXT_LOCK(context);
    702        bool isCallValid =
    703            (context->skipValidation() ||
    704             ValidateCopyTexSubImage2D(context, angle::EntryPoint::GLCopyTexSubImage2D,
    705                                       targetPacked, level, xoffset, yoffset, x, y, width, height));
    706        if (isCallValid)
    707        {
    708            context->copyTexSubImage2D(targetPacked, level, xoffset, yoffset, x, y, width, height);
    709        }
    710        ANGLE_CAPTURE_GL(CopyTexSubImage2D, isCallValid, context, targetPacked, level, xoffset,
    711                         yoffset, x, y, width, height);
    712    }
    713    else
    714    {
    715        GenerateContextLostErrorOnCurrentGlobalContext();
    716    }
    717 }
    718 
    719 GLuint GL_APIENTRY GL_CreateProgram()
    720 {
    721    Context *context = GetValidGlobalContext();
    722    EVENT(context, GLCreateProgram, "context = %d", CID(context));
    723 
    724    GLuint returnValue;
    725    if (context)
    726    {
    727        SCOPED_SHARE_CONTEXT_LOCK(context);
    728        bool isCallValid = (context->skipValidation() ||
    729                            ValidateCreateProgram(context, angle::EntryPoint::GLCreateProgram));
    730        if (isCallValid)
    731        {
    732            returnValue = context->createProgram();
    733        }
    734        else
    735        {
    736            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLCreateProgram, GLuint>();
    737        }
    738        ANGLE_CAPTURE_GL(CreateProgram, isCallValid, context, returnValue);
    739    }
    740    else
    741    {
    742        GenerateContextLostErrorOnCurrentGlobalContext();
    743        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLCreateProgram, GLuint>();
    744    }
    745    return returnValue;
    746 }
    747 
    748 GLuint GL_APIENTRY GL_CreateShader(GLenum type)
    749 {
    750    Context *context = GetValidGlobalContext();
    751    EVENT(context, GLCreateShader, "context = %d, type = %s", CID(context),
    752          GLenumToString(GLESEnum::ShaderType, type));
    753 
    754    GLuint returnValue;
    755    if (context)
    756    {
    757        ShaderType typePacked = PackParam<ShaderType>(type);
    758        SCOPED_SHARE_CONTEXT_LOCK(context);
    759        bool isCallValid =
    760            (context->skipValidation() ||
    761             ValidateCreateShader(context, angle::EntryPoint::GLCreateShader, typePacked));
    762        if (isCallValid)
    763        {
    764            returnValue = context->createShader(typePacked);
    765        }
    766        else
    767        {
    768            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLCreateShader, GLuint>();
    769        }
    770        ANGLE_CAPTURE_GL(CreateShader, isCallValid, context, typePacked, returnValue);
    771    }
    772    else
    773    {
    774        GenerateContextLostErrorOnCurrentGlobalContext();
    775        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLCreateShader, GLuint>();
    776    }
    777    return returnValue;
    778 }
    779 
    780 void GL_APIENTRY GL_CullFace(GLenum mode)
    781 {
    782    Context *context = GetValidGlobalContext();
    783    EVENT(context, GLCullFace, "context = %d, mode = %s", CID(context),
    784          GLenumToString(GLESEnum::TriangleFace, mode));
    785 
    786    if (context)
    787    {
    788        CullFaceMode modePacked = PackParam<CullFaceMode>(mode);
    789        SCOPED_SHARE_CONTEXT_LOCK(context);
    790        bool isCallValid = (context->skipValidation() ||
    791                            ValidateCullFace(context, angle::EntryPoint::GLCullFace, modePacked));
    792        if (isCallValid)
    793        {
    794            context->cullFace(modePacked);
    795        }
    796        ANGLE_CAPTURE_GL(CullFace, isCallValid, context, modePacked);
    797    }
    798    else
    799    {
    800        GenerateContextLostErrorOnCurrentGlobalContext();
    801    }
    802 }
    803 
    804 void GL_APIENTRY GL_DeleteBuffers(GLsizei n, const GLuint *buffers)
    805 {
    806    Context *context = GetValidGlobalContext();
    807    EVENT(context, GLDeleteBuffers, "context = %d, n = %d, buffers = 0x%016" PRIxPTR "",
    808          CID(context), n, (uintptr_t)buffers);
    809 
    810    if (context)
    811    {
    812        const BufferID *buffersPacked = PackParam<const BufferID *>(buffers);
    813        SCOPED_SHARE_CONTEXT_LOCK(context);
    814        bool isCallValid =
    815            (context->skipValidation() ||
    816             ValidateDeleteBuffers(context, angle::EntryPoint::GLDeleteBuffers, n, buffersPacked));
    817        if (isCallValid)
    818        {
    819            context->deleteBuffers(n, buffersPacked);
    820        }
    821        ANGLE_CAPTURE_GL(DeleteBuffers, isCallValid, context, n, buffersPacked);
    822    }
    823    else
    824    {
    825        GenerateContextLostErrorOnCurrentGlobalContext();
    826    }
    827 }
    828 
    829 void GL_APIENTRY GL_DeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
    830 {
    831    Context *context = GetValidGlobalContext();
    832    EVENT(context, GLDeleteFramebuffers, "context = %d, n = %d, framebuffers = 0x%016" PRIxPTR "",
    833          CID(context), n, (uintptr_t)framebuffers);
    834 
    835    if (context)
    836    {
    837        const FramebufferID *framebuffersPacked = PackParam<const FramebufferID *>(framebuffers);
    838        SCOPED_SHARE_CONTEXT_LOCK(context);
    839        bool isCallValid =
    840            (context->skipValidation() ||
    841             ValidateDeleteFramebuffers(context, angle::EntryPoint::GLDeleteFramebuffers, n,
    842                                        framebuffersPacked));
    843        if (isCallValid)
    844        {
    845            context->deleteFramebuffers(n, framebuffersPacked);
    846        }
    847        ANGLE_CAPTURE_GL(DeleteFramebuffers, isCallValid, context, n, framebuffersPacked);
    848    }
    849    else
    850    {
    851        GenerateContextLostErrorOnCurrentGlobalContext();
    852    }
    853 }
    854 
    855 void GL_APIENTRY GL_DeleteProgram(GLuint program)
    856 {
    857    Context *context = GetValidGlobalContext();
    858    EVENT(context, GLDeleteProgram, "context = %d, program = %u", CID(context), program);
    859 
    860    if (context)
    861    {
    862        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
    863        SCOPED_SHARE_CONTEXT_LOCK(context);
    864        bool isCallValid =
    865            (context->skipValidation() ||
    866             ValidateDeleteProgram(context, angle::EntryPoint::GLDeleteProgram, programPacked));
    867        if (isCallValid)
    868        {
    869            context->deleteProgram(programPacked);
    870        }
    871        ANGLE_CAPTURE_GL(DeleteProgram, isCallValid, context, programPacked);
    872    }
    873    else
    874    {
    875        GenerateContextLostErrorOnCurrentGlobalContext();
    876    }
    877 }
    878 
    879 void GL_APIENTRY GL_DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
    880 {
    881    Context *context = GetValidGlobalContext();
    882    EVENT(context, GLDeleteRenderbuffers, "context = %d, n = %d, renderbuffers = 0x%016" PRIxPTR "",
    883          CID(context), n, (uintptr_t)renderbuffers);
    884 
    885    if (context)
    886    {
    887        const RenderbufferID *renderbuffersPacked =
    888            PackParam<const RenderbufferID *>(renderbuffers);
    889        SCOPED_SHARE_CONTEXT_LOCK(context);
    890        bool isCallValid =
    891            (context->skipValidation() ||
    892             ValidateDeleteRenderbuffers(context, angle::EntryPoint::GLDeleteRenderbuffers, n,
    893                                         renderbuffersPacked));
    894        if (isCallValid)
    895        {
    896            context->deleteRenderbuffers(n, renderbuffersPacked);
    897        }
    898        ANGLE_CAPTURE_GL(DeleteRenderbuffers, isCallValid, context, n, renderbuffersPacked);
    899    }
    900    else
    901    {
    902        GenerateContextLostErrorOnCurrentGlobalContext();
    903    }
    904 }
    905 
    906 void GL_APIENTRY GL_DeleteShader(GLuint shader)
    907 {
    908    Context *context = GetValidGlobalContext();
    909    EVENT(context, GLDeleteShader, "context = %d, shader = %u", CID(context), shader);
    910 
    911    if (context)
    912    {
    913        ShaderProgramID shaderPacked = PackParam<ShaderProgramID>(shader);
    914        SCOPED_SHARE_CONTEXT_LOCK(context);
    915        bool isCallValid =
    916            (context->skipValidation() ||
    917             ValidateDeleteShader(context, angle::EntryPoint::GLDeleteShader, shaderPacked));
    918        if (isCallValid)
    919        {
    920            context->deleteShader(shaderPacked);
    921        }
    922        ANGLE_CAPTURE_GL(DeleteShader, isCallValid, context, shaderPacked);
    923    }
    924    else
    925    {
    926        GenerateContextLostErrorOnCurrentGlobalContext();
    927    }
    928 }
    929 
    930 void GL_APIENTRY GL_DeleteTextures(GLsizei n, const GLuint *textures)
    931 {
    932    Context *context = GetValidGlobalContext();
    933    EVENT(context, GLDeleteTextures, "context = %d, n = %d, textures = 0x%016" PRIxPTR "",
    934          CID(context), n, (uintptr_t)textures);
    935 
    936    if (context)
    937    {
    938        const TextureID *texturesPacked = PackParam<const TextureID *>(textures);
    939        SCOPED_SHARE_CONTEXT_LOCK(context);
    940        bool isCallValid = (context->skipValidation() ||
    941                            ValidateDeleteTextures(context, angle::EntryPoint::GLDeleteTextures, n,
    942                                                   texturesPacked));
    943        if (isCallValid)
    944        {
    945            context->deleteTextures(n, texturesPacked);
    946        }
    947        ANGLE_CAPTURE_GL(DeleteTextures, isCallValid, context, n, texturesPacked);
    948    }
    949    else
    950    {
    951        GenerateContextLostErrorOnCurrentGlobalContext();
    952    }
    953 }
    954 
    955 void GL_APIENTRY GL_DepthFunc(GLenum func)
    956 {
    957    Context *context = GetValidGlobalContext();
    958    EVENT(context, GLDepthFunc, "context = %d, func = %s", CID(context),
    959          GLenumToString(GLESEnum::DepthFunction, func));
    960 
    961    if (context)
    962    {
    963        SCOPED_SHARE_CONTEXT_LOCK(context);
    964        bool isCallValid = (context->skipValidation() ||
    965                            ValidateDepthFunc(context, angle::EntryPoint::GLDepthFunc, func));
    966        if (isCallValid)
    967        {
    968            context->depthFunc(func);
    969        }
    970        ANGLE_CAPTURE_GL(DepthFunc, isCallValid, context, func);
    971    }
    972    else
    973    {
    974        GenerateContextLostErrorOnCurrentGlobalContext();
    975    }
    976 }
    977 
    978 void GL_APIENTRY GL_DepthMask(GLboolean flag)
    979 {
    980    Context *context = GetValidGlobalContext();
    981    EVENT(context, GLDepthMask, "context = %d, flag = %s", CID(context), GLbooleanToString(flag));
    982 
    983    if (context)
    984    {
    985        SCOPED_SHARE_CONTEXT_LOCK(context);
    986        bool isCallValid = (context->skipValidation() ||
    987                            ValidateDepthMask(context, angle::EntryPoint::GLDepthMask, flag));
    988        if (isCallValid)
    989        {
    990            context->depthMask(flag);
    991        }
    992        ANGLE_CAPTURE_GL(DepthMask, isCallValid, context, flag);
    993    }
    994    else
    995    {
    996        GenerateContextLostErrorOnCurrentGlobalContext();
    997    }
    998 }
    999 
   1000 void GL_APIENTRY GL_DepthRangef(GLfloat n, GLfloat f)
   1001 {
   1002    Context *context = GetValidGlobalContext();
   1003    EVENT(context, GLDepthRangef, "context = %d, n = %f, f = %f", CID(context), n, f);
   1004 
   1005    if (context)
   1006    {
   1007        SCOPED_SHARE_CONTEXT_LOCK(context);
   1008        bool isCallValid = (context->skipValidation() ||
   1009                            ValidateDepthRangef(context, angle::EntryPoint::GLDepthRangef, n, f));
   1010        if (isCallValid)
   1011        {
   1012            context->depthRangef(n, f);
   1013        }
   1014        ANGLE_CAPTURE_GL(DepthRangef, isCallValid, context, n, f);
   1015    }
   1016    else
   1017    {
   1018        GenerateContextLostErrorOnCurrentGlobalContext();
   1019    }
   1020 }
   1021 
   1022 void GL_APIENTRY GL_DetachShader(GLuint program, GLuint shader)
   1023 {
   1024    Context *context = GetValidGlobalContext();
   1025    EVENT(context, GLDetachShader, "context = %d, program = %u, shader = %u", CID(context), program,
   1026          shader);
   1027 
   1028    if (context)
   1029    {
   1030        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
   1031        ShaderProgramID shaderPacked  = PackParam<ShaderProgramID>(shader);
   1032        SCOPED_SHARE_CONTEXT_LOCK(context);
   1033        bool isCallValid = (context->skipValidation() ||
   1034                            ValidateDetachShader(context, angle::EntryPoint::GLDetachShader,
   1035                                                 programPacked, shaderPacked));
   1036        if (isCallValid)
   1037        {
   1038            context->detachShader(programPacked, shaderPacked);
   1039        }
   1040        ANGLE_CAPTURE_GL(DetachShader, isCallValid, context, programPacked, shaderPacked);
   1041    }
   1042    else
   1043    {
   1044        GenerateContextLostErrorOnCurrentGlobalContext();
   1045    }
   1046 }
   1047 
   1048 void GL_APIENTRY GL_Disable(GLenum cap)
   1049 {
   1050    Context *context = GetValidGlobalContext();
   1051    EVENT(context, GLDisable, "context = %d, cap = %s", CID(context),
   1052          GLenumToString(GLESEnum::EnableCap, cap));
   1053 
   1054    if (context)
   1055    {
   1056        SCOPED_SHARE_CONTEXT_LOCK(context);
   1057        bool isCallValid = (context->skipValidation() ||
   1058                            ValidateDisable(context, angle::EntryPoint::GLDisable, cap));
   1059        if (isCallValid)
   1060        {
   1061            context->disable(cap);
   1062        }
   1063        ANGLE_CAPTURE_GL(Disable, isCallValid, context, cap);
   1064    }
   1065    else
   1066    {
   1067        GenerateContextLostErrorOnCurrentGlobalContext();
   1068    }
   1069 }
   1070 
   1071 void GL_APIENTRY GL_DisableVertexAttribArray(GLuint index)
   1072 {
   1073    Context *context = GetValidGlobalContext();
   1074    EVENT(context, GLDisableVertexAttribArray, "context = %d, index = %u", CID(context), index);
   1075 
   1076    if (context)
   1077    {
   1078        SCOPED_SHARE_CONTEXT_LOCK(context);
   1079        bool isCallValid = (context->skipValidation() ||
   1080                            ValidateDisableVertexAttribArray(
   1081                                context, angle::EntryPoint::GLDisableVertexAttribArray, index));
   1082        if (isCallValid)
   1083        {
   1084            context->disableVertexAttribArray(index);
   1085        }
   1086        ANGLE_CAPTURE_GL(DisableVertexAttribArray, isCallValid, context, index);
   1087    }
   1088    else
   1089    {
   1090        GenerateContextLostErrorOnCurrentGlobalContext();
   1091    }
   1092 }
   1093 
   1094 void GL_APIENTRY GL_DrawArrays(GLenum mode, GLint first, GLsizei count)
   1095 {
   1096    Context *context = GetValidGlobalContext();
   1097    EVENT(context, GLDrawArrays, "context = %d, mode = %s, first = %d, count = %d", CID(context),
   1098          GLenumToString(GLESEnum::PrimitiveType, mode), first, count);
   1099 
   1100    if (context)
   1101    {
   1102        PrimitiveMode modePacked = PackParam<PrimitiveMode>(mode);
   1103        SCOPED_SHARE_CONTEXT_LOCK(context);
   1104        bool isCallValid = (context->skipValidation() ||
   1105                            ValidateDrawArrays(context, angle::EntryPoint::GLDrawArrays, modePacked,
   1106                                               first, count));
   1107        if (isCallValid)
   1108        {
   1109            context->drawArrays(modePacked, first, count);
   1110        }
   1111        ANGLE_CAPTURE_GL(DrawArrays, isCallValid, context, modePacked, first, count);
   1112    }
   1113    else
   1114    {
   1115        GenerateContextLostErrorOnCurrentGlobalContext();
   1116    }
   1117 }
   1118 
   1119 void GL_APIENTRY GL_DrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices)
   1120 {
   1121    Context *context = GetValidGlobalContext();
   1122    EVENT(context, GLDrawElements,
   1123          "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR "",
   1124          CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), count,
   1125          GLenumToString(GLESEnum::DrawElementsType, type), (uintptr_t)indices);
   1126 
   1127    if (context)
   1128    {
   1129        PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
   1130        DrawElementsType typePacked = PackParam<DrawElementsType>(type);
   1131        SCOPED_SHARE_CONTEXT_LOCK(context);
   1132        bool isCallValid = (context->skipValidation() ||
   1133                            ValidateDrawElements(context, angle::EntryPoint::GLDrawElements,
   1134                                                 modePacked, count, typePacked, indices));
   1135        if (isCallValid)
   1136        {
   1137            context->drawElements(modePacked, count, typePacked, indices);
   1138        }
   1139        ANGLE_CAPTURE_GL(DrawElements, isCallValid, context, modePacked, count, typePacked,
   1140                         indices);
   1141    }
   1142    else
   1143    {
   1144        GenerateContextLostErrorOnCurrentGlobalContext();
   1145    }
   1146 }
   1147 
   1148 void GL_APIENTRY GL_Enable(GLenum cap)
   1149 {
   1150    Context *context = GetValidGlobalContext();
   1151    EVENT(context, GLEnable, "context = %d, cap = %s", CID(context),
   1152          GLenumToString(GLESEnum::EnableCap, cap));
   1153 
   1154    if (context)
   1155    {
   1156        SCOPED_SHARE_CONTEXT_LOCK(context);
   1157        bool isCallValid = (context->skipValidation() ||
   1158                            ValidateEnable(context, angle::EntryPoint::GLEnable, cap));
   1159        if (isCallValid)
   1160        {
   1161            context->enable(cap);
   1162        }
   1163        ANGLE_CAPTURE_GL(Enable, isCallValid, context, cap);
   1164    }
   1165    else
   1166    {
   1167        GenerateContextLostErrorOnCurrentGlobalContext();
   1168    }
   1169 }
   1170 
   1171 void GL_APIENTRY GL_EnableVertexAttribArray(GLuint index)
   1172 {
   1173    Context *context = GetValidGlobalContext();
   1174    EVENT(context, GLEnableVertexAttribArray, "context = %d, index = %u", CID(context), index);
   1175 
   1176    if (context)
   1177    {
   1178        SCOPED_SHARE_CONTEXT_LOCK(context);
   1179        bool isCallValid = (context->skipValidation() ||
   1180                            ValidateEnableVertexAttribArray(
   1181                                context, angle::EntryPoint::GLEnableVertexAttribArray, index));
   1182        if (isCallValid)
   1183        {
   1184            context->enableVertexAttribArray(index);
   1185        }
   1186        ANGLE_CAPTURE_GL(EnableVertexAttribArray, isCallValid, context, index);
   1187    }
   1188    else
   1189    {
   1190        GenerateContextLostErrorOnCurrentGlobalContext();
   1191    }
   1192 }
   1193 
   1194 void GL_APIENTRY GL_Finish()
   1195 {
   1196    Context *context = GetValidGlobalContext();
   1197    EVENT(context, GLFinish, "context = %d", CID(context));
   1198 
   1199    if (context)
   1200    {
   1201        SCOPED_SHARE_CONTEXT_LOCK(context);
   1202        bool isCallValid =
   1203            (context->skipValidation() || ValidateFinish(context, angle::EntryPoint::GLFinish));
   1204        if (isCallValid)
   1205        {
   1206            context->finish();
   1207        }
   1208        ANGLE_CAPTURE_GL(Finish, isCallValid, context);
   1209    }
   1210    else
   1211    {
   1212        GenerateContextLostErrorOnCurrentGlobalContext();
   1213    }
   1214 }
   1215 
   1216 void GL_APIENTRY GL_Flush()
   1217 {
   1218    Context *context = GetValidGlobalContext();
   1219    EVENT(context, GLFlush, "context = %d", CID(context));
   1220 
   1221    if (context)
   1222    {
   1223        SCOPED_SHARE_CONTEXT_LOCK(context);
   1224        bool isCallValid =
   1225            (context->skipValidation() || ValidateFlush(context, angle::EntryPoint::GLFlush));
   1226        if (isCallValid)
   1227        {
   1228            context->flush();
   1229        }
   1230        ANGLE_CAPTURE_GL(Flush, isCallValid, context);
   1231    }
   1232    else
   1233    {
   1234        GenerateContextLostErrorOnCurrentGlobalContext();
   1235    }
   1236 }
   1237 
   1238 void GL_APIENTRY GL_FramebufferRenderbuffer(GLenum target,
   1239                                            GLenum attachment,
   1240                                            GLenum renderbuffertarget,
   1241                                            GLuint renderbuffer)
   1242 {
   1243    Context *context = GetValidGlobalContext();
   1244    EVENT(context, GLFramebufferRenderbuffer,
   1245          "context = %d, target = %s, attachment = %s, renderbuffertarget = %s, renderbuffer = %u",
   1246          CID(context), GLenumToString(GLESEnum::FramebufferTarget, target),
   1247          GLenumToString(GLESEnum::FramebufferAttachment, attachment),
   1248          GLenumToString(GLESEnum::RenderbufferTarget, renderbuffertarget), renderbuffer);
   1249 
   1250    if (context)
   1251    {
   1252        RenderbufferID renderbufferPacked = PackParam<RenderbufferID>(renderbuffer);
   1253        SCOPED_SHARE_CONTEXT_LOCK(context);
   1254        bool isCallValid = (context->skipValidation() ||
   1255                            ValidateFramebufferRenderbuffer(
   1256                                context, angle::EntryPoint::GLFramebufferRenderbuffer, target,
   1257                                attachment, renderbuffertarget, renderbufferPacked));
   1258        if (isCallValid)
   1259        {
   1260            context->framebufferRenderbuffer(target, attachment, renderbuffertarget,
   1261                                             renderbufferPacked);
   1262        }
   1263        ANGLE_CAPTURE_GL(FramebufferRenderbuffer, isCallValid, context, target, attachment,
   1264                         renderbuffertarget, renderbufferPacked);
   1265    }
   1266    else
   1267    {
   1268        GenerateContextLostErrorOnCurrentGlobalContext();
   1269    }
   1270 }
   1271 
   1272 void GL_APIENTRY GL_FramebufferTexture2D(GLenum target,
   1273                                         GLenum attachment,
   1274                                         GLenum textarget,
   1275                                         GLuint texture,
   1276                                         GLint level)
   1277 {
   1278    Context *context = GetValidGlobalContext();
   1279    EVENT(context, GLFramebufferTexture2D,
   1280          "context = %d, target = %s, attachment = %s, textarget = %s, texture = %u, level = %d",
   1281          CID(context), GLenumToString(GLESEnum::FramebufferTarget, target),
   1282          GLenumToString(GLESEnum::FramebufferAttachment, attachment),
   1283          GLenumToString(GLESEnum::TextureTarget, textarget), texture, level);
   1284 
   1285    if (context)
   1286    {
   1287        TextureTarget textargetPacked = PackParam<TextureTarget>(textarget);
   1288        TextureID texturePacked       = PackParam<TextureID>(texture);
   1289        SCOPED_SHARE_CONTEXT_LOCK(context);
   1290        bool isCallValid = (context->skipValidation() ||
   1291                            ValidateFramebufferTexture2D(
   1292                                context, angle::EntryPoint::GLFramebufferTexture2D, target,
   1293                                attachment, textargetPacked, texturePacked, level));
   1294        if (isCallValid)
   1295        {
   1296            context->framebufferTexture2D(target, attachment, textargetPacked, texturePacked,
   1297                                          level);
   1298        }
   1299        ANGLE_CAPTURE_GL(FramebufferTexture2D, isCallValid, context, target, attachment,
   1300                         textargetPacked, texturePacked, level);
   1301    }
   1302    else
   1303    {
   1304        GenerateContextLostErrorOnCurrentGlobalContext();
   1305    }
   1306 }
   1307 
   1308 void GL_APIENTRY GL_FrontFace(GLenum mode)
   1309 {
   1310    Context *context = GetValidGlobalContext();
   1311    EVENT(context, GLFrontFace, "context = %d, mode = %s", CID(context),
   1312          GLenumToString(GLESEnum::FrontFaceDirection, mode));
   1313 
   1314    if (context)
   1315    {
   1316        SCOPED_SHARE_CONTEXT_LOCK(context);
   1317        bool isCallValid = (context->skipValidation() ||
   1318                            ValidateFrontFace(context, angle::EntryPoint::GLFrontFace, mode));
   1319        if (isCallValid)
   1320        {
   1321            context->frontFace(mode);
   1322        }
   1323        ANGLE_CAPTURE_GL(FrontFace, isCallValid, context, mode);
   1324    }
   1325    else
   1326    {
   1327        GenerateContextLostErrorOnCurrentGlobalContext();
   1328    }
   1329 }
   1330 
   1331 void GL_APIENTRY GL_GenBuffers(GLsizei n, GLuint *buffers)
   1332 {
   1333    Context *context = GetValidGlobalContext();
   1334    EVENT(context, GLGenBuffers, "context = %d, n = %d, buffers = 0x%016" PRIxPTR "", CID(context),
   1335          n, (uintptr_t)buffers);
   1336 
   1337    if (context)
   1338    {
   1339        BufferID *buffersPacked = PackParam<BufferID *>(buffers);
   1340        SCOPED_SHARE_CONTEXT_LOCK(context);
   1341        bool isCallValid =
   1342            (context->skipValidation() ||
   1343             ValidateGenBuffers(context, angle::EntryPoint::GLGenBuffers, n, buffersPacked));
   1344        if (isCallValid)
   1345        {
   1346            context->genBuffers(n, buffersPacked);
   1347        }
   1348        ANGLE_CAPTURE_GL(GenBuffers, isCallValid, context, n, buffersPacked);
   1349    }
   1350    else
   1351    {
   1352        GenerateContextLostErrorOnCurrentGlobalContext();
   1353    }
   1354 }
   1355 
   1356 void GL_APIENTRY GL_GenFramebuffers(GLsizei n, GLuint *framebuffers)
   1357 {
   1358    Context *context = GetValidGlobalContext();
   1359    EVENT(context, GLGenFramebuffers, "context = %d, n = %d, framebuffers = 0x%016" PRIxPTR "",
   1360          CID(context), n, (uintptr_t)framebuffers);
   1361 
   1362    if (context)
   1363    {
   1364        FramebufferID *framebuffersPacked = PackParam<FramebufferID *>(framebuffers);
   1365        SCOPED_SHARE_CONTEXT_LOCK(context);
   1366        bool isCallValid = (context->skipValidation() ||
   1367                            ValidateGenFramebuffers(context, angle::EntryPoint::GLGenFramebuffers,
   1368                                                    n, framebuffersPacked));
   1369        if (isCallValid)
   1370        {
   1371            context->genFramebuffers(n, framebuffersPacked);
   1372        }
   1373        ANGLE_CAPTURE_GL(GenFramebuffers, isCallValid, context, n, framebuffersPacked);
   1374    }
   1375    else
   1376    {
   1377        GenerateContextLostErrorOnCurrentGlobalContext();
   1378    }
   1379 }
   1380 
   1381 void GL_APIENTRY GL_GenRenderbuffers(GLsizei n, GLuint *renderbuffers)
   1382 {
   1383    Context *context = GetValidGlobalContext();
   1384    EVENT(context, GLGenRenderbuffers, "context = %d, n = %d, renderbuffers = 0x%016" PRIxPTR "",
   1385          CID(context), n, (uintptr_t)renderbuffers);
   1386 
   1387    if (context)
   1388    {
   1389        RenderbufferID *renderbuffersPacked = PackParam<RenderbufferID *>(renderbuffers);
   1390        SCOPED_SHARE_CONTEXT_LOCK(context);
   1391        bool isCallValid = (context->skipValidation() ||
   1392                            ValidateGenRenderbuffers(context, angle::EntryPoint::GLGenRenderbuffers,
   1393                                                     n, renderbuffersPacked));
   1394        if (isCallValid)
   1395        {
   1396            context->genRenderbuffers(n, renderbuffersPacked);
   1397        }
   1398        ANGLE_CAPTURE_GL(GenRenderbuffers, isCallValid, context, n, renderbuffersPacked);
   1399    }
   1400    else
   1401    {
   1402        GenerateContextLostErrorOnCurrentGlobalContext();
   1403    }
   1404 }
   1405 
   1406 void GL_APIENTRY GL_GenTextures(GLsizei n, GLuint *textures)
   1407 {
   1408    Context *context = GetValidGlobalContext();
   1409    EVENT(context, GLGenTextures, "context = %d, n = %d, textures = 0x%016" PRIxPTR "",
   1410          CID(context), n, (uintptr_t)textures);
   1411 
   1412    if (context)
   1413    {
   1414        TextureID *texturesPacked = PackParam<TextureID *>(textures);
   1415        SCOPED_SHARE_CONTEXT_LOCK(context);
   1416        bool isCallValid =
   1417            (context->skipValidation() ||
   1418             ValidateGenTextures(context, angle::EntryPoint::GLGenTextures, n, texturesPacked));
   1419        if (isCallValid)
   1420        {
   1421            context->genTextures(n, texturesPacked);
   1422        }
   1423        ANGLE_CAPTURE_GL(GenTextures, isCallValid, context, n, texturesPacked);
   1424    }
   1425    else
   1426    {
   1427        GenerateContextLostErrorOnCurrentGlobalContext();
   1428    }
   1429 }
   1430 
   1431 void GL_APIENTRY GL_GenerateMipmap(GLenum target)
   1432 {
   1433    Context *context = GetValidGlobalContext();
   1434    EVENT(context, GLGenerateMipmap, "context = %d, target = %s", CID(context),
   1435          GLenumToString(GLESEnum::TextureTarget, target));
   1436 
   1437    if (context)
   1438    {
   1439        TextureType targetPacked = PackParam<TextureType>(target);
   1440        SCOPED_SHARE_CONTEXT_LOCK(context);
   1441        bool isCallValid =
   1442            (context->skipValidation() ||
   1443             ValidateGenerateMipmap(context, angle::EntryPoint::GLGenerateMipmap, targetPacked));
   1444        if (isCallValid)
   1445        {
   1446            context->generateMipmap(targetPacked);
   1447        }
   1448        ANGLE_CAPTURE_GL(GenerateMipmap, isCallValid, context, targetPacked);
   1449    }
   1450    else
   1451    {
   1452        GenerateContextLostErrorOnCurrentGlobalContext();
   1453    }
   1454 }
   1455 
   1456 void GL_APIENTRY GL_GetActiveAttrib(GLuint program,
   1457                                    GLuint index,
   1458                                    GLsizei bufSize,
   1459                                    GLsizei *length,
   1460                                    GLint *size,
   1461                                    GLenum *type,
   1462                                    GLchar *name)
   1463 {
   1464    Context *context = GetValidGlobalContext();
   1465    EVENT(context, GLGetActiveAttrib,
   1466          "context = %d, program = %u, index = %u, bufSize = %d, length = 0x%016" PRIxPTR
   1467          ", size = 0x%016" PRIxPTR ", type = 0x%016" PRIxPTR ", name = 0x%016" PRIxPTR "",
   1468          CID(context), program, index, bufSize, (uintptr_t)length, (uintptr_t)size,
   1469          (uintptr_t)type, (uintptr_t)name);
   1470 
   1471    if (context)
   1472    {
   1473        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
   1474        SCOPED_SHARE_CONTEXT_LOCK(context);
   1475        bool isCallValid =
   1476            (context->skipValidation() ||
   1477             ValidateGetActiveAttrib(context, angle::EntryPoint::GLGetActiveAttrib, programPacked,
   1478                                     index, bufSize, length, size, type, name));
   1479        if (isCallValid)
   1480        {
   1481            context->getActiveAttrib(programPacked, index, bufSize, length, size, type, name);
   1482        }
   1483        ANGLE_CAPTURE_GL(GetActiveAttrib, isCallValid, context, programPacked, index, bufSize,
   1484                         length, size, type, name);
   1485    }
   1486    else
   1487    {
   1488        GenerateContextLostErrorOnCurrentGlobalContext();
   1489    }
   1490 }
   1491 
   1492 void GL_APIENTRY GL_GetActiveUniform(GLuint program,
   1493                                     GLuint index,
   1494                                     GLsizei bufSize,
   1495                                     GLsizei *length,
   1496                                     GLint *size,
   1497                                     GLenum *type,
   1498                                     GLchar *name)
   1499 {
   1500    Context *context = GetValidGlobalContext();
   1501    EVENT(context, GLGetActiveUniform,
   1502          "context = %d, program = %u, index = %u, bufSize = %d, length = 0x%016" PRIxPTR
   1503          ", size = 0x%016" PRIxPTR ", type = 0x%016" PRIxPTR ", name = 0x%016" PRIxPTR "",
   1504          CID(context), program, index, bufSize, (uintptr_t)length, (uintptr_t)size,
   1505          (uintptr_t)type, (uintptr_t)name);
   1506 
   1507    if (context)
   1508    {
   1509        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
   1510        SCOPED_SHARE_CONTEXT_LOCK(context);
   1511        bool isCallValid =
   1512            (context->skipValidation() ||
   1513             ValidateGetActiveUniform(context, angle::EntryPoint::GLGetActiveUniform, programPacked,
   1514                                      index, bufSize, length, size, type, name));
   1515        if (isCallValid)
   1516        {
   1517            context->getActiveUniform(programPacked, index, bufSize, length, size, type, name);
   1518        }
   1519        ANGLE_CAPTURE_GL(GetActiveUniform, isCallValid, context, programPacked, index, bufSize,
   1520                         length, size, type, name);
   1521    }
   1522    else
   1523    {
   1524        GenerateContextLostErrorOnCurrentGlobalContext();
   1525    }
   1526 }
   1527 
   1528 void GL_APIENTRY GL_GetAttachedShaders(GLuint program,
   1529                                       GLsizei maxCount,
   1530                                       GLsizei *count,
   1531                                       GLuint *shaders)
   1532 {
   1533    Context *context = GetValidGlobalContext();
   1534    EVENT(context, GLGetAttachedShaders,
   1535          "context = %d, program = %u, maxCount = %d, count = 0x%016" PRIxPTR
   1536          ", shaders = 0x%016" PRIxPTR "",
   1537          CID(context), program, maxCount, (uintptr_t)count, (uintptr_t)shaders);
   1538 
   1539    if (context)
   1540    {
   1541        ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
   1542        ShaderProgramID *shadersPacked = PackParam<ShaderProgramID *>(shaders);
   1543        SCOPED_SHARE_CONTEXT_LOCK(context);
   1544        bool isCallValid =
   1545            (context->skipValidation() ||
   1546             ValidateGetAttachedShaders(context, angle::EntryPoint::GLGetAttachedShaders,
   1547                                        programPacked, maxCount, count, shadersPacked));
   1548        if (isCallValid)
   1549        {
   1550            context->getAttachedShaders(programPacked, maxCount, count, shadersPacked);
   1551        }
   1552        ANGLE_CAPTURE_GL(GetAttachedShaders, isCallValid, context, programPacked, maxCount, count,
   1553                         shadersPacked);
   1554    }
   1555    else
   1556    {
   1557        GenerateContextLostErrorOnCurrentGlobalContext();
   1558    }
   1559 }
   1560 
   1561 GLint GL_APIENTRY GL_GetAttribLocation(GLuint program, const GLchar *name)
   1562 {
   1563    Context *context = GetValidGlobalContext();
   1564    EVENT(context, GLGetAttribLocation, "context = %d, program = %u, name = 0x%016" PRIxPTR "",
   1565          CID(context), program, (uintptr_t)name);
   1566 
   1567    GLint returnValue;
   1568    if (context)
   1569    {
   1570        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
   1571        SCOPED_SHARE_CONTEXT_LOCK(context);
   1572        bool isCallValid =
   1573            (context->skipValidation() ||
   1574             ValidateGetAttribLocation(context, angle::EntryPoint::GLGetAttribLocation,
   1575                                       programPacked, name));
   1576        if (isCallValid)
   1577        {
   1578            returnValue = context->getAttribLocation(programPacked, name);
   1579        }
   1580        else
   1581        {
   1582            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetAttribLocation, GLint>();
   1583        }
   1584        ANGLE_CAPTURE_GL(GetAttribLocation, isCallValid, context, programPacked, name, returnValue);
   1585    }
   1586    else
   1587    {
   1588        GenerateContextLostErrorOnCurrentGlobalContext();
   1589        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetAttribLocation, GLint>();
   1590    }
   1591    return returnValue;
   1592 }
   1593 
   1594 void GL_APIENTRY GL_GetBooleanv(GLenum pname, GLboolean *data)
   1595 {
   1596    Context *context = GetValidGlobalContext();
   1597    EVENT(context, GLGetBooleanv, "context = %d, pname = %s, data = 0x%016" PRIxPTR "",
   1598          CID(context), GLenumToString(GLESEnum::GetPName, pname), (uintptr_t)data);
   1599 
   1600    if (context)
   1601    {
   1602        SCOPED_SHARE_CONTEXT_LOCK(context);
   1603        bool isCallValid =
   1604            (context->skipValidation() ||
   1605             ValidateGetBooleanv(context, angle::EntryPoint::GLGetBooleanv, pname, data));
   1606        if (isCallValid)
   1607        {
   1608            context->getBooleanv(pname, data);
   1609        }
   1610        ANGLE_CAPTURE_GL(GetBooleanv, isCallValid, context, pname, data);
   1611    }
   1612    else
   1613    {
   1614        GenerateContextLostErrorOnCurrentGlobalContext();
   1615    }
   1616 }
   1617 
   1618 void GL_APIENTRY GL_GetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
   1619 {
   1620    Context *context = GetValidGlobalContext();
   1621    EVENT(context, GLGetBufferParameteriv,
   1622          "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
   1623          GLenumToString(GLESEnum::BufferTargetARB, target),
   1624          GLenumToString(GLESEnum::AllEnums, pname), (uintptr_t)params);
   1625 
   1626    if (context)
   1627    {
   1628        BufferBinding targetPacked = PackParam<BufferBinding>(target);
   1629        SCOPED_SHARE_CONTEXT_LOCK(context);
   1630        bool isCallValid =
   1631            (context->skipValidation() ||
   1632             ValidateGetBufferParameteriv(context, angle::EntryPoint::GLGetBufferParameteriv,
   1633                                          targetPacked, pname, params));
   1634        if (isCallValid)
   1635        {
   1636            context->getBufferParameteriv(targetPacked, pname, params);
   1637        }
   1638        ANGLE_CAPTURE_GL(GetBufferParameteriv, isCallValid, context, targetPacked, pname, params);
   1639    }
   1640    else
   1641    {
   1642        GenerateContextLostErrorOnCurrentGlobalContext();
   1643    }
   1644 }
   1645 
   1646 GLenum GL_APIENTRY GL_GetError()
   1647 {
   1648    Context *context = GetGlobalContext();
   1649    EVENT(context, GLGetError, "context = %d", CID(context));
   1650 
   1651    GLenum returnValue;
   1652    if (context)
   1653    {
   1654        SCOPED_SHARE_CONTEXT_LOCK(context);
   1655        bool isCallValid =
   1656            (context->skipValidation() || ValidateGetError(context, angle::EntryPoint::GLGetError));
   1657        if (isCallValid)
   1658        {
   1659            returnValue = context->getError();
   1660        }
   1661        else
   1662        {
   1663            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetError, GLenum>();
   1664        }
   1665        ANGLE_CAPTURE_GL(GetError, isCallValid, context, returnValue);
   1666    }
   1667    else
   1668    {
   1669 
   1670        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetError, GLenum>();
   1671    }
   1672    return returnValue;
   1673 }
   1674 
   1675 void GL_APIENTRY GL_GetFloatv(GLenum pname, GLfloat *data)
   1676 {
   1677    Context *context = GetValidGlobalContext();
   1678    EVENT(context, GLGetFloatv, "context = %d, pname = %s, data = 0x%016" PRIxPTR "", CID(context),
   1679          GLenumToString(GLESEnum::GetPName, pname), (uintptr_t)data);
   1680 
   1681    if (context)
   1682    {
   1683        SCOPED_SHARE_CONTEXT_LOCK(context);
   1684        bool isCallValid =
   1685            (context->skipValidation() ||
   1686             ValidateGetFloatv(context, angle::EntryPoint::GLGetFloatv, pname, data));
   1687        if (isCallValid)
   1688        {
   1689            context->getFloatv(pname, data);
   1690        }
   1691        ANGLE_CAPTURE_GL(GetFloatv, isCallValid, context, pname, data);
   1692    }
   1693    else
   1694    {
   1695        GenerateContextLostErrorOnCurrentGlobalContext();
   1696    }
   1697 }
   1698 
   1699 void GL_APIENTRY GL_GetFramebufferAttachmentParameteriv(GLenum target,
   1700                                                        GLenum attachment,
   1701                                                        GLenum pname,
   1702                                                        GLint *params)
   1703 {
   1704    Context *context = GetValidGlobalContext();
   1705    EVENT(context, GLGetFramebufferAttachmentParameteriv,
   1706          "context = %d, target = %s, attachment = %s, pname = %s, params = 0x%016" PRIxPTR "",
   1707          CID(context), GLenumToString(GLESEnum::FramebufferTarget, target),
   1708          GLenumToString(GLESEnum::FramebufferAttachment, attachment),
   1709          GLenumToString(GLESEnum::FramebufferAttachmentParameterName, pname), (uintptr_t)params);
   1710 
   1711    if (context)
   1712    {
   1713        SCOPED_SHARE_CONTEXT_LOCK(context);
   1714        bool isCallValid = (context->skipValidation() ||
   1715                            ValidateGetFramebufferAttachmentParameteriv(
   1716                                context, angle::EntryPoint::GLGetFramebufferAttachmentParameteriv,
   1717                                target, attachment, pname, params));
   1718        if (isCallValid)
   1719        {
   1720            context->getFramebufferAttachmentParameteriv(target, attachment, pname, params);
   1721        }
   1722        ANGLE_CAPTURE_GL(GetFramebufferAttachmentParameteriv, isCallValid, context, target,
   1723                         attachment, pname, params);
   1724    }
   1725    else
   1726    {
   1727        GenerateContextLostErrorOnCurrentGlobalContext();
   1728    }
   1729 }
   1730 
   1731 void GL_APIENTRY GL_GetIntegerv(GLenum pname, GLint *data)
   1732 {
   1733    Context *context = GetValidGlobalContext();
   1734    EVENT(context, GLGetIntegerv, "context = %d, pname = %s, data = 0x%016" PRIxPTR "",
   1735          CID(context), GLenumToString(GLESEnum::GetPName, pname), (uintptr_t)data);
   1736 
   1737    if (context)
   1738    {
   1739        SCOPED_SHARE_CONTEXT_LOCK(context);
   1740        bool isCallValid =
   1741            (context->skipValidation() ||
   1742             ValidateGetIntegerv(context, angle::EntryPoint::GLGetIntegerv, pname, data));
   1743        if (isCallValid)
   1744        {
   1745            context->getIntegerv(pname, data);
   1746        }
   1747        ANGLE_CAPTURE_GL(GetIntegerv, isCallValid, context, pname, data);
   1748    }
   1749    else
   1750    {
   1751        GenerateContextLostErrorOnCurrentGlobalContext();
   1752    }
   1753 }
   1754 
   1755 void GL_APIENTRY GL_GetProgramInfoLog(GLuint program,
   1756                                      GLsizei bufSize,
   1757                                      GLsizei *length,
   1758                                      GLchar *infoLog)
   1759 {
   1760    Context *context = GetValidGlobalContext();
   1761    EVENT(context, GLGetProgramInfoLog,
   1762          "context = %d, program = %u, bufSize = %d, length = 0x%016" PRIxPTR
   1763          ", infoLog = 0x%016" PRIxPTR "",
   1764          CID(context), program, bufSize, (uintptr_t)length, (uintptr_t)infoLog);
   1765 
   1766    if (context)
   1767    {
   1768        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
   1769        SCOPED_SHARE_CONTEXT_LOCK(context);
   1770        bool isCallValid =
   1771            (context->skipValidation() ||
   1772             ValidateGetProgramInfoLog(context, angle::EntryPoint::GLGetProgramInfoLog,
   1773                                       programPacked, bufSize, length, infoLog));
   1774        if (isCallValid)
   1775        {
   1776            context->getProgramInfoLog(programPacked, bufSize, length, infoLog);
   1777        }
   1778        ANGLE_CAPTURE_GL(GetProgramInfoLog, isCallValid, context, programPacked, bufSize, length,
   1779                         infoLog);
   1780    }
   1781    else
   1782    {
   1783        GenerateContextLostErrorOnCurrentGlobalContext();
   1784    }
   1785 }
   1786 
   1787 void GL_APIENTRY GL_GetProgramiv(GLuint program, GLenum pname, GLint *params)
   1788 {
   1789    Context *context = GetGlobalContext();
   1790    EVENT(context, GLGetProgramiv,
   1791          "context = %d, program = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
   1792          program, GLenumToString(GLESEnum::ProgramPropertyARB, pname), (uintptr_t)params);
   1793 
   1794    if (context)
   1795    {
   1796        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
   1797        SCOPED_SHARE_CONTEXT_LOCK(context);
   1798        bool isCallValid = (context->skipValidation() ||
   1799                            ValidateGetProgramiv(context, angle::EntryPoint::GLGetProgramiv,
   1800                                                 programPacked, pname, params));
   1801        if (isCallValid)
   1802        {
   1803            context->getProgramiv(programPacked, pname, params);
   1804        }
   1805        ANGLE_CAPTURE_GL(GetProgramiv, isCallValid, context, programPacked, pname, params);
   1806    }
   1807    else
   1808    {}
   1809 }
   1810 
   1811 void GL_APIENTRY GL_GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
   1812 {
   1813    Context *context = GetValidGlobalContext();
   1814    EVENT(context, GLGetRenderbufferParameteriv,
   1815          "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
   1816          GLenumToString(GLESEnum::RenderbufferTarget, target),
   1817          GLenumToString(GLESEnum::RenderbufferParameterName, pname), (uintptr_t)params);
   1818 
   1819    if (context)
   1820    {
   1821        SCOPED_SHARE_CONTEXT_LOCK(context);
   1822        bool isCallValid =
   1823            (context->skipValidation() ||
   1824             ValidateGetRenderbufferParameteriv(
   1825                 context, angle::EntryPoint::GLGetRenderbufferParameteriv, target, pname, params));
   1826        if (isCallValid)
   1827        {
   1828            context->getRenderbufferParameteriv(target, pname, params);
   1829        }
   1830        ANGLE_CAPTURE_GL(GetRenderbufferParameteriv, isCallValid, context, target, pname, params);
   1831    }
   1832    else
   1833    {
   1834        GenerateContextLostErrorOnCurrentGlobalContext();
   1835    }
   1836 }
   1837 
   1838 void GL_APIENTRY GL_GetShaderInfoLog(GLuint shader,
   1839                                     GLsizei bufSize,
   1840                                     GLsizei *length,
   1841                                     GLchar *infoLog)
   1842 {
   1843    Context *context = GetValidGlobalContext();
   1844    EVENT(context, GLGetShaderInfoLog,
   1845          "context = %d, shader = %u, bufSize = %d, length = 0x%016" PRIxPTR
   1846          ", infoLog = 0x%016" PRIxPTR "",
   1847          CID(context), shader, bufSize, (uintptr_t)length, (uintptr_t)infoLog);
   1848 
   1849    if (context)
   1850    {
   1851        ShaderProgramID shaderPacked = PackParam<ShaderProgramID>(shader);
   1852        SCOPED_SHARE_CONTEXT_LOCK(context);
   1853        bool isCallValid = (context->skipValidation() ||
   1854                            ValidateGetShaderInfoLog(context, angle::EntryPoint::GLGetShaderInfoLog,
   1855                                                     shaderPacked, bufSize, length, infoLog));
   1856        if (isCallValid)
   1857        {
   1858            context->getShaderInfoLog(shaderPacked, bufSize, length, infoLog);
   1859        }
   1860        ANGLE_CAPTURE_GL(GetShaderInfoLog, isCallValid, context, shaderPacked, bufSize, length,
   1861                         infoLog);
   1862    }
   1863    else
   1864    {
   1865        GenerateContextLostErrorOnCurrentGlobalContext();
   1866    }
   1867 }
   1868 
   1869 void GL_APIENTRY GL_GetShaderPrecisionFormat(GLenum shadertype,
   1870                                             GLenum precisiontype,
   1871                                             GLint *range,
   1872                                             GLint *precision)
   1873 {
   1874    Context *context = GetValidGlobalContext();
   1875    EVENT(context, GLGetShaderPrecisionFormat,
   1876          "context = %d, shadertype = %s, precisiontype = %s, range = 0x%016" PRIxPTR
   1877          ", precision = 0x%016" PRIxPTR "",
   1878          CID(context), GLenumToString(GLESEnum::ShaderType, shadertype),
   1879          GLenumToString(GLESEnum::PrecisionType, precisiontype), (uintptr_t)range,
   1880          (uintptr_t)precision);
   1881 
   1882    if (context)
   1883    {
   1884        SCOPED_SHARE_CONTEXT_LOCK(context);
   1885        bool isCallValid = (context->skipValidation() ||
   1886                            ValidateGetShaderPrecisionFormat(
   1887                                context, angle::EntryPoint::GLGetShaderPrecisionFormat, shadertype,
   1888                                precisiontype, range, precision));
   1889        if (isCallValid)
   1890        {
   1891            context->getShaderPrecisionFormat(shadertype, precisiontype, range, precision);
   1892        }
   1893        ANGLE_CAPTURE_GL(GetShaderPrecisionFormat, isCallValid, context, shadertype, precisiontype,
   1894                         range, precision);
   1895    }
   1896    else
   1897    {
   1898        GenerateContextLostErrorOnCurrentGlobalContext();
   1899    }
   1900 }
   1901 
   1902 void GL_APIENTRY GL_GetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
   1903 {
   1904    Context *context = GetValidGlobalContext();
   1905    EVENT(context, GLGetShaderSource,
   1906          "context = %d, shader = %u, bufSize = %d, length = 0x%016" PRIxPTR
   1907          ", source = 0x%016" PRIxPTR "",
   1908          CID(context), shader, bufSize, (uintptr_t)length, (uintptr_t)source);
   1909 
   1910    if (context)
   1911    {
   1912        ShaderProgramID shaderPacked = PackParam<ShaderProgramID>(shader);
   1913        SCOPED_SHARE_CONTEXT_LOCK(context);
   1914        bool isCallValid = (context->skipValidation() ||
   1915                            ValidateGetShaderSource(context, angle::EntryPoint::GLGetShaderSource,
   1916                                                    shaderPacked, bufSize, length, source));
   1917        if (isCallValid)
   1918        {
   1919            context->getShaderSource(shaderPacked, bufSize, length, source);
   1920        }
   1921        ANGLE_CAPTURE_GL(GetShaderSource, isCallValid, context, shaderPacked, bufSize, length,
   1922                         source);
   1923    }
   1924    else
   1925    {
   1926        GenerateContextLostErrorOnCurrentGlobalContext();
   1927    }
   1928 }
   1929 
   1930 void GL_APIENTRY GL_GetShaderiv(GLuint shader, GLenum pname, GLint *params)
   1931 {
   1932    Context *context = GetGlobalContext();
   1933    EVENT(context, GLGetShaderiv,
   1934          "context = %d, shader = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), shader,
   1935          GLenumToString(GLESEnum::ShaderParameterName, pname), (uintptr_t)params);
   1936 
   1937    if (context)
   1938    {
   1939        ShaderProgramID shaderPacked = PackParam<ShaderProgramID>(shader);
   1940        SCOPED_SHARE_CONTEXT_LOCK(context);
   1941        bool isCallValid = (context->skipValidation() ||
   1942                            ValidateGetShaderiv(context, angle::EntryPoint::GLGetShaderiv,
   1943                                                shaderPacked, pname, params));
   1944        if (isCallValid)
   1945        {
   1946            context->getShaderiv(shaderPacked, pname, params);
   1947        }
   1948        ANGLE_CAPTURE_GL(GetShaderiv, isCallValid, context, shaderPacked, pname, params);
   1949    }
   1950    else
   1951    {}
   1952 }
   1953 
   1954 const GLubyte *GL_APIENTRY GL_GetString(GLenum name)
   1955 {
   1956    Context *context = GetValidGlobalContext();
   1957    EVENT(context, GLGetString, "context = %d, name = %s", CID(context),
   1958          GLenumToString(GLESEnum::StringName, name));
   1959 
   1960    const GLubyte *returnValue;
   1961    if (context)
   1962    {
   1963        SCOPED_SHARE_CONTEXT_LOCK(context);
   1964        bool isCallValid = (context->skipValidation() ||
   1965                            ValidateGetString(context, angle::EntryPoint::GLGetString, name));
   1966        if (isCallValid)
   1967        {
   1968            returnValue = context->getString(name);
   1969        }
   1970        else
   1971        {
   1972            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetString, const GLubyte *>();
   1973        }
   1974        ANGLE_CAPTURE_GL(GetString, isCallValid, context, name, returnValue);
   1975    }
   1976    else
   1977    {
   1978        GenerateContextLostErrorOnCurrentGlobalContext();
   1979        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetString, const GLubyte *>();
   1980    }
   1981    return returnValue;
   1982 }
   1983 
   1984 void GL_APIENTRY GL_GetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
   1985 {
   1986    Context *context = GetValidGlobalContext();
   1987    EVENT(context, GLGetTexParameterfv,
   1988          "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
   1989          GLenumToString(GLESEnum::TextureTarget, target),
   1990          GLenumToString(GLESEnum::GetTextureParameter, pname), (uintptr_t)params);
   1991 
   1992    if (context)
   1993    {
   1994        TextureType targetPacked = PackParam<TextureType>(target);
   1995        SCOPED_SHARE_CONTEXT_LOCK(context);
   1996        bool isCallValid =
   1997            (context->skipValidation() ||
   1998             ValidateGetTexParameterfv(context, angle::EntryPoint::GLGetTexParameterfv,
   1999                                       targetPacked, pname, params));
   2000        if (isCallValid)
   2001        {
   2002            context->getTexParameterfv(targetPacked, pname, params);
   2003        }
   2004        ANGLE_CAPTURE_GL(GetTexParameterfv, isCallValid, context, targetPacked, pname, params);
   2005    }
   2006    else
   2007    {
   2008        GenerateContextLostErrorOnCurrentGlobalContext();
   2009    }
   2010 }
   2011 
   2012 void GL_APIENTRY GL_GetTexParameteriv(GLenum target, GLenum pname, GLint *params)
   2013 {
   2014    Context *context = GetValidGlobalContext();
   2015    EVENT(context, GLGetTexParameteriv,
   2016          "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
   2017          GLenumToString(GLESEnum::TextureTarget, target),
   2018          GLenumToString(GLESEnum::GetTextureParameter, pname), (uintptr_t)params);
   2019 
   2020    if (context)
   2021    {
   2022        TextureType targetPacked = PackParam<TextureType>(target);
   2023        SCOPED_SHARE_CONTEXT_LOCK(context);
   2024        bool isCallValid =
   2025            (context->skipValidation() ||
   2026             ValidateGetTexParameteriv(context, angle::EntryPoint::GLGetTexParameteriv,
   2027                                       targetPacked, pname, params));
   2028        if (isCallValid)
   2029        {
   2030            context->getTexParameteriv(targetPacked, pname, params);
   2031        }
   2032        ANGLE_CAPTURE_GL(GetTexParameteriv, isCallValid, context, targetPacked, pname, params);
   2033    }
   2034    else
   2035    {
   2036        GenerateContextLostErrorOnCurrentGlobalContext();
   2037    }
   2038 }
   2039 
   2040 GLint GL_APIENTRY GL_GetUniformLocation(GLuint program, const GLchar *name)
   2041 {
   2042    Context *context = GetValidGlobalContext();
   2043    EVENT(context, GLGetUniformLocation, "context = %d, program = %u, name = 0x%016" PRIxPTR "",
   2044          CID(context), program, (uintptr_t)name);
   2045 
   2046    GLint returnValue;
   2047    if (context)
   2048    {
   2049        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
   2050        SCOPED_SHARE_CONTEXT_LOCK(context);
   2051        bool isCallValid =
   2052            (context->skipValidation() ||
   2053             ValidateGetUniformLocation(context, angle::EntryPoint::GLGetUniformLocation,
   2054                                        programPacked, name));
   2055        if (isCallValid)
   2056        {
   2057            returnValue = context->getUniformLocation(programPacked, name);
   2058        }
   2059        else
   2060        {
   2061            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetUniformLocation, GLint>();
   2062        }
   2063        ANGLE_CAPTURE_GL(GetUniformLocation, isCallValid, context, programPacked, name,
   2064                         returnValue);
   2065    }
   2066    else
   2067    {
   2068        GenerateContextLostErrorOnCurrentGlobalContext();
   2069        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetUniformLocation, GLint>();
   2070    }
   2071    return returnValue;
   2072 }
   2073 
   2074 void GL_APIENTRY GL_GetUniformfv(GLuint program, GLint location, GLfloat *params)
   2075 {
   2076    Context *context = GetValidGlobalContext();
   2077    EVENT(context, GLGetUniformfv,
   2078          "context = %d, program = %u, location = %d, params = 0x%016" PRIxPTR "", CID(context),
   2079          program, location, (uintptr_t)params);
   2080 
   2081    if (context)
   2082    {
   2083        ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
   2084        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   2085        SCOPED_SHARE_CONTEXT_LOCK(context);
   2086        bool isCallValid = (context->skipValidation() ||
   2087                            ValidateGetUniformfv(context, angle::EntryPoint::GLGetUniformfv,
   2088                                                 programPacked, locationPacked, params));
   2089        if (isCallValid)
   2090        {
   2091            context->getUniformfv(programPacked, locationPacked, params);
   2092        }
   2093        ANGLE_CAPTURE_GL(GetUniformfv, isCallValid, context, programPacked, locationPacked, params);
   2094    }
   2095    else
   2096    {
   2097        GenerateContextLostErrorOnCurrentGlobalContext();
   2098    }
   2099 }
   2100 
   2101 void GL_APIENTRY GL_GetUniformiv(GLuint program, GLint location, GLint *params)
   2102 {
   2103    Context *context = GetValidGlobalContext();
   2104    EVENT(context, GLGetUniformiv,
   2105          "context = %d, program = %u, location = %d, params = 0x%016" PRIxPTR "", CID(context),
   2106          program, location, (uintptr_t)params);
   2107 
   2108    if (context)
   2109    {
   2110        ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
   2111        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   2112        SCOPED_SHARE_CONTEXT_LOCK(context);
   2113        bool isCallValid = (context->skipValidation() ||
   2114                            ValidateGetUniformiv(context, angle::EntryPoint::GLGetUniformiv,
   2115                                                 programPacked, locationPacked, params));
   2116        if (isCallValid)
   2117        {
   2118            context->getUniformiv(programPacked, locationPacked, params);
   2119        }
   2120        ANGLE_CAPTURE_GL(GetUniformiv, isCallValid, context, programPacked, locationPacked, params);
   2121    }
   2122    else
   2123    {
   2124        GenerateContextLostErrorOnCurrentGlobalContext();
   2125    }
   2126 }
   2127 
   2128 void GL_APIENTRY GL_GetVertexAttribPointerv(GLuint index, GLenum pname, void **pointer)
   2129 {
   2130    Context *context = GetValidGlobalContext();
   2131    EVENT(context, GLGetVertexAttribPointerv,
   2132          "context = %d, index = %u, pname = %s, pointer = 0x%016" PRIxPTR "", CID(context), index,
   2133          GLenumToString(GLESEnum::AllEnums, pname), (uintptr_t)pointer);
   2134 
   2135    if (context)
   2136    {
   2137        SCOPED_SHARE_CONTEXT_LOCK(context);
   2138        bool isCallValid =
   2139            (context->skipValidation() ||
   2140             ValidateGetVertexAttribPointerv(context, angle::EntryPoint::GLGetVertexAttribPointerv,
   2141                                             index, pname, pointer));
   2142        if (isCallValid)
   2143        {
   2144            context->getVertexAttribPointerv(index, pname, pointer);
   2145        }
   2146        ANGLE_CAPTURE_GL(GetVertexAttribPointerv, isCallValid, context, index, pname, pointer);
   2147    }
   2148    else
   2149    {
   2150        GenerateContextLostErrorOnCurrentGlobalContext();
   2151    }
   2152 }
   2153 
   2154 void GL_APIENTRY GL_GetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
   2155 {
   2156    Context *context = GetValidGlobalContext();
   2157    EVENT(context, GLGetVertexAttribfv,
   2158          "context = %d, index = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), index,
   2159          GLenumToString(GLESEnum::AllEnums, pname), (uintptr_t)params);
   2160 
   2161    if (context)
   2162    {
   2163        SCOPED_SHARE_CONTEXT_LOCK(context);
   2164        bool isCallValid =
   2165            (context->skipValidation() ||
   2166             ValidateGetVertexAttribfv(context, angle::EntryPoint::GLGetVertexAttribfv, index,
   2167                                       pname, params));
   2168        if (isCallValid)
   2169        {
   2170            context->getVertexAttribfv(index, pname, params);
   2171        }
   2172        ANGLE_CAPTURE_GL(GetVertexAttribfv, isCallValid, context, index, pname, params);
   2173    }
   2174    else
   2175    {
   2176        GenerateContextLostErrorOnCurrentGlobalContext();
   2177    }
   2178 }
   2179 
   2180 void GL_APIENTRY GL_GetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
   2181 {
   2182    Context *context = GetValidGlobalContext();
   2183    EVENT(context, GLGetVertexAttribiv,
   2184          "context = %d, index = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), index,
   2185          GLenumToString(GLESEnum::AllEnums, pname), (uintptr_t)params);
   2186 
   2187    if (context)
   2188    {
   2189        SCOPED_SHARE_CONTEXT_LOCK(context);
   2190        bool isCallValid =
   2191            (context->skipValidation() ||
   2192             ValidateGetVertexAttribiv(context, angle::EntryPoint::GLGetVertexAttribiv, index,
   2193                                       pname, params));
   2194        if (isCallValid)
   2195        {
   2196            context->getVertexAttribiv(index, pname, params);
   2197        }
   2198        ANGLE_CAPTURE_GL(GetVertexAttribiv, isCallValid, context, index, pname, params);
   2199    }
   2200    else
   2201    {
   2202        GenerateContextLostErrorOnCurrentGlobalContext();
   2203    }
   2204 }
   2205 
   2206 void GL_APIENTRY GL_Hint(GLenum target, GLenum mode)
   2207 {
   2208    Context *context = GetValidGlobalContext();
   2209    EVENT(context, GLHint, "context = %d, target = %s, mode = %s", CID(context),
   2210          GLenumToString(GLESEnum::HintTarget, target), GLenumToString(GLESEnum::HintMode, mode));
   2211 
   2212    if (context)
   2213    {
   2214        SCOPED_SHARE_CONTEXT_LOCK(context);
   2215        bool isCallValid = (context->skipValidation() ||
   2216                            ValidateHint(context, angle::EntryPoint::GLHint, target, mode));
   2217        if (isCallValid)
   2218        {
   2219            context->hint(target, mode);
   2220        }
   2221        ANGLE_CAPTURE_GL(Hint, isCallValid, context, target, mode);
   2222    }
   2223    else
   2224    {
   2225        GenerateContextLostErrorOnCurrentGlobalContext();
   2226    }
   2227 }
   2228 
   2229 GLboolean GL_APIENTRY GL_IsBuffer(GLuint buffer)
   2230 {
   2231    Context *context = GetValidGlobalContext();
   2232    EVENT(context, GLIsBuffer, "context = %d, buffer = %u", CID(context), buffer);
   2233 
   2234    GLboolean returnValue;
   2235    if (context)
   2236    {
   2237        BufferID bufferPacked = PackParam<BufferID>(buffer);
   2238        SCOPED_SHARE_CONTEXT_LOCK(context);
   2239        bool isCallValid = (context->skipValidation() ||
   2240                            ValidateIsBuffer(context, angle::EntryPoint::GLIsBuffer, bufferPacked));
   2241        if (isCallValid)
   2242        {
   2243            returnValue = context->isBuffer(bufferPacked);
   2244        }
   2245        else
   2246        {
   2247            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsBuffer, GLboolean>();
   2248        }
   2249        ANGLE_CAPTURE_GL(IsBuffer, isCallValid, context, bufferPacked, returnValue);
   2250    }
   2251    else
   2252    {
   2253        GenerateContextLostErrorOnCurrentGlobalContext();
   2254        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsBuffer, GLboolean>();
   2255    }
   2256    return returnValue;
   2257 }
   2258 
   2259 GLboolean GL_APIENTRY GL_IsEnabled(GLenum cap)
   2260 {
   2261    Context *context = GetValidGlobalContext();
   2262    EVENT(context, GLIsEnabled, "context = %d, cap = %s", CID(context),
   2263          GLenumToString(GLESEnum::EnableCap, cap));
   2264 
   2265    GLboolean returnValue;
   2266    if (context)
   2267    {
   2268        SCOPED_SHARE_CONTEXT_LOCK(context);
   2269        bool isCallValid = (context->skipValidation() ||
   2270                            ValidateIsEnabled(context, angle::EntryPoint::GLIsEnabled, cap));
   2271        if (isCallValid)
   2272        {
   2273            returnValue = context->isEnabled(cap);
   2274        }
   2275        else
   2276        {
   2277            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsEnabled, GLboolean>();
   2278        }
   2279        ANGLE_CAPTURE_GL(IsEnabled, isCallValid, context, cap, returnValue);
   2280    }
   2281    else
   2282    {
   2283        GenerateContextLostErrorOnCurrentGlobalContext();
   2284        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsEnabled, GLboolean>();
   2285    }
   2286    return returnValue;
   2287 }
   2288 
   2289 GLboolean GL_APIENTRY GL_IsFramebuffer(GLuint framebuffer)
   2290 {
   2291    Context *context = GetValidGlobalContext();
   2292    EVENT(context, GLIsFramebuffer, "context = %d, framebuffer = %u", CID(context), framebuffer);
   2293 
   2294    GLboolean returnValue;
   2295    if (context)
   2296    {
   2297        FramebufferID framebufferPacked = PackParam<FramebufferID>(framebuffer);
   2298        SCOPED_SHARE_CONTEXT_LOCK(context);
   2299        bool isCallValid =
   2300            (context->skipValidation() ||
   2301             ValidateIsFramebuffer(context, angle::EntryPoint::GLIsFramebuffer, framebufferPacked));
   2302        if (isCallValid)
   2303        {
   2304            returnValue = context->isFramebuffer(framebufferPacked);
   2305        }
   2306        else
   2307        {
   2308            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsFramebuffer, GLboolean>();
   2309        }
   2310        ANGLE_CAPTURE_GL(IsFramebuffer, isCallValid, context, framebufferPacked, returnValue);
   2311    }
   2312    else
   2313    {
   2314        GenerateContextLostErrorOnCurrentGlobalContext();
   2315        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsFramebuffer, GLboolean>();
   2316    }
   2317    return returnValue;
   2318 }
   2319 
   2320 GLboolean GL_APIENTRY GL_IsProgram(GLuint program)
   2321 {
   2322    Context *context = GetValidGlobalContext();
   2323    EVENT(context, GLIsProgram, "context = %d, program = %u", CID(context), program);
   2324 
   2325    GLboolean returnValue;
   2326    if (context)
   2327    {
   2328        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
   2329        SCOPED_SHARE_CONTEXT_LOCK(context);
   2330        bool isCallValid =
   2331            (context->skipValidation() ||
   2332             ValidateIsProgram(context, angle::EntryPoint::GLIsProgram, programPacked));
   2333        if (isCallValid)
   2334        {
   2335            returnValue = context->isProgram(programPacked);
   2336        }
   2337        else
   2338        {
   2339            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsProgram, GLboolean>();
   2340        }
   2341        ANGLE_CAPTURE_GL(IsProgram, isCallValid, context, programPacked, returnValue);
   2342    }
   2343    else
   2344    {
   2345        GenerateContextLostErrorOnCurrentGlobalContext();
   2346        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsProgram, GLboolean>();
   2347    }
   2348    return returnValue;
   2349 }
   2350 
   2351 GLboolean GL_APIENTRY GL_IsRenderbuffer(GLuint renderbuffer)
   2352 {
   2353    Context *context = GetValidGlobalContext();
   2354    EVENT(context, GLIsRenderbuffer, "context = %d, renderbuffer = %u", CID(context), renderbuffer);
   2355 
   2356    GLboolean returnValue;
   2357    if (context)
   2358    {
   2359        RenderbufferID renderbufferPacked = PackParam<RenderbufferID>(renderbuffer);
   2360        SCOPED_SHARE_CONTEXT_LOCK(context);
   2361        bool isCallValid = (context->skipValidation() ||
   2362                            ValidateIsRenderbuffer(context, angle::EntryPoint::GLIsRenderbuffer,
   2363                                                   renderbufferPacked));
   2364        if (isCallValid)
   2365        {
   2366            returnValue = context->isRenderbuffer(renderbufferPacked);
   2367        }
   2368        else
   2369        {
   2370            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsRenderbuffer, GLboolean>();
   2371        }
   2372        ANGLE_CAPTURE_GL(IsRenderbuffer, isCallValid, context, renderbufferPacked, returnValue);
   2373    }
   2374    else
   2375    {
   2376        GenerateContextLostErrorOnCurrentGlobalContext();
   2377        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsRenderbuffer, GLboolean>();
   2378    }
   2379    return returnValue;
   2380 }
   2381 
   2382 GLboolean GL_APIENTRY GL_IsShader(GLuint shader)
   2383 {
   2384    Context *context = GetValidGlobalContext();
   2385    EVENT(context, GLIsShader, "context = %d, shader = %u", CID(context), shader);
   2386 
   2387    GLboolean returnValue;
   2388    if (context)
   2389    {
   2390        ShaderProgramID shaderPacked = PackParam<ShaderProgramID>(shader);
   2391        SCOPED_SHARE_CONTEXT_LOCK(context);
   2392        bool isCallValid = (context->skipValidation() ||
   2393                            ValidateIsShader(context, angle::EntryPoint::GLIsShader, shaderPacked));
   2394        if (isCallValid)
   2395        {
   2396            returnValue = context->isShader(shaderPacked);
   2397        }
   2398        else
   2399        {
   2400            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsShader, GLboolean>();
   2401        }
   2402        ANGLE_CAPTURE_GL(IsShader, isCallValid, context, shaderPacked, returnValue);
   2403    }
   2404    else
   2405    {
   2406        GenerateContextLostErrorOnCurrentGlobalContext();
   2407        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsShader, GLboolean>();
   2408    }
   2409    return returnValue;
   2410 }
   2411 
   2412 GLboolean GL_APIENTRY GL_IsTexture(GLuint texture)
   2413 {
   2414    Context *context = GetValidGlobalContext();
   2415    EVENT(context, GLIsTexture, "context = %d, texture = %u", CID(context), texture);
   2416 
   2417    GLboolean returnValue;
   2418    if (context)
   2419    {
   2420        TextureID texturePacked = PackParam<TextureID>(texture);
   2421        SCOPED_SHARE_CONTEXT_LOCK(context);
   2422        bool isCallValid =
   2423            (context->skipValidation() ||
   2424             ValidateIsTexture(context, angle::EntryPoint::GLIsTexture, texturePacked));
   2425        if (isCallValid)
   2426        {
   2427            returnValue = context->isTexture(texturePacked);
   2428        }
   2429        else
   2430        {
   2431            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsTexture, GLboolean>();
   2432        }
   2433        ANGLE_CAPTURE_GL(IsTexture, isCallValid, context, texturePacked, returnValue);
   2434    }
   2435    else
   2436    {
   2437        GenerateContextLostErrorOnCurrentGlobalContext();
   2438        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsTexture, GLboolean>();
   2439    }
   2440    return returnValue;
   2441 }
   2442 
   2443 void GL_APIENTRY GL_LineWidth(GLfloat width)
   2444 {
   2445    Context *context = GetValidGlobalContext();
   2446    EVENT(context, GLLineWidth, "context = %d, width = %f", CID(context), width);
   2447 
   2448    if (context)
   2449    {
   2450        SCOPED_SHARE_CONTEXT_LOCK(context);
   2451        bool isCallValid = (context->skipValidation() ||
   2452                            ValidateLineWidth(context, angle::EntryPoint::GLLineWidth, width));
   2453        if (isCallValid)
   2454        {
   2455            context->lineWidth(width);
   2456        }
   2457        ANGLE_CAPTURE_GL(LineWidth, isCallValid, context, width);
   2458    }
   2459    else
   2460    {
   2461        GenerateContextLostErrorOnCurrentGlobalContext();
   2462    }
   2463 }
   2464 
   2465 void GL_APIENTRY GL_LinkProgram(GLuint program)
   2466 {
   2467    Context *context = GetValidGlobalContext();
   2468    EVENT(context, GLLinkProgram, "context = %d, program = %u", CID(context), program);
   2469 
   2470    if (context)
   2471    {
   2472        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
   2473        SCOPED_SHARE_CONTEXT_LOCK(context);
   2474        bool isCallValid =
   2475            (context->skipValidation() ||
   2476             ValidateLinkProgram(context, angle::EntryPoint::GLLinkProgram, programPacked));
   2477        if (isCallValid)
   2478        {
   2479            context->linkProgram(programPacked);
   2480        }
   2481        ANGLE_CAPTURE_GL(LinkProgram, isCallValid, context, programPacked);
   2482    }
   2483    else
   2484    {
   2485        GenerateContextLostErrorOnCurrentGlobalContext();
   2486    }
   2487 }
   2488 
   2489 void GL_APIENTRY GL_PixelStorei(GLenum pname, GLint param)
   2490 {
   2491    Context *context = GetValidGlobalContext();
   2492    EVENT(context, GLPixelStorei, "context = %d, pname = %s, param = %d", CID(context),
   2493          GLenumToString(GLESEnum::PixelStoreParameter, pname), param);
   2494 
   2495    if (context)
   2496    {
   2497        SCOPED_SHARE_CONTEXT_LOCK(context);
   2498        bool isCallValid =
   2499            (context->skipValidation() ||
   2500             ValidatePixelStorei(context, angle::EntryPoint::GLPixelStorei, pname, param));
   2501        if (isCallValid)
   2502        {
   2503            context->pixelStorei(pname, param);
   2504        }
   2505        ANGLE_CAPTURE_GL(PixelStorei, isCallValid, context, pname, param);
   2506    }
   2507    else
   2508    {
   2509        GenerateContextLostErrorOnCurrentGlobalContext();
   2510    }
   2511 }
   2512 
   2513 void GL_APIENTRY GL_PolygonOffset(GLfloat factor, GLfloat units)
   2514 {
   2515    Context *context = GetValidGlobalContext();
   2516    EVENT(context, GLPolygonOffset, "context = %d, factor = %f, units = %f", CID(context), factor,
   2517          units);
   2518 
   2519    if (context)
   2520    {
   2521        SCOPED_SHARE_CONTEXT_LOCK(context);
   2522        bool isCallValid =
   2523            (context->skipValidation() ||
   2524             ValidatePolygonOffset(context, angle::EntryPoint::GLPolygonOffset, factor, units));
   2525        if (isCallValid)
   2526        {
   2527            context->polygonOffset(factor, units);
   2528        }
   2529        ANGLE_CAPTURE_GL(PolygonOffset, isCallValid, context, factor, units);
   2530    }
   2531    else
   2532    {
   2533        GenerateContextLostErrorOnCurrentGlobalContext();
   2534    }
   2535 }
   2536 
   2537 void GL_APIENTRY GL_ReadPixels(GLint x,
   2538                               GLint y,
   2539                               GLsizei width,
   2540                               GLsizei height,
   2541                               GLenum format,
   2542                               GLenum type,
   2543                               void *pixels)
   2544 {
   2545    Context *context = GetValidGlobalContext();
   2546    EVENT(context, GLReadPixels,
   2547          "context = %d, x = %d, y = %d, width = %d, height = %d, format = %s, type = %s, pixels = "
   2548          "0x%016" PRIxPTR "",
   2549          CID(context), x, y, width, height, GLenumToString(GLESEnum::PixelFormat, format),
   2550          GLenumToString(GLESEnum::PixelType, type), (uintptr_t)pixels);
   2551 
   2552    if (context)
   2553    {
   2554        SCOPED_SHARE_CONTEXT_LOCK(context);
   2555        bool isCallValid = (context->skipValidation() ||
   2556                            ValidateReadPixels(context, angle::EntryPoint::GLReadPixels, x, y,
   2557                                               width, height, format, type, pixels));
   2558        if (isCallValid)
   2559        {
   2560            context->readPixels(x, y, width, height, format, type, pixels);
   2561        }
   2562        ANGLE_CAPTURE_GL(ReadPixels, isCallValid, context, x, y, width, height, format, type,
   2563                         pixels);
   2564    }
   2565    else
   2566    {
   2567        GenerateContextLostErrorOnCurrentGlobalContext();
   2568    }
   2569 }
   2570 
   2571 void GL_APIENTRY GL_ReleaseShaderCompiler()
   2572 {
   2573    Context *context = GetValidGlobalContext();
   2574    EVENT(context, GLReleaseShaderCompiler, "context = %d", CID(context));
   2575 
   2576    if (context)
   2577    {
   2578        SCOPED_SHARE_CONTEXT_LOCK(context);
   2579        bool isCallValid =
   2580            (context->skipValidation() ||
   2581             ValidateReleaseShaderCompiler(context, angle::EntryPoint::GLReleaseShaderCompiler));
   2582        if (isCallValid)
   2583        {
   2584            context->releaseShaderCompiler();
   2585        }
   2586        ANGLE_CAPTURE_GL(ReleaseShaderCompiler, isCallValid, context);
   2587    }
   2588    else
   2589    {
   2590        GenerateContextLostErrorOnCurrentGlobalContext();
   2591    }
   2592 }
   2593 
   2594 void GL_APIENTRY GL_RenderbufferStorage(GLenum target,
   2595                                        GLenum internalformat,
   2596                                        GLsizei width,
   2597                                        GLsizei height)
   2598 {
   2599    Context *context = GetValidGlobalContext();
   2600    EVENT(context, GLRenderbufferStorage,
   2601          "context = %d, target = %s, internalformat = %s, width = %d, height = %d", CID(context),
   2602          GLenumToString(GLESEnum::RenderbufferTarget, target),
   2603          GLenumToString(GLESEnum::InternalFormat, internalformat), width, height);
   2604 
   2605    if (context)
   2606    {
   2607        SCOPED_SHARE_CONTEXT_LOCK(context);
   2608        bool isCallValid =
   2609            (context->skipValidation() ||
   2610             ValidateRenderbufferStorage(context, angle::EntryPoint::GLRenderbufferStorage, target,
   2611                                         internalformat, width, height));
   2612        if (isCallValid)
   2613        {
   2614            context->renderbufferStorage(target, internalformat, width, height);
   2615        }
   2616        ANGLE_CAPTURE_GL(RenderbufferStorage, isCallValid, context, target, internalformat, width,
   2617                         height);
   2618    }
   2619    else
   2620    {
   2621        GenerateContextLostErrorOnCurrentGlobalContext();
   2622    }
   2623 }
   2624 
   2625 void GL_APIENTRY GL_SampleCoverage(GLfloat value, GLboolean invert)
   2626 {
   2627    Context *context = GetValidGlobalContext();
   2628    EVENT(context, GLSampleCoverage, "context = %d, value = %f, invert = %s", CID(context), value,
   2629          GLbooleanToString(invert));
   2630 
   2631    if (context)
   2632    {
   2633        SCOPED_SHARE_CONTEXT_LOCK(context);
   2634        bool isCallValid =
   2635            (context->skipValidation() ||
   2636             ValidateSampleCoverage(context, angle::EntryPoint::GLSampleCoverage, value, invert));
   2637        if (isCallValid)
   2638        {
   2639            context->sampleCoverage(value, invert);
   2640        }
   2641        ANGLE_CAPTURE_GL(SampleCoverage, isCallValid, context, value, invert);
   2642    }
   2643    else
   2644    {
   2645        GenerateContextLostErrorOnCurrentGlobalContext();
   2646    }
   2647 }
   2648 
   2649 void GL_APIENTRY GL_Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
   2650 {
   2651    Context *context = GetValidGlobalContext();
   2652    EVENT(context, GLScissor, "context = %d, x = %d, y = %d, width = %d, height = %d", CID(context),
   2653          x, y, width, height);
   2654 
   2655    if (context)
   2656    {
   2657        SCOPED_SHARE_CONTEXT_LOCK(context);
   2658        bool isCallValid =
   2659            (context->skipValidation() ||
   2660             ValidateScissor(context, angle::EntryPoint::GLScissor, x, y, width, height));
   2661        if (isCallValid)
   2662        {
   2663            context->scissor(x, y, width, height);
   2664        }
   2665        ANGLE_CAPTURE_GL(Scissor, isCallValid, context, x, y, width, height);
   2666    }
   2667    else
   2668    {
   2669        GenerateContextLostErrorOnCurrentGlobalContext();
   2670    }
   2671 }
   2672 
   2673 void GL_APIENTRY GL_ShaderBinary(GLsizei count,
   2674                                 const GLuint *shaders,
   2675                                 GLenum binaryFormat,
   2676                                 const void *binary,
   2677                                 GLsizei length)
   2678 {
   2679    Context *context = GetValidGlobalContext();
   2680    EVENT(context, GLShaderBinary,
   2681          "context = %d, count = %d, shaders = 0x%016" PRIxPTR
   2682          ", binaryFormat = %s, binary = 0x%016" PRIxPTR ", length = %d",
   2683          CID(context), count, (uintptr_t)shaders,
   2684          GLenumToString(GLESEnum::ShaderBinaryFormat, binaryFormat), (uintptr_t)binary, length);
   2685 
   2686    if (context)
   2687    {
   2688        const ShaderProgramID *shadersPacked = PackParam<const ShaderProgramID *>(shaders);
   2689        SCOPED_SHARE_CONTEXT_LOCK(context);
   2690        bool isCallValid = (context->skipValidation() ||
   2691                            ValidateShaderBinary(context, angle::EntryPoint::GLShaderBinary, count,
   2692                                                 shadersPacked, binaryFormat, binary, length));
   2693        if (isCallValid)
   2694        {
   2695            context->shaderBinary(count, shadersPacked, binaryFormat, binary, length);
   2696        }
   2697        ANGLE_CAPTURE_GL(ShaderBinary, isCallValid, context, count, shadersPacked, binaryFormat,
   2698                         binary, length);
   2699    }
   2700    else
   2701    {
   2702        GenerateContextLostErrorOnCurrentGlobalContext();
   2703    }
   2704 }
   2705 
   2706 void GL_APIENTRY GL_ShaderSource(GLuint shader,
   2707                                 GLsizei count,
   2708                                 const GLchar *const *string,
   2709                                 const GLint *length)
   2710 {
   2711    Context *context = GetValidGlobalContext();
   2712    EVENT(context, GLShaderSource,
   2713          "context = %d, shader = %u, count = %d, string = 0x%016" PRIxPTR
   2714          ", length = 0x%016" PRIxPTR "",
   2715          CID(context), shader, count, (uintptr_t)string, (uintptr_t)length);
   2716 
   2717    if (context)
   2718    {
   2719        ShaderProgramID shaderPacked = PackParam<ShaderProgramID>(shader);
   2720        SCOPED_SHARE_CONTEXT_LOCK(context);
   2721        bool isCallValid = (context->skipValidation() ||
   2722                            ValidateShaderSource(context, angle::EntryPoint::GLShaderSource,
   2723                                                 shaderPacked, count, string, length));
   2724        if (isCallValid)
   2725        {
   2726            context->shaderSource(shaderPacked, count, string, length);
   2727        }
   2728        ANGLE_CAPTURE_GL(ShaderSource, isCallValid, context, shaderPacked, count, string, length);
   2729    }
   2730    else
   2731    {
   2732        GenerateContextLostErrorOnCurrentGlobalContext();
   2733    }
   2734 }
   2735 
   2736 void GL_APIENTRY GL_StencilFunc(GLenum func, GLint ref, GLuint mask)
   2737 {
   2738    Context *context = GetValidGlobalContext();
   2739    EVENT(context, GLStencilFunc, "context = %d, func = %s, ref = %d, mask = %u", CID(context),
   2740          GLenumToString(GLESEnum::StencilFunction, func), ref, mask);
   2741 
   2742    if (context)
   2743    {
   2744        SCOPED_SHARE_CONTEXT_LOCK(context);
   2745        bool isCallValid =
   2746            (context->skipValidation() ||
   2747             ValidateStencilFunc(context, angle::EntryPoint::GLStencilFunc, func, ref, mask));
   2748        if (isCallValid)
   2749        {
   2750            context->stencilFunc(func, ref, mask);
   2751        }
   2752        ANGLE_CAPTURE_GL(StencilFunc, isCallValid, context, func, ref, mask);
   2753    }
   2754    else
   2755    {
   2756        GenerateContextLostErrorOnCurrentGlobalContext();
   2757    }
   2758 }
   2759 
   2760 void GL_APIENTRY GL_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
   2761 {
   2762    Context *context = GetValidGlobalContext();
   2763    EVENT(context, GLStencilFuncSeparate, "context = %d, face = %s, func = %s, ref = %d, mask = %u",
   2764          CID(context), GLenumToString(GLESEnum::TriangleFace, face),
   2765          GLenumToString(GLESEnum::StencilFunction, func), ref, mask);
   2766 
   2767    if (context)
   2768    {
   2769        SCOPED_SHARE_CONTEXT_LOCK(context);
   2770        bool isCallValid =
   2771            (context->skipValidation() ||
   2772             ValidateStencilFuncSeparate(context, angle::EntryPoint::GLStencilFuncSeparate, face,
   2773                                         func, ref, mask));
   2774        if (isCallValid)
   2775        {
   2776            context->stencilFuncSeparate(face, func, ref, mask);
   2777        }
   2778        ANGLE_CAPTURE_GL(StencilFuncSeparate, isCallValid, context, face, func, ref, mask);
   2779    }
   2780    else
   2781    {
   2782        GenerateContextLostErrorOnCurrentGlobalContext();
   2783    }
   2784 }
   2785 
   2786 void GL_APIENTRY GL_StencilMask(GLuint mask)
   2787 {
   2788    Context *context = GetValidGlobalContext();
   2789    EVENT(context, GLStencilMask, "context = %d, mask = %u", CID(context), mask);
   2790 
   2791    if (context)
   2792    {
   2793        SCOPED_SHARE_CONTEXT_LOCK(context);
   2794        bool isCallValid = (context->skipValidation() ||
   2795                            ValidateStencilMask(context, angle::EntryPoint::GLStencilMask, mask));
   2796        if (isCallValid)
   2797        {
   2798            context->stencilMask(mask);
   2799        }
   2800        ANGLE_CAPTURE_GL(StencilMask, isCallValid, context, mask);
   2801    }
   2802    else
   2803    {
   2804        GenerateContextLostErrorOnCurrentGlobalContext();
   2805    }
   2806 }
   2807 
   2808 void GL_APIENTRY GL_StencilMaskSeparate(GLenum face, GLuint mask)
   2809 {
   2810    Context *context = GetValidGlobalContext();
   2811    EVENT(context, GLStencilMaskSeparate, "context = %d, face = %s, mask = %u", CID(context),
   2812          GLenumToString(GLESEnum::TriangleFace, face), mask);
   2813 
   2814    if (context)
   2815    {
   2816        SCOPED_SHARE_CONTEXT_LOCK(context);
   2817        bool isCallValid = (context->skipValidation() ||
   2818                            ValidateStencilMaskSeparate(
   2819                                context, angle::EntryPoint::GLStencilMaskSeparate, face, mask));
   2820        if (isCallValid)
   2821        {
   2822            context->stencilMaskSeparate(face, mask);
   2823        }
   2824        ANGLE_CAPTURE_GL(StencilMaskSeparate, isCallValid, context, face, mask);
   2825    }
   2826    else
   2827    {
   2828        GenerateContextLostErrorOnCurrentGlobalContext();
   2829    }
   2830 }
   2831 
   2832 void GL_APIENTRY GL_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
   2833 {
   2834    Context *context = GetValidGlobalContext();
   2835    EVENT(context, GLStencilOp, "context = %d, fail = %s, zfail = %s, zpass = %s", CID(context),
   2836          GLenumToString(GLESEnum::StencilOp, fail), GLenumToString(GLESEnum::StencilOp, zfail),
   2837          GLenumToString(GLESEnum::StencilOp, zpass));
   2838 
   2839    if (context)
   2840    {
   2841        SCOPED_SHARE_CONTEXT_LOCK(context);
   2842        bool isCallValid =
   2843            (context->skipValidation() ||
   2844             ValidateStencilOp(context, angle::EntryPoint::GLStencilOp, fail, zfail, zpass));
   2845        if (isCallValid)
   2846        {
   2847            context->stencilOp(fail, zfail, zpass);
   2848        }
   2849        ANGLE_CAPTURE_GL(StencilOp, isCallValid, context, fail, zfail, zpass);
   2850    }
   2851    else
   2852    {
   2853        GenerateContextLostErrorOnCurrentGlobalContext();
   2854    }
   2855 }
   2856 
   2857 void GL_APIENTRY GL_StencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
   2858 {
   2859    Context *context = GetValidGlobalContext();
   2860    EVENT(context, GLStencilOpSeparate,
   2861          "context = %d, face = %s, sfail = %s, dpfail = %s, dppass = %s", CID(context),
   2862          GLenumToString(GLESEnum::TriangleFace, face), GLenumToString(GLESEnum::StencilOp, sfail),
   2863          GLenumToString(GLESEnum::StencilOp, dpfail), GLenumToString(GLESEnum::StencilOp, dppass));
   2864 
   2865    if (context)
   2866    {
   2867        SCOPED_SHARE_CONTEXT_LOCK(context);
   2868        bool isCallValid =
   2869            (context->skipValidation() ||
   2870             ValidateStencilOpSeparate(context, angle::EntryPoint::GLStencilOpSeparate, face, sfail,
   2871                                       dpfail, dppass));
   2872        if (isCallValid)
   2873        {
   2874            context->stencilOpSeparate(face, sfail, dpfail, dppass);
   2875        }
   2876        ANGLE_CAPTURE_GL(StencilOpSeparate, isCallValid, context, face, sfail, dpfail, dppass);
   2877    }
   2878    else
   2879    {
   2880        GenerateContextLostErrorOnCurrentGlobalContext();
   2881    }
   2882 }
   2883 
   2884 void GL_APIENTRY GL_TexImage2D(GLenum target,
   2885                               GLint level,
   2886                               GLint internalformat,
   2887                               GLsizei width,
   2888                               GLsizei height,
   2889                               GLint border,
   2890                               GLenum format,
   2891                               GLenum type,
   2892                               const void *pixels)
   2893 {
   2894    Context *context = GetValidGlobalContext();
   2895    EVENT(context, GLTexImage2D,
   2896          "context = %d, target = %s, level = %d, internalformat = %d, width = %d, height = %d, "
   2897          "border = %d, format = %s, type = %s, pixels = 0x%016" PRIxPTR "",
   2898          CID(context), GLenumToString(GLESEnum::TextureTarget, target), level, internalformat,
   2899          width, height, border, GLenumToString(GLESEnum::PixelFormat, format),
   2900          GLenumToString(GLESEnum::PixelType, type), (uintptr_t)pixels);
   2901 
   2902    if (context)
   2903    {
   2904        TextureTarget targetPacked = PackParam<TextureTarget>(target);
   2905        SCOPED_SHARE_CONTEXT_LOCK(context);
   2906        bool isCallValid =
   2907            (context->skipValidation() ||
   2908             ValidateTexImage2D(context, angle::EntryPoint::GLTexImage2D, targetPacked, level,
   2909                                internalformat, width, height, border, format, type, pixels));
   2910        if (isCallValid)
   2911        {
   2912            context->texImage2D(targetPacked, level, internalformat, width, height, border, format,
   2913                                type, pixels);
   2914        }
   2915        ANGLE_CAPTURE_GL(TexImage2D, isCallValid, context, targetPacked, level, internalformat,
   2916                         width, height, border, format, type, pixels);
   2917    }
   2918    else
   2919    {
   2920        GenerateContextLostErrorOnCurrentGlobalContext();
   2921    }
   2922 }
   2923 
   2924 void GL_APIENTRY GL_TexParameterf(GLenum target, GLenum pname, GLfloat param)
   2925 {
   2926    Context *context = GetValidGlobalContext();
   2927    EVENT(context, GLTexParameterf, "context = %d, target = %s, pname = %s, param = %f",
   2928          CID(context), GLenumToString(GLESEnum::TextureTarget, target),
   2929          GLenumToString(GLESEnum::TextureParameterName, pname), param);
   2930 
   2931    if (context)
   2932    {
   2933        TextureType targetPacked = PackParam<TextureType>(target);
   2934        SCOPED_SHARE_CONTEXT_LOCK(context);
   2935        bool isCallValid = (context->skipValidation() ||
   2936                            ValidateTexParameterf(context, angle::EntryPoint::GLTexParameterf,
   2937                                                  targetPacked, pname, param));
   2938        if (isCallValid)
   2939        {
   2940            context->texParameterf(targetPacked, pname, param);
   2941        }
   2942        ANGLE_CAPTURE_GL(TexParameterf, isCallValid, context, targetPacked, pname, param);
   2943    }
   2944    else
   2945    {
   2946        GenerateContextLostErrorOnCurrentGlobalContext();
   2947    }
   2948 }
   2949 
   2950 void GL_APIENTRY GL_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
   2951 {
   2952    Context *context = GetValidGlobalContext();
   2953    EVENT(context, GLTexParameterfv,
   2954          "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
   2955          GLenumToString(GLESEnum::TextureTarget, target),
   2956          GLenumToString(GLESEnum::TextureParameterName, pname), (uintptr_t)params);
   2957 
   2958    if (context)
   2959    {
   2960        TextureType targetPacked = PackParam<TextureType>(target);
   2961        SCOPED_SHARE_CONTEXT_LOCK(context);
   2962        bool isCallValid = (context->skipValidation() ||
   2963                            ValidateTexParameterfv(context, angle::EntryPoint::GLTexParameterfv,
   2964                                                   targetPacked, pname, params));
   2965        if (isCallValid)
   2966        {
   2967            context->texParameterfv(targetPacked, pname, params);
   2968        }
   2969        ANGLE_CAPTURE_GL(TexParameterfv, isCallValid, context, targetPacked, pname, params);
   2970    }
   2971    else
   2972    {
   2973        GenerateContextLostErrorOnCurrentGlobalContext();
   2974    }
   2975 }
   2976 
   2977 void GL_APIENTRY GL_TexParameteri(GLenum target, GLenum pname, GLint param)
   2978 {
   2979    Context *context = GetValidGlobalContext();
   2980    EVENT(context, GLTexParameteri, "context = %d, target = %s, pname = %s, param = %d",
   2981          CID(context), GLenumToString(GLESEnum::TextureTarget, target),
   2982          GLenumToString(GLESEnum::TextureParameterName, pname), param);
   2983 
   2984    if (context)
   2985    {
   2986        TextureType targetPacked = PackParam<TextureType>(target);
   2987        SCOPED_SHARE_CONTEXT_LOCK(context);
   2988        bool isCallValid = (context->skipValidation() ||
   2989                            ValidateTexParameteri(context, angle::EntryPoint::GLTexParameteri,
   2990                                                  targetPacked, pname, param));
   2991        if (isCallValid)
   2992        {
   2993            context->texParameteri(targetPacked, pname, param);
   2994        }
   2995        ANGLE_CAPTURE_GL(TexParameteri, isCallValid, context, targetPacked, pname, param);
   2996    }
   2997    else
   2998    {
   2999        GenerateContextLostErrorOnCurrentGlobalContext();
   3000    }
   3001 }
   3002 
   3003 void GL_APIENTRY GL_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
   3004 {
   3005    Context *context = GetValidGlobalContext();
   3006    EVENT(context, GLTexParameteriv,
   3007          "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
   3008          GLenumToString(GLESEnum::TextureTarget, target),
   3009          GLenumToString(GLESEnum::TextureParameterName, pname), (uintptr_t)params);
   3010 
   3011    if (context)
   3012    {
   3013        TextureType targetPacked = PackParam<TextureType>(target);
   3014        SCOPED_SHARE_CONTEXT_LOCK(context);
   3015        bool isCallValid = (context->skipValidation() ||
   3016                            ValidateTexParameteriv(context, angle::EntryPoint::GLTexParameteriv,
   3017                                                   targetPacked, pname, params));
   3018        if (isCallValid)
   3019        {
   3020            context->texParameteriv(targetPacked, pname, params);
   3021        }
   3022        ANGLE_CAPTURE_GL(TexParameteriv, isCallValid, context, targetPacked, pname, params);
   3023    }
   3024    else
   3025    {
   3026        GenerateContextLostErrorOnCurrentGlobalContext();
   3027    }
   3028 }
   3029 
   3030 void GL_APIENTRY GL_TexSubImage2D(GLenum target,
   3031                                  GLint level,
   3032                                  GLint xoffset,
   3033                                  GLint yoffset,
   3034                                  GLsizei width,
   3035                                  GLsizei height,
   3036                                  GLenum format,
   3037                                  GLenum type,
   3038                                  const void *pixels)
   3039 {
   3040    Context *context = GetValidGlobalContext();
   3041    EVENT(context, GLTexSubImage2D,
   3042          "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, width = %d, height = "
   3043          "%d, format = %s, type = %s, pixels = 0x%016" PRIxPTR "",
   3044          CID(context), GLenumToString(GLESEnum::TextureTarget, target), level, xoffset, yoffset,
   3045          width, height, GLenumToString(GLESEnum::PixelFormat, format),
   3046          GLenumToString(GLESEnum::PixelType, type), (uintptr_t)pixels);
   3047 
   3048    if (context)
   3049    {
   3050        TextureTarget targetPacked = PackParam<TextureTarget>(target);
   3051        SCOPED_SHARE_CONTEXT_LOCK(context);
   3052        bool isCallValid =
   3053            (context->skipValidation() ||
   3054             ValidateTexSubImage2D(context, angle::EntryPoint::GLTexSubImage2D, targetPacked, level,
   3055                                   xoffset, yoffset, width, height, format, type, pixels));
   3056        if (isCallValid)
   3057        {
   3058            context->texSubImage2D(targetPacked, level, xoffset, yoffset, width, height, format,
   3059                                   type, pixels);
   3060        }
   3061        ANGLE_CAPTURE_GL(TexSubImage2D, isCallValid, context, targetPacked, level, xoffset, yoffset,
   3062                         width, height, format, type, pixels);
   3063    }
   3064    else
   3065    {
   3066        GenerateContextLostErrorOnCurrentGlobalContext();
   3067    }
   3068 }
   3069 
   3070 void GL_APIENTRY GL_Uniform1f(GLint location, GLfloat v0)
   3071 {
   3072    Context *context = GetValidGlobalContext();
   3073    EVENT(context, GLUniform1f, "context = %d, location = %d, v0 = %f", CID(context), location, v0);
   3074 
   3075    if (context)
   3076    {
   3077        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   3078        SCOPED_SHARE_CONTEXT_LOCK(context);
   3079        bool isCallValid =
   3080            (context->skipValidation() ||
   3081             ValidateUniform1f(context, angle::EntryPoint::GLUniform1f, locationPacked, v0));
   3082        if (isCallValid)
   3083        {
   3084            context->uniform1f(locationPacked, v0);
   3085        }
   3086        ANGLE_CAPTURE_GL(Uniform1f, isCallValid, context, locationPacked, v0);
   3087    }
   3088    else
   3089    {
   3090        GenerateContextLostErrorOnCurrentGlobalContext();
   3091    }
   3092 }
   3093 
   3094 void GL_APIENTRY GL_Uniform1fv(GLint location, GLsizei count, const GLfloat *value)
   3095 {
   3096    Context *context = GetValidGlobalContext();
   3097    EVENT(context, GLUniform1fv,
   3098          "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
   3099          location, count, (uintptr_t)value);
   3100 
   3101    if (context)
   3102    {
   3103        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   3104        SCOPED_SHARE_CONTEXT_LOCK(context);
   3105        bool isCallValid = (context->skipValidation() ||
   3106                            ValidateUniform1fv(context, angle::EntryPoint::GLUniform1fv,
   3107                                               locationPacked, count, value));
   3108        if (isCallValid)
   3109        {
   3110            context->uniform1fv(locationPacked, count, value);
   3111        }
   3112        ANGLE_CAPTURE_GL(Uniform1fv, isCallValid, context, locationPacked, count, value);
   3113    }
   3114    else
   3115    {
   3116        GenerateContextLostErrorOnCurrentGlobalContext();
   3117    }
   3118 }
   3119 
   3120 void GL_APIENTRY GL_Uniform1i(GLint location, GLint v0)
   3121 {
   3122    Context *context = GetValidGlobalContext();
   3123    EVENT(context, GLUniform1i, "context = %d, location = %d, v0 = %d", CID(context), location, v0);
   3124 
   3125    if (context)
   3126    {
   3127        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   3128        SCOPED_SHARE_CONTEXT_LOCK(context);
   3129        bool isCallValid =
   3130            (context->skipValidation() ||
   3131             ValidateUniform1i(context, angle::EntryPoint::GLUniform1i, locationPacked, v0));
   3132        if (isCallValid)
   3133        {
   3134            context->uniform1i(locationPacked, v0);
   3135        }
   3136        ANGLE_CAPTURE_GL(Uniform1i, isCallValid, context, locationPacked, v0);
   3137    }
   3138    else
   3139    {
   3140        GenerateContextLostErrorOnCurrentGlobalContext();
   3141    }
   3142 }
   3143 
   3144 void GL_APIENTRY GL_Uniform1iv(GLint location, GLsizei count, const GLint *value)
   3145 {
   3146    Context *context = GetValidGlobalContext();
   3147    EVENT(context, GLUniform1iv,
   3148          "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
   3149          location, count, (uintptr_t)value);
   3150 
   3151    if (context)
   3152    {
   3153        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   3154        SCOPED_SHARE_CONTEXT_LOCK(context);
   3155        bool isCallValid = (context->skipValidation() ||
   3156                            ValidateUniform1iv(context, angle::EntryPoint::GLUniform1iv,
   3157                                               locationPacked, count, value));
   3158        if (isCallValid)
   3159        {
   3160            context->uniform1iv(locationPacked, count, value);
   3161        }
   3162        ANGLE_CAPTURE_GL(Uniform1iv, isCallValid, context, locationPacked, count, value);
   3163    }
   3164    else
   3165    {
   3166        GenerateContextLostErrorOnCurrentGlobalContext();
   3167    }
   3168 }
   3169 
   3170 void GL_APIENTRY GL_Uniform2f(GLint location, GLfloat v0, GLfloat v1)
   3171 {
   3172    Context *context = GetValidGlobalContext();
   3173    EVENT(context, GLUniform2f, "context = %d, location = %d, v0 = %f, v1 = %f", CID(context),
   3174          location, v0, v1);
   3175 
   3176    if (context)
   3177    {
   3178        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   3179        SCOPED_SHARE_CONTEXT_LOCK(context);
   3180        bool isCallValid =
   3181            (context->skipValidation() ||
   3182             ValidateUniform2f(context, angle::EntryPoint::GLUniform2f, locationPacked, v0, v1));
   3183        if (isCallValid)
   3184        {
   3185            context->uniform2f(locationPacked, v0, v1);
   3186        }
   3187        ANGLE_CAPTURE_GL(Uniform2f, isCallValid, context, locationPacked, v0, v1);
   3188    }
   3189    else
   3190    {
   3191        GenerateContextLostErrorOnCurrentGlobalContext();
   3192    }
   3193 }
   3194 
   3195 void GL_APIENTRY GL_Uniform2fv(GLint location, GLsizei count, const GLfloat *value)
   3196 {
   3197    Context *context = GetValidGlobalContext();
   3198    EVENT(context, GLUniform2fv,
   3199          "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
   3200          location, count, (uintptr_t)value);
   3201 
   3202    if (context)
   3203    {
   3204        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   3205        SCOPED_SHARE_CONTEXT_LOCK(context);
   3206        bool isCallValid = (context->skipValidation() ||
   3207                            ValidateUniform2fv(context, angle::EntryPoint::GLUniform2fv,
   3208                                               locationPacked, count, value));
   3209        if (isCallValid)
   3210        {
   3211            context->uniform2fv(locationPacked, count, value);
   3212        }
   3213        ANGLE_CAPTURE_GL(Uniform2fv, isCallValid, context, locationPacked, count, value);
   3214    }
   3215    else
   3216    {
   3217        GenerateContextLostErrorOnCurrentGlobalContext();
   3218    }
   3219 }
   3220 
   3221 void GL_APIENTRY GL_Uniform2i(GLint location, GLint v0, GLint v1)
   3222 {
   3223    Context *context = GetValidGlobalContext();
   3224    EVENT(context, GLUniform2i, "context = %d, location = %d, v0 = %d, v1 = %d", CID(context),
   3225          location, v0, v1);
   3226 
   3227    if (context)
   3228    {
   3229        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   3230        SCOPED_SHARE_CONTEXT_LOCK(context);
   3231        bool isCallValid =
   3232            (context->skipValidation() ||
   3233             ValidateUniform2i(context, angle::EntryPoint::GLUniform2i, locationPacked, v0, v1));
   3234        if (isCallValid)
   3235        {
   3236            context->uniform2i(locationPacked, v0, v1);
   3237        }
   3238        ANGLE_CAPTURE_GL(Uniform2i, isCallValid, context, locationPacked, v0, v1);
   3239    }
   3240    else
   3241    {
   3242        GenerateContextLostErrorOnCurrentGlobalContext();
   3243    }
   3244 }
   3245 
   3246 void GL_APIENTRY GL_Uniform2iv(GLint location, GLsizei count, const GLint *value)
   3247 {
   3248    Context *context = GetValidGlobalContext();
   3249    EVENT(context, GLUniform2iv,
   3250          "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
   3251          location, count, (uintptr_t)value);
   3252 
   3253    if (context)
   3254    {
   3255        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   3256        SCOPED_SHARE_CONTEXT_LOCK(context);
   3257        bool isCallValid = (context->skipValidation() ||
   3258                            ValidateUniform2iv(context, angle::EntryPoint::GLUniform2iv,
   3259                                               locationPacked, count, value));
   3260        if (isCallValid)
   3261        {
   3262            context->uniform2iv(locationPacked, count, value);
   3263        }
   3264        ANGLE_CAPTURE_GL(Uniform2iv, isCallValid, context, locationPacked, count, value);
   3265    }
   3266    else
   3267    {
   3268        GenerateContextLostErrorOnCurrentGlobalContext();
   3269    }
   3270 }
   3271 
   3272 void GL_APIENTRY GL_Uniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
   3273 {
   3274    Context *context = GetValidGlobalContext();
   3275    EVENT(context, GLUniform3f, "context = %d, location = %d, v0 = %f, v1 = %f, v2 = %f",
   3276          CID(context), location, v0, v1, v2);
   3277 
   3278    if (context)
   3279    {
   3280        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   3281        SCOPED_SHARE_CONTEXT_LOCK(context);
   3282        bool isCallValid =
   3283            (context->skipValidation() || ValidateUniform3f(context, angle::EntryPoint::GLUniform3f,
   3284                                                            locationPacked, v0, v1, v2));
   3285        if (isCallValid)
   3286        {
   3287            context->uniform3f(locationPacked, v0, v1, v2);
   3288        }
   3289        ANGLE_CAPTURE_GL(Uniform3f, isCallValid, context, locationPacked, v0, v1, v2);
   3290    }
   3291    else
   3292    {
   3293        GenerateContextLostErrorOnCurrentGlobalContext();
   3294    }
   3295 }
   3296 
   3297 void GL_APIENTRY GL_Uniform3fv(GLint location, GLsizei count, const GLfloat *value)
   3298 {
   3299    Context *context = GetValidGlobalContext();
   3300    EVENT(context, GLUniform3fv,
   3301          "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
   3302          location, count, (uintptr_t)value);
   3303 
   3304    if (context)
   3305    {
   3306        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   3307        SCOPED_SHARE_CONTEXT_LOCK(context);
   3308        bool isCallValid = (context->skipValidation() ||
   3309                            ValidateUniform3fv(context, angle::EntryPoint::GLUniform3fv,
   3310                                               locationPacked, count, value));
   3311        if (isCallValid)
   3312        {
   3313            context->uniform3fv(locationPacked, count, value);
   3314        }
   3315        ANGLE_CAPTURE_GL(Uniform3fv, isCallValid, context, locationPacked, count, value);
   3316    }
   3317    else
   3318    {
   3319        GenerateContextLostErrorOnCurrentGlobalContext();
   3320    }
   3321 }
   3322 
   3323 void GL_APIENTRY GL_Uniform3i(GLint location, GLint v0, GLint v1, GLint v2)
   3324 {
   3325    Context *context = GetValidGlobalContext();
   3326    EVENT(context, GLUniform3i, "context = %d, location = %d, v0 = %d, v1 = %d, v2 = %d",
   3327          CID(context), location, v0, v1, v2);
   3328 
   3329    if (context)
   3330    {
   3331        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   3332        SCOPED_SHARE_CONTEXT_LOCK(context);
   3333        bool isCallValid =
   3334            (context->skipValidation() || ValidateUniform3i(context, angle::EntryPoint::GLUniform3i,
   3335                                                            locationPacked, v0, v1, v2));
   3336        if (isCallValid)
   3337        {
   3338            context->uniform3i(locationPacked, v0, v1, v2);
   3339        }
   3340        ANGLE_CAPTURE_GL(Uniform3i, isCallValid, context, locationPacked, v0, v1, v2);
   3341    }
   3342    else
   3343    {
   3344        GenerateContextLostErrorOnCurrentGlobalContext();
   3345    }
   3346 }
   3347 
   3348 void GL_APIENTRY GL_Uniform3iv(GLint location, GLsizei count, const GLint *value)
   3349 {
   3350    Context *context = GetValidGlobalContext();
   3351    EVENT(context, GLUniform3iv,
   3352          "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
   3353          location, count, (uintptr_t)value);
   3354 
   3355    if (context)
   3356    {
   3357        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   3358        SCOPED_SHARE_CONTEXT_LOCK(context);
   3359        bool isCallValid = (context->skipValidation() ||
   3360                            ValidateUniform3iv(context, angle::EntryPoint::GLUniform3iv,
   3361                                               locationPacked, count, value));
   3362        if (isCallValid)
   3363        {
   3364            context->uniform3iv(locationPacked, count, value);
   3365        }
   3366        ANGLE_CAPTURE_GL(Uniform3iv, isCallValid, context, locationPacked, count, value);
   3367    }
   3368    else
   3369    {
   3370        GenerateContextLostErrorOnCurrentGlobalContext();
   3371    }
   3372 }
   3373 
   3374 void GL_APIENTRY GL_Uniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
   3375 {
   3376    Context *context = GetValidGlobalContext();
   3377    EVENT(context, GLUniform4f, "context = %d, location = %d, v0 = %f, v1 = %f, v2 = %f, v3 = %f",
   3378          CID(context), location, v0, v1, v2, v3);
   3379 
   3380    if (context)
   3381    {
   3382        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   3383        SCOPED_SHARE_CONTEXT_LOCK(context);
   3384        bool isCallValid =
   3385            (context->skipValidation() || ValidateUniform4f(context, angle::EntryPoint::GLUniform4f,
   3386                                                            locationPacked, v0, v1, v2, v3));
   3387        if (isCallValid)
   3388        {
   3389            context->uniform4f(locationPacked, v0, v1, v2, v3);
   3390        }
   3391        ANGLE_CAPTURE_GL(Uniform4f, isCallValid, context, locationPacked, v0, v1, v2, v3);
   3392    }
   3393    else
   3394    {
   3395        GenerateContextLostErrorOnCurrentGlobalContext();
   3396    }
   3397 }
   3398 
   3399 void GL_APIENTRY GL_Uniform4fv(GLint location, GLsizei count, const GLfloat *value)
   3400 {
   3401    Context *context = GetValidGlobalContext();
   3402    EVENT(context, GLUniform4fv,
   3403          "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
   3404          location, count, (uintptr_t)value);
   3405 
   3406    if (context)
   3407    {
   3408        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   3409        SCOPED_SHARE_CONTEXT_LOCK(context);
   3410        bool isCallValid = (context->skipValidation() ||
   3411                            ValidateUniform4fv(context, angle::EntryPoint::GLUniform4fv,
   3412                                               locationPacked, count, value));
   3413        if (isCallValid)
   3414        {
   3415            context->uniform4fv(locationPacked, count, value);
   3416        }
   3417        ANGLE_CAPTURE_GL(Uniform4fv, isCallValid, context, locationPacked, count, value);
   3418    }
   3419    else
   3420    {
   3421        GenerateContextLostErrorOnCurrentGlobalContext();
   3422    }
   3423 }
   3424 
   3425 void GL_APIENTRY GL_Uniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
   3426 {
   3427    Context *context = GetValidGlobalContext();
   3428    EVENT(context, GLUniform4i, "context = %d, location = %d, v0 = %d, v1 = %d, v2 = %d, v3 = %d",
   3429          CID(context), location, v0, v1, v2, v3);
   3430 
   3431    if (context)
   3432    {
   3433        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   3434        SCOPED_SHARE_CONTEXT_LOCK(context);
   3435        bool isCallValid =
   3436            (context->skipValidation() || ValidateUniform4i(context, angle::EntryPoint::GLUniform4i,
   3437                                                            locationPacked, v0, v1, v2, v3));
   3438        if (isCallValid)
   3439        {
   3440            context->uniform4i(locationPacked, v0, v1, v2, v3);
   3441        }
   3442        ANGLE_CAPTURE_GL(Uniform4i, isCallValid, context, locationPacked, v0, v1, v2, v3);
   3443    }
   3444    else
   3445    {
   3446        GenerateContextLostErrorOnCurrentGlobalContext();
   3447    }
   3448 }
   3449 
   3450 void GL_APIENTRY GL_Uniform4iv(GLint location, GLsizei count, const GLint *value)
   3451 {
   3452    Context *context = GetValidGlobalContext();
   3453    EVENT(context, GLUniform4iv,
   3454          "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
   3455          location, count, (uintptr_t)value);
   3456 
   3457    if (context)
   3458    {
   3459        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   3460        SCOPED_SHARE_CONTEXT_LOCK(context);
   3461        bool isCallValid = (context->skipValidation() ||
   3462                            ValidateUniform4iv(context, angle::EntryPoint::GLUniform4iv,
   3463                                               locationPacked, count, value));
   3464        if (isCallValid)
   3465        {
   3466            context->uniform4iv(locationPacked, count, value);
   3467        }
   3468        ANGLE_CAPTURE_GL(Uniform4iv, isCallValid, context, locationPacked, count, value);
   3469    }
   3470    else
   3471    {
   3472        GenerateContextLostErrorOnCurrentGlobalContext();
   3473    }
   3474 }
   3475 
   3476 void GL_APIENTRY GL_UniformMatrix2fv(GLint location,
   3477                                     GLsizei count,
   3478                                     GLboolean transpose,
   3479                                     const GLfloat *value)
   3480 {
   3481    Context *context = GetValidGlobalContext();
   3482    EVENT(context, GLUniformMatrix2fv,
   3483          "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
   3484          CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
   3485 
   3486    if (context)
   3487    {
   3488        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   3489        SCOPED_SHARE_CONTEXT_LOCK(context);
   3490        bool isCallValid = (context->skipValidation() ||
   3491                            ValidateUniformMatrix2fv(context, angle::EntryPoint::GLUniformMatrix2fv,
   3492                                                     locationPacked, count, transpose, value));
   3493        if (isCallValid)
   3494        {
   3495            context->uniformMatrix2fv(locationPacked, count, transpose, value);
   3496        }
   3497        ANGLE_CAPTURE_GL(UniformMatrix2fv, isCallValid, context, locationPacked, count, transpose,
   3498                         value);
   3499    }
   3500    else
   3501    {
   3502        GenerateContextLostErrorOnCurrentGlobalContext();
   3503    }
   3504 }
   3505 
   3506 void GL_APIENTRY GL_UniformMatrix3fv(GLint location,
   3507                                     GLsizei count,
   3508                                     GLboolean transpose,
   3509                                     const GLfloat *value)
   3510 {
   3511    Context *context = GetValidGlobalContext();
   3512    EVENT(context, GLUniformMatrix3fv,
   3513          "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
   3514          CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
   3515 
   3516    if (context)
   3517    {
   3518        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   3519        SCOPED_SHARE_CONTEXT_LOCK(context);
   3520        bool isCallValid = (context->skipValidation() ||
   3521                            ValidateUniformMatrix3fv(context, angle::EntryPoint::GLUniformMatrix3fv,
   3522                                                     locationPacked, count, transpose, value));
   3523        if (isCallValid)
   3524        {
   3525            context->uniformMatrix3fv(locationPacked, count, transpose, value);
   3526        }
   3527        ANGLE_CAPTURE_GL(UniformMatrix3fv, isCallValid, context, locationPacked, count, transpose,
   3528                         value);
   3529    }
   3530    else
   3531    {
   3532        GenerateContextLostErrorOnCurrentGlobalContext();
   3533    }
   3534 }
   3535 
   3536 void GL_APIENTRY GL_UniformMatrix4fv(GLint location,
   3537                                     GLsizei count,
   3538                                     GLboolean transpose,
   3539                                     const GLfloat *value)
   3540 {
   3541    Context *context = GetValidGlobalContext();
   3542    EVENT(context, GLUniformMatrix4fv,
   3543          "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
   3544          CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
   3545 
   3546    if (context)
   3547    {
   3548        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   3549        SCOPED_SHARE_CONTEXT_LOCK(context);
   3550        bool isCallValid = (context->skipValidation() ||
   3551                            ValidateUniformMatrix4fv(context, angle::EntryPoint::GLUniformMatrix4fv,
   3552                                                     locationPacked, count, transpose, value));
   3553        if (isCallValid)
   3554        {
   3555            context->uniformMatrix4fv(locationPacked, count, transpose, value);
   3556        }
   3557        ANGLE_CAPTURE_GL(UniformMatrix4fv, isCallValid, context, locationPacked, count, transpose,
   3558                         value);
   3559    }
   3560    else
   3561    {
   3562        GenerateContextLostErrorOnCurrentGlobalContext();
   3563    }
   3564 }
   3565 
   3566 void GL_APIENTRY GL_UseProgram(GLuint program)
   3567 {
   3568    Context *context = GetValidGlobalContext();
   3569    EVENT(context, GLUseProgram, "context = %d, program = %u", CID(context), program);
   3570 
   3571    if (context)
   3572    {
   3573        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
   3574        SCOPED_SHARE_CONTEXT_LOCK(context);
   3575        bool isCallValid =
   3576            (context->skipValidation() ||
   3577             ValidateUseProgram(context, angle::EntryPoint::GLUseProgram, programPacked));
   3578        if (isCallValid)
   3579        {
   3580            context->useProgram(programPacked);
   3581        }
   3582        ANGLE_CAPTURE_GL(UseProgram, isCallValid, context, programPacked);
   3583    }
   3584    else
   3585    {
   3586        GenerateContextLostErrorOnCurrentGlobalContext();
   3587    }
   3588 }
   3589 
   3590 void GL_APIENTRY GL_ValidateProgram(GLuint program)
   3591 {
   3592    Context *context = GetValidGlobalContext();
   3593    EVENT(context, GLValidateProgram, "context = %d, program = %u", CID(context), program);
   3594 
   3595    if (context)
   3596    {
   3597        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
   3598        SCOPED_SHARE_CONTEXT_LOCK(context);
   3599        bool isCallValid =
   3600            (context->skipValidation() ||
   3601             ValidateValidateProgram(context, angle::EntryPoint::GLValidateProgram, programPacked));
   3602        if (isCallValid)
   3603        {
   3604            context->validateProgram(programPacked);
   3605        }
   3606        ANGLE_CAPTURE_GL(ValidateProgram, isCallValid, context, programPacked);
   3607    }
   3608    else
   3609    {
   3610        GenerateContextLostErrorOnCurrentGlobalContext();
   3611    }
   3612 }
   3613 
   3614 void GL_APIENTRY GL_VertexAttrib1f(GLuint index, GLfloat x)
   3615 {
   3616    Context *context = GetValidGlobalContext();
   3617    EVENT(context, GLVertexAttrib1f, "context = %d, index = %u, x = %f", CID(context), index, x);
   3618 
   3619    if (context)
   3620    {
   3621        SCOPED_SHARE_CONTEXT_LOCK(context);
   3622        bool isCallValid =
   3623            (context->skipValidation() ||
   3624             ValidateVertexAttrib1f(context, angle::EntryPoint::GLVertexAttrib1f, index, x));
   3625        if (isCallValid)
   3626        {
   3627            context->vertexAttrib1f(index, x);
   3628        }
   3629        ANGLE_CAPTURE_GL(VertexAttrib1f, isCallValid, context, index, x);
   3630    }
   3631    else
   3632    {
   3633        GenerateContextLostErrorOnCurrentGlobalContext();
   3634    }
   3635 }
   3636 
   3637 void GL_APIENTRY GL_VertexAttrib1fv(GLuint index, const GLfloat *v)
   3638 {
   3639    Context *context = GetValidGlobalContext();
   3640    EVENT(context, GLVertexAttrib1fv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
   3641          CID(context), index, (uintptr_t)v);
   3642 
   3643    if (context)
   3644    {
   3645        SCOPED_SHARE_CONTEXT_LOCK(context);
   3646        bool isCallValid =
   3647            (context->skipValidation() ||
   3648             ValidateVertexAttrib1fv(context, angle::EntryPoint::GLVertexAttrib1fv, index, v));
   3649        if (isCallValid)
   3650        {
   3651            context->vertexAttrib1fv(index, v);
   3652        }
   3653        ANGLE_CAPTURE_GL(VertexAttrib1fv, isCallValid, context, index, v);
   3654    }
   3655    else
   3656    {
   3657        GenerateContextLostErrorOnCurrentGlobalContext();
   3658    }
   3659 }
   3660 
   3661 void GL_APIENTRY GL_VertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
   3662 {
   3663    Context *context = GetValidGlobalContext();
   3664    EVENT(context, GLVertexAttrib2f, "context = %d, index = %u, x = %f, y = %f", CID(context),
   3665          index, x, y);
   3666 
   3667    if (context)
   3668    {
   3669        SCOPED_SHARE_CONTEXT_LOCK(context);
   3670        bool isCallValid =
   3671            (context->skipValidation() ||
   3672             ValidateVertexAttrib2f(context, angle::EntryPoint::GLVertexAttrib2f, index, x, y));
   3673        if (isCallValid)
   3674        {
   3675            context->vertexAttrib2f(index, x, y);
   3676        }
   3677        ANGLE_CAPTURE_GL(VertexAttrib2f, isCallValid, context, index, x, y);
   3678    }
   3679    else
   3680    {
   3681        GenerateContextLostErrorOnCurrentGlobalContext();
   3682    }
   3683 }
   3684 
   3685 void GL_APIENTRY GL_VertexAttrib2fv(GLuint index, const GLfloat *v)
   3686 {
   3687    Context *context = GetValidGlobalContext();
   3688    EVENT(context, GLVertexAttrib2fv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
   3689          CID(context), index, (uintptr_t)v);
   3690 
   3691    if (context)
   3692    {
   3693        SCOPED_SHARE_CONTEXT_LOCK(context);
   3694        bool isCallValid =
   3695            (context->skipValidation() ||
   3696             ValidateVertexAttrib2fv(context, angle::EntryPoint::GLVertexAttrib2fv, index, v));
   3697        if (isCallValid)
   3698        {
   3699            context->vertexAttrib2fv(index, v);
   3700        }
   3701        ANGLE_CAPTURE_GL(VertexAttrib2fv, isCallValid, context, index, v);
   3702    }
   3703    else
   3704    {
   3705        GenerateContextLostErrorOnCurrentGlobalContext();
   3706    }
   3707 }
   3708 
   3709 void GL_APIENTRY GL_VertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
   3710 {
   3711    Context *context = GetValidGlobalContext();
   3712    EVENT(context, GLVertexAttrib3f, "context = %d, index = %u, x = %f, y = %f, z = %f",
   3713          CID(context), index, x, y, z);
   3714 
   3715    if (context)
   3716    {
   3717        SCOPED_SHARE_CONTEXT_LOCK(context);
   3718        bool isCallValid =
   3719            (context->skipValidation() ||
   3720             ValidateVertexAttrib3f(context, angle::EntryPoint::GLVertexAttrib3f, index, x, y, z));
   3721        if (isCallValid)
   3722        {
   3723            context->vertexAttrib3f(index, x, y, z);
   3724        }
   3725        ANGLE_CAPTURE_GL(VertexAttrib3f, isCallValid, context, index, x, y, z);
   3726    }
   3727    else
   3728    {
   3729        GenerateContextLostErrorOnCurrentGlobalContext();
   3730    }
   3731 }
   3732 
   3733 void GL_APIENTRY GL_VertexAttrib3fv(GLuint index, const GLfloat *v)
   3734 {
   3735    Context *context = GetValidGlobalContext();
   3736    EVENT(context, GLVertexAttrib3fv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
   3737          CID(context), index, (uintptr_t)v);
   3738 
   3739    if (context)
   3740    {
   3741        SCOPED_SHARE_CONTEXT_LOCK(context);
   3742        bool isCallValid =
   3743            (context->skipValidation() ||
   3744             ValidateVertexAttrib3fv(context, angle::EntryPoint::GLVertexAttrib3fv, index, v));
   3745        if (isCallValid)
   3746        {
   3747            context->vertexAttrib3fv(index, v);
   3748        }
   3749        ANGLE_CAPTURE_GL(VertexAttrib3fv, isCallValid, context, index, v);
   3750    }
   3751    else
   3752    {
   3753        GenerateContextLostErrorOnCurrentGlobalContext();
   3754    }
   3755 }
   3756 
   3757 void GL_APIENTRY GL_VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
   3758 {
   3759    Context *context = GetValidGlobalContext();
   3760    EVENT(context, GLVertexAttrib4f, "context = %d, index = %u, x = %f, y = %f, z = %f, w = %f",
   3761          CID(context), index, x, y, z, w);
   3762 
   3763    if (context)
   3764    {
   3765        SCOPED_SHARE_CONTEXT_LOCK(context);
   3766        bool isCallValid = (context->skipValidation() ||
   3767                            ValidateVertexAttrib4f(context, angle::EntryPoint::GLVertexAttrib4f,
   3768                                                   index, x, y, z, w));
   3769        if (isCallValid)
   3770        {
   3771            context->vertexAttrib4f(index, x, y, z, w);
   3772        }
   3773        ANGLE_CAPTURE_GL(VertexAttrib4f, isCallValid, context, index, x, y, z, w);
   3774    }
   3775    else
   3776    {
   3777        GenerateContextLostErrorOnCurrentGlobalContext();
   3778    }
   3779 }
   3780 
   3781 void GL_APIENTRY GL_VertexAttrib4fv(GLuint index, const GLfloat *v)
   3782 {
   3783    Context *context = GetValidGlobalContext();
   3784    EVENT(context, GLVertexAttrib4fv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
   3785          CID(context), index, (uintptr_t)v);
   3786 
   3787    if (context)
   3788    {
   3789        SCOPED_SHARE_CONTEXT_LOCK(context);
   3790        bool isCallValid =
   3791            (context->skipValidation() ||
   3792             ValidateVertexAttrib4fv(context, angle::EntryPoint::GLVertexAttrib4fv, index, v));
   3793        if (isCallValid)
   3794        {
   3795            context->vertexAttrib4fv(index, v);
   3796        }
   3797        ANGLE_CAPTURE_GL(VertexAttrib4fv, isCallValid, context, index, v);
   3798    }
   3799    else
   3800    {
   3801        GenerateContextLostErrorOnCurrentGlobalContext();
   3802    }
   3803 }
   3804 
   3805 void GL_APIENTRY GL_VertexAttribPointer(GLuint index,
   3806                                        GLint size,
   3807                                        GLenum type,
   3808                                        GLboolean normalized,
   3809                                        GLsizei stride,
   3810                                        const void *pointer)
   3811 {
   3812    Context *context = GetValidGlobalContext();
   3813    EVENT(context, GLVertexAttribPointer,
   3814          "context = %d, index = %u, size = %d, type = %s, normalized = %s, stride = %d, pointer = "
   3815          "0x%016" PRIxPTR "",
   3816          CID(context), index, size, GLenumToString(GLESEnum::VertexAttribPointerType, type),
   3817          GLbooleanToString(normalized), stride, (uintptr_t)pointer);
   3818 
   3819    if (context)
   3820    {
   3821        VertexAttribType typePacked = PackParam<VertexAttribType>(type);
   3822        SCOPED_SHARE_CONTEXT_LOCK(context);
   3823        bool isCallValid =
   3824            (context->skipValidation() ||
   3825             ValidateVertexAttribPointer(context, angle::EntryPoint::GLVertexAttribPointer, index,
   3826                                         size, typePacked, normalized, stride, pointer));
   3827        if (isCallValid)
   3828        {
   3829            context->vertexAttribPointer(index, size, typePacked, normalized, stride, pointer);
   3830        }
   3831        ANGLE_CAPTURE_GL(VertexAttribPointer, isCallValid, context, index, size, typePacked,
   3832                         normalized, stride, pointer);
   3833    }
   3834    else
   3835    {
   3836        GenerateContextLostErrorOnCurrentGlobalContext();
   3837    }
   3838 }
   3839 
   3840 void GL_APIENTRY GL_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
   3841 {
   3842    Context *context = GetValidGlobalContext();
   3843    EVENT(context, GLViewport, "context = %d, x = %d, y = %d, width = %d, height = %d",
   3844          CID(context), x, y, width, height);
   3845 
   3846    if (context)
   3847    {
   3848        SCOPED_SHARE_CONTEXT_LOCK(context);
   3849        bool isCallValid =
   3850            (context->skipValidation() ||
   3851             ValidateViewport(context, angle::EntryPoint::GLViewport, x, y, width, height));
   3852        if (isCallValid)
   3853        {
   3854            context->viewport(x, y, width, height);
   3855        }
   3856        ANGLE_CAPTURE_GL(Viewport, isCallValid, context, x, y, width, height);
   3857    }
   3858    else
   3859    {
   3860        GenerateContextLostErrorOnCurrentGlobalContext();
   3861    }
   3862 }
   3863 
   3864 }  // extern "C"