summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-23 04:51:52 +0000
committeralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-23 04:51:52 +0000
commitbe8fd116e295fd7ef6c75e4dd717017d68c7fd57 (patch)
treec6ef9e02c1e60d189ead67e9a7ce90f01c8da2e8
parent79cc8d9d943c79c2e5237265591d36b884470fbf (diff)
downloadchromium_src-be8fd116e295fd7ef6c75e4dd717017d68c7fd57.zip
chromium_src-be8fd116e295fd7ef6c75e4dd717017d68c7fd57.tar.gz
chromium_src-be8fd116e295fd7ef6c75e4dd717017d68c7fd57.tar.bz2
Added ppapi::Context3D interface. The API has already been reviewed. I am adding the new API incrementally so as not to break the demos.
Review URL: http://codereview.chromium.org/6062003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70037 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-xgpu/command_buffer/build_gles2_cmd_buffer.py21
-rw-r--r--gpu/demos/framework/pepper.cc23
-rw-r--r--ppapi/c/dev/pp_graphics_3d_dev.h177
-rw-r--r--ppapi/c/dev/ppb_context_3d_dev.h128
-rw-r--r--ppapi/c/dev/ppb_graphics_3d_dev.h146
-rw-r--r--ppapi/c/dev/ppb_opengles_dev.h2
-rw-r--r--ppapi/cpp/dev/context_3d_dev.cc58
-rw-r--r--ppapi/cpp/dev/context_3d_dev.h38
-rw-r--r--ppapi/cpp/dev/graphics_3d_dev.cc94
-rw-r--r--ppapi/cpp/dev/graphics_3d_dev.h40
-rw-r--r--ppapi/cpp/instance.cc4
-rw-r--r--ppapi/cpp/instance.h5
-rw-r--r--ppapi/ppapi.gyp4
-rw-r--r--ppapi/tests/all_c_includes.h2
-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
25 files changed, 1448 insertions, 1024 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
index 7c9128c..a34035f 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -5271,6 +5271,8 @@ class GLGenerator(object):
"// OpenGL ES interface.\n",
3)
+ file.Write("#include \"ppapi/c/pp_resource.h\"\n\n")
+
file.Write("#ifndef __gl2_h_\n")
for (k, v) in _GL_TYPES.iteritems():
file.Write("typedef %s %s;\n" % (v, k))
@@ -5301,10 +5303,11 @@ class GLGenerator(object):
file.Write(_LICENSE)
file.Write("// This file is auto-generated. DO NOT EDIT!\n\n")
- file.Write("#include \"webkit/plugins/ppapi/ppb_graphics_3d_impl.h\"\n\n")
+ file.Write("#include \"webkit/plugins/ppapi/ppb_opengles_impl.h\"\n\n")
- file.Write("#include \"gpu/command_buffer/client/gles2_implementation.h\"")
- file.Write("\n#include \"ppapi/c/dev/ppb_opengles_dev.h\"\n\n")
+ file.Write("#include \"gpu/command_buffer/client/gles2_implementation.h\"\n")
+ file.Write("#include \"ppapi/c/dev/ppb_opengles_dev.h\"\n")
+ file.Write("#include \"webkit/plugins/ppapi/ppb_context_3d_impl.h\"\n\n")
file.Write("namespace webkit {\n")
file.Write("namespace ppapi {\n\n")
@@ -5315,19 +5318,19 @@ class GLGenerator(object):
continue
original_arg = func.MakeTypedOriginalArgString("")
- context_arg = "PP_Resource context"
+ context_arg = "PP_Resource context_id"
if len(original_arg):
arg = context_arg + ", " + original_arg
else:
arg = context_arg
file.Write("%s %s(%s) {\n" % (func.return_type, func.name, arg))
-
- file.Write(""" scoped_refptr<PPB_Graphics3D_Impl> graphics_3d =
- Resource::GetAs<PPB_Graphics3D_Impl>(context);
+
+ file.Write(""" scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
""")
return_str = "" if func.return_type == "void" else "return "
- file.Write(" %sgraphics_3d->impl()->%s(%s);\n" %
+ file.Write(" %scontext->gles2_impl()->%s(%s);\n" %
(return_str, func.original_name,
func.MakeOriginalArgString("")))
file.Write("}\n\n")
@@ -5342,7 +5345,7 @@ class GLGenerator(object):
file.Write("} // namespace\n")
file.Write("""
-const PPB_OpenGLES2_Dev* PPB_Graphics3D_Impl::GetOpenGLES2Interface() {
+const PPB_OpenGLES2_Dev* PPB_OpenGLES_Impl::GetInterface() {
return &ppb_opengles2;
}
diff --git a/gpu/demos/framework/pepper.cc b/gpu/demos/framework/pepper.cc
index ffb2460..8c9e43a 100644
--- a/gpu/demos/framework/pepper.cc
+++ b/gpu/demos/framework/pepper.cc
@@ -8,10 +8,11 @@
#include "gpu/demos/framework/demo_factory.h"
#include "ppapi/cpp/completion_callback.h"
#include "ppapi/cpp/instance.h"
-#include "ppapi/cpp/dev/graphics_3d_dev.h"
#include "ppapi/cpp/module.h"
#include "ppapi/cpp/rect.h"
#include "ppapi/cpp/size.h"
+#include "ppapi/cpp/dev/context_3d_dev.h"
+#include "ppapi/cpp/dev/graphics_3d_dev.h"
#include "ppapi/lib/gl/gles2/gl2ext_ppapi.h"
namespace gpu {
@@ -29,8 +30,8 @@ class PluginInstance : public pp::Instance {
}
~PluginInstance() {
- if (!graphics_.is_null()) {
- glSetCurrentContextPPAPI(graphics_.pp_resource());
+ if (!context_.is_null()) {
+ glSetCurrentContextPPAPI(context_.pp_resource());
delete demo_;
glSetCurrentContextPPAPI(0);
}
@@ -44,15 +45,15 @@ class PluginInstance : public pp::Instance {
size_ = position.size();
demo_->InitWindowSize(size_.width(), size_.height());
- if (graphics_.is_null()) {
- graphics_ = pp::Graphics3D_Dev(*this, 0, NULL, NULL);
- if (graphics_.is_null())
+ if (context_.is_null()) {
+ context_ = pp::Context3D_Dev(*this, 0, pp::Context3D_Dev(), NULL);
+ if (context_.is_null())
return;
- if (!pp::Instance::BindGraphics(graphics_))
+ if (!pp::Instance::BindGraphics(context_))
return;
- glSetCurrentContextPPAPI(graphics_.pp_resource());
+ glSetCurrentContextPPAPI(context_.pp_resource());
demo_->InitGL();
glSetCurrentContextPPAPI(0);
}
@@ -64,9 +65,9 @@ class PluginInstance : public pp::Instance {
}
void Paint() {
- glSetCurrentContextPPAPI(graphics_.pp_resource());
+ glSetCurrentContextPPAPI(context_.pp_resource());
demo_->Draw();
- graphics_.SwapBuffers();
+ context_.SwapBuffers();
glSetCurrentContextPPAPI(0);
}
@@ -79,7 +80,7 @@ class PluginInstance : public pp::Instance {
pp::Module* module_;
Demo* demo_;
- pp::Graphics3D_Dev graphics_;
+ pp::Context3D_Dev context_;
pp::Size size_;
pp::CompletionCallbackFactory<PluginInstance> callback_factory_;
};
diff --git a/ppapi/c/dev/pp_graphics_3d_dev.h b/ppapi/c/dev/pp_graphics_3d_dev.h
new file mode 100644
index 0000000..6ea2506
--- /dev/null
+++ b/ppapi/c/dev/pp_graphics_3d_dev.h
@@ -0,0 +1,177 @@
+/* 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 PPAPI_C_DEV_PP_GRAPHICS_3D_DEV_H_
+#define PPAPI_C_DEV_PP_GRAPHICS_3D_DEV_H_
+
+#include "ppapi/c/pp_stdint.h"
+
+// TODO(alokp): Using PP_Graphics3D prefix is making these enum names rather
+// long. Can we just use PP_GL? It will be a nice short replacement of EGL.
+// In which case we should rename associated classes as - PP_GL, PP_GLContext,
+// PP_GLContext, PP_GLSurface, PP_GLConfig, and PP_OpenGLES2.
+//
+// Another option is to rename Surface3D and Context3D to Graphics3DSurface
+// and Graphics3DContext respectively But this does not make the names
+// any shorter.
+
+enum PP_Graphics3DError_Dev {
+ PP_GRAPHICS3DERROR_BAD_ACCESS = 0x3002,
+ PP_GRAPHICS3DERROR_BAD_ATTRIBUTE = 0x3004,
+ PP_GRAPHICS3DERROR_BAD_CONFIG = 0x3005,
+ PP_GRAPHICS3DERROR_BAD_CONTEXT = 0x3006,
+ PP_GRAPHICS3DERROR_BAD_MATCH = 0x3009,
+ PP_GRAPHICS3DERROR_BAD_SURFACE = 0x300D,
+ PP_GRAPHICS3DERROR_CONTEXT_LOST = 0x300E
+};
+
+enum PP_Graphics3DString_Dev {
+ PP_GRAPHICS3DSTRING_VENDOR = 0x3053,
+ PP_GRAPHICS3DSTRING_VERSION = 0x3054,
+ // Which extensions are supported.
+ PP_GRAPHICS3DSTRING_EXTENSIONS = 0x3055,
+ // Which client rendering APIs are supported.
+ PP_GRAPHICS3DSTRING_CLIENT_APIS = 0x308D
+};
+
+enum PP_Graphics3DAttrib_Dev {
+ // Total color component bits in the color buffer.
+ PP_GRAPHICS3DATTRIB_BUFFER_SIZE = 0x3020,
+ // Bits of Alpha in the color buffer.
+ PP_GRAPHICS3DATTRIB_ALPHA_SIZE = 0x3021,
+ // Bits of Blue in the color buffer.
+ PP_GRAPHICS3DATTRIB_BLUE_SIZE = 0x3022,
+ // Bits of Green in the color buffer.
+ PP_GRAPHICS3DATTRIB_GREEN_SIZE = 0x3023,
+ // Bits of Red in the color buffer.
+ PP_GRAPHICS3DATTRIB_RED_SIZE = 0x3024,
+ // Bits of Z in the depth buffer.
+ PP_GRAPHICS3DATTRIB_DEPTH_SIZE = 0x3025,
+ // Bits of Stencil in the stencil buffer.
+ PP_GRAPHICS3DATTRIB_STENCIL_SIZE = 0x3026,
+ // Any caveats for the configuration.
+ PP_GRAPHICS3DATTRIB_CONFIG_CAVEAT = 0x3027,
+ // Unique EGLConfig identifier.
+ PP_GRAPHICS3DATTRIB_CONFIG_ID = 0x3028,
+ // Maximum height of surface.
+ PP_GRAPHICS3DATTRIB_MAX_SURFACE_HEIGHT = 0x302A,
+ // Maximum size of surface.
+ PP_GRAPHICS3DATTRIB_MAX_SURFACE_PIXELS = 0x302B,
+ // Maximum width of surface.
+ PP_GRAPHICS3DATTRIB_MAX_SURFACE_WIDTH = 0x302C,
+ // Number of samples per pixel.
+ PP_GRAPHICS3DATTRIB_SAMPLES = 0x3031,
+ // Number of multisample buffers.
+ PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS = 0x3032,
+ // Which types of EGL surfaces are supported.
+ PP_GRAPHICS3DATTRIB_SURFACE_TYPE = 0x3033,
+ // Type of transparency supported.
+ PP_GRAPHICS3DATTRIB_TRANSPARENT_TYPE = 0x3034,
+ // Transparent blue value.
+ PP_GRAPHICS3DATTRIB_TRANSPARENT_BLUE_VALUE = 0x3035,
+ // Transparent green value.
+ PP_GRAPHICS3DATTRIB_TRANSPARENT_GREEN_VALUE = 0x3036,
+ // Transparent red value.
+ PP_GRAPHICS3DATTRIB_TRANSPARENT_RED_VALUE = 0x3037,
+ // Attrib list terminator.
+ PP_GRAPHICS3DATTRIB_NONE = 0x3038,
+ // TODO(alokp): Find out if we can support swap intervals. Remove them if not.
+ // Minimum swap interval.
+ PP_GRAPHICS3DATTRIB_MIN_SWAP_INTERVAL = 0x303B,
+ // Maximum swap interval.
+ PP_GRAPHICS3DATTRIB_MAX_SWAP_INTERVAL = 0x303C,
+ // Bits of Luminance in the color buffer.
+ PP_GRAPHICS3DATTRIB_LUMINANCE_SIZE = 0x303D,
+ // Bits of Alpha Mask in the mask buffer.
+ PP_GRAPHICS3DATTRIB_ALPHA_MASK_SIZE = 0x303E,
+ // Color buffer type.
+ PP_GRAPHICS3DATTRIB_COLOR_BUFFER_TYPE = 0x303F,
+ // Which client APIs are supported.
+ PP_GRAPHICS3DATTRIB_RENDERABLE_TYPE = 0x3040,
+ // Whether contexts created with this config are conformant.
+ PP_GRAPHICS3DATTRIB_CONFORMANT = 0x3042,
+
+ // Surface-specific attributes.
+ // Height of surface in pixels.
+ PP_GRAPHICS3DATTRIB_HEIGHT = 0x3056,
+ // Width of surface in pixels.
+ PP_GRAPHICS3DATTRIB_WIDTH = 0x3057,
+ // If true, largest possible surface is created.
+ PP_GRAPHICS3DATTRIB_LARGEST_SURFACE = 0x3058,
+ // The buffer which client API renders to.
+ PP_GRAPHICS3DATTRIB_RENDER_BUFFER = 0x3086,
+ // Specifies the effect on the color buffer of posting a surface
+ // with SwapBuffers.
+ PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR = 0x3093,
+ // Specifies the filter to use when resolving the multisample buffer.
+ PP_GRAPHICS3DATTRIB_MULTISAMPLE_RESOLVE = 0x3099,
+
+ // Context-specific attributes.
+ // Which client API the context supports.
+ PP_GRAPHICS3DATTRIB_CONTEXT_CLIENT_TYPE = 0x3097,
+ // Version of OpenGL ES supported by a context.
+ // An attribute value of 1 specifies OpenGL ES 1.x.
+ // An attribute value of 2 specifies OpenGL ES 2.x.
+ // The default value for PP_GRAPHICS3DATTRIB_CONTEXT_CLIENT_VERSION is 1.
+ // This attribute is only meaningful for an OpenGL ES context.
+ PP_GRAPHICS3DATTRIB_CONTEXT_CLIENT_VERSION = 0x3098
+};
+
+enum PP_Graphics3DAttribValue_Dev {
+ PP_GRAPHICS3DATTRIBVALUE_NONE = 0x3038,
+
+ // PP_GRAPHICS3DATTRIB_CONFIG_CAVEAT values.
+ PP_GRAPHICS3DATTRIBVALUE_SLOW_CONFIG = 0x3050,
+ PP_GRAPHICS3DATTRIBVALUE_NON_CONFORMANT_CONFIG = 0x3051,
+
+ // PP_GRAPHICS3DATTRIB_TRANSPARENT_TYPE values.
+ PP_GRAPHICS3DATTRIBVALUE_TRANSPARENT_RGB = 0x3052,
+
+ // PP_GRAPHICS3DATTRIB_COLOR_BUFFER_TYPE values.
+ PP_GRAPHICS3DATTRIBVALUE_RGB_BUFFER = 0x308E,
+ PP_GRAPHICS3DATTRIBVALUE_LUMINANCE_BUFFER = 0x308F,
+
+ // PP_GRAPHICS3DATTRIB_SURFACE_TYPE mask bits.
+ // Indicates if box filter (PP_GRAPHICS3DATTRIBVALUE_MULTISAMPLE_RESOLVE_BOX)
+ // for resolving the multisample buffer is supported.
+ PP_GRAPHICS3DATTRIBVALUE_MULTISAMPLE_RESOLVE_BOX_BIT = 0x0200,
+ PP_GRAPHICS3DATTRIBVALUE_SWAP_BEHAVIOR_PRESERVED_BIT = 0x0400,
+
+ // PP_GRAPHICS3DATTRIB_RENDERABLE_TYPE mask bits.
+ PP_GRAPHICS3DATTRIBVALUE_OPENGL_ES_BIT = 0x0001,
+ PP_GRAPHICS3DATTRIBVALUE_OPENGL_ES2_BIT = 0x0004,
+ PP_GRAPHICS3DATTRIBVALUE_OPENGL_BIT = 0x0008,
+
+ // PP_GRAPHICS3DATTRIB_RENDER_BUFFER values.
+ // The default value is PP_GRAPHICS3DATTRIBVALUE_BACK_BUFFER.
+ // Surface contains two color buffers and client APIs render into
+ // the back buffer.
+ PP_GRAPHICS3DATTRIBVALUE_BACK_BUFFER = 0x3084,
+ // Surface contains a single color buffer.
+ PP_GRAPHICS3DATTRIBVALUE_SINGLE_BUFFER = 0x3085,
+
+ // PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR values.
+ // The initial value is chosen by the implementation.
+ // Indicates that color buffer contents are unaffected.
+ PP_GRAPHICS3DATTRIBVALUE_BUFFER_PRESERVED = 0x3094,
+ // Indicates that color buffer contents may be destroyed or changed.
+ PP_GRAPHICS3DATTRIBVALUE_BUFFER_DESTROYED = 0x3095,
+
+ // PP_GRAPHICS3DATTRIB_MULTISAMPLE_RESOLVE values.
+ // The default value is PP_GRAPHICS3DATTRIBVALUE_MULTISAMPLE_RESOLVE_DEFAULT.
+ // The default implementation-defined filtering method.
+ PP_GRAPHICS3DATTRIBVALUE_MULTISAMPLE_RESOLVE_DEFAULT = 0x309A,
+ // One-pixel wide box filter placing equal weighting on all
+ // multisample values.
+ PP_GRAPHICS3DATTRIBVALUE_MULTISAMPLE_RESOLVE_BOX = 0x309B,
+
+ // PP_GRAPHICS3DATTRIB_CONTEXT_CLIENT_TYPE values.
+ PP_GRAPHICS3DATTRIBVALUE_OPENGL_ES_API = 0x30A0,
+ PP_GRAPHICS3DATTRIBVALUE_OPENGL_API = 0x30A2
+};
+
+typedef int32_t PP_Config3D_Dev;
+
+#endif // PPAPI_C_DEV_PP_GRAPHICS_3D_DEV_H_
diff --git a/ppapi/c/dev/ppb_context_3d_dev.h b/ppapi/c/dev/ppb_context_3d_dev.h
new file mode 100644
index 0000000..79969a3
--- /dev/null
+++ b/ppapi/c/dev/ppb_context_3d_dev.h
@@ -0,0 +1,128 @@
+/* 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 PPAPI_C_DEV_PPB_CONTEXT_3D_DEV_H_
+#define PPAPI_C_DEV_PPB_CONTEXT_3D_DEV_H_
+
+#include "ppapi/c/dev/pp_graphics_3d_dev.h"
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_resource.h"
+
+#define PPB_CONTEXT_3D_DEV_INTERFACE "PPB_Context3D(Dev);0.1"
+
+struct PPB_Context3D_Dev {
+ // Creates and initializes a rendering context and returns a handle to it.
+ // The context can be used to render to any compatible PPB_Surface3D_Dev.
+ //
+ // If share_context is not NULL, then all shareable data, as defined
+ // by the client API (note that for OpenGL and OpenGL ES, shareable data
+ // excludes texture objects named 0) will be shared by share_context, all
+ // other contexts share_context already shares with, and the newly created
+ // context. An arbitrary number of PPB_Context3D_Dev can share data in
+ // this fashion.
+ //
+ // attrib_list specifies a list of attributes for the context. The list
+ // has the same structure as described for
+ // PPB_Graphics3D_Dev::GetConfigAttribs. The only attribute that can be
+ // specified in attrib_list is PP_GRAPHICS3DATTRIB_CONTEXT_CLIENT_VERSION,
+ // and this attribute may only be specified when creating a OpenGL ES context.
+ // attrib_list may be NULL or empty (first attribute is EGL_NONE), in which
+ // case attributes assume their default values.
+ //
+ // If config is not a valid PP_Config3D_Dev, or does not support
+ // the requested client API, then an PP_GRAPHICS3DERROR_BAD_CONFIG error is
+ // generated (this includes requesting creation of an OpenGL ES 1.x context
+ // when the PP_GRAPHICS3DATTRIB_RENDERABLE_TYPE attribute of config does not
+ // contain PP_GRAPHICS3DATTRIBVALUE_OPENGL_ES_BIT, or creation of an
+ // OpenGL ES 2.x context when the attribute does not contain
+ // PP_GRAPHICS3DATTRIBVALUE_OPENGL_ES2_BIT).
+ //
+ // On failure Create returns NULL resource.
+ PP_Resource (*Create)(PP_Instance instance,
+ PP_Config3D_Dev config,
+ PP_Resource share_context,
+ const int32_t* attrib_list);
+
+ // Returns PP_TRUE if the given resource is a valid PPB_Context3D_Dev,
+ // PP_FALSE if it is an invalid resource or is a resource of another type.
+ PP_Bool (*IsContext3D)(PP_Resource resource);
+
+ // Returns in value the value of attribute for context.
+ // Attributes that can be queried for include:
+ // - PP_GRAPHICS3DATTRIB_CONFIG_ID: returns the ID of the
+ // PP_Config3D_Dev with respect to which the context was created.
+ // - PP_GRAPHICS3DATTRIB_CONTEXT_CLIENT_TYPE: returns the type of client API
+ // this context supports.
+ // - PP_GRAPHICS3DATTRIB_CONTEXT_CLIENT_VERSION: returns the version of the
+ // client API this context supports, as specified at context creation time.
+ // - PP_GRAPHICS3DATTRIB_RENDER_BUFFER: returns the buffer which client API
+ // rendering via this context will use. The value returned depends on
+ // properties of both the context, and the surface to which the context
+ // is bound:
+ // - If the context is bound to a surface, then either
+ // PP_GRAPHICS3DATTRIBVALUE_BACK_BUFFER or
+ // PP_GRAPHICS3DATTRIBVALUE_SINGLE_BUFFER may be returned. The value
+ // returned depends on the buffer requested by the setting of the
+ // PP_GRAPHICS3DATTRIB_RENDER_BUFFER property of the surface.
+ // - If the context is not bound to a surface, then
+ // PP_GRAPHICS3DATTRIBVALUE_NONE will be returned.
+ //
+ // On failure the following error codes may be returned:
+ // - PP_GRAPHICS3DERROR_BAD_ATTRIBUTE if attribute is not a valid attribute
+ // - PP_GRAPHICS3DERROR_BAD_CONTEXT if context is invalid.
+ int32_t (*GetAttrib)(PP_Resource context,
+ int32_t attribute,
+ int32_t* value);
+
+ // Binds context to the draw and read surfaces.
+ // For an OpenGL or OpenGL ES context, draw is used for all operations except
+ // for any pixel data read back or copied, which is taken from the frame
+ // buffer values of read. Note that the same PPB_Surface3D_Dev may be
+ // specified for both draw and read.
+ //
+ // On failure the following error codes may be returned:
+ // - PP_GRAPHICS3DERROR_BAD_MATCH: if draw or read surfaces are not
+ // compatible with context.
+ // - PP_GRAPHICS3DERROR_BAD_ACCESS: if either draw or read is bound to any
+ // other context.
+ // - PP_GRAPHICS3DERROR_BAD_CONTEXT: if context is not a valid context.
+ // - PP_GRAPHICS3DERROR_BAD_SURFACE: if either draw or read are not valid
+ // surfaces.
+ // - PP_GRAPHICS3DERROR_BAD_MATCH:fIf draw and read cannot fit into
+ // graphics memory simultaneously.
+ // - PP_ERROR_NOMEMORY: if the ancillary buffers for draw and read cannot
+ // be allocated.
+ // - PP_GRAPHICS3DERROR_CONTEXT_LOST: if a power management event has
+ // occurred.
+ //
+ // If draw is destroyed after BindSurfaces is called, then subsequent
+ // rendering commands will be processed and the context state will be updated,
+ // but the surface contents become undefined. If read is destroyed after
+ // BindSurfaces then pixel values read from the framebuffer (e.g., as result
+ // of calling glReadPixels) are undefined.
+ //
+ // To unbind surfaces set draw and read to NULL.
+ int32_t (*BindSurfaces)(PP_Resource context,
+ PP_Resource draw,
+ PP_Resource read);
+
+ // Returns the surfaces bound to the context for drawing and reading in
+ // draw and read respectively.
+ //
+ // On failure, the following error codes can be returned:
+ // - PP_GRAPHICS3DERROR_BAD_CONTEXT: if context is not a valid context.
+ // - PP_ERROR_BADARGUMENT: if either draw or read is NULL.
+ int32_t (*GetBoundSurfaces)(PP_Resource context,
+ PP_Resource* draw,
+ PP_Resource* read);
+
+ // TODO(alokp): Move to PPB_Surface3D_Dev
+ int32_t (*SwapBuffers)(PP_Resource context,
+ struct PP_CompletionCallback callback);
+};
+
+#endif // PPAPI_C_DEV_PPB_CONTEXT_3D_DEV_H_
diff --git a/ppapi/c/dev/ppb_graphics_3d_dev.h b/ppapi/c/dev/ppb_graphics_3d_dev.h
index cb67d46..6d5374a 100644
--- a/ppapi/c/dev/ppb_graphics_3d_dev.h
+++ b/ppapi/c/dev/ppb_graphics_3d_dev.h
@@ -5,92 +5,96 @@
#ifndef PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_
#define PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_
-#include "ppapi/c/pp_bool.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/dev/pp_graphics_3d_dev.h"
// Example usage from plugin code:
//
-// PP_Resource context = device->Create(module, config, contextAttribList);
-// CHECK(context);
+// // Setup.
+// PP_Resource context, surface;
+// int32_t config, num_config;
+// g3d->GetConfigs(&config, 1, &num_config);
+// int32_t attribs[] = {PP_GRAPHICS_3D_SURFACE_WIDTH, 800,
+// PP_GRAPHICS_3D_SURFACE_HEIGHT, 800,
+// PP_GRAPHICS_3D_ATTRIB_NONE};
+// c3d->Create(instance, config, NULL, NULL, &context);
+// s3d->Create(instance, config, attribs, &surface);
+// c3d->BindSurfaces(context, surface, surface);
+// inst->BindGraphics(instance, surface);
//
// // Present one frame.
-// CHECK(device->MakeCurrent(context));
-// glClear(GL_COLOR_BUFFER);
-// CHECK(device->MakeCurrent(NULL));
-// CHECK(device->SwapBuffers(context));
+// gles2->Clear(context, GL_COLOR_BUFFER);
+// c3d->SwapBuffers(context);
//
// // Shutdown.
// core->ReleaseResource(context);
+// core->ReleaseResource(surface);
#define PPB_GRAPHICS_3D_DEV_INTERFACE "PPB_Graphics3D(Dev);0.2"
-// These are the same error codes as used by EGL.
-enum {
- PP_GRAPHICS_3D_ERROR_SUCCESS = 0x3000,
- PP_GRAPHICS_3D_ERROR_NOT_INITIALIZED = 0x3001,
- PP_GRAOHICS_3D_ERROR_BAD_CONTEXT = 0x3006,
- PP_GRAPHICS_3D_ERROR_BAD_PARAMETER = 0x300C,
- PP_GRAPHICS_3D_ERROR_CONTEXT_LOST = 0x300E
-};
-
-// QueryString targets, matching EGL ones.
-enum {
- EGL_VENDOR = 0x3053,
- EGL_VERSION = 0x3054,
- EGL_EXTENSIONS = 0x3055,
- EGL_CLIENT_APIS = 0x308D
-};
-
struct PPB_Graphics3D_Dev {
- PP_Bool (*IsGraphics3D)(PP_Resource resource);
-
- // EGL-like configuration ----------------------------------------------------
- PP_Bool (*GetConfigs)(int32_t* configs,
+ // TODO(alokp): Do these functions need module argument.
+
+ // Retrieves the list of all available PP_Config3D_Devs.
+ // configs is a pointer to a buffer containing config_size elements.
+ // On success, PP_OK is returned. The number of configurations is returned
+ // in num_config, and elements 0 through num_config - 1 of configs are filled
+ // in with valid PP_Config3D_Devs. No more than config_size
+ // PP_Config3D_Devs will be returned even if more are available.
+ // However, if GetConfigs is called with configs = NULL, then no
+ // configurations are returned, but the total number of configurations
+ // available will be returned in num_config.
+ //
+ // On failure following error codes are returned:
+ // PP_ERROR_BADARGUMENT if num_config is NULL.
+ // PP_ERROR_FAILED for everything else.
+ int32_t (*GetConfigs)(PP_Config3D_Dev* configs,
int32_t config_size,
int32_t* num_config);
- PP_Bool (*ChooseConfig)(const int32_t* attrib_list,
- int32_t* configs,
- int32_t config_size,
- int32_t* num_config);
-
- // TODO(apatrick): What to do if the browser window is moved to
- // another display? Do the configs potentially change?
- PP_Bool (*GetConfigAttrib)(int32_t config, int32_t attribute, int32_t* value);
-
- const char* (*QueryString)(int32_t name);
- // ---------------------------------------------------------------------------
-
-
- // Create a reference counted 3D context. Releasing a context while it is
- // current automatically sets the current context to NULL. This is only true
- // for the releasing thread. Releasing a context while it is current on
- // another thread leads to undefined behavior.
- PP_Resource (*CreateContext)(PP_Instance instance,
- int32_t config,
- int32_t share_context,
- const int32_t* attrib_list);
-
- // Get the address of any GL functions, whether core or part of an extension.
- // Any thread.
- void* (*GetProcAddress)(const char* name);
-
- // Snapshots the rendered frame and makes it available for composition with
- // the rest of the page. The alpha channel is used for translucency effects.
- // One means fully opaque. Zero means fully transparent. Any thread.
- // TODO(apatrick): premultiplied alpha or linear alpha? Premultiplied alpha is
- // better for correct alpha blending effect. Most existing OpenGL code assumes
- // linear. I could convert from linear to premultiplied during the copy from
- // back-buffer to offscreen "front-buffer".
- PP_Bool (*SwapBuffers)(PP_Resource context);
-
- // Returns the current error for this thread. This is not associated with a
- // particular context. It is distinct from the GL error returned by
- // glGetError.
- uint32_t (*GetError)();
+ // Retrieves the values for each attribute in attrib_list.
+ // attrib_list is a list of attribute name-value pairs terminated with
+ // PP_GRAPHICS3DCONFIGATTRIB_NONE. It is both input and output structure
+ // for this function.
+ //
+ // On success PP_OK is returned and attrib_list is populated with
+ // values of the attributes specified in attrib_list.
+ // On failure following error codes are returned:
+ // PP_GRAPHICS3DERROR_BAD_CONFIG if config is not valid
+ // PP_ERROR_BADARGUMENT if attrib_list is NULL or malformed
+ // PP_GRAPHICS3DERROR_BAD_ATTRIBUTE if any of the attributes in the
+ // attrib_list is not recognized.
+ //
+ // Example usage: To get the values for rgb bits in the color buffer,
+ // this function must be called as following:
+ // int attrib_list[] = {PP_GRAPHICS3DCONFIGATTRIB_RED_SIZE, 0,
+ // PP_GRAPHICS3DCONFIGATTRIB_GREEN_SIZE, 0,
+ // PP_GRAPHICS3DCONFIGATTRIB_BLUE_SIZE, 0,
+ // PP_GRAPHICS3DCONFIGATTRIB_NONE};
+ // GetConfigAttribs(config, attrib_list);
+ // int red_bits = attrib_list[1];
+ // int green_bits = attrib_list[3];
+ // int blue_bits = attrib_list[5];
+ int32_t (*GetConfigAttribs)(PP_Config3D_Dev config,
+ int32_t* attrib_list);
+
+ // Returns a string describing some aspect of the Graphics3D implementation.
+ // name may be one of:
+ // - PP_GRAPHICS3DSTRING_CLIENT_APIS: describes which client rendering APIs
+ // are supported. It is zero-terminated and contains a space-separated list
+ // of API names, which must include at least one of "OpenGL" or "OpenGL_ES".
+ // - PP_GRAPHICS3DSTRING_EXTENSIONS: describes which extensions are supported
+ // by the implementation. The string is zero-terminated and contains a
+ // space-separated list of extension names; extension names themselves do
+ // not contain spaces. If there are no extensions, then the empty string is
+ // returned.
+ // - PP_GRAPHICS3DSTRING_VENDOR: Implementation dependent.
+ // - PP_GRAPHICS3DSTRING_VERSION: The format of the string is:
+ // <major version.minor version><space><vendor specific info>
+ // Both the major and minor portions of the version number are numeric.
+ // The vendor-specific information is optional; if present, its format and
+ // contents are implementation specific.
+ // On failure, PP_VARTYPE_UNDEFINED is returned.
+ struct PP_Var (*GetString)(int32_t name);
};
#endif /* PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ */
diff --git a/ppapi/c/dev/ppb_opengles_dev.h b/ppapi/c/dev/ppb_opengles_dev.h
index 76baa89..254a313 100644
--- a/ppapi/c/dev/ppb_opengles_dev.h
+++ b/ppapi/c/dev/ppb_opengles_dev.h
@@ -8,6 +8,8 @@
#ifndef PPAPI_C_DEV_PPB_OPENGLES_DEV_H_
#define PPAPI_C_DEV_PPB_OPENGLES_DEV_H_
+#include "ppapi/c/pp_resource.h"
+
#ifndef __gl2_h_
typedef unsigned int GLenum;
typedef void GLvoid;
diff --git a/ppapi/cpp/dev/context_3d_dev.cc b/ppapi/cpp/dev/context_3d_dev.cc
new file mode 100644
index 0000000..47f51ac
--- /dev/null
+++ b/ppapi/cpp/dev/context_3d_dev.cc
@@ -0,0 +1,58 @@
+// 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 "ppapi/cpp/dev/context_3d_dev.h"
+
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/dev/ppb_opengles_dev.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/cpp/instance.h"
+#include "ppapi/cpp/module_impl.h"
+
+namespace pp {
+
+namespace {
+
+template <> const char* interface_name<PPB_Context3D_Dev>() {
+ return PPB_CONTEXT_3D_DEV_INTERFACE;
+}
+
+template <> const char* interface_name<PPB_OpenGLES2_Dev>() {
+ return PPB_OPENGLES2_DEV_INTERFACE;
+}
+
+} // namespace
+
+Context3D_Dev Context3D_Dev::FromResource(PP_Resource resource_id) {
+ if (has_interface<PPB_Context3D_Dev>() &&
+ get_interface<PPB_Context3D_Dev>()->IsContext3D(resource_id))
+ return Context3D_Dev(resource_id);
+
+ return Context3D_Dev();
+}
+
+Context3D_Dev::Context3D_Dev(const Instance& instance,
+ PP_Config3D_Dev config,
+ const Context3D_Dev& share_context,
+ const int32_t* attrib_list) {
+ if (has_interface<PPB_Context3D_Dev>() &&
+ has_interface<PPB_OpenGLES2_Dev>()) {
+ PassRefFromConstructor(get_interface<PPB_Context3D_Dev>()->Create(
+ instance.pp_instance(),
+ config,
+ share_context.pp_resource(),
+ attrib_list));
+ }
+}
+
+int32_t Context3D_Dev::SwapBuffers() const {
+ if (!has_interface<PPB_Context3D_Dev>())
+ return PP_ERROR_NOINTERFACE;
+
+ return get_interface<PPB_Context3D_Dev>()->SwapBuffers(
+ pp_resource(),
+ PP_BlockUntilComplete());
+}
+
+} // namespace pp
diff --git a/ppapi/cpp/dev/context_3d_dev.h b/ppapi/cpp/dev/context_3d_dev.h
new file mode 100644
index 0000000..51881f3
--- /dev/null
+++ b/ppapi/cpp/dev/context_3d_dev.h
@@ -0,0 +1,38 @@
+// 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 PPAPI_CPP_DEV_GRAPHICS_3D_DEV_H_
+#define PPAPI_CPP_DEV_GRAPHICS_3D_DEV_H_
+
+#include "ppapi/c/dev/ppb_context_3d_dev.h"
+
+#include "ppapi/cpp/instance.h"
+#include "ppapi/cpp/resource.h"
+
+namespace pp {
+
+class CompletionCallback;
+
+class Context3D_Dev : public Resource {
+ public:
+ // Creates an is_null() Context3D object.
+ Context3D_Dev() {}
+
+ Context3D_Dev(const Instance& instance,
+ PP_Config3D_Dev config,
+ const Context3D_Dev& share_context,
+ const int32_t* attrib_list);
+
+ // TODO(alokp): Move to Surface3D.
+ int32_t SwapBuffers() const;
+
+ protected:
+ explicit Context3D_Dev(PP_Resource resource_id) : Resource(resource_id) {}
+ static Context3D_Dev FromResource(PP_Resource resource_id);
+};
+
+} // namespace pp
+
+#endif // PPAPI_CPP_DEV_GRAPHICS_3D_DEV_H_
+
diff --git a/ppapi/cpp/dev/graphics_3d_dev.cc b/ppapi/cpp/dev/graphics_3d_dev.cc
index 579b610..f0a587e 100644
--- a/ppapi/cpp/dev/graphics_3d_dev.cc
+++ b/ppapi/cpp/dev/graphics_3d_dev.cc
@@ -4,11 +4,9 @@
#include "ppapi/cpp/dev/graphics_3d_dev.h"
-#include "ppapi/cpp/common.h"
-#include "ppapi/cpp/instance.h"
-#include "ppapi/cpp/resource.h"
-#include "ppapi/cpp/module.h"
+#include "ppapi/c/pp_errors.h"
#include "ppapi/cpp/module_impl.h"
+#include "ppapi/cpp/var.h"
namespace pp {
@@ -18,87 +16,37 @@ template <> const char* interface_name<PPB_Graphics3D_Dev>() {
return PPB_GRAPHICS_3D_DEV_INTERFACE;
}
-template <> const char* interface_name<PPB_OpenGLES2_Dev>() {
- return PPB_OPENGLES2_DEV_INTERFACE;
-}
-
} // namespace
// static
-bool Graphics3D_Dev::GetConfigs(int32_t *configs, int32_t config_size,
- int32_t *num_config) {
- if (has_interface<PPB_Graphics3D_Dev>()) {
- return PPBoolToBool(get_interface<PPB_Graphics3D_Dev>()->GetConfigs(
- configs, config_size, num_config));
- }
- return false;
-}
+int32_t Graphics3D_Dev::GetConfigs(int32_t *configs,
+ int32_t config_size,
+ int32_t *num_config) {
+ if (!has_interface<PPB_Graphics3D_Dev>())
+ return PP_ERROR_NOINTERFACE;
-// static
-bool Graphics3D_Dev::ChooseConfig(const int32_t *attrib_list, int32_t *configs,
- int32_t config_size, int32_t *num_config) {
- if (has_interface<PPB_Graphics3D_Dev>()) {
- return PPBoolToBool(get_interface<PPB_Graphics3D_Dev>()->ChooseConfig(
- attrib_list, configs, config_size, num_config));
- }
- return false;
+ return get_interface<PPB_Graphics3D_Dev>()->GetConfigs(
+ configs, config_size, num_config);
}
// static
-bool Graphics3D_Dev::GetConfigAttrib(int32_t config, int32_t attribute,
- int32_t *value) {
- if (has_interface<PPB_Graphics3D_Dev>()) {
- return PPBoolToBool(get_interface<PPB_Graphics3D_Dev>()->GetConfigAttrib(
- config, attribute, value));
- }
- return false;
-}
+int32_t Graphics3D_Dev::GetConfigAttribs(PP_Config3D_Dev config,
+ int32_t* attrib_list) {
+ if (!has_interface<PPB_Graphics3D_Dev>())
+ return PP_ERROR_NOINTERFACE;
-// static
-const char* Graphics3D_Dev::QueryString(int32_t name) {
- if (has_interface<PPB_Graphics3D_Dev>())
- return get_interface<PPB_Graphics3D_Dev>()->QueryString(name);
- return NULL;
+ return get_interface<PPB_Graphics3D_Dev>()->GetConfigAttribs(
+ config, attrib_list);
}
// static
-void* Graphics3D_Dev::GetProcAddress(const char* name) {
- if (has_interface<PPB_Graphics3D_Dev>())
- return get_interface<PPB_Graphics3D_Dev>()->GetProcAddress(name);
- return NULL;
-}
-
-Graphics3D_Dev Graphics3D_Dev::FromResource(PP_Resource resource_id) {
- if (has_interface<PPB_Graphics3D_Dev>() &&
- get_interface<PPB_Graphics3D_Dev>()->IsGraphics3D(resource_id))
- return Graphics3D_Dev(resource_id);
- return Graphics3D_Dev();
-}
-
-uint32_t Graphics3D_Dev::GetError() {
- if (has_interface<PPB_Graphics3D_Dev>())
- return get_interface<PPB_Graphics3D_Dev>()->GetError();
- return PP_GRAPHICS_3D_ERROR_NOT_INITIALIZED;
-}
-
-const PPB_OpenGLES2_Dev* Graphics3D_Dev::GetImplementation() {
- return get_interface<PPB_OpenGLES2_Dev>();
-}
-
-Graphics3D_Dev::Graphics3D_Dev(const Instance& instance,
- int32_t config,
- int32_t share_context,
- const int32_t* attrib_list) {
- if (has_interface<PPB_Graphics3D_Dev>() &&
- has_interface<PPB_OpenGLES2_Dev>()) {
- PassRefFromConstructor(get_interface<PPB_Graphics3D_Dev>()->CreateContext(
- instance.pp_instance(), config, share_context, attrib_list));
- }
-}
+Var Graphics3D_Dev::GetString(int32_t name) {
+ if (!has_interface<PPB_Graphics3D_Dev>())
+ return Var();
-bool Graphics3D_Dev::SwapBuffers() const {
- return has_interface<PPB_Graphics3D_Dev>() &&
- get_interface<PPB_Graphics3D_Dev>()->SwapBuffers(pp_resource());
+ return Var(Var::PassRef(),
+ get_interface<PPB_Graphics3D_Dev>()->GetString(name));
}
} // namespace pp
+
diff --git a/ppapi/cpp/dev/graphics_3d_dev.h b/ppapi/cpp/dev/graphics_3d_dev.h
index 43bd0b0..dece4c0 100644
--- a/ppapi/cpp/dev/graphics_3d_dev.h
+++ b/ppapi/cpp/dev/graphics_3d_dev.h
@@ -6,43 +6,21 @@
#define PPAPI_CPP_DEV_GRAPHICS_3D_DEV_H_
#include "ppapi/c/dev/ppb_graphics_3d_dev.h"
-#include "ppapi/c/dev/ppb_opengles_dev.h"
-#include "ppapi/cpp/instance.h"
-#include "ppapi/cpp/resource.h"
namespace pp {
-class Graphics3D_Dev : public Resource {
- public:
- static bool GetConfigs(int32_t* configs, int32_t config_size,
- int32_t* num_config);
-
- static bool ChooseConfig(const int32_t* attrib_list, int32_t* configs,
- int32_t config_size, int32_t* num_config);
-
- static bool GetConfigAttrib(int32_t config, int32_t attribute,
- int32_t* value);
-
- static const char* QueryString(int32_t name);
+class Var;
- static void* GetProcAddress(const char* name);
-
- static uint32_t GetError();
- static const PPB_OpenGLES2_Dev* GetImplementation();
-
- // Creates an is_null() Graphics3D object.
- Graphics3D_Dev() {}
-
- Graphics3D_Dev(const Instance& instance,
- int32_t config,
- int32_t share_context,
- const int32_t* attrib_list);
+class Graphics3D_Dev {
+ public:
+ static int32_t GetConfigs(PP_Config3D_Dev* configs,
+ int32_t config_size,
+ int32_t* num_config);
- bool SwapBuffers() const;
+ static int32_t GetConfigAttribs(PP_Config3D_Dev config,
+ int32_t* attrib_list);
- protected:
- explicit Graphics3D_Dev(PP_Resource resource_id) : Resource(resource_id) {}
- static Graphics3D_Dev FromResource(PP_Resource resource_id);
+ static Var GetString(int32_t name);
};
} // namespace pp
diff --git a/ppapi/cpp/instance.cc b/ppapi/cpp/instance.cc
index 379518d..369b277 100644
--- a/ppapi/cpp/instance.cc
+++ b/ppapi/cpp/instance.cc
@@ -7,7 +7,7 @@
#include "ppapi/c/dev/ppp_printing_dev.h"
#include "ppapi/c/ppb_instance.h"
#include "ppapi/cpp/common.h"
-#include "ppapi/cpp/dev/graphics_3d_dev.h"
+#include "ppapi/cpp/dev/context_3d_dev.h"
#include "ppapi/cpp/graphics_2d.h"
#include "ppapi/cpp/image_data.h"
#include "ppapi/cpp/logging.h"
@@ -91,7 +91,7 @@ bool Instance::BindGraphics(const Graphics2D& graphics) {
pp_instance(), graphics.pp_resource()));
}
-bool Instance::BindGraphics(const Graphics3D_Dev& graphics) {
+bool Instance::BindGraphics(const Context3D_Dev& graphics) {
if (!has_interface<PPB_Instance>())
return false;
return PPBoolToBool(get_interface<PPB_Instance>()->BindGraphics(
diff --git a/ppapi/cpp/instance.h b/ppapi/cpp/instance.h
index d74995e..161d6b0 100644
--- a/ppapi/cpp/instance.h
+++ b/ppapi/cpp/instance.h
@@ -26,7 +26,7 @@ struct PP_InputEvent;
namespace pp {
class Graphics2D;
-class Graphics3D_Dev;
+class Context3D_Dev;
class ImageData;
class Point;
class Rect;
@@ -89,7 +89,8 @@ class Instance {
bool BindGraphics(const Graphics2D& graphics);
/** See PPB_Instance.BindGraphics. */
- bool BindGraphics(const Graphics3D_Dev& graphics);
+ // TODO(alokp): Change it to Surface3D.
+ bool BindGraphics(const Context3D_Dev& graphics);
/** See PPB_Instance.IsFullFrame. */
bool IsFullFrame();
diff --git a/ppapi/ppapi.gyp b/ppapi/ppapi.gyp
index 16ca6ec..0bc5ea0 100644
--- a/ppapi/ppapi.gyp
+++ b/ppapi/ppapi.gyp
@@ -66,12 +66,14 @@
# Dev interfaces.
'c/dev/pp_cursor_type_dev.h',
'c/dev/pp_file_info_dev.h',
+ 'c/dev/pp_graphics_3d_dev.h',
'c/dev/pp_video_dev.h',
'c/dev/ppb_audio_config_dev.h',
'c/dev/ppb_audio_dev.h',
'c/dev/ppb_audio_trusted_dev.h',
'c/dev/ppb_buffer_dev.h',
'c/dev/ppb_char_set_dev.h',
+ 'c/dev/ppb_context_3d_dev.h',
'c/dev/ppb_cursor_control_dev.h',
'c/dev/ppb_directory_reader_dev.h',
'c/dev/ppb_file_chooser_dev.h',
@@ -164,6 +166,8 @@
'cpp/dev/audio_dev.h',
'cpp/dev/buffer_dev.cc',
'cpp/dev/buffer_dev.h',
+ 'cpp/dev/context_3d_dev.cc',
+ 'cpp/dev/context_3d_dev.h',
'cpp/dev/directory_entry_dev.cc',
'cpp/dev/directory_entry_dev.h',
'cpp/dev/directory_reader_dev.cc',
diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h
index 5f337db..3661bfc 100644
--- a/ppapi/tests/all_c_includes.h
+++ b/ppapi/tests/all_c_includes.h
@@ -11,12 +11,14 @@
#include "ppapi/c/dev/deprecated_bool.h"
#include "ppapi/c/dev/pp_cursor_type_dev.h"
#include "ppapi/c/dev/pp_file_info_dev.h"
+#include "ppapi/c/dev/pp_graphics_3d_dev.h"
#include "ppapi/c/dev/pp_video_dev.h"
#include "ppapi/c/dev/ppb_audio_config_dev.h"
#include "ppapi/c/dev/ppb_audio_dev.h"
#include "ppapi/c/dev/ppb_audio_trusted_dev.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_chooser_dev.h"
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) \