Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3326)

Unified Diff: content/renderer/pepper/pepper_platform_context_3d_impl.cc

Issue 15798014: Replace context parenting by sharing through mailboxes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add test Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/pepper/pepper_platform_context_3d_impl.cc
diff --git a/content/renderer/pepper/pepper_platform_context_3d_impl.cc b/content/renderer/pepper/pepper_platform_context_3d_impl.cc
index b9856dac728434d96a4866ecab93e4351b468a39..4c4309f0dc92d0e75bbc8c6a0476f098913441ee 100644
--- a/content/renderer/pepper/pepper_platform_context_3d_impl.cc
+++ b/content/renderer/pepper/pepper_platform_context_3d_impl.cc
@@ -108,6 +108,13 @@ bool PlatformContext3DImpl::Init(const int32* attrib_list,
return false;
if (!command_buffer_->Initialize())
return false;
+ std::vector<gpu::Mailbox> names;
+ if (!command_buffer_->GenerateMailboxNames(1, &names))
+ return false;
+ DCHECK_EQ(names.size(), 1u);
+ mailbox_ = names[0];
+ if (!command_buffer_->ProduceFrontBuffer(mailbox_))
+ return false;
command_buffer_->SetChannelErrorCallback(
base::Bind(&PlatformContext3DImpl::OnContextLost,
@@ -130,18 +137,12 @@ bool PlatformContext3DImpl::SetParentAndCreateBackingTextureIfNeeded() {
if (!parent_context_provider_.get())
return false;
- // Flush any remaining commands in the parent context to make sure the
- // texture id accounting stays consistent.
gpu::gles2::GLES2Implementation* parent_gles2 =
parent_context_provider_->Context3d()->GetImplementation();
- parent_gles2->helper()->CommandBufferHelper::Finish();
- parent_texture_id_ = parent_gles2->MakeTextureId();
-
- CommandBufferProxyImpl* parent_command_buffer =
- parent_context_provider_->Context3d()->GetCommandBufferProxy();
- if (!command_buffer_->SetParent(parent_command_buffer, parent_texture_id_))
- return false;
-
+ parent_gles2->GenTextures(1, &parent_texture_id_);
+ parent_gles2->BindTexture(GL_TEXTURE_2D, parent_texture_id_);
+ parent_gles2->ConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox_.name);
+ parent_gles2->ShallowFlushCHROMIUM();
return true;
}
@@ -150,12 +151,10 @@ void PlatformContext3DImpl::DestroyParentContextProviderAndBackingTexture() {
return;
if (parent_texture_id_) {
- // Flush any remaining commands in the parent context to make sure the
- // texture id accounting stays consistent.
gpu::gles2::GLES2Implementation* parent_gles2 =
parent_context_provider_->Context3d()->GetImplementation();
- parent_gles2->helper()->CommandBufferHelper::Finish();
- parent_gles2->FreeTextureId(parent_texture_id_);
+ parent_gles2->DeleteTextures(1, &parent_texture_id_);
+ parent_gles2->ShallowFlushCHROMIUM();
parent_texture_id_ = 0;
}

Powered by Google App Engine
This is Rietveld 408576698