Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Side by Side Diff: gpu/command_buffer/service/texture_manager_unittest.cc

Issue 168983005: Do not rely on a texture's internalformat matching format (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 EXPECT_TRUE(manager_->HaveUnclearedMips()); 1418 EXPECT_TRUE(manager_->HaveUnclearedMips());
1419 EXPECT_CALL(*gl_, DeleteTextures(1, ::testing::Pointee(kService3Id))) 1419 EXPECT_CALL(*gl_, DeleteTextures(1, ::testing::Pointee(kService3Id)))
1420 .Times(1) 1420 .Times(1)
1421 .RetiresOnSaturation(); 1421 .RetiresOnSaturation();
1422 texture_ref3 = NULL; 1422 texture_ref3 = NULL;
1423 EXPECT_FALSE(manager_->HaveUnsafeTextures()); 1423 EXPECT_FALSE(manager_->HaveUnsafeTextures());
1424 EXPECT_FALSE(manager_->HaveUnclearedMips()); 1424 EXPECT_FALSE(manager_->HaveUnclearedMips());
1425 } 1425 }
1426 1426
1427 TEST_F(TextureTest, ClearTexture) { 1427 TEST_F(TextureTest, ClearTexture) {
1428 EXPECT_CALL(*decoder_, ClearLevel(_, _, _, _, _, _, _, _, _)) 1428 EXPECT_CALL(*decoder_, ClearLevel(_, _, _, _, _, _, _, _, _, _))
1429 .WillRepeatedly(Return(true)); 1429 .WillRepeatedly(Return(true));
1430 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_2D); 1430 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_2D);
1431 manager_->SetLevelInfo(texture_ref_.get(), 1431 manager_->SetLevelInfo(texture_ref_.get(),
1432 GL_TEXTURE_2D, 1432 GL_TEXTURE_2D,
1433 0, 1433 0,
1434 GL_RGBA, 1434 GL_RGBA,
1435 4, 1435 4,
1436 4, 1436 4,
1437 1, 1437 1,
1438 0, 1438 0,
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 1985
1986 GLuint client_id = texture2_->client_id(); 1986 GLuint client_id = texture2_->client_id();
1987 manager_->RemoveTexture(client_id); 1987 manager_->RemoveTexture(client_id);
1988 Consume(client_id, produced_texture); 1988 Consume(client_id, produced_texture);
1989 scoped_refptr<TextureRef> restored_texture = manager_->GetTexture(client_id); 1989 scoped_refptr<TextureRef> restored_texture = manager_->GetTexture(client_id);
1990 EXPECT_EQ(produced_texture, restored_texture->texture()); 1990 EXPECT_EQ(produced_texture, restored_texture->texture());
1991 1991
1992 // See if we can clear the previously uncleared level now. 1992 // See if we can clear the previously uncleared level now.
1993 EXPECT_EQ(level0, 1993 EXPECT_EQ(level0,
1994 GetLevelInfo(restored_texture.get(), GL_TEXTURE_RECTANGLE_ARB, 0)); 1994 GetLevelInfo(restored_texture.get(), GL_TEXTURE_RECTANGLE_ARB, 0));
1995 EXPECT_CALL(*decoder_, ClearLevel(_, _, _, _, _, _, _, _, _)) 1995 EXPECT_CALL(*decoder_, ClearLevel(_, _, _, _, _, _, _, _, _, _))
1996 .WillRepeatedly(Return(true)); 1996 .WillRepeatedly(Return(true));
1997 EXPECT_TRUE(manager_->ClearTextureLevel( 1997 EXPECT_TRUE(manager_->ClearTextureLevel(
1998 decoder_.get(), restored_texture.get(), GL_TEXTURE_RECTANGLE_ARB, 0)); 1998 decoder_.get(), restored_texture.get(), GL_TEXTURE_RECTANGLE_ARB, 0));
1999 } 1999 }
2000 2000
2001 TEST_F(ProduceConsumeTextureTest, ProduceConsumeExternal) { 2001 TEST_F(ProduceConsumeTextureTest, ProduceConsumeExternal) {
2002 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_EXTERNAL_OES); 2002 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_EXTERNAL_OES);
2003 Texture* texture = texture_ref_->texture(); 2003 Texture* texture = texture_ref_->texture();
2004 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), texture->target()); 2004 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), texture->target());
2005 LevelInfo level0( 2005 LevelInfo level0(
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
2438 2438
2439 EXPECT_CALL(*gl_, DeleteTextures(1, _)) 2439 EXPECT_CALL(*gl_, DeleteTextures(1, _))
2440 .Times(1) 2440 .Times(1)
2441 .RetiresOnSaturation(); 2441 .RetiresOnSaturation();
2442 texture_manager1_->RemoveTexture(10); 2442 texture_manager1_->RemoveTexture(10);
2443 texture_manager2_->RemoveTexture(20); 2443 texture_manager2_->RemoveTexture(20);
2444 } 2444 }
2445 2445
2446 } // namespace gles2 2446 } // namespace gles2
2447 } // namespace gpu 2447 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698