1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file is auto-generated from
6 // gpu/command_buffer/build_gles2_cmd_buffer.py
7 // It's formatted by clang-format using chromium coding style:
8 // clang-format -i -style=chromium filename
11 #include "ppapi/shared_impl/ppb_opengles2_shared.h"
13 #include "base/logging.h"
14 #include "gpu/command_buffer/client/gles2_implementation.h"
15 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h"
16 #include "ppapi/thunk/enter.h"
22 typedef thunk::EnterResource
<thunk::PPB_Graphics3D_API
> Enter3D
;
24 gpu::gles2::GLES2Implementation
* ToGles2Impl(Enter3D
* enter
) {
26 DCHECK(enter
->succeeded());
27 return static_cast<PPB_Graphics3D_Shared
*>(enter
->object())->gles2_impl();
30 void ActiveTexture(PP_Resource context_id
, GLenum texture
) {
31 Enter3D
enter(context_id
, true);
32 if (enter
.succeeded()) {
33 ToGles2Impl(&enter
)->ActiveTexture(texture
);
37 void AttachShader(PP_Resource context_id
, GLuint program
, GLuint shader
) {
38 Enter3D
enter(context_id
, true);
39 if (enter
.succeeded()) {
40 ToGles2Impl(&enter
)->AttachShader(program
, shader
);
44 void BindAttribLocation(PP_Resource context_id
,
48 Enter3D
enter(context_id
, true);
49 if (enter
.succeeded()) {
50 ToGles2Impl(&enter
)->BindAttribLocation(program
, index
, name
);
54 void BindBuffer(PP_Resource context_id
, GLenum target
, GLuint buffer
) {
55 Enter3D
enter(context_id
, true);
56 if (enter
.succeeded()) {
57 ToGles2Impl(&enter
)->BindBuffer(target
, buffer
);
61 void BindFramebuffer(PP_Resource context_id
,
64 Enter3D
enter(context_id
, true);
65 if (enter
.succeeded()) {
66 ToGles2Impl(&enter
)->BindFramebuffer(target
, framebuffer
);
70 void BindRenderbuffer(PP_Resource context_id
,
72 GLuint renderbuffer
) {
73 Enter3D
enter(context_id
, true);
74 if (enter
.succeeded()) {
75 ToGles2Impl(&enter
)->BindRenderbuffer(target
, renderbuffer
);
79 void BindTexture(PP_Resource context_id
, GLenum target
, GLuint texture
) {
80 Enter3D
enter(context_id
, true);
81 if (enter
.succeeded()) {
82 ToGles2Impl(&enter
)->BindTexture(target
, texture
);
86 void BlendColor(PP_Resource context_id
,
91 Enter3D
enter(context_id
, true);
92 if (enter
.succeeded()) {
93 ToGles2Impl(&enter
)->BlendColor(red
, green
, blue
, alpha
);
97 void BlendEquation(PP_Resource context_id
, GLenum mode
) {
98 Enter3D
enter(context_id
, true);
99 if (enter
.succeeded()) {
100 ToGles2Impl(&enter
)->BlendEquation(mode
);
104 void BlendEquationSeparate(PP_Resource context_id
,
107 Enter3D
enter(context_id
, true);
108 if (enter
.succeeded()) {
109 ToGles2Impl(&enter
)->BlendEquationSeparate(modeRGB
, modeAlpha
);
113 void BlendFunc(PP_Resource context_id
, GLenum sfactor
, GLenum dfactor
) {
114 Enter3D
enter(context_id
, true);
115 if (enter
.succeeded()) {
116 ToGles2Impl(&enter
)->BlendFunc(sfactor
, dfactor
);
120 void BlendFuncSeparate(PP_Resource context_id
,
125 Enter3D
enter(context_id
, true);
126 if (enter
.succeeded()) {
127 ToGles2Impl(&enter
)->BlendFuncSeparate(srcRGB
, dstRGB
, srcAlpha
, dstAlpha
);
131 void BufferData(PP_Resource context_id
,
136 Enter3D
enter(context_id
, true);
137 if (enter
.succeeded()) {
138 ToGles2Impl(&enter
)->BufferData(target
, size
, data
, usage
);
142 void BufferSubData(PP_Resource context_id
,
147 Enter3D
enter(context_id
, true);
148 if (enter
.succeeded()) {
149 ToGles2Impl(&enter
)->BufferSubData(target
, offset
, size
, data
);
153 GLenum
CheckFramebufferStatus(PP_Resource context_id
, GLenum target
) {
154 Enter3D
enter(context_id
, true);
155 if (enter
.succeeded()) {
156 return ToGles2Impl(&enter
)->CheckFramebufferStatus(target
);
162 void Clear(PP_Resource context_id
, GLbitfield mask
) {
163 Enter3D
enter(context_id
, true);
164 if (enter
.succeeded()) {
165 ToGles2Impl(&enter
)->Clear(mask
);
169 void ClearColor(PP_Resource context_id
,
174 Enter3D
enter(context_id
, true);
175 if (enter
.succeeded()) {
176 ToGles2Impl(&enter
)->ClearColor(red
, green
, blue
, alpha
);
180 void ClearDepthf(PP_Resource context_id
, GLclampf depth
) {
181 Enter3D
enter(context_id
, true);
182 if (enter
.succeeded()) {
183 ToGles2Impl(&enter
)->ClearDepthf(depth
);
187 void ClearStencil(PP_Resource context_id
, GLint s
) {
188 Enter3D
enter(context_id
, true);
189 if (enter
.succeeded()) {
190 ToGles2Impl(&enter
)->ClearStencil(s
);
194 void ColorMask(PP_Resource context_id
,
199 Enter3D
enter(context_id
, true);
200 if (enter
.succeeded()) {
201 ToGles2Impl(&enter
)->ColorMask(red
, green
, blue
, alpha
);
205 void CompileShader(PP_Resource context_id
, GLuint shader
) {
206 Enter3D
enter(context_id
, true);
207 if (enter
.succeeded()) {
208 ToGles2Impl(&enter
)->CompileShader(shader
);
212 void CompressedTexImage2D(PP_Resource context_id
,
215 GLenum internalformat
,
221 Enter3D
enter(context_id
, true);
222 if (enter
.succeeded()) {
223 ToGles2Impl(&enter
)->CompressedTexImage2D(
224 target
, level
, internalformat
, width
, height
, border
, imageSize
, data
);
228 void CompressedTexSubImage2D(PP_Resource context_id
,
238 Enter3D
enter(context_id
, true);
239 if (enter
.succeeded()) {
240 ToGles2Impl(&enter
)->CompressedTexSubImage2D(target
,
252 void CopyTexImage2D(PP_Resource context_id
,
255 GLenum internalformat
,
261 Enter3D
enter(context_id
, true);
262 if (enter
.succeeded()) {
263 ToGles2Impl(&enter
)->CopyTexImage2D(
264 target
, level
, internalformat
, x
, y
, width
, height
, border
);
268 void CopyTexSubImage2D(PP_Resource context_id
,
277 Enter3D
enter(context_id
, true);
278 if (enter
.succeeded()) {
279 ToGles2Impl(&enter
)->CopyTexSubImage2D(
280 target
, level
, xoffset
, yoffset
, x
, y
, width
, height
);
284 GLuint
CreateProgram(PP_Resource context_id
) {
285 Enter3D
enter(context_id
, true);
286 if (enter
.succeeded()) {
287 return ToGles2Impl(&enter
)->CreateProgram();
293 GLuint
CreateShader(PP_Resource context_id
, GLenum type
) {
294 Enter3D
enter(context_id
, true);
295 if (enter
.succeeded()) {
296 return ToGles2Impl(&enter
)->CreateShader(type
);
302 void CullFace(PP_Resource context_id
, GLenum mode
) {
303 Enter3D
enter(context_id
, true);
304 if (enter
.succeeded()) {
305 ToGles2Impl(&enter
)->CullFace(mode
);
309 void DeleteBuffers(PP_Resource context_id
, GLsizei n
, const GLuint
* buffers
) {
310 Enter3D
enter(context_id
, true);
311 if (enter
.succeeded()) {
312 ToGles2Impl(&enter
)->DeleteBuffers(n
, buffers
);
316 void DeleteFramebuffers(PP_Resource context_id
,
318 const GLuint
* framebuffers
) {
319 Enter3D
enter(context_id
, true);
320 if (enter
.succeeded()) {
321 ToGles2Impl(&enter
)->DeleteFramebuffers(n
, framebuffers
);
325 void DeleteProgram(PP_Resource context_id
, GLuint program
) {
326 Enter3D
enter(context_id
, true);
327 if (enter
.succeeded()) {
328 ToGles2Impl(&enter
)->DeleteProgram(program
);
332 void DeleteRenderbuffers(PP_Resource context_id
,
334 const GLuint
* renderbuffers
) {
335 Enter3D
enter(context_id
, true);
336 if (enter
.succeeded()) {
337 ToGles2Impl(&enter
)->DeleteRenderbuffers(n
, renderbuffers
);
341 void DeleteShader(PP_Resource context_id
, GLuint shader
) {
342 Enter3D
enter(context_id
, true);
343 if (enter
.succeeded()) {
344 ToGles2Impl(&enter
)->DeleteShader(shader
);
348 void DeleteTextures(PP_Resource context_id
, GLsizei n
, const GLuint
* textures
) {
349 Enter3D
enter(context_id
, true);
350 if (enter
.succeeded()) {
351 ToGles2Impl(&enter
)->DeleteTextures(n
, textures
);
355 void DepthFunc(PP_Resource context_id
, GLenum func
) {
356 Enter3D
enter(context_id
, true);
357 if (enter
.succeeded()) {
358 ToGles2Impl(&enter
)->DepthFunc(func
);
362 void DepthMask(PP_Resource context_id
, GLboolean flag
) {
363 Enter3D
enter(context_id
, true);
364 if (enter
.succeeded()) {
365 ToGles2Impl(&enter
)->DepthMask(flag
);
369 void DepthRangef(PP_Resource context_id
, GLclampf zNear
, GLclampf zFar
) {
370 Enter3D
enter(context_id
, true);
371 if (enter
.succeeded()) {
372 ToGles2Impl(&enter
)->DepthRangef(zNear
, zFar
);
376 void DetachShader(PP_Resource context_id
, GLuint program
, GLuint shader
) {
377 Enter3D
enter(context_id
, true);
378 if (enter
.succeeded()) {
379 ToGles2Impl(&enter
)->DetachShader(program
, shader
);
383 void Disable(PP_Resource context_id
, GLenum cap
) {
384 Enter3D
enter(context_id
, true);
385 if (enter
.succeeded()) {
386 ToGles2Impl(&enter
)->Disable(cap
);
390 void DisableVertexAttribArray(PP_Resource context_id
, GLuint index
) {
391 Enter3D
enter(context_id
, true);
392 if (enter
.succeeded()) {
393 ToGles2Impl(&enter
)->DisableVertexAttribArray(index
);
397 void DrawArrays(PP_Resource context_id
,
401 Enter3D
enter(context_id
, true);
402 if (enter
.succeeded()) {
403 ToGles2Impl(&enter
)->DrawArrays(mode
, first
, count
);
407 void DrawElements(PP_Resource context_id
,
411 const void* indices
) {
412 Enter3D
enter(context_id
, true);
413 if (enter
.succeeded()) {
414 ToGles2Impl(&enter
)->DrawElements(mode
, count
, type
, indices
);
418 void Enable(PP_Resource context_id
, GLenum cap
) {
419 Enter3D
enter(context_id
, true);
420 if (enter
.succeeded()) {
421 ToGles2Impl(&enter
)->Enable(cap
);
425 void EnableVertexAttribArray(PP_Resource context_id
, GLuint index
) {
426 Enter3D
enter(context_id
, true);
427 if (enter
.succeeded()) {
428 ToGles2Impl(&enter
)->EnableVertexAttribArray(index
);
432 void Finish(PP_Resource context_id
) {
433 Enter3D
enter(context_id
, true);
434 if (enter
.succeeded()) {
435 ToGles2Impl(&enter
)->Finish();
439 void Flush(PP_Resource context_id
) {
440 Enter3D
enter(context_id
, true);
441 if (enter
.succeeded()) {
442 ToGles2Impl(&enter
)->Flush();
446 void FramebufferRenderbuffer(PP_Resource context_id
,
449 GLenum renderbuffertarget
,
450 GLuint renderbuffer
) {
451 Enter3D
enter(context_id
, true);
452 if (enter
.succeeded()) {
453 ToGles2Impl(&enter
)->FramebufferRenderbuffer(
454 target
, attachment
, renderbuffertarget
, renderbuffer
);
458 void FramebufferTexture2D(PP_Resource context_id
,
464 Enter3D
enter(context_id
, true);
465 if (enter
.succeeded()) {
467 ->FramebufferTexture2D(target
, attachment
, textarget
, texture
, level
);
471 void FrontFace(PP_Resource context_id
, GLenum mode
) {
472 Enter3D
enter(context_id
, true);
473 if (enter
.succeeded()) {
474 ToGles2Impl(&enter
)->FrontFace(mode
);
478 void GenBuffers(PP_Resource context_id
, GLsizei n
, GLuint
* buffers
) {
479 Enter3D
enter(context_id
, true);
480 if (enter
.succeeded()) {
481 ToGles2Impl(&enter
)->GenBuffers(n
, buffers
);
485 void GenerateMipmap(PP_Resource context_id
, GLenum target
) {
486 Enter3D
enter(context_id
, true);
487 if (enter
.succeeded()) {
488 ToGles2Impl(&enter
)->GenerateMipmap(target
);
492 void GenFramebuffers(PP_Resource context_id
, GLsizei n
, GLuint
* framebuffers
) {
493 Enter3D
enter(context_id
, true);
494 if (enter
.succeeded()) {
495 ToGles2Impl(&enter
)->GenFramebuffers(n
, framebuffers
);
499 void GenRenderbuffers(PP_Resource context_id
,
501 GLuint
* renderbuffers
) {
502 Enter3D
enter(context_id
, true);
503 if (enter
.succeeded()) {
504 ToGles2Impl(&enter
)->GenRenderbuffers(n
, renderbuffers
);
508 void GenTextures(PP_Resource context_id
, GLsizei n
, GLuint
* textures
) {
509 Enter3D
enter(context_id
, true);
510 if (enter
.succeeded()) {
511 ToGles2Impl(&enter
)->GenTextures(n
, textures
);
515 void GetActiveAttrib(PP_Resource context_id
,
523 Enter3D
enter(context_id
, true);
524 if (enter
.succeeded()) {
526 ->GetActiveAttrib(program
, index
, bufsize
, length
, size
, type
, name
);
530 void GetActiveUniform(PP_Resource context_id
,
538 Enter3D
enter(context_id
, true);
539 if (enter
.succeeded()) {
541 ->GetActiveUniform(program
, index
, bufsize
, length
, size
, type
, name
);
545 void GetAttachedShaders(PP_Resource context_id
,
550 Enter3D
enter(context_id
, true);
551 if (enter
.succeeded()) {
552 ToGles2Impl(&enter
)->GetAttachedShaders(program
, maxcount
, count
, shaders
);
556 GLint
GetAttribLocation(PP_Resource context_id
,
559 Enter3D
enter(context_id
, true);
560 if (enter
.succeeded()) {
561 return ToGles2Impl(&enter
)->GetAttribLocation(program
, name
);
567 void GetBooleanv(PP_Resource context_id
, GLenum pname
, GLboolean
* params
) {
568 Enter3D
enter(context_id
, true);
569 if (enter
.succeeded()) {
570 ToGles2Impl(&enter
)->GetBooleanv(pname
, params
);
574 void GetBufferParameteriv(PP_Resource context_id
,
578 Enter3D
enter(context_id
, true);
579 if (enter
.succeeded()) {
580 ToGles2Impl(&enter
)->GetBufferParameteriv(target
, pname
, params
);
584 GLenum
GetError(PP_Resource context_id
) {
585 Enter3D
enter(context_id
, true);
586 if (enter
.succeeded()) {
587 return ToGles2Impl(&enter
)->GetError();
593 void GetFloatv(PP_Resource context_id
, GLenum pname
, GLfloat
* params
) {
594 Enter3D
enter(context_id
, true);
595 if (enter
.succeeded()) {
596 ToGles2Impl(&enter
)->GetFloatv(pname
, params
);
600 void GetFramebufferAttachmentParameteriv(PP_Resource context_id
,
605 Enter3D
enter(context_id
, true);
606 if (enter
.succeeded()) {
607 ToGles2Impl(&enter
)->GetFramebufferAttachmentParameteriv(
608 target
, attachment
, pname
, params
);
612 void GetIntegerv(PP_Resource context_id
, GLenum pname
, GLint
* params
) {
613 Enter3D
enter(context_id
, true);
614 if (enter
.succeeded()) {
615 ToGles2Impl(&enter
)->GetIntegerv(pname
, params
);
619 void GetProgramiv(PP_Resource context_id
,
623 Enter3D
enter(context_id
, true);
624 if (enter
.succeeded()) {
625 ToGles2Impl(&enter
)->GetProgramiv(program
, pname
, params
);
629 void GetProgramInfoLog(PP_Resource context_id
,
634 Enter3D
enter(context_id
, true);
635 if (enter
.succeeded()) {
636 ToGles2Impl(&enter
)->GetProgramInfoLog(program
, bufsize
, length
, infolog
);
640 void GetRenderbufferParameteriv(PP_Resource context_id
,
644 Enter3D
enter(context_id
, true);
645 if (enter
.succeeded()) {
646 ToGles2Impl(&enter
)->GetRenderbufferParameteriv(target
, pname
, params
);
650 void GetShaderiv(PP_Resource context_id
,
654 Enter3D
enter(context_id
, true);
655 if (enter
.succeeded()) {
656 ToGles2Impl(&enter
)->GetShaderiv(shader
, pname
, params
);
660 void GetShaderInfoLog(PP_Resource context_id
,
665 Enter3D
enter(context_id
, true);
666 if (enter
.succeeded()) {
667 ToGles2Impl(&enter
)->GetShaderInfoLog(shader
, bufsize
, length
, infolog
);
671 void GetShaderPrecisionFormat(PP_Resource context_id
,
673 GLenum precisiontype
,
676 Enter3D
enter(context_id
, true);
677 if (enter
.succeeded()) {
679 ->GetShaderPrecisionFormat(shadertype
, precisiontype
, range
, precision
);
683 void GetShaderSource(PP_Resource context_id
,
688 Enter3D
enter(context_id
, true);
689 if (enter
.succeeded()) {
690 ToGles2Impl(&enter
)->GetShaderSource(shader
, bufsize
, length
, source
);
694 const GLubyte
* GetString(PP_Resource context_id
, GLenum name
) {
695 Enter3D
enter(context_id
, true);
696 if (enter
.succeeded()) {
697 return ToGles2Impl(&enter
)->GetString(name
);
703 void GetTexParameterfv(PP_Resource context_id
,
707 Enter3D
enter(context_id
, true);
708 if (enter
.succeeded()) {
709 ToGles2Impl(&enter
)->GetTexParameterfv(target
, pname
, params
);
713 void GetTexParameteriv(PP_Resource context_id
,
717 Enter3D
enter(context_id
, true);
718 if (enter
.succeeded()) {
719 ToGles2Impl(&enter
)->GetTexParameteriv(target
, pname
, params
);
723 void GetUniformfv(PP_Resource context_id
,
727 Enter3D
enter(context_id
, true);
728 if (enter
.succeeded()) {
729 ToGles2Impl(&enter
)->GetUniformfv(program
, location
, params
);
733 void GetUniformiv(PP_Resource context_id
,
737 Enter3D
enter(context_id
, true);
738 if (enter
.succeeded()) {
739 ToGles2Impl(&enter
)->GetUniformiv(program
, location
, params
);
743 GLint
GetUniformLocation(PP_Resource context_id
,
746 Enter3D
enter(context_id
, true);
747 if (enter
.succeeded()) {
748 return ToGles2Impl(&enter
)->GetUniformLocation(program
, name
);
754 void GetVertexAttribfv(PP_Resource context_id
,
758 Enter3D
enter(context_id
, true);
759 if (enter
.succeeded()) {
760 ToGles2Impl(&enter
)->GetVertexAttribfv(index
, pname
, params
);
764 void GetVertexAttribiv(PP_Resource context_id
,
768 Enter3D
enter(context_id
, true);
769 if (enter
.succeeded()) {
770 ToGles2Impl(&enter
)->GetVertexAttribiv(index
, pname
, params
);
774 void GetVertexAttribPointerv(PP_Resource context_id
,
778 Enter3D
enter(context_id
, true);
779 if (enter
.succeeded()) {
780 ToGles2Impl(&enter
)->GetVertexAttribPointerv(index
, pname
, pointer
);
784 void Hint(PP_Resource context_id
, GLenum target
, GLenum mode
) {
785 Enter3D
enter(context_id
, true);
786 if (enter
.succeeded()) {
787 ToGles2Impl(&enter
)->Hint(target
, mode
);
791 GLboolean
IsBuffer(PP_Resource context_id
, GLuint buffer
) {
792 Enter3D
enter(context_id
, true);
793 if (enter
.succeeded()) {
794 return ToGles2Impl(&enter
)->IsBuffer(buffer
);
800 GLboolean
IsEnabled(PP_Resource context_id
, GLenum cap
) {
801 Enter3D
enter(context_id
, true);
802 if (enter
.succeeded()) {
803 return ToGles2Impl(&enter
)->IsEnabled(cap
);
809 GLboolean
IsFramebuffer(PP_Resource context_id
, GLuint framebuffer
) {
810 Enter3D
enter(context_id
, true);
811 if (enter
.succeeded()) {
812 return ToGles2Impl(&enter
)->IsFramebuffer(framebuffer
);
818 GLboolean
IsProgram(PP_Resource context_id
, GLuint program
) {
819 Enter3D
enter(context_id
, true);
820 if (enter
.succeeded()) {
821 return ToGles2Impl(&enter
)->IsProgram(program
);
827 GLboolean
IsRenderbuffer(PP_Resource context_id
, GLuint renderbuffer
) {
828 Enter3D
enter(context_id
, true);
829 if (enter
.succeeded()) {
830 return ToGles2Impl(&enter
)->IsRenderbuffer(renderbuffer
);
836 GLboolean
IsShader(PP_Resource context_id
, GLuint shader
) {
837 Enter3D
enter(context_id
, true);
838 if (enter
.succeeded()) {
839 return ToGles2Impl(&enter
)->IsShader(shader
);
845 GLboolean
IsTexture(PP_Resource context_id
, GLuint texture
) {
846 Enter3D
enter(context_id
, true);
847 if (enter
.succeeded()) {
848 return ToGles2Impl(&enter
)->IsTexture(texture
);
854 void LineWidth(PP_Resource context_id
, GLfloat width
) {
855 Enter3D
enter(context_id
, true);
856 if (enter
.succeeded()) {
857 ToGles2Impl(&enter
)->LineWidth(width
);
861 void LinkProgram(PP_Resource context_id
, GLuint program
) {
862 Enter3D
enter(context_id
, true);
863 if (enter
.succeeded()) {
864 ToGles2Impl(&enter
)->LinkProgram(program
);
868 void PixelStorei(PP_Resource context_id
, GLenum pname
, GLint param
) {
869 Enter3D
enter(context_id
, true);
870 if (enter
.succeeded()) {
871 ToGles2Impl(&enter
)->PixelStorei(pname
, param
);
875 void PolygonOffset(PP_Resource context_id
, GLfloat factor
, GLfloat units
) {
876 Enter3D
enter(context_id
, true);
877 if (enter
.succeeded()) {
878 ToGles2Impl(&enter
)->PolygonOffset(factor
, units
);
882 void ReadPixels(PP_Resource context_id
,
890 Enter3D
enter(context_id
, true);
891 if (enter
.succeeded()) {
892 ToGles2Impl(&enter
)->ReadPixels(x
, y
, width
, height
, format
, type
, pixels
);
896 void ReleaseShaderCompiler(PP_Resource context_id
) {
897 Enter3D
enter(context_id
, true);
898 if (enter
.succeeded()) {
899 ToGles2Impl(&enter
)->ReleaseShaderCompiler();
903 void RenderbufferStorage(PP_Resource context_id
,
905 GLenum internalformat
,
908 Enter3D
enter(context_id
, true);
909 if (enter
.succeeded()) {
911 ->RenderbufferStorage(target
, internalformat
, width
, height
);
915 void SampleCoverage(PP_Resource context_id
, GLclampf value
, GLboolean invert
) {
916 Enter3D
enter(context_id
, true);
917 if (enter
.succeeded()) {
918 ToGles2Impl(&enter
)->SampleCoverage(value
, invert
);
922 void Scissor(PP_Resource context_id
,
927 Enter3D
enter(context_id
, true);
928 if (enter
.succeeded()) {
929 ToGles2Impl(&enter
)->Scissor(x
, y
, width
, height
);
933 void ShaderBinary(PP_Resource context_id
,
935 const GLuint
* shaders
,
939 Enter3D
enter(context_id
, true);
940 if (enter
.succeeded()) {
941 ToGles2Impl(&enter
)->ShaderBinary(n
, shaders
, binaryformat
, binary
, length
);
945 void ShaderSource(PP_Resource context_id
,
949 const GLint
* length
) {
950 Enter3D
enter(context_id
, true);
951 if (enter
.succeeded()) {
952 ToGles2Impl(&enter
)->ShaderSource(shader
, count
, str
, length
);
956 void StencilFunc(PP_Resource context_id
, GLenum func
, GLint ref
, GLuint mask
) {
957 Enter3D
enter(context_id
, true);
958 if (enter
.succeeded()) {
959 ToGles2Impl(&enter
)->StencilFunc(func
, ref
, mask
);
963 void StencilFuncSeparate(PP_Resource context_id
,
968 Enter3D
enter(context_id
, true);
969 if (enter
.succeeded()) {
970 ToGles2Impl(&enter
)->StencilFuncSeparate(face
, func
, ref
, mask
);
974 void StencilMask(PP_Resource context_id
, GLuint mask
) {
975 Enter3D
enter(context_id
, true);
976 if (enter
.succeeded()) {
977 ToGles2Impl(&enter
)->StencilMask(mask
);
981 void StencilMaskSeparate(PP_Resource context_id
, GLenum face
, GLuint mask
) {
982 Enter3D
enter(context_id
, true);
983 if (enter
.succeeded()) {
984 ToGles2Impl(&enter
)->StencilMaskSeparate(face
, mask
);
988 void StencilOp(PP_Resource context_id
,
992 Enter3D
enter(context_id
, true);
993 if (enter
.succeeded()) {
994 ToGles2Impl(&enter
)->StencilOp(fail
, zfail
, zpass
);
998 void StencilOpSeparate(PP_Resource context_id
,
1003 Enter3D
enter(context_id
, true);
1004 if (enter
.succeeded()) {
1005 ToGles2Impl(&enter
)->StencilOpSeparate(face
, fail
, zfail
, zpass
);
1009 void TexImage2D(PP_Resource context_id
,
1012 GLint internalformat
,
1018 const void* pixels
) {
1019 Enter3D
enter(context_id
, true);
1020 if (enter
.succeeded()) {
1021 ToGles2Impl(&enter
)->TexImage2D(target
,
1033 void TexParameterf(PP_Resource context_id
,
1037 Enter3D
enter(context_id
, true);
1038 if (enter
.succeeded()) {
1039 ToGles2Impl(&enter
)->TexParameterf(target
, pname
, param
);
1043 void TexParameterfv(PP_Resource context_id
,
1046 const GLfloat
* params
) {
1047 Enter3D
enter(context_id
, true);
1048 if (enter
.succeeded()) {
1049 ToGles2Impl(&enter
)->TexParameterfv(target
, pname
, params
);
1053 void TexParameteri(PP_Resource context_id
,
1057 Enter3D
enter(context_id
, true);
1058 if (enter
.succeeded()) {
1059 ToGles2Impl(&enter
)->TexParameteri(target
, pname
, param
);
1063 void TexParameteriv(PP_Resource context_id
,
1066 const GLint
* params
) {
1067 Enter3D
enter(context_id
, true);
1068 if (enter
.succeeded()) {
1069 ToGles2Impl(&enter
)->TexParameteriv(target
, pname
, params
);
1073 void TexSubImage2D(PP_Resource context_id
,
1082 const void* pixels
) {
1083 Enter3D
enter(context_id
, true);
1084 if (enter
.succeeded()) {
1085 ToGles2Impl(&enter
)->TexSubImage2D(
1086 target
, level
, xoffset
, yoffset
, width
, height
, format
, type
, pixels
);
1090 void Uniform1f(PP_Resource context_id
, GLint location
, GLfloat x
) {
1091 Enter3D
enter(context_id
, true);
1092 if (enter
.succeeded()) {
1093 ToGles2Impl(&enter
)->Uniform1f(location
, x
);
1097 void Uniform1fv(PP_Resource context_id
,
1101 Enter3D
enter(context_id
, true);
1102 if (enter
.succeeded()) {
1103 ToGles2Impl(&enter
)->Uniform1fv(location
, count
, v
);
1107 void Uniform1i(PP_Resource context_id
, GLint location
, GLint x
) {
1108 Enter3D
enter(context_id
, true);
1109 if (enter
.succeeded()) {
1110 ToGles2Impl(&enter
)->Uniform1i(location
, x
);
1114 void Uniform1iv(PP_Resource context_id
,
1118 Enter3D
enter(context_id
, true);
1119 if (enter
.succeeded()) {
1120 ToGles2Impl(&enter
)->Uniform1iv(location
, count
, v
);
1124 void Uniform2f(PP_Resource context_id
, GLint location
, GLfloat x
, GLfloat y
) {
1125 Enter3D
enter(context_id
, true);
1126 if (enter
.succeeded()) {
1127 ToGles2Impl(&enter
)->Uniform2f(location
, x
, y
);
1131 void Uniform2fv(PP_Resource context_id
,
1135 Enter3D
enter(context_id
, true);
1136 if (enter
.succeeded()) {
1137 ToGles2Impl(&enter
)->Uniform2fv(location
, count
, v
);
1141 void Uniform2i(PP_Resource context_id
, GLint location
, GLint x
, GLint y
) {
1142 Enter3D
enter(context_id
, true);
1143 if (enter
.succeeded()) {
1144 ToGles2Impl(&enter
)->Uniform2i(location
, x
, y
);
1148 void Uniform2iv(PP_Resource context_id
,
1152 Enter3D
enter(context_id
, true);
1153 if (enter
.succeeded()) {
1154 ToGles2Impl(&enter
)->Uniform2iv(location
, count
, v
);
1158 void Uniform3f(PP_Resource context_id
,
1163 Enter3D
enter(context_id
, true);
1164 if (enter
.succeeded()) {
1165 ToGles2Impl(&enter
)->Uniform3f(location
, x
, y
, z
);
1169 void Uniform3fv(PP_Resource context_id
,
1173 Enter3D
enter(context_id
, true);
1174 if (enter
.succeeded()) {
1175 ToGles2Impl(&enter
)->Uniform3fv(location
, count
, v
);
1179 void Uniform3i(PP_Resource context_id
,
1184 Enter3D
enter(context_id
, true);
1185 if (enter
.succeeded()) {
1186 ToGles2Impl(&enter
)->Uniform3i(location
, x
, y
, z
);
1190 void Uniform3iv(PP_Resource context_id
,
1194 Enter3D
enter(context_id
, true);
1195 if (enter
.succeeded()) {
1196 ToGles2Impl(&enter
)->Uniform3iv(location
, count
, v
);
1200 void Uniform4f(PP_Resource context_id
,
1206 Enter3D
enter(context_id
, true);
1207 if (enter
.succeeded()) {
1208 ToGles2Impl(&enter
)->Uniform4f(location
, x
, y
, z
, w
);
1212 void Uniform4fv(PP_Resource context_id
,
1216 Enter3D
enter(context_id
, true);
1217 if (enter
.succeeded()) {
1218 ToGles2Impl(&enter
)->Uniform4fv(location
, count
, v
);
1222 void Uniform4i(PP_Resource context_id
,
1228 Enter3D
enter(context_id
, true);
1229 if (enter
.succeeded()) {
1230 ToGles2Impl(&enter
)->Uniform4i(location
, x
, y
, z
, w
);
1234 void Uniform4iv(PP_Resource context_id
,
1238 Enter3D
enter(context_id
, true);
1239 if (enter
.succeeded()) {
1240 ToGles2Impl(&enter
)->Uniform4iv(location
, count
, v
);
1244 void UniformMatrix2fv(PP_Resource context_id
,
1247 GLboolean transpose
,
1248 const GLfloat
* value
) {
1249 Enter3D
enter(context_id
, true);
1250 if (enter
.succeeded()) {
1251 ToGles2Impl(&enter
)->UniformMatrix2fv(location
, count
, transpose
, value
);
1255 void UniformMatrix3fv(PP_Resource context_id
,
1258 GLboolean transpose
,
1259 const GLfloat
* value
) {
1260 Enter3D
enter(context_id
, true);
1261 if (enter
.succeeded()) {
1262 ToGles2Impl(&enter
)->UniformMatrix3fv(location
, count
, transpose
, value
);
1266 void UniformMatrix4fv(PP_Resource context_id
,
1269 GLboolean transpose
,
1270 const GLfloat
* value
) {
1271 Enter3D
enter(context_id
, true);
1272 if (enter
.succeeded()) {
1273 ToGles2Impl(&enter
)->UniformMatrix4fv(location
, count
, transpose
, value
);
1277 void UseProgram(PP_Resource context_id
, GLuint program
) {
1278 Enter3D
enter(context_id
, true);
1279 if (enter
.succeeded()) {
1280 ToGles2Impl(&enter
)->UseProgram(program
);
1284 void ValidateProgram(PP_Resource context_id
, GLuint program
) {
1285 Enter3D
enter(context_id
, true);
1286 if (enter
.succeeded()) {
1287 ToGles2Impl(&enter
)->ValidateProgram(program
);
1291 void VertexAttrib1f(PP_Resource context_id
, GLuint indx
, GLfloat x
) {
1292 Enter3D
enter(context_id
, true);
1293 if (enter
.succeeded()) {
1294 ToGles2Impl(&enter
)->VertexAttrib1f(indx
, x
);
1298 void VertexAttrib1fv(PP_Resource context_id
,
1300 const GLfloat
* values
) {
1301 Enter3D
enter(context_id
, true);
1302 if (enter
.succeeded()) {
1303 ToGles2Impl(&enter
)->VertexAttrib1fv(indx
, values
);
1307 void VertexAttrib2f(PP_Resource context_id
, GLuint indx
, GLfloat x
, GLfloat y
) {
1308 Enter3D
enter(context_id
, true);
1309 if (enter
.succeeded()) {
1310 ToGles2Impl(&enter
)->VertexAttrib2f(indx
, x
, y
);
1314 void VertexAttrib2fv(PP_Resource context_id
,
1316 const GLfloat
* values
) {
1317 Enter3D
enter(context_id
, true);
1318 if (enter
.succeeded()) {
1319 ToGles2Impl(&enter
)->VertexAttrib2fv(indx
, values
);
1323 void VertexAttrib3f(PP_Resource context_id
,
1328 Enter3D
enter(context_id
, true);
1329 if (enter
.succeeded()) {
1330 ToGles2Impl(&enter
)->VertexAttrib3f(indx
, x
, y
, z
);
1334 void VertexAttrib3fv(PP_Resource context_id
,
1336 const GLfloat
* values
) {
1337 Enter3D
enter(context_id
, true);
1338 if (enter
.succeeded()) {
1339 ToGles2Impl(&enter
)->VertexAttrib3fv(indx
, values
);
1343 void VertexAttrib4f(PP_Resource context_id
,
1349 Enter3D
enter(context_id
, true);
1350 if (enter
.succeeded()) {
1351 ToGles2Impl(&enter
)->VertexAttrib4f(indx
, x
, y
, z
, w
);
1355 void VertexAttrib4fv(PP_Resource context_id
,
1357 const GLfloat
* values
) {
1358 Enter3D
enter(context_id
, true);
1359 if (enter
.succeeded()) {
1360 ToGles2Impl(&enter
)->VertexAttrib4fv(indx
, values
);
1364 void VertexAttribPointer(PP_Resource context_id
,
1368 GLboolean normalized
,
1371 Enter3D
enter(context_id
, true);
1372 if (enter
.succeeded()) {
1374 ->VertexAttribPointer(indx
, size
, type
, normalized
, stride
, ptr
);
1378 void Viewport(PP_Resource context_id
,
1383 Enter3D
enter(context_id
, true);
1384 if (enter
.succeeded()) {
1385 ToGles2Impl(&enter
)->Viewport(x
, y
, width
, height
);
1389 void BlitFramebufferEXT(PP_Resource context_id
,
1400 Enter3D
enter(context_id
, true);
1401 if (enter
.succeeded()) {
1402 ToGles2Impl(&enter
)->BlitFramebufferCHROMIUM(
1403 srcX0
, srcY0
, srcX1
, srcY1
, dstX0
, dstY0
, dstX1
, dstY1
, mask
, filter
);
1407 void RenderbufferStorageMultisampleEXT(PP_Resource context_id
,
1410 GLenum internalformat
,
1413 Enter3D
enter(context_id
, true);
1414 if (enter
.succeeded()) {
1415 ToGles2Impl(&enter
)->RenderbufferStorageMultisampleCHROMIUM(
1416 target
, samples
, internalformat
, width
, height
);
1420 void GenQueriesEXT(PP_Resource context_id
, GLsizei n
, GLuint
* queries
) {
1421 Enter3D
enter(context_id
, true);
1422 if (enter
.succeeded()) {
1423 ToGles2Impl(&enter
)->GenQueriesEXT(n
, queries
);
1427 void DeleteQueriesEXT(PP_Resource context_id
,
1429 const GLuint
* queries
) {
1430 Enter3D
enter(context_id
, true);
1431 if (enter
.succeeded()) {
1432 ToGles2Impl(&enter
)->DeleteQueriesEXT(n
, queries
);
1436 GLboolean
IsQueryEXT(PP_Resource context_id
, GLuint id
) {
1437 Enter3D
enter(context_id
, true);
1438 if (enter
.succeeded()) {
1439 return ToGles2Impl(&enter
)->IsQueryEXT(id
);
1445 void BeginQueryEXT(PP_Resource context_id
, GLenum target
, GLuint id
) {
1446 Enter3D
enter(context_id
, true);
1447 if (enter
.succeeded()) {
1448 ToGles2Impl(&enter
)->BeginQueryEXT(target
, id
);
1452 void EndQueryEXT(PP_Resource context_id
, GLenum target
) {
1453 Enter3D
enter(context_id
, true);
1454 if (enter
.succeeded()) {
1455 ToGles2Impl(&enter
)->EndQueryEXT(target
);
1459 void GetQueryivEXT(PP_Resource context_id
,
1463 Enter3D
enter(context_id
, true);
1464 if (enter
.succeeded()) {
1465 ToGles2Impl(&enter
)->GetQueryivEXT(target
, pname
, params
);
1469 void GetQueryObjectuivEXT(PP_Resource context_id
,
1473 Enter3D
enter(context_id
, true);
1474 if (enter
.succeeded()) {
1475 ToGles2Impl(&enter
)->GetQueryObjectuivEXT(id
, pname
, params
);
1479 GLboolean
EnableFeatureCHROMIUM(PP_Resource context_id
, const char* feature
) {
1480 Enter3D
enter(context_id
, true);
1481 if (enter
.succeeded()) {
1482 return ToGles2Impl(&enter
)->EnableFeatureCHROMIUM(feature
);
1488 void* MapBufferSubDataCHROMIUM(PP_Resource context_id
,
1493 Enter3D
enter(context_id
, true);
1494 if (enter
.succeeded()) {
1495 return ToGles2Impl(&enter
)
1496 ->MapBufferSubDataCHROMIUM(target
, offset
, size
, access
);
1502 void UnmapBufferSubDataCHROMIUM(PP_Resource context_id
, const void* mem
) {
1503 Enter3D
enter(context_id
, true);
1504 if (enter
.succeeded()) {
1505 ToGles2Impl(&enter
)->UnmapBufferSubDataCHROMIUM(mem
);
1509 void* MapTexSubImage2DCHROMIUM(PP_Resource context_id
,
1519 Enter3D
enter(context_id
, true);
1520 if (enter
.succeeded()) {
1521 return ToGles2Impl(&enter
)->MapTexSubImage2DCHROMIUM(
1522 target
, level
, xoffset
, yoffset
, width
, height
, format
, type
, access
);
1528 void UnmapTexSubImage2DCHROMIUM(PP_Resource context_id
, const void* mem
) {
1529 Enter3D
enter(context_id
, true);
1530 if (enter
.succeeded()) {
1531 ToGles2Impl(&enter
)->UnmapTexSubImage2DCHROMIUM(mem
);
1535 void DrawArraysInstancedANGLE(PP_Resource context_id
,
1539 GLsizei primcount
) {
1540 Enter3D
enter(context_id
, true);
1541 if (enter
.succeeded()) {
1543 ->DrawArraysInstancedANGLE(mode
, first
, count
, primcount
);
1547 void DrawElementsInstancedANGLE(PP_Resource context_id
,
1551 const void* indices
,
1552 GLsizei primcount
) {
1553 Enter3D
enter(context_id
, true);
1554 if (enter
.succeeded()) {
1556 ->DrawElementsInstancedANGLE(mode
, count
, type
, indices
, primcount
);
1560 void VertexAttribDivisorANGLE(PP_Resource context_id
,
1563 Enter3D
enter(context_id
, true);
1564 if (enter
.succeeded()) {
1565 ToGles2Impl(&enter
)->VertexAttribDivisorANGLE(index
, divisor
);
1570 const PPB_OpenGLES2
* PPB_OpenGLES2_Shared::GetInterface() {
1571 static const struct PPB_OpenGLES2 ppb_opengles2
= {
1572 &ActiveTexture
, &AttachShader
,
1573 &BindAttribLocation
, &BindBuffer
,
1574 &BindFramebuffer
, &BindRenderbuffer
,
1575 &BindTexture
, &BlendColor
,
1576 &BlendEquation
, &BlendEquationSeparate
,
1577 &BlendFunc
, &BlendFuncSeparate
,
1578 &BufferData
, &BufferSubData
,
1579 &CheckFramebufferStatus
, &Clear
,
1580 &ClearColor
, &ClearDepthf
,
1581 &ClearStencil
, &ColorMask
,
1582 &CompileShader
, &CompressedTexImage2D
,
1583 &CompressedTexSubImage2D
, &CopyTexImage2D
,
1584 &CopyTexSubImage2D
, &CreateProgram
,
1585 &CreateShader
, &CullFace
,
1586 &DeleteBuffers
, &DeleteFramebuffers
,
1587 &DeleteProgram
, &DeleteRenderbuffers
,
1588 &DeleteShader
, &DeleteTextures
,
1589 &DepthFunc
, &DepthMask
,
1590 &DepthRangef
, &DetachShader
,
1591 &Disable
, &DisableVertexAttribArray
,
1592 &DrawArrays
, &DrawElements
,
1593 &Enable
, &EnableVertexAttribArray
,
1595 &FramebufferRenderbuffer
, &FramebufferTexture2D
,
1596 &FrontFace
, &GenBuffers
,
1597 &GenerateMipmap
, &GenFramebuffers
,
1598 &GenRenderbuffers
, &GenTextures
,
1599 &GetActiveAttrib
, &GetActiveUniform
,
1600 &GetAttachedShaders
, &GetAttribLocation
,
1601 &GetBooleanv
, &GetBufferParameteriv
,
1602 &GetError
, &GetFloatv
,
1603 &GetFramebufferAttachmentParameteriv
, &GetIntegerv
,
1604 &GetProgramiv
, &GetProgramInfoLog
,
1605 &GetRenderbufferParameteriv
, &GetShaderiv
,
1606 &GetShaderInfoLog
, &GetShaderPrecisionFormat
,
1607 &GetShaderSource
, &GetString
,
1608 &GetTexParameterfv
, &GetTexParameteriv
,
1609 &GetUniformfv
, &GetUniformiv
,
1610 &GetUniformLocation
, &GetVertexAttribfv
,
1611 &GetVertexAttribiv
, &GetVertexAttribPointerv
,
1613 &IsEnabled
, &IsFramebuffer
,
1614 &IsProgram
, &IsRenderbuffer
,
1615 &IsShader
, &IsTexture
,
1616 &LineWidth
, &LinkProgram
,
1617 &PixelStorei
, &PolygonOffset
,
1618 &ReadPixels
, &ReleaseShaderCompiler
,
1619 &RenderbufferStorage
, &SampleCoverage
,
1620 &Scissor
, &ShaderBinary
,
1621 &ShaderSource
, &StencilFunc
,
1622 &StencilFuncSeparate
, &StencilMask
,
1623 &StencilMaskSeparate
, &StencilOp
,
1624 &StencilOpSeparate
, &TexImage2D
,
1625 &TexParameterf
, &TexParameterfv
,
1626 &TexParameteri
, &TexParameteriv
,
1627 &TexSubImage2D
, &Uniform1f
,
1628 &Uniform1fv
, &Uniform1i
,
1629 &Uniform1iv
, &Uniform2f
,
1630 &Uniform2fv
, &Uniform2i
,
1631 &Uniform2iv
, &Uniform3f
,
1632 &Uniform3fv
, &Uniform3i
,
1633 &Uniform3iv
, &Uniform4f
,
1634 &Uniform4fv
, &Uniform4i
,
1635 &Uniform4iv
, &UniformMatrix2fv
,
1636 &UniformMatrix3fv
, &UniformMatrix4fv
,
1637 &UseProgram
, &ValidateProgram
,
1638 &VertexAttrib1f
, &VertexAttrib1fv
,
1639 &VertexAttrib2f
, &VertexAttrib2fv
,
1640 &VertexAttrib3f
, &VertexAttrib3fv
,
1641 &VertexAttrib4f
, &VertexAttrib4fv
,
1642 &VertexAttribPointer
, &Viewport
};
1643 return &ppb_opengles2
;
1645 const PPB_OpenGLES2InstancedArrays
*
1646 PPB_OpenGLES2_Shared::GetInstancedArraysInterface() { // NOLINT
1647 static const struct PPB_OpenGLES2InstancedArrays ppb_opengles2
= {
1648 &DrawArraysInstancedANGLE
, &DrawElementsInstancedANGLE
,
1649 &VertexAttribDivisorANGLE
};
1650 return &ppb_opengles2
;
1652 const PPB_OpenGLES2FramebufferBlit
*
1653 PPB_OpenGLES2_Shared::GetFramebufferBlitInterface() { // NOLINT
1654 static const struct PPB_OpenGLES2FramebufferBlit ppb_opengles2
= {
1655 &BlitFramebufferEXT
};
1656 return &ppb_opengles2
;
1658 const PPB_OpenGLES2FramebufferMultisample
*
1659 PPB_OpenGLES2_Shared::GetFramebufferMultisampleInterface() { // NOLINT
1660 static const struct PPB_OpenGLES2FramebufferMultisample ppb_opengles2
= {
1661 &RenderbufferStorageMultisampleEXT
};
1662 return &ppb_opengles2
;
1664 const PPB_OpenGLES2ChromiumEnableFeature
*
1665 PPB_OpenGLES2_Shared::GetChromiumEnableFeatureInterface() { // NOLINT
1666 static const struct PPB_OpenGLES2ChromiumEnableFeature ppb_opengles2
= {
1667 &EnableFeatureCHROMIUM
};
1668 return &ppb_opengles2
;
1670 const PPB_OpenGLES2ChromiumMapSub
*
1671 PPB_OpenGLES2_Shared::GetChromiumMapSubInterface() { // NOLINT
1672 static const struct PPB_OpenGLES2ChromiumMapSub ppb_opengles2
= {
1673 &MapBufferSubDataCHROMIUM
, &UnmapBufferSubDataCHROMIUM
,
1674 &MapTexSubImage2DCHROMIUM
, &UnmapTexSubImage2DCHROMIUM
};
1675 return &ppb_opengles2
;
1677 const PPB_OpenGLES2Query
* PPB_OpenGLES2_Shared::GetQueryInterface() {
1678 static const struct PPB_OpenGLES2Query ppb_opengles2
= {
1679 &GenQueriesEXT
, &DeleteQueriesEXT
, &IsQueryEXT
, &BeginQueryEXT
,
1680 &EndQueryEXT
, &GetQueryivEXT
, &GetQueryObjectuivEXT
};
1681 return &ppb_opengles2
;
1683 } // namespace ppapi