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