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

Side by Side Diff: gpu/command_buffer/service/framebuffer_manager.cc

Issue 180723023: gpu: Mailbox emulation with EGLImage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 6 years, 9 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 "gpu/command_buffer/service/framebuffer_manager.h" 5 #include "gpu/command_buffer/service/framebuffer_manager.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 8 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
9 #include "gpu/command_buffer/service/renderbuffer_manager.h" 9 #include "gpu/command_buffer/service/renderbuffer_manager.h"
10 #include "gpu/command_buffer/service/texture_manager.h" 10 #include "gpu/command_buffer/service/texture_manager.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 Renderbuffer* renderbuffer() const { 112 Renderbuffer* renderbuffer() const {
113 return renderbuffer_.get(); 113 return renderbuffer_.get();
114 } 114 }
115 115
116 virtual void AddToSignature( 116 virtual void AddToSignature(
117 TextureManager* texture_manager, std::string* signature) const OVERRIDE { 117 TextureManager* texture_manager, std::string* signature) const OVERRIDE {
118 DCHECK(signature); 118 DCHECK(signature);
119 renderbuffer_->AddToSignature(signature); 119 renderbuffer_->AddToSignature(signature);
120 } 120 }
121 121
122 virtual void OnWillRenderTo() const OVERRIDE {}
123 virtual void OnDidRenderTo() const OVERRIDE {}
124
122 protected: 125 protected:
123 virtual ~RenderbufferAttachment() { } 126 virtual ~RenderbufferAttachment() { }
124 127
125 private: 128 private:
126 scoped_refptr<Renderbuffer> renderbuffer_; 129 scoped_refptr<Renderbuffer> renderbuffer_;
127 130
128 DISALLOW_COPY_AND_ASSIGN(RenderbufferAttachment); 131 DISALLOW_COPY_AND_ASSIGN(RenderbufferAttachment);
129 }; 132 };
130 133
131 class TextureAttachment 134 class TextureAttachment
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 return (need & have) != 0; 239 return (need & have) != 0;
237 } 240 }
238 241
239 virtual void AddToSignature( 242 virtual void AddToSignature(
240 TextureManager* texture_manager, std::string* signature) const OVERRIDE { 243 TextureManager* texture_manager, std::string* signature) const OVERRIDE {
241 DCHECK(signature); 244 DCHECK(signature);
242 texture_manager->AddToSignature( 245 texture_manager->AddToSignature(
243 texture_ref_.get(), target_, level_, signature); 246 texture_ref_.get(), target_, level_, signature);
244 } 247 }
245 248
249 virtual void OnWillRenderTo() const OVERRIDE {
250 texture_ref_->texture()->OnWillModifyPixels();
251 }
252
253 virtual void OnDidRenderTo() const OVERRIDE {
254 texture_ref_->texture()->OnDidModifyPixels();
255 }
256
246 protected: 257 protected:
247 virtual ~TextureAttachment() {} 258 virtual ~TextureAttachment() {}
248 259
249 private: 260 private:
250 scoped_refptr<TextureRef> texture_ref_; 261 scoped_refptr<TextureRef> texture_ref_;
251 GLenum target_; 262 GLenum target_;
252 GLint level_; 263 GLint level_;
253 GLsizei samples_; 264 GLsizei samples_;
254 265
255 DISALLOW_COPY_AND_ASSIGN(TextureAttachment); 266 DISALLOW_COPY_AND_ASSIGN(TextureAttachment);
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 if (it != attachments_.end()) { 619 if (it != attachments_.end()) {
609 return it->second.get(); 620 return it->second.get();
610 } 621 }
611 return NULL; 622 return NULL;
612 } 623 }
613 624
614 void Framebuffer::OnTextureRefDetached(TextureRef* texture) { 625 void Framebuffer::OnTextureRefDetached(TextureRef* texture) {
615 manager_->OnTextureRefDetached(texture); 626 manager_->OnTextureRefDetached(texture);
616 } 627 }
617 628
629 void Framebuffer::OnWillRenderTo() const {
630 for (AttachmentMap::const_iterator it = attachments_.begin();
631 it != attachments_.end(); ++it) {
632 it->second->OnWillRenderTo();
633 }
634 }
635
636 void Framebuffer::OnDidRenderTo() const {
637 for (AttachmentMap::const_iterator it = attachments_.begin();
638 it != attachments_.end(); ++it) {
639 it->second->OnDidRenderTo();
640 }
641 }
642
618 bool FramebufferManager::GetClientId( 643 bool FramebufferManager::GetClientId(
619 GLuint service_id, GLuint* client_id) const { 644 GLuint service_id, GLuint* client_id) const {
620 // This doesn't need to be fast. It's only used during slow queries. 645 // This doesn't need to be fast. It's only used during slow queries.
621 for (FramebufferMap::const_iterator it = framebuffers_.begin(); 646 for (FramebufferMap::const_iterator it = framebuffers_.begin();
622 it != framebuffers_.end(); ++it) { 647 it != framebuffers_.end(); ++it) {
623 if (it->second->service_id() == service_id) { 648 if (it->second->service_id() == service_id) {
624 *client_id = it->first; 649 *client_id = it->first;
625 return true; 650 return true;
626 } 651 }
627 } 652 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 ++it) { 684 ++it) {
660 TextureDetachObserver* observer = *it; 685 TextureDetachObserver* observer = *it;
661 observer->OnTextureRefDetachedFromFramebuffer(texture); 686 observer->OnTextureRefDetachedFromFramebuffer(texture);
662 } 687 }
663 } 688 }
664 689
665 } // namespace gles2 690 } // namespace gles2
666 } // namespace gpu 691 } // namespace gpu
667 692
668 693
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698