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

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

Issue 1344373004: TexSubImage2D no longer needs to match the type in ES3. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 <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 943 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), format); 954 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), format);
955 } 955 }
956 956
957 TEST_F(TextureTest, ValidForTexture) { 957 TEST_F(TextureTest, ValidForTexture) {
958 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_2D); 958 manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_2D);
959 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_2D, 1, GL_RGBA, 4, 5, 6, 959 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_2D, 1, GL_RGBA, 4, 5, 6,
960 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(4, 5)); 960 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(4, 5));
961 // Check bad face. 961 // Check bad face.
962 Texture* texture = texture_ref_->texture(); 962 Texture* texture = texture_ref_->texture();
963 EXPECT_FALSE(texture->ValidForTexture( 963 EXPECT_FALSE(texture->ValidForTexture(
964 GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 964 GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 1, 0, 0, 0, 4, 5, 6));
965 1, 0, 0, 0, 4, 5, 6, GL_UNSIGNED_BYTE));
966 // Check bad level. 965 // Check bad level.
967 EXPECT_FALSE(texture->ValidForTexture( 966 EXPECT_FALSE(texture->ValidForTexture(GL_TEXTURE_2D, 0, 0, 0, 0, 4, 5, 6));
968 GL_TEXTURE_2D, 0, 0, 0, 0, 4, 5, 6, GL_UNSIGNED_BYTE));
969 // Check bad xoffset. 967 // Check bad xoffset.
970 EXPECT_FALSE(texture->ValidForTexture( 968 EXPECT_FALSE(texture->ValidForTexture(GL_TEXTURE_2D, 1, -1, 0, 0, 4, 5, 6));
971 GL_TEXTURE_2D, 1, -1, 0, 0, 4, 5, 6, GL_UNSIGNED_BYTE));
972 // Check bad xoffset + width > width. 969 // Check bad xoffset + width > width.
973 EXPECT_FALSE(texture->ValidForTexture( 970 EXPECT_FALSE(texture->ValidForTexture(GL_TEXTURE_2D, 1, 1, 0, 0, 4, 5, 6));
974 GL_TEXTURE_2D, 1, 1, 0, 0, 4, 5, 6, GL_UNSIGNED_BYTE));
975 // Check bad yoffset. 971 // Check bad yoffset.
976 EXPECT_FALSE(texture->ValidForTexture( 972 EXPECT_FALSE(texture->ValidForTexture(GL_TEXTURE_2D, 1, 0, -1, 0, 4, 5, 6));
977 GL_TEXTURE_2D, 1, 0, -1, 0, 4, 5, 6, GL_UNSIGNED_BYTE));
978 // Check bad yoffset + height > height. 973 // Check bad yoffset + height > height.
979 EXPECT_FALSE(texture->ValidForTexture( 974 EXPECT_FALSE(texture->ValidForTexture(GL_TEXTURE_2D, 1, 0, 1, 0, 4, 5, 6));
980 GL_TEXTURE_2D, 1, 0, 1, 0, 4, 5, 6, GL_UNSIGNED_BYTE));
981 // Check bad zoffset. 975 // Check bad zoffset.
982 EXPECT_FALSE(texture->ValidForTexture( 976 EXPECT_FALSE(texture->ValidForTexture(GL_TEXTURE_2D, 1, 0, 0, -1, 4, 5, 6));
983 GL_TEXTURE_2D, 1, 0, 0, -1, 4, 5, 6, GL_UNSIGNED_BYTE));
984 // Check bad zoffset + depth > depth. 977 // Check bad zoffset + depth > depth.
985 EXPECT_FALSE(texture->ValidForTexture( 978 EXPECT_FALSE(texture->ValidForTexture(GL_TEXTURE_2D, 1, 0, 0, 1, 4, 5, 6));
986 GL_TEXTURE_2D, 1, 0, 0, 1, 4, 5, 6, GL_UNSIGNED_BYTE));
987 // Check bad width. 979 // Check bad width.
988 EXPECT_FALSE(texture->ValidForTexture( 980 EXPECT_FALSE(texture->ValidForTexture(GL_TEXTURE_2D, 1, 0, 0, 0, 5, 5, 6));
989 GL_TEXTURE_2D, 1, 0, 0, 0, 5, 5, 6, GL_UNSIGNED_BYTE));
990 // Check bad height. 981 // Check bad height.
991 EXPECT_FALSE(texture->ValidForTexture( 982 EXPECT_FALSE(texture->ValidForTexture(GL_TEXTURE_2D, 1, 0, 0, 0, 4, 6, 6));
992 GL_TEXTURE_2D, 1, 0, 0, 0, 4, 6, 6, GL_UNSIGNED_BYTE));
993 // Check bad depth. 983 // Check bad depth.
994 EXPECT_FALSE(texture->ValidForTexture( 984 EXPECT_FALSE(texture->ValidForTexture(GL_TEXTURE_2D, 1, 0, 0, 0, 4, 5, 7));
995 GL_TEXTURE_2D, 1, 0, 0, 0, 4, 5, 7, GL_UNSIGNED_BYTE));
996 // Check bad type.
997 EXPECT_FALSE(texture->ValidForTexture(
998 GL_TEXTURE_2D, 1, 0, 0, 0, 4, 5, 6, GL_UNSIGNED_SHORT_4_4_4_4));
999 // Check valid full size 985 // Check valid full size
1000 EXPECT_TRUE(texture->ValidForTexture( 986 EXPECT_TRUE(texture->ValidForTexture(GL_TEXTURE_2D, 1, 0, 0, 0, 4, 5, 6));
1001 GL_TEXTURE_2D, 1, 0, 0, 0, 4, 5, 6, GL_UNSIGNED_BYTE));
1002 // Check valid particial size. 987 // Check valid particial size.
1003 EXPECT_TRUE(texture->ValidForTexture( 988 EXPECT_TRUE(texture->ValidForTexture(GL_TEXTURE_2D, 1, 1, 1, 1, 2, 3, 4));
1004 GL_TEXTURE_2D, 1, 1, 1, 1, 2, 3, 4, GL_UNSIGNED_BYTE));
1005 manager_->RemoveTexture(kClient1Id); 989 manager_->RemoveTexture(kClient1Id);
1006 EXPECT_TRUE(texture->ValidForTexture( 990 EXPECT_TRUE(texture->ValidForTexture(GL_TEXTURE_2D, 1, 0, 0, 0, 4, 5, 6));
1007 GL_TEXTURE_2D, 1, 0, 0, 0, 4, 5, 6, GL_UNSIGNED_BYTE));
1008 } 991 }
1009 992
1010 TEST_F(TextureTest, FloatNotLinear) { 993 TEST_F(TextureTest, FloatNotLinear) {
1011 TestHelper::SetupFeatureInfoInitExpectations( 994 TestHelper::SetupFeatureInfoInitExpectations(
1012 gl_.get(), "GL_OES_texture_float"); 995 gl_.get(), "GL_OES_texture_float");
1013 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); 996 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo());
1014 feature_info->Initialize(); 997 feature_info->Initialize();
1015 TextureManager manager(NULL, 998 TextureManager manager(NULL,
1016 feature_info.get(), 999 feature_info.get(),
1017 kMaxTextureSize, 1000 kMaxTextureSize,
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after
2312 ExpectValid(GL_DEPTH_COMPONENT, GL_FLOAT, GL_DEPTH_COMPONENT32F); 2295 ExpectValid(GL_DEPTH_COMPONENT, GL_FLOAT, GL_DEPTH_COMPONENT32F);
2313 ExpectValid(GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8); 2296 ExpectValid(GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8);
2314 ExpectValid(GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, 2297 ExpectValid(GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV,
2315 GL_DEPTH32F_STENCIL8); 2298 GL_DEPTH32F_STENCIL8);
2316 2299
2317 ExpectInvalid(GL_RGB_INTEGER, GL_INT, GL_RGBA8); 2300 ExpectInvalid(GL_RGB_INTEGER, GL_INT, GL_RGBA8);
2318 } 2301 }
2319 2302
2320 } // namespace gles2 2303 } // namespace gles2
2321 } // namespace gpu 2304 } // 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