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

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

Issue 2171543002: Split DEPTH_STENCIL into DEPTH and STENCIL in command buffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 attachment->SetCleared(renderbuffer_manager, texture_manager, cleared); 586 attachment->SetCleared(renderbuffer_manager, texture_manager, cleared);
587 } 587 }
588 } 588 }
589 } 589 }
590 590
591 bool Framebuffer::HasColorAttachment(int index) const { 591 bool Framebuffer::HasColorAttachment(int index) const {
592 return attachments_.find(GL_COLOR_ATTACHMENT0 + index) != attachments_.end(); 592 return attachments_.find(GL_COLOR_ATTACHMENT0 + index) != attachments_.end();
593 } 593 }
594 594
595 bool Framebuffer::HasDepthAttachment() const { 595 bool Framebuffer::HasDepthAttachment() const {
596 return attachments_.find(GL_DEPTH_STENCIL_ATTACHMENT) != attachments_.end() || 596 return attachments_.find(GL_DEPTH_ATTACHMENT) != attachments_.end();
597 attachments_.find(GL_DEPTH_ATTACHMENT) != attachments_.end();
598 } 597 }
599 598
600 bool Framebuffer::HasStencilAttachment() const { 599 bool Framebuffer::HasStencilAttachment() const {
601 return attachments_.find(GL_DEPTH_STENCIL_ATTACHMENT) != attachments_.end() || 600 return attachments_.find(GL_STENCIL_ATTACHMENT) != attachments_.end();
602 attachments_.find(GL_STENCIL_ATTACHMENT) != attachments_.end();
603 } 601 }
604 602
605 GLenum Framebuffer::GetReadBufferInternalFormat() const { 603 GLenum Framebuffer::GetReadBufferInternalFormat() const {
606 if (read_buffer_ == GL_NONE) 604 if (read_buffer_ == GL_NONE)
607 return 0; 605 return 0;
608 AttachmentMap::const_iterator it = attachments_.find(read_buffer_); 606 AttachmentMap::const_iterator it = attachments_.find(read_buffer_);
609 if (it == attachments_.end()) { 607 if (it == attachments_.end()) {
610 return 0; 608 return 0;
611 } 609 }
612 const Attachment* attachment = it->second.get(); 610 const Attachment* attachment = it->second.get();
(...skipping 19 matching lines...) Expand all
632 // Assume the framebuffer is complete, so return any attachment's samples. 630 // Assume the framebuffer is complete, so return any attachment's samples.
633 auto iter = attachments_.begin(); 631 auto iter = attachments_.begin();
634 if (iter == attachments_.end()) 632 if (iter == attachments_.end())
635 return -1; 633 return -1;
636 Attachment* attachment = iter->second.get(); 634 Attachment* attachment = iter->second.get();
637 DCHECK(attachment); 635 DCHECK(attachment);
638 return attachment->samples(); 636 return attachment->samples();
639 } 637 }
640 638
641 GLenum Framebuffer::GetDepthFormat() const { 639 GLenum Framebuffer::GetDepthFormat() const {
642 auto iter = attachments_.find(GL_DEPTH_STENCIL_ATTACHMENT); 640 auto iter = attachments_.find(GL_DEPTH_ATTACHMENT);
643 if (iter == attachments_.end())
644 iter = attachments_.find(GL_DEPTH_ATTACHMENT);
645 if (iter == attachments_.end()) 641 if (iter == attachments_.end())
646 return 0; 642 return 0;
647 Attachment* attachment = iter->second.get(); 643 Attachment* attachment = iter->second.get();
648 DCHECK(attachment); 644 DCHECK(attachment);
649 return attachment->internal_format(); 645 return attachment->internal_format();
650 } 646 }
651 647
652 GLenum Framebuffer::GetStencilFormat() const { 648 GLenum Framebuffer::GetStencilFormat() const {
653 auto iter = attachments_.find(GL_DEPTH_STENCIL_ATTACHMENT); 649 auto iter = attachments_.find(GL_STENCIL_ATTACHMENT);
654 if (iter == attachments_.end())
655 iter = attachments_.find(GL_STENCIL_ATTACHMENT);
656 if (iter == attachments_.end()) 650 if (iter == attachments_.end())
657 return 0; 651 return 0;
658 Attachment* attachment = iter->second.get(); 652 Attachment* attachment = iter->second.get();
659 DCHECK(attachment); 653 DCHECK(attachment);
660 return attachment->internal_format(); 654 return attachment->internal_format();
661 } 655 }
662 656
663 GLenum Framebuffer::IsPossiblyComplete(const FeatureInfo* feature_info) const { 657 GLenum Framebuffer::IsPossiblyComplete(const FeatureInfo* feature_info) const {
664 if (attachments_.empty()) { 658 if (attachments_.empty()) {
665 return GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT; 659 return GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT;
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 void Framebuffer::DoUnbindGLAttachmentsForWorkaround(GLenum target) { 899 void Framebuffer::DoUnbindGLAttachmentsForWorkaround(GLenum target) {
906 // Replace all attachments with the default Renderbuffer. 900 // Replace all attachments with the default Renderbuffer.
907 for (AttachmentMap::const_iterator it = attachments_.begin(); 901 for (AttachmentMap::const_iterator it = attachments_.begin();
908 it != attachments_.end(); ++it) { 902 it != attachments_.end(); ++it) {
909 glFramebufferRenderbufferEXT(target, it->first, GL_RENDERBUFFER, 0); 903 glFramebufferRenderbufferEXT(target, it->first, GL_RENDERBUFFER, 0);
910 } 904 }
911 } 905 }
912 906
913 void Framebuffer::AttachRenderbuffer( 907 void Framebuffer::AttachRenderbuffer(
914 GLenum attachment, Renderbuffer* renderbuffer) { 908 GLenum attachment, Renderbuffer* renderbuffer) {
909 DCHECK(attachment != GL_DEPTH_STENCIL_ATTACHMENT);
Zhenyao Mo 2016/07/20 20:28:10 Also dcheck in texture side.
915 const Attachment* a = GetAttachment(attachment); 910 const Attachment* a = GetAttachment(attachment);
916 if (a) 911 if (a)
917 a->DetachFromFramebuffer(this); 912 a->DetachFromFramebuffer(this);
918 if (renderbuffer) { 913 if (renderbuffer) {
919 attachments_[attachment] = scoped_refptr<Attachment>( 914 attachments_[attachment] = scoped_refptr<Attachment>(
920 new RenderbufferAttachment(renderbuffer)); 915 new RenderbufferAttachment(renderbuffer));
921 } else { 916 } else {
922 attachments_.erase(attachment); 917 attachments_.erase(attachment);
923 } 918 }
924 framebuffer_complete_state_count_id_ = 0; 919 framebuffer_complete_state_count_id_ = 0;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 999
1005 bool FramebufferManager::IsComplete( 1000 bool FramebufferManager::IsComplete(
1006 Framebuffer* framebuffer) { 1001 Framebuffer* framebuffer) {
1007 DCHECK(framebuffer); 1002 DCHECK(framebuffer);
1008 return framebuffer->framebuffer_complete_state_count_id() == 1003 return framebuffer->framebuffer_complete_state_count_id() ==
1009 framebuffer_state_change_count_; 1004 framebuffer_state_change_count_;
1010 } 1005 }
1011 1006
1012 } // namespace gles2 1007 } // namespace gles2
1013 } // namespace gpu 1008 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698