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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 ext_texture_storage(false), | 169 ext_texture_storage(false), |
170 chromium_path_rendering(false), | 170 chromium_path_rendering(false), |
171 blend_equation_advanced(false), | 171 blend_equation_advanced(false), |
172 blend_equation_advanced_coherent(false), | 172 blend_equation_advanced_coherent(false), |
173 ext_texture_rg(false), | 173 ext_texture_rg(false), |
174 chromium_image_ycbcr_420v(false), | 174 chromium_image_ycbcr_420v(false), |
175 chromium_image_ycbcr_422(false), | 175 chromium_image_ycbcr_422(false), |
176 enable_subscribe_uniform(false), | 176 enable_subscribe_uniform(false), |
177 emulate_primitive_restart_fixed_index(false), | 177 emulate_primitive_restart_fixed_index(false), |
178 ext_render_buffer_format_bgra8888(false), | 178 ext_render_buffer_format_bgra8888(false), |
179 ext_multisample_compatibility(false) {} | 179 ext_multisample_compatibility(false), |
| 180 ext_blend_func_extended(false) {} |
180 | 181 |
181 FeatureInfo::Workarounds::Workarounds() : | 182 FeatureInfo::Workarounds::Workarounds() : |
182 #define GPU_OP(type, name) name(false), | 183 #define GPU_OP(type, name) name(false), |
183 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) | 184 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) |
184 #undef GPU_OP | 185 #undef GPU_OP |
185 max_texture_size(0), | 186 max_texture_size(0), |
186 max_cube_map_texture_size(0), | 187 max_cube_map_texture_size(0), |
187 max_fragment_uniform_vectors(0), | 188 max_fragment_uniform_vectors(0), |
188 max_varying_vectors(0), | 189 max_varying_vectors(0), |
189 max_vertex_uniform_vectors(0), | 190 max_vertex_uniform_vectors(0), |
(...skipping 29 matching lines...) Expand all Loading... |
219 command_line->HasSwitch(switches::kEnableSubscribeUniformExtension); | 220 command_line->HasSwitch(switches::kEnableSubscribeUniformExtension); |
220 | 221 |
221 enable_unsafe_es3_apis_switch_ = | 222 enable_unsafe_es3_apis_switch_ = |
222 command_line->HasSwitch(switches::kEnableUnsafeES3APIs); | 223 command_line->HasSwitch(switches::kEnableUnsafeES3APIs); |
223 | 224 |
224 enable_gl_path_rendering_switch_ = | 225 enable_gl_path_rendering_switch_ = |
225 command_line->HasSwitch(switches::kEnableGLPathRendering); | 226 command_line->HasSwitch(switches::kEnableGLPathRendering); |
226 | 227 |
227 // The shader translator is needed to translate from WebGL-conformant GLES SL | 228 // The shader translator is needed to translate from WebGL-conformant GLES SL |
228 // to normal GLES SL, enforce WebGL conformance, translate from GLES SL 1.0 to | 229 // to normal GLES SL, enforce WebGL conformance, translate from GLES SL 1.0 to |
229 // target context GLSL, etc. | 230 // target context GLSL, implement emulation of OpenGL ES features on OpenGL, |
| 231 // etc. |
230 // The flag here is for testing only. | 232 // The flag here is for testing only. |
231 disable_shader_translator_ = | 233 disable_shader_translator_ = |
232 command_line->HasSwitch(switches::kDisableGLSLTranslator); | 234 command_line->HasSwitch(switches::kDisableGLSLTranslator); |
233 | 235 |
234 unsafe_es3_apis_enabled_ = false; | 236 unsafe_es3_apis_enabled_ = false; |
235 | 237 |
236 // Default context_type_ to a GLES2 Context. | 238 // Default context_type_ to a GLES2 Context. |
237 context_type_ = CONTEXT_TYPE_OPENGLES2; | 239 context_type_ = CONTEXT_TYPE_OPENGLES2; |
238 } | 240 } |
239 | 241 |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 validators_.texture_internal_format.AddValue(GL_R8_EXT); | 1181 validators_.texture_internal_format.AddValue(GL_R8_EXT); |
1180 validators_.texture_internal_format.AddValue(GL_RG_EXT); | 1182 validators_.texture_internal_format.AddValue(GL_RG_EXT); |
1181 validators_.texture_internal_format.AddValue(GL_RG8_EXT); | 1183 validators_.texture_internal_format.AddValue(GL_RG8_EXT); |
1182 validators_.read_pixel_format.AddValue(GL_RED_EXT); | 1184 validators_.read_pixel_format.AddValue(GL_RED_EXT); |
1183 validators_.read_pixel_format.AddValue(GL_RG_EXT); | 1185 validators_.read_pixel_format.AddValue(GL_RG_EXT); |
1184 validators_.render_buffer_format.AddValue(GL_R8_EXT); | 1186 validators_.render_buffer_format.AddValue(GL_R8_EXT); |
1185 validators_.render_buffer_format.AddValue(GL_RG8_EXT); | 1187 validators_.render_buffer_format.AddValue(GL_RG8_EXT); |
1186 } | 1188 } |
1187 UMA_HISTOGRAM_BOOLEAN("GPU.TextureRG", feature_flags_.ext_texture_rg); | 1189 UMA_HISTOGRAM_BOOLEAN("GPU.TextureRG", feature_flags_.ext_texture_rg); |
1188 | 1190 |
| 1191 bool has_opengl_dual_source_blending = |
| 1192 gl_version_info_->IsAtLeastGL(3, 3) || |
| 1193 (gl_version_info_->IsAtLeastGL(3, 2) && |
| 1194 extensions.Contains("GL_ARB_blend_func_extended")); |
| 1195 if (!disable_shader_translator_ && |
| 1196 ((gl_version_info_->IsAtLeastGL(3, 2) && |
| 1197 has_opengl_dual_source_blending) || |
| 1198 (gl_version_info_->IsAtLeastGLES(3, 0) && |
| 1199 extensions.Contains("GL_EXT_blend_func_extended")))) { |
| 1200 // Note: to simplify the code, we do not expose EXT_blend_func_extended |
| 1201 // unless the service context supports ES 3.0. This means the theoretical ES |
| 1202 // 2.0 implementation with EXT_blend_func_extended is not sufficient. |
| 1203 feature_flags_.ext_blend_func_extended = true; |
| 1204 AddExtensionString("GL_EXT_blend_func_extended"); |
| 1205 |
| 1206 // NOTE: SRC_ALPHA_SATURATE is valid for ES2 src blend factor. |
| 1207 // SRC_ALPHA_SATURATE is valid for ES3 src and dst blend factor. |
| 1208 validators_.dst_blend_factor.AddValue(GL_SRC_ALPHA_SATURATE_EXT); |
| 1209 |
| 1210 validators_.src_blend_factor.AddValue(GL_SRC1_ALPHA_EXT); |
| 1211 validators_.dst_blend_factor.AddValue(GL_SRC1_ALPHA_EXT); |
| 1212 validators_.src_blend_factor.AddValue(GL_SRC1_COLOR_EXT); |
| 1213 validators_.dst_blend_factor.AddValue(GL_SRC1_COLOR_EXT); |
| 1214 validators_.src_blend_factor.AddValue(GL_ONE_MINUS_SRC1_COLOR_EXT); |
| 1215 validators_.dst_blend_factor.AddValue(GL_ONE_MINUS_SRC1_COLOR_EXT); |
| 1216 validators_.src_blend_factor.AddValue(GL_ONE_MINUS_SRC1_ALPHA_EXT); |
| 1217 validators_.dst_blend_factor.AddValue(GL_ONE_MINUS_SRC1_ALPHA_EXT); |
| 1218 validators_.g_l_state.AddValue(GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT); |
| 1219 } |
| 1220 |
1189 #if !defined(OS_MACOSX) | 1221 #if !defined(OS_MACOSX) |
1190 if (workarounds_.ignore_egl_sync_failures) { | 1222 if (workarounds_.ignore_egl_sync_failures) { |
1191 gfx::GLFenceEGL::SetIgnoreFailures(); | 1223 gfx::GLFenceEGL::SetIgnoreFailures(); |
1192 } | 1224 } |
1193 #endif | 1225 #endif |
1194 | 1226 |
1195 if (workarounds_.avoid_egl_image_target_texture_reuse) { | 1227 if (workarounds_.avoid_egl_image_target_texture_reuse) { |
1196 TextureDefinition::AvoidEGLTargetTextureReuse(); | 1228 TextureDefinition::AvoidEGLTargetTextureReuse(); |
1197 } | 1229 } |
1198 | 1230 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 if (pos == std::string::npos) { | 1332 if (pos == std::string::npos) { |
1301 extensions_ += (extensions_.empty() ? "" : " ") + str; | 1333 extensions_ += (extensions_.empty() ? "" : " ") + str; |
1302 } | 1334 } |
1303 } | 1335 } |
1304 | 1336 |
1305 FeatureInfo::~FeatureInfo() { | 1337 FeatureInfo::~FeatureInfo() { |
1306 } | 1338 } |
1307 | 1339 |
1308 } // namespace gles2 | 1340 } // namespace gles2 |
1309 } // namespace gpu | 1341 } // namespace gpu |
OLD | NEW |