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

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

Issue 2351093002: Fix crash in BlitFramebufferCHROMIUM if a read or draw depth/stencil buffer is not present (Closed)
Patch Set: rebase Created 4 years, 3 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
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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 GLsizei Framebuffer::GetSamples() const { 685 GLsizei Framebuffer::GetSamples() const {
686 // Assume the framebuffer is complete, so return any attachment's samples. 686 // Assume the framebuffer is complete, so return any attachment's samples.
687 auto iter = attachments_.begin(); 687 auto iter = attachments_.begin();
688 if (iter == attachments_.end()) 688 if (iter == attachments_.end())
689 return -1; 689 return -1;
690 Attachment* attachment = iter->second.get(); 690 Attachment* attachment = iter->second.get();
691 DCHECK(attachment); 691 DCHECK(attachment);
692 return attachment->samples(); 692 return attachment->samples();
693 } 693 }
694 694
695 GLenum Framebuffer::GetDepthFormat() const { 695 const Framebuffer::Attachment* Framebuffer::GetDepthAttachment() const {
696 auto iter = attachments_.find(GL_DEPTH_STENCIL_ATTACHMENT); 696 auto iter = attachments_.find(GL_DEPTH_STENCIL_ATTACHMENT);
697 if (iter == attachments_.end()) 697 if (iter == attachments_.end())
698 iter = attachments_.find(GL_DEPTH_ATTACHMENT); 698 iter = attachments_.find(GL_DEPTH_ATTACHMENT);
699 if (iter == attachments_.end()) 699 if (iter == attachments_.end())
700 return 0; 700 return nullptr;
701 Attachment* attachment = iter->second.get(); 701 Attachment* attachment = iter->second.get();
702 DCHECK(attachment); 702 DCHECK(attachment);
703 return attachment->internal_format(); 703 return attachment;
704 } 704 }
705 705
706 GLenum Framebuffer::GetStencilFormat() const { 706 const Framebuffer::Attachment* Framebuffer::GetStencilAttachment() const {
707 auto iter = attachments_.find(GL_DEPTH_STENCIL_ATTACHMENT); 707 auto iter = attachments_.find(GL_DEPTH_STENCIL_ATTACHMENT);
708 if (iter == attachments_.end()) 708 if (iter == attachments_.end())
709 iter = attachments_.find(GL_STENCIL_ATTACHMENT); 709 iter = attachments_.find(GL_STENCIL_ATTACHMENT);
710 if (iter == attachments_.end()) 710 if (iter == attachments_.end())
711 return 0; 711 return nullptr;
712 Attachment* attachment = iter->second.get(); 712 Attachment* attachment = iter->second.get();
713 DCHECK(attachment); 713 DCHECK(attachment);
714 return attachment->internal_format(); 714 return attachment;
715 }
716
717 GLenum Framebuffer::GetDepthFormat() const {
718 const Attachment* attachment = GetDepthAttachment();
719 return attachment ? attachment->internal_format() : 0;
720 }
721
722 GLenum Framebuffer::GetStencilFormat() const {
723 const Attachment* attachment = GetStencilAttachment();
724 return attachment ? attachment->internal_format() : 0;
715 } 725 }
716 726
717 GLenum Framebuffer::IsPossiblyComplete(const FeatureInfo* feature_info) const { 727 GLenum Framebuffer::IsPossiblyComplete(const FeatureInfo* feature_info) const {
718 if (attachments_.empty()) { 728 if (attachments_.empty()) {
719 return GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT; 729 return GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT;
720 } 730 }
721 731
722 GLsizei width = -1; 732 GLsizei width = -1;
723 GLsizei height = -1; 733 GLsizei height = -1;
724 GLsizei samples = -1; 734 GLsizei samples = -1;
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 1089
1080 bool FramebufferManager::IsComplete( 1090 bool FramebufferManager::IsComplete(
1081 Framebuffer* framebuffer) { 1091 Framebuffer* framebuffer) {
1082 DCHECK(framebuffer); 1092 DCHECK(framebuffer);
1083 return framebuffer->framebuffer_complete_state_count_id() == 1093 return framebuffer->framebuffer_complete_state_count_id() ==
1084 framebuffer_state_change_count_; 1094 framebuffer_state_change_count_;
1085 } 1095 }
1086 1096
1087 } // namespace gles2 1097 } // namespace gles2
1088 } // namespace gpu 1098 } // namespace gpu
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