| OLD | NEW |
| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "gpu/command_buffer/service/error_state_mock.h" | 8 #include "gpu/command_buffer/service/error_state_mock.h" |
| 9 #include "gpu/command_buffer/service/feature_info.h" | 9 #include "gpu/command_buffer/service/feature_info.h" |
| 10 #include "gpu/command_buffer/service/framebuffer_manager.h" | 10 #include "gpu/command_buffer/service/framebuffer_manager.h" |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 // Not cleared at all. | 752 // Not cleared at all. |
| 753 texture_manager_->SetLevelInfo(texture.get(), GL_TEXTURE_2D, 0, GL_RGBA, 4, | 753 texture_manager_->SetLevelInfo(texture.get(), GL_TEXTURE_2D, 0, GL_RGBA, 4, |
| 754 4, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 754 4, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 755 gfx::Rect()); | 755 gfx::Rect()); |
| 756 EXPECT_FALSE(attachment->cleared()); | 756 EXPECT_FALSE(attachment->cleared()); |
| 757 EXPECT_FALSE(attachment->IsPartiallyCleared()); | 757 EXPECT_FALSE(attachment->IsPartiallyCleared()); |
| 758 EXPECT_FALSE(framebuffer_->IsCleared()); | 758 EXPECT_FALSE(framebuffer_->IsCleared()); |
| 759 EXPECT_TRUE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); | 759 EXPECT_TRUE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); |
| 760 EXPECT_TRUE(framebuffer_->HasUnclearedColorAttachments()); | 760 EXPECT_TRUE(framebuffer_->HasUnclearedColorAttachments()); |
| 761 // Clear it but nothing happens. | 761 // Clear it but nothing happens. |
| 762 EXPECT_CALL(*decoder_.get(), GetFeatureInfo()) |
| 763 .WillRepeatedly(Return(feature_info_.get())); |
| 762 framebuffer_->ClearUnclearedIntOr3DTexturesOrPartiallyClearedTextures( | 764 framebuffer_->ClearUnclearedIntOr3DTexturesOrPartiallyClearedTextures( |
| 763 decoder_.get(), texture_manager_.get()); | 765 decoder_.get(), texture_manager_.get()); |
| 764 EXPECT_FALSE(attachment->cleared()); | 766 EXPECT_FALSE(attachment->cleared()); |
| 765 EXPECT_FALSE(attachment->IsPartiallyCleared()); | 767 EXPECT_FALSE(attachment->IsPartiallyCleared()); |
| 766 EXPECT_FALSE(framebuffer_->IsCleared()); | 768 EXPECT_FALSE(framebuffer_->IsCleared()); |
| 767 EXPECT_TRUE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); | 769 EXPECT_TRUE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); |
| 768 EXPECT_TRUE(framebuffer_->HasUnclearedColorAttachments()); | 770 EXPECT_TRUE(framebuffer_->HasUnclearedColorAttachments()); |
| 769 | 771 |
| 770 // Fully cleared. | 772 // Fully cleared. |
| 771 texture_manager_->SetLevelInfo(texture.get(), GL_TEXTURE_2D, 0, GL_RGBA, 4, | 773 texture_manager_->SetLevelInfo(texture.get(), GL_TEXTURE_2D, 0, GL_RGBA, 4, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 texture_manager_->SetLevelInfo(texture.get(), GL_TEXTURE_2D, 0, GL_RGBA8, | 843 texture_manager_->SetLevelInfo(texture.get(), GL_TEXTURE_2D, 0, GL_RGBA8, |
| 842 kWidth, kHeight, kDepth, | 844 kWidth, kHeight, kDepth, |
| 843 0, GL_RGBA, GL_UNSIGNED_BYTE, | 845 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 844 gfx::Rect(0, 0, kWidth, kHeight)); | 846 gfx::Rect(0, 0, kWidth, kHeight)); |
| 845 EXPECT_TRUE(attachment->cleared()); | 847 EXPECT_TRUE(attachment->cleared()); |
| 846 EXPECT_FALSE(attachment->IsPartiallyCleared()); | 848 EXPECT_FALSE(attachment->IsPartiallyCleared()); |
| 847 EXPECT_TRUE(framebuffer_->IsCleared()); | 849 EXPECT_TRUE(framebuffer_->IsCleared()); |
| 848 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); | 850 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); |
| 849 EXPECT_FALSE(framebuffer_->HasUnclearedColorAttachments()); | 851 EXPECT_FALSE(framebuffer_->HasUnclearedColorAttachments()); |
| 850 // Clear it but nothing happens. | 852 // Clear it but nothing happens. |
| 853 EXPECT_CALL(*decoder_.get(), GetFeatureInfo()) |
| 854 .WillRepeatedly(Return(feature_info_.get())); |
| 851 framebuffer_->ClearUnclearedIntOr3DTexturesOrPartiallyClearedTextures( | 855 framebuffer_->ClearUnclearedIntOr3DTexturesOrPartiallyClearedTextures( |
| 852 decoder_.get(), texture_manager_.get()); | 856 decoder_.get(), texture_manager_.get()); |
| 853 EXPECT_TRUE(attachment->cleared()); | 857 EXPECT_TRUE(attachment->cleared()); |
| 854 EXPECT_FALSE(attachment->IsPartiallyCleared()); | 858 EXPECT_FALSE(attachment->IsPartiallyCleared()); |
| 855 EXPECT_TRUE(framebuffer_->IsCleared()); | 859 EXPECT_TRUE(framebuffer_->IsCleared()); |
| 856 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); | 860 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); |
| 857 EXPECT_FALSE(framebuffer_->HasUnclearedColorAttachments()); | 861 EXPECT_FALSE(framebuffer_->HasUnclearedColorAttachments()); |
| 858 | 862 |
| 859 // Not cleared at all. | 863 // Not cleared at all. |
| 860 texture_manager_->SetLevelInfo(texture.get(), GL_TEXTURE_3D, 0, GL_RGBA8, | 864 texture_manager_->SetLevelInfo(texture.get(), GL_TEXTURE_3D, 0, GL_RGBA8, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 EXPECT_FALSE(attachment->cleared()); | 921 EXPECT_FALSE(attachment->cleared()); |
| 918 EXPECT_FALSE(attachment->IsPartiallyCleared()); | 922 EXPECT_FALSE(attachment->IsPartiallyCleared()); |
| 919 EXPECT_FALSE(framebuffer_->IsCleared()); | 923 EXPECT_FALSE(framebuffer_->IsCleared()); |
| 920 EXPECT_TRUE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); | 924 EXPECT_TRUE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); |
| 921 EXPECT_TRUE(framebuffer_->HasUnclearedColorAttachments()); | 925 EXPECT_TRUE(framebuffer_->HasUnclearedColorAttachments()); |
| 922 EXPECT_CALL(*decoder_.get(), | 926 EXPECT_CALL(*decoder_.get(), |
| 923 ClearLevel3D(texture->texture(), GL_TEXTURE_3D, 0, GL_RGBA, | 927 ClearLevel3D(texture->texture(), GL_TEXTURE_3D, 0, GL_RGBA, |
| 924 GL_UNSIGNED_BYTE, _, _, _)) | 928 GL_UNSIGNED_BYTE, _, _, _)) |
| 925 .WillOnce(Return(true)) | 929 .WillOnce(Return(true)) |
| 926 .RetiresOnSaturation(); | 930 .RetiresOnSaturation(); |
| 931 EXPECT_CALL(*decoder_.get(), GetFeatureInfo()) |
| 932 .WillRepeatedly(Return(feature_info_.get())); |
| 927 framebuffer_->ClearUnclearedIntOr3DTexturesOrPartiallyClearedTextures( | 933 framebuffer_->ClearUnclearedIntOr3DTexturesOrPartiallyClearedTextures( |
| 928 decoder_.get(), texture_manager_.get()); | 934 decoder_.get(), texture_manager_.get()); |
| 929 EXPECT_TRUE(attachment->cleared()); | 935 EXPECT_TRUE(attachment->cleared()); |
| 930 EXPECT_FALSE(attachment->IsPartiallyCleared()); | 936 EXPECT_FALSE(attachment->IsPartiallyCleared()); |
| 931 EXPECT_TRUE(framebuffer_->IsCleared()); | 937 EXPECT_TRUE(framebuffer_->IsCleared()); |
| 932 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); | 938 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); |
| 933 EXPECT_FALSE(framebuffer_->HasUnclearedColorAttachments()); | 939 EXPECT_FALSE(framebuffer_->HasUnclearedColorAttachments()); |
| 934 } | 940 } |
| 935 | 941 |
| 936 TEST_F(FramebufferInfoTest, ClearIntegerTextureAttachments) { | 942 TEST_F(FramebufferInfoTest, ClearIntegerTextureAttachments) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 954 texture_manager_->SetLevelInfo(texture.get(), GL_TEXTURE_2D, 0, GL_RGBA8UI, | 960 texture_manager_->SetLevelInfo(texture.get(), GL_TEXTURE_2D, 0, GL_RGBA8UI, |
| 955 kWidth, kHeight, 1, | 961 kWidth, kHeight, 1, |
| 956 0, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, | 962 0, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, |
| 957 gfx::Rect(0, 0, kWidth, kHeight)); | 963 gfx::Rect(0, 0, kWidth, kHeight)); |
| 958 EXPECT_TRUE(attachment->cleared()); | 964 EXPECT_TRUE(attachment->cleared()); |
| 959 EXPECT_FALSE(attachment->IsPartiallyCleared()); | 965 EXPECT_FALSE(attachment->IsPartiallyCleared()); |
| 960 EXPECT_TRUE(framebuffer_->IsCleared()); | 966 EXPECT_TRUE(framebuffer_->IsCleared()); |
| 961 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); | 967 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); |
| 962 EXPECT_FALSE(framebuffer_->HasUnclearedColorAttachments()); | 968 EXPECT_FALSE(framebuffer_->HasUnclearedColorAttachments()); |
| 963 // Clear it but nothing happens. | 969 // Clear it but nothing happens. |
| 970 EXPECT_CALL(*decoder_.get(), GetFeatureInfo()) |
| 971 .WillRepeatedly(Return(feature_info_.get())); |
| 964 framebuffer_->ClearUnclearedIntOr3DTexturesOrPartiallyClearedTextures( | 972 framebuffer_->ClearUnclearedIntOr3DTexturesOrPartiallyClearedTextures( |
| 965 decoder_.get(), texture_manager_.get()); | 973 decoder_.get(), texture_manager_.get()); |
| 966 EXPECT_TRUE(attachment->cleared()); | 974 EXPECT_TRUE(attachment->cleared()); |
| 967 EXPECT_FALSE(attachment->IsPartiallyCleared()); | 975 EXPECT_FALSE(attachment->IsPartiallyCleared()); |
| 968 EXPECT_TRUE(framebuffer_->IsCleared()); | 976 EXPECT_TRUE(framebuffer_->IsCleared()); |
| 969 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); | 977 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); |
| 970 EXPECT_FALSE(framebuffer_->HasUnclearedColorAttachments()); | 978 EXPECT_FALSE(framebuffer_->HasUnclearedColorAttachments()); |
| 971 | 979 |
| 972 // Not cleared at all. | 980 // Not cleared at all. |
| 973 texture_manager_->SetLevelInfo(texture.get(), GL_TEXTURE_2D, 0, GL_RGBA8UI, | 981 texture_manager_->SetLevelInfo(texture.get(), GL_TEXTURE_2D, 0, GL_RGBA8UI, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 EXPECT_TRUE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); | 1044 EXPECT_TRUE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); |
| 1037 EXPECT_TRUE(framebuffer_->HasUnclearedColorAttachments()); | 1045 EXPECT_TRUE(framebuffer_->HasUnclearedColorAttachments()); |
| 1038 EXPECT_CALL(*decoder_.get(), IsCompressedTextureFormat(GL_RGBA8UI)) | 1046 EXPECT_CALL(*decoder_.get(), IsCompressedTextureFormat(GL_RGBA8UI)) |
| 1039 .WillOnce(Return(false)) | 1047 .WillOnce(Return(false)) |
| 1040 .RetiresOnSaturation(); | 1048 .RetiresOnSaturation(); |
| 1041 EXPECT_CALL(*decoder_.get(), | 1049 EXPECT_CALL(*decoder_.get(), |
| 1042 ClearLevel(texture->texture(), GL_TEXTURE_2D, 0, GL_RGBA_INTEGER, | 1050 ClearLevel(texture->texture(), GL_TEXTURE_2D, 0, GL_RGBA_INTEGER, |
| 1043 GL_UNSIGNED_BYTE, _, _, _, _)) | 1051 GL_UNSIGNED_BYTE, _, _, _, _)) |
| 1044 .WillOnce(Return(true)) | 1052 .WillOnce(Return(true)) |
| 1045 .RetiresOnSaturation(); | 1053 .RetiresOnSaturation(); |
| 1054 EXPECT_CALL(*decoder_.get(), GetFeatureInfo()) |
| 1055 .WillRepeatedly(Return(feature_info_.get())); |
| 1046 framebuffer_->ClearUnclearedIntOr3DTexturesOrPartiallyClearedTextures( | 1056 framebuffer_->ClearUnclearedIntOr3DTexturesOrPartiallyClearedTextures( |
| 1047 decoder_.get(), texture_manager_.get()); | 1057 decoder_.get(), texture_manager_.get()); |
| 1048 EXPECT_TRUE(attachment->cleared()); | 1058 EXPECT_TRUE(attachment->cleared()); |
| 1049 EXPECT_FALSE(attachment->IsPartiallyCleared()); | 1059 EXPECT_FALSE(attachment->IsPartiallyCleared()); |
| 1050 EXPECT_TRUE(framebuffer_->IsCleared()); | 1060 EXPECT_TRUE(framebuffer_->IsCleared()); |
| 1051 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); | 1061 EXPECT_FALSE(framebuffer_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)); |
| 1052 EXPECT_FALSE(framebuffer_->HasUnclearedColorAttachments()); | 1062 EXPECT_FALSE(framebuffer_->HasUnclearedColorAttachments()); |
| 1053 } | 1063 } |
| 1054 | 1064 |
| 1055 TEST_F(FramebufferInfoTest, DrawBuffers) { | 1065 TEST_F(FramebufferInfoTest, DrawBuffers) { |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1657 renderbuffer_manager_->GetRenderbuffer(kRenderbufferClientId); | 1667 renderbuffer_manager_->GetRenderbuffer(kRenderbufferClientId); |
| 1658 ASSERT_TRUE(renderbuffer != nullptr); | 1668 ASSERT_TRUE(renderbuffer != nullptr); |
| 1659 framebuffer_->AttachRenderbuffer(GL_COLOR_ATTACHMENT1, renderbuffer); | 1669 framebuffer_->AttachRenderbuffer(GL_COLOR_ATTACHMENT1, renderbuffer); |
| 1660 EXPECT_TRUE(framebuffer_->GetReadBufferAttachment()); | 1670 EXPECT_TRUE(framebuffer_->GetReadBufferAttachment()); |
| 1661 } | 1671 } |
| 1662 | 1672 |
| 1663 } // namespace gles2 | 1673 } // namespace gles2 |
| 1664 } // namespace gpu | 1674 } // namespace gpu |
| 1665 | 1675 |
| 1666 | 1676 |
| OLD | NEW |