Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: gpu/command_buffer/service/feature_info.cc

Issue 16159004: Hookup driver_bug_workarounds with gl_tests properly. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | gpu/command_buffer/service/test_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 disallowed_features_ = disallowed_features; 173 disallowed_features_ = disallowed_features;
174 AddFeatures(*CommandLine::ForCurrentProcess()); 174 AddFeatures(*CommandLine::ForCurrentProcess());
175 return true; 175 return true;
176 } 176 }
177 177
178 void FeatureInfo::AddFeatures(const CommandLine& command_line) { 178 void FeatureInfo::AddFeatures(const CommandLine& command_line) {
179 // Figure out what extensions to turn on. 179 // Figure out what extensions to turn on.
180 StringSet extensions( 180 StringSet extensions(
181 reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS))); 181 reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)));
182 182
183 // This is a temporary fix to turn gl_tests green on Linux and Android bots.
184 // Once we migrate blacklisting stuff from src/content to src/gpu, we can
185 // get the workarounds from json file. Then we should remove this block.
186 // See crbug.com/228979.
187 bool is_intel = false;
188 bool is_nvidia = false;
189 bool is_amd = false;
190 bool is_mesa = false;
191 bool is_qualcomm = false;
192 bool is_imagination = false;
193 bool is_arm = false;
194 bool is_vivante = false;
195 const char* gl_strings[2];
196 gl_strings[0] = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
197 gl_strings[1] = reinterpret_cast<const char*>(glGetString(GL_RENDERER));
198 if (!command_line.HasSwitch(switches::kGpuDriverBugWorkarounds) &&
199 !command_line.HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) {
200 for (size_t ii = 0; ii < arraysize(gl_strings); ++ii) {
201 const char* str = gl_strings[ii];
202 if (str) {
203 std::string lstr(StringToLowerASCII(std::string(str)));
204 StringSet string_set(lstr);
205 is_intel |= string_set.Contains("intel");
206 is_nvidia |= string_set.Contains("nvidia");
207 is_amd |= string_set.Contains("amd") || string_set.Contains("ati");
208 is_mesa |= string_set.Contains("mesa");
209 is_qualcomm |= string_set.Contains("qualcomm");
210 is_imagination |= string_set.Contains("imagination");
211 is_arm |= string_set.Contains("arm");
212 }
213 }
214 if (extensions.Contains("GL_VIV_shader_binary"))
215 is_vivante = true;
216
217 workarounds_.set_texture_filter_before_generating_mipmap = true;
218 workarounds_.clear_alpha_in_readpixels = true;
219 if (is_nvidia) {
220 workarounds_.use_current_program_after_successful_link = true;
221 }
222 if (is_qualcomm) {
223 workarounds_.restore_scissor_on_fbo_change = true;
224 workarounds_.flush_on_context_switch = true;
225 workarounds_.delete_instead_of_resize_fbo = true;
226 }
227 if (is_vivante || is_imagination) {
228 workarounds_.unbind_fbo_on_context_switch = true;
229 }
230 #if defined(OS_MACOSX)
231 workarounds_.needs_offscreen_buffer_workaround = is_nvidia;
232 workarounds_.needs_glsl_built_in_function_emulation = is_amd;
233 if ((is_amd || is_intel) &&
234 gfx::GetGLImplementation() == gfx::kGLImplementationDesktopGL) {
235 workarounds_.reverse_point_sprite_coord_origin = true;
236 }
237 if (is_intel) {
238 workarounds_.max_texture_size = 4096;
239 workarounds_.max_cube_map_texture_size = 1024;
240 int32 major = 0;
241 int32 minor = 0;
242 int32 bugfix = 0;
243 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix);
244 if (major < 10 ||
245 (major == 10 && ((minor == 7 && bugfix < 3) || (minor < 7))))
246 workarounds_.max_cube_map_texture_size = 512;
247 }
248 if (is_amd) {
249 workarounds_.max_texture_size = 4096;
250 workarounds_.max_cube_map_texture_size = 4096;
251 }
252 #endif
253 }
254
255 if (command_line.HasSwitch(switches::kGpuDriverBugWorkarounds)) { 183 if (command_line.HasSwitch(switches::kGpuDriverBugWorkarounds)) {
256 std::string types = command_line.GetSwitchValueASCII( 184 std::string types = command_line.GetSwitchValueASCII(
257 switches::kGpuDriverBugWorkarounds); 185 switches::kGpuDriverBugWorkarounds);
258 StringToWorkarounds(types, &workarounds_); 186 StringToWorkarounds(types, &workarounds_);
259 } 187 }
260 188
261 feature_flags_.enable_shader_name_hashing = 189 feature_flags_.enable_shader_name_hashing =
262 !command_line.HasSwitch(switches::kDisableShaderNameHashing); 190 !command_line.HasSwitch(switches::kDisableShaderNameHashing);
263 191
264 bool npot_ok = false; 192 bool npot_ok = false;
(...skipping 10 matching lines...) Expand all
275 AddExtensionString("GL_CHROMIUM_pixel_transfer_buffer_object"); 203 AddExtensionString("GL_CHROMIUM_pixel_transfer_buffer_object");
276 AddExtensionString("GL_CHROMIUM_rate_limit_offscreen_context"); 204 AddExtensionString("GL_CHROMIUM_rate_limit_offscreen_context");
277 AddExtensionString("GL_CHROMIUM_resize"); 205 AddExtensionString("GL_CHROMIUM_resize");
278 AddExtensionString("GL_CHROMIUM_resource_safe"); 206 AddExtensionString("GL_CHROMIUM_resource_safe");
279 AddExtensionString("GL_CHROMIUM_set_visibility"); 207 AddExtensionString("GL_CHROMIUM_set_visibility");
280 AddExtensionString("GL_CHROMIUM_strict_attribs"); 208 AddExtensionString("GL_CHROMIUM_strict_attribs");
281 AddExtensionString("GL_CHROMIUM_stream_texture"); 209 AddExtensionString("GL_CHROMIUM_stream_texture");
282 AddExtensionString("GL_CHROMIUM_texture_mailbox"); 210 AddExtensionString("GL_CHROMIUM_texture_mailbox");
283 AddExtensionString("GL_EXT_debug_marker"); 211 AddExtensionString("GL_EXT_debug_marker");
284 212
285 if (workarounds_.enable_chromium_fast_npot_mo8_textures || 213 if (workarounds_.enable_chromium_fast_npot_mo8_textures)
286 is_imagination)
287 AddExtensionString("GL_CHROMIUM_fast_NPOT_MO8_textures"); 214 AddExtensionString("GL_CHROMIUM_fast_NPOT_MO8_textures");
288 215
289 feature_flags_.chromium_stream_texture = true; 216 feature_flags_.chromium_stream_texture = true;
290 217
291 // OES_vertex_array_object is emulated if not present natively, 218 // OES_vertex_array_object is emulated if not present natively,
292 // so the extension string is always exposed. 219 // so the extension string is always exposed.
293 AddExtensionString("GL_OES_vertex_array_object"); 220 AddExtensionString("GL_OES_vertex_array_object");
294 221
295 if (!disallowed_features_.gpu_memory_manager) 222 if (!disallowed_features_.gpu_memory_manager)
296 AddExtensionString("GL_CHROMIUM_gpu_memory_manager"); 223 AddExtensionString("GL_CHROMIUM_gpu_memory_manager");
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // NOTE: GL_OES_depth_texture requires support for depth cubemaps. 288 // NOTE: GL_OES_depth_texture requires support for depth cubemaps.
362 // GL_ARB_depth_texture requires other features that 289 // GL_ARB_depth_texture requires other features that
363 // GL_OES_packed_depth_stencil does not provide. 290 // GL_OES_packed_depth_stencil does not provide.
364 // 291 //
365 // Therefore we made up GL_GOOGLE_depth_texture / GL_CHROMIUM_depth_texture. 292 // Therefore we made up GL_GOOGLE_depth_texture / GL_CHROMIUM_depth_texture.
366 // 293 //
367 // GL_GOOGLE_depth_texture is legacy. As we exposed it into NaCl we can't 294 // GL_GOOGLE_depth_texture is legacy. As we exposed it into NaCl we can't
368 // get rid of it. 295 // get rid of it.
369 // 296 //
370 bool enable_depth_texture = false; 297 bool enable_depth_texture = false;
371 if ((!workarounds_.disable_depth_texture && !is_qualcomm) && 298 if (!workarounds_.disable_depth_texture &&
372 (extensions.Contains("GL_ARB_depth_texture") || 299 (extensions.Contains("GL_ARB_depth_texture") ||
373 extensions.Contains("GL_OES_depth_texture") || 300 extensions.Contains("GL_OES_depth_texture") ||
374 extensions.Contains("GL_ANGLE_depth_texture"))) { 301 extensions.Contains("GL_ANGLE_depth_texture"))) {
375 enable_depth_texture = true; 302 enable_depth_texture = true;
376 } 303 }
377 304
378 if (enable_depth_texture) { 305 if (enable_depth_texture) {
379 AddExtensionString("GL_CHROMIUM_depth_texture"); 306 AddExtensionString("GL_CHROMIUM_depth_texture");
380 AddExtensionString("GL_GOOGLE_depth_texture"); 307 AddExtensionString("GL_GOOGLE_depth_texture");
381 texture_format_validators_[GL_DEPTH_COMPONENT].AddValue(GL_UNSIGNED_SHORT); 308 texture_format_validators_[GL_DEPTH_COMPONENT].AddValue(GL_UNSIGNED_SHORT);
(...skipping 16 matching lines...) Expand all
398 } 325 }
399 validators_.render_buffer_format.AddValue(GL_DEPTH24_STENCIL8); 326 validators_.render_buffer_format.AddValue(GL_DEPTH24_STENCIL8);
400 } 327 }
401 328
402 if (extensions.Contains("GL_OES_vertex_array_object") || 329 if (extensions.Contains("GL_OES_vertex_array_object") ||
403 extensions.Contains("GL_ARB_vertex_array_object") || 330 extensions.Contains("GL_ARB_vertex_array_object") ||
404 extensions.Contains("GL_APPLE_vertex_array_object")) { 331 extensions.Contains("GL_APPLE_vertex_array_object")) {
405 feature_flags_.native_vertex_array_object = true; 332 feature_flags_.native_vertex_array_object = true;
406 } 333 }
407 334
408 if (is_arm || is_imagination) {
409 workarounds_.use_client_side_arrays_for_stream_buffers = true;
410 }
411
412 // If we're using client_side_arrays we have to emulate 335 // If we're using client_side_arrays we have to emulate
413 // vertex array objects since vertex array objects do not work 336 // vertex array objects since vertex array objects do not work
414 // with client side arrays. 337 // with client side arrays.
415 if (workarounds_.use_client_side_arrays_for_stream_buffers) { 338 if (workarounds_.use_client_side_arrays_for_stream_buffers) {
416 feature_flags_.native_vertex_array_object = false; 339 feature_flags_.native_vertex_array_object = false;
417 } 340 }
418 341
419 if (extensions.Contains("GL_OES_element_index_uint") || 342 if (extensions.Contains("GL_OES_element_index_uint") ||
420 gfx::HasDesktopGLFeatures()) { 343 gfx::HasDesktopGLFeatures()) {
421 AddExtensionString("GL_OES_element_index_uint"); 344 AddExtensionString("GL_OES_element_index_uint");
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 validators_.read_pixel_type.AddValue(GL_HALF_FLOAT_OES); 445 validators_.read_pixel_type.AddValue(GL_HALF_FLOAT_OES);
523 AddExtensionString("GL_OES_texture_half_float"); 446 AddExtensionString("GL_OES_texture_half_float");
524 if (enable_texture_half_float_linear) { 447 if (enable_texture_half_float_linear) {
525 AddExtensionString("GL_OES_texture_half_float_linear"); 448 AddExtensionString("GL_OES_texture_half_float_linear");
526 } 449 }
527 } 450 }
528 451
529 // Check for multisample support 452 // Check for multisample support
530 bool ext_has_multisample = 453 bool ext_has_multisample =
531 extensions.Contains("GL_EXT_framebuffer_multisample"); 454 extensions.Contains("GL_EXT_framebuffer_multisample");
532 if (!is_qualcomm && !workarounds_.disable_angle_framebuffer_multisample) { 455 if (!workarounds_.disable_angle_framebuffer_multisample) {
533 ext_has_multisample |= 456 ext_has_multisample |=
534 extensions.Contains("GL_ANGLE_framebuffer_multisample"); 457 extensions.Contains("GL_ANGLE_framebuffer_multisample");
535 } 458 }
536 if (!disallowed_features_.multisampling && ext_has_multisample) { 459 if (!disallowed_features_.multisampling && ext_has_multisample) {
537 feature_flags_.chromium_framebuffer_multisample = true; 460 feature_flags_.chromium_framebuffer_multisample = true;
538 validators_.frame_buffer_target.AddValue(GL_READ_FRAMEBUFFER_EXT); 461 validators_.frame_buffer_target.AddValue(GL_READ_FRAMEBUFFER_EXT);
539 validators_.frame_buffer_target.AddValue(GL_DRAW_FRAMEBUFFER_EXT); 462 validators_.frame_buffer_target.AddValue(GL_DRAW_FRAMEBUFFER_EXT);
540 validators_.g_l_state.AddValue(GL_READ_FRAMEBUFFER_BINDING_EXT); 463 validators_.g_l_state.AddValue(GL_READ_FRAMEBUFFER_BINDING_EXT);
541 validators_.g_l_state.AddValue(GL_MAX_SAMPLES_EXT); 464 validators_.g_l_state.AddValue(GL_MAX_SAMPLES_EXT);
542 validators_.render_buffer_parameter.AddValue(GL_RENDERBUFFER_SAMPLES_EXT); 465 validators_.render_buffer_parameter.AddValue(GL_RENDERBUFFER_SAMPLES_EXT);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 } 564 }
642 565
643 bool have_ext_occlusion_query_boolean = 566 bool have_ext_occlusion_query_boolean =
644 extensions.Contains("GL_EXT_occlusion_query_boolean"); 567 extensions.Contains("GL_EXT_occlusion_query_boolean");
645 bool have_arb_occlusion_query2 = 568 bool have_arb_occlusion_query2 =
646 extensions.Contains("GL_ARB_occlusion_query2"); 569 extensions.Contains("GL_ARB_occlusion_query2");
647 bool have_arb_occlusion_query = 570 bool have_arb_occlusion_query =
648 extensions.Contains("GL_ARB_occlusion_query"); 571 extensions.Contains("GL_ARB_occlusion_query");
649 572
650 if (!workarounds_.disable_ext_occlusion_query && 573 if (!workarounds_.disable_ext_occlusion_query &&
651 #if defined(OS_LINUX)
652 !is_intel &&
653 #endif
654 (have_ext_occlusion_query_boolean || 574 (have_ext_occlusion_query_boolean ||
655 have_arb_occlusion_query2 || 575 have_arb_occlusion_query2 ||
656 have_arb_occlusion_query)) { 576 have_arb_occlusion_query)) {
657 AddExtensionString("GL_EXT_occlusion_query_boolean"); 577 AddExtensionString("GL_EXT_occlusion_query_boolean");
658 feature_flags_.occlusion_query_boolean = true; 578 feature_flags_.occlusion_query_boolean = true;
659 feature_flags_.use_arb_occlusion_query2_for_occlusion_query_boolean = 579 feature_flags_.use_arb_occlusion_query2_for_occlusion_query_boolean =
660 !have_ext_occlusion_query_boolean && have_arb_occlusion_query2; 580 !have_ext_occlusion_query_boolean && have_arb_occlusion_query2;
661 feature_flags_.use_arb_occlusion_query_for_occlusion_query_boolean = 581 feature_flags_.use_arb_occlusion_query_for_occlusion_query_boolean =
662 !have_ext_occlusion_query_boolean && have_arb_occlusion_query && 582 !have_ext_occlusion_query_boolean && have_arb_occlusion_query &&
663 !have_arb_occlusion_query2; 583 !have_arb_occlusion_query2;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 if (extensions_.find(str) == std::string::npos) { 637 if (extensions_.find(str) == std::string::npos) {
718 extensions_ += (extensions_.empty() ? "" : " ") + str; 638 extensions_ += (extensions_.empty() ? "" : " ") + str;
719 } 639 }
720 } 640 }
721 641
722 FeatureInfo::~FeatureInfo() { 642 FeatureInfo::~FeatureInfo() {
723 } 643 }
724 644
725 } // namespace gles2 645 } // namespace gles2
726 } // namespace gpu 646 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698