Chromium Code Reviews| 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/feature_info.h" | 5 #include "gpu/command_buffer/service/feature_info.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 584 (extensions.Contains("GL_EXT_framebuffer_sRGB") || | 584 (extensions.Contains("GL_EXT_framebuffer_sRGB") || |
| 585 extensions.Contains("GL_ARB_framebuffer_sRGB")))) { | 585 extensions.Contains("GL_ARB_framebuffer_sRGB")))) { |
| 586 feature_flags_.desktop_srgb_support = true; | 586 feature_flags_.desktop_srgb_support = true; |
| 587 } | 587 } |
| 588 // With EXT_sRGB, unsized SRGB_EXT and SRGB_ALPHA_EXT are accepted by the | 588 // With EXT_sRGB, unsized SRGB_EXT and SRGB_ALPHA_EXT are accepted by the |
| 589 // <format> and <internalformat> parameter of TexImage2D. GLES3 adds support | 589 // <format> and <internalformat> parameter of TexImage2D. GLES3 adds support |
| 590 // for SRGB Textures but the accepted internal formats for TexImage2D are only | 590 // for SRGB Textures but the accepted internal formats for TexImage2D are only |
| 591 // sized formats GL_SRGB8 and GL_SRGB8_ALPHA8. Also, SRGB_EXT isn't a valid | 591 // sized formats GL_SRGB8 and GL_SRGB8_ALPHA8. Also, SRGB_EXT isn't a valid |
| 592 // <format> in this case. So, even with GLES3 explicitly check for | 592 // <format> in this case. So, even with GLES3 explicitly check for |
| 593 // GL_EXT_sRGB. | 593 // GL_EXT_sRGB. |
| 594 bool have_srgb = false; | |
| 594 if ((((gl_version_info_->is_es3 || | 595 if ((((gl_version_info_->is_es3 || |
| 595 extensions.Contains("GL_OES_rgb8_rgba8")) && | 596 extensions.Contains("GL_OES_rgb8_rgba8")) && |
| 596 extensions.Contains("GL_EXT_sRGB")) || | 597 extensions.Contains("GL_EXT_sRGB")) || |
| 597 feature_flags_.desktop_srgb_support) && | 598 feature_flags_.desktop_srgb_support) && |
| 598 IsWebGL1OrES2Context()) { | 599 IsWebGL1OrES2Context()) { |
| 600 have_srgb = true; | |
| 599 AddExtensionString("GL_EXT_sRGB"); | 601 AddExtensionString("GL_EXT_sRGB"); |
| 600 validators_.texture_internal_format.AddValue(GL_SRGB_EXT); | 602 validators_.texture_internal_format.AddValue(GL_SRGB_EXT); |
| 601 validators_.texture_internal_format.AddValue(GL_SRGB_ALPHA_EXT); | 603 validators_.texture_internal_format.AddValue(GL_SRGB_ALPHA_EXT); |
| 602 validators_.texture_format.AddValue(GL_SRGB_EXT); | 604 validators_.texture_format.AddValue(GL_SRGB_EXT); |
| 603 validators_.texture_format.AddValue(GL_SRGB_ALPHA_EXT); | 605 validators_.texture_format.AddValue(GL_SRGB_ALPHA_EXT); |
| 604 validators_.render_buffer_format.AddValue(GL_SRGB8_ALPHA8_EXT); | 606 validators_.render_buffer_format.AddValue(GL_SRGB8_ALPHA8_EXT); |
| 605 validators_.framebuffer_parameter.AddValue( | 607 validators_.framebuffer_parameter.AddValue( |
| 606 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT); | 608 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT); |
| 607 validators_.texture_unsized_internal_format.AddValue(GL_SRGB_EXT); | 609 validators_.texture_unsized_internal_format.AddValue(GL_SRGB_EXT); |
| 608 validators_.texture_unsized_internal_format.AddValue(GL_SRGB_ALPHA_EXT); | 610 validators_.texture_unsized_internal_format.AddValue(GL_SRGB_ALPHA_EXT); |
| 609 } | 611 } |
| 610 | 612 |
| 613 if ((have_s3tc || (enable_dxt1 && enable_dxt3 && enable_dxt5)) && have_srgb) { | |
|
jbauman
2016/09/15 00:14:25
Will this actually guarantee that these SRGB forma
Kai Ninomiya
2016/09/15 20:45:35
You're right. It should be enabled if the desktop
| |
| 614 AddExtensionString("GL_NV_sRGB_formats"); | |
| 615 | |
| 616 validators_.compressed_texture_format.AddValue( | |
| 617 GL_COMPRESSED_SRGB_S3TC_DXT1_EXT); | |
| 618 validators_.compressed_texture_format.AddValue( | |
| 619 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT); | |
| 620 validators_.compressed_texture_format.AddValue( | |
| 621 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT); | |
| 622 validators_.compressed_texture_format.AddValue( | |
| 623 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT); | |
| 624 | |
| 625 validators_.texture_internal_format_storage.AddValue( | |
| 626 GL_COMPRESSED_SRGB_S3TC_DXT1_EXT); | |
| 627 validators_.texture_internal_format_storage.AddValue( | |
| 628 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT); | |
| 629 validators_.texture_internal_format_storage.AddValue( | |
| 630 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT); | |
| 631 validators_.texture_internal_format_storage.AddValue( | |
| 632 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT); | |
|
jbauman
2016/09/15 00:14:25
I guess we're not going to bother with GL_SLUMINAN
Ken Russell (switch to Gerrit)
2016/09/15 00:50:35
Agreed.
Should we consider exposing the extension
Kai Ninomiya
2016/09/15 20:45:35
I have tried replacing GL_NV_sRGB_formats with GL_
Kai Ninomiya
2016/09/15 21:54:08
Never mind, it actually works fine.
We decided of
| |
| 633 | |
| 634 //validators_.texture_internal_format.AddValue(_); | |
| 635 //validators_.texture_format.AddValue(_); | |
| 636 //validators_.texture_unsized_internal_format.AddValue(_); | |
|
jbauman
2016/09/15 00:14:25
Unneeded?
Kai Ninomiya
2016/09/15 20:45:35
Done.
| |
| 637 } | |
| 638 | |
| 611 // Note: Only APPLE_texture_format_BGRA8888 extension allows BGRA8_EXT in | 639 // Note: Only APPLE_texture_format_BGRA8888 extension allows BGRA8_EXT in |
| 612 // ES3's glTexStorage2D, whereas EXT_texture_format_BGRA8888 doesn't provide | 640 // ES3's glTexStorage2D, whereas EXT_texture_format_BGRA8888 doesn't provide |
| 613 // that compatibility. So if EXT_texture_format_BGRA8888 (but not | 641 // that compatibility. So if EXT_texture_format_BGRA8888 (but not |
| 614 // APPLE_texture_format_BGRA8888) is present on an underlying ES3 context, we | 642 // APPLE_texture_format_BGRA8888) is present on an underlying ES3 context, we |
| 615 // have to choose which one of BGRA vs texture storage we expose. | 643 // have to choose which one of BGRA vs texture storage we expose. |
| 616 // When creating ES2 contexts, we prefer support BGRA to texture storage, so | 644 // When creating ES2 contexts, we prefer support BGRA to texture storage, so |
| 617 // we disable texture storage if only EXT_texture_format_BGRA8888 is present. | 645 // we disable texture storage if only EXT_texture_format_BGRA8888 is present. |
| 618 // If neither is present, we expose texture storage. | 646 // If neither is present, we expose texture storage. |
| 619 // When creating ES3 contexts, we do need to expose texture storage, so we | 647 // When creating ES3 contexts, we do need to expose texture storage, so we |
| 620 // disable BGRA if we have to. | 648 // disable BGRA if we have to. |
| (...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1497 if (pos == std::string::npos) { | 1525 if (pos == std::string::npos) { |
| 1498 extensions_ += (extensions_.empty() ? "" : " ") + str; | 1526 extensions_ += (extensions_.empty() ? "" : " ") + str; |
| 1499 } | 1527 } |
| 1500 } | 1528 } |
| 1501 | 1529 |
| 1502 FeatureInfo::~FeatureInfo() { | 1530 FeatureInfo::~FeatureInfo() { |
| 1503 } | 1531 } |
| 1504 | 1532 |
| 1505 } // namespace gles2 | 1533 } // namespace gles2 |
| 1506 } // namespace gpu | 1534 } // namespace gpu |
| OLD | NEW |