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

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

Issue 1421903006: ui/gl: Move GLImage into gl namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix gl_unittests Created 5 years, 1 month 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 <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 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 texture_ref = NULL; 1383 texture_ref = NULL;
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<gl::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); 1395 Texture::BOUND);
1396 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 1) == NULL); 1396 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 1) == NULL);
1397 // Remove it. 1397 // Remove it.
1398 manager_->SetLevelImage(texture_ref_.get(), GL_TEXTURE_2D, 1, nullptr, 1398 manager_->SetLevelImage(texture_ref_.get(), GL_TEXTURE_2D, 1, nullptr,
1399 Texture::UNBOUND); 1399 Texture::UNBOUND);
1400 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 1) == NULL); 1400 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 1) == NULL);
1401 manager_->SetLevelImage(texture_ref_.get(), GL_TEXTURE_2D, 1, image.get(), 1401 manager_->SetLevelImage(texture_ref_.get(), GL_TEXTURE_2D, 1, image.get(),
1402 Texture::UNBOUND); 1402 Texture::UNBOUND);
1403 // Image should be reset when SetLevelInfo is called. 1403 // Image should be reset when SetLevelInfo is called.
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1730 EXPECT_EQ(produced_texture, restored_texture->texture()); 1730 EXPECT_EQ(produced_texture, restored_texture->texture());
1731 EXPECT_EQ(level0, 1731 EXPECT_EQ(level0,
1732 GetLevelInfo(restored_texture.get(), GL_TEXTURE_EXTERNAL_OES, 0)); 1732 GetLevelInfo(restored_texture.get(), GL_TEXTURE_EXTERNAL_OES, 0));
1733 } 1733 }
1734 1734
1735 TEST_P(ProduceConsumeTextureTest, ProduceConsumeTextureWithImage) { 1735 TEST_P(ProduceConsumeTextureTest, ProduceConsumeTextureWithImage) {
1736 GLenum target = GetParam(); 1736 GLenum target = GetParam();
1737 manager_->SetTarget(texture_ref_.get(), target); 1737 manager_->SetTarget(texture_ref_.get(), target);
1738 Texture* texture = texture_ref_->texture(); 1738 Texture* texture = texture_ref_->texture();
1739 EXPECT_EQ(static_cast<GLenum>(target), texture->target()); 1739 EXPECT_EQ(static_cast<GLenum>(target), texture->target());
1740 scoped_refptr<gfx::GLImage> image(new gfx::GLImageStub); 1740 scoped_refptr<gl::GLImage> image(new gfx::GLImageStub);
1741 manager_->SetLevelInfo(texture_ref_.get(), target, 0, GL_RGBA, 0, 0, 1, 0, 1741 manager_->SetLevelInfo(texture_ref_.get(), target, 0, GL_RGBA, 0, 0, 1, 0,
1742 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect()); 1742 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect());
1743 manager_->SetLevelImage(texture_ref_.get(), target, 0, image.get(), 1743 manager_->SetLevelImage(texture_ref_.get(), target, 0, image.get(),
1744 Texture::BOUND); 1744 Texture::BOUND);
1745 GLuint service_id = texture->service_id(); 1745 GLuint service_id = texture->service_id();
1746 Texture* produced_texture = Produce(texture_ref_.get()); 1746 Texture* produced_texture = Produce(texture_ref_.get());
1747 1747
1748 GLuint client_id = texture2_->client_id(); 1748 GLuint client_id = texture2_->client_id();
1749 manager_->RemoveTexture(client_id); 1749 manager_->RemoveTexture(client_id);
1750 Consume(client_id, produced_texture); 1750 Consume(client_id, produced_texture);
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 texture_manager2_->Consume(20, ref1->texture()); 2053 texture_manager2_->Consume(20, ref1->texture());
2054 2054
2055 texture_manager1_->SetTarget(ref1.get(), GL_TEXTURE_2D); 2055 texture_manager1_->SetTarget(ref1.get(), GL_TEXTURE_2D);
2056 texture_manager1_->SetLevelInfo(ref1.get(), GL_TEXTURE_2D, 1, GL_RGBA, 2, 2, 2056 texture_manager1_->SetLevelInfo(ref1.get(), GL_TEXTURE_2D, 1, GL_RGBA, 2, 2,
2057 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 2057 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
2058 gfx::Rect(2, 2)); 2058 gfx::Rect(2, 2));
2059 EXPECT_FALSE(ref1->texture()->HasImages()); 2059 EXPECT_FALSE(ref1->texture()->HasImages());
2060 EXPECT_FALSE(ref2->texture()->HasImages()); 2060 EXPECT_FALSE(ref2->texture()->HasImages());
2061 EXPECT_FALSE(texture_manager1_->HaveImages()); 2061 EXPECT_FALSE(texture_manager1_->HaveImages());
2062 EXPECT_FALSE(texture_manager2_->HaveImages()); 2062 EXPECT_FALSE(texture_manager2_->HaveImages());
2063 scoped_refptr<gfx::GLImage> image1(new gfx::GLImageStub); 2063 scoped_refptr<gl::GLImage> image1(new gfx::GLImageStub);
2064 texture_manager1_->SetLevelImage(ref1.get(), GL_TEXTURE_2D, 1, image1.get(), 2064 texture_manager1_->SetLevelImage(ref1.get(), GL_TEXTURE_2D, 1, image1.get(),
2065 Texture::BOUND); 2065 Texture::BOUND);
2066 EXPECT_TRUE(ref1->texture()->HasImages()); 2066 EXPECT_TRUE(ref1->texture()->HasImages());
2067 EXPECT_TRUE(ref2->texture()->HasImages()); 2067 EXPECT_TRUE(ref2->texture()->HasImages());
2068 EXPECT_TRUE(texture_manager1_->HaveImages()); 2068 EXPECT_TRUE(texture_manager1_->HaveImages());
2069 EXPECT_TRUE(texture_manager2_->HaveImages()); 2069 EXPECT_TRUE(texture_manager2_->HaveImages());
2070 scoped_refptr<gfx::GLImage> image2(new gfx::GLImageStub); 2070 scoped_refptr<gl::GLImage> image2(new gfx::GLImageStub);
2071 texture_manager1_->SetLevelImage(ref1.get(), GL_TEXTURE_2D, 1, image2.get(), 2071 texture_manager1_->SetLevelImage(ref1.get(), GL_TEXTURE_2D, 1, image2.get(),
2072 Texture::BOUND); 2072 Texture::BOUND);
2073 EXPECT_TRUE(ref1->texture()->HasImages()); 2073 EXPECT_TRUE(ref1->texture()->HasImages());
2074 EXPECT_TRUE(ref2->texture()->HasImages()); 2074 EXPECT_TRUE(ref2->texture()->HasImages());
2075 EXPECT_TRUE(texture_manager1_->HaveImages()); 2075 EXPECT_TRUE(texture_manager1_->HaveImages());
2076 EXPECT_TRUE(texture_manager2_->HaveImages()); 2076 EXPECT_TRUE(texture_manager2_->HaveImages());
2077 texture_manager1_->SetLevelInfo(ref1.get(), GL_TEXTURE_2D, 1, GL_RGBA, 2, 2, 2077 texture_manager1_->SetLevelInfo(ref1.get(), GL_TEXTURE_2D, 1, GL_RGBA, 2, 2,
2078 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 2078 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
2079 gfx::Rect(2, 2)); 2079 gfx::Rect(2, 2));
2080 EXPECT_FALSE(ref1->texture()->HasImages()); 2080 EXPECT_FALSE(ref1->texture()->HasImages());
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2329 ExpectValid(GL_DEPTH_COMPONENT, GL_FLOAT, GL_DEPTH_COMPONENT32F); 2329 ExpectValid(GL_DEPTH_COMPONENT, GL_FLOAT, GL_DEPTH_COMPONENT32F);
2330 ExpectValid(GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8); 2330 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, 2331 ExpectValid(GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV,
2332 GL_DEPTH32F_STENCIL8); 2332 GL_DEPTH32F_STENCIL8);
2333 2333
2334 ExpectInvalid(GL_RGB_INTEGER, GL_INT, GL_RGBA8); 2334 ExpectInvalid(GL_RGB_INTEGER, GL_INT, GL_RGBA8);
2335 } 2335 }
2336 2336
2337 } // namespace gles2 2337 } // namespace gles2
2338 } // namespace gpu 2338 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698