From 9ed07f8831639f9d6c74b9633262710af532df5b Mon Sep 17 00:00:00 2001 From: "scshunt@google.com" Date: Tue, 29 May 2012 21:54:55 +0000 Subject: Add the necessary plumbing mechanisms to ensure proper WebGL support inside the tag, which is a separate patch. Known bugs: Not all aspects of context sharing work properly; in no models would render although the background animated properly. Requires a separate WebKit patch: https://bugs.webkit.org/show_bug.cgi?id=86504 R=fsamuel@chromium.org,piman@chromium.org,brettw@chromium.org BUG=None TEST=compiles Review URL: https://chromiumcodereview.appspot.com/10386145 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139385 0039d316-1c4b-4281-b951-d872f2087c98 --- content/renderer/browser_plugin/guest_to_embedder_channel.cc | 1 + content/renderer/pepper/pepper_platform_context_3d_impl.cc | 12 ++++++++++-- content/renderer/pepper/pepper_platform_context_3d_impl.h | 3 ++- 3 files changed, 13 insertions(+), 3 deletions(-) (limited to 'content') diff --git a/content/renderer/browser_plugin/guest_to_embedder_channel.cc b/content/renderer/browser_plugin/guest_to_embedder_channel.cc index ad82a68..1e5cec0 100644 --- a/content/renderer/browser_plugin/guest_to_embedder_channel.cc +++ b/content/renderer/browser_plugin/guest_to_embedder_channel.cc @@ -168,6 +168,7 @@ bool GuestToEmbedderChannel::CreateGraphicsContext( bool success = Send(new PpapiHostMsg_PPBGraphics3D_Create( ppapi::API_ID_PPB_GRAPHICS_3D, render_view->guest_pp_instance(), + ppapi::HostResource(), attribs, &resource)); if (!success || resource.is_null()) diff --git a/content/renderer/pepper/pepper_platform_context_3d_impl.cc b/content/renderer/pepper/pepper_platform_context_3d_impl.cc index 8e2f96a..670e9ab1 100644 --- a/content/renderer/pepper/pepper_platform_context_3d_impl.cc +++ b/content/renderer/pepper/pepper_platform_context_3d_impl.cc @@ -51,7 +51,8 @@ PlatformContext3DImpl::~PlatformContext3DImpl() { channel_ = NULL; } -bool PlatformContext3DImpl::Init(const int32* attrib_list) { +bool PlatformContext3DImpl::Init(const int32* attrib_list, + PlatformContext3D* share_context) { // Ignore initializing more than once. if (command_buffer_) return true; @@ -114,9 +115,16 @@ bool PlatformContext3DImpl::Init(const int32* attrib_list) { attribs.push_back(PP_GRAPHICS3DATTRIB_NONE); } + CommandBufferProxy* share_buffer = NULL; + if (share_context) { + PlatformContext3DImpl* share_impl = + static_cast(share_context); + share_buffer = share_impl->command_buffer_; + } + command_buffer_ = channel_->CreateOffscreenCommandBuffer( surface_size, - NULL, + share_buffer, "*", attribs, GURL::EmptyGURL(), diff --git a/content/renderer/pepper/pepper_platform_context_3d_impl.h b/content/renderer/pepper/pepper_platform_context_3d_impl.h index 8d3a0f6..bee7505 100644 --- a/content/renderer/pepper/pepper_platform_context_3d_impl.h +++ b/content/renderer/pepper/pepper_platform_context_3d_impl.h @@ -36,7 +36,8 @@ class PlatformContext3DImpl PepperParentContextProvider* parent_context_provider); virtual ~PlatformContext3DImpl(); - virtual bool Init(const int32* attrib_list) OVERRIDE; + virtual bool Init(const int32* attrib_list, + PlatformContext3D* share_context) OVERRIDE; virtual unsigned GetBackingTextureId() OVERRIDE; virtual bool IsOpaque() OVERRIDE; virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE; -- cgit v1.1