summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/webkit_glue.gypi3
-rw-r--r--webkit/plugins/ppapi/plugin_module.cc7
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc10
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.h4
-rw-r--r--webkit/plugins/ppapi/ppb_context_3d_impl.cc182
-rw-r--r--webkit/plugins/ppapi/ppb_context_3d_impl.h82
-rw-r--r--webkit/plugins/ppapi/ppb_graphics_3d_impl.cc194
-rw-r--r--webkit/plugins/ppapi/ppb_graphics_3d_impl.h67
-rw-r--r--webkit/plugins/ppapi/ppb_opengles_impl.cc1158
-rw-r--r--webkit/plugins/ppapi/ppb_opengles_impl.h22
-rw-r--r--webkit/plugins/ppapi/resource.h1
11 files changed, 905 insertions, 825 deletions
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
index b0668c9..959f4e1 100644
--- a/webkit/glue/webkit_glue.gypi
+++ b/webkit/glue/webkit_glue.gypi
@@ -267,6 +267,8 @@
'../plugins/ppapi/ppb_buffer_impl.h',
'../plugins/ppapi/ppb_char_set_impl.cc',
'../plugins/ppapi/ppb_char_set_impl.h',
+ '../plugins/ppapi/ppb_context_3d_impl.cc',
+ '../plugins/ppapi/ppb_context_3d_impl.h',
'../plugins/ppapi/ppb_cursor_control_impl.cc',
'../plugins/ppapi/ppb_cursor_control_impl.h',
'../plugins/ppapi/ppb_directory_reader_impl.cc',
@@ -294,6 +296,7 @@
'../plugins/ppapi/ppb_nacl_private_impl.cc',
'../plugins/ppapi/ppb_nacl_private_impl.h',
'../plugins/ppapi/ppb_opengles_impl.cc',
+ '../plugins/ppapi/ppb_opengles_impl.h',
'../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 d32be39..a21cbf7 100644
--- a/webkit/plugins/ppapi/plugin_module.cc
+++ b/webkit/plugins/ppapi/plugin_module.cc
@@ -14,6 +14,7 @@
#include "base/time.h"
#include "ppapi/c/dev/ppb_buffer_dev.h"
#include "ppapi/c/dev/ppb_char_set_dev.h"
+#include "ppapi/c/dev/ppb_context_3d_dev.h"
#include "ppapi/c/dev/ppb_cursor_control_dev.h"
#include "ppapi/c/dev/ppb_directory_reader_dev.h"
#include "ppapi/c/dev/ppb_file_io_dev.h"
@@ -83,7 +84,9 @@
#include "webkit/plugins/ppapi/var_object_class.h"
#ifdef ENABLE_GPU
+#include "webkit/plugins/ppapi/ppb_context_3d_impl.h"
#include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h"
+#include "webkit/plugins/ppapi/ppb_opengles_impl.h"
#endif // ENABLE_GPU
namespace webkit {
@@ -283,8 +286,10 @@ 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_CONTEXT_3D_DEV_INTERFACE) == 0)
+ return PPB_Context3D_Impl::GetInterface();
if (strcmp(name, PPB_OPENGLES2_DEV_INTERFACE) == 0)
- return PPB_Graphics3D_Impl::GetOpenGLES2Interface();
+ return PPB_OpenGLES_Impl::GetInterface();
}
#endif // ENABLE_GPU
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index 3b7aff9..e0c8343 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -45,8 +45,8 @@
#include "webkit/plugins/ppapi/plugin_delegate.h"
#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/ppapi/ppb_buffer_impl.h"
+#include "webkit/plugins/ppapi/ppb_context_3d_impl.h"
#include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h"
-#include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h"
#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
#include "webkit/plugins/ppapi/ppb_url_loader_impl.h"
#include "webkit/plugins/ppapi/ppp_pdf.h"
@@ -441,8 +441,8 @@ bool PluginInstance::BindGraphics(PP_Resource graphics_id) {
scoped_refptr<PPB_Graphics2D_Impl> graphics_2d =
Resource::GetAs<PPB_Graphics2D_Impl>(graphics_id);
- scoped_refptr<PPB_Graphics3D_Impl> graphics_3d =
- Resource::GetAs<PPB_Graphics3D_Impl>(graphics_id);
+ scoped_refptr<PPB_Context3D_Impl> graphics_3d =
+ Resource::GetAs<PPB_Context3D_Impl>(graphics_id);
if (graphics_2d) {
if (!graphics_2d->BindToInstance(this))
@@ -1174,11 +1174,11 @@ PPB_Graphics2D_Impl* PluginInstance::bound_graphics_2d() const {
return bound_graphics_->Cast<PPB_Graphics2D_Impl>();
}
-PPB_Graphics3D_Impl* PluginInstance::bound_graphics_3d() const {
+PPB_Context3D_Impl* PluginInstance::bound_graphics_3d() const {
if (bound_graphics_.get() == NULL)
return NULL;
- return bound_graphics_->Cast<PPB_Graphics3D_Impl>();
+ return bound_graphics_->Cast<PPB_Context3D_Impl>();
}
} // namespace ppapi
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h
index c2a87f5..801eca6 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.h
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h
@@ -53,7 +53,7 @@ class FullscreenContainer;
class PluginDelegate;
class PluginModule;
class PPB_Graphics2D_Impl;
-class PPB_Graphics3D_Impl;
+class PPB_Context3D_Impl;
class PPB_ImageData_Impl;
class PPB_URLLoader_Impl;
class Resource;
@@ -227,7 +227,7 @@ class PluginInstance : public base::RefCounted<PluginInstance> {
// Get the bound graphics context as a concrete 3D graphics context or returns
// null if the context is not 3D.
- PPB_Graphics3D_Impl* bound_graphics_3d() const;
+ PPB_Context3D_Impl* bound_graphics_3d() const;
PluginDelegate* delegate_;
scoped_refptr<PluginModule> module_;
diff --git a/webkit/plugins/ppapi/ppb_context_3d_impl.cc b/webkit/plugins/ppapi/ppb_context_3d_impl.cc
new file mode 100644
index 0000000..4a7c961
--- /dev/null
+++ b/webkit/plugins/ppapi/ppb_context_3d_impl.cc
@@ -0,0 +1,182 @@
+// 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.
+
+#include "webkit/plugins/ppapi/ppb_context_3d_impl.h"
+
+#include "gpu/command_buffer/common/command_buffer.h"
+#include "ppapi/c/dev/ppb_graphics_3d_dev.h"
+#include "webkit/plugins/ppapi/common.h"
+#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
+
+namespace webkit {
+namespace ppapi {
+
+namespace {
+
+// Size of the transfer buffer.
+enum { kTransferBufferSize = 512 * 1024 };
+
+PP_Resource Create(PP_Instance instance_id,
+ PP_Config3D_Dev config,
+ PP_Resource share_context,
+ const int32_t* attrib_list) {
+ // TODO(alokp): Support shared context.
+ DCHECK_EQ(0, share_context);
+ if (share_context != 0)
+ return 0;
+
+ PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
+ if (!instance)
+ return 0;
+
+ scoped_refptr<PPB_Context3D_Impl> context(
+ new PPB_Context3D_Impl(instance->module()));
+ if (!context->Init(instance, config, share_context, attrib_list))
+ return 0;
+
+ return context->GetReference();
+}
+
+PP_Bool IsContext3D(PP_Resource resource) {
+ return BoolToPPBool(!!Resource::GetAs<PPB_Context3D_Impl>(resource));
+}
+
+int32_t GetAttrib(PP_Resource context,
+ int32_t attribute,
+ int32_t* value) {
+ // TODO(alokp): Implement me.
+ return 0;
+}
+
+int32_t BindSurfaces(PP_Resource context,
+ PP_Resource draw,
+ PP_Resource read) {
+ // TODO(alokp): Implement me.
+ return 0;
+}
+
+int32_t GetBoundSurfaces(PP_Resource context,
+ PP_Resource* draw,
+ PP_Resource* read) {
+ // TODO(alokp): Implement me.
+ return 0;
+}
+
+int32_t SwapBuffers(PP_Resource context_id,
+ PP_CompletionCallback callback) {
+ scoped_refptr<PPB_Context3D_Impl> context(
+ Resource::GetAs<PPB_Context3D_Impl>(context_id));
+ return context->SwapBuffers();
+}
+
+const PPB_Context3D_Dev ppb_context3d = {
+ &Create,
+ &IsContext3D,
+ &GetAttrib,
+ &BindSurfaces,
+ &GetBoundSurfaces,
+ &SwapBuffers
+};
+
+} // namespace
+
+PPB_Context3D_Impl::PPB_Context3D_Impl(PluginModule* module)
+ : Resource(module),
+ bound_instance_(NULL),
+ gles2_impl_(NULL) {
+}
+
+PPB_Context3D_Impl::~PPB_Context3D_Impl() {
+ Destroy();
+}
+
+const PPB_Context3D_Dev* PPB_Context3D_Impl::GetInterface() {
+ return &ppb_context3d;
+}
+
+PPB_Context3D_Impl* PPB_Context3D_Impl::AsPPB_Context3D_Impl() {
+ return this;
+}
+
+bool PPB_Context3D_Impl::Init(PluginInstance* instance,
+ PP_Config3D_Dev config,
+ PP_Resource share_context,
+ const int32_t* attrib_list) {
+ DCHECK(instance);
+ // Create and initialize the objects required to issue GLES2 calls.
+ platform_context_.reset(instance->delegate()->CreateContext3D());
+ if (!platform_context_.get()) {
+ Destroy();
+ return false;
+ }
+ if (!platform_context_->Init()) {
+ Destroy();
+ return false;
+ }
+
+ gles2_impl_ = platform_context_->GetGLES2Implementation();
+ DCHECK(gles2_impl_);
+
+ return true;
+}
+
+bool PPB_Context3D_Impl::BindToInstance(PluginInstance* new_instance) {
+ if (bound_instance_ == new_instance)
+ return true; // Rebinding the same device, nothing to do.
+ if (bound_instance_ && new_instance)
+ return false; // Can't change a bound device.
+
+ if (new_instance) {
+ // Resize the backing texture to the size of the instance when it is bound.
+ platform_context_->ResizeBackingTexture(new_instance->position().size());
+
+ // This is a temporary hack. The SwapBuffers is issued to force the resize
+ // to take place before any subsequent rendering. This might lead to a
+ // partially rendered frame being displayed. It is also not thread safe
+ // since the SwapBuffers is written to the command buffer and that command
+ // buffer might be written to by another thread.
+ // TODO(apatrick): Figure out the semantics of binding and resizing.
+ platform_context_->SwapBuffers();
+ }
+
+ bound_instance_ = new_instance;
+ return true;
+}
+
+bool PPB_Context3D_Impl::SwapBuffers() {
+ if (!platform_context_.get())
+ return false;
+
+ return platform_context_->SwapBuffers();
+}
+
+void PPB_Context3D_Impl::SetSwapBuffersCallback(Callback0::Type* callback) {
+ if (!platform_context_.get())
+ return;
+
+ platform_context_->SetSwapBuffersCallback(callback);
+}
+
+unsigned int PPB_Context3D_Impl::GetBackingTextureId() {
+ if (!platform_context_.get())
+ return 0;
+
+ return platform_context_->GetBackingTextureId();
+}
+
+void PPB_Context3D_Impl::ResizeBackingTexture(const gfx::Size& size) {
+ if (!platform_context_.get())
+ return;
+
+ platform_context_->ResizeBackingTexture(size);
+}
+
+void PPB_Context3D_Impl::Destroy() {
+ gles2_impl_ = NULL;
+ platform_context_.reset();
+}
+
+} // namespace ppapi
+} // namespace webkit
+
diff --git a/webkit/plugins/ppapi/ppb_context_3d_impl.h b/webkit/plugins/ppapi/ppb_context_3d_impl.h
new file mode 100644
index 0000000..f111005
--- /dev/null
+++ b/webkit/plugins/ppapi/ppb_context_3d_impl.h
@@ -0,0 +1,82 @@
+// 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.
+
+#ifndef WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_
+#define WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_
+
+#include "base/callback.h"
+#include "base/scoped_ptr.h"
+#include "ppapi/c/dev/ppb_context_3d_dev.h"
+#include "webkit/plugins/ppapi/plugin_delegate.h"
+#include "webkit/plugins/ppapi/resource.h"
+
+namespace gfx {
+class Size;
+}
+
+namespace gpu {
+namespace gles2 {
+class GLES2Implementation;
+} // namespace gles2
+} // namespace gpu
+
+namespace webkit {
+namespace ppapi {
+
+class PPB_Context3D_Impl : public Resource {
+ public:
+ explicit PPB_Context3D_Impl(PluginModule* module);
+ virtual ~PPB_Context3D_Impl();
+
+ static const PPB_Context3D_Dev* GetInterface();
+
+ // Resource override.
+ virtual PPB_Context3D_Impl* AsPPB_Context3D_Impl();
+
+ bool Init(PluginInstance* instance,
+ PP_Config3D_Dev config,
+ PP_Resource share_context,
+ const int32_t* attrib_list);
+
+ // Associates this PPB_Context3D_Impl with the given plugin instance.
+ // You can pass NULL to clear the existing device. Returns true on success.
+ // In this case, the last rendered frame is displayed.
+ //
+ // TODO(alokp): This is confusing. This context is already associated with
+ // an instance. This function should rather be called BindToInstanceGraphics
+ // or something similar which means from this point on, anything drawn with
+ // this context appears on instance window. This function should also not
+ // take any argument. But this means modifying PPB_Instance::BindGraphics.
+ bool BindToInstance(PluginInstance* new_instance);
+
+ bool SwapBuffers();
+ void SetSwapBuffersCallback(Callback0::Type* callback);
+
+ unsigned int GetBackingTextureId();
+ void ResizeBackingTexture(const gfx::Size& size);
+
+ gpu::gles2::GLES2Implementation* gles2_impl() {
+ return gles2_impl_;
+ }
+
+ private:
+ void Destroy();
+
+ // Non-owning pointer to the plugin instance this context is currently bound
+ // to, if any. If the context is currently unbound, this will be NULL.
+ PluginInstance* bound_instance_;
+
+ // PluginDelegate's 3D Context. Responsible for providing the command buffer.
+ scoped_ptr<PluginDelegate::PlatformContext3D> platform_context_;
+
+ // GLES2 Implementation instance. Owned by the platform context's GGL context.
+ gpu::gles2::GLES2Implementation* gles2_impl_;
+
+ DISALLOW_COPY_AND_ASSIGN(PPB_Context3D_Impl);
+};
+
+} // namespace ppapi
+} // namespace webkit
+
+#endif // WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc b/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc
index a10274e..36dc91b 100644
--- a/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc
+++ b/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc
@@ -4,208 +4,44 @@
#include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h"
-#include "gpu/command_buffer/common/command_buffer.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/pp_var.h"
#include "ppapi/c/dev/ppb_graphics_3d_dev.h"
-#include "webkit/plugins/ppapi/common.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
namespace webkit {
namespace ppapi {
namespace {
-// Size of the transfer buffer.
-enum { kTransferBufferSize = 512 * 1024 };
-
-PP_Bool IsGraphics3D(PP_Resource resource) {
- return BoolToPPBool(!!Resource::GetAs<PPB_Graphics3D_Impl>(resource));
-}
-
-PP_Bool GetConfigs(int32_t* configs, int32_t config_size, int32_t* num_config) {
- // TODO(neb): Implement me!
- return PP_FALSE;
+int32_t GetConfigs(PP_Config3D_Dev* configs,
+ int32_t config_size,
+ int32_t* num_config) {
+ // TODO(alokp): Implement me.
+ return PP_ERROR_FAILED;
}
-PP_Bool ChooseConfig(const int32_t* attrib_list, int32_t* configs,
- int32_t config_size, int32_t* num_config) {
- // TODO(neb): Implement me!
- return PP_FALSE;
+int32_t GetConfigAttribs(PP_Config3D_Dev config, int32_t* attrib_list) {
+ // TODO(alokp): Implement me.
+ return PP_ERROR_FAILED;
}
-PP_Bool GetConfigAttrib(int32_t config, int32_t attribute, int32_t* value) {
- // TODO(neb): Implement me!
- return PP_FALSE;
-}
-
-const char* QueryString(int32_t name) {
- switch (name) {
- case EGL_CLIENT_APIS:
- return "OpenGL_ES";
- case EGL_EXTENSIONS:
- return "";
- case EGL_VENDOR:
- return "Google";
- case EGL_VERSION:
- return "1.0 Google";
- default:
- return NULL;
- }
-}
-
-PP_Resource CreateContext(PP_Instance instance_id, int32_t config,
- int32_t share_context,
- const int32_t* attrib_list) {
- DCHECK_EQ(0, share_context);
-
- PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
- if (!instance) {
- return 0;
- }
-
- scoped_refptr<PPB_Graphics3D_Impl> context(
- new PPB_Graphics3D_Impl(instance->module()));
- if (!context->Init(instance_id, config, attrib_list)) {
- return 0;
- }
-
- return context->GetReference();
-}
-
-void* GetProcAddress(const char* name) {
- // TODO(neb): Implement me!
- return NULL;
-}
-
-PP_Bool SwapBuffers(PP_Resource graphics3d) {
- scoped_refptr<PPB_Graphics3D_Impl> context(
- Resource::GetAs<PPB_Graphics3D_Impl>(graphics3d));
- return BoolToPPBool(context && context->SwapBuffers());
-}
-
-uint32_t GetError() {
- // TODO(alokp): Fix this.
- return 0;
+PP_Var GetString(int32_t name) {
+ // TODO(alokp): Implement me.
+ return PP_MakeUndefined();
}
const PPB_Graphics3D_Dev ppb_graphics3d = {
- &IsGraphics3D,
&GetConfigs,
- &ChooseConfig,
- &GetConfigAttrib,
- &QueryString,
- &CreateContext,
- &GetProcAddress,
- &SwapBuffers,
- &GetError
+ &GetConfigAttribs,
+ &GetString
};
} // namespace
-PPB_Graphics3D_Impl::PPB_Graphics3D_Impl(PluginModule* module)
- : Resource(module),
- bound_instance_(NULL) {
-}
-
const PPB_Graphics3D_Dev* PPB_Graphics3D_Impl::GetInterface() {
return &ppb_graphics3d;
}
-PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() {
- Destroy();
-}
-
-PPB_Graphics3D_Impl* PPB_Graphics3D_Impl::AsPPB_Graphics3D_Impl() {
- return this;
-}
-
-bool PPB_Graphics3D_Impl::Init(PP_Instance instance_id, int32_t config,
- const int32_t* attrib_list) {
- PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
- if (!instance) {
- return false;
- }
-
- // Create and initialize the objects required to issue GLES2 calls.
- platform_context_.reset(instance->delegate()->CreateContext3D());
- if (!platform_context_.get()) {
- Destroy();
- return false;
- }
-
- if (!platform_context_->Init()) {
- Destroy();
- return false;
- }
-
- gles2_implementation_ = platform_context_->GetGLES2Implementation();
- DCHECK(gles2_implementation_);
-
- return true;
-}
-
-bool PPB_Graphics3D_Impl::BindToInstance(PluginInstance* new_instance) {
- if (bound_instance_ == new_instance)
- return true; // Rebinding the same device, nothing to do.
- if (bound_instance_ && new_instance)
- return false; // Can't change a bound device.
-
- if (new_instance) {
- // Resize the backing texture to the size of the instance when it is bound.
- platform_context_->ResizeBackingTexture(new_instance->position().size());
-
- // This is a temporary hack. The SwapBuffers is issued to force the resize
- // to take place before any subsequent rendering. This might lead to a
- // partially rendered frame being displayed. It is also not thread safe
- // since the SwapBuffers is written to the command buffer and that command
- // buffer might be written to by another thread.
- // TODO(apatrick): Figure out the semantics of binding and resizing.
- platform_context_->SwapBuffers();
- }
-
- bound_instance_ = new_instance;
- return true;
-}
-
-bool PPB_Graphics3D_Impl::SwapBuffers() {
- if (!platform_context_.get())
- return false;
-
- return platform_context_->SwapBuffers();
-}
-
-unsigned PPB_Graphics3D_Impl::GetError() {
- if (!platform_context_.get())
- return 0;
-
- return platform_context_->GetError();
-}
-
-void PPB_Graphics3D_Impl::ResizeBackingTexture(const gfx::Size& size) {
- if (!platform_context_.get())
- return;
-
- platform_context_->ResizeBackingTexture(size);
-}
-
-void PPB_Graphics3D_Impl::SetSwapBuffersCallback(Callback0::Type* callback) {
- if (!platform_context_.get())
- return;
-
- platform_context_->SetSwapBuffersCallback(callback);
-}
-
-unsigned PPB_Graphics3D_Impl::GetBackingTextureId() {
- if (!platform_context_.get())
- return 0;
-
- return platform_context_->GetBackingTextureId();
-}
-
-void PPB_Graphics3D_Impl::Destroy() {
- gles2_implementation_ = NULL;
- platform_context_.reset();
-}
-
} // namespace ppapi
} // namespace webkit
diff --git a/webkit/plugins/ppapi/ppb_graphics_3d_impl.h b/webkit/plugins/ppapi/ppb_graphics_3d_impl.h
index d4a49d6..c4738cc 100644
--- a/webkit/plugins/ppapi/ppb_graphics_3d_impl.h
+++ b/webkit/plugins/ppapi/ppb_graphics_3d_impl.h
@@ -5,79 +5,14 @@
#ifndef WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_
#define WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_
-#include "base/basictypes.h"
-#include "base/callback.h"
-#include "base/scoped_ptr.h"
-#include "gfx/size.h"
-#include "gpu/command_buffer/client/gles2_cmd_helper.h"
-#include "gpu/command_buffer/client/gles2_implementation.h"
-#include "ppapi/c/pp_instance.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
-#include "webkit/plugins/ppapi/resource.h"
-
-namespace gpu {
-namespace gles2 {
-class GLES2Implementation;
-} // namespace gles2
-} // namespace gpu
-
struct PPB_Graphics3D_Dev;
-struct PPB_OpenGLES2_Dev;
namespace webkit {
namespace ppapi {
-class PPB_Graphics3D_Impl : public Resource {
+class PPB_Graphics3D_Impl {
public:
- explicit PPB_Graphics3D_Impl(PluginModule* module);
-
- virtual ~PPB_Graphics3D_Impl();
-
static const PPB_Graphics3D_Dev* GetInterface();
- static const PPB_OpenGLES2_Dev* GetOpenGLES2Interface();
-
- static bool Shutdown();
-
- // Resource override.
- virtual PPB_Graphics3D_Impl* AsPPB_Graphics3D_Impl();
-
- bool Init(PP_Instance instance_id, int32_t config,
- const int32_t* attrib_list);
-
- // Associates this PPB_Graphics3D_Impl with the given plugin instance. You can pass
- // NULL to clear the existing device. Returns true on success. In this case,
- // the last rendered frame is displayed.
- // TODO(apatrick): Figure out the best semantics here.
- bool BindToInstance(PluginInstance* new_instance);
-
- bool SwapBuffers();
-
- unsigned GetError();
-
- void ResizeBackingTexture(const gfx::Size& size);
-
- void SetSwapBuffersCallback(Callback0::Type* callback);
-
- unsigned GetBackingTextureId();
-
- gpu::gles2::GLES2Implementation* impl() {
- return gles2_implementation_;
- }
-
- private:
- void Destroy();
-
- // Non-owning pointer to the plugin instance this context is currently bound
- // to, if any. If the context is currently unbound, this will be NULL.
- PluginInstance* bound_instance_;
-
- // PluginDelegate's 3D Context. Responsible for providing the command buffer.
- scoped_ptr<PluginDelegate::PlatformContext3D> platform_context_;
-
- // GLES2 Implementation instance. Owned by the platform context's GGL context.
- gpu::gles2::GLES2Implementation* gles2_implementation_;
-
- DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl);
};
} // namespace ppapi
diff --git a/webkit/plugins/ppapi/ppb_opengles_impl.cc b/webkit/plugins/ppapi/ppb_opengles_impl.cc
index e56eb9c..bd233d0 100644
--- a/webkit/plugins/ppapi/ppb_opengles_impl.cc
+++ b/webkit/plugins/ppapi/ppb_opengles_impl.cc
@@ -4,990 +4,1004 @@
// This file is auto-generated. DO NOT EDIT!
-#include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h"
+#include "webkit/plugins/ppapi/ppb_opengles_impl.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
#include "ppapi/c/dev/ppb_opengles_dev.h"
+#include "webkit/plugins/ppapi/ppb_context_3d_impl.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 ActiveTexture(PP_Resource context_id, GLenum texture) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 AttachShader(PP_Resource context_id, GLuint program, GLuint shader) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLuint program, GLuint index, const char* name) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 BindBuffer(PP_Resource context_id, GLenum target, GLuint buffer) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 BindFramebuffer(
+ PP_Resource context_id, GLenum target, GLuint framebuffer) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLenum target, GLuint renderbuffer) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 BindTexture(PP_Resource context_id, GLenum target, GLuint texture) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->BindTexture(target, texture);
}
void BlendColor(
- PP_Resource context, GLclampf red, GLclampf green, GLclampf blue,
+ PP_Resource context_id, 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);
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 BlendEquation(PP_Resource context_id, GLenum mode) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLenum modeRGB, GLenum modeAlpha) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 BlendFunc(PP_Resource context_id, GLenum sfactor, GLenum dfactor) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->BlendFunc(sfactor, dfactor);
}
void BlendFuncSeparate(
- PP_Resource context, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha,
+ PP_Resource context_id, 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);
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
}
void BufferData(
- PP_Resource context, GLenum target, GLsizeiptr size, const void* data,
+ PP_Resource context_id, 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);
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->BufferData(target, size, data, usage);
}
void BufferSubData(
- PP_Resource context, GLenum target, GLintptr offset, GLsizeiptr size,
+ PP_Resource context_id, 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);
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+GLenum CheckFramebufferStatus(PP_Resource context_id, GLenum target) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ return context->gles2_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 Clear(PP_Resource context_id, GLbitfield mask) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->Clear(mask);
}
void ClearColor(
- PP_Resource context, GLclampf red, GLclampf green, GLclampf blue,
+ PP_Resource context_id, 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);
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 ClearDepthf(PP_Resource context_id, GLclampf depth) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 ClearStencil(PP_Resource context_id, GLint s) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->ClearStencil(s);
}
void ColorMask(
- PP_Resource context, GLboolean red, GLboolean green, GLboolean blue,
+ PP_Resource context_id, 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);
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 CompileShader(PP_Resource context_id, GLuint shader) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->CompileShader(shader);
}
void CompressedTexImage2D(
- PP_Resource context, GLenum target, GLint level, GLenum internalformat,
+ PP_Resource context_id, 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(
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->CompressedTexImage2D(
target, level, internalformat, width, height, border, imageSize, data);
}
void CompressedTexSubImage2D(
- PP_Resource context, GLenum target, GLint level, GLint xoffset,
+ PP_Resource context_id, 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(
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->CompressedTexSubImage2D(
target, level, xoffset, yoffset, width, height, format, imageSize, data);
}
void CopyTexImage2D(
- PP_Resource context, GLenum target, GLint level, GLenum internalformat,
+ PP_Resource context_id, 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(
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->CopyTexImage2D(
target, level, internalformat, x, y, width, height, border);
}
void CopyTexSubImage2D(
- PP_Resource context, GLenum target, GLint level, GLint xoffset,
+ PP_Resource context_id, 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(
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 CreateProgram(PP_Resource context_id) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ return context->gles2_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);
+GLuint CreateShader(PP_Resource context_id, GLenum type) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ return context->gles2_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 CullFace(PP_Resource context_id, GLenum mode) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 DeleteBuffers(PP_Resource context_id, GLsizei n, const GLuint* buffers) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLsizei n, const GLuint* framebuffers) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 DeleteProgram(PP_Resource context_id, GLuint program) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLsizei n, const GLuint* renderbuffers) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 DeleteShader(PP_Resource context_id, GLuint shader) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 DeleteTextures(
+ PP_Resource context_id, GLsizei n, const GLuint* textures) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 DepthFunc(PP_Resource context_id, GLenum func) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 DepthMask(PP_Resource context_id, GLboolean flag) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 DepthRangef(PP_Resource context_id, GLclampf zNear, GLclampf zFar) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 DetachShader(PP_Resource context_id, GLuint program, GLuint shader) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 Disable(PP_Resource context_id, GLenum cap) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 DisableVertexAttribArray(PP_Resource context_id, GLuint index) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 DrawArrays(
+ PP_Resource context_id, GLenum mode, GLint first, GLsizei count) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->DrawArrays(mode, first, count);
}
void DrawElements(
- PP_Resource context, GLenum mode, GLsizei count, GLenum type,
+ PP_Resource context_id, 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);
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 Enable(PP_Resource context_id, GLenum cap) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 EnableVertexAttribArray(PP_Resource context_id, GLuint index) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 Finish(PP_Resource context_id) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 Flush(PP_Resource context_id) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->Flush();
}
void FramebufferRenderbuffer(
- PP_Resource context, GLenum target, GLenum attachment,
+ PP_Resource context_id, 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(
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->FramebufferRenderbuffer(
target, attachment, renderbuffertarget, renderbuffer);
}
void FramebufferTexture2D(
- PP_Resource context, GLenum target, GLenum attachment, GLenum textarget,
+ PP_Resource context_id, 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(
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 FrontFace(PP_Resource context_id, GLenum mode) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 GenBuffers(PP_Resource context_id, GLsizei n, GLuint* buffers) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 GenerateMipmap(PP_Resource context_id, GLenum target) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 GenFramebuffers(PP_Resource context_id, GLsizei n, GLuint* framebuffers) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 GenRenderbuffers(
+ PP_Resource context_id, GLsizei n, GLuint* renderbuffers) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 GenTextures(PP_Resource context_id, GLsizei n, GLuint* textures) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->GenTextures(n, textures);
}
void GetActiveAttrib(
- PP_Resource context, GLuint program, GLuint index, GLsizei bufsize,
+ PP_Resource context_id, 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(
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->GetActiveAttrib(
program, index, bufsize, length, size, type, name);
}
void GetActiveUniform(
- PP_Resource context, GLuint program, GLuint index, GLsizei bufsize,
+ PP_Resource context_id, 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(
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->GetActiveUniform(
program, index, bufsize, length, size, type, name);
}
void GetAttachedShaders(
- PP_Resource context, GLuint program, GLsizei maxcount, GLsizei* count,
+ PP_Resource context_id, 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);
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLuint program, const char* name) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ return context->gles2_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 GetBooleanv(PP_Resource context_id, GLenum pname, GLboolean* params) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLenum target, GLenum pname, GLint* params) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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();
+GLenum GetError(PP_Resource context_id) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ return context->gles2_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 GetFloatv(PP_Resource context_id, GLenum pname, GLfloat* params) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->GetFloatv(pname, params);
}
void GetFramebufferAttachmentParameteriv(
- PP_Resource context, GLenum target, GLenum attachment, GLenum pname,
+ PP_Resource context_id, 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(
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 GetIntegerv(PP_Resource context_id, GLenum pname, GLint* params) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLuint program, GLenum pname, GLint* params) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->GetProgramiv(program, pname, params);
}
void GetProgramInfoLog(
- PP_Resource context, GLuint program, GLsizei bufsize, GLsizei* length,
+ PP_Resource context_id, 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);
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLenum target, GLenum pname, GLint* params) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLuint shader, GLenum pname, GLint* params) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->GetShaderiv(shader, pname, params);
}
void GetShaderInfoLog(
- PP_Resource context, GLuint shader, GLsizei bufsize, GLsizei* length,
+ PP_Resource context_id, 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);
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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(
+ PP_Resource context_id, GLenum shadertype, GLenum precisiontype,
+ GLint* range, GLint* precision) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->GetShaderPrecisionFormat(
shadertype, precisiontype, range, precision);
}
void GetShaderSource(
- PP_Resource context, GLuint shader, GLsizei bufsize, GLsizei* length,
+ PP_Resource context_id, 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);
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+const GLubyte* GetString(PP_Resource context_id, GLenum name) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ return context->gles2_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);
+ PP_Resource context_id, GLenum target, GLenum pname, GLfloat* params) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLenum target, GLenum pname, GLint* params) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLuint program, GLint location, GLfloat* params) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLuint program, GLint location, GLint* params) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLuint program, const char* name) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ return context->gles2_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);
+ PP_Resource context_id, GLuint index, GLenum pname, GLfloat* params) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLuint index, GLenum pname, GLint* params) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLuint index, GLenum pname, void** pointer) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+void Hint(PP_Resource context_id, GLenum target, GLenum mode) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 IsBuffer(PP_Resource context_id, GLuint buffer) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ return context->gles2_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 IsEnabled(PP_Resource context_id, GLenum cap) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ return context->gles2_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 IsFramebuffer(PP_Resource context_id, GLuint framebuffer) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ return context->gles2_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 IsProgram(PP_Resource context_id, GLuint program) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ return context->gles2_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 IsRenderbuffer(PP_Resource context_id, GLuint renderbuffer) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ return context->gles2_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 IsShader(PP_Resource context_id, GLuint shader) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ return context->gles2_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);
+GLboolean IsTexture(PP_Resource context_id, GLuint texture) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ return context->gles2_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 LineWidth(PP_Resource context_id, GLfloat width) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 LinkProgram(PP_Resource context_id, GLuint program) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 PixelStorei(PP_Resource context_id, GLenum pname, GLint param) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 PolygonOffset(PP_Resource context_id, GLfloat factor, GLfloat units) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->PolygonOffset(factor, units);
}
void ReadPixels(
- PP_Resource context, GLint x, GLint y, GLsizei width, GLsizei height,
+ PP_Resource context_id, 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);
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 ReleaseShaderCompiler(PP_Resource context_id) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->ReleaseShaderCompiler();
}
void RenderbufferStorage(
- PP_Resource context, GLenum target, GLenum internalformat, GLsizei width,
+ PP_Resource context_id, 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(
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 SampleCoverage(PP_Resource context_id, GLclampf value, GLboolean invert) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLint x, GLint y, GLsizei width, GLsizei height) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLsizei n, const GLuint* shaders,
+ GLenum binaryformat, const void* binary, GLsizei length) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->ShaderBinary(
+ n, shaders, binaryformat, binary, length);
}
void ShaderSource(
- PP_Resource context, GLuint shader, GLsizei count, const char** str,
+ PP_Resource context_id, 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);
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 StencilFunc(PP_Resource context_id, GLenum func, GLint ref, GLuint mask) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLenum face, GLenum func, GLint ref, GLuint mask) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 StencilMask(PP_Resource context_id, GLuint mask) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 StencilMaskSeparate(PP_Resource context_id, GLenum face, GLuint mask) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 StencilOp(
+ PP_Resource context_id, GLenum fail, GLenum zfail, GLenum zpass) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->StencilOp(fail, zfail, zpass);
}
void StencilOpSeparate(
- PP_Resource context, GLenum face, GLenum fail, GLenum zfail,
+ PP_Resource context_id, 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);
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->StencilOpSeparate(face, fail, zfail, zpass);
}
void TexImage2D(
- PP_Resource context, GLenum target, GLint level, GLint internalformat,
+ PP_Resource context_id, 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(
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLenum target, GLenum pname, GLfloat param) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLenum target, GLenum pname,
+ const GLfloat* params) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLenum target, GLenum pname, GLint param) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLenum target, GLenum pname, const GLint* params) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->TexParameteriv(target, pname, params);
}
void TexSubImage2D(
- PP_Resource context, GLenum target, GLint level, GLint xoffset,
+ PP_Resource context_id, 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(
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 Uniform1f(PP_Resource context_id, GLint location, GLfloat x) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 Uniform1i(PP_Resource context_id, GLint location, GLint x) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLint location, GLsizei count, const GLint* v) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 Uniform2f(PP_Resource context_id, GLint location, GLfloat x, GLfloat y) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 Uniform2i(PP_Resource context_id, GLint location, GLint x, GLint y) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLint location, GLsizei count, const GLint* v) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLint location, GLfloat x, GLfloat y, GLfloat z) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLint location, GLint x, GLint y, GLint z) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLint location, GLsizei count, const GLint* v) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->Uniform3iv(location, count, v);
}
void Uniform4f(
- PP_Resource context, GLint location, GLfloat x, GLfloat y, GLfloat z,
+ PP_Resource context_id, 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);
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLint location, GLsizei count, const GLfloat* v) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLint location, GLint x, GLint y, GLint z,
+ GLint w) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLint location, GLsizei count, const GLint* v) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->Uniform4iv(location, count, v);
}
void UniformMatrix2fv(
- PP_Resource context, GLint location, GLsizei count, GLboolean transpose,
+ PP_Resource context_id, 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);
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->UniformMatrix2fv(location, count, transpose, value);
}
void UniformMatrix3fv(
- PP_Resource context, GLint location, GLsizei count, GLboolean transpose,
+ PP_Resource context_id, 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);
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->UniformMatrix3fv(location, count, transpose, value);
}
void UniformMatrix4fv(
- PP_Resource context, GLint location, GLsizei count, GLboolean transpose,
+ PP_Resource context_id, 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);
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 UseProgram(PP_Resource context_id, GLuint program) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 ValidateProgram(PP_Resource context_id, GLuint program) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 VertexAttrib1f(PP_Resource context_id, GLuint indx, GLfloat x) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 VertexAttrib1fv(
+ PP_Resource context_id, GLuint indx, const GLfloat* values) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 VertexAttrib2f(
+ PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 VertexAttrib2fv(
+ PP_Resource context_id, GLuint indx, const GLfloat* values) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLuint indx, GLfloat x, GLfloat y, GLfloat z) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 VertexAttrib3fv(
+ PP_Resource context_id, GLuint indx, const GLfloat* values) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->VertexAttrib3fv(indx, values);
}
void VertexAttrib4f(
- PP_Resource context, GLuint indx, GLfloat x, GLfloat y, GLfloat z,
+ PP_Resource context_id, 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);
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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 VertexAttrib4fv(
+ PP_Resource context_id, GLuint indx, const GLfloat* values) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->VertexAttrib4fv(indx, values);
}
void VertexAttribPointer(
- PP_Resource context, GLuint indx, GLint size, GLenum type,
+ PP_Resource context_id, 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(
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_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);
+ PP_Resource context_id, GLint x, GLint y, GLsizei width, GLsizei height) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->Viewport(x, y, width, height);
}
@@ -1138,7 +1152,7 @@ const struct PPB_OpenGLES2_Dev ppb_opengles2 = {
} // namespace
-const PPB_OpenGLES2_Dev* PPB_Graphics3D_Impl::GetOpenGLES2Interface() {
+const PPB_OpenGLES2_Dev* PPB_OpenGLES_Impl::GetInterface() {
return &ppb_opengles2;
}
diff --git a/webkit/plugins/ppapi/ppb_opengles_impl.h b/webkit/plugins/ppapi/ppb_opengles_impl.h
new file mode 100644
index 0000000..11df197
--- /dev/null
+++ b/webkit/plugins/ppapi/ppb_opengles_impl.h
@@ -0,0 +1,22 @@
+// 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.
+
+#ifndef WEBKIT_PLUGINS_PPAPI_PPB_OPENGLES_IMPL_H_
+#define WEBKIT_PLUGINS_PPAPI_PPB_OPENGLES_IMPL_H_
+
+struct PPB_OpenGLES2_Dev;
+
+namespace webkit {
+namespace ppapi {
+
+class PPB_OpenGLES_Impl {
+ public:
+ static const PPB_OpenGLES2_Dev* GetInterface();
+};
+
+} // namespace ppapi
+} // namespace webkit
+
+#endif // WEBKIT_PLUGINS_PPAPI_PPB_OPENGLES_IMPL_H_
+
diff --git a/webkit/plugins/ppapi/resource.h b/webkit/plugins/ppapi/resource.h
index 45f114c..be79136 100644
--- a/webkit/plugins/ppapi/resource.h
+++ b/webkit/plugins/ppapi/resource.h
@@ -20,6 +20,7 @@ namespace ppapi {
F(PPB_AudioConfig_Impl) \
F(PPB_Audio_Impl) \
F(PPB_Buffer_Impl) \
+ F(PPB_Context3D_Impl) \
F(PPB_DirectoryReader_Impl) \
F(PPB_FileChooser_Impl) \
F(PPB_FileIO_Impl) \