OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 &feature_info_, info, GL_TEXTURE_MAG_FILTER, GL_CLAMP_TO_EDGE)); | 117 &feature_info_, info, GL_TEXTURE_MAG_FILTER, GL_CLAMP_TO_EDGE)); |
118 EXPECT_EQ(static_cast<GLenum>(GL_NEAREST), info->min_filter()); | 118 EXPECT_EQ(static_cast<GLenum>(GL_NEAREST), info->min_filter()); |
119 EXPECT_FALSE(manager_.SetParameter( | 119 EXPECT_FALSE(manager_.SetParameter( |
120 &feature_info_, info, GL_TEXTURE_WRAP_S, GL_NEAREST)); | 120 &feature_info_, info, GL_TEXTURE_WRAP_S, GL_NEAREST)); |
121 EXPECT_EQ(static_cast<GLenum>(GL_CLAMP_TO_EDGE), info->wrap_s()); | 121 EXPECT_EQ(static_cast<GLenum>(GL_CLAMP_TO_EDGE), info->wrap_s()); |
122 EXPECT_FALSE(manager_.SetParameter( | 122 EXPECT_FALSE(manager_.SetParameter( |
123 &feature_info_, info, GL_TEXTURE_WRAP_T, GL_NEAREST)); | 123 &feature_info_, info, GL_TEXTURE_WRAP_T, GL_NEAREST)); |
124 EXPECT_EQ(static_cast<GLenum>(GL_CLAMP_TO_EDGE), info->wrap_t()); | 124 EXPECT_EQ(static_cast<GLenum>(GL_CLAMP_TO_EDGE), info->wrap_t()); |
125 } | 125 } |
126 | 126 |
127 TEST_F(TextureManagerTest, TextureUsageExt) { | |
greggman
2011/12/02 18:33:24
Should there be a test that SetParameter returns f
vangelis
2011/12/03 00:19:53
Added a GLES2DecoderTest for it.
| |
128 TestHelper::SetupTextureManagerInitExpectations(gl_.get(), "GL_ANGLE_texture_u sage"); | |
greggman
2011/12/02 18:33:24
> 80 cols
vangelis
2011/12/03 00:19:53
Done.
| |
129 manager_.Initialize(&feature_info_); | |
130 const GLuint kClient1Id = 1; | |
131 const GLuint kService1Id = 11; | |
132 // Check we can create texture. | |
133 manager_.CreateTextureInfo(&feature_info_, kClient1Id, kService1Id); | |
134 // Check texture got created. | |
135 TextureManager::TextureInfo* info = manager_.GetTextureInfo(kClient1Id); | |
136 ASSERT_TRUE(info != NULL); | |
137 EXPECT_TRUE(manager_.SetParameter( | |
138 &feature_info_, info, GL_TEXTURE_USAGE_ANGLE, | |
139 GL_FRAMEBUFFER_ATTACHMENT_ANGLE)); | |
140 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_ATTACHMENT_ANGLE), | |
141 info->usage()); | |
142 } | |
143 | |
144 | |
127 TEST_F(TextureManagerTest, Destroy) { | 145 TEST_F(TextureManagerTest, Destroy) { |
128 const GLuint kClient1Id = 1; | 146 const GLuint kClient1Id = 1; |
129 const GLuint kService1Id = 11; | 147 const GLuint kService1Id = 11; |
130 // Check we can create texture. | 148 // Check we can create texture. |
131 manager_.CreateTextureInfo(&feature_info_, kClient1Id, kService1Id); | 149 manager_.CreateTextureInfo(&feature_info_, kClient1Id, kService1Id); |
132 // Check texture got created. | 150 // Check texture got created. |
133 TextureManager::TextureInfo* info1 = manager_.GetTextureInfo(kClient1Id); | 151 TextureManager::TextureInfo* info1 = manager_.GetTextureInfo(kClient1Id); |
134 ASSERT_TRUE(info1 != NULL); | 152 ASSERT_TRUE(info1 != NULL); |
135 EXPECT_CALL(*gl_, DeleteTextures(1, ::testing::Pointee(kService1Id))) | 153 EXPECT_CALL(*gl_, DeleteTextures(1, ::testing::Pointee(kService1Id))) |
136 .Times(1) | 154 .Times(1) |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
871 EXPECT_TRUE(info_->SafeToRenderFrom()); | 889 EXPECT_TRUE(info_->SafeToRenderFrom()); |
872 EXPECT_FALSE(manager_.HaveUnsafeTextures()); | 890 EXPECT_FALSE(manager_.HaveUnsafeTextures()); |
873 EXPECT_FALSE(manager_.HaveUnclearedMips()); | 891 EXPECT_FALSE(manager_.HaveUnclearedMips()); |
874 EXPECT_EQ(0, info_->num_uncleared_mips()); | 892 EXPECT_EQ(0, info_->num_uncleared_mips()); |
875 } | 893 } |
876 | 894 |
877 } // namespace gles2 | 895 } // namespace gles2 |
878 } // namespace gpu | 896 } // namespace gpu |
879 | 897 |
880 | 898 |
OLD | NEW |