diff options
author | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-17 10:02:55 +0000 |
---|---|---|
committer | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-17 10:02:55 +0000 |
commit | 5844ad129d3a308f4cfb11ff607faab2baf821ca (patch) | |
tree | bdca1a76834e9dbdb98c22cb66b71ce955117223 | |
parent | 27b63409118ffb337df1f75a0f8d89d27f389ec0 (diff) | |
download | chromium_src-5844ad129d3a308f4cfb11ff607faab2baf821ca.zip chromium_src-5844ad129d3a308f4cfb11ff607faab2baf821ca.tar.gz chromium_src-5844ad129d3a308f4cfb11ff607faab2baf821ca.tar.bz2 |
cc: Delete ContextProvider::MakeGrContextCurrent.
It is not necessary to explicitly make the GrContext current.
The underlying GL context is automatically made current via a
callback setup by all implementations of cc::ContextProvider.
Ganesh calls this callback before issuing any GL command, which
ensures the the appropriate GL context is current.
BUG=334886
Review URL: https://codereview.chromium.org/135753006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245475 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | cc/output/context_provider.h | 1 | ||||
-rw-r--r-- | cc/output/gl_renderer.cc | 6 | ||||
-rw-r--r-- | cc/resources/raster_worker_pool.cc | 2 | ||||
-rw-r--r-- | cc/test/test_context_provider.cc | 2 | ||||
-rw-r--r-- | cc/test/test_context_provider.h | 1 | ||||
-rw-r--r-- | cc/test/test_in_process_context_provider.cc | 45 | ||||
-rw-r--r-- | cc/test/test_in_process_context_provider.h | 1 | ||||
-rw-r--r-- | content/common/gpu/client/context_provider_command_buffer.cc | 8 | ||||
-rw-r--r-- | content/common/gpu/client/context_provider_command_buffer.h | 1 | ||||
-rw-r--r-- | mojo/examples/aura_demo/demo_context_factory.cc | 1 | ||||
-rw-r--r-- | mojo/examples/compositor_app/compositor_host.cc | 1 | ||||
-rw-r--r-- | webkit/common/gpu/context_provider_in_process.cc | 8 | ||||
-rw-r--r-- | webkit/common/gpu/context_provider_in_process.h | 1 | ||||
-rw-r--r-- | webkit/common/gpu/grcontext_for_webgraphicscontext3d.cc | 4 |
14 files changed, 19 insertions, 63 deletions
diff --git a/cc/output/context_provider.h b/cc/output/context_provider.h index 134e4f5..934118e 100644 --- a/cc/output/context_provider.h +++ b/cc/output/context_provider.h @@ -31,7 +31,6 @@ class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> { virtual gpu::gles2::GLES2Interface* ContextGL() = 0; virtual gpu::ContextSupport* ContextSupport() = 0; virtual class GrContext* GrContext() = 0; - virtual void MakeGrContextCurrent() = 0; struct Capabilities { gpu::Capabilities gpu; diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index d9b4882..028c409 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -464,9 +464,6 @@ static SkBitmap ApplyImageFilter(GLRenderer* renderer, // texture. renderer->resource_provider()->Flush(); - // Make sure skia uses the correct GL context. - offscreen_contexts->MakeGrContextCurrent(); - // Wrap the source texture in a Ganesh platform texture. GrBackendTextureDesc backend_texture_description; backend_texture_description.fWidth = source_texture_resource->size().width(); @@ -572,9 +569,6 @@ static SkBitmap ApplyBlendModeWithBackdrop( // texture. renderer->resource_provider()->Flush(); - // Make sure skia uses the correct GL context. - offscreen_contexts->MakeGrContextCurrent(); - // Wrap the source texture in a Ganesh platform texture. GrBackendTextureDesc backend_texture_description; backend_texture_description.fConfig = kSkia8888_GrPixelConfig; diff --git a/cc/resources/raster_worker_pool.cc b/cc/resources/raster_worker_pool.cc index fd0aacc..6fc8ff5 100644 --- a/cc/resources/raster_worker_pool.cc +++ b/cc/resources/raster_worker_pool.cc @@ -616,8 +616,6 @@ void RasterWorkerPool::RunGpuRasterTasks(const RasterTaskVector& tasks) { if (tasks.empty()) return; - context_provider_->MakeGrContextCurrent(); - GrContext* gr_context = context_provider_->GrContext(); // TODO(alokp): Implement TestContextProvider::GrContext(). if (gr_context) diff --git a/cc/test/test_context_provider.cc b/cc/test/test_context_provider.cc index f40f8ba..887317a 100644 --- a/cc/test/test_context_provider.cc +++ b/cc/test/test_context_provider.cc @@ -94,8 +94,6 @@ class GrContext* TestContextProvider::GrContext() { return NULL; } -void TestContextProvider::MakeGrContextCurrent() {} - bool TestContextProvider::IsContextLost() { DCHECK(bound_); DCHECK(context_thread_checker_.CalledOnValidThread()); diff --git a/cc/test/test_context_provider.h b/cc/test/test_context_provider.h index d2a0db1..68f7382 100644 --- a/cc/test/test_context_provider.h +++ b/cc/test/test_context_provider.h @@ -32,7 +32,6 @@ class TestContextProvider : public ContextProvider { virtual gpu::gles2::GLES2Interface* ContextGL() OVERRIDE; virtual gpu::ContextSupport* ContextSupport() OVERRIDE; virtual class GrContext* GrContext() OVERRIDE; - virtual void MakeGrContextCurrent() OVERRIDE; virtual bool IsContextLost() OVERRIDE; virtual void VerifyContexts() OVERRIDE; virtual bool DestroyedOnMainThread() OVERRIDE; diff --git a/cc/test/test_in_process_context_provider.cc b/cc/test/test_in_process_context_provider.cc index 0381004..579a2e8 100644 --- a/cc/test/test_in_process_context_provider.cc +++ b/cc/test/test_in_process_context_provider.cc @@ -63,30 +63,6 @@ gpu::ContextSupport* TestInProcessContextProvider::ContextSupport() { return context_->GetImplementation(); } -static void BindGrContextCallback(const GrGLInterface* interface) { -#if GR_GL_PER_GL_FUNC_CALLBACK - reinterpret_cast<TestInProcessContextProvider*>(interface->fCallbackData) - ->MakeGrContextCurrent(); -#endif // GR_GL_PER_GL_FUNC_CALLBACK -} - -class GrContext* TestInProcessContextProvider::GrContext() { - if (gr_context_) - return gr_context_.get(); - - skia::RefPtr<GrGLInterface> interface = - skia::AdoptRef(skia_bindings::CreateCommandBufferSkiaGLBinding()); -#if GR_GL_PER_GL_FUNC_CALLBACK - interface->fCallback = BindGrContextCallback; - interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this); -#endif // GR_GL_PER_GL_FUNC_CALLBACK - - gr_context_ = skia::AdoptRef(GrContext::Create( - kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(interface.get()))); - - return gr_context_.get(); -} - namespace { // Singleton used to initialize and terminate the gles2 library. @@ -105,11 +81,28 @@ static base::LazyInstance<GLES2Initializer> g_gles2_initializer = } // namespace -void TestInProcessContextProvider::MakeGrContextCurrent() { +static void BindGrContextCallback(const GrGLInterface* interface) { + TestInProcessContextProvider* context_provider = + reinterpret_cast<TestInProcessContextProvider*>(interface->fCallbackData); + // Make sure the gles2 library is initialized first on exactly one thread. g_gles2_initializer.Get(); + gles2::SetGLContext(context_provider->ContextGL()); +} - gles2::SetGLContext(context_->GetImplementation()); +class GrContext* TestInProcessContextProvider::GrContext() { + if (gr_context_) + return gr_context_.get(); + + skia::RefPtr<GrGLInterface> interface = + skia::AdoptRef(skia_bindings::CreateCommandBufferSkiaGLBinding()); + interface->fCallback = BindGrContextCallback; + interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this); + + gr_context_ = skia::AdoptRef(GrContext::Create( + kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(interface.get()))); + + return gr_context_.get(); } ContextProvider::Capabilities diff --git a/cc/test/test_in_process_context_provider.h b/cc/test/test_in_process_context_provider.h index bcbcad9..c3770f3 100644 --- a/cc/test/test_in_process_context_provider.h +++ b/cc/test/test_in_process_context_provider.h @@ -26,7 +26,6 @@ class TestInProcessContextProvider : public ContextProvider { virtual gpu::gles2::GLES2Interface* ContextGL() OVERRIDE; virtual gpu::ContextSupport* ContextSupport() OVERRIDE; virtual class GrContext* GrContext() OVERRIDE; - virtual void MakeGrContextCurrent() OVERRIDE; virtual Capabilities ContextCapabilities() OVERRIDE; virtual bool IsContextLost() OVERRIDE; virtual void VerifyContexts() OVERRIDE; diff --git a/content/common/gpu/client/context_provider_command_buffer.cc b/content/common/gpu/client/context_provider_command_buffer.cc index 6535719..f0b25f0 100644 --- a/content/common/gpu/client/context_provider_command_buffer.cc +++ b/content/common/gpu/client/context_provider_command_buffer.cc @@ -139,14 +139,6 @@ class GrContext* ContextProviderCommandBuffer::GrContext() { return gr_context_->get(); } -void ContextProviderCommandBuffer::MakeGrContextCurrent() { - DCHECK(lost_context_callback_proxy_); // Is bound to thread. - DCHECK(context_thread_checker_.CalledOnValidThread()); - DCHECK(gr_context_); - - context3d_->makeContextCurrent(); -} - cc::ContextProvider::Capabilities ContextProviderCommandBuffer::ContextCapabilities() { DCHECK(lost_context_callback_proxy_); // Is bound to thread. diff --git a/content/common/gpu/client/context_provider_command_buffer.h b/content/common/gpu/client/context_provider_command_buffer.h index 8859d2b..05d181e 100644 --- a/content/common/gpu/client/context_provider_command_buffer.h +++ b/content/common/gpu/client/context_provider_command_buffer.h @@ -46,7 +46,6 @@ class CONTENT_EXPORT ContextProviderCommandBuffer virtual gpu::gles2::GLES2Interface* ContextGL() OVERRIDE; virtual gpu::ContextSupport* ContextSupport() OVERRIDE; virtual class GrContext* GrContext() OVERRIDE; - virtual void MakeGrContextCurrent() OVERRIDE; virtual Capabilities ContextCapabilities() OVERRIDE; virtual bool IsContextLost() OVERRIDE; virtual void VerifyContexts() OVERRIDE; diff --git a/mojo/examples/aura_demo/demo_context_factory.cc b/mojo/examples/aura_demo/demo_context_factory.cc index 64214ca..732a872 100644 --- a/mojo/examples/aura_demo/demo_context_factory.cc +++ b/mojo/examples/aura_demo/demo_context_factory.cc @@ -34,7 +34,6 @@ class MojoContextProvider : public cc::ContextProvider { return gles2_client_impl_->Support(); } virtual class GrContext* GrContext() OVERRIDE { return NULL; } - virtual void MakeGrContextCurrent() OVERRIDE {} virtual Capabilities ContextCapabilities() OVERRIDE { return capabilities_; } virtual bool IsContextLost() OVERRIDE { return !gles2_client_impl_->Interface(); diff --git a/mojo/examples/compositor_app/compositor_host.cc b/mojo/examples/compositor_app/compositor_host.cc index 21bff68..61bac34 100644 --- a/mojo/examples/compositor_app/compositor_host.cc +++ b/mojo/examples/compositor_app/compositor_host.cc @@ -29,7 +29,6 @@ class MojoContextProvider : public cc::ContextProvider { return gles2_client_impl_->Support(); } virtual class GrContext* GrContext() OVERRIDE { return NULL; } - virtual void MakeGrContextCurrent() OVERRIDE {} virtual Capabilities ContextCapabilities() OVERRIDE { return capabilities_; } virtual bool IsContextLost() OVERRIDE { return !gles2_client_impl_->Interface(); diff --git a/webkit/common/gpu/context_provider_in_process.cc b/webkit/common/gpu/context_provider_in_process.cc index 1e543a5..6f1be9c 100644 --- a/webkit/common/gpu/context_provider_in_process.cc +++ b/webkit/common/gpu/context_provider_in_process.cc @@ -147,14 +147,6 @@ class GrContext* ContextProviderInProcess::GrContext() { return gr_context_->get(); } -void ContextProviderInProcess::MakeGrContextCurrent() { - DCHECK(lost_context_callback_proxy_); // Is bound to thread. - DCHECK(context_thread_checker_.CalledOnValidThread()); - DCHECK(gr_context_); - - context3d_->makeContextCurrent(); -} - bool ContextProviderInProcess::IsContextLost() { DCHECK(lost_context_callback_proxy_); // Is bound to thread. DCHECK(context_thread_checker_.CalledOnValidThread()); diff --git a/webkit/common/gpu/context_provider_in_process.h b/webkit/common/gpu/context_provider_in_process.h index 59d5866..fc1d15c 100644 --- a/webkit/common/gpu/context_provider_in_process.h +++ b/webkit/common/gpu/context_provider_in_process.h @@ -37,7 +37,6 @@ class WEBKIT_GPU_EXPORT ContextProviderInProcess virtual ::gpu::gles2::GLES2Interface* ContextGL() OVERRIDE; virtual ::gpu::ContextSupport* ContextSupport() OVERRIDE; virtual class GrContext* GrContext() OVERRIDE; - virtual void MakeGrContextCurrent() OVERRIDE; virtual bool IsContextLost() OVERRIDE; virtual void VerifyContexts() OVERRIDE; virtual bool DestroyedOnMainThread() OVERRIDE; diff --git a/webkit/common/gpu/grcontext_for_webgraphicscontext3d.cc b/webkit/common/gpu/grcontext_for_webgraphicscontext3d.cc index 61f605c..947a515 100644 --- a/webkit/common/gpu/grcontext_for_webgraphicscontext3d.cc +++ b/webkit/common/gpu/grcontext_for_webgraphicscontext3d.cc @@ -14,10 +14,8 @@ namespace gpu { static void BindWebGraphicsContext3DGLContextCallback( const GrGLInterface* interface) { -#if GR_GL_PER_GL_FUNC_CALLBACK reinterpret_cast<blink::WebGraphicsContext3D*>( interface->fCallbackData)->makeContextCurrent(); -#endif } GrContextForWebGraphicsContext3D::GrContextForWebGraphicsContext3D( @@ -30,11 +28,9 @@ GrContextForWebGraphicsContext3D::GrContextForWebGraphicsContext3D( if (!interface) return; -#if GR_GL_PER_GL_FUNC_CALLBACK interface->fCallback = BindWebGraphicsContext3DGLContextCallback; interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(context3d); -#endif gr_context_ = skia::AdoptRef(GrContext::Create( kOpenGL_GrBackend, |