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

Unified Diff: gpu/command_buffer/service/texture_manager_unittest.cc

Issue 1465993003: Ensured that texture completeness takes into account base and max level (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing compiler warnings 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/texture_manager.cc ('k') | gpu/config/gpu_driver_bug_list_json.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/texture_manager_unittest.cc
diff --git a/gpu/command_buffer/service/texture_manager_unittest.cc b/gpu/command_buffer/service/texture_manager_unittest.cc
index dc01e7a10c31e056cecaf64a7e307c5c724476ec..4f026d12930c6a5b1f1d739c09d9b1eb177a754f 100644
--- a/gpu/command_buffer/service/texture_manager_unittest.cc
+++ b/gpu/command_buffer/service/texture_manager_unittest.cc
@@ -47,12 +47,12 @@ class TextureTestHelper {
class TextureManagerTest : public GpuServiceTest {
public:
- static const GLint kMaxTextureSize = 16;
+ static const GLint kMaxTextureSize = 32;
static const GLint kMaxCubeMapTextureSize = 8;
- static const GLint kMaxRectangleTextureSize = 16;
- static const GLint kMaxExternalTextureSize = 16;
+ static const GLint kMaxRectangleTextureSize = 32;
+ static const GLint kMaxExternalTextureSize = 32;
static const GLint kMax3DTextureSize = 256;
- static const GLint kMax2dLevels = 5;
+ static const GLint kMax2dLevels = 6;
static const GLint kMaxCubeMapLevels = 4;
static const GLint kMaxExternalLevels = 1;
static const bool kUseDefaultTextures = false;
@@ -465,11 +465,11 @@ TEST_F(TextureManagerTest, ValidForTargetNPOT) {
class TextureTestBase : public GpuServiceTest {
public:
- static const GLint kMaxTextureSize = 16;
+ static const GLint kMaxTextureSize = 32;
static const GLint kMaxCubeMapTextureSize = 8;
- static const GLint kMaxRectangleTextureSize = 16;
+ static const GLint kMaxRectangleTextureSize = 32;
static const GLint kMax3DTextureSize = 256;
- static const GLint kMax2dLevels = 5;
+ static const GLint kMax2dLevels = 6;
static const GLint kMaxCubeMapLevels = 4;
static const GLuint kClient1Id = 1;
static const GLuint kService1Id = 11;
@@ -684,6 +684,55 @@ TEST_F(TextureTest, POT2D) {
EXPECT_FALSE(manager_->HaveUnrenderableTextures());
}
+TEST_F(TextureTest, BaseLevel) {
+ manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_2D);
+ Texture* texture = texture_ref_->texture();
+ EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), texture->target());
+ // Check Setting level 1 to POT
+ manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_2D, 1, GL_RGBA, 4, 4, 1,
+ 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(4, 4));
+ SetParameter(
+ texture_ref_.get(), GL_TEXTURE_MIN_FILTER, GL_LINEAR, GL_NO_ERROR);
+ EXPECT_FALSE(manager_->CanRender(texture_ref_.get()));
+ EXPECT_TRUE(manager_->HaveUnrenderableTextures());
+ SetParameter(
+ texture_ref_.get(), GL_TEXTURE_BASE_LEVEL, 1, GL_NO_ERROR);
+ EXPECT_TRUE(manager_->CanRender(texture_ref_.get()));
+ EXPECT_FALSE(manager_->HaveUnrenderableTextures());
+}
+
+TEST_F(TextureTest, BaseLevelMaxLevel) {
+ manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_2D);
+ Texture* texture = texture_ref_->texture();
+ EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), texture->target());
+ // Set up level 2, 3, 4.
+ manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_2D, 2, GL_RGBA, 8, 8, 1,
+ 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(8, 8));
+ manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_2D, 3, GL_RGBA, 4, 4, 1,
+ 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(4, 4));
+ manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_2D, 4, GL_RGBA, 2, 2, 1,
+ 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(2, 2));
+ SetParameter(
+ texture_ref_.get(), GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR,
+ GL_NO_ERROR);
+ SetParameter(
+ texture_ref_.get(), GL_TEXTURE_MAG_FILTER, GL_LINEAR, GL_NO_ERROR);
+ EXPECT_FALSE(manager_->CanRender(texture_ref_.get()));
+ EXPECT_TRUE(manager_->HaveUnrenderableTextures());
+ SetParameter(
+ texture_ref_.get(), GL_TEXTURE_BASE_LEVEL, 2, GL_NO_ERROR);
+ EXPECT_FALSE(manager_->CanRender(texture_ref_.get()));
+ EXPECT_TRUE(manager_->HaveUnrenderableTextures());
+ SetParameter(
+ texture_ref_.get(), GL_TEXTURE_MAX_LEVEL, 4, GL_NO_ERROR);
+ EXPECT_TRUE(manager_->CanRender(texture_ref_.get()));
+ EXPECT_FALSE(manager_->HaveUnrenderableTextures());
+ SetParameter(
+ texture_ref_.get(), GL_TEXTURE_BASE_LEVEL, 0, GL_NO_ERROR);
+ EXPECT_FALSE(manager_->CanRender(texture_ref_.get()));
+ EXPECT_TRUE(manager_->HaveUnrenderableTextures());
+}
+
TEST_F(TextureMemoryTrackerTest, MarkMipmapsGenerated) {
manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_2D);
EXPECT_MEMORY_ALLOCATION_CHANGE(0, 64);
« no previous file with comments | « gpu/command_buffer/service/texture_manager.cc ('k') | gpu/config/gpu_driver_bug_list_json.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698