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 835 matching lines...) Loading... |
846 } | 846 } |
847 | 847 |
848 // Enable the GL_EXT_color_buffer_float extension for WebGL 2.0 | 848 // Enable the GL_EXT_color_buffer_float extension for WebGL 2.0 |
849 if (enable_ext_color_buffer_float && IsES3Capable()) { | 849 if (enable_ext_color_buffer_float && IsES3Capable()) { |
850 ext_color_buffer_float_available_ = true; | 850 ext_color_buffer_float_available_ = true; |
851 if (!disallowed_features_.ext_color_buffer_float) | 851 if (!disallowed_features_.ext_color_buffer_float) |
852 EnableEXTColorBufferFloat(); | 852 EnableEXTColorBufferFloat(); |
853 } | 853 } |
854 | 854 |
855 // Check for multisample support | 855 // Check for multisample support |
856 | 856 if (!workarounds_.disable_chromium_framebuffer_multisample) { |
857 // crbug.com/527565 - On some GPUs, MSAA does not perform acceptably for | |
858 // rasterization. We disable it on non-WebGL contexts. For WebGL contexts | |
859 // we leave it up to the site to decide whether to enable MSAA. | |
860 bool disable_all_multisample = | |
861 workarounds_.disable_msaa_on_non_webgl_contexts && !IsWebGLContext(); | |
862 | |
863 if (!disable_all_multisample && | |
864 !workarounds_.disable_chromium_framebuffer_multisample) { | |
865 bool ext_has_multisample = | 857 bool ext_has_multisample = |
866 extensions.Contains("GL_EXT_framebuffer_multisample") || | 858 extensions.Contains("GL_EXT_framebuffer_multisample") || |
867 gl_version_info_->is_es3 || | 859 gl_version_info_->is_es3 || |
868 gl_version_info_->is_desktop_core_profile; | 860 gl_version_info_->is_desktop_core_profile; |
869 if (gl_version_info_->is_angle) { | 861 if (gl_version_info_->is_angle) { |
870 ext_has_multisample |= | 862 ext_has_multisample |= |
871 extensions.Contains("GL_ANGLE_framebuffer_multisample"); | 863 extensions.Contains("GL_ANGLE_framebuffer_multisample"); |
872 } | 864 } |
873 feature_flags_.use_core_framebuffer_multisample = | 865 feature_flags_.use_core_framebuffer_multisample = |
874 gl_version_info_->is_es3 || gl_version_info_->is_desktop_core_profile; | 866 gl_version_info_->is_es3 || gl_version_info_->is_desktop_core_profile; |
875 if (ext_has_multisample) { | 867 if (ext_has_multisample) { |
876 feature_flags_.chromium_framebuffer_multisample = true; | 868 feature_flags_.chromium_framebuffer_multisample = true; |
877 validators_.frame_buffer_target.AddValue(GL_READ_FRAMEBUFFER_EXT); | 869 validators_.frame_buffer_target.AddValue(GL_READ_FRAMEBUFFER_EXT); |
878 validators_.frame_buffer_target.AddValue(GL_DRAW_FRAMEBUFFER_EXT); | 870 validators_.frame_buffer_target.AddValue(GL_DRAW_FRAMEBUFFER_EXT); |
879 validators_.g_l_state.AddValue(GL_READ_FRAMEBUFFER_BINDING_EXT); | 871 validators_.g_l_state.AddValue(GL_READ_FRAMEBUFFER_BINDING_EXT); |
880 validators_.g_l_state.AddValue(GL_MAX_SAMPLES_EXT); | 872 validators_.g_l_state.AddValue(GL_MAX_SAMPLES_EXT); |
881 validators_.render_buffer_parameter.AddValue(GL_RENDERBUFFER_SAMPLES_EXT); | 873 validators_.render_buffer_parameter.AddValue(GL_RENDERBUFFER_SAMPLES_EXT); |
882 AddExtensionString("GL_CHROMIUM_framebuffer_multisample"); | 874 AddExtensionString("GL_CHROMIUM_framebuffer_multisample"); |
883 } | 875 } |
884 } | 876 } |
885 | 877 |
886 if (!disable_all_multisample && | 878 if (!workarounds_.disable_multisampled_render_to_texture) { |
887 !workarounds_.disable_multisampled_render_to_texture) { | |
888 if (extensions.Contains("GL_EXT_multisampled_render_to_texture")) { | 879 if (extensions.Contains("GL_EXT_multisampled_render_to_texture")) { |
889 feature_flags_.multisampled_render_to_texture = true; | 880 feature_flags_.multisampled_render_to_texture = true; |
890 } else if (extensions.Contains("GL_IMG_multisampled_render_to_texture")) { | 881 } else if (extensions.Contains("GL_IMG_multisampled_render_to_texture")) { |
891 feature_flags_.multisampled_render_to_texture = true; | 882 feature_flags_.multisampled_render_to_texture = true; |
892 feature_flags_.use_img_for_multisampled_render_to_texture = true; | 883 feature_flags_.use_img_for_multisampled_render_to_texture = true; |
893 } | 884 } |
894 if (feature_flags_.multisampled_render_to_texture) { | 885 if (feature_flags_.multisampled_render_to_texture) { |
895 validators_.render_buffer_parameter.AddValue( | 886 validators_.render_buffer_parameter.AddValue( |
896 GL_RENDERBUFFER_SAMPLES_EXT); | 887 GL_RENDERBUFFER_SAMPLES_EXT); |
897 validators_.g_l_state.AddValue(GL_MAX_SAMPLES_EXT); | 888 validators_.g_l_state.AddValue(GL_MAX_SAMPLES_EXT); |
898 validators_.frame_buffer_parameter.AddValue( | 889 validators_.frame_buffer_parameter.AddValue( |
899 GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT); | 890 GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT); |
900 AddExtensionString("GL_EXT_multisampled_render_to_texture"); | 891 AddExtensionString("GL_EXT_multisampled_render_to_texture"); |
901 } | 892 } |
902 } | 893 } |
903 | 894 |
904 if (!disable_all_multisample && | 895 if (!gl_version_info_->is_es || |
905 (!gl_version_info_->is_es || | 896 extensions.Contains("GL_EXT_multisample_compatibility")) { |
906 extensions.Contains("GL_EXT_multisample_compatibility"))) { | |
907 AddExtensionString("GL_EXT_multisample_compatibility"); | 897 AddExtensionString("GL_EXT_multisample_compatibility"); |
908 feature_flags_.ext_multisample_compatibility = true; | 898 feature_flags_.ext_multisample_compatibility = true; |
909 validators_.capability.AddValue(GL_MULTISAMPLE_EXT); | 899 validators_.capability.AddValue(GL_MULTISAMPLE_EXT); |
910 validators_.capability.AddValue(GL_SAMPLE_ALPHA_TO_ONE_EXT); | 900 validators_.capability.AddValue(GL_SAMPLE_ALPHA_TO_ONE_EXT); |
911 } | 901 } |
912 | 902 |
913 if (extensions.Contains("GL_INTEL_framebuffer_CMAA")) { | 903 if (extensions.Contains("GL_INTEL_framebuffer_CMAA")) { |
914 feature_flags_.chromium_screen_space_antialiasing = true; | 904 feature_flags_.chromium_screen_space_antialiasing = true; |
915 AddExtensionString("GL_CHROMIUM_screen_space_antialiasing"); | 905 AddExtensionString("GL_CHROMIUM_screen_space_antialiasing"); |
916 } | 906 } |
(...skipping 517 matching lines...) Loading... |
1434 if (pos == std::string::npos) { | 1424 if (pos == std::string::npos) { |
1435 extensions_ += (extensions_.empty() ? "" : " ") + str; | 1425 extensions_ += (extensions_.empty() ? "" : " ") + str; |
1436 } | 1426 } |
1437 } | 1427 } |
1438 | 1428 |
1439 FeatureInfo::~FeatureInfo() { | 1429 FeatureInfo::~FeatureInfo() { |
1440 } | 1430 } |
1441 | 1431 |
1442 } // namespace gles2 | 1432 } // namespace gles2 |
1443 } // namespace gpu | 1433 } // namespace gpu |
OLD | NEW |