| 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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 feature_flags_.native_vertex_array_object = false; | 565 feature_flags_.native_vertex_array_object = false; |
| 566 } | 566 } |
| 567 | 567 |
| 568 if (gl_version_info_->is_es3 || | 568 if (gl_version_info_->is_es3 || |
| 569 extensions.Contains("GL_OES_element_index_uint") || | 569 extensions.Contains("GL_OES_element_index_uint") || |
| 570 gl::HasDesktopGLFeatures()) { | 570 gl::HasDesktopGLFeatures()) { |
| 571 AddExtensionString("GL_OES_element_index_uint"); | 571 AddExtensionString("GL_OES_element_index_uint"); |
| 572 validators_.index_type.AddValue(GL_UNSIGNED_INT); | 572 validators_.index_type.AddValue(GL_UNSIGNED_INT); |
| 573 } | 573 } |
| 574 | 574 |
| 575 bool has_srgb_framebuffer_support = false; | |
| 576 if (gl_version_info_->IsAtLeastGL(3, 2) || | 575 if (gl_version_info_->IsAtLeastGL(3, 2) || |
| 577 (gl_version_info_->IsAtLeastGL(2, 0) && | 576 (gl_version_info_->IsAtLeastGL(2, 0) && |
| 578 (extensions.Contains("GL_EXT_framebuffer_sRGB") || | 577 (extensions.Contains("GL_EXT_framebuffer_sRGB") || |
| 579 extensions.Contains("GL_ARB_framebuffer_sRGB")))) { | 578 extensions.Contains("GL_ARB_framebuffer_sRGB")))) { |
| 580 feature_flags_.desktop_srgb_support = true; | 579 feature_flags_.desktop_srgb_support = true; |
| 581 has_srgb_framebuffer_support = true; | |
| 582 } | 580 } |
| 583 // With EXT_sRGB, unsized SRGB_EXT and SRGB_ALPHA_EXT are accepted by the | 581 // With EXT_sRGB, unsized SRGB_EXT and SRGB_ALPHA_EXT are accepted by the |
| 584 // <format> and <internalformat> parameter of TexImage2D. GLES3 adds support | 582 // <format> and <internalformat> parameter of TexImage2D. GLES3 adds support |
| 585 // for SRGB Textures but the accepted internal formats for TexImage2D are only | 583 // for SRGB Textures but the accepted internal formats for TexImage2D are only |
| 586 // sized formats GL_SRGB8 and GL_SRGB8_ALPHA8. Also, SRGB_EXT isn't a valid | 584 // sized formats GL_SRGB8 and GL_SRGB8_ALPHA8. Also, SRGB_EXT isn't a valid |
| 587 // <format> in this case. So, even with GLES3 explicitly check for | 585 // <format> in this case. So, even with GLES3 explicitly check for |
| 588 // GL_EXT_sRGB. | 586 // GL_EXT_sRGB. |
| 589 if ((((gl_version_info_->is_es3 || | 587 if ((((gl_version_info_->is_es3 || |
| 590 extensions.Contains("GL_OES_rgb8_rgba8")) && | 588 extensions.Contains("GL_OES_rgb8_rgba8")) && |
| 591 extensions.Contains("GL_EXT_sRGB")) || | 589 extensions.Contains("GL_EXT_sRGB")) || |
| 592 feature_flags_.desktop_srgb_support) && | 590 feature_flags_.desktop_srgb_support) && |
| 593 IsWebGL1OrES2Context()) { | 591 IsWebGL1OrES2Context()) { |
| 594 AddExtensionString("GL_EXT_sRGB"); | 592 AddExtensionString("GL_EXT_sRGB"); |
| 595 validators_.texture_internal_format.AddValue(GL_SRGB_EXT); | 593 validators_.texture_internal_format.AddValue(GL_SRGB_EXT); |
| 596 validators_.texture_internal_format.AddValue(GL_SRGB_ALPHA_EXT); | 594 validators_.texture_internal_format.AddValue(GL_SRGB_ALPHA_EXT); |
| 597 validators_.texture_format.AddValue(GL_SRGB_EXT); | 595 validators_.texture_format.AddValue(GL_SRGB_EXT); |
| 598 validators_.texture_format.AddValue(GL_SRGB_ALPHA_EXT); | 596 validators_.texture_format.AddValue(GL_SRGB_ALPHA_EXT); |
| 599 validators_.render_buffer_format.AddValue(GL_SRGB8_ALPHA8_EXT); | 597 validators_.render_buffer_format.AddValue(GL_SRGB8_ALPHA8_EXT); |
| 600 validators_.framebuffer_parameter.AddValue( | 598 validators_.framebuffer_parameter.AddValue( |
| 601 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT); | 599 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT); |
| 602 validators_.texture_unsized_internal_format.AddValue(GL_SRGB_EXT); | 600 validators_.texture_unsized_internal_format.AddValue(GL_SRGB_EXT); |
| 603 validators_.texture_unsized_internal_format.AddValue(GL_SRGB_ALPHA_EXT); | 601 validators_.texture_unsized_internal_format.AddValue(GL_SRGB_ALPHA_EXT); |
| 604 has_srgb_framebuffer_support = true; | |
| 605 } | |
| 606 if (gl_version_info_->is_es3) | |
| 607 has_srgb_framebuffer_support = true; | |
| 608 | |
| 609 if (has_srgb_framebuffer_support && !IsWebGLContext()) { | |
| 610 // GL_FRAMEBUFFER_SRGB_EXT is exposed by the GLES extension | |
| 611 // GL_EXT_sRGB_write_control (which is not part of the core, even in GLES3), | |
| 612 // and the desktop extension GL_ARB_framebuffer_sRGB (part of the core in | |
| 613 // 3.0). | |
| 614 if (feature_flags_.desktop_srgb_support || | |
| 615 extensions.Contains("GL_EXT_sRGB_write_control")) { | |
| 616 feature_flags_.ext_srgb_write_control = true; | |
| 617 AddExtensionString("GL_EXT_sRGB_write_control"); | |
| 618 validators_.capability.AddValue(GL_FRAMEBUFFER_SRGB_EXT); | |
| 619 } | |
| 620 } | 602 } |
| 621 | 603 |
| 622 // On desktop, GL_EXT_texture_sRGB is required regardless of GL version, | 604 // On desktop, GL_EXT_texture_sRGB is required regardless of GL version, |
| 623 // since the sRGB formats in OpenGL 3.0 Core do not support S3TC. | 605 // since the sRGB formats in OpenGL 3.0 Core do not support S3TC. |
| 624 // TODO(kainino): Support GL_EXT_texture_compression_s3tc_srgb once ratified. | 606 // TODO(kainino): Support GL_EXT_texture_compression_s3tc_srgb once ratified. |
| 625 if ((gl_version_info_->is_es && extensions.Contains("GL_NV_sRGB_formats")) || | 607 if ((gl_version_info_->is_es && extensions.Contains("GL_NV_sRGB_formats")) || |
| 626 (!gl_version_info_->is_es && | 608 (!gl_version_info_->is_es && |
| 627 extensions.Contains("GL_EXT_texture_sRGB") && | 609 extensions.Contains("GL_EXT_texture_sRGB") && |
| 628 extensions.Contains("GL_EXT_texture_compression_s3tc"))) { | 610 extensions.Contains("GL_EXT_texture_compression_s3tc"))) { |
| 629 AddExtensionString("GL_EXT_texture_compression_s3tc_srgb"); | 611 AddExtensionString("GL_EXT_texture_compression_s3tc_srgb"); |
| (...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1557 if (pos == std::string::npos) { | 1539 if (pos == std::string::npos) { |
| 1558 extensions_ += (extensions_.empty() ? "" : " ") + str; | 1540 extensions_ += (extensions_.empty() ? "" : " ") + str; |
| 1559 } | 1541 } |
| 1560 } | 1542 } |
| 1561 | 1543 |
| 1562 FeatureInfo::~FeatureInfo() { | 1544 FeatureInfo::~FeatureInfo() { |
| 1563 } | 1545 } |
| 1564 | 1546 |
| 1565 } // namespace gles2 | 1547 } // namespace gles2 |
| 1566 } // namespace gpu | 1548 } // namespace gpu |
| OLD | NEW |