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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // Once we migrate blacklisting stuff from src/content to src/gpu, we can | 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. | 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_hisilicon = false; |
194 const char* gl_strings[2]; | 195 const char* gl_strings[2]; |
195 gl_strings[0] = reinterpret_cast<const char*>(glGetString(GL_VENDOR)); | 196 gl_strings[0] = reinterpret_cast<const char*>(glGetString(GL_VENDOR)); |
196 gl_strings[1] = reinterpret_cast<const char*>(glGetString(GL_RENDERER)); | 197 gl_strings[1] = reinterpret_cast<const char*>(glGetString(GL_RENDERER)); |
197 if (!command_line.HasSwitch(switches::kGpuDriverBugWorkarounds) && | 198 if (!command_line.HasSwitch(switches::kGpuDriverBugWorkarounds) && |
198 !command_line.HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { | 199 !command_line.HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { |
199 for (size_t ii = 0; ii < arraysize(gl_strings); ++ii) { | 200 for (size_t ii = 0; ii < arraysize(gl_strings); ++ii) { |
200 const char* str = gl_strings[ii]; | 201 const char* str = gl_strings[ii]; |
201 if (str) { | 202 if (str) { |
202 std::string lstr(StringToLowerASCII(std::string(str))); | 203 std::string lstr(StringToLowerASCII(std::string(str))); |
203 StringSet string_set(lstr); | 204 StringSet string_set(lstr); |
204 is_intel |= string_set.Contains("intel"); | 205 is_intel |= string_set.Contains("intel"); |
205 is_nvidia |= string_set.Contains("nvidia"); | 206 is_nvidia |= string_set.Contains("nvidia"); |
206 is_amd |= string_set.Contains("amd") || string_set.Contains("ati"); | 207 is_amd |= string_set.Contains("amd") || string_set.Contains("ati"); |
207 is_mesa |= string_set.Contains("mesa"); | 208 is_mesa |= string_set.Contains("mesa"); |
208 is_qualcomm |= string_set.Contains("qualcomm"); | 209 is_qualcomm |= string_set.Contains("qualcomm"); |
209 is_imagination |= string_set.Contains("imagination"); | 210 is_imagination |= string_set.Contains("imagination"); |
210 is_arm |= string_set.Contains("arm"); | 211 is_arm |= string_set.Contains("arm"); |
| 212 is_hisilicon |= string_set.Contains("hisilicon"); |
211 } | 213 } |
212 } | 214 } |
213 | 215 |
214 workarounds_.set_texture_filter_before_generating_mipmap = true; | 216 workarounds_.set_texture_filter_before_generating_mipmap = true; |
215 workarounds_.clear_alpha_in_readpixels = true; | 217 workarounds_.clear_alpha_in_readpixels = true; |
216 if (is_nvidia) { | 218 if (is_nvidia) { |
217 workarounds_.use_current_program_after_successful_link = true; | 219 workarounds_.use_current_program_after_successful_link = true; |
218 } | 220 } |
219 if (is_qualcomm) { | 221 if (is_qualcomm) { |
220 workarounds_.restore_scissor_on_fbo_change = true; | 222 workarounds_.restore_scissor_on_fbo_change = true; |
221 workarounds_.flush_on_context_switch = true; | 223 workarounds_.flush_on_context_switch = true; |
222 workarounds_.delete_instead_of_resize_fbo = true; | 224 workarounds_.delete_instead_of_resize_fbo = true; |
223 } | 225 } |
| 226 if (is_hisilicon) { |
| 227 workarounds_.makecurrent_recreates_surfaces = true; |
| 228 } |
224 #if defined(OS_MACOSX) | 229 #if defined(OS_MACOSX) |
225 workarounds_.needs_offscreen_buffer_workaround = is_nvidia; | 230 workarounds_.needs_offscreen_buffer_workaround = is_nvidia; |
226 workarounds_.needs_glsl_built_in_function_emulation = is_amd; | 231 workarounds_.needs_glsl_built_in_function_emulation = is_amd; |
227 if ((is_amd || is_intel) && | 232 if ((is_amd || is_intel) && |
228 gfx::GetGLImplementation() == gfx::kGLImplementationDesktopGL) { | 233 gfx::GetGLImplementation() == gfx::kGLImplementationDesktopGL) { |
229 workarounds_.reverse_point_sprite_coord_origin = true; | 234 workarounds_.reverse_point_sprite_coord_origin = true; |
230 } | 235 } |
231 if (is_intel) { | 236 if (is_intel) { |
232 workarounds_.max_texture_size = 4096; | 237 workarounds_.max_texture_size = 4096; |
233 workarounds_.max_cube_map_texture_size = 1024; | 238 workarounds_.max_cube_map_texture_size = 1024; |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 if (extensions_.find(str) == std::string::npos) { | 717 if (extensions_.find(str) == std::string::npos) { |
713 extensions_ += (extensions_.empty() ? "" : " ") + str; | 718 extensions_ += (extensions_.empty() ? "" : " ") + str; |
714 } | 719 } |
715 } | 720 } |
716 | 721 |
717 FeatureInfo::~FeatureInfo() { | 722 FeatureInfo::~FeatureInfo() { |
718 } | 723 } |
719 | 724 |
720 } // namespace gles2 | 725 } // namespace gles2 |
721 } // namespace gpu | 726 } // namespace gpu |
OLD | NEW |