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

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

Issue 13957008: Merge 193302 "Force GPU switch with CGLSetVirtualScreen only for..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1453/src/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
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 #include "gpu/command_buffer/service/feature_info.h" 6 #include "gpu/command_buffer/service/feature_info.h"
7 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" 7 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h"
8 #include "gpu/command_buffer/service/renderbuffer_manager.h" 8 #include "gpu/command_buffer/service/renderbuffer_manager.h"
9 #include "gpu/command_buffer/service/test_helper.h" 9 #include "gpu/command_buffer/service/test_helper.h"
10 #include "gpu/command_buffer/service/texture_manager.h" 10 #include "gpu/command_buffer/service/texture_manager.h"
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 texture_manager_.GetTexture(kTextureClient2Id)); 671 texture_manager_.GetTexture(kTextureClient2Id));
672 ASSERT_TRUE(texture2 != NULL); 672 ASSERT_TRUE(texture2 != NULL);
673 texture_manager_.SetTarget(texture2, GL_TEXTURE_2D); 673 texture_manager_.SetTarget(texture2, GL_TEXTURE_2D);
674 674
675 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) 675 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_FRAMEBUFFER))
676 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) 676 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
677 .RetiresOnSaturation(); 677 .RetiresOnSaturation();
678 framebuffer_->GetStatus(&texture_manager_, GL_FRAMEBUFFER); 678 framebuffer_->GetStatus(&texture_manager_, GL_FRAMEBUFFER);
679 679
680 // Check a second call for the same type does not call anything 680 // Check a second call for the same type does not call anything
681 if (!framebuffer_->AllowFramebufferComboCompleteMapForTesting()) {
682 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_FRAMEBUFFER))
683 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
684 .RetiresOnSaturation();
685 }
681 framebuffer_->GetStatus(&texture_manager_, GL_FRAMEBUFFER); 686 framebuffer_->GetStatus(&texture_manager_, GL_FRAMEBUFFER);
682 687
683 // Check changing the attachments calls CheckFramebufferStatus. 688 // Check changing the attachments calls CheckFramebufferStatus.
684 framebuffer_->AttachTexture( 689 framebuffer_->AttachTexture(
685 GL_COLOR_ATTACHMENT0, texture2, kTarget1, kLevel1); 690 GL_COLOR_ATTACHMENT0, texture2, kTarget1, kLevel1);
686 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) 691 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_FRAMEBUFFER))
687 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) 692 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
688 .RetiresOnSaturation(); 693 .RetiresOnSaturation();
689 framebuffer_->GetStatus(&texture_manager_, GL_FRAMEBUFFER); 694 framebuffer_->GetStatus(&texture_manager_, GL_FRAMEBUFFER);
690 695
691 // Check a second call for the same type does not call anything. 696 // Check a second call for the same type does not call anything.
697 if (!framebuffer_->AllowFramebufferComboCompleteMapForTesting()) {
698 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_FRAMEBUFFER))
699 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
700 .RetiresOnSaturation();
701 }
692 framebuffer_->GetStatus(&texture_manager_, GL_FRAMEBUFFER); 702 framebuffer_->GetStatus(&texture_manager_, GL_FRAMEBUFFER);
693 703
694 // Check a second call with a different target calls CheckFramebufferStatus. 704 // Check a second call with a different target calls CheckFramebufferStatus.
695 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER)) 705 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER))
696 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) 706 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
697 .RetiresOnSaturation(); 707 .RetiresOnSaturation();
698 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER); 708 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER);
699 709
700 // Check a second call for the same type does not call anything. 710 // Check a second call for the same type does not call anything.
711 if (!framebuffer_->AllowFramebufferComboCompleteMapForTesting()) {
712 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER))
713 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
714 .RetiresOnSaturation();
715 }
701 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER); 716 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER);
702 717
703 // Check adding another attachment calls CheckFramebufferStatus. 718 // Check adding another attachment calls CheckFramebufferStatus.
704 framebuffer_->AttachRenderbuffer(GL_DEPTH_ATTACHMENT, renderbuffer1); 719 framebuffer_->AttachRenderbuffer(GL_DEPTH_ATTACHMENT, renderbuffer1);
705 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER)) 720 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER))
706 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) 721 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
707 .RetiresOnSaturation(); 722 .RetiresOnSaturation();
708 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER); 723 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER);
709 724
710 // Check a second call for the same type does not call anything. 725 // Check a second call for the same type does not call anything.
726 if (!framebuffer_->AllowFramebufferComboCompleteMapForTesting()) {
727 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER))
728 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
729 .RetiresOnSaturation();
730 }
711 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER); 731 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER);
712 732
713 // Check changing the format calls CheckFramebuffferStatus. 733 // Check changing the format calls CheckFramebuffferStatus.
714 TestHelper::SetTexParameterWithExpectations( 734 TestHelper::SetTexParameterWithExpectations(
715 gl_.get(), decoder_.get(), &texture_manager_, 735 gl_.get(), decoder_.get(), &texture_manager_,
716 texture2, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE, GL_NO_ERROR); 736 texture2, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE, GL_NO_ERROR);
717 737
718 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER)) 738 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER))
719 .WillOnce(Return(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT)) 739 .WillOnce(Return(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT))
720 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) 740 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
721 .RetiresOnSaturation(); 741 .RetiresOnSaturation();
722 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER); 742 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER);
723 743
724 // Check since it did not return FRAMEBUFFER_COMPLETE that it calls 744 // Check since it did not return FRAMEBUFFER_COMPLETE that it calls
725 // CheckFramebufferStatus 745 // CheckFramebufferStatus
726 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER); 746 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER);
727 747
728 // Check putting it back does not call CheckFramebufferStatus. 748 // Check putting it back does not call CheckFramebufferStatus.
749 if (!framebuffer_->AllowFramebufferComboCompleteMapForTesting()) {
750 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER))
751 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
752 .RetiresOnSaturation();
753 }
729 TestHelper::SetTexParameterWithExpectations( 754 TestHelper::SetTexParameterWithExpectations(
730 gl_.get(), decoder_.get(), &texture_manager_, 755 gl_.get(), decoder_.get(), &texture_manager_,
731 texture2, GL_TEXTURE_WRAP_S, GL_REPEAT, GL_NO_ERROR); 756 texture2, GL_TEXTURE_WRAP_S, GL_REPEAT, GL_NO_ERROR);
732 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER); 757 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER);
733 758
734 // Check Unbinding does not call CheckFramebufferStatus 759 // Check Unbinding does not call CheckFramebufferStatus
735 framebuffer_->UnbindRenderbuffer(GL_RENDERBUFFER, renderbuffer1); 760 framebuffer_->UnbindRenderbuffer(GL_RENDERBUFFER, renderbuffer1);
761 if (!framebuffer_->AllowFramebufferComboCompleteMapForTesting()) {
762 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER))
763 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
764 .RetiresOnSaturation();
765 }
736 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER); 766 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER);
737 } 767 }
738 768
739 } // namespace gles2 769 } // namespace gles2
740 } // namespace gpu 770 } // namespace gpu
741 771
742 772
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager.cc ('k') | gpu/command_buffer/service/gl_context_virtual.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698