• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
ToGles2Impl(Enter3D * enter)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 
ActiveTexture(PP_Resource context_id,GLenum texture)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 
AttachShader(PP_Resource context_id,GLuint program,GLuint shader)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 
BindAttribLocation(PP_Resource context_id,GLuint program,GLuint index,const char * name)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 
BindBuffer(PP_Resource context_id,GLenum target,GLuint buffer)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 
BindFramebuffer(PP_Resource context_id,GLenum target,GLuint framebuffer)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 
BindRenderbuffer(PP_Resource context_id,GLenum target,GLuint renderbuffer)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 
BindTexture(PP_Resource context_id,GLenum target,GLuint texture)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 
BlendColor(PP_Resource context_id,GLclampf red,GLclampf green,GLclampf blue,GLclampf alpha)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 
BlendEquation(PP_Resource context_id,GLenum mode)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 
BlendEquationSeparate(PP_Resource context_id,GLenum modeRGB,GLenum modeAlpha)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 
BlendFunc(PP_Resource context_id,GLenum sfactor,GLenum dfactor)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 
BlendFuncSeparate(PP_Resource context_id,GLenum srcRGB,GLenum dstRGB,GLenum srcAlpha,GLenum dstAlpha)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 
BufferData(PP_Resource context_id,GLenum target,GLsizeiptr size,const void * data,GLenum usage)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 
BufferSubData(PP_Resource context_id,GLenum target,GLintptr offset,GLsizeiptr size,const void * data)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 
CheckFramebufferStatus(PP_Resource context_id,GLenum target)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 
Clear(PP_Resource context_id,GLbitfield mask)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 
ClearColor(PP_Resource context_id,GLclampf red,GLclampf green,GLclampf blue,GLclampf alpha)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 
ClearDepthf(PP_Resource context_id,GLclampf depth)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 
ClearStencil(PP_Resource context_id,GLint s)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 
ColorMask(PP_Resource context_id,GLboolean red,GLboolean green,GLboolean blue,GLboolean alpha)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 
CompileShader(PP_Resource context_id,GLuint shader)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 
CompressedTexImage2D(PP_Resource context_id,GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLint border,GLsizei imageSize,const void * data)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 
CompressedTexSubImage2D(PP_Resource context_id,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLsizei imageSize,const void * data)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 
CopyTexImage2D(PP_Resource context_id,GLenum target,GLint level,GLenum internalformat,GLint x,GLint y,GLsizei width,GLsizei height,GLint border)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 
CopyTexSubImage2D(PP_Resource context_id,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint x,GLint y,GLsizei width,GLsizei height)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 
CreateProgram(PP_Resource context_id)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 
CreateShader(PP_Resource context_id,GLenum type)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 
CullFace(PP_Resource context_id,GLenum mode)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 
DeleteBuffers(PP_Resource context_id,GLsizei n,const GLuint * buffers)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 
DeleteFramebuffers(PP_Resource context_id,GLsizei n,const GLuint * framebuffers)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 
DeleteProgram(PP_Resource context_id,GLuint program)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 
DeleteRenderbuffers(PP_Resource context_id,GLsizei n,const GLuint * renderbuffers)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 
DeleteShader(PP_Resource context_id,GLuint shader)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 
DeleteTextures(PP_Resource context_id,GLsizei n,const GLuint * textures)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 
DepthFunc(PP_Resource context_id,GLenum func)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 
DepthMask(PP_Resource context_id,GLboolean flag)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 
DepthRangef(PP_Resource context_id,GLclampf zNear,GLclampf zFar)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 
DetachShader(PP_Resource context_id,GLuint program,GLuint shader)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 
Disable(PP_Resource context_id,GLenum cap)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 
DisableVertexAttribArray(PP_Resource context_id,GLuint index)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 
DrawArrays(PP_Resource context_id,GLenum mode,GLint first,GLsizei count)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 
DrawElements(PP_Resource context_id,GLenum mode,GLsizei count,GLenum type,const void * indices)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 
Enable(PP_Resource context_id,GLenum cap)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 
EnableVertexAttribArray(PP_Resource context_id,GLuint index)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 
Finish(PP_Resource context_id)384 void Finish(PP_Resource context_id) {
385   Enter3D enter(context_id, true);
386   if (enter.succeeded()) {
387     ToGles2Impl(&enter)->Finish();
388   }
389 }
390 
Flush(PP_Resource context_id)391 void Flush(PP_Resource context_id) {
392   Enter3D enter(context_id, true);
393   if (enter.succeeded()) {
394     ToGles2Impl(&enter)->Flush();
395   }
396 }
397 
FramebufferRenderbuffer(PP_Resource context_id,GLenum target,GLenum attachment,GLenum renderbuffertarget,GLuint renderbuffer)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 
FramebufferTexture2D(PP_Resource context_id,GLenum target,GLenum attachment,GLenum textarget,GLuint texture,GLint level)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 
FrontFace(PP_Resource context_id,GLenum mode)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 
GenBuffers(PP_Resource context_id,GLsizei n,GLuint * buffers)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 
GenerateMipmap(PP_Resource context_id,GLenum target)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 
GenFramebuffers(PP_Resource context_id,GLsizei n,GLuint * framebuffers)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 
GenRenderbuffers(PP_Resource context_id,GLsizei n,GLuint * renderbuffers)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 
GenTextures(PP_Resource context_id,GLsizei n,GLuint * textures)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 
GetActiveAttrib(PP_Resource context_id,GLuint program,GLuint index,GLsizei bufsize,GLsizei * length,GLint * size,GLenum * type,char * name)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 
GetActiveUniform(PP_Resource context_id,GLuint program,GLuint index,GLsizei bufsize,GLsizei * length,GLint * size,GLenum * type,char * name)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 
GetAttachedShaders(PP_Resource context_id,GLuint program,GLsizei maxcount,GLsizei * count,GLuint * shaders)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 
GetAttribLocation(PP_Resource context_id,GLuint program,const char * name)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 
GetBooleanv(PP_Resource context_id,GLenum pname,GLboolean * params)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 
GetBufferParameteriv(PP_Resource context_id,GLenum target,GLenum pname,GLint * params)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 
GetError(PP_Resource context_id)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 
GetFloatv(PP_Resource context_id,GLenum pname,GLfloat * params)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 
GetFramebufferAttachmentParameteriv(PP_Resource context_id,GLenum target,GLenum attachment,GLenum pname,GLint * params)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 
GetIntegerv(PP_Resource context_id,GLenum pname,GLint * params)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 
GetProgramiv(PP_Resource context_id,GLuint program,GLenum pname,GLint * params)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 
GetProgramInfoLog(PP_Resource context_id,GLuint program,GLsizei bufsize,GLsizei * length,char * infolog)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 
GetRenderbufferParameteriv(PP_Resource context_id,GLenum target,GLenum pname,GLint * params)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 
GetShaderiv(PP_Resource context_id,GLuint shader,GLenum pname,GLint * params)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 
GetShaderInfoLog(PP_Resource context_id,GLuint shader,GLsizei bufsize,GLsizei * length,char * infolog)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 
GetShaderPrecisionFormat(PP_Resource context_id,GLenum shadertype,GLenum precisiontype,GLint * range,GLint * precision)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 
GetShaderSource(PP_Resource context_id,GLuint shader,GLsizei bufsize,GLsizei * length,char * source)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 
GetString(PP_Resource context_id,GLenum name)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 
GetTexParameterfv(PP_Resource context_id,GLenum target,GLenum pname,GLfloat * params)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 
GetTexParameteriv(PP_Resource context_id,GLenum target,GLenum pname,GLint * params)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 
GetUniformfv(PP_Resource context_id,GLuint program,GLint location,GLfloat * params)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 
GetUniformiv(PP_Resource context_id,GLuint program,GLint location,GLint * params)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 
GetUniformLocation(PP_Resource context_id,GLuint program,const char * name)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 
GetVertexAttribfv(PP_Resource context_id,GLuint index,GLenum pname,GLfloat * params)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 
GetVertexAttribiv(PP_Resource context_id,GLuint index,GLenum pname,GLint * params)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 
GetVertexAttribPointerv(PP_Resource context_id,GLuint index,GLenum pname,void ** pointer)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 
Hint(PP_Resource context_id,GLenum target,GLenum mode)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 
IsBuffer(PP_Resource context_id,GLuint buffer)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 
IsEnabled(PP_Resource context_id,GLenum cap)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 
IsFramebuffer(PP_Resource context_id,GLuint framebuffer)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 
IsProgram(PP_Resource context_id,GLuint program)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 
IsRenderbuffer(PP_Resource context_id,GLuint renderbuffer)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 
IsShader(PP_Resource context_id,GLuint shader)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 
IsTexture(PP_Resource context_id,GLuint texture)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 
LineWidth(PP_Resource context_id,GLfloat width)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 
LinkProgram(PP_Resource context_id,GLuint program)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 
PixelStorei(PP_Resource context_id,GLenum pname,GLint param)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 
PolygonOffset(PP_Resource context_id,GLfloat factor,GLfloat units)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 
ReadPixels(PP_Resource context_id,GLint x,GLint y,GLsizei width,GLsizei height,GLenum format,GLenum type,void * pixels)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 
ReleaseShaderCompiler(PP_Resource context_id)797 void ReleaseShaderCompiler(PP_Resource context_id) {
798   Enter3D enter(context_id, true);
799   if (enter.succeeded()) {
800     ToGles2Impl(&enter)->ReleaseShaderCompiler();
801   }
802 }
803 
RenderbufferStorage(PP_Resource context_id,GLenum target,GLenum internalformat,GLsizei width,GLsizei height)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 
SampleCoverage(PP_Resource context_id,GLclampf value,GLboolean invert)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 
Scissor(PP_Resource context_id,GLint x,GLint y,GLsizei width,GLsizei height)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 
ShaderBinary(PP_Resource context_id,GLsizei n,const GLuint * shaders,GLenum binaryformat,const void * binary,GLsizei length)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 
ShaderSource(PP_Resource context_id,GLuint shader,GLsizei count,const char ** str,const GLint * length)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 
StencilFunc(PP_Resource context_id,GLenum func,GLint ref,GLuint mask)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 
StencilFuncSeparate(PP_Resource context_id,GLenum face,GLenum func,GLint ref,GLuint mask)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 
StencilMask(PP_Resource context_id,GLuint mask)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 
StencilMaskSeparate(PP_Resource context_id,GLenum face,GLuint mask)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 
StencilOp(PP_Resource context_id,GLenum fail,GLenum zfail,GLenum zpass)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 
StencilOpSeparate(PP_Resource context_id,GLenum face,GLenum fail,GLenum zfail,GLenum zpass)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 
TexImage2D(PP_Resource context_id,GLenum target,GLint level,GLint internalformat,GLsizei width,GLsizei height,GLint border,GLenum format,GLenum type,const void * pixels)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 
TexParameterf(PP_Resource context_id,GLenum target,GLenum pname,GLfloat param)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 
TexParameterfv(PP_Resource context_id,GLenum target,GLenum pname,const GLfloat * params)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 
TexParameteri(PP_Resource context_id,GLenum target,GLenum pname,GLint param)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 
TexParameteriv(PP_Resource context_id,GLenum target,GLenum pname,const GLint * params)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 
TexSubImage2D(PP_Resource context_id,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLenum type,const void * pixels)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 
Uniform1f(PP_Resource context_id,GLint location,GLfloat x)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 
Uniform1fv(PP_Resource context_id,GLint location,GLsizei count,const GLfloat * v)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 
Uniform1i(PP_Resource context_id,GLint location,GLint x)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 
Uniform1iv(PP_Resource context_id,GLint location,GLsizei count,const GLint * v)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 
Uniform2f(PP_Resource context_id,GLint location,GLfloat x,GLfloat y)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 
Uniform2fv(PP_Resource context_id,GLint location,GLsizei count,const GLfloat * v)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 
Uniform2i(PP_Resource context_id,GLint location,GLint x,GLint y)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 
Uniform2iv(PP_Resource context_id,GLint location,GLsizei count,const GLint * v)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 
Uniform3f(PP_Resource context_id,GLint location,GLfloat x,GLfloat y,GLfloat z)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 
Uniform3fv(PP_Resource context_id,GLint location,GLsizei count,const GLfloat * v)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 
Uniform3i(PP_Resource context_id,GLint location,GLint x,GLint y,GLint z)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 
Uniform3iv(PP_Resource context_id,GLint location,GLsizei count,const GLint * v)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 
Uniform4f(PP_Resource context_id,GLint location,GLfloat x,GLfloat y,GLfloat z,GLfloat w)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 
Uniform4fv(PP_Resource context_id,GLint location,GLsizei count,const GLfloat * v)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 
Uniform4i(PP_Resource context_id,GLint location,GLint x,GLint y,GLint z,GLint w)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 
Uniform4iv(PP_Resource context_id,GLint location,GLsizei count,const GLint * v)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 
UniformMatrix2fv(PP_Resource context_id,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)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 
UniformMatrix3fv(PP_Resource context_id,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)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 
UniformMatrix4fv(PP_Resource context_id,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)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 
UseProgram(PP_Resource context_id,GLuint program)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 
ValidateProgram(PP_Resource context_id,GLuint program)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 
VertexAttrib1f(PP_Resource context_id,GLuint indx,GLfloat x)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 
VertexAttrib1fv(PP_Resource context_id,GLuint indx,const GLfloat * values)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 
VertexAttrib2f(PP_Resource context_id,GLuint indx,GLfloat x,GLfloat y)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 
VertexAttrib2fv(PP_Resource context_id,GLuint indx,const GLfloat * values)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 
VertexAttrib3f(PP_Resource context_id,GLuint indx,GLfloat x,GLfloat y,GLfloat z)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 
VertexAttrib3fv(PP_Resource context_id,GLuint indx,const GLfloat * values)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 
VertexAttrib4f(PP_Resource context_id,GLuint indx,GLfloat x,GLfloat y,GLfloat z,GLfloat w)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 
VertexAttrib4fv(PP_Resource context_id,GLuint indx,const GLfloat * values)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 
VertexAttribPointer(PP_Resource context_id,GLuint indx,GLint size,GLenum type,GLboolean normalized,GLsizei stride,const void * ptr)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 
Viewport(PP_Resource context_id,GLint x,GLint y,GLsizei width,GLsizei height)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 
BlitFramebufferEXT(PP_Resource context_id,GLint srcX0,GLint srcY0,GLint srcX1,GLint srcY1,GLint dstX0,GLint dstY0,GLint dstX1,GLint dstY1,GLbitfield mask,GLenum filter)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 
RenderbufferStorageMultisampleEXT(PP_Resource context_id,GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height)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 
GenQueriesEXT(PP_Resource context_id,GLsizei n,GLuint * queries)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 
DeleteQueriesEXT(PP_Resource context_id,GLsizei n,const GLuint * queries)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 
IsQueryEXT(PP_Resource context_id,GLuint id)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 
BeginQueryEXT(PP_Resource context_id,GLenum target,GLuint id)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 
EndQueryEXT(PP_Resource context_id,GLenum target)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 
GetQueryivEXT(PP_Resource context_id,GLenum target,GLenum pname,GLint * params)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 
GetQueryObjectuivEXT(PP_Resource context_id,GLuint id,GLenum pname,GLuint * params)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 
EnableFeatureCHROMIUM(PP_Resource context_id,const char * feature)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 
MapBufferSubDataCHROMIUM(PP_Resource context_id,GLuint target,GLintptr offset,GLsizeiptr size,GLenum access)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 
UnmapBufferSubDataCHROMIUM(PP_Resource context_id,const void * mem)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 
MapTexSubImage2DCHROMIUM(PP_Resource context_id,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLenum type,GLenum access)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 
UnmapTexSubImage2DCHROMIUM(PP_Resource context_id,const void * mem)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 
DrawArraysInstancedANGLE(PP_Resource context_id,GLenum mode,GLint first,GLsizei count,GLsizei primcount)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 
DrawElementsInstancedANGLE(PP_Resource context_id,GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei primcount)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 
VertexAttribDivisorANGLE(PP_Resource context_id,GLuint index,GLuint divisor)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
GetInterface()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 }
GetInstancedArraysInterface()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 }
GetFramebufferBlitInterface()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 }
GetFramebufferMultisampleInterface()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 }
GetChromiumEnableFeatureInterface()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 }
GetChromiumMapSubInterface()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 }
GetQueryInterface()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