| 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 "gpu/command_buffer/service/texture_manager.h" | 5 #include "gpu/command_buffer/service/texture_manager.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "gpu/command_buffer/common/gl_mock.h" | 8 #include "gpu/command_buffer/common/gl_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/gles2_cmd_decoder_mock.h" | 10 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 feature_info.get(), kMaxTextureSize, kMaxCubeMapTextureSize); | 760 feature_info.get(), kMaxTextureSize, kMaxCubeMapTextureSize); |
| 761 manager.CreateTextureInfo(kClient1Id, kService1Id); | 761 manager.CreateTextureInfo(kClient1Id, kService1Id); |
| 762 TextureManager::TextureInfo* info = manager.GetTextureInfo(kClient1Id); | 762 TextureManager::TextureInfo* info = manager.GetTextureInfo(kClient1Id); |
| 763 ASSERT_TRUE(info != NULL); | 763 ASSERT_TRUE(info != NULL); |
| 764 manager.SetInfoTarget(info, GL_TEXTURE_EXTERNAL_OES); | 764 manager.SetInfoTarget(info, GL_TEXTURE_EXTERNAL_OES); |
| 765 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), info->target()); | 765 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), info->target()); |
| 766 EXPECT_FALSE(manager.CanGenerateMipmaps(info)); | 766 EXPECT_FALSE(manager.CanGenerateMipmaps(info)); |
| 767 manager.Destroy(false); | 767 manager.Destroy(false); |
| 768 } | 768 } |
| 769 | 769 |
| 770 TEST_F(TextureInfoTest, DepthTexture) { |
| 771 TestHelper::SetupFeatureInfoInitExpectations( |
| 772 gl_.get(), "GL_ANGLE_depth_texture"); |
| 773 FeatureInfo::Ref feature_info(new FeatureInfo()); |
| 774 feature_info->Initialize(NULL); |
| 775 TextureManager manager( |
| 776 feature_info.get(), kMaxTextureSize, kMaxCubeMapTextureSize); |
| 777 manager.CreateTextureInfo(kClient1Id, kService1Id); |
| 778 TextureManager::TextureInfo* info = manager.GetTextureInfo(kClient1Id); |
| 779 ASSERT_TRUE(info != NULL); |
| 780 manager.SetInfoTarget(info, GL_TEXTURE_2D); |
| 781 manager.SetLevelInfo( |
| 782 info, GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 4, 4, 1, 0, |
| 783 GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, false); |
| 784 EXPECT_FALSE(manager.CanGenerateMipmaps(info)); |
| 785 manager.Destroy(false); |
| 786 } |
| 787 |
| 770 TEST_F(TextureInfoTest, SafeUnsafe) { | 788 TEST_F(TextureInfoTest, SafeUnsafe) { |
| 771 static const GLuint kClient2Id = 2; | 789 static const GLuint kClient2Id = 2; |
| 772 static const GLuint kService2Id = 12; | 790 static const GLuint kService2Id = 12; |
| 773 static const GLuint kClient3Id = 3; | 791 static const GLuint kClient3Id = 3; |
| 774 static const GLuint kService3Id = 13; | 792 static const GLuint kService3Id = 13; |
| 775 EXPECT_FALSE(manager_.HaveUnclearedMips()); | 793 EXPECT_FALSE(manager_.HaveUnclearedMips()); |
| 776 EXPECT_EQ(0, info_->num_uncleared_mips()); | 794 EXPECT_EQ(0, info_->num_uncleared_mips()); |
| 777 manager_.SetInfoTarget(info_, GL_TEXTURE_2D); | 795 manager_.SetInfoTarget(info_, GL_TEXTURE_2D); |
| 778 manager_.SetLevelInfo(info_, | 796 manager_.SetLevelInfo(info_, |
| 779 GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, false); | 797 GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, false); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 EXPECT_CALL(*gl_, DeleteTextures(1, ::testing::Pointee(kService2Id))) | 973 EXPECT_CALL(*gl_, DeleteTextures(1, ::testing::Pointee(kService2Id))) |
| 956 .Times(1) | 974 .Times(1) |
| 957 .RetiresOnSaturation(); | 975 .RetiresOnSaturation(); |
| 958 info = NULL; | 976 info = NULL; |
| 959 } | 977 } |
| 960 | 978 |
| 961 } // namespace gles2 | 979 } // namespace gles2 |
| 962 } // namespace gpu | 980 } // namespace gpu |
| 963 | 981 |
| 964 | 982 |
| OLD | NEW |