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

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

Issue 1925093002: Handle compressed textures allocated via TexStorage2D. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed gpu_unittests after last refactor. Created 4 years, 7 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1606 .Times(1) 1606 .Times(1)
1607 .RetiresOnSaturation(); 1607 .RetiresOnSaturation();
1608 texture_ref3 = NULL; 1608 texture_ref3 = NULL;
1609 EXPECT_FALSE(manager_->HaveUnsafeTextures()); 1609 EXPECT_FALSE(manager_->HaveUnsafeTextures());
1610 EXPECT_FALSE(manager_->HaveUnclearedMips()); 1610 EXPECT_FALSE(manager_->HaveUnclearedMips());
1611 } 1611 }
1612 1612
1613 TEST_F(TextureTest, ClearTexture) { 1613 TEST_F(TextureTest, ClearTexture) {
1614 EXPECT_CALL(*decoder_, ClearLevel(_, _, _, _, _, _, _, _, _)) 1614 EXPECT_CALL(*decoder_, ClearLevel(_, _, _, _, _, _, _, _, _))
1615 .WillRepeatedly(Return(true)); 1615 .WillRepeatedly(Return(true));
1616 // The code path taken when IsCompressedTextureFormat returns true
1617 // is covered best by the WebGL 2.0 conformance tests.
1618 EXPECT_CALL(*decoder_, IsCompressedTextureFormat(_))
1619 .WillRepeatedly(Return(false));
1616 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_2D); 1620 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_2D);
1617 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 1, 1621 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 1,
1618 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect()); 1622 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect());
1619 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_2D, 1, GL_RGBA, 4, 4, 1, 1623 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_2D, 1, GL_RGBA, 4, 4, 1,
1620 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect()); 1624 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect());
1621 Texture* texture = texture_ref_->texture(); 1625 Texture* texture = texture_ref_->texture();
1622 EXPECT_FALSE(texture->SafeToRenderFrom()); 1626 EXPECT_FALSE(texture->SafeToRenderFrom());
1623 EXPECT_TRUE(manager_->HaveUnsafeTextures()); 1627 EXPECT_TRUE(manager_->HaveUnsafeTextures());
1624 EXPECT_TRUE(manager_->HaveUnclearedMips()); 1628 EXPECT_TRUE(manager_->HaveUnclearedMips());
1625 EXPECT_EQ(2, texture->num_uncleared_mips()); 1629 EXPECT_EQ(2, texture->num_uncleared_mips());
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
2032 manager_->RemoveTexture(client_id); 2036 manager_->RemoveTexture(client_id);
2033 Consume(client_id, produced_texture); 2037 Consume(client_id, produced_texture);
2034 scoped_refptr<TextureRef> restored_texture = manager_->GetTexture(client_id); 2038 scoped_refptr<TextureRef> restored_texture = manager_->GetTexture(client_id);
2035 EXPECT_EQ(produced_texture, restored_texture->texture()); 2039 EXPECT_EQ(produced_texture, restored_texture->texture());
2036 2040
2037 // See if we can clear the previously uncleared level now. 2041 // See if we can clear the previously uncleared level now.
2038 EXPECT_EQ(level0, 2042 EXPECT_EQ(level0,
2039 GetLevelInfo(restored_texture.get(), GL_TEXTURE_RECTANGLE_ARB, 0)); 2043 GetLevelInfo(restored_texture.get(), GL_TEXTURE_RECTANGLE_ARB, 0));
2040 EXPECT_CALL(*decoder_, ClearLevel(_, _, _, _, _, _, _, _, _)) 2044 EXPECT_CALL(*decoder_, ClearLevel(_, _, _, _, _, _, _, _, _))
2041 .WillRepeatedly(Return(true)); 2045 .WillRepeatedly(Return(true));
2046 // The code path taken when IsCompressedTextureFormat returns true
2047 // is covered best by the WebGL 2.0 conformance tests.
2048 EXPECT_CALL(*decoder_, IsCompressedTextureFormat(_))
2049 .WillRepeatedly(Return(false));
2042 EXPECT_TRUE(manager_->ClearTextureLevel( 2050 EXPECT_TRUE(manager_->ClearTextureLevel(
2043 decoder_.get(), restored_texture.get(), GL_TEXTURE_RECTANGLE_ARB, 0)); 2051 decoder_.get(), restored_texture.get(), GL_TEXTURE_RECTANGLE_ARB, 0));
2044 } 2052 }
2045 2053
2046 TEST_F(ProduceConsumeTextureTest, ProduceConsumeExternal) { 2054 TEST_F(ProduceConsumeTextureTest, ProduceConsumeExternal) {
2047 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_EXTERNAL_OES); 2055 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_EXTERNAL_OES);
2048 Texture* texture = texture_ref_->texture(); 2056 Texture* texture = texture_ref_->texture();
2049 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), texture->target()); 2057 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), texture->target());
2050 LevelInfo level0(GL_TEXTURE_EXTERNAL_OES, GL_RGBA, 1, 1, 1, 0, 2058 LevelInfo level0(GL_TEXTURE_EXTERNAL_OES, GL_RGBA, 1, 1, 1, 0,
2051 GL_UNSIGNED_BYTE, gfx::Rect()); 2059 GL_UNSIGNED_BYTE, gfx::Rect());
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
2674 ExpectValid( 2682 ExpectValid(
2675 true, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8); 2683 true, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8);
2676 ExpectValid(true, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, 2684 ExpectValid(true, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV,
2677 GL_DEPTH32F_STENCIL8); 2685 GL_DEPTH32F_STENCIL8);
2678 2686
2679 ExpectInvalid(true, GL_RGB_INTEGER, GL_INT, GL_RGBA8); 2687 ExpectInvalid(true, GL_RGB_INTEGER, GL_INT, GL_RGBA8);
2680 } 2688 }
2681 2689
2682 } // namespace gles2 2690 } // namespace gles2
2683 } // namespace gpu 2691 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_manager.cc ('k') | third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698