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

Unified Diff: content/renderer/gpu/renderer_gl_context.cc

Issue 7518016: Revert 94743 - Allow the renderer process to map textures from one context into another. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 5 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/gpu/renderer_gl_context.cc
===================================================================
--- content/renderer/gpu/renderer_gl_context.cc (revision 94806)
+++ content/renderer/gpu/renderer_gl_context.cc (working copy)
@@ -134,38 +134,6 @@
#endif
}
-bool RendererGLContext::MapExternalResource(
- gpu::resource_type::ResourceType resource_type,
- uint32 resource_source_id,
- RendererGLContext* source_context,
- uint32 resource_dest_id) {
- if (!command_buffer_)
- return false;
-
- return command_buffer_->MapExternalResource(
- resource_type,
- resource_source_id,
- source_context ? source_context->command_buffer_ : NULL,
- resource_dest_id);
-}
-
-bool RendererGLContext::MapExternalResourceToParent(
- gpu::resource_type::ResourceType resource_type,
- uint32 resource_source_id,
- uint32 resource_dest_id) {
- if (!command_buffer_)
- return false;
-
- if (!parent_.get())
- return false;
-
- return parent_->MapExternalResource(
- resource_type,
- resource_source_id,
- this,
- resource_dest_id);
-}
-
bool RendererGLContext::SetParent(RendererGLContext* new_parent) {
if (parent_.get() == new_parent)
return true;
@@ -227,18 +195,45 @@
}
uint32 RendererGLContext::CreateParentTexture(const gfx::Size& size) {
+ // Allocate a texture ID with respect to the parent.
if (parent_.get()) {
- // Reserve a parent texture ID on the client side.
- uint32 parent_texture_id = 0;
- parent_->gles2_implementation_->GenTextures(1, &parent_texture_id);
- return parent_texture_id;
+ if (!MakeCurrent(parent_.get()))
+ return 0;
+ uint32 texture_id = parent_->gles2_implementation_->MakeTextureId();
+ parent_->gles2_implementation_->BindTexture(GL_TEXTURE_2D, texture_id);
+ parent_->gles2_implementation_->TexParameteri(
+ GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ parent_->gles2_implementation_->TexParameteri(
+ GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ parent_->gles2_implementation_->TexParameteri(
+ GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ parent_->gles2_implementation_->TexParameteri(
+ GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
+ parent_->gles2_implementation_->TexImage2D(GL_TEXTURE_2D,
+ 0, // mip level
+ GL_RGBA,
+ size.width(),
+ size.height(),
+ 0, // border
+ GL_RGBA,
+ GL_UNSIGNED_BYTE,
+ NULL);
+ // Make sure that the parent texture's storage is allocated before we let
+ // the caller attempt to use it.
+ int32 token = parent_->gles2_helper_->InsertToken();
+ parent_->gles2_helper_->WaitForToken(token);
+ return texture_id;
}
return 0;
}
void RendererGLContext::DeleteParentTexture(uint32 texture) {
- if (parent_.get())
+ if (parent_.get()) {
+ if (!MakeCurrent(parent_.get()))
+ return;
parent_->gles2_implementation_->DeleteTextures(1, &texture);
+ }
}
void RendererGLContext::SetSwapBuffersCallback(Callback0::Type* callback) {
« no previous file with comments | « content/renderer/gpu/renderer_gl_context.h ('k') | content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698