1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
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
, level
, xoffset
,
241 yoffset
, width
, height
, format
,
246 void CopyTexImage2D(PP_Resource context_id
,
249 GLenum internalformat
,
255 Enter3D
enter(context_id
, true);
256 if (enter
.succeeded()) {
257 ToGles2Impl(&enter
)->CopyTexImage2D(target
, level
, internalformat
, x
, y
,
258 width
, height
, border
);
262 void CopyTexSubImage2D(PP_Resource context_id
,
271 Enter3D
enter(context_id
, true);
272 if (enter
.succeeded()) {
273 ToGles2Impl(&enter
)->CopyTexSubImage2D(target
, level
, xoffset
, yoffset
, x
,
278 GLuint
CreateProgram(PP_Resource context_id
) {
279 Enter3D
enter(context_id
, true);
280 if (enter
.succeeded()) {
281 return ToGles2Impl(&enter
)->CreateProgram();
287 GLuint
CreateShader(PP_Resource context_id
, GLenum type
) {
288 Enter3D
enter(context_id
, true);
289 if (enter
.succeeded()) {
290 return ToGles2Impl(&enter
)->CreateShader(type
);
296 void CullFace(PP_Resource context_id
, GLenum mode
) {
297 Enter3D
enter(context_id
, true);
298 if (enter
.succeeded()) {
299 ToGles2Impl(&enter
)->CullFace(mode
);
303 void DeleteBuffers(PP_Resource context_id
, GLsizei n
, const GLuint
* buffers
) {
304 Enter3D
enter(context_id
, true);
305 if (enter
.succeeded()) {
306 ToGles2Impl(&enter
)->DeleteBuffers(n
, buffers
);
310 void DeleteFramebuffers(PP_Resource context_id
,
312 const GLuint
* framebuffers
) {
313 Enter3D
enter(context_id
, true);
314 if (enter
.succeeded()) {
315 ToGles2Impl(&enter
)->DeleteFramebuffers(n
, framebuffers
);
319 void DeleteProgram(PP_Resource context_id
, GLuint program
) {
320 Enter3D
enter(context_id
, true);
321 if (enter
.succeeded()) {
322 ToGles2Impl(&enter
)->DeleteProgram(program
);
326 void DeleteRenderbuffers(PP_Resource context_id
,
328 const GLuint
* renderbuffers
) {
329 Enter3D
enter(context_id
, true);
330 if (enter
.succeeded()) {
331 ToGles2Impl(&enter
)->DeleteRenderbuffers(n
, renderbuffers
);
335 void DeleteShader(PP_Resource context_id
, GLuint shader
) {
336 Enter3D
enter(context_id
, true);
337 if (enter
.succeeded()) {
338 ToGles2Impl(&enter
)->DeleteShader(shader
);
342 void DeleteTextures(PP_Resource context_id
, GLsizei n
, const GLuint
* textures
) {
343 Enter3D
enter(context_id
, true);
344 if (enter
.succeeded()) {
345 ToGles2Impl(&enter
)->DeleteTextures(n
, textures
);
349 void DepthFunc(PP_Resource context_id
, GLenum func
) {
350 Enter3D
enter(context_id
, true);
351 if (enter
.succeeded()) {
352 ToGles2Impl(&enter
)->DepthFunc(func
);
356 void DepthMask(PP_Resource context_id
, GLboolean flag
) {
357 Enter3D
enter(context_id
, true);
358 if (enter
.succeeded()) {
359 ToGles2Impl(&enter
)->DepthMask(flag
);
363 void DepthRangef(PP_Resource context_id
, GLclampf zNear
, GLclampf zFar
) {
364 Enter3D
enter(context_id
, true);
365 if (enter
.succeeded()) {
366 ToGles2Impl(&enter
)->DepthRangef(zNear
, zFar
);
370 void DetachShader(PP_Resource context_id
, GLuint program
, GLuint shader
) {
371 Enter3D
enter(context_id
, true);
372 if (enter
.succeeded()) {
373 ToGles2Impl(&enter
)->DetachShader(program
, shader
);
377 void Disable(PP_Resource context_id
, GLenum cap
) {
378 Enter3D
enter(context_id
, true);
379 if (enter
.succeeded()) {
380 ToGles2Impl(&enter
)->Disable(cap
);
384 void DisableVertexAttribArray(PP_Resource context_id
, GLuint index
) {
385 Enter3D
enter(context_id
, true);
386 if (enter
.succeeded()) {
387 ToGles2Impl(&enter
)->DisableVertexAttribArray(index
);
391 void DrawArrays(PP_Resource context_id
,
395 Enter3D
enter(context_id
, true);
396 if (enter
.succeeded()) {
397 ToGles2Impl(&enter
)->DrawArrays(mode
, first
, count
);
401 void DrawElements(PP_Resource context_id
,
405 const void* indices
) {
406 Enter3D
enter(context_id
, true);
407 if (enter
.succeeded()) {
408 ToGles2Impl(&enter
)->DrawElements(mode
, count
, type
, indices
);
412 void Enable(PP_Resource context_id
, GLenum cap
) {
413 Enter3D
enter(context_id
, true);
414 if (enter
.succeeded()) {
415 ToGles2Impl(&enter
)->Enable(cap
);
419 void EnableVertexAttribArray(PP_Resource context_id
, GLuint index
) {
420 Enter3D
enter(context_id
, true);
421 if (enter
.succeeded()) {
422 ToGles2Impl(&enter
)->EnableVertexAttribArray(index
);
426 void Finish(PP_Resource context_id
) {
427 Enter3D
enter(context_id
, true);
428 if (enter
.succeeded()) {
429 ToGles2Impl(&enter
)->Finish();
433 void Flush(PP_Resource context_id
) {
434 Enter3D
enter(context_id
, true);
435 if (enter
.succeeded()) {
436 ToGles2Impl(&enter
)->Flush();
440 void FramebufferRenderbuffer(PP_Resource context_id
,
443 GLenum renderbuffertarget
,
444 GLuint renderbuffer
) {
445 Enter3D
enter(context_id
, true);
446 if (enter
.succeeded()) {
447 ToGles2Impl(&enter
)->FramebufferRenderbuffer(
448 target
, attachment
, renderbuffertarget
, renderbuffer
);
452 void FramebufferTexture2D(PP_Resource context_id
,
458 Enter3D
enter(context_id
, true);
459 if (enter
.succeeded()) {
461 ->FramebufferTexture2D(target
, attachment
, textarget
, texture
, level
);
465 void FrontFace(PP_Resource context_id
, GLenum mode
) {
466 Enter3D
enter(context_id
, true);
467 if (enter
.succeeded()) {
468 ToGles2Impl(&enter
)->FrontFace(mode
);
472 void GenBuffers(PP_Resource context_id
, GLsizei n
, GLuint
* buffers
) {
473 Enter3D
enter(context_id
, true);
474 if (enter
.succeeded()) {
475 ToGles2Impl(&enter
)->GenBuffers(n
, buffers
);
479 void GenerateMipmap(PP_Resource context_id
, GLenum target
) {
480 Enter3D
enter(context_id
, true);
481 if (enter
.succeeded()) {
482 ToGles2Impl(&enter
)->GenerateMipmap(target
);
486 void GenFramebuffers(PP_Resource context_id
, GLsizei n
, GLuint
* framebuffers
) {
487 Enter3D
enter(context_id
, true);
488 if (enter
.succeeded()) {
489 ToGles2Impl(&enter
)->GenFramebuffers(n
, framebuffers
);
493 void GenRenderbuffers(PP_Resource context_id
,
495 GLuint
* renderbuffers
) {
496 Enter3D
enter(context_id
, true);
497 if (enter
.succeeded()) {
498 ToGles2Impl(&enter
)->GenRenderbuffers(n
, renderbuffers
);
502 void GenTextures(PP_Resource context_id
, GLsizei n
, GLuint
* textures
) {
503 Enter3D
enter(context_id
, true);
504 if (enter
.succeeded()) {
505 ToGles2Impl(&enter
)->GenTextures(n
, textures
);
509 void GetActiveAttrib(PP_Resource context_id
,
517 Enter3D
enter(context_id
, true);
518 if (enter
.succeeded()) {
520 ->GetActiveAttrib(program
, index
, bufsize
, length
, size
, type
, name
);
524 void GetActiveUniform(PP_Resource context_id
,
532 Enter3D
enter(context_id
, true);
533 if (enter
.succeeded()) {
535 ->GetActiveUniform(program
, index
, bufsize
, length
, size
, type
, name
);
539 void GetAttachedShaders(PP_Resource context_id
,
544 Enter3D
enter(context_id
, true);
545 if (enter
.succeeded()) {
546 ToGles2Impl(&enter
)->GetAttachedShaders(program
, maxcount
, count
, shaders
);
550 GLint
GetAttribLocation(PP_Resource context_id
,
553 Enter3D
enter(context_id
, true);
554 if (enter
.succeeded()) {
555 return ToGles2Impl(&enter
)->GetAttribLocation(program
, name
);
561 void GetBooleanv(PP_Resource context_id
, GLenum pname
, GLboolean
* params
) {
562 Enter3D
enter(context_id
, true);
563 if (enter
.succeeded()) {
564 ToGles2Impl(&enter
)->GetBooleanv(pname
, params
);
568 void GetBufferParameteriv(PP_Resource context_id
,
572 Enter3D
enter(context_id
, true);
573 if (enter
.succeeded()) {
574 ToGles2Impl(&enter
)->GetBufferParameteriv(target
, pname
, params
);
578 GLenum
GetError(PP_Resource context_id
) {
579 Enter3D
enter(context_id
, true);
580 if (enter
.succeeded()) {
581 return ToGles2Impl(&enter
)->GetError();
587 void GetFloatv(PP_Resource context_id
, GLenum pname
, GLfloat
* params
) {
588 Enter3D
enter(context_id
, true);
589 if (enter
.succeeded()) {
590 ToGles2Impl(&enter
)->GetFloatv(pname
, params
);
594 void GetFramebufferAttachmentParameteriv(PP_Resource context_id
,
599 Enter3D
enter(context_id
, true);
600 if (enter
.succeeded()) {
601 ToGles2Impl(&enter
)->GetFramebufferAttachmentParameteriv(target
, attachment
,
606 void GetIntegerv(PP_Resource context_id
, GLenum pname
, GLint
* params
) {
607 Enter3D
enter(context_id
, true);
608 if (enter
.succeeded()) {
609 ToGles2Impl(&enter
)->GetIntegerv(pname
, params
);
613 void GetProgramiv(PP_Resource context_id
,
617 Enter3D
enter(context_id
, true);
618 if (enter
.succeeded()) {
619 ToGles2Impl(&enter
)->GetProgramiv(program
, pname
, params
);
623 void GetProgramInfoLog(PP_Resource context_id
,
628 Enter3D
enter(context_id
, true);
629 if (enter
.succeeded()) {
630 ToGles2Impl(&enter
)->GetProgramInfoLog(program
, bufsize
, length
, infolog
);
634 void GetRenderbufferParameteriv(PP_Resource context_id
,
638 Enter3D
enter(context_id
, true);
639 if (enter
.succeeded()) {
640 ToGles2Impl(&enter
)->GetRenderbufferParameteriv(target
, pname
, params
);
644 void GetShaderiv(PP_Resource context_id
,
648 Enter3D
enter(context_id
, true);
649 if (enter
.succeeded()) {
650 ToGles2Impl(&enter
)->GetShaderiv(shader
, pname
, params
);
654 void GetShaderInfoLog(PP_Resource context_id
,
659 Enter3D
enter(context_id
, true);
660 if (enter
.succeeded()) {
661 ToGles2Impl(&enter
)->GetShaderInfoLog(shader
, bufsize
, length
, infolog
);
665 void GetShaderPrecisionFormat(PP_Resource context_id
,
667 GLenum precisiontype
,
670 Enter3D
enter(context_id
, true);
671 if (enter
.succeeded()) {
673 ->GetShaderPrecisionFormat(shadertype
, precisiontype
, range
, precision
);
677 void GetShaderSource(PP_Resource context_id
,
682 Enter3D
enter(context_id
, true);
683 if (enter
.succeeded()) {
684 ToGles2Impl(&enter
)->GetShaderSource(shader
, bufsize
, length
, source
);
688 const GLubyte
* GetString(PP_Resource context_id
, GLenum name
) {
689 Enter3D
enter(context_id
, true);
690 if (enter
.succeeded()) {
691 return ToGles2Impl(&enter
)->GetString(name
);
697 void GetTexParameterfv(PP_Resource context_id
,
701 Enter3D
enter(context_id
, true);
702 if (enter
.succeeded()) {
703 ToGles2Impl(&enter
)->GetTexParameterfv(target
, pname
, params
);
707 void GetTexParameteriv(PP_Resource context_id
,
711 Enter3D
enter(context_id
, true);
712 if (enter
.succeeded()) {
713 ToGles2Impl(&enter
)->GetTexParameteriv(target
, pname
, params
);
717 void GetUniformfv(PP_Resource context_id
,
721 Enter3D
enter(context_id
, true);
722 if (enter
.succeeded()) {
723 ToGles2Impl(&enter
)->GetUniformfv(program
, location
, params
);
727 void GetUniformiv(PP_Resource context_id
,
731 Enter3D
enter(context_id
, true);
732 if (enter
.succeeded()) {
733 ToGles2Impl(&enter
)->GetUniformiv(program
, location
, params
);
737 GLint
GetUniformLocation(PP_Resource context_id
,
740 Enter3D
enter(context_id
, true);
741 if (enter
.succeeded()) {
742 return ToGles2Impl(&enter
)->GetUniformLocation(program
, name
);
748 void GetVertexAttribfv(PP_Resource context_id
,
752 Enter3D
enter(context_id
, true);
753 if (enter
.succeeded()) {
754 ToGles2Impl(&enter
)->GetVertexAttribfv(index
, pname
, params
);
758 void GetVertexAttribiv(PP_Resource context_id
,
762 Enter3D
enter(context_id
, true);
763 if (enter
.succeeded()) {
764 ToGles2Impl(&enter
)->GetVertexAttribiv(index
, pname
, params
);
768 void GetVertexAttribPointerv(PP_Resource context_id
,
772 Enter3D
enter(context_id
, true);
773 if (enter
.succeeded()) {
774 ToGles2Impl(&enter
)->GetVertexAttribPointerv(index
, pname
, pointer
);
778 void Hint(PP_Resource context_id
, GLenum target
, GLenum mode
) {
779 Enter3D
enter(context_id
, true);
780 if (enter
.succeeded()) {
781 ToGles2Impl(&enter
)->Hint(target
, mode
);
785 GLboolean
IsBuffer(PP_Resource context_id
, GLuint buffer
) {
786 Enter3D
enter(context_id
, true);
787 if (enter
.succeeded()) {
788 return ToGles2Impl(&enter
)->IsBuffer(buffer
);
794 GLboolean
IsEnabled(PP_Resource context_id
, GLenum cap
) {
795 Enter3D
enter(context_id
, true);
796 if (enter
.succeeded()) {
797 return ToGles2Impl(&enter
)->IsEnabled(cap
);
803 GLboolean
IsFramebuffer(PP_Resource context_id
, GLuint framebuffer
) {
804 Enter3D
enter(context_id
, true);
805 if (enter
.succeeded()) {
806 return ToGles2Impl(&enter
)->IsFramebuffer(framebuffer
);
812 GLboolean
IsProgram(PP_Resource context_id
, GLuint program
) {
813 Enter3D
enter(context_id
, true);
814 if (enter
.succeeded()) {
815 return ToGles2Impl(&enter
)->IsProgram(program
);
821 GLboolean
IsRenderbuffer(PP_Resource context_id
, GLuint renderbuffer
) {
822 Enter3D
enter(context_id
, true);
823 if (enter
.succeeded()) {
824 return ToGles2Impl(&enter
)->IsRenderbuffer(renderbuffer
);
830 GLboolean
IsShader(PP_Resource context_id
, GLuint shader
) {
831 Enter3D
enter(context_id
, true);
832 if (enter
.succeeded()) {
833 return ToGles2Impl(&enter
)->IsShader(shader
);
839 GLboolean
IsTexture(PP_Resource context_id
, GLuint texture
) {
840 Enter3D
enter(context_id
, true);
841 if (enter
.succeeded()) {
842 return ToGles2Impl(&enter
)->IsTexture(texture
);
848 void LineWidth(PP_Resource context_id
, GLfloat width
) {
849 Enter3D
enter(context_id
, true);
850 if (enter
.succeeded()) {
851 ToGles2Impl(&enter
)->LineWidth(width
);
855 void LinkProgram(PP_Resource context_id
, GLuint program
) {
856 Enter3D
enter(context_id
, true);
857 if (enter
.succeeded()) {
858 ToGles2Impl(&enter
)->LinkProgram(program
);
862 void PixelStorei(PP_Resource context_id
, GLenum pname
, GLint param
) {
863 Enter3D
enter(context_id
, true);
864 if (enter
.succeeded()) {
865 ToGles2Impl(&enter
)->PixelStorei(pname
, param
);
869 void PolygonOffset(PP_Resource context_id
, GLfloat factor
, GLfloat units
) {
870 Enter3D
enter(context_id
, true);
871 if (enter
.succeeded()) {
872 ToGles2Impl(&enter
)->PolygonOffset(factor
, units
);
876 void ReadPixels(PP_Resource context_id
,
884 Enter3D
enter(context_id
, true);
885 if (enter
.succeeded()) {
886 ToGles2Impl(&enter
)->ReadPixels(x
, y
, width
, height
, format
, type
, pixels
);
890 void ReleaseShaderCompiler(PP_Resource context_id
) {
891 Enter3D
enter(context_id
, true);
892 if (enter
.succeeded()) {
893 ToGles2Impl(&enter
)->ReleaseShaderCompiler();
897 void RenderbufferStorage(PP_Resource context_id
,
899 GLenum internalformat
,
902 Enter3D
enter(context_id
, true);
903 if (enter
.succeeded()) {
905 ->RenderbufferStorage(target
, internalformat
, width
, height
);
909 void SampleCoverage(PP_Resource context_id
, GLclampf value
, GLboolean invert
) {
910 Enter3D
enter(context_id
, true);
911 if (enter
.succeeded()) {
912 ToGles2Impl(&enter
)->SampleCoverage(value
, invert
);
916 void Scissor(PP_Resource context_id
,
921 Enter3D
enter(context_id
, true);
922 if (enter
.succeeded()) {
923 ToGles2Impl(&enter
)->Scissor(x
, y
, width
, height
);
927 void ShaderBinary(PP_Resource context_id
,
929 const GLuint
* shaders
,
933 Enter3D
enter(context_id
, true);
934 if (enter
.succeeded()) {
935 ToGles2Impl(&enter
)->ShaderBinary(n
, shaders
, binaryformat
, binary
, length
);
939 void ShaderSource(PP_Resource context_id
,
943 const GLint
* length
) {
944 Enter3D
enter(context_id
, true);
945 if (enter
.succeeded()) {
946 ToGles2Impl(&enter
)->ShaderSource(shader
, count
, str
, length
);
950 void StencilFunc(PP_Resource context_id
, GLenum func
, GLint ref
, GLuint mask
) {
951 Enter3D
enter(context_id
, true);
952 if (enter
.succeeded()) {
953 ToGles2Impl(&enter
)->StencilFunc(func
, ref
, mask
);
957 void StencilFuncSeparate(PP_Resource context_id
,
962 Enter3D
enter(context_id
, true);
963 if (enter
.succeeded()) {
964 ToGles2Impl(&enter
)->StencilFuncSeparate(face
, func
, ref
, mask
);
968 void StencilMask(PP_Resource context_id
, GLuint mask
) {
969 Enter3D
enter(context_id
, true);
970 if (enter
.succeeded()) {
971 ToGles2Impl(&enter
)->StencilMask(mask
);
975 void StencilMaskSeparate(PP_Resource context_id
, GLenum face
, GLuint mask
) {
976 Enter3D
enter(context_id
, true);
977 if (enter
.succeeded()) {
978 ToGles2Impl(&enter
)->StencilMaskSeparate(face
, mask
);
982 void StencilOp(PP_Resource context_id
,
986 Enter3D
enter(context_id
, true);
987 if (enter
.succeeded()) {
988 ToGles2Impl(&enter
)->StencilOp(fail
, zfail
, zpass
);
992 void StencilOpSeparate(PP_Resource context_id
,
997 Enter3D
enter(context_id
, true);
998 if (enter
.succeeded()) {
999 ToGles2Impl(&enter
)->StencilOpSeparate(face
, fail
, zfail
, zpass
);
1003 void TexImage2D(PP_Resource context_id
,
1006 GLint internalformat
,
1012 const void* pixels
) {
1013 Enter3D
enter(context_id
, true);
1014 if (enter
.succeeded()) {
1015 ToGles2Impl(&enter
)->TexImage2D(target
, level
, internalformat
, width
,
1016 height
, border
, format
, type
, pixels
);
1020 void TexParameterf(PP_Resource context_id
,
1024 Enter3D
enter(context_id
, true);
1025 if (enter
.succeeded()) {
1026 ToGles2Impl(&enter
)->TexParameterf(target
, pname
, param
);
1030 void TexParameterfv(PP_Resource context_id
,
1033 const GLfloat
* params
) {
1034 Enter3D
enter(context_id
, true);
1035 if (enter
.succeeded()) {
1036 ToGles2Impl(&enter
)->TexParameterfv(target
, pname
, params
);
1040 void TexParameteri(PP_Resource context_id
,
1044 Enter3D
enter(context_id
, true);
1045 if (enter
.succeeded()) {
1046 ToGles2Impl(&enter
)->TexParameteri(target
, pname
, param
);
1050 void TexParameteriv(PP_Resource context_id
,
1053 const GLint
* params
) {
1054 Enter3D
enter(context_id
, true);
1055 if (enter
.succeeded()) {
1056 ToGles2Impl(&enter
)->TexParameteriv(target
, pname
, params
);
1060 void TexSubImage2D(PP_Resource context_id
,
1069 const void* pixels
) {
1070 Enter3D
enter(context_id
, true);
1071 if (enter
.succeeded()) {
1072 ToGles2Impl(&enter
)->TexSubImage2D(target
, level
, xoffset
, yoffset
, width
,
1073 height
, format
, type
, pixels
);
1077 void Uniform1f(PP_Resource context_id
, GLint location
, GLfloat x
) {
1078 Enter3D
enter(context_id
, true);
1079 if (enter
.succeeded()) {
1080 ToGles2Impl(&enter
)->Uniform1f(location
, x
);
1084 void Uniform1fv(PP_Resource context_id
,
1088 Enter3D
enter(context_id
, true);
1089 if (enter
.succeeded()) {
1090 ToGles2Impl(&enter
)->Uniform1fv(location
, count
, v
);
1094 void Uniform1i(PP_Resource context_id
, GLint location
, GLint x
) {
1095 Enter3D
enter(context_id
, true);
1096 if (enter
.succeeded()) {
1097 ToGles2Impl(&enter
)->Uniform1i(location
, x
);
1101 void Uniform1iv(PP_Resource context_id
,
1105 Enter3D
enter(context_id
, true);
1106 if (enter
.succeeded()) {
1107 ToGles2Impl(&enter
)->Uniform1iv(location
, count
, v
);
1111 void Uniform2f(PP_Resource context_id
, GLint location
, GLfloat x
, GLfloat y
) {
1112 Enter3D
enter(context_id
, true);
1113 if (enter
.succeeded()) {
1114 ToGles2Impl(&enter
)->Uniform2f(location
, x
, y
);
1118 void Uniform2fv(PP_Resource context_id
,
1122 Enter3D
enter(context_id
, true);
1123 if (enter
.succeeded()) {
1124 ToGles2Impl(&enter
)->Uniform2fv(location
, count
, v
);
1128 void Uniform2i(PP_Resource context_id
, GLint location
, GLint x
, GLint y
) {
1129 Enter3D
enter(context_id
, true);
1130 if (enter
.succeeded()) {
1131 ToGles2Impl(&enter
)->Uniform2i(location
, x
, y
);
1135 void Uniform2iv(PP_Resource context_id
,
1139 Enter3D
enter(context_id
, true);
1140 if (enter
.succeeded()) {
1141 ToGles2Impl(&enter
)->Uniform2iv(location
, count
, v
);
1145 void Uniform3f(PP_Resource context_id
,
1150 Enter3D
enter(context_id
, true);
1151 if (enter
.succeeded()) {
1152 ToGles2Impl(&enter
)->Uniform3f(location
, x
, y
, z
);
1156 void Uniform3fv(PP_Resource context_id
,
1160 Enter3D
enter(context_id
, true);
1161 if (enter
.succeeded()) {
1162 ToGles2Impl(&enter
)->Uniform3fv(location
, count
, v
);
1166 void Uniform3i(PP_Resource context_id
,
1171 Enter3D
enter(context_id
, true);
1172 if (enter
.succeeded()) {
1173 ToGles2Impl(&enter
)->Uniform3i(location
, x
, y
, z
);
1177 void Uniform3iv(PP_Resource context_id
,
1181 Enter3D
enter(context_id
, true);
1182 if (enter
.succeeded()) {
1183 ToGles2Impl(&enter
)->Uniform3iv(location
, count
, v
);
1187 void Uniform4f(PP_Resource context_id
,
1193 Enter3D
enter(context_id
, true);
1194 if (enter
.succeeded()) {
1195 ToGles2Impl(&enter
)->Uniform4f(location
, x
, y
, z
, w
);
1199 void Uniform4fv(PP_Resource context_id
,
1203 Enter3D
enter(context_id
, true);
1204 if (enter
.succeeded()) {
1205 ToGles2Impl(&enter
)->Uniform4fv(location
, count
, v
);
1209 void Uniform4i(PP_Resource context_id
,
1215 Enter3D
enter(context_id
, true);
1216 if (enter
.succeeded()) {
1217 ToGles2Impl(&enter
)->Uniform4i(location
, x
, y
, z
, w
);
1221 void Uniform4iv(PP_Resource context_id
,
1225 Enter3D
enter(context_id
, true);
1226 if (enter
.succeeded()) {
1227 ToGles2Impl(&enter
)->Uniform4iv(location
, count
, v
);
1231 void UniformMatrix2fv(PP_Resource context_id
,
1234 GLboolean transpose
,
1235 const GLfloat
* value
) {
1236 Enter3D
enter(context_id
, true);
1237 if (enter
.succeeded()) {
1238 ToGles2Impl(&enter
)->UniformMatrix2fv(location
, count
, transpose
, value
);
1242 void UniformMatrix3fv(PP_Resource context_id
,
1245 GLboolean transpose
,
1246 const GLfloat
* value
) {
1247 Enter3D
enter(context_id
, true);
1248 if (enter
.succeeded()) {
1249 ToGles2Impl(&enter
)->UniformMatrix3fv(location
, count
, transpose
, value
);
1253 void UniformMatrix4fv(PP_Resource context_id
,
1256 GLboolean transpose
,
1257 const GLfloat
* value
) {
1258 Enter3D
enter(context_id
, true);
1259 if (enter
.succeeded()) {
1260 ToGles2Impl(&enter
)->UniformMatrix4fv(location
, count
, transpose
, value
);
1264 void UseProgram(PP_Resource context_id
, GLuint program
) {
1265 Enter3D
enter(context_id
, true);
1266 if (enter
.succeeded()) {
1267 ToGles2Impl(&enter
)->UseProgram(program
);
1271 void ValidateProgram(PP_Resource context_id
, GLuint program
) {
1272 Enter3D
enter(context_id
, true);
1273 if (enter
.succeeded()) {
1274 ToGles2Impl(&enter
)->ValidateProgram(program
);
1278 void VertexAttrib1f(PP_Resource context_id
, GLuint indx
, GLfloat x
) {
1279 Enter3D
enter(context_id
, true);
1280 if (enter
.succeeded()) {
1281 ToGles2Impl(&enter
)->VertexAttrib1f(indx
, x
);
1285 void VertexAttrib1fv(PP_Resource context_id
,
1287 const GLfloat
* values
) {
1288 Enter3D
enter(context_id
, true);
1289 if (enter
.succeeded()) {
1290 ToGles2Impl(&enter
)->VertexAttrib1fv(indx
, values
);
1294 void VertexAttrib2f(PP_Resource context_id
, GLuint indx
, GLfloat x
, GLfloat y
) {
1295 Enter3D
enter(context_id
, true);
1296 if (enter
.succeeded()) {
1297 ToGles2Impl(&enter
)->VertexAttrib2f(indx
, x
, y
);
1301 void VertexAttrib2fv(PP_Resource context_id
,
1303 const GLfloat
* values
) {
1304 Enter3D
enter(context_id
, true);
1305 if (enter
.succeeded()) {
1306 ToGles2Impl(&enter
)->VertexAttrib2fv(indx
, values
);
1310 void VertexAttrib3f(PP_Resource context_id
,
1315 Enter3D
enter(context_id
, true);
1316 if (enter
.succeeded()) {
1317 ToGles2Impl(&enter
)->VertexAttrib3f(indx
, x
, y
, z
);
1321 void VertexAttrib3fv(PP_Resource context_id
,
1323 const GLfloat
* values
) {
1324 Enter3D
enter(context_id
, true);
1325 if (enter
.succeeded()) {
1326 ToGles2Impl(&enter
)->VertexAttrib3fv(indx
, values
);
1330 void VertexAttrib4f(PP_Resource context_id
,
1336 Enter3D
enter(context_id
, true);
1337 if (enter
.succeeded()) {
1338 ToGles2Impl(&enter
)->VertexAttrib4f(indx
, x
, y
, z
, w
);
1342 void VertexAttrib4fv(PP_Resource context_id
,
1344 const GLfloat
* values
) {
1345 Enter3D
enter(context_id
, true);
1346 if (enter
.succeeded()) {
1347 ToGles2Impl(&enter
)->VertexAttrib4fv(indx
, values
);
1351 void VertexAttribPointer(PP_Resource context_id
,
1355 GLboolean normalized
,
1358 Enter3D
enter(context_id
, true);
1359 if (enter
.succeeded()) {
1361 ->VertexAttribPointer(indx
, size
, type
, normalized
, stride
, ptr
);
1365 void Viewport(PP_Resource context_id
,
1370 Enter3D
enter(context_id
, true);
1371 if (enter
.succeeded()) {
1372 ToGles2Impl(&enter
)->Viewport(x
, y
, width
, height
);
1376 void BlitFramebufferEXT(PP_Resource context_id
,
1387 Enter3D
enter(context_id
, true);
1388 if (enter
.succeeded()) {
1389 ToGles2Impl(&enter
)->BlitFramebufferCHROMIUM(
1390 srcX0
, srcY0
, srcX1
, srcY1
, dstX0
, dstY0
, dstX1
, dstY1
, mask
, filter
);
1394 void RenderbufferStorageMultisampleEXT(PP_Resource context_id
,
1397 GLenum internalformat
,
1400 Enter3D
enter(context_id
, true);
1401 if (enter
.succeeded()) {
1402 ToGles2Impl(&enter
)->RenderbufferStorageMultisampleCHROMIUM(
1403 target
, samples
, internalformat
, width
, height
);
1407 void GenQueriesEXT(PP_Resource context_id
, GLsizei n
, GLuint
* queries
) {
1408 Enter3D
enter(context_id
, true);
1409 if (enter
.succeeded()) {
1410 ToGles2Impl(&enter
)->GenQueriesEXT(n
, queries
);
1414 void DeleteQueriesEXT(PP_Resource context_id
,
1416 const GLuint
* queries
) {
1417 Enter3D
enter(context_id
, true);
1418 if (enter
.succeeded()) {
1419 ToGles2Impl(&enter
)->DeleteQueriesEXT(n
, queries
);
1423 GLboolean
IsQueryEXT(PP_Resource context_id
, GLuint id
) {
1424 Enter3D
enter(context_id
, true);
1425 if (enter
.succeeded()) {
1426 return ToGles2Impl(&enter
)->IsQueryEXT(id
);
1432 void BeginQueryEXT(PP_Resource context_id
, GLenum target
, GLuint id
) {
1433 Enter3D
enter(context_id
, true);
1434 if (enter
.succeeded()) {
1435 ToGles2Impl(&enter
)->BeginQueryEXT(target
, id
);
1439 void EndQueryEXT(PP_Resource context_id
, GLenum target
) {
1440 Enter3D
enter(context_id
, true);
1441 if (enter
.succeeded()) {
1442 ToGles2Impl(&enter
)->EndQueryEXT(target
);
1446 void GetQueryivEXT(PP_Resource context_id
,
1450 Enter3D
enter(context_id
, true);
1451 if (enter
.succeeded()) {
1452 ToGles2Impl(&enter
)->GetQueryivEXT(target
, pname
, params
);
1456 void GetQueryObjectuivEXT(PP_Resource context_id
,
1460 Enter3D
enter(context_id
, true);
1461 if (enter
.succeeded()) {
1462 ToGles2Impl(&enter
)->GetQueryObjectuivEXT(id
, pname
, params
);
1466 void GenVertexArraysOES(PP_Resource context_id
, GLsizei n
, GLuint
* arrays
) {
1467 Enter3D
enter(context_id
, true);
1468 if (enter
.succeeded()) {
1469 ToGles2Impl(&enter
)->GenVertexArraysOES(n
, arrays
);
1473 void DeleteVertexArraysOES(PP_Resource context_id
,
1475 const GLuint
* arrays
) {
1476 Enter3D
enter(context_id
, true);
1477 if (enter
.succeeded()) {
1478 ToGles2Impl(&enter
)->DeleteVertexArraysOES(n
, arrays
);
1482 GLboolean
IsVertexArrayOES(PP_Resource context_id
, GLuint array
) {
1483 Enter3D
enter(context_id
, true);
1484 if (enter
.succeeded()) {
1485 return ToGles2Impl(&enter
)->IsVertexArrayOES(array
);
1491 void BindVertexArrayOES(PP_Resource context_id
, GLuint array
) {
1492 Enter3D
enter(context_id
, true);
1493 if (enter
.succeeded()) {
1494 ToGles2Impl(&enter
)->BindVertexArrayOES(array
);
1498 GLboolean
EnableFeatureCHROMIUM(PP_Resource context_id
, const char* feature
) {
1499 Enter3D
enter(context_id
, true);
1500 if (enter
.succeeded()) {
1501 return ToGles2Impl(&enter
)->EnableFeatureCHROMIUM(feature
);
1507 void* MapBufferSubDataCHROMIUM(PP_Resource context_id
,
1512 Enter3D
enter(context_id
, true);
1513 if (enter
.succeeded()) {
1514 return ToGles2Impl(&enter
)
1515 ->MapBufferSubDataCHROMIUM(target
, offset
, size
, access
);
1521 void UnmapBufferSubDataCHROMIUM(PP_Resource context_id
, const void* mem
) {
1522 Enter3D
enter(context_id
, true);
1523 if (enter
.succeeded()) {
1524 ToGles2Impl(&enter
)->UnmapBufferSubDataCHROMIUM(mem
);
1528 void* MapTexSubImage2DCHROMIUM(PP_Resource context_id
,
1538 Enter3D
enter(context_id
, true);
1539 if (enter
.succeeded()) {
1540 return ToGles2Impl(&enter
)->MapTexSubImage2DCHROMIUM(
1541 target
, level
, xoffset
, yoffset
, width
, height
, format
, type
, access
);
1547 void UnmapTexSubImage2DCHROMIUM(PP_Resource context_id
, const void* mem
) {
1548 Enter3D
enter(context_id
, true);
1549 if (enter
.succeeded()) {
1550 ToGles2Impl(&enter
)->UnmapTexSubImage2DCHROMIUM(mem
);
1554 void DrawArraysInstancedANGLE(PP_Resource context_id
,
1558 GLsizei primcount
) {
1559 Enter3D
enter(context_id
, true);
1560 if (enter
.succeeded()) {
1562 ->DrawArraysInstancedANGLE(mode
, first
, count
, primcount
);
1566 void DrawElementsInstancedANGLE(PP_Resource context_id
,
1570 const void* indices
,
1571 GLsizei primcount
) {
1572 Enter3D
enter(context_id
, true);
1573 if (enter
.succeeded()) {
1575 ->DrawElementsInstancedANGLE(mode
, count
, type
, indices
, primcount
);
1579 void VertexAttribDivisorANGLE(PP_Resource context_id
,
1582 Enter3D
enter(context_id
, true);
1583 if (enter
.succeeded()) {
1584 ToGles2Impl(&enter
)->VertexAttribDivisorANGLE(index
, divisor
);
1588 void DrawBuffersEXT(PP_Resource context_id
, GLsizei count
, const GLenum
* bufs
) {
1589 Enter3D
enter(context_id
, true);
1590 if (enter
.succeeded()) {
1591 ToGles2Impl(&enter
)->DrawBuffersEXT(count
, bufs
);
1596 const PPB_OpenGLES2
* PPB_OpenGLES2_Shared::GetInterface() {
1597 static const struct PPB_OpenGLES2 ppb_opengles2
= {
1600 &BindAttribLocation
,
1607 &BlendEquationSeparate
,
1612 &CheckFramebufferStatus
,
1619 &CompressedTexImage2D
,
1620 &CompressedTexSubImage2D
,
1627 &DeleteFramebuffers
,
1629 &DeleteRenderbuffers
,
1637 &DisableVertexAttribArray
,
1641 &EnableVertexAttribArray
,
1644 &FramebufferRenderbuffer
,
1645 &FramebufferTexture2D
,
1654 &GetAttachedShaders
,
1657 &GetBufferParameteriv
,
1660 &GetFramebufferAttachmentParameteriv
,
1664 &GetRenderbufferParameteriv
,
1667 &GetShaderPrecisionFormat
,
1674 &GetUniformLocation
,
1677 &GetVertexAttribPointerv
,
1691 &ReleaseShaderCompiler
,
1692 &RenderbufferStorage
,
1698 &StencilFuncSeparate
,
1700 &StencilMaskSeparate
,
1738 &VertexAttribPointer
,
1740 return &ppb_opengles2
;
1742 const PPB_OpenGLES2InstancedArrays
*
1743 PPB_OpenGLES2_Shared::GetInstancedArraysInterface() {
1744 static const struct PPB_OpenGLES2InstancedArrays ppb_opengles2
= {
1745 &DrawArraysInstancedANGLE
,
1746 &DrawElementsInstancedANGLE
,
1747 &VertexAttribDivisorANGLE
};
1748 return &ppb_opengles2
;
1750 const PPB_OpenGLES2FramebufferBlit
*
1751 PPB_OpenGLES2_Shared::GetFramebufferBlitInterface() {
1752 static const struct PPB_OpenGLES2FramebufferBlit ppb_opengles2
= {
1753 &BlitFramebufferEXT
};
1754 return &ppb_opengles2
;
1756 const PPB_OpenGLES2FramebufferMultisample
*
1757 PPB_OpenGLES2_Shared::GetFramebufferMultisampleInterface() {
1758 static const struct PPB_OpenGLES2FramebufferMultisample ppb_opengles2
= {
1759 &RenderbufferStorageMultisampleEXT
};
1760 return &ppb_opengles2
;
1762 const PPB_OpenGLES2ChromiumEnableFeature
*
1763 PPB_OpenGLES2_Shared::GetChromiumEnableFeatureInterface() {
1764 static const struct PPB_OpenGLES2ChromiumEnableFeature ppb_opengles2
= {
1765 &EnableFeatureCHROMIUM
};
1766 return &ppb_opengles2
;
1768 const PPB_OpenGLES2ChromiumMapSub
*
1769 PPB_OpenGLES2_Shared::GetChromiumMapSubInterface() {
1770 static const struct PPB_OpenGLES2ChromiumMapSub ppb_opengles2
= {
1771 &MapBufferSubDataCHROMIUM
,
1772 &UnmapBufferSubDataCHROMIUM
,
1773 &MapTexSubImage2DCHROMIUM
,
1774 &UnmapTexSubImage2DCHROMIUM
};
1775 return &ppb_opengles2
;
1777 const PPB_OpenGLES2Query
* PPB_OpenGLES2_Shared::GetQueryInterface() {
1778 static const struct PPB_OpenGLES2Query ppb_opengles2
= {
1785 &GetQueryObjectuivEXT
};
1786 return &ppb_opengles2
;
1788 const PPB_OpenGLES2VertexArrayObject
*
1789 PPB_OpenGLES2_Shared::GetVertexArrayObjectInterface() {
1790 static const struct PPB_OpenGLES2VertexArrayObject ppb_opengles2
= {
1791 &GenVertexArraysOES
,
1792 &DeleteVertexArraysOES
,
1794 &BindVertexArrayOES
};
1795 return &ppb_opengles2
;
1797 const PPB_OpenGLES2DrawBuffers_Dev
*
1798 PPB_OpenGLES2_Shared::GetDrawBuffersInterface() {
1799 static const struct PPB_OpenGLES2DrawBuffers_Dev ppb_opengles2
= {
1801 return &ppb_opengles2
;
1803 } // namespace ppapi