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

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

Issue 1418603002: Revert of Re-land: ui: Move GLImage::BindTexImage fallback from GLImage implementations to GLES2CmdDecoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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') | ui/gl/BUILD.gn » ('j') | 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 <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 } 1384 }
1385 1385
1386 TEST_F(TextureTest, GetLevelImage) { 1386 TEST_F(TextureTest, GetLevelImage) {
1387 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_2D); 1387 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_2D);
1388 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_2D, 1, GL_RGBA, 2, 2, 1, 1388 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_2D, 1, GL_RGBA, 2, 2, 1,
1389 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(2, 2)); 1389 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(2, 2));
1390 Texture* texture = texture_ref_->texture(); 1390 Texture* texture = texture_ref_->texture();
1391 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 1) == NULL); 1391 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 1) == NULL);
1392 // Set image. 1392 // Set image.
1393 scoped_refptr<gfx::GLImage> image(new gfx::GLImageStub); 1393 scoped_refptr<gfx::GLImage> image(new gfx::GLImageStub);
1394 manager_->SetLevelImage(texture_ref_.get(), GL_TEXTURE_2D, 1, image.get(), 1394 manager_->SetLevelImage(texture_ref_.get(), GL_TEXTURE_2D, 1, image.get());
1395 Texture::BOUND);
1396 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 1) == NULL); 1395 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 1) == NULL);
1397 // Remove it. 1396 // Remove it.
1398 manager_->SetLevelImage(texture_ref_.get(), GL_TEXTURE_2D, 1, nullptr, 1397 manager_->SetLevelImage(texture_ref_.get(), GL_TEXTURE_2D, 1, NULL);
1399 Texture::UNBOUND);
1400 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 1) == NULL); 1398 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 1) == NULL);
1401 manager_->SetLevelImage(texture_ref_.get(), GL_TEXTURE_2D, 1, image.get(), 1399 manager_->SetLevelImage(texture_ref_.get(), GL_TEXTURE_2D, 1, image.get());
1402 Texture::UNBOUND);
1403 // Image should be reset when SetLevelInfo is called. 1400 // Image should be reset when SetLevelInfo is called.
1404 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_2D, 1, GL_RGBA, 2, 2, 1, 1401 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_2D, 1, GL_RGBA, 2, 2, 1,
1405 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(2, 2)); 1402 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(2, 2));
1406 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 1) == NULL); 1403 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 1) == NULL);
1407 } 1404 }
1408 1405
1409 namespace { 1406 namespace {
1410 1407
1411 bool InSet(std::set<std::string>* string_set, const std::string& str) { 1408 bool InSet(std::set<std::string>* string_set, const std::string& str) {
1412 std::pair<std::set<std::string>::iterator, bool> result = 1409 std::pair<std::set<std::string>::iterator, bool> result =
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 } 1730 }
1734 1731
1735 TEST_P(ProduceConsumeTextureTest, ProduceConsumeTextureWithImage) { 1732 TEST_P(ProduceConsumeTextureTest, ProduceConsumeTextureWithImage) {
1736 GLenum target = GetParam(); 1733 GLenum target = GetParam();
1737 manager_->SetTarget(texture_ref_.get(), target); 1734 manager_->SetTarget(texture_ref_.get(), target);
1738 Texture* texture = texture_ref_->texture(); 1735 Texture* texture = texture_ref_->texture();
1739 EXPECT_EQ(static_cast<GLenum>(target), texture->target()); 1736 EXPECT_EQ(static_cast<GLenum>(target), texture->target());
1740 scoped_refptr<gfx::GLImage> image(new gfx::GLImageStub); 1737 scoped_refptr<gfx::GLImage> image(new gfx::GLImageStub);
1741 manager_->SetLevelInfo(texture_ref_.get(), target, 0, GL_RGBA, 0, 0, 1, 0, 1738 manager_->SetLevelInfo(texture_ref_.get(), target, 0, GL_RGBA, 0, 0, 1, 0,
1742 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect()); 1739 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect());
1743 manager_->SetLevelImage(texture_ref_.get(), target, 0, image.get(), 1740 manager_->SetLevelImage(texture_ref_.get(), target, 0, image.get());
1744 Texture::BOUND);
1745 GLuint service_id = texture->service_id(); 1741 GLuint service_id = texture->service_id();
1746 Texture* produced_texture = Produce(texture_ref_.get()); 1742 Texture* produced_texture = Produce(texture_ref_.get());
1747 1743
1748 GLuint client_id = texture2_->client_id(); 1744 GLuint client_id = texture2_->client_id();
1749 manager_->RemoveTexture(client_id); 1745 manager_->RemoveTexture(client_id);
1750 Consume(client_id, produced_texture); 1746 Consume(client_id, produced_texture);
1751 scoped_refptr<TextureRef> restored_texture = manager_->GetTexture(client_id); 1747 scoped_refptr<TextureRef> restored_texture = manager_->GetTexture(client_id);
1752 EXPECT_EQ(produced_texture, restored_texture->texture()); 1748 EXPECT_EQ(produced_texture, restored_texture->texture());
1753 EXPECT_EQ(service_id, restored_texture->service_id()); 1749 EXPECT_EQ(service_id, restored_texture->service_id());
1754 EXPECT_EQ(image.get(), restored_texture->texture()->GetLevelImage(target, 0)); 1750 EXPECT_EQ(image.get(), restored_texture->texture()->GetLevelImage(target, 0));
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
2054 2050
2055 texture_manager1_->SetTarget(ref1.get(), GL_TEXTURE_2D); 2051 texture_manager1_->SetTarget(ref1.get(), GL_TEXTURE_2D);
2056 texture_manager1_->SetLevelInfo(ref1.get(), GL_TEXTURE_2D, 1, GL_RGBA, 2, 2, 2052 texture_manager1_->SetLevelInfo(ref1.get(), GL_TEXTURE_2D, 1, GL_RGBA, 2, 2,
2057 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 2053 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
2058 gfx::Rect(2, 2)); 2054 gfx::Rect(2, 2));
2059 EXPECT_FALSE(ref1->texture()->HasImages()); 2055 EXPECT_FALSE(ref1->texture()->HasImages());
2060 EXPECT_FALSE(ref2->texture()->HasImages()); 2056 EXPECT_FALSE(ref2->texture()->HasImages());
2061 EXPECT_FALSE(texture_manager1_->HaveImages()); 2057 EXPECT_FALSE(texture_manager1_->HaveImages());
2062 EXPECT_FALSE(texture_manager2_->HaveImages()); 2058 EXPECT_FALSE(texture_manager2_->HaveImages());
2063 scoped_refptr<gfx::GLImage> image1(new gfx::GLImageStub); 2059 scoped_refptr<gfx::GLImage> image1(new gfx::GLImageStub);
2064 texture_manager1_->SetLevelImage(ref1.get(), GL_TEXTURE_2D, 1, image1.get(), 2060 texture_manager1_->SetLevelImage(ref1.get(), GL_TEXTURE_2D, 1, image1.get());
2065 Texture::BOUND);
2066 EXPECT_TRUE(ref1->texture()->HasImages()); 2061 EXPECT_TRUE(ref1->texture()->HasImages());
2067 EXPECT_TRUE(ref2->texture()->HasImages()); 2062 EXPECT_TRUE(ref2->texture()->HasImages());
2068 EXPECT_TRUE(texture_manager1_->HaveImages()); 2063 EXPECT_TRUE(texture_manager1_->HaveImages());
2069 EXPECT_TRUE(texture_manager2_->HaveImages()); 2064 EXPECT_TRUE(texture_manager2_->HaveImages());
2070 scoped_refptr<gfx::GLImage> image2(new gfx::GLImageStub); 2065 scoped_refptr<gfx::GLImage> image2(new gfx::GLImageStub);
2071 texture_manager1_->SetLevelImage(ref1.get(), GL_TEXTURE_2D, 1, image2.get(), 2066 texture_manager1_->SetLevelImage(ref1.get(), GL_TEXTURE_2D, 1, image2.get());
2072 Texture::BOUND);
2073 EXPECT_TRUE(ref1->texture()->HasImages()); 2067 EXPECT_TRUE(ref1->texture()->HasImages());
2074 EXPECT_TRUE(ref2->texture()->HasImages()); 2068 EXPECT_TRUE(ref2->texture()->HasImages());
2075 EXPECT_TRUE(texture_manager1_->HaveImages()); 2069 EXPECT_TRUE(texture_manager1_->HaveImages());
2076 EXPECT_TRUE(texture_manager2_->HaveImages()); 2070 EXPECT_TRUE(texture_manager2_->HaveImages());
2077 texture_manager1_->SetLevelInfo(ref1.get(), GL_TEXTURE_2D, 1, GL_RGBA, 2, 2, 2071 texture_manager1_->SetLevelInfo(ref1.get(), GL_TEXTURE_2D, 1, GL_RGBA, 2, 2,
2078 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 2072 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
2079 gfx::Rect(2, 2)); 2073 gfx::Rect(2, 2));
2080 EXPECT_FALSE(ref1->texture()->HasImages()); 2074 EXPECT_FALSE(ref1->texture()->HasImages());
2081 EXPECT_FALSE(ref2->texture()->HasImages()); 2075 EXPECT_FALSE(ref2->texture()->HasImages());
2082 EXPECT_FALSE(texture_manager1_->HaveImages()); 2076 EXPECT_FALSE(texture_manager1_->HaveImages());
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
2329 ExpectValid(GL_DEPTH_COMPONENT, GL_FLOAT, GL_DEPTH_COMPONENT32F); 2323 ExpectValid(GL_DEPTH_COMPONENT, GL_FLOAT, GL_DEPTH_COMPONENT32F);
2330 ExpectValid(GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8); 2324 ExpectValid(GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8);
2331 ExpectValid(GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, 2325 ExpectValid(GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV,
2332 GL_DEPTH32F_STENCIL8); 2326 GL_DEPTH32F_STENCIL8);
2333 2327
2334 ExpectInvalid(GL_RGB_INTEGER, GL_INT, GL_RGBA8); 2328 ExpectInvalid(GL_RGB_INTEGER, GL_INT, GL_RGBA8);
2335 } 2329 }
2336 2330
2337 } // namespace gles2 2331 } // namespace gles2
2338 } // namespace gpu 2332 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_manager.cc ('k') | ui/gl/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698