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 #ifndef GL_GLEXT_PROTOTYPES | 5 #ifndef GL_GLEXT_PROTOTYPES |
6 #define GL_GLEXT_PROTOTYPES | 6 #define GL_GLEXT_PROTOTYPES |
7 #endif | 7 #endif |
8 | 8 |
9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
10 #include <GLES2/gl2ext.h> | 10 #include <GLES2/gl2ext.h> |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 width_ = 8; | 502 width_ = 8; |
503 height_ = 8; | 503 height_ = 8; |
504 } | 504 } |
505 | 505 |
506 // If a driver isn't capable of supporting ES3 context, creating | 506 // If a driver isn't capable of supporting ES3 context, creating |
507 // ContextGroup will fail. Just skip the test. | 507 // ContextGroup will fail. Just skip the test. |
508 bool ShouldSkipTest() const { | 508 bool ShouldSkipTest() const { |
509 return (!gl_.decoder() || !gl_.decoder()->GetContextGroup()); | 509 return (!gl_.decoder() || !gl_.decoder()->GetContextGroup()); |
510 } | 510 } |
511 | 511 |
512 // RGB9_E5 isn't accepted by glCopyTexImage2D if underlying context is ES. | |
513 // TODO(qiankun.miao@intel.com): we should support RGB9_E5 in ES context. | |
514 // Maybe, we can add a readback path for RGB9_E5 format in ES context. | |
515 bool ShouldSkipRGB9_E5() const { | |
516 DCHECK(!ShouldSkipTest()); | |
517 const gl::GLVersionInfo& gl_version_info = | |
518 gl_.decoder()->GetFeatureInfo()->gl_version_info(); | |
519 return gl_version_info.is_es; | |
520 } | |
521 | |
522 // If EXT_color_buffer_float isn't available, float format isn't supported. | 512 // If EXT_color_buffer_float isn't available, float format isn't supported. |
523 bool ShouldSkipFloatFormat() const { | 513 bool ShouldSkipFloatFormat() const { |
524 DCHECK(!ShouldSkipTest()); | 514 DCHECK(!ShouldSkipTest()); |
525 return !gl_.decoder()->GetFeatureInfo()->ext_color_buffer_float_available(); | 515 return !gl_.decoder()->GetFeatureInfo()->ext_color_buffer_float_available(); |
526 } | 516 } |
527 | 517 |
528 bool ShouldSkipBGRA() const { | 518 bool ShouldSkipBGRA() const { |
529 DCHECK(!ShouldSkipTest()); | 519 DCHECK(!ShouldSkipTest()); |
530 return !gl_.decoder() | 520 return !gl_.decoder() |
531 ->GetFeatureInfo() | 521 ->GetFeatureInfo() |
532 ->feature_flags() | 522 ->feature_flags() |
533 .ext_texture_format_bgra8888; | 523 .ext_texture_format_bgra8888; |
534 } | 524 } |
535 | 525 |
536 bool ShouldSkipSRGBEXT() const { | 526 bool ShouldSkipSRGBEXT() const { |
537 DCHECK(!ShouldSkipTest()); | 527 DCHECK(!ShouldSkipTest()); |
538 return !gl_.decoder()->GetFeatureInfo()->feature_flags().ext_srgb; | 528 return !gl_.decoder()->GetFeatureInfo()->feature_flags().ext_srgb; |
539 } | 529 } |
540 | |
541 // RGB5_A1 is not color-renderable on NVIDIA Mac, see crbug.com/676209. | |
542 bool ShouldSkipRGB5_A1() const { | |
543 DCHECK(!ShouldSkipTest()); | |
544 #if defined(OS_MACOSX) | |
545 return true; | |
546 #else | |
547 return false; | |
548 #endif | |
549 } | |
550 }; | 530 }; |
551 | 531 |
552 INSTANTIATE_TEST_CASE_P(CopyType, | 532 INSTANTIATE_TEST_CASE_P(CopyType, |
553 GLCopyTextureCHROMIUMTest, | 533 GLCopyTextureCHROMIUMTest, |
554 ::testing::ValuesIn(kCopyTypes)); | 534 ::testing::ValuesIn(kCopyTypes)); |
555 | 535 |
556 INSTANTIATE_TEST_CASE_P(CopyType, | 536 INSTANTIATE_TEST_CASE_P(CopyType, |
557 GLCopyTextureCHROMIUMES3Test, | 537 GLCopyTextureCHROMIUMES3Test, |
558 ::testing::ValuesIn(kCopyTypes)); | 538 ::testing::ValuesIn(kCopyTypes)); |
559 | 539 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_BYTE}, | 629 {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_BYTE}, |
650 {GL_RGBA4, GL_RGBA, GL_UNSIGNED_BYTE}, | 630 {GL_RGBA4, GL_RGBA, GL_UNSIGNED_BYTE}, |
651 {GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT}, | 631 {GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT}, |
652 {GL_RGBA16F, GL_RGBA, GL_FLOAT}, | 632 {GL_RGBA16F, GL_RGBA, GL_FLOAT}, |
653 {GL_RGBA32F, GL_RGBA, GL_FLOAT}, | 633 {GL_RGBA32F, GL_RGBA, GL_FLOAT}, |
654 {GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE}, | 634 {GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE}, |
655 }; | 635 }; |
656 | 636 |
657 for (auto src_format_type : src_format_types) { | 637 for (auto src_format_type : src_format_types) { |
658 for (auto dest_format_type : dest_format_types) { | 638 for (auto dest_format_type : dest_format_types) { |
659 if (dest_format_type.internal_format == GL_RGB9_E5 && ShouldSkipRGB9_E5()) | |
660 continue; | |
661 if ((src_format_type.internal_format == GL_BGRA_EXT || | 639 if ((src_format_type.internal_format == GL_BGRA_EXT || |
662 src_format_type.internal_format == GL_BGRA8_EXT || | 640 src_format_type.internal_format == GL_BGRA8_EXT || |
663 dest_format_type.internal_format == GL_BGRA_EXT || | 641 dest_format_type.internal_format == GL_BGRA_EXT || |
664 dest_format_type.internal_format == GL_BGRA8_EXT) && | 642 dest_format_type.internal_format == GL_BGRA8_EXT) && |
665 ShouldSkipBGRA()) { | 643 ShouldSkipBGRA()) { |
666 continue; | 644 continue; |
667 } | 645 } |
668 if (gles2::GLES2Util::IsFloatFormat(dest_format_type.internal_format) && | 646 if (gles2::GLES2Util::IsFloatFormat(dest_format_type.internal_format) && |
669 ShouldSkipFloatFormat()) | 647 ShouldSkipFloatFormat()) |
670 continue; | 648 continue; |
671 if ((dest_format_type.internal_format == GL_SRGB_EXT || | 649 if ((dest_format_type.internal_format == GL_SRGB_EXT || |
672 dest_format_type.internal_format == GL_SRGB_ALPHA_EXT) && | 650 dest_format_type.internal_format == GL_SRGB_ALPHA_EXT) && |
673 ShouldSkipSRGBEXT()) | 651 ShouldSkipSRGBEXT()) |
674 continue; | 652 continue; |
675 if (dest_format_type.internal_format == GL_RGB5_A1 && ShouldSkipRGB5_A1()) | |
676 continue; | |
677 | 653 |
678 RunCopyTexture(GL_TEXTURE_2D, copy_type, src_format_type, 0, | 654 RunCopyTexture(GL_TEXTURE_2D, copy_type, src_format_type, 0, |
679 dest_format_type, 0, true); | 655 dest_format_type, 0, true); |
680 } | 656 } |
681 } | 657 } |
682 } | 658 } |
683 | 659 |
684 TEST_P(GLCopyTextureCHROMIUMTest, ImmutableTexture) { | 660 TEST_P(GLCopyTextureCHROMIUMTest, ImmutableTexture) { |
685 if (!GLTestHelper::HasExtension("GL_EXT_texture_storage")) { | 661 if (!GLTestHelper::HasExtension("GL_EXT_texture_storage")) { |
686 LOG(INFO) << "GL_EXT_texture_storage not supported. Skipping test..."; | 662 LOG(INFO) << "GL_EXT_texture_storage not supported. Skipping test..."; |
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 } | 1612 } |
1637 } | 1613 } |
1638 | 1614 |
1639 glDeleteTextures(2, textures_); | 1615 glDeleteTextures(2, textures_); |
1640 glDeleteFramebuffers(1, &framebuffer_id_); | 1616 glDeleteFramebuffers(1, &framebuffer_id_); |
1641 } | 1617 } |
1642 } | 1618 } |
1643 } | 1619 } |
1644 | 1620 |
1645 } // namespace gpu | 1621 } // namespace gpu |
OLD | NEW |