diff options
author | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-21 17:12:55 +0000 |
---|---|---|
committer | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-21 17:12:55 +0000 |
commit | 3e9d8aa0bbf6e2ed8d093e17c92cacff383c7e4f (patch) | |
tree | ab4483673b5886ee5b821bccb8ecbee2c5922ffd /webkit | |
parent | e5b826e46e8a435945f94370bd50bc7ee1749607 (diff) | |
download | chromium_src-3e9d8aa0bbf6e2ed8d093e17c92cacff383c7e4f.zip chromium_src-3e9d8aa0bbf6e2ed8d093e17c92cacff383c7e4f.tar.gz chromium_src-3e9d8aa0bbf6e2ed8d093e17c92cacff383c7e4f.tar.bz2 |
Moved the logic of maintaining the current context to gles2 helper library.
Review URL: http://codereview.chromium.org/5927002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69838 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/webkit_glue.gypi | 2 | ||||
-rw-r--r-- | webkit/plugins/ppapi/plugin_module.cc | 4 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_graphics_3d_impl.cc | 56 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_graphics_3d_impl.h | 10 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_open_gl_es_impl.cc | 673 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_opengles_impl.cc | 1147 |
6 files changed, 1154 insertions, 738 deletions
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index b45bf85..b0668c9 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -293,7 +293,7 @@ '../plugins/ppapi/ppb_image_data_impl.h', '../plugins/ppapi/ppb_nacl_private_impl.cc', '../plugins/ppapi/ppb_nacl_private_impl.h', - '../plugins/ppapi/ppb_open_gl_es_impl.cc', + '../plugins/ppapi/ppb_opengles_impl.cc', '../plugins/ppapi/ppb_pdf.h', '../plugins/ppapi/ppb_pdf_impl.cc', '../plugins/ppapi/ppb_pdf_impl.h', diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc index 82ead74..d32be39 100644 --- a/webkit/plugins/ppapi/plugin_module.cc +++ b/webkit/plugins/ppapi/plugin_module.cc @@ -283,8 +283,8 @@ const void* GetInterface(const char* name) { if (!CommandLine::ForCurrentProcess()->HasSwitch("disable-3d-apis")) { if (strcmp(name, PPB_GRAPHICS_3D_DEV_INTERFACE) == 0) return PPB_Graphics3D_Impl::GetInterface(); - if (strcmp(name, PPB_OPENGLES_DEV_INTERFACE) == 0) - return PPB_Graphics3D_Impl::GetOpenGLESInterface(); + if (strcmp(name, PPB_OPENGLES2_DEV_INTERFACE) == 0) + return PPB_Graphics3D_Impl::GetOpenGLES2Interface(); } #endif // ENABLE_GPU diff --git a/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc b/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc index 0355262..a10274e 100644 --- a/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc +++ b/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc @@ -5,8 +5,6 @@ #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" #include "gpu/command_buffer/common/command_buffer.h" -#include "base/lazy_instance.h" -#include "base/thread_local.h" #include "ppapi/c/dev/ppb_graphics_3d_dev.h" #include "webkit/plugins/ppapi/common.h" #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" @@ -16,9 +14,6 @@ namespace ppapi { namespace { -static base::LazyInstance<base::ThreadLocalPointer<PPB_Graphics3D_Impl> > - g_current_context_key(base::LINKER_INITIALIZED); - // Size of the transfer buffer. enum { kTransferBufferSize = 512 * 1024 }; @@ -81,22 +76,6 @@ void* GetProcAddress(const char* name) { return NULL; } -PP_Bool MakeCurrent(PP_Resource graphics3d) { - if (!graphics3d) { - PPB_Graphics3D_Impl::ResetCurrent(); - return PP_TRUE; - } else { - scoped_refptr<PPB_Graphics3D_Impl> context( - Resource::GetAs<PPB_Graphics3D_Impl>(graphics3d)); - return BoolToPPBool(context.get() && context->MakeCurrent()); - } -} - -PP_Resource GetCurrentContext() { - PPB_Graphics3D_Impl* current_context = PPB_Graphics3D_Impl::GetCurrent(); - return current_context ? current_context->GetReference() : 0; -} - PP_Bool SwapBuffers(PP_Resource graphics3d) { scoped_refptr<PPB_Graphics3D_Impl> context( Resource::GetAs<PPB_Graphics3D_Impl>(graphics3d)); @@ -104,14 +83,8 @@ PP_Bool SwapBuffers(PP_Resource graphics3d) { } uint32_t GetError() { - // Technically, this should return the last error that occurred on the current - // thread, rather than an error associated with a particular context. - // TODO(apatrick): Fix this. - PPB_Graphics3D_Impl* current_context = PPB_Graphics3D_Impl::GetCurrent(); - if (!current_context) - return 0; - - return current_context->GetError(); + // TODO(alokp): Fix this. + return 0; } const PPB_Graphics3D_Dev ppb_graphics3d = { @@ -122,8 +95,6 @@ const PPB_Graphics3D_Dev ppb_graphics3d = { &QueryString, &CreateContext, &GetProcAddress, - &MakeCurrent, - &GetCurrentContext, &SwapBuffers, &GetError }; @@ -139,14 +110,6 @@ const PPB_Graphics3D_Dev* PPB_Graphics3D_Impl::GetInterface() { return &ppb_graphics3d; } -PPB_Graphics3D_Impl* PPB_Graphics3D_Impl::GetCurrent() { - return g_current_context_key.Get().Get(); -} - -void PPB_Graphics3D_Impl::ResetCurrent() { - g_current_context_key.Get().Set(NULL); -} - PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() { Destroy(); } @@ -203,16 +166,6 @@ bool PPB_Graphics3D_Impl::BindToInstance(PluginInstance* new_instance) { return true; } -bool PPB_Graphics3D_Impl::MakeCurrent() { - if (!platform_context_.get()) - return false; - - g_current_context_key.Get().Set(this); - - // TODO(apatrick): Return false on context lost. - return true; -} - bool PPB_Graphics3D_Impl::SwapBuffers() { if (!platform_context_.get()) return false; @@ -249,12 +202,7 @@ unsigned PPB_Graphics3D_Impl::GetBackingTextureId() { } void PPB_Graphics3D_Impl::Destroy() { - if (GetCurrent() == this) { - ResetCurrent(); - } - gles2_implementation_ = NULL; - platform_context_.reset(); } diff --git a/webkit/plugins/ppapi/ppb_graphics_3d_impl.h b/webkit/plugins/ppapi/ppb_graphics_3d_impl.h index 8124979..d4a49d6 100644 --- a/webkit/plugins/ppapi/ppb_graphics_3d_impl.h +++ b/webkit/plugins/ppapi/ppb_graphics_3d_impl.h @@ -22,7 +22,7 @@ class GLES2Implementation; } // namespace gpu struct PPB_Graphics3D_Dev; -struct PPB_OpenGLES_Dev; +struct PPB_OpenGLES2_Dev; namespace webkit { namespace ppapi { @@ -34,14 +34,10 @@ class PPB_Graphics3D_Impl : public Resource { virtual ~PPB_Graphics3D_Impl(); static const PPB_Graphics3D_Dev* GetInterface(); - static const PPB_OpenGLES_Dev* GetOpenGLESInterface(); + static const PPB_OpenGLES2_Dev* GetOpenGLES2Interface(); static bool Shutdown(); - static PPB_Graphics3D_Impl* GetCurrent(); - - static void ResetCurrent(); - // Resource override. virtual PPB_Graphics3D_Impl* AsPPB_Graphics3D_Impl(); @@ -54,8 +50,6 @@ class PPB_Graphics3D_Impl : public Resource { // TODO(apatrick): Figure out the best semantics here. bool BindToInstance(PluginInstance* new_instance); - bool MakeCurrent(); - bool SwapBuffers(); unsigned GetError(); diff --git a/webkit/plugins/ppapi/ppb_open_gl_es_impl.cc b/webkit/plugins/ppapi/ppb_open_gl_es_impl.cc deleted file mode 100644 index 8d64168..0000000 --- a/webkit/plugins/ppapi/ppb_open_gl_es_impl.cc +++ /dev/null @@ -1,673 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This file is auto-generated. DO NOT EDIT! - -#include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" - -#include "gpu/command_buffer/client/gles2_implementation.h" -#include "ppapi/c/dev/ppb_opengles_dev.h" - -namespace webkit { -namespace ppapi { - -namespace { - -void ActiveTexture(GLenum texture) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->ActiveTexture(texture); -} -void AttachShader(GLuint program, GLuint shader) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->AttachShader(program, shader); -} -void BindAttribLocation(GLuint program, GLuint index, const char* name) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->BindAttribLocation(program, index, name); -} -void BindBuffer(GLenum target, GLuint buffer) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->BindBuffer(target, buffer); -} -void BindFramebuffer(GLenum target, GLuint framebuffer) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->BindFramebuffer(target, framebuffer); -} -void BindRenderbuffer(GLenum target, GLuint renderbuffer) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->BindRenderbuffer(target, renderbuffer); -} -void BindTexture(GLenum target, GLuint texture) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->BindTexture(target, texture); -} -void BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->BlendColor(red, green, blue, alpha); -} -void BlendEquation(GLenum mode) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->BlendEquation(mode); -} -void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->BlendEquationSeparate(modeRGB, modeAlpha); -} -void BlendFunc(GLenum sfactor, GLenum dfactor) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->BlendFunc(sfactor, dfactor); -} -void BlendFuncSeparate( - GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->BlendFuncSeparate( - srcRGB, dstRGB, srcAlpha, dstAlpha); -} -void BufferData( - GLenum target, GLsizeiptr size, const void* data, GLenum usage) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->BufferData(target, size, data, usage); -} -void BufferSubData( - GLenum target, GLintptr offset, GLsizeiptr size, const void* data) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->BufferSubData(target, offset, size, data); -} -GLenum CheckFramebufferStatus(GLenum target) { - return PPB_Graphics3D_Impl::GetCurrent()->impl()->CheckFramebufferStatus(target); -} -void Clear(GLbitfield mask) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Clear(mask); -} -void ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->ClearColor(red, green, blue, alpha); -} -void ClearDepthf(GLclampf depth) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->ClearDepthf(depth); -} -void ClearStencil(GLint s) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->ClearStencil(s); -} -void ColorMask( - GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->ColorMask(red, green, blue, alpha); -} -void CompileShader(GLuint shader) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->CompileShader(shader); -} -void CompressedTexImage2D( - GLenum target, GLint level, GLenum internalformat, GLsizei width, - GLsizei height, GLint border, GLsizei imageSize, const void* data) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->CompressedTexImage2D( - target, level, internalformat, width, height, border, imageSize, data); -} -void CompressedTexSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLsizei imageSize, const void* data) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->CompressedTexSubImage2D( - target, level, xoffset, yoffset, width, height, format, imageSize, data); -} -void CopyTexImage2D( - GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, - GLsizei width, GLsizei height, GLint border) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->CopyTexImage2D( - target, level, internalformat, x, y, width, height, border); -} -void CopyTexSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, - GLsizei width, GLsizei height) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->CopyTexSubImage2D( - target, level, xoffset, yoffset, x, y, width, height); -} -GLuint CreateProgram() { - return PPB_Graphics3D_Impl::GetCurrent()->impl()->CreateProgram(); -} -GLuint CreateShader(GLenum type) { - return PPB_Graphics3D_Impl::GetCurrent()->impl()->CreateShader(type); -} -void CullFace(GLenum mode) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->CullFace(mode); -} -void DeleteBuffers(GLsizei n, const GLuint* buffers) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->DeleteBuffers(n, buffers); -} -void DeleteFramebuffers(GLsizei n, const GLuint* framebuffers) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->DeleteFramebuffers(n, framebuffers); -} -void DeleteProgram(GLuint program) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->DeleteProgram(program); -} -void DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->DeleteRenderbuffers(n, renderbuffers); -} -void DeleteShader(GLuint shader) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->DeleteShader(shader); -} -void DeleteTextures(GLsizei n, const GLuint* textures) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->DeleteTextures(n, textures); -} -void DepthFunc(GLenum func) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->DepthFunc(func); -} -void DepthMask(GLboolean flag) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->DepthMask(flag); -} -void DepthRangef(GLclampf zNear, GLclampf zFar) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->DepthRangef(zNear, zFar); -} -void DetachShader(GLuint program, GLuint shader) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->DetachShader(program, shader); -} -void Disable(GLenum cap) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Disable(cap); -} -void DisableVertexAttribArray(GLuint index) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->DisableVertexAttribArray(index); -} -void DrawArrays(GLenum mode, GLint first, GLsizei count) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->DrawArrays(mode, first, count); -} -void DrawElements( - GLenum mode, GLsizei count, GLenum type, const void* indices) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->DrawElements(mode, count, type, indices); -} -void Enable(GLenum cap) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Enable(cap); -} -void EnableVertexAttribArray(GLuint index) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->EnableVertexAttribArray(index); -} -void Finish() { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Finish(); -} -void Flush() { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Flush(); -} -void FramebufferRenderbuffer( - GLenum target, GLenum attachment, GLenum renderbuffertarget, - GLuint renderbuffer) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->FramebufferRenderbuffer( - target, attachment, renderbuffertarget, renderbuffer); -} -void FramebufferTexture2D( - GLenum target, GLenum attachment, GLenum textarget, GLuint texture, - GLint level) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->FramebufferTexture2D( - target, attachment, textarget, texture, level); -} -void FrontFace(GLenum mode) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->FrontFace(mode); -} -void GenBuffers(GLsizei n, GLuint* buffers) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GenBuffers(n, buffers); -} -void GenerateMipmap(GLenum target) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GenerateMipmap(target); -} -void GenFramebuffers(GLsizei n, GLuint* framebuffers) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GenFramebuffers(n, framebuffers); -} -void GenRenderbuffers(GLsizei n, GLuint* renderbuffers) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GenRenderbuffers(n, renderbuffers); -} -void GenTextures(GLsizei n, GLuint* textures) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GenTextures(n, textures); -} -void GetActiveAttrib( - GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, - GLenum* type, char* name) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetActiveAttrib( - program, index, bufsize, length, size, type, name); -} -void GetActiveUniform( - GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, - GLenum* type, char* name) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetActiveUniform( - program, index, bufsize, length, size, type, name); -} -void GetAttachedShaders( - GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetAttachedShaders( - program, maxcount, count, shaders); -} -GLint GetAttribLocation(GLuint program, const char* name) { - return PPB_Graphics3D_Impl::GetCurrent()->impl()->GetAttribLocation(program, name); -} -void GetBooleanv(GLenum pname, GLboolean* params) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetBooleanv(pname, params); -} -void GetBufferParameteriv(GLenum target, GLenum pname, GLint* params) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetBufferParameteriv( - target, pname, params); -} -GLenum GetError() { - return PPB_Graphics3D_Impl::GetCurrent()->impl()->GetError(); -} -void GetFloatv(GLenum pname, GLfloat* params) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetFloatv(pname, params); -} -void GetFramebufferAttachmentParameteriv( - GLenum target, GLenum attachment, GLenum pname, GLint* params) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetFramebufferAttachmentParameteriv( - target, attachment, pname, params); -} -void GetIntegerv(GLenum pname, GLint* params) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetIntegerv(pname, params); -} -void GetProgramiv(GLuint program, GLenum pname, GLint* params) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetProgramiv(program, pname, params); -} -void GetProgramInfoLog( - GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetProgramInfoLog( - program, bufsize, length, infolog); -} -void GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetRenderbufferParameteriv( - target, pname, params); -} -void GetShaderiv(GLuint shader, GLenum pname, GLint* params) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetShaderiv(shader, pname, params); -} -void GetShaderInfoLog( - GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetShaderInfoLog( - shader, bufsize, length, infolog); -} -void GetShaderPrecisionFormat( - GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetShaderPrecisionFormat( - shadertype, precisiontype, range, precision); -} -void GetShaderSource( - GLuint shader, GLsizei bufsize, GLsizei* length, char* source) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetShaderSource( - shader, bufsize, length, source); -} -const GLubyte* GetString(GLenum name) { - return PPB_Graphics3D_Impl::GetCurrent()->impl()->GetString(name); -} -void GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetTexParameterfv(target, pname, params); -} -void GetTexParameteriv(GLenum target, GLenum pname, GLint* params) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetTexParameteriv(target, pname, params); -} -void GetUniformfv(GLuint program, GLint location, GLfloat* params) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetUniformfv(program, location, params); -} -void GetUniformiv(GLuint program, GLint location, GLint* params) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetUniformiv(program, location, params); -} -GLint GetUniformLocation(GLuint program, const char* name) { - return PPB_Graphics3D_Impl::GetCurrent()->impl()->GetUniformLocation(program, name); -} -void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetVertexAttribfv(index, pname, params); -} -void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetVertexAttribiv(index, pname, params); -} -void GetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->GetVertexAttribPointerv( - index, pname, pointer); -} -void Hint(GLenum target, GLenum mode) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Hint(target, mode); -} -GLboolean IsBuffer(GLuint buffer) { - return PPB_Graphics3D_Impl::GetCurrent()->impl()->IsBuffer(buffer); -} -GLboolean IsEnabled(GLenum cap) { - return PPB_Graphics3D_Impl::GetCurrent()->impl()->IsEnabled(cap); -} -GLboolean IsFramebuffer(GLuint framebuffer) { - return PPB_Graphics3D_Impl::GetCurrent()->impl()->IsFramebuffer(framebuffer); -} -GLboolean IsProgram(GLuint program) { - return PPB_Graphics3D_Impl::GetCurrent()->impl()->IsProgram(program); -} -GLboolean IsRenderbuffer(GLuint renderbuffer) { - return PPB_Graphics3D_Impl::GetCurrent()->impl()->IsRenderbuffer(renderbuffer); -} -GLboolean IsShader(GLuint shader) { - return PPB_Graphics3D_Impl::GetCurrent()->impl()->IsShader(shader); -} -GLboolean IsTexture(GLuint texture) { - return PPB_Graphics3D_Impl::GetCurrent()->impl()->IsTexture(texture); -} -void LineWidth(GLfloat width) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->LineWidth(width); -} -void LinkProgram(GLuint program) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->LinkProgram(program); -} -void PixelStorei(GLenum pname, GLint param) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->PixelStorei(pname, param); -} -void PolygonOffset(GLfloat factor, GLfloat units) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->PolygonOffset(factor, units); -} -void ReadPixels( - GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, - void* pixels) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->ReadPixels( - x, y, width, height, format, type, pixels); -} -void ReleaseShaderCompiler() { - PPB_Graphics3D_Impl::GetCurrent()->impl()->ReleaseShaderCompiler(); -} -void RenderbufferStorage( - GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->RenderbufferStorage( - target, internalformat, width, height); -} -void SampleCoverage(GLclampf value, GLboolean invert) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->SampleCoverage(value, invert); -} -void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Scissor(x, y, width, height); -} -void ShaderBinary( - GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, - GLsizei length) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->ShaderBinary( - n, shaders, binaryformat, binary, length); -} -void ShaderSource( - GLuint shader, GLsizei count, const char** str, const GLint* length) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->ShaderSource(shader, count, str, length); -} -void StencilFunc(GLenum func, GLint ref, GLuint mask) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->StencilFunc(func, ref, mask); -} -void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->StencilFuncSeparate(face, func, ref, mask); -} -void StencilMask(GLuint mask) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->StencilMask(mask); -} -void StencilMaskSeparate(GLenum face, GLuint mask) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->StencilMaskSeparate(face, mask); -} -void StencilOp(GLenum fail, GLenum zfail, GLenum zpass) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->StencilOp(fail, zfail, zpass); -} -void StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->StencilOpSeparate( - face, fail, zfail, zpass); -} -void TexImage2D( - GLenum target, GLint level, GLint internalformat, GLsizei width, - GLsizei height, GLint border, GLenum format, GLenum type, - const void* pixels) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->TexImage2D( - target, level, internalformat, width, height, border, format, type, - pixels); -} -void TexParameterf(GLenum target, GLenum pname, GLfloat param) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->TexParameterf(target, pname, param); -} -void TexParameterfv(GLenum target, GLenum pname, const GLfloat* params) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->TexParameterfv(target, pname, params); -} -void TexParameteri(GLenum target, GLenum pname, GLint param) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->TexParameteri(target, pname, param); -} -void TexParameteriv(GLenum target, GLenum pname, const GLint* params) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->TexParameteriv(target, pname, params); -} -void TexSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, const void* pixels) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->TexSubImage2D( - target, level, xoffset, yoffset, width, height, format, type, pixels); -} -void Uniform1f(GLint location, GLfloat x) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Uniform1f(location, x); -} -void Uniform1fv(GLint location, GLsizei count, const GLfloat* v) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Uniform1fv(location, count, v); -} -void Uniform1i(GLint location, GLint x) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Uniform1i(location, x); -} -void Uniform1iv(GLint location, GLsizei count, const GLint* v) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Uniform1iv(location, count, v); -} -void Uniform2f(GLint location, GLfloat x, GLfloat y) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Uniform2f(location, x, y); -} -void Uniform2fv(GLint location, GLsizei count, const GLfloat* v) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Uniform2fv(location, count, v); -} -void Uniform2i(GLint location, GLint x, GLint y) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Uniform2i(location, x, y); -} -void Uniform2iv(GLint location, GLsizei count, const GLint* v) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Uniform2iv(location, count, v); -} -void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Uniform3f(location, x, y, z); -} -void Uniform3fv(GLint location, GLsizei count, const GLfloat* v) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Uniform3fv(location, count, v); -} -void Uniform3i(GLint location, GLint x, GLint y, GLint z) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Uniform3i(location, x, y, z); -} -void Uniform3iv(GLint location, GLsizei count, const GLint* v) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Uniform3iv(location, count, v); -} -void Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Uniform4f(location, x, y, z, w); -} -void Uniform4fv(GLint location, GLsizei count, const GLfloat* v) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Uniform4fv(location, count, v); -} -void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Uniform4i(location, x, y, z, w); -} -void Uniform4iv(GLint location, GLsizei count, const GLint* v) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Uniform4iv(location, count, v); -} -void UniformMatrix2fv( - GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->UniformMatrix2fv( - location, count, transpose, value); -} -void UniformMatrix3fv( - GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->UniformMatrix3fv( - location, count, transpose, value); -} -void UniformMatrix4fv( - GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->UniformMatrix4fv( - location, count, transpose, value); -} -void UseProgram(GLuint program) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->UseProgram(program); -} -void ValidateProgram(GLuint program) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->ValidateProgram(program); -} -void VertexAttrib1f(GLuint indx, GLfloat x) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->VertexAttrib1f(indx, x); -} -void VertexAttrib1fv(GLuint indx, const GLfloat* values) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->VertexAttrib1fv(indx, values); -} -void VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->VertexAttrib2f(indx, x, y); -} -void VertexAttrib2fv(GLuint indx, const GLfloat* values) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->VertexAttrib2fv(indx, values); -} -void VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->VertexAttrib3f(indx, x, y, z); -} -void VertexAttrib3fv(GLuint indx, const GLfloat* values) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->VertexAttrib3fv(indx, values); -} -void VertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->VertexAttrib4f(indx, x, y, z, w); -} -void VertexAttrib4fv(GLuint indx, const GLfloat* values) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->VertexAttrib4fv(indx, values); -} -void VertexAttribPointer( - GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, - const void* ptr) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->VertexAttribPointer( - indx, size, type, normalized, stride, ptr); -} -void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) { - PPB_Graphics3D_Impl::GetCurrent()->impl()->Viewport(x, y, width, height); -} -void SwapBuffers() { - PPB_Graphics3D_Impl::GetCurrent()->impl()->SwapBuffers(); -} - -const struct PPB_OpenGLES_Dev ppb_opengles = { - &ActiveTexture, - &AttachShader, - &BindAttribLocation, - &BindBuffer, - &BindFramebuffer, - &BindRenderbuffer, - &BindTexture, - &BlendColor, - &BlendEquation, - &BlendEquationSeparate, - &BlendFunc, - &BlendFuncSeparate, - &BufferData, - &BufferSubData, - &CheckFramebufferStatus, - &Clear, - &ClearColor, - &ClearDepthf, - &ClearStencil, - &ColorMask, - &CompileShader, - &CompressedTexImage2D, - &CompressedTexSubImage2D, - &CopyTexImage2D, - &CopyTexSubImage2D, - &CreateProgram, - &CreateShader, - &CullFace, - &DeleteBuffers, - &DeleteFramebuffers, - &DeleteProgram, - &DeleteRenderbuffers, - &DeleteShader, - &DeleteTextures, - &DepthFunc, - &DepthMask, - &DepthRangef, - &DetachShader, - &Disable, - &DisableVertexAttribArray, - &DrawArrays, - &DrawElements, - &Enable, - &EnableVertexAttribArray, - &Finish, - &Flush, - &FramebufferRenderbuffer, - &FramebufferTexture2D, - &FrontFace, - &GenBuffers, - &GenerateMipmap, - &GenFramebuffers, - &GenRenderbuffers, - &GenTextures, - &GetActiveAttrib, - &GetActiveUniform, - &GetAttachedShaders, - &GetAttribLocation, - &GetBooleanv, - &GetBufferParameteriv, - &GetError, - &GetFloatv, - &GetFramebufferAttachmentParameteriv, - &GetIntegerv, - &GetProgramiv, - &GetProgramInfoLog, - &GetRenderbufferParameteriv, - &GetShaderiv, - &GetShaderInfoLog, - &GetShaderPrecisionFormat, - &GetShaderSource, - &GetString, - &GetTexParameterfv, - &GetTexParameteriv, - &GetUniformfv, - &GetUniformiv, - &GetUniformLocation, - &GetVertexAttribfv, - &GetVertexAttribiv, - &GetVertexAttribPointerv, - &Hint, - &IsBuffer, - &IsEnabled, - &IsFramebuffer, - &IsProgram, - &IsRenderbuffer, - &IsShader, - &IsTexture, - &LineWidth, - &LinkProgram, - &PixelStorei, - &PolygonOffset, - &ReadPixels, - &ReleaseShaderCompiler, - &RenderbufferStorage, - &SampleCoverage, - &Scissor, - &ShaderBinary, - &ShaderSource, - &StencilFunc, - &StencilFuncSeparate, - &StencilMask, - &StencilMaskSeparate, - &StencilOp, - &StencilOpSeparate, - &TexImage2D, - &TexParameterf, - &TexParameterfv, - &TexParameteri, - &TexParameteriv, - &TexSubImage2D, - &Uniform1f, - &Uniform1fv, - &Uniform1i, - &Uniform1iv, - &Uniform2f, - &Uniform2fv, - &Uniform2i, - &Uniform2iv, - &Uniform3f, - &Uniform3fv, - &Uniform3i, - &Uniform3iv, - &Uniform4f, - &Uniform4fv, - &Uniform4i, - &Uniform4iv, - &UniformMatrix2fv, - &UniformMatrix3fv, - &UniformMatrix4fv, - &UseProgram, - &ValidateProgram, - &VertexAttrib1f, - &VertexAttrib1fv, - &VertexAttrib2f, - &VertexAttrib2fv, - &VertexAttrib3f, - &VertexAttrib3fv, - &VertexAttrib4f, - &VertexAttrib4fv, - &VertexAttribPointer, - &Viewport, - &SwapBuffers -}; - -} // namespace - -const PPB_OpenGLES_Dev* PPB_Graphics3D_Impl::GetOpenGLESInterface() { - return &ppb_opengles; -} - -} // namespace ppapi -} // namespace webkit - diff --git a/webkit/plugins/ppapi/ppb_opengles_impl.cc b/webkit/plugins/ppapi/ppb_opengles_impl.cc new file mode 100644 index 0000000..e56eb9c --- /dev/null +++ b/webkit/plugins/ppapi/ppb_opengles_impl.cc @@ -0,0 +1,1147 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file is auto-generated. DO NOT EDIT! + +#include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" + +#include "gpu/command_buffer/client/gles2_implementation.h" +#include "ppapi/c/dev/ppb_opengles_dev.h" + +namespace webkit { +namespace ppapi { + +namespace { + +void ActiveTexture(PP_Resource context, GLenum texture) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->ActiveTexture(texture); +} + +void AttachShader(PP_Resource context, GLuint program, GLuint shader) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->AttachShader(program, shader); +} + +void BindAttribLocation( + PP_Resource context, GLuint program, GLuint index, const char* name) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->BindAttribLocation(program, index, name); +} + +void BindBuffer(PP_Resource context, GLenum target, GLuint buffer) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->BindBuffer(target, buffer); +} + +void BindFramebuffer(PP_Resource context, GLenum target, GLuint framebuffer) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->BindFramebuffer(target, framebuffer); +} + +void BindRenderbuffer( + PP_Resource context, GLenum target, GLuint renderbuffer) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->BindRenderbuffer(target, renderbuffer); +} + +void BindTexture(PP_Resource context, GLenum target, GLuint texture) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->BindTexture(target, texture); +} + +void BlendColor( + PP_Resource context, GLclampf red, GLclampf green, GLclampf blue, + GLclampf alpha) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->BlendColor(red, green, blue, alpha); +} + +void BlendEquation(PP_Resource context, GLenum mode) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->BlendEquation(mode); +} + +void BlendEquationSeparate( + PP_Resource context, GLenum modeRGB, GLenum modeAlpha) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->BlendEquationSeparate(modeRGB, modeAlpha); +} + +void BlendFunc(PP_Resource context, GLenum sfactor, GLenum dfactor) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->BlendFunc(sfactor, dfactor); +} + +void BlendFuncSeparate( + PP_Resource context, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, + GLenum dstAlpha) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); +} + +void BufferData( + PP_Resource context, GLenum target, GLsizeiptr size, const void* data, + GLenum usage) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->BufferData(target, size, data, usage); +} + +void BufferSubData( + PP_Resource context, GLenum target, GLintptr offset, GLsizeiptr size, + const void* data) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->BufferSubData(target, offset, size, data); +} + +GLenum CheckFramebufferStatus(PP_Resource context, GLenum target) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + return graphics_3d->impl()->CheckFramebufferStatus(target); +} + +void Clear(PP_Resource context, GLbitfield mask) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Clear(mask); +} + +void ClearColor( + PP_Resource context, GLclampf red, GLclampf green, GLclampf blue, + GLclampf alpha) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->ClearColor(red, green, blue, alpha); +} + +void ClearDepthf(PP_Resource context, GLclampf depth) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->ClearDepthf(depth); +} + +void ClearStencil(PP_Resource context, GLint s) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->ClearStencil(s); +} + +void ColorMask( + PP_Resource context, GLboolean red, GLboolean green, GLboolean blue, + GLboolean alpha) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->ColorMask(red, green, blue, alpha); +} + +void CompileShader(PP_Resource context, GLuint shader) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->CompileShader(shader); +} + +void CompressedTexImage2D( + PP_Resource context, GLenum target, GLint level, GLenum internalformat, + GLsizei width, GLsizei height, GLint border, GLsizei imageSize, + const void* data) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->CompressedTexImage2D( + target, level, internalformat, width, height, border, imageSize, data); +} + +void CompressedTexSubImage2D( + PP_Resource context, GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLsizei width, GLsizei height, GLenum format, + GLsizei imageSize, const void* data) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->CompressedTexSubImage2D( + target, level, xoffset, yoffset, width, height, format, imageSize, data); +} + +void CopyTexImage2D( + PP_Resource context, GLenum target, GLint level, GLenum internalformat, + GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->CopyTexImage2D( + target, level, internalformat, x, y, width, height, border); +} + +void CopyTexSubImage2D( + PP_Resource context, GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->CopyTexSubImage2D( + target, level, xoffset, yoffset, x, y, width, height); +} + +GLuint CreateProgram(PP_Resource context) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + return graphics_3d->impl()->CreateProgram(); +} + +GLuint CreateShader(PP_Resource context, GLenum type) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + return graphics_3d->impl()->CreateShader(type); +} + +void CullFace(PP_Resource context, GLenum mode) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->CullFace(mode); +} + +void DeleteBuffers(PP_Resource context, GLsizei n, const GLuint* buffers) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->DeleteBuffers(n, buffers); +} + +void DeleteFramebuffers( + PP_Resource context, GLsizei n, const GLuint* framebuffers) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->DeleteFramebuffers(n, framebuffers); +} + +void DeleteProgram(PP_Resource context, GLuint program) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->DeleteProgram(program); +} + +void DeleteRenderbuffers( + PP_Resource context, GLsizei n, const GLuint* renderbuffers) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->DeleteRenderbuffers(n, renderbuffers); +} + +void DeleteShader(PP_Resource context, GLuint shader) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->DeleteShader(shader); +} + +void DeleteTextures(PP_Resource context, GLsizei n, const GLuint* textures) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->DeleteTextures(n, textures); +} + +void DepthFunc(PP_Resource context, GLenum func) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->DepthFunc(func); +} + +void DepthMask(PP_Resource context, GLboolean flag) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->DepthMask(flag); +} + +void DepthRangef(PP_Resource context, GLclampf zNear, GLclampf zFar) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->DepthRangef(zNear, zFar); +} + +void DetachShader(PP_Resource context, GLuint program, GLuint shader) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->DetachShader(program, shader); +} + +void Disable(PP_Resource context, GLenum cap) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Disable(cap); +} + +void DisableVertexAttribArray(PP_Resource context, GLuint index) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->DisableVertexAttribArray(index); +} + +void DrawArrays(PP_Resource context, GLenum mode, GLint first, GLsizei count) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->DrawArrays(mode, first, count); +} + +void DrawElements( + PP_Resource context, GLenum mode, GLsizei count, GLenum type, + const void* indices) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->DrawElements(mode, count, type, indices); +} + +void Enable(PP_Resource context, GLenum cap) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Enable(cap); +} + +void EnableVertexAttribArray(PP_Resource context, GLuint index) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->EnableVertexAttribArray(index); +} + +void Finish(PP_Resource context) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Finish(); +} + +void Flush(PP_Resource context) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Flush(); +} + +void FramebufferRenderbuffer( + PP_Resource context, GLenum target, GLenum attachment, + GLenum renderbuffertarget, GLuint renderbuffer) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->FramebufferRenderbuffer( + target, attachment, renderbuffertarget, renderbuffer); +} + +void FramebufferTexture2D( + PP_Resource context, GLenum target, GLenum attachment, GLenum textarget, + GLuint texture, GLint level) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->FramebufferTexture2D( + target, attachment, textarget, texture, level); +} + +void FrontFace(PP_Resource context, GLenum mode) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->FrontFace(mode); +} + +void GenBuffers(PP_Resource context, GLsizei n, GLuint* buffers) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GenBuffers(n, buffers); +} + +void GenerateMipmap(PP_Resource context, GLenum target) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GenerateMipmap(target); +} + +void GenFramebuffers(PP_Resource context, GLsizei n, GLuint* framebuffers) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GenFramebuffers(n, framebuffers); +} + +void GenRenderbuffers(PP_Resource context, GLsizei n, GLuint* renderbuffers) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GenRenderbuffers(n, renderbuffers); +} + +void GenTextures(PP_Resource context, GLsizei n, GLuint* textures) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GenTextures(n, textures); +} + +void GetActiveAttrib( + PP_Resource context, GLuint program, GLuint index, GLsizei bufsize, + GLsizei* length, GLint* size, GLenum* type, char* name) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetActiveAttrib( + program, index, bufsize, length, size, type, name); +} + +void GetActiveUniform( + PP_Resource context, GLuint program, GLuint index, GLsizei bufsize, + GLsizei* length, GLint* size, GLenum* type, char* name) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetActiveUniform( + program, index, bufsize, length, size, type, name); +} + +void GetAttachedShaders( + PP_Resource context, GLuint program, GLsizei maxcount, GLsizei* count, + GLuint* shaders) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetAttachedShaders(program, maxcount, count, shaders); +} + +GLint GetAttribLocation( + PP_Resource context, GLuint program, const char* name) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + return graphics_3d->impl()->GetAttribLocation(program, name); +} + +void GetBooleanv(PP_Resource context, GLenum pname, GLboolean* params) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetBooleanv(pname, params); +} + +void GetBufferParameteriv( + PP_Resource context, GLenum target, GLenum pname, GLint* params) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetBufferParameteriv(target, pname, params); +} + +GLenum GetError(PP_Resource context) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + return graphics_3d->impl()->GetError(); +} + +void GetFloatv(PP_Resource context, GLenum pname, GLfloat* params) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetFloatv(pname, params); +} + +void GetFramebufferAttachmentParameteriv( + PP_Resource context, GLenum target, GLenum attachment, GLenum pname, + GLint* params) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetFramebufferAttachmentParameteriv( + target, attachment, pname, params); +} + +void GetIntegerv(PP_Resource context, GLenum pname, GLint* params) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetIntegerv(pname, params); +} + +void GetProgramiv( + PP_Resource context, GLuint program, GLenum pname, GLint* params) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetProgramiv(program, pname, params); +} + +void GetProgramInfoLog( + PP_Resource context, GLuint program, GLsizei bufsize, GLsizei* length, + char* infolog) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetProgramInfoLog(program, bufsize, length, infolog); +} + +void GetRenderbufferParameteriv( + PP_Resource context, GLenum target, GLenum pname, GLint* params) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetRenderbufferParameteriv(target, pname, params); +} + +void GetShaderiv( + PP_Resource context, GLuint shader, GLenum pname, GLint* params) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetShaderiv(shader, pname, params); +} + +void GetShaderInfoLog( + PP_Resource context, GLuint shader, GLsizei bufsize, GLsizei* length, + char* infolog) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetShaderInfoLog(shader, bufsize, length, infolog); +} + +void GetShaderPrecisionFormat( + PP_Resource context, GLenum shadertype, GLenum precisiontype, GLint* range, + GLint* precision) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetShaderPrecisionFormat( + shadertype, precisiontype, range, precision); +} + +void GetShaderSource( + PP_Resource context, GLuint shader, GLsizei bufsize, GLsizei* length, + char* source) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetShaderSource(shader, bufsize, length, source); +} + +const GLubyte* GetString(PP_Resource context, GLenum name) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + return graphics_3d->impl()->GetString(name); +} + +void GetTexParameterfv( + PP_Resource context, GLenum target, GLenum pname, GLfloat* params) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetTexParameterfv(target, pname, params); +} + +void GetTexParameteriv( + PP_Resource context, GLenum target, GLenum pname, GLint* params) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetTexParameteriv(target, pname, params); +} + +void GetUniformfv( + PP_Resource context, GLuint program, GLint location, GLfloat* params) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetUniformfv(program, location, params); +} + +void GetUniformiv( + PP_Resource context, GLuint program, GLint location, GLint* params) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetUniformiv(program, location, params); +} + +GLint GetUniformLocation( + PP_Resource context, GLuint program, const char* name) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + return graphics_3d->impl()->GetUniformLocation(program, name); +} + +void GetVertexAttribfv( + PP_Resource context, GLuint index, GLenum pname, GLfloat* params) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetVertexAttribfv(index, pname, params); +} + +void GetVertexAttribiv( + PP_Resource context, GLuint index, GLenum pname, GLint* params) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetVertexAttribiv(index, pname, params); +} + +void GetVertexAttribPointerv( + PP_Resource context, GLuint index, GLenum pname, void** pointer) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->GetVertexAttribPointerv(index, pname, pointer); +} + +void Hint(PP_Resource context, GLenum target, GLenum mode) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Hint(target, mode); +} + +GLboolean IsBuffer(PP_Resource context, GLuint buffer) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + return graphics_3d->impl()->IsBuffer(buffer); +} + +GLboolean IsEnabled(PP_Resource context, GLenum cap) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + return graphics_3d->impl()->IsEnabled(cap); +} + +GLboolean IsFramebuffer(PP_Resource context, GLuint framebuffer) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + return graphics_3d->impl()->IsFramebuffer(framebuffer); +} + +GLboolean IsProgram(PP_Resource context, GLuint program) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + return graphics_3d->impl()->IsProgram(program); +} + +GLboolean IsRenderbuffer(PP_Resource context, GLuint renderbuffer) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + return graphics_3d->impl()->IsRenderbuffer(renderbuffer); +} + +GLboolean IsShader(PP_Resource context, GLuint shader) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + return graphics_3d->impl()->IsShader(shader); +} + +GLboolean IsTexture(PP_Resource context, GLuint texture) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + return graphics_3d->impl()->IsTexture(texture); +} + +void LineWidth(PP_Resource context, GLfloat width) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->LineWidth(width); +} + +void LinkProgram(PP_Resource context, GLuint program) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->LinkProgram(program); +} + +void PixelStorei(PP_Resource context, GLenum pname, GLint param) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->PixelStorei(pname, param); +} + +void PolygonOffset(PP_Resource context, GLfloat factor, GLfloat units) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->PolygonOffset(factor, units); +} + +void ReadPixels( + PP_Resource context, GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, void* pixels) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->ReadPixels(x, y, width, height, format, type, pixels); +} + +void ReleaseShaderCompiler(PP_Resource context) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->ReleaseShaderCompiler(); +} + +void RenderbufferStorage( + PP_Resource context, GLenum target, GLenum internalformat, GLsizei width, + GLsizei height) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->RenderbufferStorage( + target, internalformat, width, height); +} + +void SampleCoverage(PP_Resource context, GLclampf value, GLboolean invert) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->SampleCoverage(value, invert); +} + +void Scissor( + PP_Resource context, GLint x, GLint y, GLsizei width, GLsizei height) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Scissor(x, y, width, height); +} + +void ShaderBinary( + PP_Resource context, GLsizei n, const GLuint* shaders, GLenum binaryformat, + const void* binary, GLsizei length) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->ShaderBinary(n, shaders, binaryformat, binary, length); +} + +void ShaderSource( + PP_Resource context, GLuint shader, GLsizei count, const char** str, + const GLint* length) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->ShaderSource(shader, count, str, length); +} + +void StencilFunc(PP_Resource context, GLenum func, GLint ref, GLuint mask) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->StencilFunc(func, ref, mask); +} + +void StencilFuncSeparate( + PP_Resource context, GLenum face, GLenum func, GLint ref, GLuint mask) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->StencilFuncSeparate(face, func, ref, mask); +} + +void StencilMask(PP_Resource context, GLuint mask) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->StencilMask(mask); +} + +void StencilMaskSeparate(PP_Resource context, GLenum face, GLuint mask) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->StencilMaskSeparate(face, mask); +} + +void StencilOp(PP_Resource context, GLenum fail, GLenum zfail, GLenum zpass) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->StencilOp(fail, zfail, zpass); +} + +void StencilOpSeparate( + PP_Resource context, GLenum face, GLenum fail, GLenum zfail, + GLenum zpass) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->StencilOpSeparate(face, fail, zfail, zpass); +} + +void TexImage2D( + PP_Resource context, GLenum target, GLint level, GLint internalformat, + GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, + const void* pixels) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->TexImage2D( + target, level, internalformat, width, height, border, format, type, + pixels); +} + +void TexParameterf( + PP_Resource context, GLenum target, GLenum pname, GLfloat param) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->TexParameterf(target, pname, param); +} + +void TexParameterfv( + PP_Resource context, GLenum target, GLenum pname, const GLfloat* params) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->TexParameterfv(target, pname, params); +} + +void TexParameteri( + PP_Resource context, GLenum target, GLenum pname, GLint param) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->TexParameteri(target, pname, param); +} + +void TexParameteriv( + PP_Resource context, GLenum target, GLenum pname, const GLint* params) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->TexParameteriv(target, pname, params); +} + +void TexSubImage2D( + PP_Resource context, GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, + const void* pixels) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->TexSubImage2D( + target, level, xoffset, yoffset, width, height, format, type, pixels); +} + +void Uniform1f(PP_Resource context, GLint location, GLfloat x) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Uniform1f(location, x); +} + +void Uniform1fv( + PP_Resource context, GLint location, GLsizei count, const GLfloat* v) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Uniform1fv(location, count, v); +} + +void Uniform1i(PP_Resource context, GLint location, GLint x) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Uniform1i(location, x); +} + +void Uniform1iv( + PP_Resource context, GLint location, GLsizei count, const GLint* v) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Uniform1iv(location, count, v); +} + +void Uniform2f(PP_Resource context, GLint location, GLfloat x, GLfloat y) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Uniform2f(location, x, y); +} + +void Uniform2fv( + PP_Resource context, GLint location, GLsizei count, const GLfloat* v) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Uniform2fv(location, count, v); +} + +void Uniform2i(PP_Resource context, GLint location, GLint x, GLint y) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Uniform2i(location, x, y); +} + +void Uniform2iv( + PP_Resource context, GLint location, GLsizei count, const GLint* v) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Uniform2iv(location, count, v); +} + +void Uniform3f( + PP_Resource context, GLint location, GLfloat x, GLfloat y, GLfloat z) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Uniform3f(location, x, y, z); +} + +void Uniform3fv( + PP_Resource context, GLint location, GLsizei count, const GLfloat* v) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Uniform3fv(location, count, v); +} + +void Uniform3i( + PP_Resource context, GLint location, GLint x, GLint y, GLint z) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Uniform3i(location, x, y, z); +} + +void Uniform3iv( + PP_Resource context, GLint location, GLsizei count, const GLint* v) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Uniform3iv(location, count, v); +} + +void Uniform4f( + PP_Resource context, GLint location, GLfloat x, GLfloat y, GLfloat z, + GLfloat w) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Uniform4f(location, x, y, z, w); +} + +void Uniform4fv( + PP_Resource context, GLint location, GLsizei count, const GLfloat* v) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Uniform4fv(location, count, v); +} + +void Uniform4i( + PP_Resource context, GLint location, GLint x, GLint y, GLint z, GLint w) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Uniform4i(location, x, y, z, w); +} + +void Uniform4iv( + PP_Resource context, GLint location, GLsizei count, const GLint* v) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Uniform4iv(location, count, v); +} + +void UniformMatrix2fv( + PP_Resource context, GLint location, GLsizei count, GLboolean transpose, + const GLfloat* value) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->UniformMatrix2fv(location, count, transpose, value); +} + +void UniformMatrix3fv( + PP_Resource context, GLint location, GLsizei count, GLboolean transpose, + const GLfloat* value) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->UniformMatrix3fv(location, count, transpose, value); +} + +void UniformMatrix4fv( + PP_Resource context, GLint location, GLsizei count, GLboolean transpose, + const GLfloat* value) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->UniformMatrix4fv(location, count, transpose, value); +} + +void UseProgram(PP_Resource context, GLuint program) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->UseProgram(program); +} + +void ValidateProgram(PP_Resource context, GLuint program) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->ValidateProgram(program); +} + +void VertexAttrib1f(PP_Resource context, GLuint indx, GLfloat x) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->VertexAttrib1f(indx, x); +} + +void VertexAttrib1fv(PP_Resource context, GLuint indx, const GLfloat* values) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->VertexAttrib1fv(indx, values); +} + +void VertexAttrib2f(PP_Resource context, GLuint indx, GLfloat x, GLfloat y) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->VertexAttrib2f(indx, x, y); +} + +void VertexAttrib2fv(PP_Resource context, GLuint indx, const GLfloat* values) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->VertexAttrib2fv(indx, values); +} + +void VertexAttrib3f( + PP_Resource context, GLuint indx, GLfloat x, GLfloat y, GLfloat z) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->VertexAttrib3f(indx, x, y, z); +} + +void VertexAttrib3fv(PP_Resource context, GLuint indx, const GLfloat* values) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->VertexAttrib3fv(indx, values); +} + +void VertexAttrib4f( + PP_Resource context, GLuint indx, GLfloat x, GLfloat y, GLfloat z, + GLfloat w) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->VertexAttrib4f(indx, x, y, z, w); +} + +void VertexAttrib4fv(PP_Resource context, GLuint indx, const GLfloat* values) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->VertexAttrib4fv(indx, values); +} + +void VertexAttribPointer( + PP_Resource context, GLuint indx, GLint size, GLenum type, + GLboolean normalized, GLsizei stride, const void* ptr) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->VertexAttribPointer( + indx, size, type, normalized, stride, ptr); +} + +void Viewport( + PP_Resource context, GLint x, GLint y, GLsizei width, GLsizei height) { + scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = + Resource::GetAs<PPB_Graphics3D_Impl>(context); + graphics_3d->impl()->Viewport(x, y, width, height); +} + + +const struct PPB_OpenGLES2_Dev ppb_opengles2 = { + &ActiveTexture, + &AttachShader, + &BindAttribLocation, + &BindBuffer, + &BindFramebuffer, + &BindRenderbuffer, + &BindTexture, + &BlendColor, + &BlendEquation, + &BlendEquationSeparate, + &BlendFunc, + &BlendFuncSeparate, + &BufferData, + &BufferSubData, + &CheckFramebufferStatus, + &Clear, + &ClearColor, + &ClearDepthf, + &ClearStencil, + &ColorMask, + &CompileShader, + &CompressedTexImage2D, + &CompressedTexSubImage2D, + &CopyTexImage2D, + &CopyTexSubImage2D, + &CreateProgram, + &CreateShader, + &CullFace, + &DeleteBuffers, + &DeleteFramebuffers, + &DeleteProgram, + &DeleteRenderbuffers, + &DeleteShader, + &DeleteTextures, + &DepthFunc, + &DepthMask, + &DepthRangef, + &DetachShader, + &Disable, + &DisableVertexAttribArray, + &DrawArrays, + &DrawElements, + &Enable, + &EnableVertexAttribArray, + &Finish, + &Flush, + &FramebufferRenderbuffer, + &FramebufferTexture2D, + &FrontFace, + &GenBuffers, + &GenerateMipmap, + &GenFramebuffers, + &GenRenderbuffers, + &GenTextures, + &GetActiveAttrib, + &GetActiveUniform, + &GetAttachedShaders, + &GetAttribLocation, + &GetBooleanv, + &GetBufferParameteriv, + &GetError, + &GetFloatv, + &GetFramebufferAttachmentParameteriv, + &GetIntegerv, + &GetProgramiv, + &GetProgramInfoLog, + &GetRenderbufferParameteriv, + &GetShaderiv, + &GetShaderInfoLog, + &GetShaderPrecisionFormat, + &GetShaderSource, + &GetString, + &GetTexParameterfv, + &GetTexParameteriv, + &GetUniformfv, + &GetUniformiv, + &GetUniformLocation, + &GetVertexAttribfv, + &GetVertexAttribiv, + &GetVertexAttribPointerv, + &Hint, + &IsBuffer, + &IsEnabled, + &IsFramebuffer, + &IsProgram, + &IsRenderbuffer, + &IsShader, + &IsTexture, + &LineWidth, + &LinkProgram, + &PixelStorei, + &PolygonOffset, + &ReadPixels, + &ReleaseShaderCompiler, + &RenderbufferStorage, + &SampleCoverage, + &Scissor, + &ShaderBinary, + &ShaderSource, + &StencilFunc, + &StencilFuncSeparate, + &StencilMask, + &StencilMaskSeparate, + &StencilOp, + &StencilOpSeparate, + &TexImage2D, + &TexParameterf, + &TexParameterfv, + &TexParameteri, + &TexParameteriv, + &TexSubImage2D, + &Uniform1f, + &Uniform1fv, + &Uniform1i, + &Uniform1iv, + &Uniform2f, + &Uniform2fv, + &Uniform2i, + &Uniform2iv, + &Uniform3f, + &Uniform3fv, + &Uniform3i, + &Uniform3iv, + &Uniform4f, + &Uniform4fv, + &Uniform4i, + &Uniform4iv, + &UniformMatrix2fv, + &UniformMatrix3fv, + &UniformMatrix4fv, + &UseProgram, + &ValidateProgram, + &VertexAttrib1f, + &VertexAttrib1fv, + &VertexAttrib2f, + &VertexAttrib2fv, + &VertexAttrib3f, + &VertexAttrib3fv, + &VertexAttrib4f, + &VertexAttrib4fv, + &VertexAttribPointer, + &Viewport +}; + +} // namespace + +const PPB_OpenGLES2_Dev* PPB_Graphics3D_Impl::GetOpenGLES2Interface() { + return &ppb_opengles2; +} + +} // namespace ppapi +} // namespace webkit + |