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

Unified Diff: content/browser/compositor/reflector_texture.cc

Issue 1123763003: Draw the offscreen texture to reflector's surface without extra copy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moved texture code to ReflectorTexture Created 5 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
« no previous file with comments | « content/browser/compositor/reflector_texture.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/compositor/reflector_texture.cc
diff --git a/content/browser/compositor/reflector_texture.cc b/content/browser/compositor/reflector_texture.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ed6a3bd86dbe7774254ad83b629fcf1b869e793c
--- /dev/null
+++ b/content/browser/compositor/reflector_texture.cc
@@ -0,0 +1,48 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/compositor/reflector_texture.h"
+
+#include "content/browser/compositor/owned_mailbox.h"
+#include "content/common/gpu/client/context_provider_command_buffer.h"
+#include "content/common/gpu/client/gl_helper.h"
+#include "gpu/command_buffer/client/context_support.h"
+#include "gpu/command_buffer/client/gles2_interface.h"
+
+namespace content {
+
+ReflectorTexture::ReflectorTexture(cc::ContextProvider* context_provider)
+ : texture_id_(0) {
+ GLHelper* shared_helper =
+ ImageTransportFactory::GetInstance()->GetGLHelper();
+ mailbox_ = new OwnedMailbox(shared_helper);
+ gpu::gles2::GLES2Interface* gl = context_provider->ContextGL();
+
+ gl_helper_.reset(new GLHelper(gl, context_provider->ContextSupport()));
+
+ texture_id_ = gl_helper_->ConsumeMailboxToTexture(
+ mailbox_->mailbox(), mailbox_->sync_point());
+}
+
+ReflectorTexture::~ReflectorTexture() {
+ gl_helper_->DeleteTexture(texture_id_);
+}
+
+void ReflectorTexture::CopyTextureFullImage(const gfx::Size& size) {
+ gl_helper_->CopyTextureFullImage(texture_id_, size);
+ // Insert a barrier to make the copy show up in the mirroring compositor's
+ // mailbox. Since the the compositor contexts and the
+ // ImageTransportFactory's
+ // GLHelper are all on the same GPU channel, this is sufficient instead of
+ // plumbing through a sync point.
+ gl_helper_->InsertOrderingBarrier();
+}
+
+void ReflectorTexture::CopyTextureSubImage(const gfx::Rect& rect) {
+ gl_helper_->CopyTextureSubImage(texture_id_, rect);
+ // Insert a barrier for the same reason above.
+ gl_helper_->InsertOrderingBarrier();
+}
+
+} // namespace content
« no previous file with comments | « content/browser/compositor/reflector_texture.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698