Home | History | Annotate | Download | only in shared_impl
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // This file is auto-generated from
      6 // gpu/command_buffer/build_gles2_cmd_buffer.py
      7 // DO NOT EDIT!
      8 
      9 #include "ppapi/shared_impl/ppb_opengles2_shared.h"
     10 
     11 #include "base/logging.h"
     12 #include "gpu/command_buffer/client/gles2_implementation.h"
     13 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h"
     14 #include "ppapi/thunk/enter.h"
     15 
     16 namespace ppapi {
     17 
     18 namespace {
     19 
     20 typedef thunk::EnterResource<thunk::PPB_Graphics3D_API> Enter3D;
     21 
     22 gpu::gles2::GLES2Implementation* ToGles2Impl(Enter3D* enter) {
     23   DCHECK(enter);
     24   DCHECK(enter->succeeded());
     25   return static_cast<PPB_Graphics3D_Shared*>(enter->object())->gles2_impl();
     26 }
     27 
     28 void ActiveTexture(PP_Resource context_id, GLenum texture) {
     29   Enter3D enter(context_id, true);
     30   if (enter.succeeded()) {
     31     ToGles2Impl(&enter)->ActiveTexture(texture);
     32   }
     33 }
     34 
     35 void AttachShader(PP_Resource context_id, GLuint program, GLuint shader) {
     36   Enter3D enter(context_id, true);
     37   if (enter.succeeded()) {
     38     ToGles2Impl(&enter)->AttachShader(program, shader);
     39   }
     40 }
     41 
     42 void BindAttribLocation(
     43     PP_Resource context_id, GLuint program, GLuint index, const char* name) {
     44   Enter3D enter(context_id, true);
     45   if (enter.succeeded()) {
     46     ToGles2Impl(&enter)->BindAttribLocation(program, index, name);
     47   }
     48 }
     49 
     50 void BindBuffer(PP_Resource context_id, GLenum target, GLuint buffer) {
     51   Enter3D enter(context_id, true);
     52   if (enter.succeeded()) {
     53     ToGles2Impl(&enter)->BindBuffer(target, buffer);
     54   }
     55 }
     56 
     57 void BindFramebuffer(
     58     PP_Resource context_id, GLenum target, GLuint framebuffer) {
     59   Enter3D enter(context_id, true);
     60   if (enter.succeeded()) {
     61     ToGles2Impl(&enter)->BindFramebuffer(target, framebuffer);
     62   }
     63 }
     64 
     65 void BindRenderbuffer(
     66     PP_Resource context_id, GLenum target, GLuint renderbuffer) {
     67   Enter3D enter(context_id, true);
     68   if (enter.succeeded()) {
     69     ToGles2Impl(&enter)->BindRenderbuffer(target, renderbuffer);
     70   }
     71 }
     72 
     73 void BindTexture(PP_Resource context_id, GLenum target, GLuint texture) {
     74   Enter3D enter(context_id, true);
     75   if (enter.succeeded()) {
     76     ToGles2Impl(&enter)->BindTexture(target, texture);
     77   }
     78 }
     79 
     80 void BlendColor(
     81     PP_Resource context_id, GLclampf red, GLclampf green, GLclampf blue,
     82     GLclampf alpha) {
     83   Enter3D enter(context_id, true);
     84   if (enter.succeeded()) {
     85     ToGles2Impl(&enter)->BlendColor(red, green, blue, alpha);
     86   }
     87 }
     88 
     89 void BlendEquation(PP_Resource context_id, GLenum mode) {
     90   Enter3D enter(context_id, true);
     91   if (enter.succeeded()) {
     92     ToGles2Impl(&enter)->BlendEquation(mode);
     93   }
     94 }
     95 
     96 void BlendEquationSeparate(
     97     PP_Resource context_id, GLenum modeRGB, GLenum modeAlpha) {
     98   Enter3D enter(context_id, true);
     99   if (enter.succeeded()) {
    100     ToGles2Impl(&enter)->BlendEquationSeparate(modeRGB, modeAlpha);
    101   }
    102 }
    103 
    104 void BlendFunc(PP_Resource context_id, GLenum sfactor, GLenum dfactor) {
    105   Enter3D enter(context_id, true);
    106   if (enter.succeeded()) {
    107     ToGles2Impl(&enter)->BlendFunc(sfactor, dfactor);
    108   }
    109 }
    110 
    111 void BlendFuncSeparate(
    112     PP_Resource context_id, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha,
    113     GLenum dstAlpha) {
    114   Enter3D enter(context_id, true);
    115   if (enter.succeeded()) {
    116     ToGles2Impl(&enter)->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
    117   }
    118 }
    119 
    120 void BufferData(
    121     PP_Resource context_id, GLenum target, GLsizeiptr size, const void* data,
    122     GLenum usage) {
    123   Enter3D enter(context_id, true);
    124   if (enter.succeeded()) {
    125     ToGles2Impl(&enter)->BufferData(target, size, data, usage);
    126   }
    127 }
    128 
    129 void BufferSubData(
    130     PP_Resource context_id, GLenum target, GLintptr offset, GLsizeiptr size,
    131     const void* data) {
    132   Enter3D enter(context_id, true);
    133   if (enter.succeeded()) {
    134     ToGles2Impl(&enter)->BufferSubData(target, offset, size, data);
    135   }
    136 }
    137 
    138 GLenum CheckFramebufferStatus(PP_Resource context_id, GLenum target) {
    139   Enter3D enter(context_id, true);
    140   if (enter.succeeded()) {
    141     return ToGles2Impl(&enter)->CheckFramebufferStatus(target);
    142   } else {
    143     return 0;
    144   }
    145 }
    146 
    147 void Clear(PP_Resource context_id, GLbitfield mask) {
    148   Enter3D enter(context_id, true);
    149   if (enter.succeeded()) {
    150     ToGles2Impl(&enter)->Clear(mask);
    151   }
    152 }
    153 
    154 void ClearColor(
    155     PP_Resource context_id, GLclampf red, GLclampf green, GLclampf blue,
    156     GLclampf alpha) {
    157   Enter3D enter(context_id, true);
    158   if (enter.succeeded()) {
    159     ToGles2Impl(&enter)->ClearColor(red, green, blue, alpha);
    160   }
    161 }
    162 
    163 void ClearDepthf(PP_Resource context_id, GLclampf depth) {
    164   Enter3D enter(context_id, true);
    165   if (enter.succeeded()) {
    166     ToGles2Impl(&enter)->ClearDepthf(depth);
    167   }
    168 }
    169 
    170 void ClearStencil(PP_Resource context_id, GLint s) {
    171   Enter3D enter(context_id, true);
    172   if (enter.succeeded()) {
    173     ToGles2Impl(&enter)->ClearStencil(s);
    174   }
    175 }
    176 
    177 void ColorMask(
    178     PP_Resource context_id, GLboolean red, GLboolean green, GLboolean blue,
    179     GLboolean alpha) {
    180   Enter3D enter(context_id, true);
    181   if (enter.succeeded()) {
    182     ToGles2Impl(&enter)->ColorMask(red, green, blue, alpha);
    183   }
    184 }
    185 
    186 void CompileShader(PP_Resource context_id, GLuint shader) {
    187   Enter3D enter(context_id, true);
    188   if (enter.succeeded()) {
    189     ToGles2Impl(&enter)->CompileShader(shader);
    190   }
    191 }
    192 
    193 void CompressedTexImage2D(
    194     PP_Resource context_id, GLenum target, GLint level, GLenum internalformat,
    195     GLsizei width, GLsizei height, GLint border, GLsizei imageSize,
    196     const void* data) {
    197   Enter3D enter(context_id, true);
    198   if (enter.succeeded()) {
    199     ToGles2Impl(
    200         &enter)->CompressedTexImage2D(
    201             target, level, internalformat, width, height, border, imageSize,
    202             data);
    203   }
    204 }
    205 
    206 void CompressedTexSubImage2D(
    207     PP_Resource context_id, GLenum target, GLint level, GLint xoffset,
    208     GLint yoffset, GLsizei width, GLsizei height, GLenum format,
    209     GLsizei imageSize, const void* data) {
    210   Enter3D enter(context_id, true);
    211   if (enter.succeeded()) {
    212     ToGles2Impl(
    213         &enter)->CompressedTexSubImage2D(
    214             target, level, xoffset, yoffset, width, height, format, imageSize,
    215             data);
    216   }
    217 }
    218 
    219 void CopyTexImage2D(
    220     PP_Resource context_id, GLenum target, GLint level, GLenum internalformat,
    221     GLint x, GLint y, GLsizei width, GLsizei height, GLint border) {
    222   Enter3D enter(context_id, true);
    223   if (enter.succeeded()) {
    224     ToGles2Impl(
    225         &enter)->CopyTexImage2D(
    226             target, level, internalformat, x, y, width, height, border);
    227   }
    228 }
    229 
    230 void CopyTexSubImage2D(
    231     PP_Resource context_id, GLenum target, GLint level, GLint xoffset,
    232     GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) {
    233   Enter3D enter(context_id, true);
    234   if (enter.succeeded()) {
    235     ToGles2Impl(
    236         &enter)->CopyTexSubImage2D(
    237             target, level, xoffset, yoffset, x, y, width, height);
    238   }
    239 }
    240 
    241 GLuint CreateProgram(PP_Resource context_id) {
    242   Enter3D enter(context_id, true);
    243   if (enter.succeeded()) {
    244     return ToGles2Impl(&enter)->CreateProgram();
    245   } else {
    246     return 0;
    247   }
    248 }
    249 
    250 GLuint CreateShader(PP_Resource context_id, GLenum type) {
    251   Enter3D enter(context_id, true);
    252   if (enter.succeeded()) {
    253     return ToGles2Impl(&enter)->CreateShader(type);
    254   } else {
    255     return 0;
    256   }
    257 }
    258 
    259 void CullFace(PP_Resource context_id, GLenum mode) {
    260   Enter3D enter(context_id, true);
    261   if (enter.succeeded()) {
    262     ToGles2Impl(&enter)->CullFace(mode);
    263   }
    264 }
    265 
    266 void DeleteBuffers(PP_Resource context_id, GLsizei n, const GLuint* buffers) {
    267   Enter3D enter(context_id, true);
    268   if (enter.succeeded()) {
    269     ToGles2Impl(&enter)->DeleteBuffers(n, buffers);
    270   }
    271 }
    272 
    273 void DeleteFramebuffers(
    274     PP_Resource context_id, GLsizei n, const GLuint* framebuffers) {
    275   Enter3D enter(context_id, true);
    276   if (enter.succeeded()) {
    277     ToGles2Impl(&enter)->DeleteFramebuffers(n, framebuffers);
    278   }
    279 }
    280 
    281 void DeleteProgram(PP_Resource context_id, GLuint program) {
    282   Enter3D enter(context_id, true);
    283   if (enter.succeeded()) {
    284     ToGles2Impl(&enter)->DeleteProgram(program);
    285   }
    286 }
    287 
    288 void DeleteRenderbuffers(
    289     PP_Resource context_id, GLsizei n, const GLuint* renderbuffers) {
    290   Enter3D enter(context_id, true);
    291   if (enter.succeeded()) {
    292     ToGles2Impl(&enter)->DeleteRenderbuffers(n, renderbuffers);
    293   }
    294 }
    295 
    296 void DeleteShader(PP_Resource context_id, GLuint shader) {
    297   Enter3D enter(context_id, true);
    298   if (enter.succeeded()) {
    299     ToGles2Impl(&enter)->DeleteShader(shader);
    300   }
    301 }
    302 
    303 void DeleteTextures(
    304     PP_Resource context_id, GLsizei n, const GLuint* textures) {
    305   Enter3D enter(context_id, true);
    306   if (enter.succeeded()) {
    307     ToGles2Impl(&enter)->DeleteTextures(n, textures);
    308   }
    309 }
    310 
    311 void DepthFunc(PP_Resource context_id, GLenum func) {
    312   Enter3D enter(context_id, true);
    313   if (enter.succeeded()) {
    314     ToGles2Impl(&enter)->DepthFunc(func);
    315   }
    316 }
    317 
    318 void DepthMask(PP_Resource context_id, GLboolean flag) {
    319   Enter3D enter(context_id, true);
    320   if (enter.succeeded()) {
    321     ToGles2Impl(&enter)->DepthMask(flag);
    322   }
    323 }
    324 
    325 void DepthRangef(PP_Resource context_id, GLclampf zNear, GLclampf zFar) {
    326   Enter3D enter(context_id, true);
    327   if (enter.succeeded()) {
    328     ToGles2Impl(&enter)->DepthRangef(zNear, zFar);
    329   }
    330 }
    331 
    332 void DetachShader(PP_Resource context_id, GLuint program, GLuint shader) {
    333   Enter3D enter(context_id, true);
    334   if (enter.succeeded()) {
    335     ToGles2Impl(&enter)->DetachShader(program, shader);
    336   }
    337 }
    338 
    339 void Disable(PP_Resource context_id, GLenum cap) {
    340   Enter3D enter(context_id, true);
    341   if (enter.succeeded()) {
    342     ToGles2Impl(&enter)->Disable(cap);
    343   }
    344 }
    345 
    346 void DisableVertexAttribArray(PP_Resource context_id, GLuint index) {
    347   Enter3D enter(context_id, true);
    348   if (enter.succeeded()) {
    349     ToGles2Impl(&enter)->DisableVertexAttribArray(index);
    350   }
    351 }
    352 
    353 void DrawArrays(
    354     PP_Resource context_id, GLenum mode, GLint first, GLsizei count) {
    355   Enter3D enter(context_id, true);
    356   if (enter.succeeded()) {
    357     ToGles2Impl(&enter)->DrawArrays(mode, first, count);
    358   }
    359 }
    360 
    361 void DrawElements(
    362     PP_Resource context_id, GLenum mode, GLsizei count, GLenum type,
    363     const void* indices) {
    364   Enter3D enter(context_id, true);
    365   if (enter.succeeded()) {
    366     ToGles2Impl(&enter)->DrawElements(mode, count, type, indices);
    367   }
    368 }
    369 
    370 void Enable(PP_Resource context_id, GLenum cap) {
    371   Enter3D enter(context_id, true);
    372   if (enter.succeeded()) {
    373     ToGles2Impl(&enter)->Enable(cap);
    374   }
    375 }
    376 
    377 void EnableVertexAttribArray(PP_Resource context_id, GLuint index) {
    378   Enter3D enter(context_id, true);
    379   if (enter.succeeded()) {
    380     ToGles2Impl(&enter)->EnableVertexAttribArray(index);
    381   }
    382 }
    383 
    384 void Finish(PP_Resource context_id) {
    385   Enter3D enter(context_id, true);
    386   if (enter.succeeded()) {
    387     ToGles2Impl(&enter)->Finish();
    388   }
    389 }
    390 
    391 void Flush(PP_Resource context_id) {
    392   Enter3D enter(context_id, true);
    393   if (enter.succeeded()) {
    394     ToGles2Impl(&enter)->Flush();
    395   }
    396 }
    397 
    398 void FramebufferRenderbuffer(
    399     PP_Resource context_id, GLenum target, GLenum attachment,
    400     GLenum renderbuffertarget, GLuint renderbuffer) {
    401   Enter3D enter(context_id, true);
    402   if (enter.succeeded()) {
    403     ToGles2Impl(
    404         &enter)->FramebufferRenderbuffer(
    405             target, attachment, renderbuffertarget, renderbuffer);
    406   }
    407 }
    408 
    409 void FramebufferTexture2D(
    410     PP_Resource context_id, GLenum target, GLenum attachment, GLenum textarget,
    411     GLuint texture, GLint level) {
    412   Enter3D enter(context_id, true);
    413   if (enter.succeeded()) {
    414     ToGles2Impl(
    415         &enter)->FramebufferTexture2D(
    416             target, attachment, textarget, texture, level);
    417   }
    418 }
    419 
    420 void FrontFace(PP_Resource context_id, GLenum mode) {
    421   Enter3D enter(context_id, true);
    422   if (enter.succeeded()) {
    423     ToGles2Impl(&enter)->FrontFace(mode);
    424   }
    425 }
    426 
    427 void GenBuffers(PP_Resource context_id, GLsizei n, GLuint* buffers) {
    428   Enter3D enter(context_id, true);
    429   if (enter.succeeded()) {
    430     ToGles2Impl(&enter)->GenBuffers(n, buffers);
    431   }
    432 }
    433 
    434 void GenerateMipmap(PP_Resource context_id, GLenum target) {
    435   Enter3D enter(context_id, true);
    436   if (enter.succeeded()) {
    437     ToGles2Impl(&enter)->GenerateMipmap(target);
    438   }
    439 }
    440 
    441 void GenFramebuffers(PP_Resource context_id, GLsizei n, GLuint* framebuffers) {
    442   Enter3D enter(context_id, true);
    443   if (enter.succeeded()) {
    444     ToGles2Impl(&enter)->GenFramebuffers(n, framebuffers);
    445   }
    446 }
    447 
    448 void GenRenderbuffers(
    449     PP_Resource context_id, GLsizei n, GLuint* renderbuffers) {
    450   Enter3D enter(context_id, true);
    451   if (enter.succeeded()) {
    452     ToGles2Impl(&enter)->GenRenderbuffers(n, renderbuffers);
    453   }
    454 }
    455 
    456 void GenTextures(PP_Resource context_id, GLsizei n, GLuint* textures) {
    457   Enter3D enter(context_id, true);
    458   if (enter.succeeded()) {
    459     ToGles2Impl(&enter)->GenTextures(n, textures);
    460   }
    461 }
    462 
    463 void GetActiveAttrib(
    464     PP_Resource context_id, GLuint program, GLuint index, GLsizei bufsize,
    465     GLsizei* length, GLint* size, GLenum* type, char* name) {
    466   Enter3D enter(context_id, true);
    467   if (enter.succeeded()) {
    468     ToGles2Impl(
    469         &enter)->GetActiveAttrib(
    470             program, index, bufsize, length, size, type, name);
    471   }
    472 }
    473 
    474 void GetActiveUniform(
    475     PP_Resource context_id, GLuint program, GLuint index, GLsizei bufsize,
    476     GLsizei* length, GLint* size, GLenum* type, char* name) {
    477   Enter3D enter(context_id, true);
    478   if (enter.succeeded()) {
    479     ToGles2Impl(
    480         &enter)->GetActiveUniform(
    481             program, index, bufsize, length, size, type, name);
    482   }
    483 }
    484 
    485 void GetAttachedShaders(
    486     PP_Resource context_id, GLuint program, GLsizei maxcount, GLsizei* count,
    487     GLuint* shaders) {
    488   Enter3D enter(context_id, true);
    489   if (enter.succeeded()) {
    490     ToGles2Impl(&enter)->GetAttachedShaders(program, maxcount, count, shaders);
    491   }
    492 }
    493 
    494 GLint GetAttribLocation(
    495     PP_Resource context_id, GLuint program, const char* name) {
    496   Enter3D enter(context_id, true);
    497   if (enter.succeeded()) {
    498     return ToGles2Impl(&enter)->GetAttribLocation(program, name);
    499   } else {
    500     return -1;
    501   }
    502 }
    503 
    504 void GetBooleanv(PP_Resource context_id, GLenum pname, GLboolean* params) {
    505   Enter3D enter(context_id, true);
    506   if (enter.succeeded()) {
    507     ToGles2Impl(&enter)->GetBooleanv(pname, params);
    508   }
    509 }
    510 
    511 void GetBufferParameteriv(
    512     PP_Resource context_id, GLenum target, GLenum pname, GLint* params) {
    513   Enter3D enter(context_id, true);
    514   if (enter.succeeded()) {
    515     ToGles2Impl(&enter)->GetBufferParameteriv(target, pname, params);
    516   }
    517 }
    518 
    519 GLenum GetError(PP_Resource context_id) {
    520   Enter3D enter(context_id, true);
    521   if (enter.succeeded()) {
    522     return ToGles2Impl(&enter)->GetError();
    523   } else {
    524     return 0;
    525   }
    526 }
    527 
    528 void GetFloatv(PP_Resource context_id, GLenum pname, GLfloat* params) {
    529   Enter3D enter(context_id, true);
    530   if (enter.succeeded()) {
    531     ToGles2Impl(&enter)->GetFloatv(pname, params);
    532   }
    533 }
    534 
    535 void GetFramebufferAttachmentParameteriv(
    536     PP_Resource context_id, GLenum target, GLenum attachment, GLenum pname,
    537     GLint* params) {
    538   Enter3D enter(context_id, true);
    539   if (enter.succeeded()) {
    540     ToGles2Impl(
    541         &enter)->GetFramebufferAttachmentParameteriv(
    542             target, attachment, pname, params);
    543   }
    544 }
    545 
    546 void GetIntegerv(PP_Resource context_id, GLenum pname, GLint* params) {
    547   Enter3D enter(context_id, true);
    548   if (enter.succeeded()) {
    549     ToGles2Impl(&enter)->GetIntegerv(pname, params);
    550   }
    551 }
    552 
    553 void GetProgramiv(
    554     PP_Resource context_id, GLuint program, GLenum pname, GLint* params) {
    555   Enter3D enter(context_id, true);
    556   if (enter.succeeded()) {
    557     ToGles2Impl(&enter)->GetProgramiv(program, pname, params);
    558   }
    559 }
    560 
    561 void GetProgramInfoLog(
    562     PP_Resource context_id, GLuint program, GLsizei bufsize, GLsizei* length,
    563     char* infolog) {
    564   Enter3D enter(context_id, true);
    565   if (enter.succeeded()) {
    566     ToGles2Impl(&enter)->GetProgramInfoLog(program, bufsize, length, infolog);
    567   }
    568 }
    569 
    570 void GetRenderbufferParameteriv(
    571     PP_Resource context_id, GLenum target, GLenum pname, GLint* params) {
    572   Enter3D enter(context_id, true);
    573   if (enter.succeeded()) {
    574     ToGles2Impl(&enter)->GetRenderbufferParameteriv(target, pname, params);
    575   }
    576 }
    577 
    578 void GetShaderiv(
    579     PP_Resource context_id, GLuint shader, GLenum pname, GLint* params) {
    580   Enter3D enter(context_id, true);
    581   if (enter.succeeded()) {
    582     ToGles2Impl(&enter)->GetShaderiv(shader, pname, params);
    583   }
    584 }
    585 
    586 void GetShaderInfoLog(
    587     PP_Resource context_id, GLuint shader, GLsizei bufsize, GLsizei* length,
    588     char* infolog) {
    589   Enter3D enter(context_id, true);
    590   if (enter.succeeded()) {
    591     ToGles2Impl(&enter)->GetShaderInfoLog(shader, bufsize, length, infolog);
    592   }
    593 }
    594 
    595 void GetShaderPrecisionFormat(
    596     PP_Resource context_id, GLenum shadertype, GLenum precisiontype,
    597     GLint* range, GLint* precision) {
    598   Enter3D enter(context_id, true);
    599   if (enter.succeeded()) {
    600     ToGles2Impl(
    601         &enter)->GetShaderPrecisionFormat(
    602             shadertype, precisiontype, range, precision);
    603   }
    604 }
    605 
    606 void GetShaderSource(
    607     PP_Resource context_id, GLuint shader, GLsizei bufsize, GLsizei* length,
    608     char* source) {
    609   Enter3D enter(context_id, true);
    610   if (enter.succeeded()) {
    611     ToGles2Impl(&enter)->GetShaderSource(shader, bufsize, length, source);
    612   }
    613 }
    614 
    615 const GLubyte* GetString(PP_Resource context_id, GLenum name) {
    616   Enter3D enter(context_id, true);
    617   if (enter.succeeded()) {
    618     return ToGles2Impl(&enter)->GetString(name);
    619   } else {
    620     return NULL;
    621   }
    622 }
    623 
    624 void GetTexParameterfv(
    625     PP_Resource context_id, GLenum target, GLenum pname, GLfloat* params) {
    626   Enter3D enter(context_id, true);
    627   if (enter.succeeded()) {
    628     ToGles2Impl(&enter)->GetTexParameterfv(target, pname, params);
    629   }
    630 }
    631 
    632 void GetTexParameteriv(
    633     PP_Resource context_id, GLenum target, GLenum pname, GLint* params) {
    634   Enter3D enter(context_id, true);
    635   if (enter.succeeded()) {
    636     ToGles2Impl(&enter)->GetTexParameteriv(target, pname, params);
    637   }
    638 }
    639 
    640 void GetUniformfv(
    641     PP_Resource context_id, GLuint program, GLint location, GLfloat* params) {
    642   Enter3D enter(context_id, true);
    643   if (enter.succeeded()) {
    644     ToGles2Impl(&enter)->GetUniformfv(program, location, params);
    645   }
    646 }
    647 
    648 void GetUniformiv(
    649     PP_Resource context_id, GLuint program, GLint location, GLint* params) {
    650   Enter3D enter(context_id, true);
    651   if (enter.succeeded()) {
    652     ToGles2Impl(&enter)->GetUniformiv(program, location, params);
    653   }
    654 }
    655 
    656 GLint GetUniformLocation(
    657     PP_Resource context_id, GLuint program, const char* name) {
    658   Enter3D enter(context_id, true);
    659   if (enter.succeeded()) {
    660     return ToGles2Impl(&enter)->GetUniformLocation(program, name);
    661   } else {
    662     return -1;
    663   }
    664 }
    665 
    666 void GetVertexAttribfv(
    667     PP_Resource context_id, GLuint index, GLenum pname, GLfloat* params) {
    668   Enter3D enter(context_id, true);
    669   if (enter.succeeded()) {
    670     ToGles2Impl(&enter)->GetVertexAttribfv(index, pname, params);
    671   }
    672 }
    673 
    674 void GetVertexAttribiv(
    675     PP_Resource context_id, GLuint index, GLenum pname, GLint* params) {
    676   Enter3D enter(context_id, true);
    677   if (enter.succeeded()) {
    678     ToGles2Impl(&enter)->GetVertexAttribiv(index, pname, params);
    679   }
    680 }
    681 
    682 void GetVertexAttribPointerv(
    683     PP_Resource context_id, GLuint index, GLenum pname, void** pointer) {
    684   Enter3D enter(context_id, true);
    685   if (enter.succeeded()) {
    686     ToGles2Impl(&enter)->GetVertexAttribPointerv(index, pname, pointer);
    687   }
    688 }
    689 
    690 void Hint(PP_Resource context_id, GLenum target, GLenum mode) {
    691   Enter3D enter(context_id, true);
    692   if (enter.succeeded()) {
    693     ToGles2Impl(&enter)->Hint(target, mode);
    694   }
    695 }
    696 
    697 GLboolean IsBuffer(PP_Resource context_id, GLuint buffer) {
    698   Enter3D enter(context_id, true);
    699   if (enter.succeeded()) {
    700     return ToGles2Impl(&enter)->IsBuffer(buffer);
    701   } else {
    702     return GL_FALSE;
    703   }
    704 }
    705 
    706 GLboolean IsEnabled(PP_Resource context_id, GLenum cap) {
    707   Enter3D enter(context_id, true);
    708   if (enter.succeeded()) {
    709     return ToGles2Impl(&enter)->IsEnabled(cap);
    710   } else {
    711     return GL_FALSE;
    712   }
    713 }
    714 
    715 GLboolean IsFramebuffer(PP_Resource context_id, GLuint framebuffer) {
    716   Enter3D enter(context_id, true);
    717   if (enter.succeeded()) {
    718     return ToGles2Impl(&enter)->IsFramebuffer(framebuffer);
    719   } else {
    720     return GL_FALSE;
    721   }
    722 }
    723 
    724 GLboolean IsProgram(PP_Resource context_id, GLuint program) {
    725   Enter3D enter(context_id, true);
    726   if (enter.succeeded()) {
    727     return ToGles2Impl(&enter)->IsProgram(program);
    728   } else {
    729     return GL_FALSE;
    730   }
    731 }
    732 
    733 GLboolean IsRenderbuffer(PP_Resource context_id, GLuint renderbuffer) {
    734   Enter3D enter(context_id, true);
    735   if (enter.succeeded()) {
    736     return ToGles2Impl(&enter)->IsRenderbuffer(renderbuffer);
    737   } else {
    738     return GL_FALSE;
    739   }
    740 }
    741 
    742 GLboolean IsShader(PP_Resource context_id, GLuint shader) {
    743   Enter3D enter(context_id, true);
    744   if (enter.succeeded()) {
    745     return ToGles2Impl(&enter)->IsShader(shader);
    746   } else {
    747     return GL_FALSE;
    748   }
    749 }
    750 
    751 GLboolean IsTexture(PP_Resource context_id, GLuint texture) {
    752   Enter3D enter(context_id, true);
    753   if (enter.succeeded()) {
    754     return ToGles2Impl(&enter)->IsTexture(texture);
    755   } else {
    756     return GL_FALSE;
    757   }
    758 }
    759 
    760 void LineWidth(PP_Resource context_id, GLfloat width) {
    761   Enter3D enter(context_id, true);
    762   if (enter.succeeded()) {
    763     ToGles2Impl(&enter)->LineWidth(width);
    764   }
    765 }
    766 
    767 void LinkProgram(PP_Resource context_id, GLuint program) {
    768   Enter3D enter(context_id, true);
    769   if (enter.succeeded()) {
    770     ToGles2Impl(&enter)->LinkProgram(program);
    771   }
    772 }
    773 
    774 void PixelStorei(PP_Resource context_id, GLenum pname, GLint param) {
    775   Enter3D enter(context_id, true);
    776   if (enter.succeeded()) {
    777     ToGles2Impl(&enter)->PixelStorei(pname, param);
    778   }
    779 }
    780 
    781 void PolygonOffset(PP_Resource context_id, GLfloat factor, GLfloat units) {
    782   Enter3D enter(context_id, true);
    783   if (enter.succeeded()) {
    784     ToGles2Impl(&enter)->PolygonOffset(factor, units);
    785   }
    786 }
    787 
    788 void ReadPixels(
    789     PP_Resource context_id, GLint x, GLint y, GLsizei width, GLsizei height,
    790     GLenum format, GLenum type, void* pixels) {
    791   Enter3D enter(context_id, true);
    792   if (enter.succeeded()) {
    793     ToGles2Impl(&enter)->ReadPixels(x, y, width, height, format, type, pixels);
    794   }
    795 }
    796 
    797 void ReleaseShaderCompiler(PP_Resource context_id) {
    798   Enter3D enter(context_id, true);
    799   if (enter.succeeded()) {
    800     ToGles2Impl(&enter)->ReleaseShaderCompiler();
    801   }
    802 }
    803 
    804 void RenderbufferStorage(
    805     PP_Resource context_id, GLenum target, GLenum internalformat, GLsizei width,
    806     GLsizei height) {
    807   Enter3D enter(context_id, true);
    808   if (enter.succeeded()) {
    809     ToGles2Impl(
    810         &enter)->RenderbufferStorage(target, internalformat, width, height);
    811   }
    812 }
    813 
    814 void SampleCoverage(PP_Resource context_id, GLclampf value, GLboolean invert) {
    815   Enter3D enter(context_id, true);
    816   if (enter.succeeded()) {
    817     ToGles2Impl(&enter)->SampleCoverage(value, invert);
    818   }
    819 }
    820 
    821 void Scissor(
    822     PP_Resource context_id, GLint x, GLint y, GLsizei width, GLsizei height) {
    823   Enter3D enter(context_id, true);
    824   if (enter.succeeded()) {
    825     ToGles2Impl(&enter)->Scissor(x, y, width, height);
    826   }
    827 }
    828 
    829 void ShaderBinary(
    830     PP_Resource context_id, GLsizei n, const GLuint* shaders,
    831     GLenum binaryformat, const void* binary, GLsizei length) {
    832   Enter3D enter(context_id, true);
    833   if (enter.succeeded()) {
    834     ToGles2Impl(
    835         &enter)->ShaderBinary(n, shaders, binaryformat, binary, length);
    836   }
    837 }
    838 
    839 void ShaderSource(
    840     PP_Resource context_id, GLuint shader, GLsizei count, const char** str,
    841     const GLint* length) {
    842   Enter3D enter(context_id, true);
    843   if (enter.succeeded()) {
    844     ToGles2Impl(&enter)->ShaderSource(shader, count, str, length);
    845   }
    846 }
    847 
    848 void StencilFunc(PP_Resource context_id, GLenum func, GLint ref, GLuint mask) {
    849   Enter3D enter(context_id, true);
    850   if (enter.succeeded()) {
    851     ToGles2Impl(&enter)->StencilFunc(func, ref, mask);
    852   }
    853 }
    854 
    855 void StencilFuncSeparate(
    856     PP_Resource context_id, GLenum face, GLenum func, GLint ref, GLuint mask) {
    857   Enter3D enter(context_id, true);
    858   if (enter.succeeded()) {
    859     ToGles2Impl(&enter)->StencilFuncSeparate(face, func, ref, mask);
    860   }
    861 }
    862 
    863 void StencilMask(PP_Resource context_id, GLuint mask) {
    864   Enter3D enter(context_id, true);
    865   if (enter.succeeded()) {
    866     ToGles2Impl(&enter)->StencilMask(mask);
    867   }
    868 }
    869 
    870 void StencilMaskSeparate(PP_Resource context_id, GLenum face, GLuint mask) {
    871   Enter3D enter(context_id, true);
    872   if (enter.succeeded()) {
    873     ToGles2Impl(&enter)->StencilMaskSeparate(face, mask);
    874   }
    875 }
    876 
    877 void StencilOp(
    878     PP_Resource context_id, GLenum fail, GLenum zfail, GLenum zpass) {
    879   Enter3D enter(context_id, true);
    880   if (enter.succeeded()) {
    881     ToGles2Impl(&enter)->StencilOp(fail, zfail, zpass);
    882   }
    883 }
    884 
    885 void StencilOpSeparate(
    886     PP_Resource context_id, GLenum face, GLenum fail, GLenum zfail,
    887     GLenum zpass) {
    888   Enter3D enter(context_id, true);
    889   if (enter.succeeded()) {
    890     ToGles2Impl(&enter)->StencilOpSeparate(face, fail, zfail, zpass);
    891   }
    892 }
    893 
    894 void TexImage2D(
    895     PP_Resource context_id, GLenum target, GLint level, GLint internalformat,
    896     GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type,
    897     const void* pixels) {
    898   Enter3D enter(context_id, true);
    899   if (enter.succeeded()) {
    900     ToGles2Impl(
    901         &enter)->TexImage2D(
    902             target, level, internalformat, width, height, border, format, type,
    903             pixels);
    904   }
    905 }
    906 
    907 void TexParameterf(
    908     PP_Resource context_id, GLenum target, GLenum pname, GLfloat param) {
    909   Enter3D enter(context_id, true);
    910   if (enter.succeeded()) {
    911     ToGles2Impl(&enter)->TexParameterf(target, pname, param);
    912   }
    913 }
    914 
    915 void TexParameterfv(
    916     PP_Resource context_id, GLenum target, GLenum pname,
    917     const GLfloat* params) {
    918   Enter3D enter(context_id, true);
    919   if (enter.succeeded()) {
    920     ToGles2Impl(&enter)->TexParameterfv(target, pname, params);
    921   }
    922 }
    923 
    924 void TexParameteri(
    925     PP_Resource context_id, GLenum target, GLenum pname, GLint param) {
    926   Enter3D enter(context_id, true);
    927   if (enter.succeeded()) {
    928     ToGles2Impl(&enter)->TexParameteri(target, pname, param);
    929   }
    930 }
    931 
    932 void TexParameteriv(
    933     PP_Resource context_id, GLenum target, GLenum pname, const GLint* params) {
    934   Enter3D enter(context_id, true);
    935   if (enter.succeeded()) {
    936     ToGles2Impl(&enter)->TexParameteriv(target, pname, params);
    937   }
    938 }
    939 
    940 void TexSubImage2D(
    941     PP_Resource context_id, GLenum target, GLint level, GLint xoffset,
    942     GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type,
    943     const void* pixels) {
    944   Enter3D enter(context_id, true);
    945   if (enter.succeeded()) {
    946     ToGles2Impl(
    947         &enter)->TexSubImage2D(
    948             target, level, xoffset, yoffset, width, height, format, type,
    949             pixels);
    950   }
    951 }
    952 
    953 void Uniform1f(PP_Resource context_id, GLint location, GLfloat x) {
    954   Enter3D enter(context_id, true);
    955   if (enter.succeeded()) {
    956     ToGles2Impl(&enter)->Uniform1f(location, x);
    957   }
    958 }
    959 
    960 void Uniform1fv(
    961     PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) {
    962   Enter3D enter(context_id, true);
    963   if (enter.succeeded()) {
    964     ToGles2Impl(&enter)->Uniform1fv(location, count, v);
    965   }
    966 }
    967 
    968 void Uniform1i(PP_Resource context_id, GLint location, GLint x) {
    969   Enter3D enter(context_id, true);
    970   if (enter.succeeded()) {
    971     ToGles2Impl(&enter)->Uniform1i(location, x);
    972   }
    973 }
    974 
    975 void Uniform1iv(
    976     PP_Resource context_id, GLint location, GLsizei count, const GLint* v) {
    977   Enter3D enter(context_id, true);
    978   if (enter.succeeded()) {
    979     ToGles2Impl(&enter)->Uniform1iv(location, count, v);
    980   }
    981 }
    982 
    983 void Uniform2f(PP_Resource context_id, GLint location, GLfloat x, GLfloat y) {
    984   Enter3D enter(context_id, true);
    985   if (enter.succeeded()) {
    986     ToGles2Impl(&enter)->Uniform2f(location, x, y);
    987   }
    988 }
    989 
    990 void Uniform2fv(
    991     PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) {
    992   Enter3D enter(context_id, true);
    993   if (enter.succeeded()) {
    994     ToGles2Impl(&enter)->Uniform2fv(location, count, v);
    995   }
    996 }
    997 
    998 void Uniform2i(PP_Resource context_id, GLint location, GLint x, GLint y) {
    999   Enter3D enter(context_id, true);
   1000   if (enter.succeeded()) {
   1001     ToGles2Impl(&enter)->Uniform2i(location, x, y);
   1002   }
   1003 }
   1004 
   1005 void Uniform2iv(
   1006     PP_Resource context_id, GLint location, GLsizei count, const GLint* v) {
   1007   Enter3D enter(context_id, true);
   1008   if (enter.succeeded()) {
   1009     ToGles2Impl(&enter)->Uniform2iv(location, count, v);
   1010   }
   1011 }
   1012 
   1013 void Uniform3f(
   1014     PP_Resource context_id, GLint location, GLfloat x, GLfloat y, GLfloat z) {
   1015   Enter3D enter(context_id, true);
   1016   if (enter.succeeded()) {
   1017     ToGles2Impl(&enter)->Uniform3f(location, x, y, z);
   1018   }
   1019 }
   1020 
   1021 void Uniform3fv(
   1022     PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) {
   1023   Enter3D enter(context_id, true);
   1024   if (enter.succeeded()) {
   1025     ToGles2Impl(&enter)->Uniform3fv(location, count, v);
   1026   }
   1027 }
   1028 
   1029 void Uniform3i(
   1030     PP_Resource context_id, GLint location, GLint x, GLint y, GLint z) {
   1031   Enter3D enter(context_id, true);
   1032   if (enter.succeeded()) {
   1033     ToGles2Impl(&enter)->Uniform3i(location, x, y, z);
   1034   }
   1035 }
   1036 
   1037 void Uniform3iv(
   1038     PP_Resource context_id, GLint location, GLsizei count, const GLint* v) {
   1039   Enter3D enter(context_id, true);
   1040   if (enter.succeeded()) {
   1041     ToGles2Impl(&enter)->Uniform3iv(location, count, v);
   1042   }
   1043 }
   1044 
   1045 void Uniform4f(
   1046     PP_Resource context_id, GLint location, GLfloat x, GLfloat y, GLfloat z,
   1047     GLfloat w) {
   1048   Enter3D enter(context_id, true);
   1049   if (enter.succeeded()) {
   1050     ToGles2Impl(&enter)->Uniform4f(location, x, y, z, w);
   1051   }
   1052 }
   1053 
   1054 void Uniform4fv(
   1055     PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) {
   1056   Enter3D enter(context_id, true);
   1057   if (enter.succeeded()) {
   1058     ToGles2Impl(&enter)->Uniform4fv(location, count, v);
   1059   }
   1060 }
   1061 
   1062 void Uniform4i(
   1063     PP_Resource context_id, GLint location, GLint x, GLint y, GLint z,
   1064     GLint w) {
   1065   Enter3D enter(context_id, true);
   1066   if (enter.succeeded()) {
   1067     ToGles2Impl(&enter)->Uniform4i(location, x, y, z, w);
   1068   }
   1069 }
   1070 
   1071 void Uniform4iv(
   1072     PP_Resource context_id, GLint location, GLsizei count, const GLint* v) {
   1073   Enter3D enter(context_id, true);
   1074   if (enter.succeeded()) {
   1075     ToGles2Impl(&enter)->Uniform4iv(location, count, v);
   1076   }
   1077 }
   1078 
   1079 void UniformMatrix2fv(
   1080     PP_Resource context_id, GLint location, GLsizei count, GLboolean transpose,
   1081     const GLfloat* value) {
   1082   Enter3D enter(context_id, true);
   1083   if (enter.succeeded()) {
   1084     ToGles2Impl(&enter)->UniformMatrix2fv(location, count, transpose, value);
   1085   }
   1086 }
   1087 
   1088 void UniformMatrix3fv(
   1089     PP_Resource context_id, GLint location, GLsizei count, GLboolean transpose,
   1090     const GLfloat* value) {
   1091   Enter3D enter(context_id, true);
   1092   if (enter.succeeded()) {
   1093     ToGles2Impl(&enter)->UniformMatrix3fv(location, count, transpose, value);
   1094   }
   1095 }
   1096 
   1097 void UniformMatrix4fv(
   1098     PP_Resource context_id, GLint location, GLsizei count, GLboolean transpose,
   1099     const GLfloat* value) {
   1100   Enter3D enter(context_id, true);
   1101   if (enter.succeeded()) {
   1102     ToGles2Impl(&enter)->UniformMatrix4fv(location, count, transpose, value);
   1103   }
   1104 }
   1105 
   1106 void UseProgram(PP_Resource context_id, GLuint program) {
   1107   Enter3D enter(context_id, true);
   1108   if (enter.succeeded()) {
   1109     ToGles2Impl(&enter)->UseProgram(program);
   1110   }
   1111 }
   1112 
   1113 void ValidateProgram(PP_Resource context_id, GLuint program) {
   1114   Enter3D enter(context_id, true);
   1115   if (enter.succeeded()) {
   1116     ToGles2Impl(&enter)->ValidateProgram(program);
   1117   }
   1118 }
   1119 
   1120 void VertexAttrib1f(PP_Resource context_id, GLuint indx, GLfloat x) {
   1121   Enter3D enter(context_id, true);
   1122   if (enter.succeeded()) {
   1123     ToGles2Impl(&enter)->VertexAttrib1f(indx, x);
   1124   }
   1125 }
   1126 
   1127 void VertexAttrib1fv(
   1128     PP_Resource context_id, GLuint indx, const GLfloat* values) {
   1129   Enter3D enter(context_id, true);
   1130   if (enter.succeeded()) {
   1131     ToGles2Impl(&enter)->VertexAttrib1fv(indx, values);
   1132   }
   1133 }
   1134 
   1135 void VertexAttrib2f(
   1136     PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y) {
   1137   Enter3D enter(context_id, true);
   1138   if (enter.succeeded()) {
   1139     ToGles2Impl(&enter)->VertexAttrib2f(indx, x, y);
   1140   }
   1141 }
   1142 
   1143 void VertexAttrib2fv(
   1144     PP_Resource context_id, GLuint indx, const GLfloat* values) {
   1145   Enter3D enter(context_id, true);
   1146   if (enter.succeeded()) {
   1147     ToGles2Impl(&enter)->VertexAttrib2fv(indx, values);
   1148   }
   1149 }
   1150 
   1151 void VertexAttrib3f(
   1152     PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y, GLfloat z) {
   1153   Enter3D enter(context_id, true);
   1154   if (enter.succeeded()) {
   1155     ToGles2Impl(&enter)->VertexAttrib3f(indx, x, y, z);
   1156   }
   1157 }
   1158 
   1159 void VertexAttrib3fv(
   1160     PP_Resource context_id, GLuint indx, const GLfloat* values) {
   1161   Enter3D enter(context_id, true);
   1162   if (enter.succeeded()) {
   1163     ToGles2Impl(&enter)->VertexAttrib3fv(indx, values);
   1164   }
   1165 }
   1166 
   1167 void VertexAttrib4f(
   1168     PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y, GLfloat z,
   1169     GLfloat w) {
   1170   Enter3D enter(context_id, true);
   1171   if (enter.succeeded()) {
   1172     ToGles2Impl(&enter)->VertexAttrib4f(indx, x, y, z, w);
   1173   }
   1174 }
   1175 
   1176 void VertexAttrib4fv(
   1177     PP_Resource context_id, GLuint indx, const GLfloat* values) {
   1178   Enter3D enter(context_id, true);
   1179   if (enter.succeeded()) {
   1180     ToGles2Impl(&enter)->VertexAttrib4fv(indx, values);
   1181   }
   1182 }
   1183 
   1184 void VertexAttribPointer(
   1185     PP_Resource context_id, GLuint indx, GLint size, GLenum type,
   1186     GLboolean normalized, GLsizei stride, const void* ptr) {
   1187   Enter3D enter(context_id, true);
   1188   if (enter.succeeded()) {
   1189     ToGles2Impl(
   1190         &enter)->VertexAttribPointer(
   1191             indx, size, type, normalized, stride, ptr);
   1192   }
   1193 }
   1194 
   1195 void Viewport(
   1196     PP_Resource context_id, GLint x, GLint y, GLsizei width, GLsizei height) {
   1197   Enter3D enter(context_id, true);
   1198   if (enter.succeeded()) {
   1199     ToGles2Impl(&enter)->Viewport(x, y, width, height);
   1200   }
   1201 }
   1202 
   1203 void BlitFramebufferEXT(
   1204     PP_Resource context_id, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
   1205     GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask,
   1206     GLenum filter) {
   1207   Enter3D enter(context_id, true);
   1208   if (enter.succeeded()) {
   1209     ToGles2Impl(
   1210         &enter)->BlitFramebufferCHROMIUM(
   1211             srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask,
   1212             filter);
   1213   }
   1214 }
   1215 
   1216 void RenderbufferStorageMultisampleEXT(
   1217     PP_Resource context_id, GLenum target, GLsizei samples,
   1218     GLenum internalformat, GLsizei width, GLsizei height) {
   1219   Enter3D enter(context_id, true);
   1220   if (enter.succeeded()) {
   1221     ToGles2Impl(
   1222         &enter)->RenderbufferStorageMultisampleCHROMIUM(
   1223             target, samples, internalformat, width, height);
   1224   }
   1225 }
   1226 
   1227 void GenQueriesEXT(PP_Resource context_id, GLsizei n, GLuint* queries) {
   1228   Enter3D enter(context_id, true);
   1229   if (enter.succeeded()) {
   1230     ToGles2Impl(&enter)->GenQueriesEXT(n, queries);
   1231   }
   1232 }
   1233 
   1234 void DeleteQueriesEXT(
   1235     PP_Resource context_id, GLsizei n, const GLuint* queries) {
   1236   Enter3D enter(context_id, true);
   1237   if (enter.succeeded()) {
   1238     ToGles2Impl(&enter)->DeleteQueriesEXT(n, queries);
   1239   }
   1240 }
   1241 
   1242 GLboolean IsQueryEXT(PP_Resource context_id, GLuint id) {
   1243   Enter3D enter(context_id, true);
   1244   if (enter.succeeded()) {
   1245     return ToGles2Impl(&enter)->IsQueryEXT(id);
   1246   } else {
   1247     return GL_FALSE;
   1248   }
   1249 }
   1250 
   1251 void BeginQueryEXT(PP_Resource context_id, GLenum target, GLuint id) {
   1252   Enter3D enter(context_id, true);
   1253   if (enter.succeeded()) {
   1254     ToGles2Impl(&enter)->BeginQueryEXT(target, id);
   1255   }
   1256 }
   1257 
   1258 void EndQueryEXT(PP_Resource context_id, GLenum target) {
   1259   Enter3D enter(context_id, true);
   1260   if (enter.succeeded()) {
   1261     ToGles2Impl(&enter)->EndQueryEXT(target);
   1262   }
   1263 }
   1264 
   1265 void GetQueryivEXT(
   1266     PP_Resource context_id, GLenum target, GLenum pname, GLint* params) {
   1267   Enter3D enter(context_id, true);
   1268   if (enter.succeeded()) {
   1269     ToGles2Impl(&enter)->GetQueryivEXT(target, pname, params);
   1270   }
   1271 }
   1272 
   1273 void GetQueryObjectuivEXT(
   1274     PP_Resource context_id, GLuint id, GLenum pname, GLuint* params) {
   1275   Enter3D enter(context_id, true);
   1276   if (enter.succeeded()) {
   1277     ToGles2Impl(&enter)->GetQueryObjectuivEXT(id, pname, params);
   1278   }
   1279 }
   1280 
   1281 GLboolean EnableFeatureCHROMIUM(PP_Resource context_id, const char* feature) {
   1282   Enter3D enter(context_id, true);
   1283   if (enter.succeeded()) {
   1284     return ToGles2Impl(&enter)->EnableFeatureCHROMIUM(feature);
   1285   } else {
   1286     return GL_FALSE;
   1287   }
   1288 }
   1289 
   1290 void* MapBufferSubDataCHROMIUM(
   1291     PP_Resource context_id, GLuint target, GLintptr offset, GLsizeiptr size,
   1292     GLenum access) {
   1293   Enter3D enter(context_id, true);
   1294   if (enter.succeeded()) {
   1295     return ToGles2Impl(
   1296         &enter)->MapBufferSubDataCHROMIUM(target, offset, size, access);
   1297   } else {
   1298     return NULL;
   1299   }
   1300 }
   1301 
   1302 void UnmapBufferSubDataCHROMIUM(PP_Resource context_id, const void* mem) {
   1303   Enter3D enter(context_id, true);
   1304   if (enter.succeeded()) {
   1305     ToGles2Impl(&enter)->UnmapBufferSubDataCHROMIUM(mem);
   1306   }
   1307 }
   1308 
   1309 void* MapTexSubImage2DCHROMIUM(
   1310     PP_Resource context_id, GLenum target, GLint level, GLint xoffset,
   1311     GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type,
   1312     GLenum access) {
   1313   Enter3D enter(context_id, true);
   1314   if (enter.succeeded()) {
   1315     return ToGles2Impl(
   1316         &enter)->MapTexSubImage2DCHROMIUM(
   1317             target, level, xoffset, yoffset, width, height, format, type,
   1318             access);
   1319   } else {
   1320     return NULL;
   1321   }
   1322 }
   1323 
   1324 void UnmapTexSubImage2DCHROMIUM(PP_Resource context_id, const void* mem) {
   1325   Enter3D enter(context_id, true);
   1326   if (enter.succeeded()) {
   1327     ToGles2Impl(&enter)->UnmapTexSubImage2DCHROMIUM(mem);
   1328   }
   1329 }
   1330 
   1331 void DrawArraysInstancedANGLE(
   1332     PP_Resource context_id, GLenum mode, GLint first, GLsizei count,
   1333     GLsizei primcount) {
   1334   Enter3D enter(context_id, true);
   1335   if (enter.succeeded()) {
   1336     ToGles2Impl(
   1337         &enter)->DrawArraysInstancedANGLE(mode, first, count, primcount);
   1338   }
   1339 }
   1340 
   1341 void DrawElementsInstancedANGLE(
   1342     PP_Resource context_id, GLenum mode, GLsizei count, GLenum type,
   1343     const void* indices, GLsizei primcount) {
   1344   Enter3D enter(context_id, true);
   1345   if (enter.succeeded()) {
   1346     ToGles2Impl(
   1347         &enter)->DrawElementsInstancedANGLE(
   1348             mode, count, type, indices, primcount);
   1349   }
   1350 }
   1351 
   1352 void VertexAttribDivisorANGLE(
   1353     PP_Resource context_id, GLuint index, GLuint divisor) {
   1354   Enter3D enter(context_id, true);
   1355   if (enter.succeeded()) {
   1356     ToGles2Impl(&enter)->VertexAttribDivisorANGLE(index, divisor);
   1357   }
   1358 }
   1359 
   1360 }  // namespace
   1361 const PPB_OpenGLES2* PPB_OpenGLES2_Shared::GetInterface() {
   1362   static const struct PPB_OpenGLES2 ppb_opengles2 = {
   1363     &ActiveTexture,
   1364     &AttachShader,
   1365     &BindAttribLocation,
   1366     &BindBuffer,
   1367     &BindFramebuffer,
   1368     &BindRenderbuffer,
   1369     &BindTexture,
   1370     &BlendColor,
   1371     &BlendEquation,
   1372     &BlendEquationSeparate,
   1373     &BlendFunc,
   1374     &BlendFuncSeparate,
   1375     &BufferData,
   1376     &BufferSubData,
   1377     &CheckFramebufferStatus,
   1378     &Clear,
   1379     &ClearColor,
   1380     &ClearDepthf,
   1381     &ClearStencil,
   1382     &ColorMask,
   1383     &CompileShader,
   1384     &CompressedTexImage2D,
   1385     &CompressedTexSubImage2D,
   1386     &CopyTexImage2D,
   1387     &CopyTexSubImage2D,
   1388     &CreateProgram,
   1389     &CreateShader,
   1390     &CullFace,
   1391     &DeleteBuffers,
   1392     &DeleteFramebuffers,
   1393     &DeleteProgram,
   1394     &DeleteRenderbuffers,
   1395     &DeleteShader,
   1396     &DeleteTextures,
   1397     &DepthFunc,
   1398     &DepthMask,
   1399     &DepthRangef,
   1400     &DetachShader,
   1401     &Disable,
   1402     &DisableVertexAttribArray,
   1403     &DrawArrays,
   1404     &DrawElements,
   1405     &Enable,
   1406     &EnableVertexAttribArray,
   1407     &Finish,
   1408     &Flush,
   1409     &FramebufferRenderbuffer,
   1410     &FramebufferTexture2D,
   1411     &FrontFace,
   1412     &GenBuffers,
   1413     &GenerateMipmap,
   1414     &GenFramebuffers,
   1415     &GenRenderbuffers,
   1416     &GenTextures,
   1417     &GetActiveAttrib,
   1418     &GetActiveUniform,
   1419     &GetAttachedShaders,
   1420     &GetAttribLocation,
   1421     &GetBooleanv,
   1422     &GetBufferParameteriv,
   1423     &GetError,
   1424     &GetFloatv,
   1425     &GetFramebufferAttachmentParameteriv,
   1426     &GetIntegerv,
   1427     &GetProgramiv,
   1428     &GetProgramInfoLog,
   1429     &GetRenderbufferParameteriv,
   1430     &GetShaderiv,
   1431     &GetShaderInfoLog,
   1432     &GetShaderPrecisionFormat,
   1433     &GetShaderSource,
   1434     &GetString,
   1435     &GetTexParameterfv,
   1436     &GetTexParameteriv,
   1437     &GetUniformfv,
   1438     &GetUniformiv,
   1439     &GetUniformLocation,
   1440     &GetVertexAttribfv,
   1441     &GetVertexAttribiv,
   1442     &GetVertexAttribPointerv,
   1443     &Hint,
   1444     &IsBuffer,
   1445     &IsEnabled,
   1446     &IsFramebuffer,
   1447     &IsProgram,
   1448     &IsRenderbuffer,
   1449     &IsShader,
   1450     &IsTexture,
   1451     &LineWidth,
   1452     &LinkProgram,
   1453     &PixelStorei,
   1454     &PolygonOffset,
   1455     &ReadPixels,
   1456     &ReleaseShaderCompiler,
   1457     &RenderbufferStorage,
   1458     &SampleCoverage,
   1459     &Scissor,
   1460     &ShaderBinary,
   1461     &ShaderSource,
   1462     &StencilFunc,
   1463     &StencilFuncSeparate,
   1464     &StencilMask,
   1465     &StencilMaskSeparate,
   1466     &StencilOp,
   1467     &StencilOpSeparate,
   1468     &TexImage2D,
   1469     &TexParameterf,
   1470     &TexParameterfv,
   1471     &TexParameteri,
   1472     &TexParameteriv,
   1473     &TexSubImage2D,
   1474     &Uniform1f,
   1475     &Uniform1fv,
   1476     &Uniform1i,
   1477     &Uniform1iv,
   1478     &Uniform2f,
   1479     &Uniform2fv,
   1480     &Uniform2i,
   1481     &Uniform2iv,
   1482     &Uniform3f,
   1483     &Uniform3fv,
   1484     &Uniform3i,
   1485     &Uniform3iv,
   1486     &Uniform4f,
   1487     &Uniform4fv,
   1488     &Uniform4i,
   1489     &Uniform4iv,
   1490     &UniformMatrix2fv,
   1491     &UniformMatrix3fv,
   1492     &UniformMatrix4fv,
   1493     &UseProgram,
   1494     &ValidateProgram,
   1495     &VertexAttrib1f,
   1496     &VertexAttrib1fv,
   1497     &VertexAttrib2f,
   1498     &VertexAttrib2fv,
   1499     &VertexAttrib3f,
   1500     &VertexAttrib3fv,
   1501     &VertexAttrib4f,
   1502     &VertexAttrib4fv,
   1503     &VertexAttribPointer,
   1504     &Viewport
   1505   };
   1506   return &ppb_opengles2;
   1507 }
   1508 const PPB_OpenGLES2InstancedArrays* PPB_OpenGLES2_Shared::GetInstancedArraysInterface() {  // NOLINT
   1509   static const struct PPB_OpenGLES2InstancedArrays ppb_opengles2 = {
   1510     &DrawArraysInstancedANGLE,
   1511     &DrawElementsInstancedANGLE,
   1512     &VertexAttribDivisorANGLE
   1513   };
   1514   return &ppb_opengles2;
   1515 }
   1516 const PPB_OpenGLES2FramebufferBlit* PPB_OpenGLES2_Shared::GetFramebufferBlitInterface() {  // NOLINT
   1517   static const struct PPB_OpenGLES2FramebufferBlit ppb_opengles2 = {
   1518     &BlitFramebufferEXT
   1519   };
   1520   return &ppb_opengles2;
   1521 }
   1522 const PPB_OpenGLES2FramebufferMultisample* PPB_OpenGLES2_Shared::GetFramebufferMultisampleInterface() {  // NOLINT
   1523   static const struct PPB_OpenGLES2FramebufferMultisample ppb_opengles2 = {
   1524     &RenderbufferStorageMultisampleEXT
   1525   };
   1526   return &ppb_opengles2;
   1527 }
   1528 const PPB_OpenGLES2ChromiumEnableFeature* PPB_OpenGLES2_Shared::GetChromiumEnableFeatureInterface() {  // NOLINT
   1529   static const struct PPB_OpenGLES2ChromiumEnableFeature ppb_opengles2 = {
   1530     &EnableFeatureCHROMIUM
   1531   };
   1532   return &ppb_opengles2;
   1533 }
   1534 const PPB_OpenGLES2ChromiumMapSub* PPB_OpenGLES2_Shared::GetChromiumMapSubInterface() {  // NOLINT
   1535   static const struct PPB_OpenGLES2ChromiumMapSub ppb_opengles2 = {
   1536     &MapBufferSubDataCHROMIUM,
   1537     &UnmapBufferSubDataCHROMIUM,
   1538     &MapTexSubImage2DCHROMIUM,
   1539     &UnmapTexSubImage2DCHROMIUM
   1540   };
   1541   return &ppb_opengles2;
   1542 }
   1543 const PPB_OpenGLES2Query* PPB_OpenGLES2_Shared::GetQueryInterface() {
   1544   static const struct PPB_OpenGLES2Query ppb_opengles2 = {
   1545     &GenQueriesEXT,
   1546     &DeleteQueriesEXT,
   1547     &IsQueryEXT,
   1548     &BeginQueryEXT,
   1549     &EndQueryEXT,
   1550     &GetQueryivEXT,
   1551     &GetQueryObjectuivEXT
   1552   };
   1553   return &ppb_opengles2;
   1554 }
   1555 }  // namespace ppapi
   1556