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