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 /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 'gpu')
-rw-r--r-- | gpu/command_buffer/client/gles2_demo.cc | 3 | ||||
-rw-r--r-- | gpu/command_buffer/service/gpu_scheduler.h | 4 | ||||
-rw-r--r-- | gpu/command_buffer/service/gpu_scheduler_linux.cc | 20 | ||||
-rw-r--r-- | gpu/command_buffer/service/gpu_scheduler_mac.cc | 12 | ||||
-rw-r--r-- | gpu/command_buffer/service/gpu_scheduler_win.cc | 12 | ||||
-rw-r--r-- | gpu/demos/framework/window.cc | 4 | ||||
-rw-r--r-- | gpu/gles2_conform_support/egl/display.cc | 2 |
7 files changed, 26 insertions, 31 deletions
diff --git a/gpu/command_buffer/client/gles2_demo.cc b/gpu/command_buffer/client/gles2_demo.cc index 90825b09..b95a2c2 100644 --- a/gpu/command_buffer/client/gles2_demo.cc +++ b/gpu/command_buffer/client/gles2_demo.cc @@ -65,7 +65,8 @@ bool GLES2Demo::Setup(void* hwnd, int32 size) { NULL, std::vector<int32>(), NULL, - 0)) { + 0, + NULL)) { return NULL; } diff --git a/gpu/command_buffer/service/gpu_scheduler.h b/gpu/command_buffer/service/gpu_scheduler.h index 7f74734..78845df 100644 --- a/gpu/command_buffer/service/gpu_scheduler.h +++ b/gpu/command_buffer/service/gpu_scheduler.h @@ -27,6 +27,7 @@ namespace gfx { class GLContext; +class GLShareGroup; class GLSurface; } @@ -63,7 +64,8 @@ class GpuScheduler : public CommandBufferEngine { const char* allowed_extensions, const std::vector<int32>& attribs, GpuScheduler* parent, - uint32 parent_texture_id); + uint32 parent_texture_id, + gfx::GLShareGroup* share_group); void Destroy(); void DestroyCommon(); diff --git a/gpu/command_buffer/service/gpu_scheduler_linux.cc b/gpu/command_buffer/service/gpu_scheduler_linux.cc index f1d49da..84d821e 100644 --- a/gpu/command_buffer/service/gpu_scheduler_linux.cc +++ b/gpu/command_buffer/service/gpu_scheduler_linux.cc @@ -4,6 +4,7 @@ #include "gpu/command_buffer/service/gpu_scheduler.h" #include "ui/gfx/gl/gl_context.h" +#include "ui/gfx/gl/gl_share_group.h" #include "ui/gfx/gl/gl_surface.h" using ::base::SharedMemory; @@ -17,28 +18,21 @@ bool GpuScheduler::Initialize( const char* allowed_extensions, const std::vector<int32>& attribs, GpuScheduler* parent, - uint32 parent_texture_id) { - // Get the parent decoder and the GLContext to share IDs with, if any. + uint32 parent_texture_id, + gfx::GLShareGroup* share_group) { + // Get the parent decoder. gles2::GLES2Decoder* parent_decoder = NULL; - gfx::GLContext* parent_context = NULL; - void* parent_handle = NULL; if (parent) { parent_decoder = parent->decoder_.get(); DCHECK(parent_decoder); - - parent_context = parent_decoder->GetGLContext(); - DCHECK(parent_context); } // Create either a view or pbuffer based GLSurface. scoped_refptr<gfx::GLSurface> surface; - if (window) { - DCHECK(!parent_handle); - + if (window) surface = gfx::GLSurface::CreateViewGLSurface(window); - } else { + else surface = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1)); - } if (!surface.get()) { LOG(ERROR) << "GpuScheduler::Initialize failed.\n"; @@ -48,7 +42,7 @@ bool GpuScheduler::Initialize( // Create a GLContext and attach the surface. scoped_refptr<gfx::GLContext> context( - gfx::GLContext::CreateGLContext(parent_context, surface.get())); + gfx::GLContext::CreateGLContext(share_group, surface.get())); if (!context.get()) { LOG(ERROR) << "CreateGLContext failed.\n"; Destroy(); diff --git a/gpu/command_buffer/service/gpu_scheduler_mac.cc b/gpu/command_buffer/service/gpu_scheduler_mac.cc index 449a90f..0e4d8d6 100644 --- a/gpu/command_buffer/service/gpu_scheduler_mac.cc +++ b/gpu/command_buffer/service/gpu_scheduler_mac.cc @@ -4,6 +4,7 @@ #include "gpu/command_buffer/service/gpu_scheduler.h" #include "ui/gfx/gl/gl_context.h" +#include "ui/gfx/gl/gl_share_group.h" #include "ui/gfx/gl/gl_surface.h" using ::base::SharedMemory; @@ -17,16 +18,13 @@ bool GpuScheduler::Initialize( const char* allowed_extensions, const std::vector<int32>& attribs, GpuScheduler* parent, - uint32 parent_texture_id) { - // Get the parent decoder and the GLContext to share IDs with, if any. + uint32 parent_texture_id, + gfx::GLShareGroup* share_group) { + // Get the parent decoder. gles2::GLES2Decoder* parent_decoder = NULL; - gfx::GLContext* parent_context = NULL; if (parent) { parent_decoder = parent->decoder_.get(); DCHECK(parent_decoder); - - parent_context = parent_decoder->GetGLContext(); - DCHECK(parent_context); } scoped_refptr<gfx::GLSurface> surface( @@ -39,7 +37,7 @@ bool GpuScheduler::Initialize( // Create a GLContext and attach the surface. scoped_refptr<gfx::GLContext> context( - gfx::GLContext::CreateGLContext(parent_context, surface.get())); + gfx::GLContext::CreateGLContext(share_group, surface.get())); if (!context.get()) { LOG(ERROR) << "CreateGLContext failed.\n"; Destroy(); diff --git a/gpu/command_buffer/service/gpu_scheduler_win.cc b/gpu/command_buffer/service/gpu_scheduler_win.cc index 81ab10b..a92d225 100644 --- a/gpu/command_buffer/service/gpu_scheduler_win.cc +++ b/gpu/command_buffer/service/gpu_scheduler_win.cc @@ -6,6 +6,7 @@ #include "gpu/command_buffer/service/gpu_scheduler.h" #include "ui/gfx/gl/gl_context.h" +#include "ui/gfx/gl/gl_share_group.h" #include "ui/gfx/gl/gl_surface.h" using ::base::SharedMemory; @@ -19,16 +20,13 @@ bool GpuScheduler::Initialize( const char* allowed_extensions, const std::vector<int32>& attribs, GpuScheduler* parent, - uint32 parent_texture_id) { - // Get the parent decoder and the GLContext to share IDs with, if any. + uint32 parent_texture_id, + gfx::GLShareGroup* share_group) { + // Get the parent decoder. gles2::GLES2Decoder* parent_decoder = NULL; - gfx::GLContext* parent_context = NULL; if (parent) { parent_decoder = parent->decoder_.get(); DCHECK(parent_decoder); - - parent_context = parent_decoder->GetGLContext(); - DCHECK(parent_context); } // Create either a view or pbuffer based GLSurface. @@ -47,7 +45,7 @@ bool GpuScheduler::Initialize( // Create a GLContext and attach the surface. scoped_refptr<gfx::GLContext> context( - gfx::GLContext::CreateGLContext(parent_context, surface.get())); + gfx::GLContext::CreateGLContext(share_group, surface.get())); if (!context.get()) { LOG(ERROR) << "CreateGLContext failed.\n"; Destroy(); diff --git a/gpu/demos/framework/window.cc b/gpu/demos/framework/window.cc index 4cbfbf6..01ce0d8 100644 --- a/gpu/demos/framework/window.cc +++ b/gpu/demos/framework/window.cc @@ -64,7 +64,9 @@ bool Window::CreateRenderContext(gfx::PluginWindowHandle hwnd) { if (!gpu_scheduler->Initialize(hwnd, gfx::Size(), gpu::gles2::DisallowedExtensions(), NULL, std::vector<int32>(), - NULL, 0)) { + NULL, + 0, + NULL)) { return false; } diff --git a/gpu/gles2_conform_support/egl/display.cc b/gpu/gles2_conform_support/egl/display.cc index 2308196..3f18c7e 100644 --- a/gpu/gles2_conform_support/egl/display.cc +++ b/gpu/gles2_conform_support/egl/display.cc @@ -112,7 +112,7 @@ EGLSurface Display::CreateWindowSurface(EGLConfig config, new GpuScheduler(command_buffer_.get(), NULL, NULL)); if (!gpu_scheduler->Initialize( win, gfx::Size(), gpu::gles2::DisallowedExtensions(), NULL, - attribs, NULL, 0)) + attribs, NULL, 0, NULL)) return EGL_NO_SURFACE; command_buffer_->SetPutOffsetChangeCallback( |