| 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 <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 is_swiftshader(false), | 165 is_swiftshader(false), |
| 166 angle_texture_usage(false), | 166 angle_texture_usage(false), |
| 167 ext_texture_storage(false), | 167 ext_texture_storage(false), |
| 168 chromium_path_rendering(false), | 168 chromium_path_rendering(false), |
| 169 blend_equation_advanced(false), | 169 blend_equation_advanced(false), |
| 170 blend_equation_advanced_coherent(false), | 170 blend_equation_advanced_coherent(false), |
| 171 ext_texture_rg(false), | 171 ext_texture_rg(false), |
| 172 chromium_image_ycbcr_422(false), | 172 chromium_image_ycbcr_422(false), |
| 173 enable_subscribe_uniform(false), | 173 enable_subscribe_uniform(false), |
| 174 emulate_primitive_restart_fixed_index(false), | 174 emulate_primitive_restart_fixed_index(false), |
| 175 ext_render_buffer_format_bgra8888(false) {} | 175 ext_render_buffer_format_bgra8888(false), |
| 176 ext_blend_func_extended(false) {} |
| 176 | 177 |
| 177 FeatureInfo::Workarounds::Workarounds() : | 178 FeatureInfo::Workarounds::Workarounds() : |
| 178 #define GPU_OP(type, name) name(false), | 179 #define GPU_OP(type, name) name(false), |
| 179 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) | 180 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) |
| 180 #undef GPU_OP | 181 #undef GPU_OP |
| 181 max_texture_size(0), | 182 max_texture_size(0), |
| 182 max_cube_map_texture_size(0), | 183 max_cube_map_texture_size(0), |
| 183 max_fragment_uniform_vectors(0), | 184 max_fragment_uniform_vectors(0), |
| 184 max_varying_vectors(0), | 185 max_varying_vectors(0), |
| 185 max_vertex_uniform_vectors(0), | 186 max_vertex_uniform_vectors(0), |
| (...skipping 29 matching lines...) Expand all Loading... |
| 215 command_line->HasSwitch(switches::kEnableSubscribeUniformExtension); | 216 command_line->HasSwitch(switches::kEnableSubscribeUniformExtension); |
| 216 | 217 |
| 217 enable_unsafe_es3_apis_switch_ = | 218 enable_unsafe_es3_apis_switch_ = |
| 218 command_line->HasSwitch(switches::kEnableUnsafeES3APIs); | 219 command_line->HasSwitch(switches::kEnableUnsafeES3APIs); |
| 219 | 220 |
| 220 enable_gl_path_rendering_switch_ = | 221 enable_gl_path_rendering_switch_ = |
| 221 command_line->HasSwitch(switches::kEnableGLPathRendering); | 222 command_line->HasSwitch(switches::kEnableGLPathRendering); |
| 222 | 223 |
| 223 // The shader translator is needed to translate from WebGL-conformant GLES SL | 224 // The shader translator is needed to translate from WebGL-conformant GLES SL |
| 224 // to normal GLES SL, enforce WebGL conformance, translate from GLES SL 1.0 to | 225 // to normal GLES SL, enforce WebGL conformance, translate from GLES SL 1.0 to |
| 225 // target context GLSL, etc. | 226 // target context GLSL, implement emulation of OpenGL ES features on OpenGL, |
| 227 // etc. |
| 226 // The flag here is for testing only. | 228 // The flag here is for testing only. |
| 227 disable_shader_translator_ = | 229 disable_shader_translator_ = |
| 228 command_line->HasSwitch(switches::kDisableGLSLTranslator); | 230 command_line->HasSwitch(switches::kDisableGLSLTranslator); |
| 229 | 231 |
| 230 unsafe_es3_apis_enabled_ = false; | 232 unsafe_es3_apis_enabled_ = false; |
| 231 } | 233 } |
| 232 | 234 |
| 233 bool FeatureInfo::Initialize() { | 235 bool FeatureInfo::Initialize() { |
| 234 disallowed_features_ = DisallowedFeatures(); | 236 disallowed_features_ = DisallowedFeatures(); |
| 235 InitializeFeatures(); | 237 InitializeFeatures(); |
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1062 if (blend_equation_advanced_coherent) | 1064 if (blend_equation_advanced_coherent) |
| 1063 AddExtensionString("GL_KHR_blend_equation_advanced_coherent"); | 1065 AddExtensionString("GL_KHR_blend_equation_advanced_coherent"); |
| 1064 | 1066 |
| 1065 AddExtensionString("GL_KHR_blend_equation_advanced"); | 1067 AddExtensionString("GL_KHR_blend_equation_advanced"); |
| 1066 feature_flags_.blend_equation_advanced = true; | 1068 feature_flags_.blend_equation_advanced = true; |
| 1067 feature_flags_.blend_equation_advanced_coherent = | 1069 feature_flags_.blend_equation_advanced_coherent = |
| 1068 blend_equation_advanced_coherent; | 1070 blend_equation_advanced_coherent; |
| 1069 } | 1071 } |
| 1070 } | 1072 } |
| 1071 | 1073 |
| 1074 bool has_opengl_program_interface_query = |
| 1075 gl_version_info_->IsAtLeastGL(4, 3) || |
| 1076 extensions.Contains("GL_ARB_program_interface_query"); |
| 1077 |
| 1072 if (enable_gl_path_rendering_switch_ && | 1078 if (enable_gl_path_rendering_switch_ && |
| 1073 !workarounds_.disable_gl_path_rendering && | 1079 !workarounds_.disable_gl_path_rendering && |
| 1074 extensions.Contains("GL_NV_path_rendering")) { | 1080 extensions.Contains("GL_NV_path_rendering")) { |
| 1075 bool has_dsa = gl_version_info_->IsAtLeastGL(4, 5) || | 1081 bool has_opengl_direct_state_access = |
| 1076 extensions.Contains("GL_EXT_direct_state_access"); | 1082 gl_version_info_->IsAtLeastGL(4, 5) || |
| 1077 bool has_piq = gl_version_info_->IsAtLeastGL(4, 3) || | 1083 extensions.Contains("GL_EXT_direct_state_access"); |
| 1078 extensions.Contains("GL_ARB_program_interface_query"); | |
| 1079 if (gl_version_info_->IsAtLeastGLES(3, 1) || | 1084 if (gl_version_info_->IsAtLeastGLES(3, 1) || |
| 1080 (gl_version_info_->IsAtLeastGL(3, 2) && has_dsa && has_piq)) { | 1085 (gl_version_info_->IsAtLeastGL(3, 2) && |
| 1086 has_opengl_direct_state_access && |
| 1087 has_opengl_program_interface_query)) { |
| 1081 AddExtensionString("GL_CHROMIUM_path_rendering"); | 1088 AddExtensionString("GL_CHROMIUM_path_rendering"); |
| 1082 feature_flags_.chromium_path_rendering = true; | 1089 feature_flags_.chromium_path_rendering = true; |
| 1083 validators_.g_l_state.AddValue(GL_PATH_MODELVIEW_MATRIX_CHROMIUM); | 1090 validators_.g_l_state.AddValue(GL_PATH_MODELVIEW_MATRIX_CHROMIUM); |
| 1084 validators_.g_l_state.AddValue(GL_PATH_PROJECTION_MATRIX_CHROMIUM); | 1091 validators_.g_l_state.AddValue(GL_PATH_PROJECTION_MATRIX_CHROMIUM); |
| 1085 validators_.g_l_state.AddValue(GL_PATH_STENCIL_FUNC_CHROMIUM); | 1092 validators_.g_l_state.AddValue(GL_PATH_STENCIL_FUNC_CHROMIUM); |
| 1086 validators_.g_l_state.AddValue(GL_PATH_STENCIL_REF_CHROMIUM); | 1093 validators_.g_l_state.AddValue(GL_PATH_STENCIL_REF_CHROMIUM); |
| 1087 validators_.g_l_state.AddValue(GL_PATH_STENCIL_VALUE_MASK_CHROMIUM); | 1094 validators_.g_l_state.AddValue(GL_PATH_STENCIL_VALUE_MASK_CHROMIUM); |
| 1088 } | 1095 } |
| 1089 } | 1096 } |
| 1090 | 1097 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1101 validators_.texture_internal_format.AddValue(GL_R8_EXT); | 1108 validators_.texture_internal_format.AddValue(GL_R8_EXT); |
| 1102 validators_.texture_internal_format.AddValue(GL_RG_EXT); | 1109 validators_.texture_internal_format.AddValue(GL_RG_EXT); |
| 1103 validators_.texture_internal_format.AddValue(GL_RG8_EXT); | 1110 validators_.texture_internal_format.AddValue(GL_RG8_EXT); |
| 1104 validators_.read_pixel_format.AddValue(GL_RED_EXT); | 1111 validators_.read_pixel_format.AddValue(GL_RED_EXT); |
| 1105 validators_.read_pixel_format.AddValue(GL_RG_EXT); | 1112 validators_.read_pixel_format.AddValue(GL_RG_EXT); |
| 1106 validators_.render_buffer_format.AddValue(GL_R8_EXT); | 1113 validators_.render_buffer_format.AddValue(GL_R8_EXT); |
| 1107 validators_.render_buffer_format.AddValue(GL_RG8_EXT); | 1114 validators_.render_buffer_format.AddValue(GL_RG8_EXT); |
| 1108 } | 1115 } |
| 1109 UMA_HISTOGRAM_BOOLEAN("GPU.TextureRG", feature_flags_.ext_texture_rg); | 1116 UMA_HISTOGRAM_BOOLEAN("GPU.TextureRG", feature_flags_.ext_texture_rg); |
| 1110 | 1117 |
| 1118 bool has_opengl_dual_source_blending = |
| 1119 gl_version_info_->IsAtLeastGL(3, 3) || |
| 1120 (gl_version_info_->IsAtLeastGL(3, 2) && |
| 1121 extensions.Contains("GL_ARB_blend_func_extended")); |
| 1122 if ((gl_version_info_->IsAtLeastGL(3, 2) && has_opengl_dual_source_blending && |
| 1123 has_opengl_program_interface_query && !disable_shader_translator_) || |
| 1124 (gl_version_info_->IsAtLeastGLES(3, 1) && |
| 1125 extensions.Contains("GL_EXT_blend_func_extended"))) { |
| 1126 // Note: to simplify the code, we do not expose EXT_blend_func_extended |
| 1127 // unless the service |
| 1128 // context supports program interface query. This means the theoretical ES |
| 1129 // 2.0 or ES 3.0 |
| 1130 // implementation with EXT_blend_func_extended is not sufficient. |
| 1131 feature_flags_.ext_blend_func_extended = true; |
| 1132 AddExtensionString("GL_EXT_blend_func_extended"); |
| 1133 |
| 1134 // NOTE: SRC_ALPHA_SATURATE is valid for ES2 src blend factor. |
| 1135 // SRC_ALPHA_SATURATE is valid for ES3 src and dst blend factor. |
| 1136 validators_.dst_blend_factor.AddValue(GL_SRC_ALPHA_SATURATE_EXT); |
| 1137 |
| 1138 validators_.src_blend_factor.AddValue(GL_SRC1_ALPHA_EXT); |
| 1139 validators_.dst_blend_factor.AddValue(GL_SRC1_ALPHA_EXT); |
| 1140 validators_.src_blend_factor.AddValue(GL_SRC1_COLOR_EXT); |
| 1141 validators_.dst_blend_factor.AddValue(GL_SRC1_COLOR_EXT); |
| 1142 validators_.src_blend_factor.AddValue(GL_ONE_MINUS_SRC1_COLOR_EXT); |
| 1143 validators_.dst_blend_factor.AddValue(GL_ONE_MINUS_SRC1_COLOR_EXT); |
| 1144 validators_.src_blend_factor.AddValue(GL_ONE_MINUS_SRC1_ALPHA_EXT); |
| 1145 validators_.dst_blend_factor.AddValue(GL_ONE_MINUS_SRC1_ALPHA_EXT); |
| 1146 validators_.g_l_state.AddValue(GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT); |
| 1147 } |
| 1148 |
| 1111 #if !defined(OS_MACOSX) | 1149 #if !defined(OS_MACOSX) |
| 1112 if (workarounds_.ignore_egl_sync_failures) { | 1150 if (workarounds_.ignore_egl_sync_failures) { |
| 1113 gfx::GLFenceEGL::SetIgnoreFailures(); | 1151 gfx::GLFenceEGL::SetIgnoreFailures(); |
| 1114 } | 1152 } |
| 1115 #endif | 1153 #endif |
| 1116 | 1154 |
| 1117 if (workarounds_.avoid_egl_image_target_texture_reuse) { | 1155 if (workarounds_.avoid_egl_image_target_texture_reuse) { |
| 1118 TextureDefinition::AvoidEGLTargetTextureReuse(); | 1156 TextureDefinition::AvoidEGLTargetTextureReuse(); |
| 1119 } | 1157 } |
| 1120 | 1158 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1207 if (pos == std::string::npos) { | 1245 if (pos == std::string::npos) { |
| 1208 extensions_ += (extensions_.empty() ? "" : " ") + str; | 1246 extensions_ += (extensions_.empty() ? "" : " ") + str; |
| 1209 } | 1247 } |
| 1210 } | 1248 } |
| 1211 | 1249 |
| 1212 FeatureInfo::~FeatureInfo() { | 1250 FeatureInfo::~FeatureInfo() { |
| 1213 } | 1251 } |
| 1214 | 1252 |
| 1215 } // namespace gles2 | 1253 } // namespace gles2 |
| 1216 } // namespace gpu | 1254 } // namespace gpu |
| OLD | NEW |