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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "gpu/command_buffer/service/error_state_mock.h" | 10 #include "gpu/command_buffer/service/error_state_mock.h" |
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1503 EXPECT_TRUE(manager_->HaveUnclearedMips()); | 1503 EXPECT_TRUE(manager_->HaveUnclearedMips()); |
1504 EXPECT_CALL(*gl_, DeleteTextures(1, ::testing::Pointee(kService3Id))) | 1504 EXPECT_CALL(*gl_, DeleteTextures(1, ::testing::Pointee(kService3Id))) |
1505 .Times(1) | 1505 .Times(1) |
1506 .RetiresOnSaturation(); | 1506 .RetiresOnSaturation(); |
1507 texture_ref3 = NULL; | 1507 texture_ref3 = NULL; |
1508 EXPECT_FALSE(manager_->HaveUnsafeTextures()); | 1508 EXPECT_FALSE(manager_->HaveUnsafeTextures()); |
1509 EXPECT_FALSE(manager_->HaveUnclearedMips()); | 1509 EXPECT_FALSE(manager_->HaveUnclearedMips()); |
1510 } | 1510 } |
1511 | 1511 |
1512 TEST_F(TextureTest, ClearTexture) { | 1512 TEST_F(TextureTest, ClearTexture) { |
1513 EXPECT_CALL(*decoder_, ClearLevel(_, _, _, _, _, _, _, _, _, _)) | 1513 EXPECT_CALL(*decoder_, ClearLevel(_, _, _, _, _, _, _, _, _)) |
1514 .WillRepeatedly(Return(true)); | 1514 .WillRepeatedly(Return(true)); |
1515 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_2D); | 1515 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_2D); |
1516 manager_->SetLevelInfo(texture_ref_.get(), | 1516 manager_->SetLevelInfo(texture_ref_.get(), |
1517 GL_TEXTURE_2D, | 1517 GL_TEXTURE_2D, |
1518 0, | 1518 0, |
1519 GL_RGBA, | 1519 GL_RGBA, |
1520 4, | 1520 4, |
1521 4, | 1521 4, |
1522 1, | 1522 1, |
1523 0, | 1523 0, |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2065 | 2065 |
2066 GLuint client_id = texture2_->client_id(); | 2066 GLuint client_id = texture2_->client_id(); |
2067 manager_->RemoveTexture(client_id); | 2067 manager_->RemoveTexture(client_id); |
2068 Consume(client_id, produced_texture); | 2068 Consume(client_id, produced_texture); |
2069 scoped_refptr<TextureRef> restored_texture = manager_->GetTexture(client_id); | 2069 scoped_refptr<TextureRef> restored_texture = manager_->GetTexture(client_id); |
2070 EXPECT_EQ(produced_texture, restored_texture->texture()); | 2070 EXPECT_EQ(produced_texture, restored_texture->texture()); |
2071 | 2071 |
2072 // See if we can clear the previously uncleared level now. | 2072 // See if we can clear the previously uncleared level now. |
2073 EXPECT_EQ(level0, | 2073 EXPECT_EQ(level0, |
2074 GetLevelInfo(restored_texture.get(), GL_TEXTURE_RECTANGLE_ARB, 0)); | 2074 GetLevelInfo(restored_texture.get(), GL_TEXTURE_RECTANGLE_ARB, 0)); |
2075 EXPECT_CALL(*decoder_, ClearLevel(_, _, _, _, _, _, _, _, _, _)) | 2075 EXPECT_CALL(*decoder_, ClearLevel(_, _, _, _, _, _, _, _, _)) |
2076 .WillRepeatedly(Return(true)); | 2076 .WillRepeatedly(Return(true)); |
2077 EXPECT_TRUE(manager_->ClearTextureLevel( | 2077 EXPECT_TRUE(manager_->ClearTextureLevel( |
2078 decoder_.get(), restored_texture.get(), GL_TEXTURE_RECTANGLE_ARB, 0)); | 2078 decoder_.get(), restored_texture.get(), GL_TEXTURE_RECTANGLE_ARB, 0)); |
2079 } | 2079 } |
2080 | 2080 |
2081 TEST_F(ProduceConsumeTextureTest, ProduceConsumeExternal) { | 2081 TEST_F(ProduceConsumeTextureTest, ProduceConsumeExternal) { |
2082 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_EXTERNAL_OES); | 2082 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_EXTERNAL_OES); |
2083 Texture* texture = texture_ref_->texture(); | 2083 Texture* texture = texture_ref_->texture(); |
2084 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), texture->target()); | 2084 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), texture->target()); |
2085 LevelInfo level0( | 2085 LevelInfo level0( |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2513 | 2513 |
2514 EXPECT_CALL(*gl_, DeleteTextures(1, _)) | 2514 EXPECT_CALL(*gl_, DeleteTextures(1, _)) |
2515 .Times(1) | 2515 .Times(1) |
2516 .RetiresOnSaturation(); | 2516 .RetiresOnSaturation(); |
2517 texture_manager1_->RemoveTexture(10); | 2517 texture_manager1_->RemoveTexture(10); |
2518 texture_manager2_->RemoveTexture(20); | 2518 texture_manager2_->RemoveTexture(20); |
2519 } | 2519 } |
2520 | 2520 |
2521 } // namespace gles2 | 2521 } // namespace gles2 |
2522 } // namespace gpu | 2522 } // namespace gpu |
OLD | NEW |