OLD | NEW |
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 <utility> | 10 #include <utility> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 static const GLint kMaxCubeMapLevels = 4; | 64 static const GLint kMaxCubeMapLevels = 4; |
65 static const GLint kMaxExternalLevels = 1; | 65 static const GLint kMaxExternalLevels = 1; |
66 static const GLint kMax3dLevels = 9; | 66 static const GLint kMax3dLevels = 9; |
67 static const bool kUseDefaultTextures = false; | 67 static const bool kUseDefaultTextures = false; |
68 | 68 |
69 TextureManagerTest() { | 69 TextureManagerTest() { |
70 // Always run with this command line, but the ES3 features are not | 70 // Always run with this command line, but the ES3 features are not |
71 // enabled without FeatureInfo::EnableES3Validators(). | 71 // enabled without FeatureInfo::EnableES3Validators(). |
72 base::CommandLine command_line(0, nullptr); | 72 base::CommandLine command_line(0, nullptr); |
73 command_line.AppendSwitch(switches::kEnableUnsafeES3APIs); | 73 command_line.AppendSwitch(switches::kEnableUnsafeES3APIs); |
74 feature_info_ = new FeatureInfo(command_line); | 74 GpuDriverBugWorkarounds::Initialize(&command_line, |
| 75 gpu_driver_bug_workarounds_); |
| 76 feature_info_ = new FeatureInfo(command_line, gpu_driver_bug_workarounds_); |
75 } | 77 } |
76 | 78 |
77 ~TextureManagerTest() override {} | 79 ~TextureManagerTest() override {} |
78 | 80 |
79 protected: | 81 protected: |
80 void SetUp() override { | 82 void SetUp() override { |
81 GpuServiceTest::SetUp(); | 83 GpuServiceTest::SetUp(); |
82 manager_.reset(new TextureManager(NULL, | 84 manager_.reset(new TextureManager(NULL, |
83 feature_info_.get(), | 85 feature_info_.get(), |
84 kMaxTextureSize, | 86 kMaxTextureSize, |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 GL_TEXTURE_CUBE_MAP, level, | 484 GL_TEXTURE_CUBE_MAP, level, |
483 (kMaxCubeMapTextureSize >> level) * 2, | 485 (kMaxCubeMapTextureSize >> level) * 2, |
484 (kMaxCubeMapTextureSize >> level) * 2, | 486 (kMaxCubeMapTextureSize >> level) * 2, |
485 1)); | 487 1)); |
486 } | 488 } |
487 } | 489 } |
488 | 490 |
489 TEST_F(TextureManagerTest, ValidForTargetNPOT) { | 491 TEST_F(TextureManagerTest, ValidForTargetNPOT) { |
490 TestHelper::SetupFeatureInfoInitExpectations( | 492 TestHelper::SetupFeatureInfoInitExpectations( |
491 gl_.get(), "GL_OES_texture_npot"); | 493 gl_.get(), "GL_OES_texture_npot"); |
492 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); | 494 scoped_refptr<FeatureInfo> feature_info( |
| 495 new FeatureInfo(gpu_driver_bug_workarounds_)); |
493 feature_info->InitializeForTesting(); | 496 feature_info->InitializeForTesting(); |
494 TextureManager manager(NULL, | 497 TextureManager manager(NULL, |
495 feature_info.get(), | 498 feature_info.get(), |
496 kMaxTextureSize, | 499 kMaxTextureSize, |
497 kMaxCubeMapTextureSize, | 500 kMaxCubeMapTextureSize, |
498 kMaxRectangleTextureSize, | 501 kMaxRectangleTextureSize, |
499 kMax3DTextureSize, | 502 kMax3DTextureSize, |
500 kUseDefaultTextures); | 503 kUseDefaultTextures); |
501 // Check NPOT width on level 0 | 504 // Check NPOT width on level 0 |
502 EXPECT_TRUE(manager.ValidForTarget(GL_TEXTURE_2D, 0, 5, 2, 1)); | 505 EXPECT_TRUE(manager.ValidForTarget(GL_TEXTURE_2D, 0, 5, 2, 1)); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 static const GLint kMaxTextureSize = 32; | 703 static const GLint kMaxTextureSize = 32; |
701 static const GLint kMaxCubeMapTextureSize = 8; | 704 static const GLint kMaxCubeMapTextureSize = 8; |
702 static const GLint kMaxRectangleTextureSize = 32; | 705 static const GLint kMaxRectangleTextureSize = 32; |
703 static const GLint kMax3DTextureSize = 256; | 706 static const GLint kMax3DTextureSize = 256; |
704 static const GLint kMax2dLevels = 6; | 707 static const GLint kMax2dLevels = 6; |
705 static const GLint kMaxCubeMapLevels = 4; | 708 static const GLint kMaxCubeMapLevels = 4; |
706 static const GLuint kClient1Id = 1; | 709 static const GLuint kClient1Id = 1; |
707 static const GLuint kService1Id = 11; | 710 static const GLuint kService1Id = 11; |
708 static const bool kUseDefaultTextures = false; | 711 static const bool kUseDefaultTextures = false; |
709 | 712 |
710 TextureTestBase() | 713 TextureTestBase() { |
711 : feature_info_(new FeatureInfo()) { | 714 GpuDriverBugWorkarounds::Initialize(gpu_driver_bug_workarounds_); |
| 715 feature_info_ = new FeatureInfo(gpu_driver_bug_workarounds_); |
712 } | 716 } |
713 ~TextureTestBase() override { texture_ref_ = NULL; } | 717 ~TextureTestBase() override { texture_ref_ = NULL; } |
714 | 718 |
715 protected: | 719 protected: |
716 void SetUpBase(MemoryTracker* memory_tracker, const std::string& extensions) { | 720 void SetUpBase(MemoryTracker* memory_tracker, const std::string& extensions) { |
717 GpuServiceTest::SetUp(); | 721 GpuServiceTest::SetUp(); |
718 if (!extensions.empty()) { | 722 if (!extensions.empty()) { |
719 TestHelper::SetupFeatureInfoInitExpectations(gl_.get(), | 723 TestHelper::SetupFeatureInfoInitExpectations(gl_.get(), |
720 extensions.c_str()); | 724 extensions.c_str()); |
721 feature_info_->InitializeForTesting(); | 725 feature_info_->InitializeForTesting(); |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 1, | 1021 manager_->SetLevelInfo(texture_ref_.get(), GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 1, |
1018 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(4, 4)); | 1022 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect(4, 4)); |
1019 EXPECT_FALSE(TextureTestHelper::IsNPOT(texture)); | 1023 EXPECT_FALSE(TextureTestHelper::IsNPOT(texture)); |
1020 EXPECT_FALSE(TextureTestHelper::IsTextureComplete(texture)); | 1024 EXPECT_FALSE(TextureTestHelper::IsTextureComplete(texture)); |
1021 EXPECT_TRUE(manager_->CanGenerateMipmaps(texture_ref_.get())); | 1025 EXPECT_TRUE(manager_->CanGenerateMipmaps(texture_ref_.get())); |
1022 } | 1026 } |
1023 | 1027 |
1024 TEST_F(TextureTest, NPOT2DNPOTOK) { | 1028 TEST_F(TextureTest, NPOT2DNPOTOK) { |
1025 TestHelper::SetupFeatureInfoInitExpectations( | 1029 TestHelper::SetupFeatureInfoInitExpectations( |
1026 gl_.get(), "GL_OES_texture_npot"); | 1030 gl_.get(), "GL_OES_texture_npot"); |
1027 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); | 1031 scoped_refptr<FeatureInfo> feature_info( |
| 1032 new FeatureInfo(gpu_driver_bug_workarounds_)); |
1028 feature_info->InitializeForTesting(); | 1033 feature_info->InitializeForTesting(); |
1029 TextureManager manager(NULL, | 1034 TextureManager manager(NULL, |
1030 feature_info.get(), | 1035 feature_info.get(), |
1031 kMaxTextureSize, | 1036 kMaxTextureSize, |
1032 kMaxCubeMapTextureSize, | 1037 kMaxCubeMapTextureSize, |
1033 kMaxRectangleTextureSize, | 1038 kMaxRectangleTextureSize, |
1034 kMax3DTextureSize, | 1039 kMax3DTextureSize, |
1035 kUseDefaultTextures); | 1040 kUseDefaultTextures); |
1036 manager.CreateTexture(kClient1Id, kService1Id); | 1041 manager.CreateTexture(kClient1Id, kService1Id); |
1037 TextureRef* texture_ref = manager.GetTexture(kClient1Id); | 1042 TextureRef* texture_ref = manager.GetTexture(kClient1Id); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1318 EXPECT_TRUE(texture->ValidForTexture(GL_TEXTURE_2D, 1, 0, 0, 0, 4, 5, 6)); | 1323 EXPECT_TRUE(texture->ValidForTexture(GL_TEXTURE_2D, 1, 0, 0, 0, 4, 5, 6)); |
1319 // Check valid particial size. | 1324 // Check valid particial size. |
1320 EXPECT_TRUE(texture->ValidForTexture(GL_TEXTURE_2D, 1, 1, 1, 1, 2, 3, 4)); | 1325 EXPECT_TRUE(texture->ValidForTexture(GL_TEXTURE_2D, 1, 1, 1, 1, 2, 3, 4)); |
1321 manager_->RemoveTexture(kClient1Id); | 1326 manager_->RemoveTexture(kClient1Id); |
1322 EXPECT_TRUE(texture->ValidForTexture(GL_TEXTURE_2D, 1, 0, 0, 0, 4, 5, 6)); | 1327 EXPECT_TRUE(texture->ValidForTexture(GL_TEXTURE_2D, 1, 0, 0, 0, 4, 5, 6)); |
1323 } | 1328 } |
1324 | 1329 |
1325 TEST_F(TextureTest, FloatNotLinear) { | 1330 TEST_F(TextureTest, FloatNotLinear) { |
1326 TestHelper::SetupFeatureInfoInitExpectations( | 1331 TestHelper::SetupFeatureInfoInitExpectations( |
1327 gl_.get(), "GL_OES_texture_float"); | 1332 gl_.get(), "GL_OES_texture_float"); |
1328 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); | 1333 scoped_refptr<FeatureInfo> feature_info( |
| 1334 new FeatureInfo(gpu_driver_bug_workarounds_)); |
1329 feature_info->InitializeForTesting(); | 1335 feature_info->InitializeForTesting(); |
1330 TextureManager manager(NULL, | 1336 TextureManager manager(NULL, |
1331 feature_info.get(), | 1337 feature_info.get(), |
1332 kMaxTextureSize, | 1338 kMaxTextureSize, |
1333 kMaxCubeMapTextureSize, | 1339 kMaxCubeMapTextureSize, |
1334 kMaxRectangleTextureSize, | 1340 kMaxRectangleTextureSize, |
1335 kMax3DTextureSize, | 1341 kMax3DTextureSize, |
1336 kUseDefaultTextures); | 1342 kUseDefaultTextures); |
1337 manager.CreateTexture(kClient1Id, kService1Id); | 1343 manager.CreateTexture(kClient1Id, kService1Id); |
1338 TextureRef* texture_ref = manager.GetTexture(kClient1Id); | 1344 TextureRef* texture_ref = manager.GetTexture(kClient1Id); |
(...skipping 11 matching lines...) Expand all Loading... |
1350 TestHelper::SetTexParameteriWithExpectations( | 1356 TestHelper::SetTexParameteriWithExpectations( |
1351 gl_.get(), error_state_.get(), &manager, texture_ref, | 1357 gl_.get(), error_state_.get(), &manager, texture_ref, |
1352 GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST, GL_NO_ERROR); | 1358 GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST, GL_NO_ERROR); |
1353 EXPECT_TRUE(manager.CanRender(texture_ref)); | 1359 EXPECT_TRUE(manager.CanRender(texture_ref)); |
1354 manager.Destroy(false); | 1360 manager.Destroy(false); |
1355 } | 1361 } |
1356 | 1362 |
1357 TEST_F(TextureTest, FloatLinear) { | 1363 TEST_F(TextureTest, FloatLinear) { |
1358 TestHelper::SetupFeatureInfoInitExpectations( | 1364 TestHelper::SetupFeatureInfoInitExpectations( |
1359 gl_.get(), "GL_OES_texture_float GL_OES_texture_float_linear"); | 1365 gl_.get(), "GL_OES_texture_float GL_OES_texture_float_linear"); |
1360 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); | 1366 scoped_refptr<FeatureInfo> feature_info( |
| 1367 new FeatureInfo(gpu_driver_bug_workarounds_)); |
1361 feature_info->InitializeForTesting(); | 1368 feature_info->InitializeForTesting(); |
1362 TextureManager manager(NULL, | 1369 TextureManager manager(NULL, |
1363 feature_info.get(), | 1370 feature_info.get(), |
1364 kMaxTextureSize, | 1371 kMaxTextureSize, |
1365 kMaxCubeMapTextureSize, | 1372 kMaxCubeMapTextureSize, |
1366 kMaxRectangleTextureSize, | 1373 kMaxRectangleTextureSize, |
1367 kMax3DTextureSize, | 1374 kMax3DTextureSize, |
1368 kUseDefaultTextures); | 1375 kUseDefaultTextures); |
1369 manager.CreateTexture(kClient1Id, kService1Id); | 1376 manager.CreateTexture(kClient1Id, kService1Id); |
1370 TextureRef* texture_ref = manager.GetTexture(kClient1Id); | 1377 TextureRef* texture_ref = manager.GetTexture(kClient1Id); |
1371 ASSERT_TRUE(texture_ref != NULL); | 1378 ASSERT_TRUE(texture_ref != NULL); |
1372 manager.SetTarget(texture_ref, GL_TEXTURE_2D); | 1379 manager.SetTarget(texture_ref, GL_TEXTURE_2D); |
1373 Texture* texture = texture_ref->texture(); | 1380 Texture* texture = texture_ref->texture(); |
1374 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), texture->target()); | 1381 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), texture->target()); |
1375 manager.SetLevelInfo(texture_ref, GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 1, 0, | 1382 manager.SetLevelInfo(texture_ref, GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 1, 0, |
1376 GL_RGBA, GL_FLOAT, gfx::Rect(1, 1)); | 1383 GL_RGBA, GL_FLOAT, gfx::Rect(1, 1)); |
1377 EXPECT_TRUE(manager.CanRender(texture_ref)); | 1384 EXPECT_TRUE(manager.CanRender(texture_ref)); |
1378 manager.Destroy(false); | 1385 manager.Destroy(false); |
1379 } | 1386 } |
1380 | 1387 |
1381 TEST_F(TextureTest, HalfFloatNotLinear) { | 1388 TEST_F(TextureTest, HalfFloatNotLinear) { |
1382 TestHelper::SetupFeatureInfoInitExpectations( | 1389 TestHelper::SetupFeatureInfoInitExpectations( |
1383 gl_.get(), "GL_OES_texture_half_float"); | 1390 gl_.get(), "GL_OES_texture_half_float"); |
1384 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); | 1391 scoped_refptr<FeatureInfo> feature_info( |
| 1392 new FeatureInfo(gpu_driver_bug_workarounds_)); |
1385 feature_info->InitializeForTesting(); | 1393 feature_info->InitializeForTesting(); |
1386 TextureManager manager(NULL, | 1394 TextureManager manager(NULL, |
1387 feature_info.get(), | 1395 feature_info.get(), |
1388 kMaxTextureSize, | 1396 kMaxTextureSize, |
1389 kMaxCubeMapTextureSize, | 1397 kMaxCubeMapTextureSize, |
1390 kMaxRectangleTextureSize, | 1398 kMaxRectangleTextureSize, |
1391 kMax3DTextureSize, | 1399 kMax3DTextureSize, |
1392 kUseDefaultTextures); | 1400 kUseDefaultTextures); |
1393 manager.CreateTexture(kClient1Id, kService1Id); | 1401 manager.CreateTexture(kClient1Id, kService1Id); |
1394 TextureRef* texture_ref = manager.GetTexture(kClient1Id); | 1402 TextureRef* texture_ref = manager.GetTexture(kClient1Id); |
(...skipping 11 matching lines...) Expand all Loading... |
1406 TestHelper::SetTexParameteriWithExpectations( | 1414 TestHelper::SetTexParameteriWithExpectations( |
1407 gl_.get(), error_state_.get(), &manager, texture_ref, | 1415 gl_.get(), error_state_.get(), &manager, texture_ref, |
1408 GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST, GL_NO_ERROR); | 1416 GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST, GL_NO_ERROR); |
1409 EXPECT_TRUE(manager.CanRender(texture_ref)); | 1417 EXPECT_TRUE(manager.CanRender(texture_ref)); |
1410 manager.Destroy(false); | 1418 manager.Destroy(false); |
1411 } | 1419 } |
1412 | 1420 |
1413 TEST_F(TextureTest, HalfFloatLinear) { | 1421 TEST_F(TextureTest, HalfFloatLinear) { |
1414 TestHelper::SetupFeatureInfoInitExpectations( | 1422 TestHelper::SetupFeatureInfoInitExpectations( |
1415 gl_.get(), "GL_OES_texture_half_float GL_OES_texture_half_float_linear"); | 1423 gl_.get(), "GL_OES_texture_half_float GL_OES_texture_half_float_linear"); |
1416 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); | 1424 scoped_refptr<FeatureInfo> feature_info( |
1417 feature_info->InitializeForTesting(); | 1425 new FeatureInfo(gpu_driver_bug_workarounds_)); |
| 1426 feature_info->InitializeForTesting(); // maybe move that to InitFortestng so |
| 1427 // allow empty |
1418 TextureManager manager(NULL, | 1428 TextureManager manager(NULL, |
1419 feature_info.get(), | 1429 feature_info.get(), |
1420 kMaxTextureSize, | 1430 kMaxTextureSize, |
1421 kMaxCubeMapTextureSize, | 1431 kMaxCubeMapTextureSize, |
1422 kMaxRectangleTextureSize, | 1432 kMaxRectangleTextureSize, |
1423 kMax3DTextureSize, | 1433 kMax3DTextureSize, |
1424 kUseDefaultTextures); | 1434 kUseDefaultTextures); |
1425 manager.CreateTexture(kClient1Id, kService1Id); | 1435 manager.CreateTexture(kClient1Id, kService1Id); |
1426 TextureRef* texture_ref = manager.GetTexture(kClient1Id); | 1436 TextureRef* texture_ref = manager.GetTexture(kClient1Id); |
1427 ASSERT_TRUE(texture_ref != NULL); | 1437 ASSERT_TRUE(texture_ref != NULL); |
1428 manager.SetTarget(texture_ref, GL_TEXTURE_2D); | 1438 manager.SetTarget(texture_ref, GL_TEXTURE_2D); |
1429 Texture* texture = texture_ref->texture(); | 1439 Texture* texture = texture_ref->texture(); |
1430 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), texture->target()); | 1440 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), texture->target()); |
1431 manager.SetLevelInfo(texture_ref, GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 1, 0, | 1441 manager.SetLevelInfo(texture_ref, GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 1, 0, |
1432 GL_RGBA, GL_HALF_FLOAT_OES, gfx::Rect(1, 1)); | 1442 GL_RGBA, GL_HALF_FLOAT_OES, gfx::Rect(1, 1)); |
1433 EXPECT_TRUE(manager.CanRender(texture_ref)); | 1443 EXPECT_TRUE(manager.CanRender(texture_ref)); |
1434 manager.Destroy(false); | 1444 manager.Destroy(false); |
1435 } | 1445 } |
1436 | 1446 |
1437 TEST_F(TextureTest, EGLImageExternal) { | 1447 TEST_F(TextureTest, EGLImageExternal) { |
1438 TestHelper::SetupFeatureInfoInitExpectations( | 1448 TestHelper::SetupFeatureInfoInitExpectations( |
1439 gl_.get(), "GL_OES_EGL_image_external"); | 1449 gl_.get(), "GL_OES_EGL_image_external"); |
1440 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); | 1450 scoped_refptr<FeatureInfo> feature_info( |
| 1451 new FeatureInfo(gpu_driver_bug_workarounds_)); |
1441 feature_info->InitializeForTesting(); | 1452 feature_info->InitializeForTesting(); |
1442 TextureManager manager(NULL, | 1453 TextureManager manager(NULL, |
1443 feature_info.get(), | 1454 feature_info.get(), |
1444 kMaxTextureSize, | 1455 kMaxTextureSize, |
1445 kMaxCubeMapTextureSize, | 1456 kMaxCubeMapTextureSize, |
1446 kMaxRectangleTextureSize, | 1457 kMaxRectangleTextureSize, |
1447 kMax3DTextureSize, | 1458 kMax3DTextureSize, |
1448 kUseDefaultTextures); | 1459 kUseDefaultTextures); |
1449 manager.CreateTexture(kClient1Id, kService1Id); | 1460 manager.CreateTexture(kClient1Id, kService1Id); |
1450 TextureRef* texture_ref = manager.GetTexture(kClient1Id); | 1461 TextureRef* texture_ref = manager.GetTexture(kClient1Id); |
1451 ASSERT_TRUE(texture_ref != NULL); | 1462 ASSERT_TRUE(texture_ref != NULL); |
1452 manager.SetTarget(texture_ref, GL_TEXTURE_EXTERNAL_OES); | 1463 manager.SetTarget(texture_ref, GL_TEXTURE_EXTERNAL_OES); |
1453 Texture* texture = texture_ref->texture(); | 1464 Texture* texture = texture_ref->texture(); |
1454 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), texture->target()); | 1465 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), texture->target()); |
1455 EXPECT_FALSE(manager.CanGenerateMipmaps(texture_ref)); | 1466 EXPECT_FALSE(manager.CanGenerateMipmaps(texture_ref)); |
1456 manager.Destroy(false); | 1467 manager.Destroy(false); |
1457 } | 1468 } |
1458 | 1469 |
1459 TEST_F(TextureTest, DepthTexture) { | 1470 TEST_F(TextureTest, DepthTexture) { |
1460 TestHelper::SetupFeatureInfoInitExpectations( | 1471 TestHelper::SetupFeatureInfoInitExpectations( |
1461 gl_.get(), "GL_ANGLE_depth_texture"); | 1472 gl_.get(), "GL_ANGLE_depth_texture"); |
1462 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); | 1473 scoped_refptr<FeatureInfo> feature_info( |
| 1474 new FeatureInfo(gpu_driver_bug_workarounds_)); |
1463 feature_info->InitializeForTesting(); | 1475 feature_info->InitializeForTesting(); |
1464 TextureManager manager(NULL, | 1476 TextureManager manager(NULL, |
1465 feature_info.get(), | 1477 feature_info.get(), |
1466 kMaxTextureSize, | 1478 kMaxTextureSize, |
1467 kMaxCubeMapTextureSize, | 1479 kMaxCubeMapTextureSize, |
1468 kMaxRectangleTextureSize, | 1480 kMaxRectangleTextureSize, |
1469 kMax3DTextureSize, | 1481 kMax3DTextureSize, |
1470 kUseDefaultTextures); | 1482 kUseDefaultTextures); |
1471 manager.CreateTexture(kClient1Id, kService1Id); | 1483 manager.CreateTexture(kClient1Id, kService1Id); |
1472 TextureRef* texture_ref = manager.GetTexture(kClient1Id); | 1484 TextureRef* texture_ref = manager.GetTexture(kClient1Id); |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2144 ~CountingMemoryTracker() override {} | 2156 ~CountingMemoryTracker() override {} |
2145 | 2157 |
2146 size_t current_size_; | 2158 size_t current_size_; |
2147 DISALLOW_COPY_AND_ASSIGN(CountingMemoryTracker); | 2159 DISALLOW_COPY_AND_ASSIGN(CountingMemoryTracker); |
2148 }; | 2160 }; |
2149 | 2161 |
2150 class SharedTextureTest : public GpuServiceTest { | 2162 class SharedTextureTest : public GpuServiceTest { |
2151 public: | 2163 public: |
2152 static const bool kUseDefaultTextures = false; | 2164 static const bool kUseDefaultTextures = false; |
2153 | 2165 |
2154 SharedTextureTest() : feature_info_(new FeatureInfo()) {} | 2166 SharedTextureTest() { |
| 2167 GpuDriverBugWorkarounds::Initialize(gpu_driver_bug_workarounds_); |
| 2168 feature_info_ = new FeatureInfo(gpu_driver_bug_workarounds_); |
| 2169 } |
2155 | 2170 |
2156 ~SharedTextureTest() override {} | 2171 ~SharedTextureTest() override {} |
2157 | 2172 |
2158 void SetUp() override { | 2173 void SetUp() override { |
2159 GpuServiceTest::SetUp(); | 2174 GpuServiceTest::SetUp(); |
2160 memory_tracker1_ = new CountingMemoryTracker; | 2175 memory_tracker1_ = new CountingMemoryTracker; |
2161 texture_manager1_.reset( | 2176 texture_manager1_.reset( |
2162 new TextureManager(memory_tracker1_.get(), | 2177 new TextureManager(memory_tracker1_.get(), |
2163 feature_info_.get(), | 2178 feature_info_.get(), |
2164 TextureManagerTest::kMaxTextureSize, | 2179 TextureManagerTest::kMaxTextureSize, |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2672 ExpectValid( | 2687 ExpectValid( |
2673 true, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8); | 2688 true, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8); |
2674 ExpectValid(true, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, | 2689 ExpectValid(true, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, |
2675 GL_DEPTH32F_STENCIL8); | 2690 GL_DEPTH32F_STENCIL8); |
2676 | 2691 |
2677 ExpectInvalid(true, GL_RGB_INTEGER, GL_INT, GL_RGBA8); | 2692 ExpectInvalid(true, GL_RGB_INTEGER, GL_INT, GL_RGBA8); |
2678 } | 2693 } |
2679 | 2694 |
2680 } // namespace gles2 | 2695 } // namespace gles2 |
2681 } // namespace gpu | 2696 } // namespace gpu |
OLD | NEW |