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

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: Reset (not restore) read buffer and/or draw buffers for all read/draw related APIs 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()) {
Zhenyao Mo 2016/11/14 19:42:24 Just return it == attachments_.end().
yunchao 2016/11/15 16:21:58 Done.
620 return true;
621 }
622 return false;
623 }
624
625 bool Framebuffer::DrawBuffersHaveNoImage(GLsizei& num, GLenum* buf) const {
626 bool ret = false;
627 for (GLenum i = 0; i < manager_->max_draw_buffers_; ++i) {
628 if (draw_buffers_[i] == GL_NONE) {
629 buf[i] = GL_NONE;
630 continue;
631 }
632 const Attachment* attachment = GetAttachment(draw_buffers_[i]);
633 if (attachment) {
634 buf[i] = GL_COLOR_ATTACHMENT0 + i;
Zhenyao Mo 2016/11/14 19:42:24 Here you should DCHECK(buf[i] == GL_COLOR_ATTACHME
yunchao 2016/11/15 16:21:58 Not re-assign. The buf[] passed in are all GL_NONE
635 ++num;
Zhenyao Mo 2016/11/14 19:42:24 Here you assume num is initialized to zero by call
yunchao 2016/11/15 16:21:58 See the explanation elsewhere.
636 } else {
637 buf[i] = GL_NONE;
638 ret = true;
639 }
640 }
641 return ret;
642 }
643
644 bool Framebuffer::ColorBuffersHaveImage() const {
645 for (GLenum i = 0; i < manager_->max_color_attachments_; i++) {
646 if (attachments_.find(GL_COLOR_ATTACHMENT0 + i) != attachments_.end())
647 return true;
648 }
649 return false;
650 }
651
614 GLenum Framebuffer::GetReadBufferInternalFormat() const { 652 GLenum Framebuffer::GetReadBufferInternalFormat() const {
615 if (read_buffer_ == GL_NONE) 653 if (read_buffer_ == GL_NONE)
616 return 0; 654 return 0;
617 AttachmentMap::const_iterator it = attachments_.find(read_buffer_); 655 AttachmentMap::const_iterator it = attachments_.find(read_buffer_);
618 if (it == attachments_.end()) { 656 if (it == attachments_.end()) {
619 return 0; 657 return 0;
620 } 658 }
621 const Attachment* attachment = it->second.get(); 659 const Attachment* attachment = it->second.get();
622 if (attachment->EmulatingRGB()) { 660 if (attachment->EmulatingRGB()) {
623 DCHECK_EQ(static_cast<GLenum>(GL_RGBA), attachment->internal_format()); 661 DCHECK_EQ(static_cast<GLenum>(GL_RGBA), attachment->internal_format());
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 1094
1057 bool FramebufferManager::IsComplete( 1095 bool FramebufferManager::IsComplete(
1058 Framebuffer* framebuffer) { 1096 Framebuffer* framebuffer) {
1059 DCHECK(framebuffer); 1097 DCHECK(framebuffer);
1060 return framebuffer->framebuffer_complete_state_count_id() == 1098 return framebuffer->framebuffer_complete_state_count_id() ==
1061 framebuffer_state_change_count_; 1099 framebuffer_state_change_count_;
1062 } 1100 }
1063 1101
1064 } // namespace gles2 1102 } // namespace gles2
1065 } // namespace gpu 1103 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698