OLD | NEW |
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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 } | 624 } |
625 | 625 |
626 void FramebufferManager::RemoveFramebuffer(GLuint client_id) { | 626 void FramebufferManager::RemoveFramebuffer(GLuint client_id) { |
627 FramebufferMap::iterator it = framebuffers_.find(client_id); | 627 FramebufferMap::iterator it = framebuffers_.find(client_id); |
628 if (it != framebuffers_.end()) { | 628 if (it != framebuffers_.end()) { |
629 it->second->MarkAsDeleted(); | 629 it->second->MarkAsDeleted(); |
630 framebuffers_.erase(it); | 630 framebuffers_.erase(it); |
631 } | 631 } |
632 } | 632 } |
633 | 633 |
634 void Framebuffer::DoUnbindGLAttachmentsForWorkaround(GLenum target) { | |
635 // Replace all attachments with the default Renderbuffer. | |
636 for (AttachmentMap::const_iterator it = attachments_.begin(); | |
637 it != attachments_.end(); ++it) { | |
638 glFramebufferRenderbufferEXT(target, it->first, GL_RENDERBUFFER, 0); | |
639 } | |
640 } | |
641 | |
642 void Framebuffer::AttachRenderbuffer( | 634 void Framebuffer::AttachRenderbuffer( |
643 GLenum attachment, Renderbuffer* renderbuffer) { | 635 GLenum attachment, Renderbuffer* renderbuffer) { |
644 const Attachment* a = GetAttachment(attachment); | 636 const Attachment* a = GetAttachment(attachment); |
645 if (a) | 637 if (a) |
646 a->DetachFromFramebuffer(this); | 638 a->DetachFromFramebuffer(this); |
647 if (renderbuffer) { | 639 if (renderbuffer) { |
648 attachments_[attachment] = scoped_refptr<Attachment>( | 640 attachments_[attachment] = scoped_refptr<Attachment>( |
649 new RenderbufferAttachment(renderbuffer)); | 641 new RenderbufferAttachment(renderbuffer)); |
650 } else { | 642 } else { |
651 attachments_.erase(attachment); | 643 attachments_.erase(attachment); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 ++it) { | 733 ++it) { |
742 TextureDetachObserver* observer = *it; | 734 TextureDetachObserver* observer = *it; |
743 observer->OnTextureRefDetachedFromFramebuffer(texture); | 735 observer->OnTextureRefDetachedFromFramebuffer(texture); |
744 } | 736 } |
745 } | 737 } |
746 | 738 |
747 } // namespace gles2 | 739 } // namespace gles2 |
748 } // namespace gpu | 740 } // namespace gpu |
749 | 741 |
750 | 742 |
OLD | NEW |