diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-16 20:54:53 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-16 20:54:53 +0000 |
commit | 7196e011d46f597b406e43a1978fa9d846e747c4 (patch) | |
tree | b13701827207e5a223c9a916bdd90d6ca892e6d8 /webkit/gpu | |
parent | c59aa47960369c63ac773d5cf4b2d1052d4a69c3 (diff) | |
download | chromium_src-7196e011d46f597b406e43a1978fa9d846e747c4.zip chromium_src-7196e011d46f597b406e43a1978fa9d846e747c4.tar.gz chromium_src-7196e011d46f597b406e43a1978fa9d846e747c4.tar.bz2 |
Automatically put all GL contexts associated with a particular GPU channel (and renderer process) in the same share group.
This is work towards allowing offscreen canvas contexts to be allocated before compositor view contexts are created. This is a problem because a canvas might be created before the window it will be displayed in exists.
This does not fix the bug on its own.
BUG=80703
Review URL: http://codereview.chromium.org/7104148
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89395 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/gpu')
-rw-r--r-- | webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc | 10 | ||||
-rw-r--r-- | webkit/gpu/webgraphicscontext3d_in_process_impl.cc | 8 |
2 files changed, 12 insertions, 6 deletions
diff --git a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc index 25795a7..1f7e672 100644 --- a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc +++ b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc @@ -29,6 +29,7 @@ #include "gpu/GLES2/gles2_command_buffer.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" +#include "ui/gfx/gl/gl_share_group.h" #include "webkit/glue/gl_bindings_skia_cmd_buffer.h" using gpu::Buffer; @@ -526,6 +527,9 @@ bool GLInProcessContext::Initialize(bool onscreen, const char* allowed_extensions, const int32* attrib_list, const GURL& active_url) { + // Use one share group for all contexts. + static scoped_refptr<gfx::GLShareGroup> share_group(new gfx::GLShareGroup); + DCHECK(size.width() >= 0 && size.height() >= 0); // Ensure the gles2 library is initialized first in a thread safe way. @@ -585,7 +589,8 @@ bool GLInProcessContext::Initialize(bool onscreen, allowed_extensions, attribs, NULL, - 0)) { + 0, + share_group.get())) { LOG(ERROR) << "Could not initialize GpuScheduler."; command_buffer_.reset(); } @@ -600,7 +605,8 @@ bool GLInProcessContext::Initialize(bool onscreen, allowed_extensions, attribs, parent_scheduler, - parent_texture_id_)) { + parent_texture_id_, + share_group.get())) { LOG(ERROR) << "Could not initialize offscreen GpuScheduler."; command_buffer_.reset(); } diff --git a/webkit/gpu/webgraphicscontext3d_in_process_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_impl.cc index 3ff4387..f01543a 100644 --- a/webkit/gpu/webgraphicscontext3d_in_process_impl.cc +++ b/webkit/gpu/webgraphicscontext3d_in_process_impl.cc @@ -110,7 +110,7 @@ bool WebGraphicsContext3DInProcessImpl::initialize( gfx::BindSkiaToInProcessGL(); render_directly_to_web_view_ = render_directly_to_web_view; - gfx::GLContext* share_context = 0; + gfx::GLShareGroup* share_group = 0; if (!render_directly_to_web_view) { // Pick up the compositor's context to share resources with. @@ -118,7 +118,7 @@ bool WebGraphicsContext3DInProcessImpl::initialize( if (view_context) { WebGraphicsContext3DInProcessImpl* contextImpl = static_cast<WebGraphicsContext3DInProcessImpl*>(view_context); - share_context = contextImpl->gl_context_.get(); + share_group = contextImpl->gl_context_->share_group(); } else { // The compositor's context didn't get created // successfully, so conceptually there is no way we can @@ -154,7 +154,7 @@ bool WebGraphicsContext3DInProcessImpl::initialize( return false; } - gl_context_ = gfx::GLContext::CreateGLContext(share_context, + gl_context_ = gfx::GLContext::CreateGLContext(share_group, gl_surface_.get()); if (!gl_context_.get()) { if (!is_gles2_) @@ -169,7 +169,7 @@ bool WebGraphicsContext3DInProcessImpl::initialize( // necessary. webView->mainFrame()->collectGarbage(); - gl_context_ = gfx::GLContext::CreateGLContext(share_context, + gl_context_ = gfx::GLContext::CreateGLContext(share_group, gl_surface_.get()); if (!gl_context_.get()) return false; |