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
16namespace ppapi {
17
18namespace {
19
20gpu::gles2::GLES2Implementation* GetGLES(PP_Resource context) {
21  thunk::EnterResource<thunk::PPB_Graphics3D_API> enter_g3d(context, false);
22  DCHECK(enter_g3d.succeeded());
23  return static_cast<PPB_Graphics3D_Shared*>(enter_g3d.object())->gles2_impl();
24}
25
26void ActiveTexture(PP_Resource context_id, GLenum texture) {
27  GetGLES(context_id)->ActiveTexture(texture);
28}
29
30void AttachShader(PP_Resource context_id, GLuint program, GLuint shader) {
31  GetGLES(context_id)->AttachShader(program, shader);
32}
33
34void BindAttribLocation(
35    PP_Resource context_id, GLuint program, GLuint index, const char* name) {
36  GetGLES(context_id)->BindAttribLocation(program, index, name);
37}
38
39void BindBuffer(PP_Resource context_id, GLenum target, GLuint buffer) {
40  GetGLES(context_id)->BindBuffer(target, buffer);
41}
42
43void BindFramebuffer(
44    PP_Resource context_id, GLenum target, GLuint framebuffer) {
45  GetGLES(context_id)->BindFramebuffer(target, framebuffer);
46}
47
48void BindRenderbuffer(
49    PP_Resource context_id, GLenum target, GLuint renderbuffer) {
50  GetGLES(context_id)->BindRenderbuffer(target, renderbuffer);
51}
52
53void BindTexture(PP_Resource context_id, GLenum target, GLuint texture) {
54  GetGLES(context_id)->BindTexture(target, texture);
55}
56
57void BlendColor(
58    PP_Resource context_id, GLclampf red, GLclampf green, GLclampf blue,
59    GLclampf alpha) {
60  GetGLES(context_id)->BlendColor(red, green, blue, alpha);
61}
62
63void BlendEquation(PP_Resource context_id, GLenum mode) {
64  GetGLES(context_id)->BlendEquation(mode);
65}
66
67void BlendEquationSeparate(
68    PP_Resource context_id, GLenum modeRGB, GLenum modeAlpha) {
69  GetGLES(context_id)->BlendEquationSeparate(modeRGB, modeAlpha);
70}
71
72void BlendFunc(PP_Resource context_id, GLenum sfactor, GLenum dfactor) {
73  GetGLES(context_id)->BlendFunc(sfactor, dfactor);
74}
75
76void BlendFuncSeparate(
77    PP_Resource context_id, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha,
78    GLenum dstAlpha) {
79  GetGLES(context_id)->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
80}
81
82void BufferData(
83    PP_Resource context_id, GLenum target, GLsizeiptr size, const void* data,
84    GLenum usage) {
85  GetGLES(context_id)->BufferData(target, size, data, usage);
86}
87
88void BufferSubData(
89    PP_Resource context_id, GLenum target, GLintptr offset, GLsizeiptr size,
90    const void* data) {
91  GetGLES(context_id)->BufferSubData(target, offset, size, data);
92}
93
94GLenum CheckFramebufferStatus(PP_Resource context_id, GLenum target) {
95  return GetGLES(context_id)->CheckFramebufferStatus(target);
96}
97
98void Clear(PP_Resource context_id, GLbitfield mask) {
99  GetGLES(context_id)->Clear(mask);
100}
101
102void ClearColor(
103    PP_Resource context_id, GLclampf red, GLclampf green, GLclampf blue,
104    GLclampf alpha) {
105  GetGLES(context_id)->ClearColor(red, green, blue, alpha);
106}
107
108void ClearDepthf(PP_Resource context_id, GLclampf depth) {
109  GetGLES(context_id)->ClearDepthf(depth);
110}
111
112void ClearStencil(PP_Resource context_id, GLint s) {
113  GetGLES(context_id)->ClearStencil(s);
114}
115
116void ColorMask(
117    PP_Resource context_id, GLboolean red, GLboolean green, GLboolean blue,
118    GLboolean alpha) {
119  GetGLES(context_id)->ColorMask(red, green, blue, alpha);
120}
121
122void CompileShader(PP_Resource context_id, GLuint shader) {
123  GetGLES(context_id)->CompileShader(shader);
124}
125
126void CompressedTexImage2D(
127    PP_Resource context_id, GLenum target, GLint level, GLenum internalformat,
128    GLsizei width, GLsizei height, GLint border, GLsizei imageSize,
129    const void* data) {
130  GetGLES(
131      context_id)->CompressedTexImage2D(
132          target, level, internalformat, width, height, border, imageSize,
133          data);
134}
135
136void CompressedTexSubImage2D(
137    PP_Resource context_id, GLenum target, GLint level, GLint xoffset,
138    GLint yoffset, GLsizei width, GLsizei height, GLenum format,
139    GLsizei imageSize, const void* data) {
140  GetGLES(
141      context_id)->CompressedTexSubImage2D(
142          target, level, xoffset, yoffset, width, height, format, imageSize,
143          data);
144}
145
146void CopyTexImage2D(
147    PP_Resource context_id, GLenum target, GLint level, GLenum internalformat,
148    GLint x, GLint y, GLsizei width, GLsizei height, GLint border) {
149  GetGLES(
150      context_id)->CopyTexImage2D(
151          target, level, internalformat, x, y, width, height, border);
152}
153
154void CopyTexSubImage2D(
155    PP_Resource context_id, GLenum target, GLint level, GLint xoffset,
156    GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) {
157  GetGLES(
158      context_id)->CopyTexSubImage2D(
159          target, level, xoffset, yoffset, x, y, width, height);
160}
161
162GLuint CreateProgram(PP_Resource context_id) {
163  return GetGLES(context_id)->CreateProgram();
164}
165
166GLuint CreateShader(PP_Resource context_id, GLenum type) {
167  return GetGLES(context_id)->CreateShader(type);
168}
169
170void CullFace(PP_Resource context_id, GLenum mode) {
171  GetGLES(context_id)->CullFace(mode);
172}
173
174void DeleteBuffers(PP_Resource context_id, GLsizei n, const GLuint* buffers) {
175  GetGLES(context_id)->DeleteBuffers(n, buffers);
176}
177
178void DeleteFramebuffers(
179    PP_Resource context_id, GLsizei n, const GLuint* framebuffers) {
180  GetGLES(context_id)->DeleteFramebuffers(n, framebuffers);
181}
182
183void DeleteProgram(PP_Resource context_id, GLuint program) {
184  GetGLES(context_id)->DeleteProgram(program);
185}
186
187void DeleteRenderbuffers(
188    PP_Resource context_id, GLsizei n, const GLuint* renderbuffers) {
189  GetGLES(context_id)->DeleteRenderbuffers(n, renderbuffers);
190}
191
192void DeleteShader(PP_Resource context_id, GLuint shader) {
193  GetGLES(context_id)->DeleteShader(shader);
194}
195
196void DeleteTextures(
197    PP_Resource context_id, GLsizei n, const GLuint* textures) {
198  GetGLES(context_id)->DeleteTextures(n, textures);
199}
200
201void DepthFunc(PP_Resource context_id, GLenum func) {
202  GetGLES(context_id)->DepthFunc(func);
203}
204
205void DepthMask(PP_Resource context_id, GLboolean flag) {
206  GetGLES(context_id)->DepthMask(flag);
207}
208
209void DepthRangef(PP_Resource context_id, GLclampf zNear, GLclampf zFar) {
210  GetGLES(context_id)->DepthRangef(zNear, zFar);
211}
212
213void DetachShader(PP_Resource context_id, GLuint program, GLuint shader) {
214  GetGLES(context_id)->DetachShader(program, shader);
215}
216
217void Disable(PP_Resource context_id, GLenum cap) {
218  GetGLES(context_id)->Disable(cap);
219}
220
221void DisableVertexAttribArray(PP_Resource context_id, GLuint index) {
222  GetGLES(context_id)->DisableVertexAttribArray(index);
223}
224
225void DrawArrays(
226    PP_Resource context_id, GLenum mode, GLint first, GLsizei count) {
227  GetGLES(context_id)->DrawArrays(mode, first, count);
228}
229
230void DrawElements(
231    PP_Resource context_id, GLenum mode, GLsizei count, GLenum type,
232    const void* indices) {
233  GetGLES(context_id)->DrawElements(mode, count, type, indices);
234}
235
236void Enable(PP_Resource context_id, GLenum cap) {
237  GetGLES(context_id)->Enable(cap);
238}
239
240void EnableVertexAttribArray(PP_Resource context_id, GLuint index) {
241  GetGLES(context_id)->EnableVertexAttribArray(index);
242}
243
244void Finish(PP_Resource context_id) {
245  GetGLES(context_id)->Finish();
246}
247
248void Flush(PP_Resource context_id) {
249  GetGLES(context_id)->Flush();
250}
251
252void FramebufferRenderbuffer(
253    PP_Resource context_id, GLenum target, GLenum attachment,
254    GLenum renderbuffertarget, GLuint renderbuffer) {
255  GetGLES(
256      context_id)->FramebufferRenderbuffer(
257          target, attachment, renderbuffertarget, renderbuffer);
258}
259
260void FramebufferTexture2D(
261    PP_Resource context_id, GLenum target, GLenum attachment, GLenum textarget,
262    GLuint texture, GLint level) {
263  GetGLES(
264      context_id)->FramebufferTexture2D(
265          target, attachment, textarget, texture, level);
266}
267
268void FrontFace(PP_Resource context_id, GLenum mode) {
269  GetGLES(context_id)->FrontFace(mode);
270}
271
272void GenBuffers(PP_Resource context_id, GLsizei n, GLuint* buffers) {
273  GetGLES(context_id)->GenBuffers(n, buffers);
274}
275
276void GenerateMipmap(PP_Resource context_id, GLenum target) {
277  GetGLES(context_id)->GenerateMipmap(target);
278}
279
280void GenFramebuffers(PP_Resource context_id, GLsizei n, GLuint* framebuffers) {
281  GetGLES(context_id)->GenFramebuffers(n, framebuffers);
282}
283
284void GenRenderbuffers(
285    PP_Resource context_id, GLsizei n, GLuint* renderbuffers) {
286  GetGLES(context_id)->GenRenderbuffers(n, renderbuffers);
287}
288
289void GenTextures(PP_Resource context_id, GLsizei n, GLuint* textures) {
290  GetGLES(context_id)->GenTextures(n, textures);
291}
292
293void GetActiveAttrib(
294    PP_Resource context_id, GLuint program, GLuint index, GLsizei bufsize,
295    GLsizei* length, GLint* size, GLenum* type, char* name) {
296  GetGLES(
297      context_id)->GetActiveAttrib(
298          program, index, bufsize, length, size, type, name);
299}
300
301void GetActiveUniform(
302    PP_Resource context_id, GLuint program, GLuint index, GLsizei bufsize,
303    GLsizei* length, GLint* size, GLenum* type, char* name) {
304  GetGLES(
305      context_id)->GetActiveUniform(
306          program, index, bufsize, length, size, type, name);
307}
308
309void GetAttachedShaders(
310    PP_Resource context_id, GLuint program, GLsizei maxcount, GLsizei* count,
311    GLuint* shaders) {
312  GetGLES(context_id)->GetAttachedShaders(program, maxcount, count, shaders);
313}
314
315GLint GetAttribLocation(
316    PP_Resource context_id, GLuint program, const char* name) {
317  return GetGLES(context_id)->GetAttribLocation(program, name);
318}
319
320void GetBooleanv(PP_Resource context_id, GLenum pname, GLboolean* params) {
321  GetGLES(context_id)->GetBooleanv(pname, params);
322}
323
324void GetBufferParameteriv(
325    PP_Resource context_id, GLenum target, GLenum pname, GLint* params) {
326  GetGLES(context_id)->GetBufferParameteriv(target, pname, params);
327}
328
329GLenum GetError(PP_Resource context_id) {
330  return GetGLES(context_id)->GetError();
331}
332
333void GetFloatv(PP_Resource context_id, GLenum pname, GLfloat* params) {
334  GetGLES(context_id)->GetFloatv(pname, params);
335}
336
337void GetFramebufferAttachmentParameteriv(
338    PP_Resource context_id, GLenum target, GLenum attachment, GLenum pname,
339    GLint* params) {
340  GetGLES(
341      context_id)->GetFramebufferAttachmentParameteriv(
342          target, attachment, pname, params);
343}
344
345void GetIntegerv(PP_Resource context_id, GLenum pname, GLint* params) {
346  GetGLES(context_id)->GetIntegerv(pname, params);
347}
348
349void GetProgramiv(
350    PP_Resource context_id, GLuint program, GLenum pname, GLint* params) {
351  GetGLES(context_id)->GetProgramiv(program, pname, params);
352}
353
354void GetProgramInfoLog(
355    PP_Resource context_id, GLuint program, GLsizei bufsize, GLsizei* length,
356    char* infolog) {
357  GetGLES(context_id)->GetProgramInfoLog(program, bufsize, length, infolog);
358}
359
360void GetRenderbufferParameteriv(
361    PP_Resource context_id, GLenum target, GLenum pname, GLint* params) {
362  GetGLES(context_id)->GetRenderbufferParameteriv(target, pname, params);
363}
364
365void GetShaderiv(
366    PP_Resource context_id, GLuint shader, GLenum pname, GLint* params) {
367  GetGLES(context_id)->GetShaderiv(shader, pname, params);
368}
369
370void GetShaderInfoLog(
371    PP_Resource context_id, GLuint shader, GLsizei bufsize, GLsizei* length,
372    char* infolog) {
373  GetGLES(context_id)->GetShaderInfoLog(shader, bufsize, length, infolog);
374}
375
376void GetShaderPrecisionFormat(
377    PP_Resource context_id, GLenum shadertype, GLenum precisiontype,
378    GLint* range, GLint* precision) {
379  GetGLES(
380      context_id)->GetShaderPrecisionFormat(
381          shadertype, precisiontype, range, precision);
382}
383
384void GetShaderSource(
385    PP_Resource context_id, GLuint shader, GLsizei bufsize, GLsizei* length,
386    char* source) {
387  GetGLES(context_id)->GetShaderSource(shader, bufsize, length, source);
388}
389
390const GLubyte* GetString(PP_Resource context_id, GLenum name) {
391  return GetGLES(context_id)->GetString(name);
392}
393
394void GetTexParameterfv(
395    PP_Resource context_id, GLenum target, GLenum pname, GLfloat* params) {
396  GetGLES(context_id)->GetTexParameterfv(target, pname, params);
397}
398
399void GetTexParameteriv(
400    PP_Resource context_id, GLenum target, GLenum pname, GLint* params) {
401  GetGLES(context_id)->GetTexParameteriv(target, pname, params);
402}
403
404void GetUniformfv(
405    PP_Resource context_id, GLuint program, GLint location, GLfloat* params) {
406  GetGLES(context_id)->GetUniformfv(program, location, params);
407}
408
409void GetUniformiv(
410    PP_Resource context_id, GLuint program, GLint location, GLint* params) {
411  GetGLES(context_id)->GetUniformiv(program, location, params);
412}
413
414GLint GetUniformLocation(
415    PP_Resource context_id, GLuint program, const char* name) {
416  return GetGLES(context_id)->GetUniformLocation(program, name);
417}
418
419void GetVertexAttribfv(
420    PP_Resource context_id, GLuint index, GLenum pname, GLfloat* params) {
421  GetGLES(context_id)->GetVertexAttribfv(index, pname, params);
422}
423
424void GetVertexAttribiv(
425    PP_Resource context_id, GLuint index, GLenum pname, GLint* params) {
426  GetGLES(context_id)->GetVertexAttribiv(index, pname, params);
427}
428
429void GetVertexAttribPointerv(
430    PP_Resource context_id, GLuint index, GLenum pname, void** pointer) {
431  GetGLES(context_id)->GetVertexAttribPointerv(index, pname, pointer);
432}
433
434void Hint(PP_Resource context_id, GLenum target, GLenum mode) {
435  GetGLES(context_id)->Hint(target, mode);
436}
437
438GLboolean IsBuffer(PP_Resource context_id, GLuint buffer) {
439  return GetGLES(context_id)->IsBuffer(buffer);
440}
441
442GLboolean IsEnabled(PP_Resource context_id, GLenum cap) {
443  return GetGLES(context_id)->IsEnabled(cap);
444}
445
446GLboolean IsFramebuffer(PP_Resource context_id, GLuint framebuffer) {
447  return GetGLES(context_id)->IsFramebuffer(framebuffer);
448}
449
450GLboolean IsProgram(PP_Resource context_id, GLuint program) {
451  return GetGLES(context_id)->IsProgram(program);
452}
453
454GLboolean IsRenderbuffer(PP_Resource context_id, GLuint renderbuffer) {
455  return GetGLES(context_id)->IsRenderbuffer(renderbuffer);
456}
457
458GLboolean IsShader(PP_Resource context_id, GLuint shader) {
459  return GetGLES(context_id)->IsShader(shader);
460}
461
462GLboolean IsTexture(PP_Resource context_id, GLuint texture) {
463  return GetGLES(context_id)->IsTexture(texture);
464}
465
466void LineWidth(PP_Resource context_id, GLfloat width) {
467  GetGLES(context_id)->LineWidth(width);
468}
469
470void LinkProgram(PP_Resource context_id, GLuint program) {
471  GetGLES(context_id)->LinkProgram(program);
472}
473
474void PixelStorei(PP_Resource context_id, GLenum pname, GLint param) {
475  GetGLES(context_id)->PixelStorei(pname, param);
476}
477
478void PolygonOffset(PP_Resource context_id, GLfloat factor, GLfloat units) {
479  GetGLES(context_id)->PolygonOffset(factor, units);
480}
481
482void ReadPixels(
483    PP_Resource context_id, GLint x, GLint y, GLsizei width, GLsizei height,
484    GLenum format, GLenum type, void* pixels) {
485  GetGLES(context_id)->ReadPixels(x, y, width, height, format, type, pixels);
486}
487
488void ReleaseShaderCompiler(PP_Resource context_id) {
489  GetGLES(context_id)->ReleaseShaderCompiler();
490}
491
492void RenderbufferStorage(
493    PP_Resource context_id, GLenum target, GLenum internalformat, GLsizei width,
494    GLsizei height) {
495  GetGLES(
496      context_id)->RenderbufferStorage(target, internalformat, width, height);
497}
498
499void SampleCoverage(PP_Resource context_id, GLclampf value, GLboolean invert) {
500  GetGLES(context_id)->SampleCoverage(value, invert);
501}
502
503void Scissor(
504    PP_Resource context_id, GLint x, GLint y, GLsizei width, GLsizei height) {
505  GetGLES(context_id)->Scissor(x, y, width, height);
506}
507
508void ShaderBinary(
509    PP_Resource context_id, GLsizei n, const GLuint* shaders,
510    GLenum binaryformat, const void* binary, GLsizei length) {
511  GetGLES(context_id)->ShaderBinary(n, shaders, binaryformat, binary, length);
512}
513
514void ShaderSource(
515    PP_Resource context_id, GLuint shader, GLsizei count, const char** str,
516    const GLint* length) {
517  GetGLES(context_id)->ShaderSource(shader, count, str, length);
518}
519
520void StencilFunc(PP_Resource context_id, GLenum func, GLint ref, GLuint mask) {
521  GetGLES(context_id)->StencilFunc(func, ref, mask);
522}
523
524void StencilFuncSeparate(
525    PP_Resource context_id, GLenum face, GLenum func, GLint ref, GLuint mask) {
526  GetGLES(context_id)->StencilFuncSeparate(face, func, ref, mask);
527}
528
529void StencilMask(PP_Resource context_id, GLuint mask) {
530  GetGLES(context_id)->StencilMask(mask);
531}
532
533void StencilMaskSeparate(PP_Resource context_id, GLenum face, GLuint mask) {
534  GetGLES(context_id)->StencilMaskSeparate(face, mask);
535}
536
537void StencilOp(
538    PP_Resource context_id, GLenum fail, GLenum zfail, GLenum zpass) {
539  GetGLES(context_id)->StencilOp(fail, zfail, zpass);
540}
541
542void StencilOpSeparate(
543    PP_Resource context_id, GLenum face, GLenum fail, GLenum zfail,
544    GLenum zpass) {
545  GetGLES(context_id)->StencilOpSeparate(face, fail, zfail, zpass);
546}
547
548void TexImage2D(
549    PP_Resource context_id, GLenum target, GLint level, GLint internalformat,
550    GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type,
551    const void* pixels) {
552  GetGLES(
553      context_id)->TexImage2D(
554          target, level, internalformat, width, height, border, format, type,
555          pixels);
556}
557
558void TexParameterf(
559    PP_Resource context_id, GLenum target, GLenum pname, GLfloat param) {
560  GetGLES(context_id)->TexParameterf(target, pname, param);
561}
562
563void TexParameterfv(
564    PP_Resource context_id, GLenum target, GLenum pname,
565    const GLfloat* params) {
566  GetGLES(context_id)->TexParameterfv(target, pname, params);
567}
568
569void TexParameteri(
570    PP_Resource context_id, GLenum target, GLenum pname, GLint param) {
571  GetGLES(context_id)->TexParameteri(target, pname, param);
572}
573
574void TexParameteriv(
575    PP_Resource context_id, GLenum target, GLenum pname, const GLint* params) {
576  GetGLES(context_id)->TexParameteriv(target, pname, params);
577}
578
579void TexSubImage2D(
580    PP_Resource context_id, GLenum target, GLint level, GLint xoffset,
581    GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type,
582    const void* pixels) {
583  GetGLES(
584      context_id)->TexSubImage2D(
585          target, level, xoffset, yoffset, width, height, format, type,
586          pixels);
587}
588
589void Uniform1f(PP_Resource context_id, GLint location, GLfloat x) {
590  GetGLES(context_id)->Uniform1f(location, x);
591}
592
593void Uniform1fv(
594    PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) {
595  GetGLES(context_id)->Uniform1fv(location, count, v);
596}
597
598void Uniform1i(PP_Resource context_id, GLint location, GLint x) {
599  GetGLES(context_id)->Uniform1i(location, x);
600}
601
602void Uniform1iv(
603    PP_Resource context_id, GLint location, GLsizei count, const GLint* v) {
604  GetGLES(context_id)->Uniform1iv(location, count, v);
605}
606
607void Uniform2f(PP_Resource context_id, GLint location, GLfloat x, GLfloat y) {
608  GetGLES(context_id)->Uniform2f(location, x, y);
609}
610
611void Uniform2fv(
612    PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) {
613  GetGLES(context_id)->Uniform2fv(location, count, v);
614}
615
616void Uniform2i(PP_Resource context_id, GLint location, GLint x, GLint y) {
617  GetGLES(context_id)->Uniform2i(location, x, y);
618}
619
620void Uniform2iv(
621    PP_Resource context_id, GLint location, GLsizei count, const GLint* v) {
622  GetGLES(context_id)->Uniform2iv(location, count, v);
623}
624
625void Uniform3f(
626    PP_Resource context_id, GLint location, GLfloat x, GLfloat y, GLfloat z) {
627  GetGLES(context_id)->Uniform3f(location, x, y, z);
628}
629
630void Uniform3fv(
631    PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) {
632  GetGLES(context_id)->Uniform3fv(location, count, v);
633}
634
635void Uniform3i(
636    PP_Resource context_id, GLint location, GLint x, GLint y, GLint z) {
637  GetGLES(context_id)->Uniform3i(location, x, y, z);
638}
639
640void Uniform3iv(
641    PP_Resource context_id, GLint location, GLsizei count, const GLint* v) {
642  GetGLES(context_id)->Uniform3iv(location, count, v);
643}
644
645void Uniform4f(
646    PP_Resource context_id, GLint location, GLfloat x, GLfloat y, GLfloat z,
647    GLfloat w) {
648  GetGLES(context_id)->Uniform4f(location, x, y, z, w);
649}
650
651void Uniform4fv(
652    PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) {
653  GetGLES(context_id)->Uniform4fv(location, count, v);
654}
655
656void Uniform4i(
657    PP_Resource context_id, GLint location, GLint x, GLint y, GLint z,
658    GLint w) {
659  GetGLES(context_id)->Uniform4i(location, x, y, z, w);
660}
661
662void Uniform4iv(
663    PP_Resource context_id, GLint location, GLsizei count, const GLint* v) {
664  GetGLES(context_id)->Uniform4iv(location, count, v);
665}
666
667void UniformMatrix2fv(
668    PP_Resource context_id, GLint location, GLsizei count, GLboolean transpose,
669    const GLfloat* value) {
670  GetGLES(context_id)->UniformMatrix2fv(location, count, transpose, value);
671}
672
673void UniformMatrix3fv(
674    PP_Resource context_id, GLint location, GLsizei count, GLboolean transpose,
675    const GLfloat* value) {
676  GetGLES(context_id)->UniformMatrix3fv(location, count, transpose, value);
677}
678
679void UniformMatrix4fv(
680    PP_Resource context_id, GLint location, GLsizei count, GLboolean transpose,
681    const GLfloat* value) {
682  GetGLES(context_id)->UniformMatrix4fv(location, count, transpose, value);
683}
684
685void UseProgram(PP_Resource context_id, GLuint program) {
686  GetGLES(context_id)->UseProgram(program);
687}
688
689void ValidateProgram(PP_Resource context_id, GLuint program) {
690  GetGLES(context_id)->ValidateProgram(program);
691}
692
693void VertexAttrib1f(PP_Resource context_id, GLuint indx, GLfloat x) {
694  GetGLES(context_id)->VertexAttrib1f(indx, x);
695}
696
697void VertexAttrib1fv(
698    PP_Resource context_id, GLuint indx, const GLfloat* values) {
699  GetGLES(context_id)->VertexAttrib1fv(indx, values);
700}
701
702void VertexAttrib2f(
703    PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y) {
704  GetGLES(context_id)->VertexAttrib2f(indx, x, y);
705}
706
707void VertexAttrib2fv(
708    PP_Resource context_id, GLuint indx, const GLfloat* values) {
709  GetGLES(context_id)->VertexAttrib2fv(indx, values);
710}
711
712void VertexAttrib3f(
713    PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y, GLfloat z) {
714  GetGLES(context_id)->VertexAttrib3f(indx, x, y, z);
715}
716
717void VertexAttrib3fv(
718    PP_Resource context_id, GLuint indx, const GLfloat* values) {
719  GetGLES(context_id)->VertexAttrib3fv(indx, values);
720}
721
722void VertexAttrib4f(
723    PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y, GLfloat z,
724    GLfloat w) {
725  GetGLES(context_id)->VertexAttrib4f(indx, x, y, z, w);
726}
727
728void VertexAttrib4fv(
729    PP_Resource context_id, GLuint indx, const GLfloat* values) {
730  GetGLES(context_id)->VertexAttrib4fv(indx, values);
731}
732
733void VertexAttribPointer(
734    PP_Resource context_id, GLuint indx, GLint size, GLenum type,
735    GLboolean normalized, GLsizei stride, const void* ptr) {
736  GetGLES(
737      context_id)->VertexAttribPointer(
738          indx, size, type, normalized, stride, ptr);
739}
740
741void Viewport(
742    PP_Resource context_id, GLint x, GLint y, GLsizei width, GLsizei height) {
743  GetGLES(context_id)->Viewport(x, y, width, height);
744}
745
746void BlitFramebufferEXT(
747    PP_Resource context_id, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
748    GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask,
749    GLenum filter) {
750  GetGLES(
751      context_id)->BlitFramebufferEXT(
752          srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask,
753          filter);
754}
755
756void RenderbufferStorageMultisampleEXT(
757    PP_Resource context_id, GLenum target, GLsizei samples,
758    GLenum internalformat, GLsizei width, GLsizei height) {
759  GetGLES(
760      context_id)->RenderbufferStorageMultisampleEXT(
761          target, samples, internalformat, width, height);
762}
763
764void GenQueriesEXT(PP_Resource context_id, GLsizei n, GLuint* queries) {
765  GetGLES(context_id)->GenQueriesEXT(n, queries);
766}
767
768void DeleteQueriesEXT(
769    PP_Resource context_id, GLsizei n, const GLuint* queries) {
770  GetGLES(context_id)->DeleteQueriesEXT(n, queries);
771}
772
773GLboolean IsQueryEXT(PP_Resource context_id, GLuint id) {
774  return GetGLES(context_id)->IsQueryEXT(id);
775}
776
777void BeginQueryEXT(PP_Resource context_id, GLenum target, GLuint id) {
778  GetGLES(context_id)->BeginQueryEXT(target, id);
779}
780
781void EndQueryEXT(PP_Resource context_id, GLenum target) {
782  GetGLES(context_id)->EndQueryEXT(target);
783}
784
785void GetQueryivEXT(
786    PP_Resource context_id, GLenum target, GLenum pname, GLint* params) {
787  GetGLES(context_id)->GetQueryivEXT(target, pname, params);
788}
789
790void GetQueryObjectuivEXT(
791    PP_Resource context_id, GLuint id, GLenum pname, GLuint* params) {
792  GetGLES(context_id)->GetQueryObjectuivEXT(id, pname, params);
793}
794
795GLboolean EnableFeatureCHROMIUM(PP_Resource context_id, const char* feature) {
796  return GetGLES(context_id)->EnableFeatureCHROMIUM(feature);
797}
798
799void* MapBufferSubDataCHROMIUM(
800    PP_Resource context_id, GLuint target, GLintptr offset, GLsizeiptr size,
801    GLenum access) {
802  return GetGLES(
803      context_id)->MapBufferSubDataCHROMIUM(target, offset, size, access);
804}
805
806void UnmapBufferSubDataCHROMIUM(PP_Resource context_id, const void* mem) {
807  GetGLES(context_id)->UnmapBufferSubDataCHROMIUM(mem);
808}
809
810void* MapTexSubImage2DCHROMIUM(
811    PP_Resource context_id, GLenum target, GLint level, GLint xoffset,
812    GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type,
813    GLenum access) {
814  return GetGLES(
815      context_id)->MapTexSubImage2DCHROMIUM(
816          target, level, xoffset, yoffset, width, height, format, type,
817          access);
818}
819
820void UnmapTexSubImage2DCHROMIUM(PP_Resource context_id, const void* mem) {
821  GetGLES(context_id)->UnmapTexSubImage2DCHROMIUM(mem);
822}
823
824void DrawArraysInstancedANGLE(
825    PP_Resource context_id, GLenum mode, GLint first, GLsizei count,
826    GLsizei primcount) {
827  GetGLES(context_id)->DrawArraysInstancedANGLE(mode, first, count, primcount);
828}
829
830void DrawElementsInstancedANGLE(
831    PP_Resource context_id, GLenum mode, GLsizei count, GLenum type,
832    const void* indices, GLsizei primcount) {
833  GetGLES(
834      context_id)->DrawElementsInstancedANGLE(
835          mode, count, type, indices, primcount);
836}
837
838void VertexAttribDivisorANGLE(
839    PP_Resource context_id, GLuint index, GLuint divisor) {
840  GetGLES(context_id)->VertexAttribDivisorANGLE(index, divisor);
841}
842
843}  // namespace
844const PPB_OpenGLES2* PPB_OpenGLES2_Shared::GetInterface() {
845  static const struct PPB_OpenGLES2 ppb_opengles2 = {
846    &ActiveTexture,
847    &AttachShader,
848    &BindAttribLocation,
849    &BindBuffer,
850    &BindFramebuffer,
851    &BindRenderbuffer,
852    &BindTexture,
853    &BlendColor,
854    &BlendEquation,
855    &BlendEquationSeparate,
856    &BlendFunc,
857    &BlendFuncSeparate,
858    &BufferData,
859    &BufferSubData,
860    &CheckFramebufferStatus,
861    &Clear,
862    &ClearColor,
863    &ClearDepthf,
864    &ClearStencil,
865    &ColorMask,
866    &CompileShader,
867    &CompressedTexImage2D,
868    &CompressedTexSubImage2D,
869    &CopyTexImage2D,
870    &CopyTexSubImage2D,
871    &CreateProgram,
872    &CreateShader,
873    &CullFace,
874    &DeleteBuffers,
875    &DeleteFramebuffers,
876    &DeleteProgram,
877    &DeleteRenderbuffers,
878    &DeleteShader,
879    &DeleteTextures,
880    &DepthFunc,
881    &DepthMask,
882    &DepthRangef,
883    &DetachShader,
884    &Disable,
885    &DisableVertexAttribArray,
886    &DrawArrays,
887    &DrawElements,
888    &Enable,
889    &EnableVertexAttribArray,
890    &Finish,
891    &Flush,
892    &FramebufferRenderbuffer,
893    &FramebufferTexture2D,
894    &FrontFace,
895    &GenBuffers,
896    &GenerateMipmap,
897    &GenFramebuffers,
898    &GenRenderbuffers,
899    &GenTextures,
900    &GetActiveAttrib,
901    &GetActiveUniform,
902    &GetAttachedShaders,
903    &GetAttribLocation,
904    &GetBooleanv,
905    &GetBufferParameteriv,
906    &GetError,
907    &GetFloatv,
908    &GetFramebufferAttachmentParameteriv,
909    &GetIntegerv,
910    &GetProgramiv,
911    &GetProgramInfoLog,
912    &GetRenderbufferParameteriv,
913    &GetShaderiv,
914    &GetShaderInfoLog,
915    &GetShaderPrecisionFormat,
916    &GetShaderSource,
917    &GetString,
918    &GetTexParameterfv,
919    &GetTexParameteriv,
920    &GetUniformfv,
921    &GetUniformiv,
922    &GetUniformLocation,
923    &GetVertexAttribfv,
924    &GetVertexAttribiv,
925    &GetVertexAttribPointerv,
926    &Hint,
927    &IsBuffer,
928    &IsEnabled,
929    &IsFramebuffer,
930    &IsProgram,
931    &IsRenderbuffer,
932    &IsShader,
933    &IsTexture,
934    &LineWidth,
935    &LinkProgram,
936    &PixelStorei,
937    &PolygonOffset,
938    &ReadPixels,
939    &ReleaseShaderCompiler,
940    &RenderbufferStorage,
941    &SampleCoverage,
942    &Scissor,
943    &ShaderBinary,
944    &ShaderSource,
945    &StencilFunc,
946    &StencilFuncSeparate,
947    &StencilMask,
948    &StencilMaskSeparate,
949    &StencilOp,
950    &StencilOpSeparate,
951    &TexImage2D,
952    &TexParameterf,
953    &TexParameterfv,
954    &TexParameteri,
955    &TexParameteriv,
956    &TexSubImage2D,
957    &Uniform1f,
958    &Uniform1fv,
959    &Uniform1i,
960    &Uniform1iv,
961    &Uniform2f,
962    &Uniform2fv,
963    &Uniform2i,
964    &Uniform2iv,
965    &Uniform3f,
966    &Uniform3fv,
967    &Uniform3i,
968    &Uniform3iv,
969    &Uniform4f,
970    &Uniform4fv,
971    &Uniform4i,
972    &Uniform4iv,
973    &UniformMatrix2fv,
974    &UniformMatrix3fv,
975    &UniformMatrix4fv,
976    &UseProgram,
977    &ValidateProgram,
978    &VertexAttrib1f,
979    &VertexAttrib1fv,
980    &VertexAttrib2f,
981    &VertexAttrib2fv,
982    &VertexAttrib3f,
983    &VertexAttrib3fv,
984    &VertexAttrib4f,
985    &VertexAttrib4fv,
986    &VertexAttribPointer,
987    &Viewport
988  };
989  return &ppb_opengles2;
990}
991const PPB_OpenGLES2InstancedArrays* PPB_OpenGLES2_Shared::GetInstancedArraysInterface() {  // NOLINT
992  static const struct PPB_OpenGLES2InstancedArrays ppb_opengles2 = {
993    &DrawArraysInstancedANGLE,
994    &DrawElementsInstancedANGLE,
995    &VertexAttribDivisorANGLE
996  };
997  return &ppb_opengles2;
998}
999const PPB_OpenGLES2FramebufferBlit* PPB_OpenGLES2_Shared::GetFramebufferBlitInterface() {  // NOLINT
1000  static const struct PPB_OpenGLES2FramebufferBlit ppb_opengles2 = {
1001    &BlitFramebufferEXT
1002  };
1003  return &ppb_opengles2;
1004}
1005const PPB_OpenGLES2FramebufferMultisample* PPB_OpenGLES2_Shared::GetFramebufferMultisampleInterface() {  // NOLINT
1006  static const struct PPB_OpenGLES2FramebufferMultisample ppb_opengles2 = {
1007    &RenderbufferStorageMultisampleEXT
1008  };
1009  return &ppb_opengles2;
1010}
1011const PPB_OpenGLES2ChromiumEnableFeature* PPB_OpenGLES2_Shared::GetChromiumEnableFeatureInterface() {  // NOLINT
1012  static const struct PPB_OpenGLES2ChromiumEnableFeature ppb_opengles2 = {
1013    &EnableFeatureCHROMIUM
1014  };
1015  return &ppb_opengles2;
1016}
1017const PPB_OpenGLES2ChromiumMapSub* PPB_OpenGLES2_Shared::GetChromiumMapSubInterface() {  // NOLINT
1018  static const struct PPB_OpenGLES2ChromiumMapSub ppb_opengles2 = {
1019    &MapBufferSubDataCHROMIUM,
1020    &UnmapBufferSubDataCHROMIUM,
1021    &MapTexSubImage2DCHROMIUM,
1022    &UnmapTexSubImage2DCHROMIUM
1023  };
1024  return &ppb_opengles2;
1025}
1026const PPB_OpenGLES2Query* PPB_OpenGLES2_Shared::GetQueryInterface() {
1027  static const struct PPB_OpenGLES2Query ppb_opengles2 = {
1028    &GenQueriesEXT,
1029    &DeleteQueriesEXT,
1030    &IsQueryEXT,
1031    &BeginQueryEXT,
1032    &EndQueryEXT,
1033    &GetQueryivEXT,
1034    &GetQueryObjectuivEXT
1035  };
1036  return &ppb_opengles2;
1037}
1038}  // namespace ppapi
1039