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

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

Issue 1299683002: gpu: If not cube complete, the texture isn't renderable, no matter mipmap complete. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: check cube complete correctly Created 5 years, 4 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 <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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 3, 833 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 3,
834 GL_RGBA, 4, 4, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 834 GL_RGBA, 4, 4, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
835 gfx::Rect(4, 4)); 835 gfx::Rect(4, 4));
836 EXPECT_TRUE(manager_->CanGenerateMipmaps(texture_ref_.get())); 836 EXPECT_TRUE(manager_->CanGenerateMipmaps(texture_ref_.get()));
837 // Make mips. 837 // Make mips.
838 EXPECT_TRUE(manager_->MarkMipmapsGenerated(texture_ref_.get())); 838 EXPECT_TRUE(manager_->MarkMipmapsGenerated(texture_ref_.get()));
839 EXPECT_TRUE(TextureTestHelper::IsTextureComplete(texture)); 839 EXPECT_TRUE(TextureTestHelper::IsTextureComplete(texture));
840 EXPECT_TRUE(TextureTestHelper::IsCubeComplete(texture)); 840 EXPECT_TRUE(TextureTestHelper::IsCubeComplete(texture));
841 } 841 }
842 842
843 TEST_F(TextureTest, POTCubeMapWithoutMipmap) {
844 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_CUBE_MAP);
845 SetParameter(
846 texture_ref_.get(), GL_TEXTURE_MIN_FILTER, GL_NEAREST, GL_NO_ERROR);
847 SetParameter(
848 texture_ref_.get(), GL_TEXTURE_MAG_FILTER, GL_NEAREST, GL_NO_ERROR);
849 SetParameter(
850 texture_ref_.get(), GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE, GL_NO_ERROR);
851 SetParameter(
852 texture_ref_.get(), GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE, GL_NO_ERROR);
853
854 Texture* texture = texture_ref_->texture();
855 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_CUBE_MAP), texture->target());
856 // Check Setting level 0 each face to POT
857 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0,
858 GL_RGBA, 4, 4, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
859 gfx::Rect(4, 4));
860 EXPECT_FALSE(TextureTestHelper::IsNPOT(texture));
861 EXPECT_FALSE(TextureTestHelper::IsTextureComplete(texture));
862 EXPECT_FALSE(TextureTestHelper::IsCubeComplete(texture));
863 EXPECT_FALSE(manager_->CanGenerateMipmaps(texture_ref_.get()));
864 EXPECT_FALSE(manager_->CanRender(texture_ref_.get()));
865 EXPECT_TRUE(manager_->HaveUnrenderableTextures());
866 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0,
867 GL_RGBA, 4, 4, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
868 gfx::Rect(4, 4));
869 EXPECT_FALSE(TextureTestHelper::IsNPOT(texture));
870 EXPECT_FALSE(TextureTestHelper::IsTextureComplete(texture));
871 EXPECT_FALSE(TextureTestHelper::IsCubeComplete(texture));
872 EXPECT_FALSE(manager_->CanGenerateMipmaps(texture_ref_.get()));
873 EXPECT_FALSE(manager_->CanRender(texture_ref_.get()));
874 EXPECT_TRUE(manager_->HaveUnrenderableTextures());
875 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0,
876 GL_RGBA, 4, 4, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
877 gfx::Rect(4, 4));
878 EXPECT_FALSE(TextureTestHelper::IsNPOT(texture));
879 EXPECT_FALSE(TextureTestHelper::IsTextureComplete(texture));
880 EXPECT_FALSE(TextureTestHelper::IsCubeComplete(texture));
881 EXPECT_FALSE(manager_->CanGenerateMipmaps(texture_ref_.get()));
882 EXPECT_FALSE(manager_->CanRender(texture_ref_.get()));
883 EXPECT_TRUE(manager_->HaveUnrenderableTextures());
884 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0,
885 GL_RGBA, 4, 4, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
886 gfx::Rect(4, 4));
887 EXPECT_FALSE(TextureTestHelper::IsNPOT(texture));
888 EXPECT_FALSE(TextureTestHelper::IsTextureComplete(texture));
889 EXPECT_FALSE(TextureTestHelper::IsCubeComplete(texture));
890 EXPECT_FALSE(manager_->CanRender(texture_ref_.get()));
891 EXPECT_FALSE(manager_->CanGenerateMipmaps(texture_ref_.get()));
892 EXPECT_TRUE(manager_->HaveUnrenderableTextures());
893 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0,
894 GL_RGBA, 4, 4, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
895 gfx::Rect(4, 4));
896 EXPECT_FALSE(TextureTestHelper::IsNPOT(texture));
897 EXPECT_FALSE(TextureTestHelper::IsTextureComplete(texture));
898 EXPECT_FALSE(TextureTestHelper::IsCubeComplete(texture));
899 EXPECT_FALSE(manager_->CanGenerateMipmaps(texture_ref_.get()));
900 EXPECT_FALSE(manager_->CanRender(texture_ref_.get()));
901 EXPECT_TRUE(manager_->HaveUnrenderableTextures());
902 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0,
903 GL_RGBA, 4, 4, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
904 gfx::Rect(4, 4));
905 EXPECT_FALSE(TextureTestHelper::IsNPOT(texture));
906 EXPECT_FALSE(TextureTestHelper::IsTextureComplete(texture));
907 EXPECT_TRUE(TextureTestHelper::IsCubeComplete(texture));
908 EXPECT_TRUE(manager_->CanGenerateMipmaps(texture_ref_.get()));
909 EXPECT_TRUE(manager_->CanRender(texture_ref_.get()));
910 EXPECT_FALSE(manager_->HaveUnrenderableTextures());
911 }
912
843 TEST_F(TextureTest, GetLevelSize) { 913 TEST_F(TextureTest, GetLevelSize) {
844 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_3D); 914 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_3D);
845 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_3D, 1, GL_RGBA, 4, 5, 6, 915 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_3D, 1, GL_RGBA, 4, 5, 6,
846 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(4, 5)); 916 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(4, 5));
847 GLsizei width = -1; 917 GLsizei width = -1;
848 GLsizei height = -1; 918 GLsizei height = -1;
849 GLsizei depth = -1; 919 GLsizei depth = -1;
850 Texture* texture = texture_ref_->texture(); 920 Texture* texture = texture_ref_->texture();
851 EXPECT_FALSE( 921 EXPECT_FALSE(
852 texture->GetLevelSize(GL_TEXTURE_3D, -1, &width, &height, &depth)); 922 texture->GetLevelSize(GL_TEXTURE_3D, -1, &width, &height, &depth));
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after
2242 ExpectValid(GL_DEPTH_COMPONENT, GL_FLOAT, GL_DEPTH_COMPONENT32F); 2312 ExpectValid(GL_DEPTH_COMPONENT, GL_FLOAT, GL_DEPTH_COMPONENT32F);
2243 ExpectValid(GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8); 2313 ExpectValid(GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8);
2244 ExpectValid(GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, 2314 ExpectValid(GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV,
2245 GL_DEPTH32F_STENCIL8); 2315 GL_DEPTH32F_STENCIL8);
2246 2316
2247 ExpectInvalid(GL_RGB_INTEGER, GL_INT, GL_RGBA8); 2317 ExpectInvalid(GL_RGB_INTEGER, GL_INT, GL_RGBA8);
2248 } 2318 }
2249 2319
2250 } // namespace gles2 2320 } // namespace gles2
2251 } // namespace gpu 2321 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698