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_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 FeatureInfo::Workarounds::Workarounds() | 89 FeatureInfo::Workarounds::Workarounds() |
90 : clear_alpha_in_readpixels(false), | 90 : clear_alpha_in_readpixels(false), |
91 needs_glsl_built_in_function_emulation(false), | 91 needs_glsl_built_in_function_emulation(false), |
92 needs_offscreen_buffer_workaround(false), | 92 needs_offscreen_buffer_workaround(false), |
93 reverse_point_sprite_coord_origin(false), | 93 reverse_point_sprite_coord_origin(false), |
94 set_texture_filter_before_generating_mipmap(false), | 94 set_texture_filter_before_generating_mipmap(false), |
95 use_current_program_after_successful_link(false), | 95 use_current_program_after_successful_link(false), |
96 restore_scissor_on_fbo_change(false), | 96 restore_scissor_on_fbo_change(false), |
97 flush_on_context_switch(false), | 97 flush_on_context_switch(false), |
| 98 makecurrent_recreates_surfaces(false), |
98 delete_instead_of_resize_fbo(false), | 99 delete_instead_of_resize_fbo(false), |
99 use_client_side_arrays_for_stream_buffers(false), | 100 use_client_side_arrays_for_stream_buffers(false), |
100 max_texture_size(0), | 101 max_texture_size(0), |
101 max_cube_map_texture_size(0) { | 102 max_cube_map_texture_size(0) { |
102 } | 103 } |
103 | 104 |
104 FeatureInfo::FeatureInfo() { | 105 FeatureInfo::FeatureInfo() { |
105 static const GLenum kAlphaTypes[] = { | 106 static const GLenum kAlphaTypes[] = { |
106 GL_UNSIGNED_BYTE, | 107 GL_UNSIGNED_BYTE, |
107 }; | 108 }; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 GL_VENDOR, | 166 GL_VENDOR, |
166 GL_RENDERER, | 167 GL_RENDERER, |
167 }; | 168 }; |
168 bool is_intel = false; | 169 bool is_intel = false; |
169 bool is_nvidia = false; | 170 bool is_nvidia = false; |
170 bool is_amd = false; | 171 bool is_amd = false; |
171 bool is_mesa = false; | 172 bool is_mesa = false; |
172 bool is_qualcomm = false; | 173 bool is_qualcomm = false; |
173 bool is_imagination = false; | 174 bool is_imagination = false; |
174 bool is_arm = false; | 175 bool is_arm = false; |
| 176 bool is_hisilicon = false; |
175 for (size_t ii = 0; ii < arraysize(string_ids); ++ii) { | 177 for (size_t ii = 0; ii < arraysize(string_ids); ++ii) { |
176 const char* str = reinterpret_cast<const char*>( | 178 const char* str = reinterpret_cast<const char*>( |
177 glGetString(string_ids[ii])); | 179 glGetString(string_ids[ii])); |
178 if (str) { | 180 if (str) { |
179 std::string lstr(StringToLowerASCII(std::string(str))); | 181 std::string lstr(StringToLowerASCII(std::string(str))); |
180 StringSet string_set(lstr); | 182 StringSet string_set(lstr); |
181 is_intel |= string_set.Contains("intel"); | 183 is_intel |= string_set.Contains("intel"); |
182 is_nvidia |= string_set.Contains("nvidia"); | 184 is_nvidia |= string_set.Contains("nvidia"); |
183 is_amd |= string_set.Contains("amd") || string_set.Contains("ati"); | 185 is_amd |= string_set.Contains("amd") || string_set.Contains("ati"); |
184 is_mesa |= string_set.Contains("mesa"); | 186 is_mesa |= string_set.Contains("mesa"); |
185 is_qualcomm |= string_set.Contains("qualcomm"); | 187 is_qualcomm |= string_set.Contains("qualcomm"); |
186 is_imagination |= string_set.Contains("imagination"); | 188 is_imagination |= string_set.Contains("imagination"); |
187 is_arm |= string_set.Contains("arm"); | 189 is_arm |= string_set.Contains("arm"); |
| 190 is_hisilicon |= string_set.Contains("hisilicon"); |
188 } | 191 } |
189 } | 192 } |
190 | 193 |
191 feature_flags_.disable_workarounds = | 194 feature_flags_.disable_workarounds = |
192 CommandLine::ForCurrentProcess()->HasSwitch( | 195 CommandLine::ForCurrentProcess()->HasSwitch( |
193 switches::kDisableGpuDriverBugWorkarounds); | 196 switches::kDisableGpuDriverBugWorkarounds); |
194 | 197 |
195 feature_flags_.enable_shader_name_hashing = | 198 feature_flags_.enable_shader_name_hashing = |
196 !CommandLine::ForCurrentProcess()->HasSwitch( | 199 !CommandLine::ForCurrentProcess()->HasSwitch( |
197 switches::kDisableShaderNameHashing); | 200 switches::kDisableShaderNameHashing); |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 workarounds_.use_current_program_after_successful_link = true; | 652 workarounds_.use_current_program_after_successful_link = true; |
650 } | 653 } |
651 | 654 |
652 if (is_qualcomm) { | 655 if (is_qualcomm) { |
653 workarounds_.restore_scissor_on_fbo_change = true; | 656 workarounds_.restore_scissor_on_fbo_change = true; |
654 workarounds_.flush_on_context_switch = true; | 657 workarounds_.flush_on_context_switch = true; |
655 // This is only needed on the ICS driver. | 658 // This is only needed on the ICS driver. |
656 workarounds_.delete_instead_of_resize_fbo = true; | 659 workarounds_.delete_instead_of_resize_fbo = true; |
657 } | 660 } |
658 | 661 |
| 662 if (is_hisilicon) { |
| 663 workarounds_.makecurrent_recreates_surfaces = true; |
| 664 } |
| 665 |
659 #if defined(OS_MACOSX) | 666 #if defined(OS_MACOSX) |
660 workarounds_.needs_offscreen_buffer_workaround = is_nvidia; | 667 workarounds_.needs_offscreen_buffer_workaround = is_nvidia; |
661 workarounds_.needs_glsl_built_in_function_emulation = is_amd; | 668 workarounds_.needs_glsl_built_in_function_emulation = is_amd; |
662 | 669 |
663 if ((is_amd || is_intel) && | 670 if ((is_amd || is_intel) && |
664 gfx::GetGLImplementation() == gfx::kGLImplementationDesktopGL) { | 671 gfx::GetGLImplementation() == gfx::kGLImplementationDesktopGL) { |
665 workarounds_.reverse_point_sprite_coord_origin = true; | 672 workarounds_.reverse_point_sprite_coord_origin = true; |
666 } | 673 } |
667 | 674 |
668 // Limit Intel on Mac to 4096 max tex size and 1024 max cube map tex size. | 675 // Limit Intel on Mac to 4096 max tex size and 1024 max cube map tex size. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 if (extensions_.find(str) == std::string::npos) { | 714 if (extensions_.find(str) == std::string::npos) { |
708 extensions_ += (extensions_.empty() ? "" : " ") + str; | 715 extensions_ += (extensions_.empty() ? "" : " ") + str; |
709 } | 716 } |
710 } | 717 } |
711 | 718 |
712 FeatureInfo::~FeatureInfo() { | 719 FeatureInfo::~FeatureInfo() { |
713 } | 720 } |
714 | 721 |
715 } // namespace gles2 | 722 } // namespace gles2 |
716 } // namespace gpu | 723 } // namespace gpu |
OLD | NEW |