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

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

Issue 24152009: Allow rendering from non-stream GL_TEXTURE_EXTERNAL_OES (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@git-svn
Patch Set: 2fea9080 Initial. Created 7 years, 3 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
« no previous file with comments | « gpu/command_buffer/service/texture_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 EXPECT_FALSE(texture->IsImmutable()); 459 EXPECT_FALSE(texture->IsImmutable());
460 } 460 }
461 461
462 TEST_F(TextureTest, SetTargetTextureExternalOES) { 462 TEST_F(TextureTest, SetTargetTextureExternalOES) {
463 Texture* texture = texture_ref_->texture(); 463 Texture* texture = texture_ref_->texture();
464 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_EXTERNAL_OES); 464 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_EXTERNAL_OES);
465 EXPECT_FALSE(TextureTestHelper::IsTextureComplete(texture)); 465 EXPECT_FALSE(TextureTestHelper::IsTextureComplete(texture));
466 EXPECT_FALSE(TextureTestHelper::IsCubeComplete(texture)); 466 EXPECT_FALSE(TextureTestHelper::IsCubeComplete(texture));
467 EXPECT_FALSE(manager_->CanGenerateMipmaps(texture_ref_.get())); 467 EXPECT_FALSE(manager_->CanGenerateMipmaps(texture_ref_.get()));
468 EXPECT_TRUE(TextureTestHelper::IsNPOT(texture)); 468 EXPECT_TRUE(TextureTestHelper::IsNPOT(texture));
469 EXPECT_FALSE(manager_->CanRender(texture_ref_.get())); 469 EXPECT_TRUE(manager_->CanRender(texture_ref_.get()));
470 EXPECT_TRUE(texture->SafeToRenderFrom()); 470 EXPECT_TRUE(texture->SafeToRenderFrom());
471 EXPECT_TRUE(texture->IsImmutable()); 471 EXPECT_TRUE(texture->IsImmutable());
472 manager_->SetStreamTexture(texture_ref_.get(), true);
473 EXPECT_TRUE(manager_->CanRender(texture_ref_.get()));
474 } 472 }
475 473
476 TEST_F(TextureTest, ZeroSizeCanNotRender) { 474 TEST_F(TextureTest, ZeroSizeCanNotRender) {
477 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_2D); 475 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_2D);
478 EXPECT_FALSE(manager_->CanRender(texture_ref_.get())); 476 EXPECT_FALSE(manager_->CanRender(texture_ref_.get()));
479 manager_->SetLevelInfo(texture_ref_.get(), 477 manager_->SetLevelInfo(texture_ref_.get(),
480 GL_TEXTURE_2D, 478 GL_TEXTURE_2D,
481 0, 479 0,
482 GL_RGBA, 480 GL_RGBA,
483 1, 481 1,
(...skipping 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 1993
1996 // See if we can clear the previously uncleared level now. 1994 // See if we can clear the previously uncleared level now.
1997 EXPECT_EQ(level0, 1995 EXPECT_EQ(level0,
1998 GetLevelInfo(restored_texture.get(), GL_TEXTURE_RECTANGLE_ARB, 0)); 1996 GetLevelInfo(restored_texture.get(), GL_TEXTURE_RECTANGLE_ARB, 0));
1999 EXPECT_CALL(*decoder_, ClearLevel(_, _, _, _, _, _, _, _, _)) 1997 EXPECT_CALL(*decoder_, ClearLevel(_, _, _, _, _, _, _, _, _))
2000 .WillRepeatedly(Return(true)); 1998 .WillRepeatedly(Return(true));
2001 EXPECT_TRUE(manager_->ClearTextureLevel( 1999 EXPECT_TRUE(manager_->ClearTextureLevel(
2002 decoder_.get(), restored_texture.get(), GL_TEXTURE_RECTANGLE_ARB, 0)); 2000 decoder_.get(), restored_texture.get(), GL_TEXTURE_RECTANGLE_ARB, 0));
2003 } 2001 }
2004 2002
2003 TEST_F(ProduceConsumeTextureTest, ProduceConsumeExternal) {
2004 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_EXTERNAL_OES);
2005 Texture* texture = texture_ref_->texture();
2006 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), texture->target());
2007 LevelInfo level0(
2008 GL_TEXTURE_EXTERNAL_OES, GL_RGBA, 1, 1, 1, 0, GL_UNSIGNED_BYTE, false);
2009 SetLevelInfo(texture_ref_.get(), 0, level0);
2010 EXPECT_TRUE(TextureTestHelper::IsTextureComplete(texture));
2011 Texture* produced_texture = Produce(texture_ref_.get());
2012 EXPECT_EQ(produced_texture, texture);
2013
2014 GLuint client_id = texture2_->client_id();
2015 manager_->RemoveTexture(client_id);
2016 Consume(client_id, produced_texture);
2017 scoped_refptr<TextureRef> restored_texture = manager_->GetTexture(client_id);
2018 EXPECT_EQ(produced_texture, restored_texture->texture());
2019 EXPECT_EQ(level0,
2020 GetLevelInfo(restored_texture.get(), GL_TEXTURE_EXTERNAL_OES, 0));
2021 }
piman 2013/09/19 02:20:09 nit: blank line after this.
sheu 2013/09/19 05:34:21 Done.
2005 TEST_F(ProduceConsumeTextureTest, ProduceConsumeStreamTexture) { 2022 TEST_F(ProduceConsumeTextureTest, ProduceConsumeStreamTexture) {
2006 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_EXTERNAL_OES); 2023 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_EXTERNAL_OES);
2007 Texture* texture = texture_ref_->texture(); 2024 Texture* texture = texture_ref_->texture();
2008 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), texture->target()); 2025 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), texture->target());
2009 manager_->SetStreamTexture(texture_ref_.get(), true); 2026 manager_->SetStreamTexture(texture_ref_.get(), true);
2010 GLuint service_id = texture->service_id(); 2027 GLuint service_id = texture->service_id();
2011 Texture* produced_texture = Produce(texture_ref_.get()); 2028 Texture* produced_texture = Produce(texture_ref_.get());
2012 EXPECT_TRUE(texture->IsStreamTexture()); 2029 EXPECT_TRUE(texture->IsStreamTexture());
2013 2030
2014 GLuint client_id = texture2_->client_id(); 2031 GLuint client_id = texture2_->client_id();
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
2344 .Times(1) 2361 .Times(1)
2345 .RetiresOnSaturation(); 2362 .RetiresOnSaturation();
2346 ref2 = NULL; 2363 ref2 = NULL;
2347 texture_manager2_->RemoveTexture(20); 2364 texture_manager2_->RemoveTexture(20);
2348 EXPECT_EQ(initial_memory2, 2365 EXPECT_EQ(initial_memory2,
2349 memory_tracker2_->GetSize(MemoryTracker::kUnmanaged)); 2366 memory_tracker2_->GetSize(MemoryTracker::kUnmanaged));
2350 } 2367 }
2351 2368
2352 } // namespace gles2 2369 } // namespace gles2
2353 } // namespace gpu 2370 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698