tor-browser

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

entry_points_gles_3_0_autogen.cpp (117740B)


      1 // GENERATED FILE - DO NOT EDIT.
      2 // Generated by generate_entry_points.py using data from gl.xml.
      3 //
      4 // Copyright 2020 The ANGLE Project Authors. All rights reserved.
      5 // Use of this source code is governed by a BSD-style license that can be
      6 // found in the LICENSE file.
      7 //
      8 // entry_points_gles_3_0_autogen.cpp:
      9 //   Defines the GLES 3.0 entry points.
     10 
     11 #include "libGLESv2/entry_points_gles_3_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_3_0_autogen.h"
     17 #include "libANGLE/capture/gl_enum_utils.h"
     18 #include "libANGLE/entry_points_utils.h"
     19 #include "libANGLE/validationES3.h"
     20 #include "libGLESv2/global_state.h"
     21 
     22 using namespace gl;
     23 
     24 extern "C" {
     25 void GL_APIENTRY GL_BeginQuery(GLenum target, GLuint id)
     26 {
     27    Context *context = GetValidGlobalContext();
     28    EVENT(context, GLBeginQuery, "context = %d, target = %s, id = %u", CID(context),
     29          GLenumToString(GLESEnum::QueryTarget, target), id);
     30 
     31    if (context)
     32    {
     33        QueryType targetPacked = PackParam<QueryType>(target);
     34        QueryID idPacked       = PackParam<QueryID>(id);
     35        SCOPED_SHARE_CONTEXT_LOCK(context);
     36        bool isCallValid =
     37            (context->skipValidation() ||
     38             ValidateBeginQuery(context, angle::EntryPoint::GLBeginQuery, targetPacked, idPacked));
     39        if (isCallValid)
     40        {
     41            context->beginQuery(targetPacked, idPacked);
     42        }
     43        ANGLE_CAPTURE_GL(BeginQuery, isCallValid, context, targetPacked, idPacked);
     44    }
     45    else
     46    {
     47        GenerateContextLostErrorOnCurrentGlobalContext();
     48    }
     49 }
     50 
     51 void GL_APIENTRY GL_BeginTransformFeedback(GLenum primitiveMode)
     52 {
     53    Context *context = GetValidGlobalContext();
     54    EVENT(context, GLBeginTransformFeedback, "context = %d, primitiveMode = %s", CID(context),
     55          GLenumToString(GLESEnum::PrimitiveType, primitiveMode));
     56 
     57    if (context)
     58    {
     59        PrimitiveMode primitiveModePacked = PackParam<PrimitiveMode>(primitiveMode);
     60        SCOPED_SHARE_CONTEXT_LOCK(context);
     61        bool isCallValid =
     62            (context->skipValidation() ||
     63             ValidateBeginTransformFeedback(context, angle::EntryPoint::GLBeginTransformFeedback,
     64                                            primitiveModePacked));
     65        if (isCallValid)
     66        {
     67            context->beginTransformFeedback(primitiveModePacked);
     68        }
     69        ANGLE_CAPTURE_GL(BeginTransformFeedback, isCallValid, context, primitiveModePacked);
     70    }
     71    else
     72    {
     73        GenerateContextLostErrorOnCurrentGlobalContext();
     74    }
     75 }
     76 
     77 void GL_APIENTRY GL_BindBufferBase(GLenum target, GLuint index, GLuint buffer)
     78 {
     79    Context *context = GetValidGlobalContext();
     80    EVENT(context, GLBindBufferBase, "context = %d, target = %s, index = %u, buffer = %u",
     81          CID(context), GLenumToString(GLESEnum::BufferTargetARB, target), index, buffer);
     82 
     83    if (context)
     84    {
     85        BufferBinding targetPacked = PackParam<BufferBinding>(target);
     86        BufferID bufferPacked      = PackParam<BufferID>(buffer);
     87        SCOPED_SHARE_CONTEXT_LOCK(context);
     88        bool isCallValid = (context->skipValidation() ||
     89                            ValidateBindBufferBase(context, angle::EntryPoint::GLBindBufferBase,
     90                                                   targetPacked, index, bufferPacked));
     91        if (isCallValid)
     92        {
     93            context->bindBufferBase(targetPacked, index, bufferPacked);
     94        }
     95        ANGLE_CAPTURE_GL(BindBufferBase, isCallValid, context, targetPacked, index, bufferPacked);
     96    }
     97    else
     98    {
     99        GenerateContextLostErrorOnCurrentGlobalContext();
    100    }
    101 }
    102 
    103 void GL_APIENTRY
    104 GL_BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
    105 {
    106    Context *context = GetValidGlobalContext();
    107    EVENT(context, GLBindBufferRange,
    108          "context = %d, target = %s, index = %u, buffer = %u, offset = %llu, size = %llu",
    109          CID(context), GLenumToString(GLESEnum::BufferTargetARB, target), index, buffer,
    110          static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size));
    111 
    112    if (context)
    113    {
    114        BufferBinding targetPacked = PackParam<BufferBinding>(target);
    115        BufferID bufferPacked      = PackParam<BufferID>(buffer);
    116        SCOPED_SHARE_CONTEXT_LOCK(context);
    117        bool isCallValid =
    118            (context->skipValidation() ||
    119             ValidateBindBufferRange(context, angle::EntryPoint::GLBindBufferRange, targetPacked,
    120                                     index, bufferPacked, offset, size));
    121        if (isCallValid)
    122        {
    123            context->bindBufferRange(targetPacked, index, bufferPacked, offset, size);
    124        }
    125        ANGLE_CAPTURE_GL(BindBufferRange, isCallValid, context, targetPacked, index, bufferPacked,
    126                         offset, size);
    127    }
    128    else
    129    {
    130        GenerateContextLostErrorOnCurrentGlobalContext();
    131    }
    132 }
    133 
    134 void GL_APIENTRY GL_BindSampler(GLuint unit, GLuint sampler)
    135 {
    136    Context *context = GetValidGlobalContext();
    137    EVENT(context, GLBindSampler, "context = %d, unit = %u, sampler = %u", CID(context), unit,
    138          sampler);
    139 
    140    if (context)
    141    {
    142        SamplerID samplerPacked = PackParam<SamplerID>(sampler);
    143        SCOPED_SHARE_CONTEXT_LOCK(context);
    144        bool isCallValid =
    145            (context->skipValidation() ||
    146             ValidateBindSampler(context, angle::EntryPoint::GLBindSampler, unit, samplerPacked));
    147        if (isCallValid)
    148        {
    149            context->bindSampler(unit, samplerPacked);
    150        }
    151        ANGLE_CAPTURE_GL(BindSampler, isCallValid, context, unit, samplerPacked);
    152    }
    153    else
    154    {
    155        GenerateContextLostErrorOnCurrentGlobalContext();
    156    }
    157 }
    158 
    159 void GL_APIENTRY GL_BindTransformFeedback(GLenum target, GLuint id)
    160 {
    161    Context *context = GetValidGlobalContext();
    162    EVENT(context, GLBindTransformFeedback, "context = %d, target = %s, id = %u", CID(context),
    163          GLenumToString(GLESEnum::BindTransformFeedbackTarget, target), id);
    164 
    165    if (context)
    166    {
    167        TransformFeedbackID idPacked = PackParam<TransformFeedbackID>(id);
    168        SCOPED_SHARE_CONTEXT_LOCK(context);
    169        bool isCallValid =
    170            (context->skipValidation() ||
    171             ValidateBindTransformFeedback(context, angle::EntryPoint::GLBindTransformFeedback,
    172                                           target, idPacked));
    173        if (isCallValid)
    174        {
    175            context->bindTransformFeedback(target, idPacked);
    176        }
    177        ANGLE_CAPTURE_GL(BindTransformFeedback, isCallValid, context, target, idPacked);
    178    }
    179    else
    180    {
    181        GenerateContextLostErrorOnCurrentGlobalContext();
    182    }
    183 }
    184 
    185 void GL_APIENTRY GL_BindVertexArray(GLuint array)
    186 {
    187    Context *context = GetValidGlobalContext();
    188    EVENT(context, GLBindVertexArray, "context = %d, array = %u", CID(context), array);
    189 
    190    if (context)
    191    {
    192        VertexArrayID arrayPacked = PackParam<VertexArrayID>(array);
    193        SCOPED_SHARE_CONTEXT_LOCK(context);
    194        bool isCallValid =
    195            (context->skipValidation() ||
    196             ValidateBindVertexArray(context, angle::EntryPoint::GLBindVertexArray, arrayPacked));
    197        if (isCallValid)
    198        {
    199            context->bindVertexArray(arrayPacked);
    200        }
    201        ANGLE_CAPTURE_GL(BindVertexArray, isCallValid, context, arrayPacked);
    202    }
    203    else
    204    {
    205        GenerateContextLostErrorOnCurrentGlobalContext();
    206    }
    207 }
    208 
    209 void GL_APIENTRY GL_BlitFramebuffer(GLint srcX0,
    210                                    GLint srcY0,
    211                                    GLint srcX1,
    212                                    GLint srcY1,
    213                                    GLint dstX0,
    214                                    GLint dstY0,
    215                                    GLint dstX1,
    216                                    GLint dstY1,
    217                                    GLbitfield mask,
    218                                    GLenum filter)
    219 {
    220    Context *context = GetValidGlobalContext();
    221    EVENT(context, GLBlitFramebuffer,
    222          "context = %d, srcX0 = %d, srcY0 = %d, srcX1 = %d, srcY1 = %d, dstX0 = %d, dstY0 = %d, "
    223          "dstX1 = %d, dstY1 = %d, mask = %s, filter = %s",
    224          CID(context), srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
    225          GLbitfieldToString(GLESEnum::ClearBufferMask, mask).c_str(),
    226          GLenumToString(GLESEnum::BlitFramebufferFilter, filter));
    227 
    228    if (context)
    229    {
    230        SCOPED_SHARE_CONTEXT_LOCK(context);
    231        bool isCallValid =
    232            (context->skipValidation() ||
    233             ValidateBlitFramebuffer(context, angle::EntryPoint::GLBlitFramebuffer, srcX0, srcY0,
    234                                     srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter));
    235        if (isCallValid)
    236        {
    237            context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask,
    238                                     filter);
    239        }
    240        ANGLE_CAPTURE_GL(BlitFramebuffer, isCallValid, context, srcX0, srcY0, srcX1, srcY1, dstX0,
    241                         dstY0, dstX1, dstY1, mask, filter);
    242    }
    243    else
    244    {
    245        GenerateContextLostErrorOnCurrentGlobalContext();
    246    }
    247 }
    248 
    249 void GL_APIENTRY GL_ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
    250 {
    251    Context *context = GetValidGlobalContext();
    252    EVENT(context, GLClearBufferfi,
    253          "context = %d, buffer = %s, drawbuffer = %d, depth = %f, stencil = %d", CID(context),
    254          GLenumToString(GLESEnum::Buffer, buffer), drawbuffer, depth, stencil);
    255 
    256    if (context)
    257    {
    258        SCOPED_SHARE_CONTEXT_LOCK(context);
    259        bool isCallValid = (context->skipValidation() ||
    260                            ValidateClearBufferfi(context, angle::EntryPoint::GLClearBufferfi,
    261                                                  buffer, drawbuffer, depth, stencil));
    262        if (isCallValid)
    263        {
    264            context->clearBufferfi(buffer, drawbuffer, depth, stencil);
    265        }
    266        ANGLE_CAPTURE_GL(ClearBufferfi, isCallValid, context, buffer, drawbuffer, depth, stencil);
    267    }
    268    else
    269    {
    270        GenerateContextLostErrorOnCurrentGlobalContext();
    271    }
    272 }
    273 
    274 void GL_APIENTRY GL_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
    275 {
    276    Context *context = GetValidGlobalContext();
    277    EVENT(context, GLClearBufferfv,
    278          "context = %d, buffer = %s, drawbuffer = %d, value = 0x%016" PRIxPTR "", CID(context),
    279          GLenumToString(GLESEnum::Buffer, buffer), drawbuffer, (uintptr_t)value);
    280 
    281    if (context)
    282    {
    283        SCOPED_SHARE_CONTEXT_LOCK(context);
    284        bool isCallValid = (context->skipValidation() ||
    285                            ValidateClearBufferfv(context, angle::EntryPoint::GLClearBufferfv,
    286                                                  buffer, drawbuffer, value));
    287        if (isCallValid)
    288        {
    289            context->clearBufferfv(buffer, drawbuffer, value);
    290        }
    291        ANGLE_CAPTURE_GL(ClearBufferfv, isCallValid, context, buffer, drawbuffer, value);
    292    }
    293    else
    294    {
    295        GenerateContextLostErrorOnCurrentGlobalContext();
    296    }
    297 }
    298 
    299 void GL_APIENTRY GL_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
    300 {
    301    Context *context = GetValidGlobalContext();
    302    EVENT(context, GLClearBufferiv,
    303          "context = %d, buffer = %s, drawbuffer = %d, value = 0x%016" PRIxPTR "", CID(context),
    304          GLenumToString(GLESEnum::Buffer, buffer), drawbuffer, (uintptr_t)value);
    305 
    306    if (context)
    307    {
    308        SCOPED_SHARE_CONTEXT_LOCK(context);
    309        bool isCallValid = (context->skipValidation() ||
    310                            ValidateClearBufferiv(context, angle::EntryPoint::GLClearBufferiv,
    311                                                  buffer, drawbuffer, value));
    312        if (isCallValid)
    313        {
    314            context->clearBufferiv(buffer, drawbuffer, value);
    315        }
    316        ANGLE_CAPTURE_GL(ClearBufferiv, isCallValid, context, buffer, drawbuffer, value);
    317    }
    318    else
    319    {
    320        GenerateContextLostErrorOnCurrentGlobalContext();
    321    }
    322 }
    323 
    324 void GL_APIENTRY GL_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
    325 {
    326    Context *context = GetValidGlobalContext();
    327    EVENT(context, GLClearBufferuiv,
    328          "context = %d, buffer = %s, drawbuffer = %d, value = 0x%016" PRIxPTR "", CID(context),
    329          GLenumToString(GLESEnum::Buffer, buffer), drawbuffer, (uintptr_t)value);
    330 
    331    if (context)
    332    {
    333        SCOPED_SHARE_CONTEXT_LOCK(context);
    334        bool isCallValid = (context->skipValidation() ||
    335                            ValidateClearBufferuiv(context, angle::EntryPoint::GLClearBufferuiv,
    336                                                   buffer, drawbuffer, value));
    337        if (isCallValid)
    338        {
    339            context->clearBufferuiv(buffer, drawbuffer, value);
    340        }
    341        ANGLE_CAPTURE_GL(ClearBufferuiv, isCallValid, context, buffer, drawbuffer, value);
    342    }
    343    else
    344    {
    345        GenerateContextLostErrorOnCurrentGlobalContext();
    346    }
    347 }
    348 
    349 GLenum GL_APIENTRY GL_ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
    350 {
    351    Context *context = GetValidGlobalContext();
    352    EVENT(context, GLClientWaitSync,
    353          "context = %d, sync = 0x%016" PRIxPTR ", flags = %s, timeout = %llu", CID(context),
    354          (uintptr_t)sync, GLbitfieldToString(GLESEnum::SyncObjectMask, flags).c_str(),
    355          static_cast<unsigned long long>(timeout));
    356 
    357    GLenum returnValue;
    358    if (context)
    359    {
    360        SCOPED_SHARE_CONTEXT_LOCK(context);
    361        bool isCallValid = (context->skipValidation() ||
    362                            ValidateClientWaitSync(context, angle::EntryPoint::GLClientWaitSync,
    363                                                   sync, flags, timeout));
    364        if (isCallValid)
    365        {
    366            returnValue = context->clientWaitSync(sync, flags, timeout);
    367        }
    368        else
    369        {
    370            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLClientWaitSync, GLenum>();
    371        }
    372        ANGLE_CAPTURE_GL(ClientWaitSync, isCallValid, context, sync, flags, timeout, returnValue);
    373    }
    374    else
    375    {
    376        GenerateContextLostErrorOnCurrentGlobalContext();
    377        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLClientWaitSync, GLenum>();
    378    }
    379    return returnValue;
    380 }
    381 
    382 void GL_APIENTRY GL_CompressedTexImage3D(GLenum target,
    383                                         GLint level,
    384                                         GLenum internalformat,
    385                                         GLsizei width,
    386                                         GLsizei height,
    387                                         GLsizei depth,
    388                                         GLint border,
    389                                         GLsizei imageSize,
    390                                         const void *data)
    391 {
    392    Context *context = GetValidGlobalContext();
    393    EVENT(context, GLCompressedTexImage3D,
    394          "context = %d, target = %s, level = %d, internalformat = %s, width = %d, height = %d, "
    395          "depth = %d, border = %d, imageSize = %d, data = 0x%016" PRIxPTR "",
    396          CID(context), GLenumToString(GLESEnum::TextureTarget, target), level,
    397          GLenumToString(GLESEnum::InternalFormat, internalformat), width, height, depth, border,
    398          imageSize, (uintptr_t)data);
    399 
    400    if (context)
    401    {
    402        TextureTarget targetPacked = PackParam<TextureTarget>(target);
    403        SCOPED_SHARE_CONTEXT_LOCK(context);
    404        bool isCallValid =
    405            (context->skipValidation() ||
    406             ValidateCompressedTexImage3D(context, angle::EntryPoint::GLCompressedTexImage3D,
    407                                          targetPacked, level, internalformat, width, height, depth,
    408                                          border, imageSize, data));
    409        if (isCallValid)
    410        {
    411            context->compressedTexImage3D(targetPacked, level, internalformat, width, height, depth,
    412                                          border, imageSize, data);
    413        }
    414        ANGLE_CAPTURE_GL(CompressedTexImage3D, isCallValid, context, targetPacked, level,
    415                         internalformat, width, height, depth, border, imageSize, data);
    416    }
    417    else
    418    {
    419        GenerateContextLostErrorOnCurrentGlobalContext();
    420    }
    421 }
    422 
    423 void GL_APIENTRY GL_CompressedTexSubImage3D(GLenum target,
    424                                            GLint level,
    425                                            GLint xoffset,
    426                                            GLint yoffset,
    427                                            GLint zoffset,
    428                                            GLsizei width,
    429                                            GLsizei height,
    430                                            GLsizei depth,
    431                                            GLenum format,
    432                                            GLsizei imageSize,
    433                                            const void *data)
    434 {
    435    Context *context = GetValidGlobalContext();
    436    EVENT(context, GLCompressedTexSubImage3D,
    437          "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width "
    438          "= %d, height = %d, depth = %d, format = %s, imageSize = %d, data = 0x%016" PRIxPTR "",
    439          CID(context), GLenumToString(GLESEnum::TextureTarget, target), level, xoffset, yoffset,
    440          zoffset, width, height, depth, GLenumToString(GLESEnum::InternalFormat, format),
    441          imageSize, (uintptr_t)data);
    442 
    443    if (context)
    444    {
    445        TextureTarget targetPacked = PackParam<TextureTarget>(target);
    446        SCOPED_SHARE_CONTEXT_LOCK(context);
    447        bool isCallValid =
    448            (context->skipValidation() ||
    449             ValidateCompressedTexSubImage3D(context, angle::EntryPoint::GLCompressedTexSubImage3D,
    450                                             targetPacked, level, xoffset, yoffset, zoffset, width,
    451                                             height, depth, format, imageSize, data));
    452        if (isCallValid)
    453        {
    454            context->compressedTexSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, width,
    455                                             height, depth, format, imageSize, data);
    456        }
    457        ANGLE_CAPTURE_GL(CompressedTexSubImage3D, isCallValid, context, targetPacked, level,
    458                         xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
    459    }
    460    else
    461    {
    462        GenerateContextLostErrorOnCurrentGlobalContext();
    463    }
    464 }
    465 
    466 void GL_APIENTRY GL_CopyBufferSubData(GLenum readTarget,
    467                                      GLenum writeTarget,
    468                                      GLintptr readOffset,
    469                                      GLintptr writeOffset,
    470                                      GLsizeiptr size)
    471 {
    472    Context *context = GetValidGlobalContext();
    473    EVENT(context, GLCopyBufferSubData,
    474          "context = %d, readTarget = %s, writeTarget = %s, readOffset = %llu, writeOffset = %llu, "
    475          "size = %llu",
    476          CID(context), GLenumToString(GLESEnum::CopyBufferSubDataTarget, readTarget),
    477          GLenumToString(GLESEnum::CopyBufferSubDataTarget, writeTarget),
    478          static_cast<unsigned long long>(readOffset), static_cast<unsigned long long>(writeOffset),
    479          static_cast<unsigned long long>(size));
    480 
    481    if (context)
    482    {
    483        BufferBinding readTargetPacked  = PackParam<BufferBinding>(readTarget);
    484        BufferBinding writeTargetPacked = PackParam<BufferBinding>(writeTarget);
    485        SCOPED_SHARE_CONTEXT_LOCK(context);
    486        bool isCallValid = (context->skipValidation() ||
    487                            ValidateCopyBufferSubData(
    488                                context, angle::EntryPoint::GLCopyBufferSubData, readTargetPacked,
    489                                writeTargetPacked, readOffset, writeOffset, size));
    490        if (isCallValid)
    491        {
    492            context->copyBufferSubData(readTargetPacked, writeTargetPacked, readOffset, writeOffset,
    493                                       size);
    494        }
    495        ANGLE_CAPTURE_GL(CopyBufferSubData, isCallValid, context, readTargetPacked,
    496                         writeTargetPacked, readOffset, writeOffset, size);
    497    }
    498    else
    499    {
    500        GenerateContextLostErrorOnCurrentGlobalContext();
    501    }
    502 }
    503 
    504 void GL_APIENTRY GL_CopyTexSubImage3D(GLenum target,
    505                                      GLint level,
    506                                      GLint xoffset,
    507                                      GLint yoffset,
    508                                      GLint zoffset,
    509                                      GLint x,
    510                                      GLint y,
    511                                      GLsizei width,
    512                                      GLsizei height)
    513 {
    514    Context *context = GetValidGlobalContext();
    515    EVENT(context, GLCopyTexSubImage3D,
    516          "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, x = "
    517          "%d, y = %d, width = %d, height = %d",
    518          CID(context), GLenumToString(GLESEnum::TextureTarget, target), level, xoffset, yoffset,
    519          zoffset, x, y, width, height);
    520 
    521    if (context)
    522    {
    523        TextureTarget targetPacked = PackParam<TextureTarget>(target);
    524        SCOPED_SHARE_CONTEXT_LOCK(context);
    525        bool isCallValid = (context->skipValidation() ||
    526                            ValidateCopyTexSubImage3D(
    527                                context, angle::EntryPoint::GLCopyTexSubImage3D, targetPacked,
    528                                level, xoffset, yoffset, zoffset, x, y, width, height));
    529        if (isCallValid)
    530        {
    531            context->copyTexSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, x, y, width,
    532                                       height);
    533        }
    534        ANGLE_CAPTURE_GL(CopyTexSubImage3D, isCallValid, context, targetPacked, level, xoffset,
    535                         yoffset, zoffset, x, y, width, height);
    536    }
    537    else
    538    {
    539        GenerateContextLostErrorOnCurrentGlobalContext();
    540    }
    541 }
    542 
    543 void GL_APIENTRY GL_DeleteQueries(GLsizei n, const GLuint *ids)
    544 {
    545    Context *context = GetValidGlobalContext();
    546    EVENT(context, GLDeleteQueries, "context = %d, n = %d, ids = 0x%016" PRIxPTR "", CID(context),
    547          n, (uintptr_t)ids);
    548 
    549    if (context)
    550    {
    551        const QueryID *idsPacked = PackParam<const QueryID *>(ids);
    552        SCOPED_SHARE_CONTEXT_LOCK(context);
    553        bool isCallValid =
    554            (context->skipValidation() ||
    555             ValidateDeleteQueries(context, angle::EntryPoint::GLDeleteQueries, n, idsPacked));
    556        if (isCallValid)
    557        {
    558            context->deleteQueries(n, idsPacked);
    559        }
    560        ANGLE_CAPTURE_GL(DeleteQueries, isCallValid, context, n, idsPacked);
    561    }
    562    else
    563    {
    564        GenerateContextLostErrorOnCurrentGlobalContext();
    565    }
    566 }
    567 
    568 void GL_APIENTRY GL_DeleteSamplers(GLsizei count, const GLuint *samplers)
    569 {
    570    Context *context = GetValidGlobalContext();
    571    EVENT(context, GLDeleteSamplers, "context = %d, count = %d, samplers = 0x%016" PRIxPTR "",
    572          CID(context), count, (uintptr_t)samplers);
    573 
    574    if (context)
    575    {
    576        const SamplerID *samplersPacked = PackParam<const SamplerID *>(samplers);
    577        SCOPED_SHARE_CONTEXT_LOCK(context);
    578        bool isCallValid = (context->skipValidation() ||
    579                            ValidateDeleteSamplers(context, angle::EntryPoint::GLDeleteSamplers,
    580                                                   count, samplersPacked));
    581        if (isCallValid)
    582        {
    583            context->deleteSamplers(count, samplersPacked);
    584        }
    585        ANGLE_CAPTURE_GL(DeleteSamplers, isCallValid, context, count, samplersPacked);
    586    }
    587    else
    588    {
    589        GenerateContextLostErrorOnCurrentGlobalContext();
    590    }
    591 }
    592 
    593 void GL_APIENTRY GL_DeleteSync(GLsync sync)
    594 {
    595    Context *context = GetValidGlobalContext();
    596    EVENT(context, GLDeleteSync, "context = %d, sync = 0x%016" PRIxPTR "", CID(context),
    597          (uintptr_t)sync);
    598 
    599    if (context)
    600    {
    601        SCOPED_SHARE_CONTEXT_LOCK(context);
    602        bool isCallValid = (context->skipValidation() ||
    603                            ValidateDeleteSync(context, angle::EntryPoint::GLDeleteSync, sync));
    604        if (isCallValid)
    605        {
    606            context->deleteSync(sync);
    607        }
    608        ANGLE_CAPTURE_GL(DeleteSync, isCallValid, context, sync);
    609    }
    610    else
    611    {
    612        GenerateContextLostErrorOnCurrentGlobalContext();
    613    }
    614 }
    615 
    616 void GL_APIENTRY GL_DeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
    617 {
    618    Context *context = GetValidGlobalContext();
    619    EVENT(context, GLDeleteTransformFeedbacks, "context = %d, n = %d, ids = 0x%016" PRIxPTR "",
    620          CID(context), n, (uintptr_t)ids);
    621 
    622    if (context)
    623    {
    624        const TransformFeedbackID *idsPacked = PackParam<const TransformFeedbackID *>(ids);
    625        SCOPED_SHARE_CONTEXT_LOCK(context);
    626        bool isCallValid =
    627            (context->skipValidation() ||
    628             ValidateDeleteTransformFeedbacks(
    629                 context, angle::EntryPoint::GLDeleteTransformFeedbacks, n, idsPacked));
    630        if (isCallValid)
    631        {
    632            context->deleteTransformFeedbacks(n, idsPacked);
    633        }
    634        ANGLE_CAPTURE_GL(DeleteTransformFeedbacks, isCallValid, context, n, idsPacked);
    635    }
    636    else
    637    {
    638        GenerateContextLostErrorOnCurrentGlobalContext();
    639    }
    640 }
    641 
    642 void GL_APIENTRY GL_DeleteVertexArrays(GLsizei n, const GLuint *arrays)
    643 {
    644    Context *context = GetValidGlobalContext();
    645    EVENT(context, GLDeleteVertexArrays, "context = %d, n = %d, arrays = 0x%016" PRIxPTR "",
    646          CID(context), n, (uintptr_t)arrays);
    647 
    648    if (context)
    649    {
    650        const VertexArrayID *arraysPacked = PackParam<const VertexArrayID *>(arrays);
    651        SCOPED_SHARE_CONTEXT_LOCK(context);
    652        bool isCallValid = (context->skipValidation() ||
    653                            ValidateDeleteVertexArrays(
    654                                context, angle::EntryPoint::GLDeleteVertexArrays, n, arraysPacked));
    655        if (isCallValid)
    656        {
    657            context->deleteVertexArrays(n, arraysPacked);
    658        }
    659        ANGLE_CAPTURE_GL(DeleteVertexArrays, isCallValid, context, n, arraysPacked);
    660    }
    661    else
    662    {
    663        GenerateContextLostErrorOnCurrentGlobalContext();
    664    }
    665 }
    666 
    667 void GL_APIENTRY GL_DrawArraysInstanced(GLenum mode,
    668                                        GLint first,
    669                                        GLsizei count,
    670                                        GLsizei instancecount)
    671 {
    672    Context *context = GetValidGlobalContext();
    673    EVENT(context, GLDrawArraysInstanced,
    674          "context = %d, mode = %s, first = %d, count = %d, instancecount = %d", CID(context),
    675          GLenumToString(GLESEnum::PrimitiveType, mode), first, count, instancecount);
    676 
    677    if (context)
    678    {
    679        PrimitiveMode modePacked = PackParam<PrimitiveMode>(mode);
    680        SCOPED_SHARE_CONTEXT_LOCK(context);
    681        bool isCallValid =
    682            (context->skipValidation() ||
    683             ValidateDrawArraysInstanced(context, angle::EntryPoint::GLDrawArraysInstanced,
    684                                         modePacked, first, count, instancecount));
    685        if (isCallValid)
    686        {
    687            context->drawArraysInstanced(modePacked, first, count, instancecount);
    688        }
    689        ANGLE_CAPTURE_GL(DrawArraysInstanced, isCallValid, context, modePacked, first, count,
    690                         instancecount);
    691    }
    692    else
    693    {
    694        GenerateContextLostErrorOnCurrentGlobalContext();
    695    }
    696 }
    697 
    698 void GL_APIENTRY GL_DrawBuffers(GLsizei n, const GLenum *bufs)
    699 {
    700    Context *context = GetValidGlobalContext();
    701    EVENT(context, GLDrawBuffers, "context = %d, n = %d, bufs = 0x%016" PRIxPTR "", CID(context), n,
    702          (uintptr_t)bufs);
    703 
    704    if (context)
    705    {
    706        SCOPED_SHARE_CONTEXT_LOCK(context);
    707        bool isCallValid =
    708            (context->skipValidation() ||
    709             ValidateDrawBuffers(context, angle::EntryPoint::GLDrawBuffers, n, bufs));
    710        if (isCallValid)
    711        {
    712            context->drawBuffers(n, bufs);
    713        }
    714        ANGLE_CAPTURE_GL(DrawBuffers, isCallValid, context, n, bufs);
    715    }
    716    else
    717    {
    718        GenerateContextLostErrorOnCurrentGlobalContext();
    719    }
    720 }
    721 
    722 void GL_APIENTRY GL_DrawElementsInstanced(GLenum mode,
    723                                          GLsizei count,
    724                                          GLenum type,
    725                                          const void *indices,
    726                                          GLsizei instancecount)
    727 {
    728    Context *context = GetValidGlobalContext();
    729    EVENT(context, GLDrawElementsInstanced,
    730          "context = %d, mode = %s, count = %d, type = %s, indices = 0x%016" PRIxPTR
    731          ", instancecount = %d",
    732          CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), count,
    733          GLenumToString(GLESEnum::DrawElementsType, type), (uintptr_t)indices, instancecount);
    734 
    735    if (context)
    736    {
    737        PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
    738        DrawElementsType typePacked = PackParam<DrawElementsType>(type);
    739        SCOPED_SHARE_CONTEXT_LOCK(context);
    740        bool isCallValid =
    741            (context->skipValidation() ||
    742             ValidateDrawElementsInstanced(context, angle::EntryPoint::GLDrawElementsInstanced,
    743                                           modePacked, count, typePacked, indices, instancecount));
    744        if (isCallValid)
    745        {
    746            context->drawElementsInstanced(modePacked, count, typePacked, indices, instancecount);
    747        }
    748        ANGLE_CAPTURE_GL(DrawElementsInstanced, isCallValid, context, modePacked, count, typePacked,
    749                         indices, instancecount);
    750    }
    751    else
    752    {
    753        GenerateContextLostErrorOnCurrentGlobalContext();
    754    }
    755 }
    756 
    757 void GL_APIENTRY GL_DrawRangeElements(GLenum mode,
    758                                      GLuint start,
    759                                      GLuint end,
    760                                      GLsizei count,
    761                                      GLenum type,
    762                                      const void *indices)
    763 {
    764    Context *context = GetValidGlobalContext();
    765    EVENT(context, GLDrawRangeElements,
    766          "context = %d, mode = %s, start = %u, end = %u, count = %d, type = %s, indices = "
    767          "0x%016" PRIxPTR "",
    768          CID(context), GLenumToString(GLESEnum::PrimitiveType, mode), start, end, count,
    769          GLenumToString(GLESEnum::DrawElementsType, type), (uintptr_t)indices);
    770 
    771    if (context)
    772    {
    773        PrimitiveMode modePacked    = PackParam<PrimitiveMode>(mode);
    774        DrawElementsType typePacked = PackParam<DrawElementsType>(type);
    775        SCOPED_SHARE_CONTEXT_LOCK(context);
    776        bool isCallValid =
    777            (context->skipValidation() ||
    778             ValidateDrawRangeElements(context, angle::EntryPoint::GLDrawRangeElements, modePacked,
    779                                       start, end, count, typePacked, indices));
    780        if (isCallValid)
    781        {
    782            context->drawRangeElements(modePacked, start, end, count, typePacked, indices);
    783        }
    784        ANGLE_CAPTURE_GL(DrawRangeElements, isCallValid, context, modePacked, start, end, count,
    785                         typePacked, indices);
    786    }
    787    else
    788    {
    789        GenerateContextLostErrorOnCurrentGlobalContext();
    790    }
    791 }
    792 
    793 void GL_APIENTRY GL_EndQuery(GLenum target)
    794 {
    795    Context *context = GetValidGlobalContext();
    796    EVENT(context, GLEndQuery, "context = %d, target = %s", CID(context),
    797          GLenumToString(GLESEnum::QueryTarget, target));
    798 
    799    if (context)
    800    {
    801        QueryType targetPacked = PackParam<QueryType>(target);
    802        SCOPED_SHARE_CONTEXT_LOCK(context);
    803        bool isCallValid = (context->skipValidation() ||
    804                            ValidateEndQuery(context, angle::EntryPoint::GLEndQuery, targetPacked));
    805        if (isCallValid)
    806        {
    807            context->endQuery(targetPacked);
    808        }
    809        ANGLE_CAPTURE_GL(EndQuery, isCallValid, context, targetPacked);
    810    }
    811    else
    812    {
    813        GenerateContextLostErrorOnCurrentGlobalContext();
    814    }
    815 }
    816 
    817 void GL_APIENTRY GL_EndTransformFeedback()
    818 {
    819    Context *context = GetValidGlobalContext();
    820    EVENT(context, GLEndTransformFeedback, "context = %d", CID(context));
    821 
    822    if (context)
    823    {
    824        SCOPED_SHARE_CONTEXT_LOCK(context);
    825        bool isCallValid =
    826            (context->skipValidation() ||
    827             ValidateEndTransformFeedback(context, angle::EntryPoint::GLEndTransformFeedback));
    828        if (isCallValid)
    829        {
    830            context->endTransformFeedback();
    831        }
    832        ANGLE_CAPTURE_GL(EndTransformFeedback, isCallValid, context);
    833    }
    834    else
    835    {
    836        GenerateContextLostErrorOnCurrentGlobalContext();
    837    }
    838 }
    839 
    840 GLsync GL_APIENTRY GL_FenceSync(GLenum condition, GLbitfield flags)
    841 {
    842    Context *context = GetValidGlobalContext();
    843    EVENT(context, GLFenceSync, "context = %d, condition = %s, flags = %s", CID(context),
    844          GLenumToString(GLESEnum::SyncCondition, condition),
    845          GLbitfieldToString(GLESEnum::SyncBehaviorFlags, flags).c_str());
    846 
    847    GLsync returnValue;
    848    if (context)
    849    {
    850        SCOPED_SHARE_CONTEXT_LOCK(context);
    851        bool isCallValid =
    852            (context->skipValidation() ||
    853             ValidateFenceSync(context, angle::EntryPoint::GLFenceSync, condition, flags));
    854        if (isCallValid)
    855        {
    856            returnValue = context->fenceSync(condition, flags);
    857        }
    858        else
    859        {
    860            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLFenceSync, GLsync>();
    861        }
    862        ANGLE_CAPTURE_GL(FenceSync, isCallValid, context, condition, flags, returnValue);
    863    }
    864    else
    865    {
    866        GenerateContextLostErrorOnCurrentGlobalContext();
    867        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLFenceSync, GLsync>();
    868    }
    869    return returnValue;
    870 }
    871 
    872 void GL_APIENTRY GL_FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
    873 {
    874    Context *context = GetValidGlobalContext();
    875    EVENT(context, GLFlushMappedBufferRange,
    876          "context = %d, target = %s, offset = %llu, length = %llu", CID(context),
    877          GLenumToString(GLESEnum::BufferTargetARB, target),
    878          static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length));
    879 
    880    if (context)
    881    {
    882        BufferBinding targetPacked = PackParam<BufferBinding>(target);
    883        SCOPED_SHARE_CONTEXT_LOCK(context);
    884        bool isCallValid =
    885            (context->skipValidation() ||
    886             ValidateFlushMappedBufferRange(context, angle::EntryPoint::GLFlushMappedBufferRange,
    887                                            targetPacked, offset, length));
    888        if (isCallValid)
    889        {
    890            context->flushMappedBufferRange(targetPacked, offset, length);
    891        }
    892        ANGLE_CAPTURE_GL(FlushMappedBufferRange, isCallValid, context, targetPacked, offset,
    893                         length);
    894    }
    895    else
    896    {
    897        GenerateContextLostErrorOnCurrentGlobalContext();
    898    }
    899 }
    900 
    901 void GL_APIENTRY GL_FramebufferTextureLayer(GLenum target,
    902                                            GLenum attachment,
    903                                            GLuint texture,
    904                                            GLint level,
    905                                            GLint layer)
    906 {
    907    Context *context = GetValidGlobalContext();
    908    EVENT(context, GLFramebufferTextureLayer,
    909          "context = %d, target = %s, attachment = %s, texture = %u, level = %d, layer = %d",
    910          CID(context), GLenumToString(GLESEnum::FramebufferTarget, target),
    911          GLenumToString(GLESEnum::FramebufferAttachment, attachment), texture, level, layer);
    912 
    913    if (context)
    914    {
    915        TextureID texturePacked = PackParam<TextureID>(texture);
    916        SCOPED_SHARE_CONTEXT_LOCK(context);
    917        bool isCallValid =
    918            (context->skipValidation() ||
    919             ValidateFramebufferTextureLayer(context, angle::EntryPoint::GLFramebufferTextureLayer,
    920                                             target, attachment, texturePacked, level, layer));
    921        if (isCallValid)
    922        {
    923            context->framebufferTextureLayer(target, attachment, texturePacked, level, layer);
    924        }
    925        ANGLE_CAPTURE_GL(FramebufferTextureLayer, isCallValid, context, target, attachment,
    926                         texturePacked, level, layer);
    927    }
    928    else
    929    {
    930        GenerateContextLostErrorOnCurrentGlobalContext();
    931    }
    932 }
    933 
    934 void GL_APIENTRY GL_GenQueries(GLsizei n, GLuint *ids)
    935 {
    936    Context *context = GetValidGlobalContext();
    937    EVENT(context, GLGenQueries, "context = %d, n = %d, ids = 0x%016" PRIxPTR "", CID(context), n,
    938          (uintptr_t)ids);
    939 
    940    if (context)
    941    {
    942        QueryID *idsPacked = PackParam<QueryID *>(ids);
    943        SCOPED_SHARE_CONTEXT_LOCK(context);
    944        bool isCallValid =
    945            (context->skipValidation() ||
    946             ValidateGenQueries(context, angle::EntryPoint::GLGenQueries, n, idsPacked));
    947        if (isCallValid)
    948        {
    949            context->genQueries(n, idsPacked);
    950        }
    951        ANGLE_CAPTURE_GL(GenQueries, isCallValid, context, n, idsPacked);
    952    }
    953    else
    954    {
    955        GenerateContextLostErrorOnCurrentGlobalContext();
    956    }
    957 }
    958 
    959 void GL_APIENTRY GL_GenSamplers(GLsizei count, GLuint *samplers)
    960 {
    961    Context *context = GetValidGlobalContext();
    962    EVENT(context, GLGenSamplers, "context = %d, count = %d, samplers = 0x%016" PRIxPTR "",
    963          CID(context), count, (uintptr_t)samplers);
    964 
    965    if (context)
    966    {
    967        SamplerID *samplersPacked = PackParam<SamplerID *>(samplers);
    968        SCOPED_SHARE_CONTEXT_LOCK(context);
    969        bool isCallValid =
    970            (context->skipValidation() ||
    971             ValidateGenSamplers(context, angle::EntryPoint::GLGenSamplers, count, samplersPacked));
    972        if (isCallValid)
    973        {
    974            context->genSamplers(count, samplersPacked);
    975        }
    976        ANGLE_CAPTURE_GL(GenSamplers, isCallValid, context, count, samplersPacked);
    977    }
    978    else
    979    {
    980        GenerateContextLostErrorOnCurrentGlobalContext();
    981    }
    982 }
    983 
    984 void GL_APIENTRY GL_GenTransformFeedbacks(GLsizei n, GLuint *ids)
    985 {
    986    Context *context = GetValidGlobalContext();
    987    EVENT(context, GLGenTransformFeedbacks, "context = %d, n = %d, ids = 0x%016" PRIxPTR "",
    988          CID(context), n, (uintptr_t)ids);
    989 
    990    if (context)
    991    {
    992        TransformFeedbackID *idsPacked = PackParam<TransformFeedbackID *>(ids);
    993        SCOPED_SHARE_CONTEXT_LOCK(context);
    994        bool isCallValid = (context->skipValidation() ||
    995                            ValidateGenTransformFeedbacks(
    996                                context, angle::EntryPoint::GLGenTransformFeedbacks, n, idsPacked));
    997        if (isCallValid)
    998        {
    999            context->genTransformFeedbacks(n, idsPacked);
   1000        }
   1001        ANGLE_CAPTURE_GL(GenTransformFeedbacks, isCallValid, context, n, idsPacked);
   1002    }
   1003    else
   1004    {
   1005        GenerateContextLostErrorOnCurrentGlobalContext();
   1006    }
   1007 }
   1008 
   1009 void GL_APIENTRY GL_GenVertexArrays(GLsizei n, GLuint *arrays)
   1010 {
   1011    Context *context = GetValidGlobalContext();
   1012    EVENT(context, GLGenVertexArrays, "context = %d, n = %d, arrays = 0x%016" PRIxPTR "",
   1013          CID(context), n, (uintptr_t)arrays);
   1014 
   1015    if (context)
   1016    {
   1017        VertexArrayID *arraysPacked = PackParam<VertexArrayID *>(arrays);
   1018        SCOPED_SHARE_CONTEXT_LOCK(context);
   1019        bool isCallValid = (context->skipValidation() ||
   1020                            ValidateGenVertexArrays(context, angle::EntryPoint::GLGenVertexArrays,
   1021                                                    n, arraysPacked));
   1022        if (isCallValid)
   1023        {
   1024            context->genVertexArrays(n, arraysPacked);
   1025        }
   1026        ANGLE_CAPTURE_GL(GenVertexArrays, isCallValid, context, n, arraysPacked);
   1027    }
   1028    else
   1029    {
   1030        GenerateContextLostErrorOnCurrentGlobalContext();
   1031    }
   1032 }
   1033 
   1034 void GL_APIENTRY GL_GetActiveUniformBlockName(GLuint program,
   1035                                              GLuint uniformBlockIndex,
   1036                                              GLsizei bufSize,
   1037                                              GLsizei *length,
   1038                                              GLchar *uniformBlockName)
   1039 {
   1040    Context *context = GetValidGlobalContext();
   1041    EVENT(
   1042        context, GLGetActiveUniformBlockName,
   1043        "context = %d, program = %u, uniformBlockIndex = %u, bufSize = %d, length = 0x%016" PRIxPTR
   1044        ", uniformBlockName = 0x%016" PRIxPTR "",
   1045        CID(context), program, uniformBlockIndex, bufSize, (uintptr_t)length,
   1046        (uintptr_t)uniformBlockName);
   1047 
   1048    if (context)
   1049    {
   1050        ShaderProgramID programPacked             = PackParam<ShaderProgramID>(program);
   1051        UniformBlockIndex uniformBlockIndexPacked = PackParam<UniformBlockIndex>(uniformBlockIndex);
   1052        SCOPED_SHARE_CONTEXT_LOCK(context);
   1053        bool isCallValid =
   1054            (context->skipValidation() ||
   1055             ValidateGetActiveUniformBlockName(
   1056                 context, angle::EntryPoint::GLGetActiveUniformBlockName, programPacked,
   1057                 uniformBlockIndexPacked, bufSize, length, uniformBlockName));
   1058        if (isCallValid)
   1059        {
   1060            context->getActiveUniformBlockName(programPacked, uniformBlockIndexPacked, bufSize,
   1061                                               length, uniformBlockName);
   1062        }
   1063        ANGLE_CAPTURE_GL(GetActiveUniformBlockName, isCallValid, context, programPacked,
   1064                         uniformBlockIndexPacked, bufSize, length, uniformBlockName);
   1065    }
   1066    else
   1067    {
   1068        GenerateContextLostErrorOnCurrentGlobalContext();
   1069    }
   1070 }
   1071 
   1072 void GL_APIENTRY GL_GetActiveUniformBlockiv(GLuint program,
   1073                                            GLuint uniformBlockIndex,
   1074                                            GLenum pname,
   1075                                            GLint *params)
   1076 {
   1077    Context *context = GetValidGlobalContext();
   1078    EVENT(context, GLGetActiveUniformBlockiv,
   1079          "context = %d, program = %u, uniformBlockIndex = %u, pname = %s, params = 0x%016" PRIxPTR
   1080          "",
   1081          CID(context), program, uniformBlockIndex,
   1082          GLenumToString(GLESEnum::UniformBlockPName, pname), (uintptr_t)params);
   1083 
   1084    if (context)
   1085    {
   1086        ShaderProgramID programPacked             = PackParam<ShaderProgramID>(program);
   1087        UniformBlockIndex uniformBlockIndexPacked = PackParam<UniformBlockIndex>(uniformBlockIndex);
   1088        SCOPED_SHARE_CONTEXT_LOCK(context);
   1089        bool isCallValid = (context->skipValidation() ||
   1090                            ValidateGetActiveUniformBlockiv(
   1091                                context, angle::EntryPoint::GLGetActiveUniformBlockiv,
   1092                                programPacked, uniformBlockIndexPacked, pname, params));
   1093        if (isCallValid)
   1094        {
   1095            context->getActiveUniformBlockiv(programPacked, uniformBlockIndexPacked, pname, params);
   1096        }
   1097        ANGLE_CAPTURE_GL(GetActiveUniformBlockiv, isCallValid, context, programPacked,
   1098                         uniformBlockIndexPacked, pname, params);
   1099    }
   1100    else
   1101    {
   1102        GenerateContextLostErrorOnCurrentGlobalContext();
   1103    }
   1104 }
   1105 
   1106 void GL_APIENTRY GL_GetActiveUniformsiv(GLuint program,
   1107                                        GLsizei uniformCount,
   1108                                        const GLuint *uniformIndices,
   1109                                        GLenum pname,
   1110                                        GLint *params)
   1111 {
   1112    Context *context = GetValidGlobalContext();
   1113    EVENT(context, GLGetActiveUniformsiv,
   1114          "context = %d, program = %u, uniformCount = %d, uniformIndices = 0x%016" PRIxPTR
   1115          ", pname = %s, params = 0x%016" PRIxPTR "",
   1116          CID(context), program, uniformCount, (uintptr_t)uniformIndices,
   1117          GLenumToString(GLESEnum::UniformPName, pname), (uintptr_t)params);
   1118 
   1119    if (context)
   1120    {
   1121        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
   1122        SCOPED_SHARE_CONTEXT_LOCK(context);
   1123        bool isCallValid = (context->skipValidation() ||
   1124                            ValidateGetActiveUniformsiv(
   1125                                context, angle::EntryPoint::GLGetActiveUniformsiv, programPacked,
   1126                                uniformCount, uniformIndices, pname, params));
   1127        if (isCallValid)
   1128        {
   1129            context->getActiveUniformsiv(programPacked, uniformCount, uniformIndices, pname,
   1130                                         params);
   1131        }
   1132        ANGLE_CAPTURE_GL(GetActiveUniformsiv, isCallValid, context, programPacked, uniformCount,
   1133                         uniformIndices, pname, params);
   1134    }
   1135    else
   1136    {
   1137        GenerateContextLostErrorOnCurrentGlobalContext();
   1138    }
   1139 }
   1140 
   1141 void GL_APIENTRY GL_GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
   1142 {
   1143    Context *context = GetValidGlobalContext();
   1144    EVENT(context, GLGetBufferParameteri64v,
   1145          "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
   1146          GLenumToString(GLESEnum::BufferTargetARB, target),
   1147          GLenumToString(GLESEnum::AllEnums, pname), (uintptr_t)params);
   1148 
   1149    if (context)
   1150    {
   1151        BufferBinding targetPacked = PackParam<BufferBinding>(target);
   1152        SCOPED_SHARE_CONTEXT_LOCK(context);
   1153        bool isCallValid =
   1154            (context->skipValidation() ||
   1155             ValidateGetBufferParameteri64v(context, angle::EntryPoint::GLGetBufferParameteri64v,
   1156                                            targetPacked, pname, params));
   1157        if (isCallValid)
   1158        {
   1159            context->getBufferParameteri64v(targetPacked, pname, params);
   1160        }
   1161        ANGLE_CAPTURE_GL(GetBufferParameteri64v, isCallValid, context, targetPacked, pname, params);
   1162    }
   1163    else
   1164    {
   1165        GenerateContextLostErrorOnCurrentGlobalContext();
   1166    }
   1167 }
   1168 
   1169 void GL_APIENTRY GL_GetBufferPointerv(GLenum target, GLenum pname, void **params)
   1170 {
   1171    Context *context = GetValidGlobalContext();
   1172    EVENT(context, GLGetBufferPointerv,
   1173          "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
   1174          GLenumToString(GLESEnum::BufferTargetARB, target),
   1175          GLenumToString(GLESEnum::AllEnums, pname), (uintptr_t)params);
   1176 
   1177    if (context)
   1178    {
   1179        BufferBinding targetPacked = PackParam<BufferBinding>(target);
   1180        SCOPED_SHARE_CONTEXT_LOCK(context);
   1181        bool isCallValid =
   1182            (context->skipValidation() ||
   1183             ValidateGetBufferPointerv(context, angle::EntryPoint::GLGetBufferPointerv,
   1184                                       targetPacked, pname, params));
   1185        if (isCallValid)
   1186        {
   1187            context->getBufferPointerv(targetPacked, pname, params);
   1188        }
   1189        ANGLE_CAPTURE_GL(GetBufferPointerv, isCallValid, context, targetPacked, pname, params);
   1190    }
   1191    else
   1192    {
   1193        GenerateContextLostErrorOnCurrentGlobalContext();
   1194    }
   1195 }
   1196 
   1197 GLint GL_APIENTRY GL_GetFragDataLocation(GLuint program, const GLchar *name)
   1198 {
   1199    Context *context = GetValidGlobalContext();
   1200    EVENT(context, GLGetFragDataLocation, "context = %d, program = %u, name = 0x%016" PRIxPTR "",
   1201          CID(context), program, (uintptr_t)name);
   1202 
   1203    GLint returnValue;
   1204    if (context)
   1205    {
   1206        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
   1207        SCOPED_SHARE_CONTEXT_LOCK(context);
   1208        bool isCallValid =
   1209            (context->skipValidation() ||
   1210             ValidateGetFragDataLocation(context, angle::EntryPoint::GLGetFragDataLocation,
   1211                                         programPacked, name));
   1212        if (isCallValid)
   1213        {
   1214            returnValue = context->getFragDataLocation(programPacked, name);
   1215        }
   1216        else
   1217        {
   1218            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetFragDataLocation, GLint>();
   1219        }
   1220        ANGLE_CAPTURE_GL(GetFragDataLocation, isCallValid, context, programPacked, name,
   1221                         returnValue);
   1222    }
   1223    else
   1224    {
   1225        GenerateContextLostErrorOnCurrentGlobalContext();
   1226        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetFragDataLocation, GLint>();
   1227    }
   1228    return returnValue;
   1229 }
   1230 
   1231 void GL_APIENTRY GL_GetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
   1232 {
   1233    Context *context = GetValidGlobalContext();
   1234    EVENT(context, GLGetInteger64i_v,
   1235          "context = %d, target = %s, index = %u, data = 0x%016" PRIxPTR "", CID(context),
   1236          GLenumToString(GLESEnum::GetPName, target), index, (uintptr_t)data);
   1237 
   1238    if (context)
   1239    {
   1240        SCOPED_SHARE_CONTEXT_LOCK(context);
   1241        bool isCallValid = (context->skipValidation() ||
   1242                            ValidateGetInteger64i_v(context, angle::EntryPoint::GLGetInteger64i_v,
   1243                                                    target, index, data));
   1244        if (isCallValid)
   1245        {
   1246            context->getInteger64i_v(target, index, data);
   1247        }
   1248        ANGLE_CAPTURE_GL(GetInteger64i_v, isCallValid, context, target, index, data);
   1249    }
   1250    else
   1251    {
   1252        GenerateContextLostErrorOnCurrentGlobalContext();
   1253    }
   1254 }
   1255 
   1256 void GL_APIENTRY GL_GetInteger64v(GLenum pname, GLint64 *data)
   1257 {
   1258    Context *context = GetValidGlobalContext();
   1259    EVENT(context, GLGetInteger64v, "context = %d, pname = %s, data = 0x%016" PRIxPTR "",
   1260          CID(context), GLenumToString(GLESEnum::GetPName, pname), (uintptr_t)data);
   1261 
   1262    if (context)
   1263    {
   1264        SCOPED_SHARE_CONTEXT_LOCK(context);
   1265        bool isCallValid =
   1266            (context->skipValidation() ||
   1267             ValidateGetInteger64v(context, angle::EntryPoint::GLGetInteger64v, pname, data));
   1268        if (isCallValid)
   1269        {
   1270            context->getInteger64v(pname, data);
   1271        }
   1272        ANGLE_CAPTURE_GL(GetInteger64v, isCallValid, context, pname, data);
   1273    }
   1274    else
   1275    {
   1276        GenerateContextLostErrorOnCurrentGlobalContext();
   1277    }
   1278 }
   1279 
   1280 void GL_APIENTRY GL_GetIntegeri_v(GLenum target, GLuint index, GLint *data)
   1281 {
   1282    Context *context = GetValidGlobalContext();
   1283    EVENT(context, GLGetIntegeri_v,
   1284          "context = %d, target = %s, index = %u, data = 0x%016" PRIxPTR "", CID(context),
   1285          GLenumToString(GLESEnum::GetPName, target), index, (uintptr_t)data);
   1286 
   1287    if (context)
   1288    {
   1289        SCOPED_SHARE_CONTEXT_LOCK(context);
   1290        bool isCallValid = (context->skipValidation() ||
   1291                            ValidateGetIntegeri_v(context, angle::EntryPoint::GLGetIntegeri_v,
   1292                                                  target, index, data));
   1293        if (isCallValid)
   1294        {
   1295            context->getIntegeri_v(target, index, data);
   1296        }
   1297        ANGLE_CAPTURE_GL(GetIntegeri_v, isCallValid, context, target, index, data);
   1298    }
   1299    else
   1300    {
   1301        GenerateContextLostErrorOnCurrentGlobalContext();
   1302    }
   1303 }
   1304 
   1305 void GL_APIENTRY GL_GetInternalformativ(GLenum target,
   1306                                        GLenum internalformat,
   1307                                        GLenum pname,
   1308                                        GLsizei count,
   1309                                        GLint *params)
   1310 {
   1311    Context *context = GetValidGlobalContext();
   1312    EVENT(context, GLGetInternalformativ,
   1313          "context = %d, target = %s, internalformat = %s, pname = %s, count = %d, params = "
   1314          "0x%016" PRIxPTR "",
   1315          CID(context), GLenumToString(GLESEnum::TextureTarget, target),
   1316          GLenumToString(GLESEnum::InternalFormat, internalformat),
   1317          GLenumToString(GLESEnum::InternalFormatPName, pname), count, (uintptr_t)params);
   1318 
   1319    if (context)
   1320    {
   1321        SCOPED_SHARE_CONTEXT_LOCK(context);
   1322        bool isCallValid =
   1323            (context->skipValidation() ||
   1324             ValidateGetInternalformativ(context, angle::EntryPoint::GLGetInternalformativ, target,
   1325                                         internalformat, pname, count, params));
   1326        if (isCallValid)
   1327        {
   1328            context->getInternalformativ(target, internalformat, pname, count, params);
   1329        }
   1330        ANGLE_CAPTURE_GL(GetInternalformativ, isCallValid, context, target, internalformat, pname,
   1331                         count, params);
   1332    }
   1333    else
   1334    {
   1335        GenerateContextLostErrorOnCurrentGlobalContext();
   1336    }
   1337 }
   1338 
   1339 void GL_APIENTRY GL_GetProgramBinary(GLuint program,
   1340                                     GLsizei bufSize,
   1341                                     GLsizei *length,
   1342                                     GLenum *binaryFormat,
   1343                                     void *binary)
   1344 {
   1345    Context *context = GetValidGlobalContext();
   1346    EVENT(context, GLGetProgramBinary,
   1347          "context = %d, program = %u, bufSize = %d, length = 0x%016" PRIxPTR
   1348          ", binaryFormat = 0x%016" PRIxPTR ", binary = 0x%016" PRIxPTR "",
   1349          CID(context), program, bufSize, (uintptr_t)length, (uintptr_t)binaryFormat,
   1350          (uintptr_t)binary);
   1351 
   1352    if (context)
   1353    {
   1354        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
   1355        SCOPED_SHARE_CONTEXT_LOCK(context);
   1356        bool isCallValid =
   1357            (context->skipValidation() ||
   1358             ValidateGetProgramBinary(context, angle::EntryPoint::GLGetProgramBinary, programPacked,
   1359                                      bufSize, length, binaryFormat, binary));
   1360        if (isCallValid)
   1361        {
   1362            context->getProgramBinary(programPacked, bufSize, length, binaryFormat, binary);
   1363        }
   1364        ANGLE_CAPTURE_GL(GetProgramBinary, isCallValid, context, programPacked, bufSize, length,
   1365                         binaryFormat, binary);
   1366    }
   1367    else
   1368    {
   1369        GenerateContextLostErrorOnCurrentGlobalContext();
   1370    }
   1371 }
   1372 
   1373 void GL_APIENTRY GL_GetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
   1374 {
   1375    Context *context = GetValidGlobalContext();
   1376    EVENT(context, GLGetQueryObjectuiv,
   1377          "context = %d, id = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), id,
   1378          GLenumToString(GLESEnum::QueryObjectParameterName, pname), (uintptr_t)params);
   1379 
   1380    if (context)
   1381    {
   1382        QueryID idPacked = PackParam<QueryID>(id);
   1383        SCOPED_SHARE_CONTEXT_LOCK(context);
   1384        bool isCallValid =
   1385            (context->skipValidation() ||
   1386             ValidateGetQueryObjectuiv(context, angle::EntryPoint::GLGetQueryObjectuiv, idPacked,
   1387                                       pname, params));
   1388        if (isCallValid)
   1389        {
   1390            context->getQueryObjectuiv(idPacked, pname, params);
   1391        }
   1392        ANGLE_CAPTURE_GL(GetQueryObjectuiv, isCallValid, context, idPacked, pname, params);
   1393    }
   1394    else
   1395    {
   1396        GenerateContextLostErrorOnCurrentGlobalContext();
   1397    }
   1398 }
   1399 
   1400 void GL_APIENTRY GL_GetQueryiv(GLenum target, GLenum pname, GLint *params)
   1401 {
   1402    Context *context = GetValidGlobalContext();
   1403    EVENT(context, GLGetQueryiv,
   1404          "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
   1405          GLenumToString(GLESEnum::QueryTarget, target),
   1406          GLenumToString(GLESEnum::QueryParameterName, pname), (uintptr_t)params);
   1407 
   1408    if (context)
   1409    {
   1410        QueryType targetPacked = PackParam<QueryType>(target);
   1411        SCOPED_SHARE_CONTEXT_LOCK(context);
   1412        bool isCallValid = (context->skipValidation() ||
   1413                            ValidateGetQueryiv(context, angle::EntryPoint::GLGetQueryiv,
   1414                                               targetPacked, pname, params));
   1415        if (isCallValid)
   1416        {
   1417            context->getQueryiv(targetPacked, pname, params);
   1418        }
   1419        ANGLE_CAPTURE_GL(GetQueryiv, isCallValid, context, targetPacked, pname, params);
   1420    }
   1421    else
   1422    {
   1423        GenerateContextLostErrorOnCurrentGlobalContext();
   1424    }
   1425 }
   1426 
   1427 void GL_APIENTRY GL_GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
   1428 {
   1429    Context *context = GetValidGlobalContext();
   1430    EVENT(context, GLGetSamplerParameterfv,
   1431          "context = %d, sampler = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
   1432          sampler, GLenumToString(GLESEnum::SamplerParameterF, pname), (uintptr_t)params);
   1433 
   1434    if (context)
   1435    {
   1436        SamplerID samplerPacked = PackParam<SamplerID>(sampler);
   1437        SCOPED_SHARE_CONTEXT_LOCK(context);
   1438        bool isCallValid =
   1439            (context->skipValidation() ||
   1440             ValidateGetSamplerParameterfv(context, angle::EntryPoint::GLGetSamplerParameterfv,
   1441                                           samplerPacked, pname, params));
   1442        if (isCallValid)
   1443        {
   1444            context->getSamplerParameterfv(samplerPacked, pname, params);
   1445        }
   1446        ANGLE_CAPTURE_GL(GetSamplerParameterfv, isCallValid, context, samplerPacked, pname, params);
   1447    }
   1448    else
   1449    {
   1450        GenerateContextLostErrorOnCurrentGlobalContext();
   1451    }
   1452 }
   1453 
   1454 void GL_APIENTRY GL_GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
   1455 {
   1456    Context *context = GetValidGlobalContext();
   1457    EVENT(context, GLGetSamplerParameteriv,
   1458          "context = %d, sampler = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
   1459          sampler, GLenumToString(GLESEnum::SamplerParameterI, pname), (uintptr_t)params);
   1460 
   1461    if (context)
   1462    {
   1463        SamplerID samplerPacked = PackParam<SamplerID>(sampler);
   1464        SCOPED_SHARE_CONTEXT_LOCK(context);
   1465        bool isCallValid =
   1466            (context->skipValidation() ||
   1467             ValidateGetSamplerParameteriv(context, angle::EntryPoint::GLGetSamplerParameteriv,
   1468                                           samplerPacked, pname, params));
   1469        if (isCallValid)
   1470        {
   1471            context->getSamplerParameteriv(samplerPacked, pname, params);
   1472        }
   1473        ANGLE_CAPTURE_GL(GetSamplerParameteriv, isCallValid, context, samplerPacked, pname, params);
   1474    }
   1475    else
   1476    {
   1477        GenerateContextLostErrorOnCurrentGlobalContext();
   1478    }
   1479 }
   1480 
   1481 const GLubyte *GL_APIENTRY GL_GetStringi(GLenum name, GLuint index)
   1482 {
   1483    Context *context = GetValidGlobalContext();
   1484    EVENT(context, GLGetStringi, "context = %d, name = %s, index = %u", CID(context),
   1485          GLenumToString(GLESEnum::StringName, name), index);
   1486 
   1487    const GLubyte *returnValue;
   1488    if (context)
   1489    {
   1490        SCOPED_SHARE_CONTEXT_LOCK(context);
   1491        bool isCallValid =
   1492            (context->skipValidation() ||
   1493             ValidateGetStringi(context, angle::EntryPoint::GLGetStringi, name, index));
   1494        if (isCallValid)
   1495        {
   1496            returnValue = context->getStringi(name, index);
   1497        }
   1498        else
   1499        {
   1500            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetStringi, const GLubyte *>();
   1501        }
   1502        ANGLE_CAPTURE_GL(GetStringi, isCallValid, context, name, index, returnValue);
   1503    }
   1504    else
   1505    {
   1506        GenerateContextLostErrorOnCurrentGlobalContext();
   1507        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetStringi, const GLubyte *>();
   1508    }
   1509    return returnValue;
   1510 }
   1511 
   1512 void GL_APIENTRY
   1513 GL_GetSynciv(GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values)
   1514 {
   1515    Context *context = GetGlobalContext();
   1516    EVENT(context, GLGetSynciv,
   1517          "context = %d, sync = 0x%016" PRIxPTR ", pname = %s, count = %d, length = 0x%016" PRIxPTR
   1518          ", values = 0x%016" PRIxPTR "",
   1519          CID(context), (uintptr_t)sync, GLenumToString(GLESEnum::SyncParameterName, pname), count,
   1520          (uintptr_t)length, (uintptr_t)values);
   1521 
   1522    if (context)
   1523    {
   1524        SCOPED_SHARE_CONTEXT_LOCK(context);
   1525        bool isCallValid =
   1526            (context->skipValidation() || ValidateGetSynciv(context, angle::EntryPoint::GLGetSynciv,
   1527                                                            sync, pname, count, length, values));
   1528        if (isCallValid)
   1529        {
   1530            context->getSynciv(sync, pname, count, length, values);
   1531        }
   1532        ANGLE_CAPTURE_GL(GetSynciv, isCallValid, context, sync, pname, count, length, values);
   1533    }
   1534    else
   1535    {}
   1536 }
   1537 
   1538 void GL_APIENTRY GL_GetTransformFeedbackVarying(GLuint program,
   1539                                                GLuint index,
   1540                                                GLsizei bufSize,
   1541                                                GLsizei *length,
   1542                                                GLsizei *size,
   1543                                                GLenum *type,
   1544                                                GLchar *name)
   1545 {
   1546    Context *context = GetValidGlobalContext();
   1547    EVENT(context, GLGetTransformFeedbackVarying,
   1548          "context = %d, program = %u, index = %u, bufSize = %d, length = 0x%016" PRIxPTR
   1549          ", size = 0x%016" PRIxPTR ", type = 0x%016" PRIxPTR ", name = 0x%016" PRIxPTR "",
   1550          CID(context), program, index, bufSize, (uintptr_t)length, (uintptr_t)size,
   1551          (uintptr_t)type, (uintptr_t)name);
   1552 
   1553    if (context)
   1554    {
   1555        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
   1556        SCOPED_SHARE_CONTEXT_LOCK(context);
   1557        bool isCallValid = (context->skipValidation() ||
   1558                            ValidateGetTransformFeedbackVarying(
   1559                                context, angle::EntryPoint::GLGetTransformFeedbackVarying,
   1560                                programPacked, index, bufSize, length, size, type, name));
   1561        if (isCallValid)
   1562        {
   1563            context->getTransformFeedbackVarying(programPacked, index, bufSize, length, size, type,
   1564                                                 name);
   1565        }
   1566        ANGLE_CAPTURE_GL(GetTransformFeedbackVarying, isCallValid, context, programPacked, index,
   1567                         bufSize, length, size, type, name);
   1568    }
   1569    else
   1570    {
   1571        GenerateContextLostErrorOnCurrentGlobalContext();
   1572    }
   1573 }
   1574 
   1575 GLuint GL_APIENTRY GL_GetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
   1576 {
   1577    Context *context = GetValidGlobalContext();
   1578    EVENT(context, GLGetUniformBlockIndex,
   1579          "context = %d, program = %u, uniformBlockName = 0x%016" PRIxPTR "", CID(context), program,
   1580          (uintptr_t)uniformBlockName);
   1581 
   1582    GLuint returnValue;
   1583    if (context)
   1584    {
   1585        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
   1586        SCOPED_SHARE_CONTEXT_LOCK(context);
   1587        bool isCallValid =
   1588            (context->skipValidation() ||
   1589             ValidateGetUniformBlockIndex(context, angle::EntryPoint::GLGetUniformBlockIndex,
   1590                                          programPacked, uniformBlockName));
   1591        if (isCallValid)
   1592        {
   1593            returnValue = context->getUniformBlockIndex(programPacked, uniformBlockName);
   1594        }
   1595        else
   1596        {
   1597            returnValue =
   1598                GetDefaultReturnValue<angle::EntryPoint::GLGetUniformBlockIndex, GLuint>();
   1599        }
   1600        ANGLE_CAPTURE_GL(GetUniformBlockIndex, isCallValid, context, programPacked,
   1601                         uniformBlockName, returnValue);
   1602    }
   1603    else
   1604    {
   1605        GenerateContextLostErrorOnCurrentGlobalContext();
   1606        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLGetUniformBlockIndex, GLuint>();
   1607    }
   1608    return returnValue;
   1609 }
   1610 
   1611 void GL_APIENTRY GL_GetUniformIndices(GLuint program,
   1612                                      GLsizei uniformCount,
   1613                                      const GLchar *const *uniformNames,
   1614                                      GLuint *uniformIndices)
   1615 {
   1616    Context *context = GetValidGlobalContext();
   1617    EVENT(context, GLGetUniformIndices,
   1618          "context = %d, program = %u, uniformCount = %d, uniformNames = 0x%016" PRIxPTR
   1619          ", uniformIndices = 0x%016" PRIxPTR "",
   1620          CID(context), program, uniformCount, (uintptr_t)uniformNames, (uintptr_t)uniformIndices);
   1621 
   1622    if (context)
   1623    {
   1624        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
   1625        SCOPED_SHARE_CONTEXT_LOCK(context);
   1626        bool isCallValid =
   1627            (context->skipValidation() ||
   1628             ValidateGetUniformIndices(context, angle::EntryPoint::GLGetUniformIndices,
   1629                                       programPacked, uniformCount, uniformNames, uniformIndices));
   1630        if (isCallValid)
   1631        {
   1632            context->getUniformIndices(programPacked, uniformCount, uniformNames, uniformIndices);
   1633        }
   1634        ANGLE_CAPTURE_GL(GetUniformIndices, isCallValid, context, programPacked, uniformCount,
   1635                         uniformNames, uniformIndices);
   1636    }
   1637    else
   1638    {
   1639        GenerateContextLostErrorOnCurrentGlobalContext();
   1640    }
   1641 }
   1642 
   1643 void GL_APIENTRY GL_GetUniformuiv(GLuint program, GLint location, GLuint *params)
   1644 {
   1645    Context *context = GetValidGlobalContext();
   1646    EVENT(context, GLGetUniformuiv,
   1647          "context = %d, program = %u, location = %d, params = 0x%016" PRIxPTR "", CID(context),
   1648          program, location, (uintptr_t)params);
   1649 
   1650    if (context)
   1651    {
   1652        ShaderProgramID programPacked  = PackParam<ShaderProgramID>(program);
   1653        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   1654        SCOPED_SHARE_CONTEXT_LOCK(context);
   1655        bool isCallValid = (context->skipValidation() ||
   1656                            ValidateGetUniformuiv(context, angle::EntryPoint::GLGetUniformuiv,
   1657                                                  programPacked, locationPacked, params));
   1658        if (isCallValid)
   1659        {
   1660            context->getUniformuiv(programPacked, locationPacked, params);
   1661        }
   1662        ANGLE_CAPTURE_GL(GetUniformuiv, isCallValid, context, programPacked, locationPacked,
   1663                         params);
   1664    }
   1665    else
   1666    {
   1667        GenerateContextLostErrorOnCurrentGlobalContext();
   1668    }
   1669 }
   1670 
   1671 void GL_APIENTRY GL_GetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
   1672 {
   1673    Context *context = GetValidGlobalContext();
   1674    EVENT(context, GLGetVertexAttribIiv,
   1675          "context = %d, index = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), index,
   1676          GLenumToString(GLESEnum::VertexAttribEnum, pname), (uintptr_t)params);
   1677 
   1678    if (context)
   1679    {
   1680        SCOPED_SHARE_CONTEXT_LOCK(context);
   1681        bool isCallValid =
   1682            (context->skipValidation() ||
   1683             ValidateGetVertexAttribIiv(context, angle::EntryPoint::GLGetVertexAttribIiv, index,
   1684                                        pname, params));
   1685        if (isCallValid)
   1686        {
   1687            context->getVertexAttribIiv(index, pname, params);
   1688        }
   1689        ANGLE_CAPTURE_GL(GetVertexAttribIiv, isCallValid, context, index, pname, params);
   1690    }
   1691    else
   1692    {
   1693        GenerateContextLostErrorOnCurrentGlobalContext();
   1694    }
   1695 }
   1696 
   1697 void GL_APIENTRY GL_GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
   1698 {
   1699    Context *context = GetValidGlobalContext();
   1700    EVENT(context, GLGetVertexAttribIuiv,
   1701          "context = %d, index = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), index,
   1702          GLenumToString(GLESEnum::VertexAttribEnum, pname), (uintptr_t)params);
   1703 
   1704    if (context)
   1705    {
   1706        SCOPED_SHARE_CONTEXT_LOCK(context);
   1707        bool isCallValid =
   1708            (context->skipValidation() ||
   1709             ValidateGetVertexAttribIuiv(context, angle::EntryPoint::GLGetVertexAttribIuiv, index,
   1710                                         pname, params));
   1711        if (isCallValid)
   1712        {
   1713            context->getVertexAttribIuiv(index, pname, params);
   1714        }
   1715        ANGLE_CAPTURE_GL(GetVertexAttribIuiv, isCallValid, context, index, pname, params);
   1716    }
   1717    else
   1718    {
   1719        GenerateContextLostErrorOnCurrentGlobalContext();
   1720    }
   1721 }
   1722 
   1723 void GL_APIENTRY GL_InvalidateFramebuffer(GLenum target,
   1724                                          GLsizei numAttachments,
   1725                                          const GLenum *attachments)
   1726 {
   1727    Context *context = GetValidGlobalContext();
   1728    EVENT(context, GLInvalidateFramebuffer,
   1729          "context = %d, target = %s, numAttachments = %d, attachments = 0x%016" PRIxPTR "",
   1730          CID(context), GLenumToString(GLESEnum::FramebufferTarget, target), numAttachments,
   1731          (uintptr_t)attachments);
   1732 
   1733    if (context)
   1734    {
   1735        SCOPED_SHARE_CONTEXT_LOCK(context);
   1736        bool isCallValid =
   1737            (context->skipValidation() ||
   1738             ValidateInvalidateFramebuffer(context, angle::EntryPoint::GLInvalidateFramebuffer,
   1739                                           target, numAttachments, attachments));
   1740        if (isCallValid)
   1741        {
   1742            context->invalidateFramebuffer(target, numAttachments, attachments);
   1743        }
   1744        ANGLE_CAPTURE_GL(InvalidateFramebuffer, isCallValid, context, target, numAttachments,
   1745                         attachments);
   1746    }
   1747    else
   1748    {
   1749        GenerateContextLostErrorOnCurrentGlobalContext();
   1750    }
   1751 }
   1752 
   1753 void GL_APIENTRY GL_InvalidateSubFramebuffer(GLenum target,
   1754                                             GLsizei numAttachments,
   1755                                             const GLenum *attachments,
   1756                                             GLint x,
   1757                                             GLint y,
   1758                                             GLsizei width,
   1759                                             GLsizei height)
   1760 {
   1761    Context *context = GetValidGlobalContext();
   1762    EVENT(context, GLInvalidateSubFramebuffer,
   1763          "context = %d, target = %s, numAttachments = %d, attachments = 0x%016" PRIxPTR
   1764          ", x = %d, y = %d, width = %d, height = %d",
   1765          CID(context), GLenumToString(GLESEnum::FramebufferTarget, target), numAttachments,
   1766          (uintptr_t)attachments, x, y, width, height);
   1767 
   1768    if (context)
   1769    {
   1770        SCOPED_SHARE_CONTEXT_LOCK(context);
   1771        bool isCallValid = (context->skipValidation() ||
   1772                            ValidateInvalidateSubFramebuffer(
   1773                                context, angle::EntryPoint::GLInvalidateSubFramebuffer, target,
   1774                                numAttachments, attachments, x, y, width, height));
   1775        if (isCallValid)
   1776        {
   1777            context->invalidateSubFramebuffer(target, numAttachments, attachments, x, y, width,
   1778                                              height);
   1779        }
   1780        ANGLE_CAPTURE_GL(InvalidateSubFramebuffer, isCallValid, context, target, numAttachments,
   1781                         attachments, x, y, width, height);
   1782    }
   1783    else
   1784    {
   1785        GenerateContextLostErrorOnCurrentGlobalContext();
   1786    }
   1787 }
   1788 
   1789 GLboolean GL_APIENTRY GL_IsQuery(GLuint id)
   1790 {
   1791    Context *context = GetValidGlobalContext();
   1792    EVENT(context, GLIsQuery, "context = %d, id = %u", CID(context), id);
   1793 
   1794    GLboolean returnValue;
   1795    if (context)
   1796    {
   1797        QueryID idPacked = PackParam<QueryID>(id);
   1798        SCOPED_SHARE_CONTEXT_LOCK(context);
   1799        bool isCallValid = (context->skipValidation() ||
   1800                            ValidateIsQuery(context, angle::EntryPoint::GLIsQuery, idPacked));
   1801        if (isCallValid)
   1802        {
   1803            returnValue = context->isQuery(idPacked);
   1804        }
   1805        else
   1806        {
   1807            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsQuery, GLboolean>();
   1808        }
   1809        ANGLE_CAPTURE_GL(IsQuery, isCallValid, context, idPacked, returnValue);
   1810    }
   1811    else
   1812    {
   1813        GenerateContextLostErrorOnCurrentGlobalContext();
   1814        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsQuery, GLboolean>();
   1815    }
   1816    return returnValue;
   1817 }
   1818 
   1819 GLboolean GL_APIENTRY GL_IsSampler(GLuint sampler)
   1820 {
   1821    Context *context = GetValidGlobalContext();
   1822    EVENT(context, GLIsSampler, "context = %d, sampler = %u", CID(context), sampler);
   1823 
   1824    GLboolean returnValue;
   1825    if (context)
   1826    {
   1827        SamplerID samplerPacked = PackParam<SamplerID>(sampler);
   1828        SCOPED_SHARE_CONTEXT_LOCK(context);
   1829        bool isCallValid =
   1830            (context->skipValidation() ||
   1831             ValidateIsSampler(context, angle::EntryPoint::GLIsSampler, samplerPacked));
   1832        if (isCallValid)
   1833        {
   1834            returnValue = context->isSampler(samplerPacked);
   1835        }
   1836        else
   1837        {
   1838            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsSampler, GLboolean>();
   1839        }
   1840        ANGLE_CAPTURE_GL(IsSampler, isCallValid, context, samplerPacked, returnValue);
   1841    }
   1842    else
   1843    {
   1844        GenerateContextLostErrorOnCurrentGlobalContext();
   1845        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsSampler, GLboolean>();
   1846    }
   1847    return returnValue;
   1848 }
   1849 
   1850 GLboolean GL_APIENTRY GL_IsSync(GLsync sync)
   1851 {
   1852    Context *context = GetValidGlobalContext();
   1853    EVENT(context, GLIsSync, "context = %d, sync = 0x%016" PRIxPTR "", CID(context),
   1854          (uintptr_t)sync);
   1855 
   1856    GLboolean returnValue;
   1857    if (context)
   1858    {
   1859        SCOPED_SHARE_CONTEXT_LOCK(context);
   1860        bool isCallValid = (context->skipValidation() ||
   1861                            ValidateIsSync(context, angle::EntryPoint::GLIsSync, sync));
   1862        if (isCallValid)
   1863        {
   1864            returnValue = context->isSync(sync);
   1865        }
   1866        else
   1867        {
   1868            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsSync, GLboolean>();
   1869        }
   1870        ANGLE_CAPTURE_GL(IsSync, isCallValid, context, sync, returnValue);
   1871    }
   1872    else
   1873    {
   1874        GenerateContextLostErrorOnCurrentGlobalContext();
   1875        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsSync, GLboolean>();
   1876    }
   1877    return returnValue;
   1878 }
   1879 
   1880 GLboolean GL_APIENTRY GL_IsTransformFeedback(GLuint id)
   1881 {
   1882    Context *context = GetValidGlobalContext();
   1883    EVENT(context, GLIsTransformFeedback, "context = %d, id = %u", CID(context), id);
   1884 
   1885    GLboolean returnValue;
   1886    if (context)
   1887    {
   1888        TransformFeedbackID idPacked = PackParam<TransformFeedbackID>(id);
   1889        SCOPED_SHARE_CONTEXT_LOCK(context);
   1890        bool isCallValid = (context->skipValidation() ||
   1891                            ValidateIsTransformFeedback(
   1892                                context, angle::EntryPoint::GLIsTransformFeedback, idPacked));
   1893        if (isCallValid)
   1894        {
   1895            returnValue = context->isTransformFeedback(idPacked);
   1896        }
   1897        else
   1898        {
   1899            returnValue =
   1900                GetDefaultReturnValue<angle::EntryPoint::GLIsTransformFeedback, GLboolean>();
   1901        }
   1902        ANGLE_CAPTURE_GL(IsTransformFeedback, isCallValid, context, idPacked, returnValue);
   1903    }
   1904    else
   1905    {
   1906        GenerateContextLostErrorOnCurrentGlobalContext();
   1907        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsTransformFeedback, GLboolean>();
   1908    }
   1909    return returnValue;
   1910 }
   1911 
   1912 GLboolean GL_APIENTRY GL_IsVertexArray(GLuint array)
   1913 {
   1914    Context *context = GetValidGlobalContext();
   1915    EVENT(context, GLIsVertexArray, "context = %d, array = %u", CID(context), array);
   1916 
   1917    GLboolean returnValue;
   1918    if (context)
   1919    {
   1920        VertexArrayID arrayPacked = PackParam<VertexArrayID>(array);
   1921        SCOPED_SHARE_CONTEXT_LOCK(context);
   1922        bool isCallValid =
   1923            (context->skipValidation() ||
   1924             ValidateIsVertexArray(context, angle::EntryPoint::GLIsVertexArray, arrayPacked));
   1925        if (isCallValid)
   1926        {
   1927            returnValue = context->isVertexArray(arrayPacked);
   1928        }
   1929        else
   1930        {
   1931            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsVertexArray, GLboolean>();
   1932        }
   1933        ANGLE_CAPTURE_GL(IsVertexArray, isCallValid, context, arrayPacked, returnValue);
   1934    }
   1935    else
   1936    {
   1937        GenerateContextLostErrorOnCurrentGlobalContext();
   1938        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLIsVertexArray, GLboolean>();
   1939    }
   1940    return returnValue;
   1941 }
   1942 
   1943 void *GL_APIENTRY GL_MapBufferRange(GLenum target,
   1944                                    GLintptr offset,
   1945                                    GLsizeiptr length,
   1946                                    GLbitfield access)
   1947 {
   1948    Context *context = GetValidGlobalContext();
   1949    EVENT(context, GLMapBufferRange,
   1950          "context = %d, target = %s, offset = %llu, length = %llu, access = %s", CID(context),
   1951          GLenumToString(GLESEnum::BufferTargetARB, target),
   1952          static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length),
   1953          GLbitfieldToString(GLESEnum::MapBufferAccessMask, access).c_str());
   1954 
   1955    void *returnValue;
   1956    if (context)
   1957    {
   1958        BufferBinding targetPacked = PackParam<BufferBinding>(target);
   1959        SCOPED_SHARE_CONTEXT_LOCK(context);
   1960        bool isCallValid = (context->skipValidation() ||
   1961                            ValidateMapBufferRange(context, angle::EntryPoint::GLMapBufferRange,
   1962                                                   targetPacked, offset, length, access));
   1963        if (isCallValid)
   1964        {
   1965            returnValue = context->mapBufferRange(targetPacked, offset, length, access);
   1966        }
   1967        else
   1968        {
   1969            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapBufferRange, void *>();
   1970        }
   1971        ANGLE_CAPTURE_GL(MapBufferRange, isCallValid, context, targetPacked, offset, length, access,
   1972                         returnValue);
   1973    }
   1974    else
   1975    {
   1976        GenerateContextLostErrorOnCurrentGlobalContext();
   1977        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLMapBufferRange, void *>();
   1978    }
   1979    return returnValue;
   1980 }
   1981 
   1982 void GL_APIENTRY GL_PauseTransformFeedback()
   1983 {
   1984    Context *context = GetValidGlobalContext();
   1985    EVENT(context, GLPauseTransformFeedback, "context = %d", CID(context));
   1986 
   1987    if (context)
   1988    {
   1989        SCOPED_SHARE_CONTEXT_LOCK(context);
   1990        bool isCallValid =
   1991            (context->skipValidation() ||
   1992             ValidatePauseTransformFeedback(context, angle::EntryPoint::GLPauseTransformFeedback));
   1993        if (isCallValid)
   1994        {
   1995            context->pauseTransformFeedback();
   1996        }
   1997        ANGLE_CAPTURE_GL(PauseTransformFeedback, isCallValid, context);
   1998    }
   1999    else
   2000    {
   2001        GenerateContextLostErrorOnCurrentGlobalContext();
   2002    }
   2003 }
   2004 
   2005 void GL_APIENTRY GL_ProgramBinary(GLuint program,
   2006                                  GLenum binaryFormat,
   2007                                  const void *binary,
   2008                                  GLsizei length)
   2009 {
   2010    Context *context = GetValidGlobalContext();
   2011    EVENT(context, GLProgramBinary,
   2012          "context = %d, program = %u, binaryFormat = %s, binary = 0x%016" PRIxPTR ", length = %d",
   2013          CID(context), program, GLenumToString(GLESEnum::AllEnums, binaryFormat),
   2014          (uintptr_t)binary, length);
   2015 
   2016    if (context)
   2017    {
   2018        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
   2019        SCOPED_SHARE_CONTEXT_LOCK(context);
   2020        bool isCallValid = (context->skipValidation() ||
   2021                            ValidateProgramBinary(context, angle::EntryPoint::GLProgramBinary,
   2022                                                  programPacked, binaryFormat, binary, length));
   2023        if (isCallValid)
   2024        {
   2025            context->programBinary(programPacked, binaryFormat, binary, length);
   2026        }
   2027        ANGLE_CAPTURE_GL(ProgramBinary, isCallValid, context, programPacked, binaryFormat, binary,
   2028                         length);
   2029    }
   2030    else
   2031    {
   2032        GenerateContextLostErrorOnCurrentGlobalContext();
   2033    }
   2034 }
   2035 
   2036 void GL_APIENTRY GL_ProgramParameteri(GLuint program, GLenum pname, GLint value)
   2037 {
   2038    Context *context = GetValidGlobalContext();
   2039    EVENT(context, GLProgramParameteri, "context = %d, program = %u, pname = %s, value = %d",
   2040          CID(context), program, GLenumToString(GLESEnum::ProgramParameterPName, pname), value);
   2041 
   2042    if (context)
   2043    {
   2044        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
   2045        SCOPED_SHARE_CONTEXT_LOCK(context);
   2046        bool isCallValid =
   2047            (context->skipValidation() ||
   2048             ValidateProgramParameteri(context, angle::EntryPoint::GLProgramParameteri,
   2049                                       programPacked, pname, value));
   2050        if (isCallValid)
   2051        {
   2052            context->programParameteri(programPacked, pname, value);
   2053        }
   2054        ANGLE_CAPTURE_GL(ProgramParameteri, isCallValid, context, programPacked, pname, value);
   2055    }
   2056    else
   2057    {
   2058        GenerateContextLostErrorOnCurrentGlobalContext();
   2059    }
   2060 }
   2061 
   2062 void GL_APIENTRY GL_ReadBuffer(GLenum src)
   2063 {
   2064    Context *context = GetValidGlobalContext();
   2065    EVENT(context, GLReadBuffer, "context = %d, src = %s", CID(context),
   2066          GLenumToString(GLESEnum::ReadBufferMode, src));
   2067 
   2068    if (context)
   2069    {
   2070        SCOPED_SHARE_CONTEXT_LOCK(context);
   2071        bool isCallValid = (context->skipValidation() ||
   2072                            ValidateReadBuffer(context, angle::EntryPoint::GLReadBuffer, src));
   2073        if (isCallValid)
   2074        {
   2075            context->readBuffer(src);
   2076        }
   2077        ANGLE_CAPTURE_GL(ReadBuffer, isCallValid, context, src);
   2078    }
   2079    else
   2080    {
   2081        GenerateContextLostErrorOnCurrentGlobalContext();
   2082    }
   2083 }
   2084 
   2085 void GL_APIENTRY GL_RenderbufferStorageMultisample(GLenum target,
   2086                                                   GLsizei samples,
   2087                                                   GLenum internalformat,
   2088                                                   GLsizei width,
   2089                                                   GLsizei height)
   2090 {
   2091    Context *context = GetValidGlobalContext();
   2092    EVENT(context, GLRenderbufferStorageMultisample,
   2093          "context = %d, target = %s, samples = %d, internalformat = %s, width = %d, height = %d",
   2094          CID(context), GLenumToString(GLESEnum::RenderbufferTarget, target), samples,
   2095          GLenumToString(GLESEnum::InternalFormat, internalformat), width, height);
   2096 
   2097    if (context)
   2098    {
   2099        SCOPED_SHARE_CONTEXT_LOCK(context);
   2100        bool isCallValid = (context->skipValidation() ||
   2101                            ValidateRenderbufferStorageMultisample(
   2102                                context, angle::EntryPoint::GLRenderbufferStorageMultisample,
   2103                                target, samples, internalformat, width, height));
   2104        if (isCallValid)
   2105        {
   2106            context->renderbufferStorageMultisample(target, samples, internalformat, width, height);
   2107        }
   2108        ANGLE_CAPTURE_GL(RenderbufferStorageMultisample, isCallValid, context, target, samples,
   2109                         internalformat, width, height);
   2110    }
   2111    else
   2112    {
   2113        GenerateContextLostErrorOnCurrentGlobalContext();
   2114    }
   2115 }
   2116 
   2117 void GL_APIENTRY GL_ResumeTransformFeedback()
   2118 {
   2119    Context *context = GetValidGlobalContext();
   2120    EVENT(context, GLResumeTransformFeedback, "context = %d", CID(context));
   2121 
   2122    if (context)
   2123    {
   2124        SCOPED_SHARE_CONTEXT_LOCK(context);
   2125        bool isCallValid = (context->skipValidation() ||
   2126                            ValidateResumeTransformFeedback(
   2127                                context, angle::EntryPoint::GLResumeTransformFeedback));
   2128        if (isCallValid)
   2129        {
   2130            context->resumeTransformFeedback();
   2131        }
   2132        ANGLE_CAPTURE_GL(ResumeTransformFeedback, isCallValid, context);
   2133    }
   2134    else
   2135    {
   2136        GenerateContextLostErrorOnCurrentGlobalContext();
   2137    }
   2138 }
   2139 
   2140 void GL_APIENTRY GL_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
   2141 {
   2142    Context *context = GetValidGlobalContext();
   2143    EVENT(context, GLSamplerParameterf, "context = %d, sampler = %u, pname = %s, param = %f",
   2144          CID(context), sampler, GLenumToString(GLESEnum::SamplerParameterF, pname), param);
   2145 
   2146    if (context)
   2147    {
   2148        SamplerID samplerPacked = PackParam<SamplerID>(sampler);
   2149        SCOPED_SHARE_CONTEXT_LOCK(context);
   2150        bool isCallValid =
   2151            (context->skipValidation() ||
   2152             ValidateSamplerParameterf(context, angle::EntryPoint::GLSamplerParameterf,
   2153                                       samplerPacked, pname, param));
   2154        if (isCallValid)
   2155        {
   2156            context->samplerParameterf(samplerPacked, pname, param);
   2157        }
   2158        ANGLE_CAPTURE_GL(SamplerParameterf, isCallValid, context, samplerPacked, pname, param);
   2159    }
   2160    else
   2161    {
   2162        GenerateContextLostErrorOnCurrentGlobalContext();
   2163    }
   2164 }
   2165 
   2166 void GL_APIENTRY GL_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
   2167 {
   2168    Context *context = GetValidGlobalContext();
   2169    EVENT(context, GLSamplerParameterfv,
   2170          "context = %d, sampler = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
   2171          sampler, GLenumToString(GLESEnum::SamplerParameterF, pname), (uintptr_t)param);
   2172 
   2173    if (context)
   2174    {
   2175        SamplerID samplerPacked = PackParam<SamplerID>(sampler);
   2176        SCOPED_SHARE_CONTEXT_LOCK(context);
   2177        bool isCallValid =
   2178            (context->skipValidation() ||
   2179             ValidateSamplerParameterfv(context, angle::EntryPoint::GLSamplerParameterfv,
   2180                                        samplerPacked, pname, param));
   2181        if (isCallValid)
   2182        {
   2183            context->samplerParameterfv(samplerPacked, pname, param);
   2184        }
   2185        ANGLE_CAPTURE_GL(SamplerParameterfv, isCallValid, context, samplerPacked, pname, param);
   2186    }
   2187    else
   2188    {
   2189        GenerateContextLostErrorOnCurrentGlobalContext();
   2190    }
   2191 }
   2192 
   2193 void GL_APIENTRY GL_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
   2194 {
   2195    Context *context = GetValidGlobalContext();
   2196    EVENT(context, GLSamplerParameteri, "context = %d, sampler = %u, pname = %s, param = %d",
   2197          CID(context), sampler, GLenumToString(GLESEnum::SamplerParameterI, pname), param);
   2198 
   2199    if (context)
   2200    {
   2201        SamplerID samplerPacked = PackParam<SamplerID>(sampler);
   2202        SCOPED_SHARE_CONTEXT_LOCK(context);
   2203        bool isCallValid =
   2204            (context->skipValidation() ||
   2205             ValidateSamplerParameteri(context, angle::EntryPoint::GLSamplerParameteri,
   2206                                       samplerPacked, pname, param));
   2207        if (isCallValid)
   2208        {
   2209            context->samplerParameteri(samplerPacked, pname, param);
   2210        }
   2211        ANGLE_CAPTURE_GL(SamplerParameteri, isCallValid, context, samplerPacked, pname, param);
   2212    }
   2213    else
   2214    {
   2215        GenerateContextLostErrorOnCurrentGlobalContext();
   2216    }
   2217 }
   2218 
   2219 void GL_APIENTRY GL_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
   2220 {
   2221    Context *context = GetValidGlobalContext();
   2222    EVENT(context, GLSamplerParameteriv,
   2223          "context = %d, sampler = %u, pname = %s, param = 0x%016" PRIxPTR "", CID(context),
   2224          sampler, GLenumToString(GLESEnum::SamplerParameterI, pname), (uintptr_t)param);
   2225 
   2226    if (context)
   2227    {
   2228        SamplerID samplerPacked = PackParam<SamplerID>(sampler);
   2229        SCOPED_SHARE_CONTEXT_LOCK(context);
   2230        bool isCallValid =
   2231            (context->skipValidation() ||
   2232             ValidateSamplerParameteriv(context, angle::EntryPoint::GLSamplerParameteriv,
   2233                                        samplerPacked, pname, param));
   2234        if (isCallValid)
   2235        {
   2236            context->samplerParameteriv(samplerPacked, pname, param);
   2237        }
   2238        ANGLE_CAPTURE_GL(SamplerParameteriv, isCallValid, context, samplerPacked, pname, param);
   2239    }
   2240    else
   2241    {
   2242        GenerateContextLostErrorOnCurrentGlobalContext();
   2243    }
   2244 }
   2245 
   2246 void GL_APIENTRY GL_TexImage3D(GLenum target,
   2247                               GLint level,
   2248                               GLint internalformat,
   2249                               GLsizei width,
   2250                               GLsizei height,
   2251                               GLsizei depth,
   2252                               GLint border,
   2253                               GLenum format,
   2254                               GLenum type,
   2255                               const void *pixels)
   2256 {
   2257    Context *context = GetValidGlobalContext();
   2258    EVENT(context, GLTexImage3D,
   2259          "context = %d, target = %s, level = %d, internalformat = %d, width = %d, height = %d, "
   2260          "depth = %d, border = %d, format = %s, type = %s, pixels = 0x%016" PRIxPTR "",
   2261          CID(context), GLenumToString(GLESEnum::TextureTarget, target), level, internalformat,
   2262          width, height, depth, border, GLenumToString(GLESEnum::PixelFormat, format),
   2263          GLenumToString(GLESEnum::PixelType, type), (uintptr_t)pixels);
   2264 
   2265    if (context)
   2266    {
   2267        TextureTarget targetPacked = PackParam<TextureTarget>(target);
   2268        SCOPED_SHARE_CONTEXT_LOCK(context);
   2269        bool isCallValid = (context->skipValidation() ||
   2270                            ValidateTexImage3D(context, angle::EntryPoint::GLTexImage3D,
   2271                                               targetPacked, level, internalformat, width, height,
   2272                                               depth, border, format, type, pixels));
   2273        if (isCallValid)
   2274        {
   2275            context->texImage3D(targetPacked, level, internalformat, width, height, depth, border,
   2276                                format, type, pixels);
   2277        }
   2278        ANGLE_CAPTURE_GL(TexImage3D, isCallValid, context, targetPacked, level, internalformat,
   2279                         width, height, depth, border, format, type, pixels);
   2280    }
   2281    else
   2282    {
   2283        GenerateContextLostErrorOnCurrentGlobalContext();
   2284    }
   2285 }
   2286 
   2287 void GL_APIENTRY
   2288 GL_TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
   2289 {
   2290    Context *context = GetValidGlobalContext();
   2291    EVENT(context, GLTexStorage2D,
   2292          "context = %d, target = %s, levels = %d, internalformat = %s, width = %d, height = %d",
   2293          CID(context), GLenumToString(GLESEnum::TextureTarget, target), levels,
   2294          GLenumToString(GLESEnum::SizedInternalFormat, internalformat), width, height);
   2295 
   2296    if (context)
   2297    {
   2298        TextureType targetPacked = PackParam<TextureType>(target);
   2299        SCOPED_SHARE_CONTEXT_LOCK(context);
   2300        bool isCallValid =
   2301            (context->skipValidation() ||
   2302             ValidateTexStorage2D(context, angle::EntryPoint::GLTexStorage2D, targetPacked, levels,
   2303                                  internalformat, width, height));
   2304        if (isCallValid)
   2305        {
   2306            context->texStorage2D(targetPacked, levels, internalformat, width, height);
   2307        }
   2308        ANGLE_CAPTURE_GL(TexStorage2D, isCallValid, context, targetPacked, levels, internalformat,
   2309                         width, height);
   2310    }
   2311    else
   2312    {
   2313        GenerateContextLostErrorOnCurrentGlobalContext();
   2314    }
   2315 }
   2316 
   2317 void GL_APIENTRY GL_TexStorage3D(GLenum target,
   2318                                 GLsizei levels,
   2319                                 GLenum internalformat,
   2320                                 GLsizei width,
   2321                                 GLsizei height,
   2322                                 GLsizei depth)
   2323 {
   2324    Context *context = GetValidGlobalContext();
   2325    EVENT(context, GLTexStorage3D,
   2326          "context = %d, target = %s, levels = %d, internalformat = %s, width = %d, height = %d, "
   2327          "depth = %d",
   2328          CID(context), GLenumToString(GLESEnum::TextureTarget, target), levels,
   2329          GLenumToString(GLESEnum::SizedInternalFormat, internalformat), width, height, depth);
   2330 
   2331    if (context)
   2332    {
   2333        TextureType targetPacked = PackParam<TextureType>(target);
   2334        SCOPED_SHARE_CONTEXT_LOCK(context);
   2335        bool isCallValid =
   2336            (context->skipValidation() ||
   2337             ValidateTexStorage3D(context, angle::EntryPoint::GLTexStorage3D, targetPacked, levels,
   2338                                  internalformat, width, height, depth));
   2339        if (isCallValid)
   2340        {
   2341            context->texStorage3D(targetPacked, levels, internalformat, width, height, depth);
   2342        }
   2343        ANGLE_CAPTURE_GL(TexStorage3D, isCallValid, context, targetPacked, levels, internalformat,
   2344                         width, height, depth);
   2345    }
   2346    else
   2347    {
   2348        GenerateContextLostErrorOnCurrentGlobalContext();
   2349    }
   2350 }
   2351 
   2352 void GL_APIENTRY GL_TexSubImage3D(GLenum target,
   2353                                  GLint level,
   2354                                  GLint xoffset,
   2355                                  GLint yoffset,
   2356                                  GLint zoffset,
   2357                                  GLsizei width,
   2358                                  GLsizei height,
   2359                                  GLsizei depth,
   2360                                  GLenum format,
   2361                                  GLenum type,
   2362                                  const void *pixels)
   2363 {
   2364    Context *context = GetValidGlobalContext();
   2365    EVENT(context, GLTexSubImage3D,
   2366          "context = %d, target = %s, level = %d, xoffset = %d, yoffset = %d, zoffset = %d, width "
   2367          "= %d, height = %d, depth = %d, format = %s, type = %s, pixels = 0x%016" PRIxPTR "",
   2368          CID(context), GLenumToString(GLESEnum::TextureTarget, target), level, xoffset, yoffset,
   2369          zoffset, width, height, depth, GLenumToString(GLESEnum::PixelFormat, format),
   2370          GLenumToString(GLESEnum::PixelType, type), (uintptr_t)pixels);
   2371 
   2372    if (context)
   2373    {
   2374        TextureTarget targetPacked = PackParam<TextureTarget>(target);
   2375        SCOPED_SHARE_CONTEXT_LOCK(context);
   2376        bool isCallValid = (context->skipValidation() ||
   2377                            ValidateTexSubImage3D(context, angle::EntryPoint::GLTexSubImage3D,
   2378                                                  targetPacked, level, xoffset, yoffset, zoffset,
   2379                                                  width, height, depth, format, type, pixels));
   2380        if (isCallValid)
   2381        {
   2382            context->texSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, width, height,
   2383                                   depth, format, type, pixels);
   2384        }
   2385        ANGLE_CAPTURE_GL(TexSubImage3D, isCallValid, context, targetPacked, level, xoffset, yoffset,
   2386                         zoffset, width, height, depth, format, type, pixels);
   2387    }
   2388    else
   2389    {
   2390        GenerateContextLostErrorOnCurrentGlobalContext();
   2391    }
   2392 }
   2393 
   2394 void GL_APIENTRY GL_TransformFeedbackVaryings(GLuint program,
   2395                                              GLsizei count,
   2396                                              const GLchar *const *varyings,
   2397                                              GLenum bufferMode)
   2398 {
   2399    Context *context = GetValidGlobalContext();
   2400    EVENT(context, GLTransformFeedbackVaryings,
   2401          "context = %d, program = %u, count = %d, varyings = 0x%016" PRIxPTR ", bufferMode = %s",
   2402          CID(context), program, count, (uintptr_t)varyings,
   2403          GLenumToString(GLESEnum::TransformFeedbackBufferMode, bufferMode));
   2404 
   2405    if (context)
   2406    {
   2407        ShaderProgramID programPacked = PackParam<ShaderProgramID>(program);
   2408        SCOPED_SHARE_CONTEXT_LOCK(context);
   2409        bool isCallValid = (context->skipValidation() ||
   2410                            ValidateTransformFeedbackVaryings(
   2411                                context, angle::EntryPoint::GLTransformFeedbackVaryings,
   2412                                programPacked, count, varyings, bufferMode));
   2413        if (isCallValid)
   2414        {
   2415            context->transformFeedbackVaryings(programPacked, count, varyings, bufferMode);
   2416        }
   2417        ANGLE_CAPTURE_GL(TransformFeedbackVaryings, isCallValid, context, programPacked, count,
   2418                         varyings, bufferMode);
   2419    }
   2420    else
   2421    {
   2422        GenerateContextLostErrorOnCurrentGlobalContext();
   2423    }
   2424 }
   2425 
   2426 void GL_APIENTRY GL_Uniform1ui(GLint location, GLuint v0)
   2427 {
   2428    Context *context = GetValidGlobalContext();
   2429    EVENT(context, GLUniform1ui, "context = %d, location = %d, v0 = %u", CID(context), location,
   2430          v0);
   2431 
   2432    if (context)
   2433    {
   2434        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   2435        SCOPED_SHARE_CONTEXT_LOCK(context);
   2436        bool isCallValid =
   2437            (context->skipValidation() ||
   2438             ValidateUniform1ui(context, angle::EntryPoint::GLUniform1ui, locationPacked, v0));
   2439        if (isCallValid)
   2440        {
   2441            context->uniform1ui(locationPacked, v0);
   2442        }
   2443        ANGLE_CAPTURE_GL(Uniform1ui, isCallValid, context, locationPacked, v0);
   2444    }
   2445    else
   2446    {
   2447        GenerateContextLostErrorOnCurrentGlobalContext();
   2448    }
   2449 }
   2450 
   2451 void GL_APIENTRY GL_Uniform1uiv(GLint location, GLsizei count, const GLuint *value)
   2452 {
   2453    Context *context = GetValidGlobalContext();
   2454    EVENT(context, GLUniform1uiv,
   2455          "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
   2456          location, count, (uintptr_t)value);
   2457 
   2458    if (context)
   2459    {
   2460        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   2461        SCOPED_SHARE_CONTEXT_LOCK(context);
   2462        bool isCallValid = (context->skipValidation() ||
   2463                            ValidateUniform1uiv(context, angle::EntryPoint::GLUniform1uiv,
   2464                                                locationPacked, count, value));
   2465        if (isCallValid)
   2466        {
   2467            context->uniform1uiv(locationPacked, count, value);
   2468        }
   2469        ANGLE_CAPTURE_GL(Uniform1uiv, isCallValid, context, locationPacked, count, value);
   2470    }
   2471    else
   2472    {
   2473        GenerateContextLostErrorOnCurrentGlobalContext();
   2474    }
   2475 }
   2476 
   2477 void GL_APIENTRY GL_Uniform2ui(GLint location, GLuint v0, GLuint v1)
   2478 {
   2479    Context *context = GetValidGlobalContext();
   2480    EVENT(context, GLUniform2ui, "context = %d, location = %d, v0 = %u, v1 = %u", CID(context),
   2481          location, v0, v1);
   2482 
   2483    if (context)
   2484    {
   2485        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   2486        SCOPED_SHARE_CONTEXT_LOCK(context);
   2487        bool isCallValid =
   2488            (context->skipValidation() ||
   2489             ValidateUniform2ui(context, angle::EntryPoint::GLUniform2ui, locationPacked, v0, v1));
   2490        if (isCallValid)
   2491        {
   2492            context->uniform2ui(locationPacked, v0, v1);
   2493        }
   2494        ANGLE_CAPTURE_GL(Uniform2ui, isCallValid, context, locationPacked, v0, v1);
   2495    }
   2496    else
   2497    {
   2498        GenerateContextLostErrorOnCurrentGlobalContext();
   2499    }
   2500 }
   2501 
   2502 void GL_APIENTRY GL_Uniform2uiv(GLint location, GLsizei count, const GLuint *value)
   2503 {
   2504    Context *context = GetValidGlobalContext();
   2505    EVENT(context, GLUniform2uiv,
   2506          "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
   2507          location, count, (uintptr_t)value);
   2508 
   2509    if (context)
   2510    {
   2511        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   2512        SCOPED_SHARE_CONTEXT_LOCK(context);
   2513        bool isCallValid = (context->skipValidation() ||
   2514                            ValidateUniform2uiv(context, angle::EntryPoint::GLUniform2uiv,
   2515                                                locationPacked, count, value));
   2516        if (isCallValid)
   2517        {
   2518            context->uniform2uiv(locationPacked, count, value);
   2519        }
   2520        ANGLE_CAPTURE_GL(Uniform2uiv, isCallValid, context, locationPacked, count, value);
   2521    }
   2522    else
   2523    {
   2524        GenerateContextLostErrorOnCurrentGlobalContext();
   2525    }
   2526 }
   2527 
   2528 void GL_APIENTRY GL_Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
   2529 {
   2530    Context *context = GetValidGlobalContext();
   2531    EVENT(context, GLUniform3ui, "context = %d, location = %d, v0 = %u, v1 = %u, v2 = %u",
   2532          CID(context), location, v0, v1, v2);
   2533 
   2534    if (context)
   2535    {
   2536        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   2537        SCOPED_SHARE_CONTEXT_LOCK(context);
   2538        bool isCallValid = (context->skipValidation() ||
   2539                            ValidateUniform3ui(context, angle::EntryPoint::GLUniform3ui,
   2540                                               locationPacked, v0, v1, v2));
   2541        if (isCallValid)
   2542        {
   2543            context->uniform3ui(locationPacked, v0, v1, v2);
   2544        }
   2545        ANGLE_CAPTURE_GL(Uniform3ui, isCallValid, context, locationPacked, v0, v1, v2);
   2546    }
   2547    else
   2548    {
   2549        GenerateContextLostErrorOnCurrentGlobalContext();
   2550    }
   2551 }
   2552 
   2553 void GL_APIENTRY GL_Uniform3uiv(GLint location, GLsizei count, const GLuint *value)
   2554 {
   2555    Context *context = GetValidGlobalContext();
   2556    EVENT(context, GLUniform3uiv,
   2557          "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
   2558          location, count, (uintptr_t)value);
   2559 
   2560    if (context)
   2561    {
   2562        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   2563        SCOPED_SHARE_CONTEXT_LOCK(context);
   2564        bool isCallValid = (context->skipValidation() ||
   2565                            ValidateUniform3uiv(context, angle::EntryPoint::GLUniform3uiv,
   2566                                                locationPacked, count, value));
   2567        if (isCallValid)
   2568        {
   2569            context->uniform3uiv(locationPacked, count, value);
   2570        }
   2571        ANGLE_CAPTURE_GL(Uniform3uiv, isCallValid, context, locationPacked, count, value);
   2572    }
   2573    else
   2574    {
   2575        GenerateContextLostErrorOnCurrentGlobalContext();
   2576    }
   2577 }
   2578 
   2579 void GL_APIENTRY GL_Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
   2580 {
   2581    Context *context = GetValidGlobalContext();
   2582    EVENT(context, GLUniform4ui, "context = %d, location = %d, v0 = %u, v1 = %u, v2 = %u, v3 = %u",
   2583          CID(context), location, v0, v1, v2, v3);
   2584 
   2585    if (context)
   2586    {
   2587        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   2588        SCOPED_SHARE_CONTEXT_LOCK(context);
   2589        bool isCallValid = (context->skipValidation() ||
   2590                            ValidateUniform4ui(context, angle::EntryPoint::GLUniform4ui,
   2591                                               locationPacked, v0, v1, v2, v3));
   2592        if (isCallValid)
   2593        {
   2594            context->uniform4ui(locationPacked, v0, v1, v2, v3);
   2595        }
   2596        ANGLE_CAPTURE_GL(Uniform4ui, isCallValid, context, locationPacked, v0, v1, v2, v3);
   2597    }
   2598    else
   2599    {
   2600        GenerateContextLostErrorOnCurrentGlobalContext();
   2601    }
   2602 }
   2603 
   2604 void GL_APIENTRY GL_Uniform4uiv(GLint location, GLsizei count, const GLuint *value)
   2605 {
   2606    Context *context = GetValidGlobalContext();
   2607    EVENT(context, GLUniform4uiv,
   2608          "context = %d, location = %d, count = %d, value = 0x%016" PRIxPTR "", CID(context),
   2609          location, count, (uintptr_t)value);
   2610 
   2611    if (context)
   2612    {
   2613        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   2614        SCOPED_SHARE_CONTEXT_LOCK(context);
   2615        bool isCallValid = (context->skipValidation() ||
   2616                            ValidateUniform4uiv(context, angle::EntryPoint::GLUniform4uiv,
   2617                                                locationPacked, count, value));
   2618        if (isCallValid)
   2619        {
   2620            context->uniform4uiv(locationPacked, count, value);
   2621        }
   2622        ANGLE_CAPTURE_GL(Uniform4uiv, isCallValid, context, locationPacked, count, value);
   2623    }
   2624    else
   2625    {
   2626        GenerateContextLostErrorOnCurrentGlobalContext();
   2627    }
   2628 }
   2629 
   2630 void GL_APIENTRY GL_UniformBlockBinding(GLuint program,
   2631                                        GLuint uniformBlockIndex,
   2632                                        GLuint uniformBlockBinding)
   2633 {
   2634    Context *context = GetValidGlobalContext();
   2635    EVENT(context, GLUniformBlockBinding,
   2636          "context = %d, program = %u, uniformBlockIndex = %u, uniformBlockBinding = %u",
   2637          CID(context), program, uniformBlockIndex, uniformBlockBinding);
   2638 
   2639    if (context)
   2640    {
   2641        ShaderProgramID programPacked             = PackParam<ShaderProgramID>(program);
   2642        UniformBlockIndex uniformBlockIndexPacked = PackParam<UniformBlockIndex>(uniformBlockIndex);
   2643        SCOPED_SHARE_CONTEXT_LOCK(context);
   2644        bool isCallValid = (context->skipValidation() ||
   2645                            ValidateUniformBlockBinding(
   2646                                context, angle::EntryPoint::GLUniformBlockBinding, programPacked,
   2647                                uniformBlockIndexPacked, uniformBlockBinding));
   2648        if (isCallValid)
   2649        {
   2650            context->uniformBlockBinding(programPacked, uniformBlockIndexPacked,
   2651                                         uniformBlockBinding);
   2652        }
   2653        ANGLE_CAPTURE_GL(UniformBlockBinding, isCallValid, context, programPacked,
   2654                         uniformBlockIndexPacked, uniformBlockBinding);
   2655    }
   2656    else
   2657    {
   2658        GenerateContextLostErrorOnCurrentGlobalContext();
   2659    }
   2660 }
   2661 
   2662 void GL_APIENTRY GL_UniformMatrix2x3fv(GLint location,
   2663                                       GLsizei count,
   2664                                       GLboolean transpose,
   2665                                       const GLfloat *value)
   2666 {
   2667    Context *context = GetValidGlobalContext();
   2668    EVENT(context, GLUniformMatrix2x3fv,
   2669          "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
   2670          CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
   2671 
   2672    if (context)
   2673    {
   2674        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   2675        SCOPED_SHARE_CONTEXT_LOCK(context);
   2676        bool isCallValid =
   2677            (context->skipValidation() ||
   2678             ValidateUniformMatrix2x3fv(context, angle::EntryPoint::GLUniformMatrix2x3fv,
   2679                                        locationPacked, count, transpose, value));
   2680        if (isCallValid)
   2681        {
   2682            context->uniformMatrix2x3fv(locationPacked, count, transpose, value);
   2683        }
   2684        ANGLE_CAPTURE_GL(UniformMatrix2x3fv, isCallValid, context, locationPacked, count, transpose,
   2685                         value);
   2686    }
   2687    else
   2688    {
   2689        GenerateContextLostErrorOnCurrentGlobalContext();
   2690    }
   2691 }
   2692 
   2693 void GL_APIENTRY GL_UniformMatrix2x4fv(GLint location,
   2694                                       GLsizei count,
   2695                                       GLboolean transpose,
   2696                                       const GLfloat *value)
   2697 {
   2698    Context *context = GetValidGlobalContext();
   2699    EVENT(context, GLUniformMatrix2x4fv,
   2700          "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
   2701          CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
   2702 
   2703    if (context)
   2704    {
   2705        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   2706        SCOPED_SHARE_CONTEXT_LOCK(context);
   2707        bool isCallValid =
   2708            (context->skipValidation() ||
   2709             ValidateUniformMatrix2x4fv(context, angle::EntryPoint::GLUniformMatrix2x4fv,
   2710                                        locationPacked, count, transpose, value));
   2711        if (isCallValid)
   2712        {
   2713            context->uniformMatrix2x4fv(locationPacked, count, transpose, value);
   2714        }
   2715        ANGLE_CAPTURE_GL(UniformMatrix2x4fv, isCallValid, context, locationPacked, count, transpose,
   2716                         value);
   2717    }
   2718    else
   2719    {
   2720        GenerateContextLostErrorOnCurrentGlobalContext();
   2721    }
   2722 }
   2723 
   2724 void GL_APIENTRY GL_UniformMatrix3x2fv(GLint location,
   2725                                       GLsizei count,
   2726                                       GLboolean transpose,
   2727                                       const GLfloat *value)
   2728 {
   2729    Context *context = GetValidGlobalContext();
   2730    EVENT(context, GLUniformMatrix3x2fv,
   2731          "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
   2732          CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
   2733 
   2734    if (context)
   2735    {
   2736        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   2737        SCOPED_SHARE_CONTEXT_LOCK(context);
   2738        bool isCallValid =
   2739            (context->skipValidation() ||
   2740             ValidateUniformMatrix3x2fv(context, angle::EntryPoint::GLUniformMatrix3x2fv,
   2741                                        locationPacked, count, transpose, value));
   2742        if (isCallValid)
   2743        {
   2744            context->uniformMatrix3x2fv(locationPacked, count, transpose, value);
   2745        }
   2746        ANGLE_CAPTURE_GL(UniformMatrix3x2fv, isCallValid, context, locationPacked, count, transpose,
   2747                         value);
   2748    }
   2749    else
   2750    {
   2751        GenerateContextLostErrorOnCurrentGlobalContext();
   2752    }
   2753 }
   2754 
   2755 void GL_APIENTRY GL_UniformMatrix3x4fv(GLint location,
   2756                                       GLsizei count,
   2757                                       GLboolean transpose,
   2758                                       const GLfloat *value)
   2759 {
   2760    Context *context = GetValidGlobalContext();
   2761    EVENT(context, GLUniformMatrix3x4fv,
   2762          "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
   2763          CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
   2764 
   2765    if (context)
   2766    {
   2767        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   2768        SCOPED_SHARE_CONTEXT_LOCK(context);
   2769        bool isCallValid =
   2770            (context->skipValidation() ||
   2771             ValidateUniformMatrix3x4fv(context, angle::EntryPoint::GLUniformMatrix3x4fv,
   2772                                        locationPacked, count, transpose, value));
   2773        if (isCallValid)
   2774        {
   2775            context->uniformMatrix3x4fv(locationPacked, count, transpose, value);
   2776        }
   2777        ANGLE_CAPTURE_GL(UniformMatrix3x4fv, isCallValid, context, locationPacked, count, transpose,
   2778                         value);
   2779    }
   2780    else
   2781    {
   2782        GenerateContextLostErrorOnCurrentGlobalContext();
   2783    }
   2784 }
   2785 
   2786 void GL_APIENTRY GL_UniformMatrix4x2fv(GLint location,
   2787                                       GLsizei count,
   2788                                       GLboolean transpose,
   2789                                       const GLfloat *value)
   2790 {
   2791    Context *context = GetValidGlobalContext();
   2792    EVENT(context, GLUniformMatrix4x2fv,
   2793          "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
   2794          CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
   2795 
   2796    if (context)
   2797    {
   2798        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   2799        SCOPED_SHARE_CONTEXT_LOCK(context);
   2800        bool isCallValid =
   2801            (context->skipValidation() ||
   2802             ValidateUniformMatrix4x2fv(context, angle::EntryPoint::GLUniformMatrix4x2fv,
   2803                                        locationPacked, count, transpose, value));
   2804        if (isCallValid)
   2805        {
   2806            context->uniformMatrix4x2fv(locationPacked, count, transpose, value);
   2807        }
   2808        ANGLE_CAPTURE_GL(UniformMatrix4x2fv, isCallValid, context, locationPacked, count, transpose,
   2809                         value);
   2810    }
   2811    else
   2812    {
   2813        GenerateContextLostErrorOnCurrentGlobalContext();
   2814    }
   2815 }
   2816 
   2817 void GL_APIENTRY GL_UniformMatrix4x3fv(GLint location,
   2818                                       GLsizei count,
   2819                                       GLboolean transpose,
   2820                                       const GLfloat *value)
   2821 {
   2822    Context *context = GetValidGlobalContext();
   2823    EVENT(context, GLUniformMatrix4x3fv,
   2824          "context = %d, location = %d, count = %d, transpose = %s, value = 0x%016" PRIxPTR "",
   2825          CID(context), location, count, GLbooleanToString(transpose), (uintptr_t)value);
   2826 
   2827    if (context)
   2828    {
   2829        UniformLocation locationPacked = PackParam<UniformLocation>(location);
   2830        SCOPED_SHARE_CONTEXT_LOCK(context);
   2831        bool isCallValid =
   2832            (context->skipValidation() ||
   2833             ValidateUniformMatrix4x3fv(context, angle::EntryPoint::GLUniformMatrix4x3fv,
   2834                                        locationPacked, count, transpose, value));
   2835        if (isCallValid)
   2836        {
   2837            context->uniformMatrix4x3fv(locationPacked, count, transpose, value);
   2838        }
   2839        ANGLE_CAPTURE_GL(UniformMatrix4x3fv, isCallValid, context, locationPacked, count, transpose,
   2840                         value);
   2841    }
   2842    else
   2843    {
   2844        GenerateContextLostErrorOnCurrentGlobalContext();
   2845    }
   2846 }
   2847 
   2848 GLboolean GL_APIENTRY GL_UnmapBuffer(GLenum target)
   2849 {
   2850    Context *context = GetValidGlobalContext();
   2851    EVENT(context, GLUnmapBuffer, "context = %d, target = %s", CID(context),
   2852          GLenumToString(GLESEnum::BufferTargetARB, target));
   2853 
   2854    GLboolean returnValue;
   2855    if (context)
   2856    {
   2857        BufferBinding targetPacked = PackParam<BufferBinding>(target);
   2858        SCOPED_SHARE_CONTEXT_LOCK(context);
   2859        bool isCallValid =
   2860            (context->skipValidation() ||
   2861             ValidateUnmapBuffer(context, angle::EntryPoint::GLUnmapBuffer, targetPacked));
   2862        if (isCallValid)
   2863        {
   2864            returnValue = context->unmapBuffer(targetPacked);
   2865        }
   2866        else
   2867        {
   2868            returnValue = GetDefaultReturnValue<angle::EntryPoint::GLUnmapBuffer, GLboolean>();
   2869        }
   2870        ANGLE_CAPTURE_GL(UnmapBuffer, isCallValid, context, targetPacked, returnValue);
   2871    }
   2872    else
   2873    {
   2874        GenerateContextLostErrorOnCurrentGlobalContext();
   2875        returnValue = GetDefaultReturnValue<angle::EntryPoint::GLUnmapBuffer, GLboolean>();
   2876    }
   2877    return returnValue;
   2878 }
   2879 
   2880 void GL_APIENTRY GL_VertexAttribDivisor(GLuint index, GLuint divisor)
   2881 {
   2882    Context *context = GetValidGlobalContext();
   2883    EVENT(context, GLVertexAttribDivisor, "context = %d, index = %u, divisor = %u", CID(context),
   2884          index, divisor);
   2885 
   2886    if (context)
   2887    {
   2888        SCOPED_SHARE_CONTEXT_LOCK(context);
   2889        bool isCallValid = (context->skipValidation() ||
   2890                            ValidateVertexAttribDivisor(
   2891                                context, angle::EntryPoint::GLVertexAttribDivisor, index, divisor));
   2892        if (isCallValid)
   2893        {
   2894            context->vertexAttribDivisor(index, divisor);
   2895        }
   2896        ANGLE_CAPTURE_GL(VertexAttribDivisor, isCallValid, context, index, divisor);
   2897    }
   2898    else
   2899    {
   2900        GenerateContextLostErrorOnCurrentGlobalContext();
   2901    }
   2902 }
   2903 
   2904 void GL_APIENTRY GL_VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
   2905 {
   2906    Context *context = GetValidGlobalContext();
   2907    EVENT(context, GLVertexAttribI4i, "context = %d, index = %u, x = %d, y = %d, z = %d, w = %d",
   2908          CID(context), index, x, y, z, w);
   2909 
   2910    if (context)
   2911    {
   2912        SCOPED_SHARE_CONTEXT_LOCK(context);
   2913        bool isCallValid = (context->skipValidation() ||
   2914                            ValidateVertexAttribI4i(context, angle::EntryPoint::GLVertexAttribI4i,
   2915                                                    index, x, y, z, w));
   2916        if (isCallValid)
   2917        {
   2918            context->vertexAttribI4i(index, x, y, z, w);
   2919        }
   2920        ANGLE_CAPTURE_GL(VertexAttribI4i, isCallValid, context, index, x, y, z, w);
   2921    }
   2922    else
   2923    {
   2924        GenerateContextLostErrorOnCurrentGlobalContext();
   2925    }
   2926 }
   2927 
   2928 void GL_APIENTRY GL_VertexAttribI4iv(GLuint index, const GLint *v)
   2929 {
   2930    Context *context = GetValidGlobalContext();
   2931    EVENT(context, GLVertexAttribI4iv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
   2932          CID(context), index, (uintptr_t)v);
   2933 
   2934    if (context)
   2935    {
   2936        SCOPED_SHARE_CONTEXT_LOCK(context);
   2937        bool isCallValid =
   2938            (context->skipValidation() ||
   2939             ValidateVertexAttribI4iv(context, angle::EntryPoint::GLVertexAttribI4iv, index, v));
   2940        if (isCallValid)
   2941        {
   2942            context->vertexAttribI4iv(index, v);
   2943        }
   2944        ANGLE_CAPTURE_GL(VertexAttribI4iv, isCallValid, context, index, v);
   2945    }
   2946    else
   2947    {
   2948        GenerateContextLostErrorOnCurrentGlobalContext();
   2949    }
   2950 }
   2951 
   2952 void GL_APIENTRY GL_VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
   2953 {
   2954    Context *context = GetValidGlobalContext();
   2955    EVENT(context, GLVertexAttribI4ui, "context = %d, index = %u, x = %u, y = %u, z = %u, w = %u",
   2956          CID(context), index, x, y, z, w);
   2957 
   2958    if (context)
   2959    {
   2960        SCOPED_SHARE_CONTEXT_LOCK(context);
   2961        bool isCallValid = (context->skipValidation() ||
   2962                            ValidateVertexAttribI4ui(context, angle::EntryPoint::GLVertexAttribI4ui,
   2963                                                     index, x, y, z, w));
   2964        if (isCallValid)
   2965        {
   2966            context->vertexAttribI4ui(index, x, y, z, w);
   2967        }
   2968        ANGLE_CAPTURE_GL(VertexAttribI4ui, isCallValid, context, index, x, y, z, w);
   2969    }
   2970    else
   2971    {
   2972        GenerateContextLostErrorOnCurrentGlobalContext();
   2973    }
   2974 }
   2975 
   2976 void GL_APIENTRY GL_VertexAttribI4uiv(GLuint index, const GLuint *v)
   2977 {
   2978    Context *context = GetValidGlobalContext();
   2979    EVENT(context, GLVertexAttribI4uiv, "context = %d, index = %u, v = 0x%016" PRIxPTR "",
   2980          CID(context), index, (uintptr_t)v);
   2981 
   2982    if (context)
   2983    {
   2984        SCOPED_SHARE_CONTEXT_LOCK(context);
   2985        bool isCallValid =
   2986            (context->skipValidation() ||
   2987             ValidateVertexAttribI4uiv(context, angle::EntryPoint::GLVertexAttribI4uiv, index, v));
   2988        if (isCallValid)
   2989        {
   2990            context->vertexAttribI4uiv(index, v);
   2991        }
   2992        ANGLE_CAPTURE_GL(VertexAttribI4uiv, isCallValid, context, index, v);
   2993    }
   2994    else
   2995    {
   2996        GenerateContextLostErrorOnCurrentGlobalContext();
   2997    }
   2998 }
   2999 
   3000 void GL_APIENTRY
   3001 GL_VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer)
   3002 {
   3003    Context *context = GetValidGlobalContext();
   3004    EVENT(context, GLVertexAttribIPointer,
   3005          "context = %d, index = %u, size = %d, type = %s, stride = %d, pointer = 0x%016" PRIxPTR
   3006          "",
   3007          CID(context), index, size, GLenumToString(GLESEnum::VertexAttribIType, type), stride,
   3008          (uintptr_t)pointer);
   3009 
   3010    if (context)
   3011    {
   3012        VertexAttribType typePacked = PackParam<VertexAttribType>(type);
   3013        SCOPED_SHARE_CONTEXT_LOCK(context);
   3014        bool isCallValid =
   3015            (context->skipValidation() ||
   3016             ValidateVertexAttribIPointer(context, angle::EntryPoint::GLVertexAttribIPointer, index,
   3017                                          size, typePacked, stride, pointer));
   3018        if (isCallValid)
   3019        {
   3020            context->vertexAttribIPointer(index, size, typePacked, stride, pointer);
   3021        }
   3022        ANGLE_CAPTURE_GL(VertexAttribIPointer, isCallValid, context, index, size, typePacked,
   3023                         stride, pointer);
   3024    }
   3025    else
   3026    {
   3027        GenerateContextLostErrorOnCurrentGlobalContext();
   3028    }
   3029 }
   3030 
   3031 void GL_APIENTRY GL_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
   3032 {
   3033    Context *context = GetValidGlobalContext();
   3034    EVENT(context, GLWaitSync, "context = %d, sync = 0x%016" PRIxPTR ", flags = %s, timeout = %llu",
   3035          CID(context), (uintptr_t)sync,
   3036          GLbitfieldToString(GLESEnum::SyncBehaviorFlags, flags).c_str(),
   3037          static_cast<unsigned long long>(timeout));
   3038 
   3039    if (context)
   3040    {
   3041        SCOPED_SHARE_CONTEXT_LOCK(context);
   3042        bool isCallValid =
   3043            (context->skipValidation() ||
   3044             ValidateWaitSync(context, angle::EntryPoint::GLWaitSync, sync, flags, timeout));
   3045        if (isCallValid)
   3046        {
   3047            context->waitSync(sync, flags, timeout);
   3048        }
   3049        ANGLE_CAPTURE_GL(WaitSync, isCallValid, context, sync, flags, timeout);
   3050    }
   3051    else
   3052    {
   3053        GenerateContextLostErrorOnCurrentGlobalContext();
   3054    }
   3055 }
   3056 
   3057 }  // extern "C"