diff options
author | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 04:51:52 +0000 |
---|---|---|
committer | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 04:51:52 +0000 |
commit | be8fd116e295fd7ef6c75e4dd717017d68c7fd57 (patch) | |
tree | c6ef9e02c1e60d189ead67e9a7ce90f01c8da2e8 /gpu | |
parent | 79cc8d9d943c79c2e5237265591d36b884470fbf (diff) | |
download | chromium_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
Diffstat (limited to 'gpu')
-rwxr-xr-x | gpu/command_buffer/build_gles2_cmd_buffer.py | 21 | ||||
-rw-r--r-- | gpu/demos/framework/pepper.cc | 23 |
2 files changed, 24 insertions, 20 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_; }; |