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

Side by Side Diff: content/common/gpu/client/gl_helper.cc

Issue 105743004: Add gpu::MailboxHolder to hold state for a gpu::Mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 89bedb8c Reference return. Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/gpu/client/gl_helper.h" 5 #include "content/common/gpu/client/gl_helper.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/debug/trace_event.h" 11 #include "base/debug/trace_event.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "content/common/gpu/client/gl_helper_scaling.h" 18 #include "content/common/gpu/client/gl_helper_scaling.h"
19 #include "gpu/command_buffer/client/context_support.h" 19 #include "gpu/command_buffer/client/context_support.h"
20 #include "gpu/command_buffer/common/mailbox.h" 20 #include "gpu/command_buffer/common/mailbox.h"
21 #include "gpu/command_buffer/common/mailbox_holder.h"
21 #include "media/base/video_frame.h" 22 #include "media/base/video_frame.h"
22 #include "media/base/video_util.h" 23 #include "media/base/video_util.h"
23 #include "third_party/WebKit/public/platform/WebCString.h" 24 #include "third_party/WebKit/public/platform/WebCString.h"
24 #include "third_party/skia/include/core/SkRegion.h" 25 #include "third_party/skia/include/core/SkRegion.h"
25 #include "ui/gfx/rect.h" 26 #include "ui/gfx/rect.h"
26 #include "ui/gfx/size.h" 27 #include "ui/gfx/size.h"
27 #include "ui/gl/gl_bindings.h" 28 #include "ui/gl/gl_bindings.h"
28 29
29 using blink::WebGLId; 30 using blink::WebGLId;
30 using blink::WebGraphicsContext3D; 31 using blink::WebGraphicsContext3D;
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 void GLHelper::DeleteTexture(blink::WebGLId texture_id) { 700 void GLHelper::DeleteTexture(blink::WebGLId texture_id) {
700 context_->deleteTexture(texture_id); 701 context_->deleteTexture(texture_id);
701 } 702 }
702 703
703 uint32 GLHelper::InsertSyncPoint() { return context_->insertSyncPoint(); } 704 uint32 GLHelper::InsertSyncPoint() { return context_->insertSyncPoint(); }
704 705
705 void GLHelper::WaitSyncPoint(uint32 sync_point) { 706 void GLHelper::WaitSyncPoint(uint32 sync_point) {
706 context_->waitSyncPoint(sync_point); 707 context_->waitSyncPoint(sync_point);
707 } 708 }
708 709
709 gpu::Mailbox GLHelper::ProduceMailboxFromTexture(blink::WebGLId texture_id, 710 gpu::MailboxHolder GLHelper::ProduceMailboxHolderFromTexture(
710 uint32* sync_point) { 711 blink::WebGLId texture_id) {
711 gpu::Mailbox mailbox; 712 gpu::Mailbox mailbox;
712 context_->genMailboxCHROMIUM(mailbox.name); 713 context_->genMailboxCHROMIUM(mailbox.name);
713 if (mailbox.IsZero()) { 714 if (mailbox.IsZero())
714 *sync_point = 0; 715 return gpu::MailboxHolder();
715 return mailbox;
716 }
717 content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(context_, 716 content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(context_,
718 texture_id); 717 texture_id);
719 context_->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); 718 context_->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
720 *sync_point = context_->insertSyncPoint(); 719 return gpu::MailboxHolder(
721 return mailbox; 720 mailbox, GL_TEXTURE_2D, context_->insertSyncPoint());
722 } 721 }
723 722
724 blink::WebGLId GLHelper::ConsumeMailboxToTexture(const gpu::Mailbox& mailbox, 723 blink::WebGLId GLHelper::ConsumeMailboxToTexture(const gpu::Mailbox& mailbox,
725 uint32 sync_point) { 724 uint32 sync_point) {
726 if (mailbox.IsZero()) 725 if (mailbox.IsZero())
727 return 0; 726 return 0;
728 if (sync_point) 727 if (sync_point)
729 context_->waitSyncPoint(sync_point); 728 context_->waitSyncPoint(sync_point);
730 blink::WebGLId texture = CreateTexture(); 729 blink::WebGLId texture = CreateTexture();
731 content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(context_, 730 content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(context_,
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 quality, 1083 quality,
1085 src_size, 1084 src_size,
1086 src_subrect, 1085 src_subrect,
1087 dst_size, 1086 dst_size,
1088 dst_subrect, 1087 dst_subrect,
1089 flip_vertically, 1088 flip_vertically,
1090 use_mrt); 1089 use_mrt);
1091 } 1090 }
1092 1091
1093 } // namespace content 1092 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698