| 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/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 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 5, | 1035 5, |
| 1036 1, | 1036 1, |
| 1037 0, | 1037 0, |
| 1038 GL_RGBA, | 1038 GL_RGBA, |
| 1039 GL_UNSIGNED_BYTE, | 1039 GL_UNSIGNED_BYTE, |
| 1040 true); | 1040 true); |
| 1041 // Check bad face. | 1041 // Check bad face. |
| 1042 Texture* texture = texture_ref_->texture(); | 1042 Texture* texture = texture_ref_->texture(); |
| 1043 EXPECT_FALSE(texture->ValidForTexture( | 1043 EXPECT_FALSE(texture->ValidForTexture( |
| 1044 GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, | 1044 GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, |
| 1045 1, 0, 0, 4, 5, GL_RGBA, GL_UNSIGNED_BYTE)); | 1045 1, 0, 0, 4, 5, GL_UNSIGNED_BYTE)); |
| 1046 // Check bad level. | 1046 // Check bad level. |
| 1047 EXPECT_FALSE(texture->ValidForTexture( | 1047 EXPECT_FALSE(texture->ValidForTexture( |
| 1048 GL_TEXTURE_2D, 0, 0, 0, 4, 5, GL_RGBA, GL_UNSIGNED_BYTE)); | 1048 GL_TEXTURE_2D, 0, 0, 0, 4, 5, GL_UNSIGNED_BYTE)); |
| 1049 // Check bad xoffset. | 1049 // Check bad xoffset. |
| 1050 EXPECT_FALSE(texture->ValidForTexture( | 1050 EXPECT_FALSE(texture->ValidForTexture( |
| 1051 GL_TEXTURE_2D, 1, -1, 0, 4, 5, GL_RGBA, GL_UNSIGNED_BYTE)); | 1051 GL_TEXTURE_2D, 1, -1, 0, 4, 5, GL_UNSIGNED_BYTE)); |
| 1052 // Check bad xoffset + width > width. | 1052 // Check bad xoffset + width > width. |
| 1053 EXPECT_FALSE(texture->ValidForTexture( | 1053 EXPECT_FALSE(texture->ValidForTexture( |
| 1054 GL_TEXTURE_2D, 1, 1, 0, 4, 5, GL_RGBA, GL_UNSIGNED_BYTE)); | 1054 GL_TEXTURE_2D, 1, 1, 0, 4, 5, GL_UNSIGNED_BYTE)); |
| 1055 // Check bad yoffset. | 1055 // Check bad yoffset. |
| 1056 EXPECT_FALSE(texture->ValidForTexture( | 1056 EXPECT_FALSE(texture->ValidForTexture( |
| 1057 GL_TEXTURE_2D, 1, 0, -1, 4, 5, GL_RGBA, GL_UNSIGNED_BYTE)); | 1057 GL_TEXTURE_2D, 1, 0, -1, 4, 5, GL_UNSIGNED_BYTE)); |
| 1058 // Check bad yoffset + height > height. | 1058 // Check bad yoffset + height > height. |
| 1059 EXPECT_FALSE(texture->ValidForTexture( | 1059 EXPECT_FALSE(texture->ValidForTexture( |
| 1060 GL_TEXTURE_2D, 1, 0, 1, 4, 5, GL_RGBA, GL_UNSIGNED_BYTE)); | 1060 GL_TEXTURE_2D, 1, 0, 1, 4, 5, GL_UNSIGNED_BYTE)); |
| 1061 // Check bad width. | 1061 // Check bad width. |
| 1062 EXPECT_FALSE(texture->ValidForTexture( | 1062 EXPECT_FALSE(texture->ValidForTexture( |
| 1063 GL_TEXTURE_2D, 1, 0, 0, 5, 5, GL_RGBA, GL_UNSIGNED_BYTE)); | 1063 GL_TEXTURE_2D, 1, 0, 0, 5, 5, GL_UNSIGNED_BYTE)); |
| 1064 // Check bad height. | 1064 // Check bad height. |
| 1065 EXPECT_FALSE(texture->ValidForTexture( | 1065 EXPECT_FALSE(texture->ValidForTexture( |
| 1066 GL_TEXTURE_2D, 1, 0, 0, 4, 6, GL_RGBA, GL_UNSIGNED_BYTE)); | 1066 GL_TEXTURE_2D, 1, 0, 0, 4, 6, GL_UNSIGNED_BYTE)); |
| 1067 // Check bad format. | |
| 1068 EXPECT_FALSE(texture->ValidForTexture( | |
| 1069 GL_TEXTURE_2D, 1, 0, 0, 4, 5, GL_RGB, GL_UNSIGNED_BYTE)); | |
| 1070 // Check bad type. | 1067 // Check bad type. |
| 1071 EXPECT_FALSE(texture->ValidForTexture( | 1068 EXPECT_FALSE(texture->ValidForTexture( |
| 1072 GL_TEXTURE_2D, 1, 0, 0, 4, 5, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4)); | 1069 GL_TEXTURE_2D, 1, 0, 0, 4, 5, GL_UNSIGNED_SHORT_4_4_4_4)); |
| 1073 // Check valid full size | 1070 // Check valid full size |
| 1074 EXPECT_TRUE(texture->ValidForTexture( | 1071 EXPECT_TRUE(texture->ValidForTexture( |
| 1075 GL_TEXTURE_2D, 1, 0, 0, 4, 5, GL_RGBA, GL_UNSIGNED_BYTE)); | 1072 GL_TEXTURE_2D, 1, 0, 0, 4, 5, GL_UNSIGNED_BYTE)); |
| 1076 // Check valid particial size. | 1073 // Check valid particial size. |
| 1077 EXPECT_TRUE(texture->ValidForTexture( | 1074 EXPECT_TRUE(texture->ValidForTexture( |
| 1078 GL_TEXTURE_2D, 1, 1, 1, 2, 3, GL_RGBA, GL_UNSIGNED_BYTE)); | 1075 GL_TEXTURE_2D, 1, 1, 1, 2, 3, GL_UNSIGNED_BYTE)); |
| 1079 manager_->RemoveTexture(kClient1Id); | 1076 manager_->RemoveTexture(kClient1Id); |
| 1080 EXPECT_TRUE(texture->ValidForTexture( | 1077 EXPECT_TRUE(texture->ValidForTexture( |
| 1081 GL_TEXTURE_2D, 1, 0, 0, 4, 5, GL_RGBA, GL_UNSIGNED_BYTE)); | 1078 GL_TEXTURE_2D, 1, 0, 0, 4, 5, GL_UNSIGNED_BYTE)); |
| 1082 } | 1079 } |
| 1083 | 1080 |
| 1084 TEST_F(TextureTest, FloatNotLinear) { | 1081 TEST_F(TextureTest, FloatNotLinear) { |
| 1085 TestHelper::SetupFeatureInfoInitExpectations( | 1082 TestHelper::SetupFeatureInfoInitExpectations( |
| 1086 gl_.get(), "GL_OES_texture_float"); | 1083 gl_.get(), "GL_OES_texture_float"); |
| 1087 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); | 1084 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); |
| 1088 feature_info->Initialize(); | 1085 feature_info->Initialize(); |
| 1089 TextureManager manager( | 1086 TextureManager manager( |
| 1090 NULL, feature_info.get(), kMaxTextureSize, kMaxCubeMapTextureSize); | 1087 NULL, feature_info.get(), kMaxTextureSize, kMaxCubeMapTextureSize); |
| 1091 manager.CreateTexture(kClient1Id, kService1Id); | 1088 manager.CreateTexture(kClient1Id, kService1Id); |
| (...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2441 | 2438 |
| 2442 EXPECT_CALL(*gl_, DeleteTextures(1, _)) | 2439 EXPECT_CALL(*gl_, DeleteTextures(1, _)) |
| 2443 .Times(1) | 2440 .Times(1) |
| 2444 .RetiresOnSaturation(); | 2441 .RetiresOnSaturation(); |
| 2445 texture_manager1_->RemoveTexture(10); | 2442 texture_manager1_->RemoveTexture(10); |
| 2446 texture_manager2_->RemoveTexture(20); | 2443 texture_manager2_->RemoveTexture(20); |
| 2447 } | 2444 } |
| 2448 | 2445 |
| 2449 } // namespace gles2 | 2446 } // namespace gles2 |
| 2450 } // namespace gpu | 2447 } // namespace gpu |
| OLD | NEW |