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

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

Issue 2496813002: [Command buffer] workaround the framebuffer completeness bug for Intel Mac (Closed)
Patch Set: apply the workaround to all Mac vendors, not only Mac Intel Created 4 years, 1 month 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
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 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 } 604 }
605 605
606 bool Framebuffer::HasDepthAttachment() const { 606 bool Framebuffer::HasDepthAttachment() const {
607 return attachments_.find(GL_DEPTH_ATTACHMENT) != attachments_.end(); 607 return attachments_.find(GL_DEPTH_ATTACHMENT) != attachments_.end();
608 } 608 }
609 609
610 bool Framebuffer::HasStencilAttachment() const { 610 bool Framebuffer::HasStencilAttachment() const {
611 return attachments_.find(GL_STENCIL_ATTACHMENT) != attachments_.end(); 611 return attachments_.find(GL_STENCIL_ATTACHMENT) != attachments_.end();
612 } 612 }
613 613
614 bool Framebuffer::ReadBufferHasNoImage() const {
615 if (read_buffer_ == GL_NONE) {
616 return false;
617 }
618 AttachmentMap::const_iterator it = attachments_.find(read_buffer_);
619 if (it == attachments_.end()) {
620 return true;
621 }
622 return false;
623 }
624
625 bool Framebuffer::DrawBuffersHaveNoImage() const {
626 for (GLenum i = 0; i < manager_->max_draw_buffers_; ++i) {
627 if (draw_buffers_[i] == GL_NONE) {
628 continue;
629 }
630 const Attachment* attachment = GetAttachment(draw_buffers_[i]);
631 if (attachment) {
632 return false;
633 }
634 }
635 return true;
636 }
637
638 bool Framebuffer::ColorBuffersHaveImage() const {
639 for (GLenum i = 0; i < manager_->max_color_attachments_; i++) {
640 if (attachments_.find(GL_COLOR_ATTACHMENT0 + i) != attachments_.end())
qiankun 2016/11/11 15:30:48 Why don't check attachment != NULL (i.e. attachmen
yunchao 2016/11/15 16:04:34 It is unnecessary. see the other code like HasColo
641 return true;
642 }
643 return false;
644 }
645
614 GLenum Framebuffer::GetReadBufferInternalFormat() const { 646 GLenum Framebuffer::GetReadBufferInternalFormat() const {
615 if (read_buffer_ == GL_NONE) 647 if (read_buffer_ == GL_NONE)
616 return 0; 648 return 0;
617 AttachmentMap::const_iterator it = attachments_.find(read_buffer_); 649 AttachmentMap::const_iterator it = attachments_.find(read_buffer_);
618 if (it == attachments_.end()) { 650 if (it == attachments_.end()) {
619 return 0; 651 return 0;
620 } 652 }
621 const Attachment* attachment = it->second.get(); 653 const Attachment* attachment = it->second.get();
622 if (attachment->EmulatingRGB()) { 654 if (attachment->EmulatingRGB()) {
623 DCHECK_EQ(static_cast<GLenum>(GL_RGBA), attachment->internal_format()); 655 DCHECK_EQ(static_cast<GLenum>(GL_RGBA), attachment->internal_format());
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 1088
1057 bool FramebufferManager::IsComplete( 1089 bool FramebufferManager::IsComplete(
1058 Framebuffer* framebuffer) { 1090 Framebuffer* framebuffer) {
1059 DCHECK(framebuffer); 1091 DCHECK(framebuffer);
1060 return framebuffer->framebuffer_complete_state_count_id() == 1092 return framebuffer->framebuffer_complete_state_count_id() ==
1061 framebuffer_state_change_count_; 1093 framebuffer_state_change_count_;
1062 } 1094 }
1063 1095
1064 } // namespace gles2 1096 } // namespace gles2
1065 } // namespace gpu 1097 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698