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