| 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  |    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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  185   // get the workarounds from json file. Then we should remove this block. |  185   // get the workarounds from json file. Then we should remove this block. | 
|  186   // See crbug.com/228979. |  186   // See crbug.com/228979. | 
|  187   bool is_intel = false; |  187   bool is_intel = false; | 
|  188   bool is_nvidia = false; |  188   bool is_nvidia = false; | 
|  189   bool is_amd = false; |  189   bool is_amd = false; | 
|  190   bool is_mesa = false; |  190   bool is_mesa = false; | 
|  191   bool is_qualcomm = false; |  191   bool is_qualcomm = false; | 
|  192   bool is_imagination = false; |  192   bool is_imagination = false; | 
|  193   bool is_arm = false; |  193   bool is_arm = false; | 
|  194   bool is_vivante = false; |  194   bool is_vivante = false; | 
 |  195   bool is_mali400 = false; | 
|  195   const char* gl_strings[2]; |  196   const char* gl_strings[2]; | 
|  196   gl_strings[0] = reinterpret_cast<const char*>(glGetString(GL_VENDOR)); |  197   gl_strings[0] = reinterpret_cast<const char*>(glGetString(GL_VENDOR)); | 
|  197   gl_strings[1] = reinterpret_cast<const char*>(glGetString(GL_RENDERER)); |  198   gl_strings[1] = reinterpret_cast<const char*>(glGetString(GL_RENDERER)); | 
|  198   if (!command_line.HasSwitch(switches::kGpuDriverBugWorkarounds) && |  199   if (!command_line.HasSwitch(switches::kGpuDriverBugWorkarounds) && | 
|  199       !command_line.HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { |  200       !command_line.HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { | 
|  200     for (size_t ii = 0; ii < arraysize(gl_strings); ++ii) { |  201     for (size_t ii = 0; ii < arraysize(gl_strings); ++ii) { | 
|  201       const char* str = gl_strings[ii]; |  202       const char* str = gl_strings[ii]; | 
|  202       if (str) { |  203       if (str) { | 
|  203         std::string lstr(StringToLowerASCII(std::string(str))); |  204         std::string lstr(StringToLowerASCII(std::string(str))); | 
|  204         StringSet string_set(lstr); |  205         StringSet string_set(lstr); | 
|  205         is_intel |= string_set.Contains("intel"); |  206         is_intel |= string_set.Contains("intel"); | 
|  206         is_nvidia |= string_set.Contains("nvidia"); |  207         is_nvidia |= string_set.Contains("nvidia"); | 
|  207         is_amd |= string_set.Contains("amd") || string_set.Contains("ati"); |  208         is_amd |= string_set.Contains("amd") || string_set.Contains("ati"); | 
|  208         is_mesa |= string_set.Contains("mesa"); |  209         is_mesa |= string_set.Contains("mesa"); | 
|  209         is_qualcomm |= string_set.Contains("qualcomm"); |  210         is_qualcomm |= string_set.Contains("qualcomm"); | 
|  210         is_imagination |= string_set.Contains("imagination"); |  211         is_imagination |= string_set.Contains("imagination"); | 
|  211         is_arm |= string_set.Contains("arm"); |  212         is_arm |= string_set.Contains("arm"); | 
|  212         is_vivante |= string_set.Contains("vivante"); |  213         is_vivante |= string_set.Contains("vivante"); | 
|  213         is_vivante |= string_set.Contains("hisilicon"); |  214         is_vivante |= string_set.Contains("hisilicon"); | 
 |  215         is_mali400 |= string_set.Contains("mali-400"); | 
|  214       } |  216       } | 
|  215     } |  217     } | 
|  216  |  218  | 
|  217     if (extensions.Contains("GL_VIV_shader_binary")) |  219     if (extensions.Contains("GL_VIV_shader_binary")) | 
|  218       is_vivante = true; |  220       is_vivante = true; | 
|  219  |  221  | 
|  220     workarounds_.set_texture_filter_before_generating_mipmap = true; |  222     workarounds_.set_texture_filter_before_generating_mipmap = true; | 
|  221     workarounds_.clear_alpha_in_readpixels = true; |  223     workarounds_.clear_alpha_in_readpixels = true; | 
|  222     if (is_nvidia) { |  224     if (is_nvidia) { | 
|  223       workarounds_.use_current_program_after_successful_link = true; |  225       workarounds_.use_current_program_after_successful_link = true; | 
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  407   if (extensions.Contains("GL_OES_vertex_array_object") || |  409   if (extensions.Contains("GL_OES_vertex_array_object") || | 
|  408       extensions.Contains("GL_ARB_vertex_array_object") || |  410       extensions.Contains("GL_ARB_vertex_array_object") || | 
|  409       extensions.Contains("GL_APPLE_vertex_array_object")) { |  411       extensions.Contains("GL_APPLE_vertex_array_object")) { | 
|  410     feature_flags_.native_vertex_array_object = true; |  412     feature_flags_.native_vertex_array_object = true; | 
|  411   } |  413   } | 
|  412  |  414  | 
|  413   if (is_arm || is_imagination) { |  415   if (is_arm || is_imagination) { | 
|  414     workarounds_.use_client_side_arrays_for_stream_buffers = true; |  416     workarounds_.use_client_side_arrays_for_stream_buffers = true; | 
|  415   } |  417   } | 
|  416  |  418  | 
 |  419   if (is_mali400) { | 
 |  420     workarounds_.use_non_zero_size_for_client_side_stream_buffers = true; | 
 |  421   } | 
 |  422  | 
|  417   // If we're using client_side_arrays we have to emulate |  423   // If we're using client_side_arrays we have to emulate | 
|  418   // vertex array objects since vertex array objects do not work |  424   // vertex array objects since vertex array objects do not work | 
|  419   // with client side arrays. |  425   // with client side arrays. | 
|  420   if (workarounds_.use_client_side_arrays_for_stream_buffers) { |  426   if (workarounds_.use_client_side_arrays_for_stream_buffers) { | 
|  421     feature_flags_.native_vertex_array_object = false; |  427     feature_flags_.native_vertex_array_object = false; | 
|  422   } |  428   } | 
|  423  |  429  | 
|  424   if (extensions.Contains("GL_OES_element_index_uint") || |  430   if (extensions.Contains("GL_OES_element_index_uint") || | 
|  425       gfx::HasDesktopGLFeatures()) { |  431       gfx::HasDesktopGLFeatures()) { | 
|  426     AddExtensionString("GL_OES_element_index_uint"); |  432     AddExtensionString("GL_OES_element_index_uint"); | 
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  722   if (extensions_.find(str) == std::string::npos) { |  728   if (extensions_.find(str) == std::string::npos) { | 
|  723     extensions_ += (extensions_.empty() ? "" : " ") + str; |  729     extensions_ += (extensions_.empty() ? "" : " ") + str; | 
|  724   } |  730   } | 
|  725 } |  731 } | 
|  726  |  732  | 
|  727 FeatureInfo::~FeatureInfo() { |  733 FeatureInfo::~FeatureInfo() { | 
|  728 } |  734 } | 
|  729  |  735  | 
|  730 }  // namespace gles2 |  736 }  // namespace gles2 | 
|  731 }  // namespace gpu |  737 }  // namespace gpu | 
| OLD | NEW |