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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 chromium_stream_texture(false), | 75 chromium_stream_texture(false), |
76 angle_translated_shader_source(false), | 76 angle_translated_shader_source(false), |
77 angle_pack_reverse_row_order(false), | 77 angle_pack_reverse_row_order(false), |
78 arb_texture_rectangle(false), | 78 arb_texture_rectangle(false), |
79 angle_instanced_arrays(false), | 79 angle_instanced_arrays(false), |
80 occlusion_query_boolean(false), | 80 occlusion_query_boolean(false), |
81 use_arb_occlusion_query2_for_occlusion_query_boolean(false), | 81 use_arb_occlusion_query2_for_occlusion_query_boolean(false), |
82 use_arb_occlusion_query_for_occlusion_query_boolean(false), | 82 use_arb_occlusion_query_for_occlusion_query_boolean(false), |
83 native_vertex_array_object(false), | 83 native_vertex_array_object(false), |
84 disable_workarounds(false), | 84 disable_workarounds(false), |
85 enable_shader_name_hashing(false), | 85 enable_shader_name_hashing(false) { |
86 enable_virtual_context(false) { | |
87 } | 86 } |
88 | 87 |
89 FeatureInfo::Workarounds::Workarounds() | 88 FeatureInfo::Workarounds::Workarounds() |
90 : clear_alpha_in_readpixels(false), | 89 : clear_alpha_in_readpixels(false), |
91 needs_glsl_built_in_function_emulation(false), | 90 needs_glsl_built_in_function_emulation(false), |
92 needs_offscreen_buffer_workaround(false), | 91 needs_offscreen_buffer_workaround(false), |
93 reverse_point_sprite_coord_origin(false), | 92 reverse_point_sprite_coord_origin(false), |
94 set_texture_filter_before_generating_mipmap(false), | 93 set_texture_filter_before_generating_mipmap(false), |
95 use_current_program_after_successful_link(false), | 94 use_current_program_after_successful_link(false), |
96 max_texture_size(0), | 95 max_texture_size(0), |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // Sandy Bridge on Linux reports: | 200 // Sandy Bridge on Linux reports: |
202 // GL_VENDOR: Tungsten Graphics, Inc | 201 // GL_VENDOR: Tungsten Graphics, Inc |
203 // GL_RENDERER: | 202 // GL_RENDERER: |
204 // Mesa DRI Intel(R) Sandybridge Desktop GEM 20100330 DEVELOPMENT | 203 // Mesa DRI Intel(R) Sandybridge Desktop GEM 20100330 DEVELOPMENT |
205 | 204 |
206 static GLenum string_ids[] = { | 205 static GLenum string_ids[] = { |
207 GL_VENDOR, | 206 GL_VENDOR, |
208 GL_RENDERER, | 207 GL_RENDERER, |
209 }; | 208 }; |
210 bool is_intel = false; | 209 bool is_intel = false; |
211 bool is_nvidia_desktop = false; | 210 bool is_nvidia = false; |
212 bool is_amd = false; | 211 bool is_amd = false; |
213 bool is_mesa = false; | 212 bool is_mesa = false; |
214 bool is_nvidia_tegra = false; | |
215 bool is_img = false; | |
216 bool is_arm = false; | |
217 bool is_qualcomm = false; | 213 bool is_qualcomm = false; |
218 for (size_t ii = 0; ii < arraysize(string_ids); ++ii) { | 214 for (size_t ii = 0; ii < arraysize(string_ids); ++ii) { |
219 const char* str = reinterpret_cast<const char*>( | 215 const char* str = reinterpret_cast<const char*>( |
220 glGetString(string_ids[ii])); | 216 glGetString(string_ids[ii])); |
221 if (str) { | 217 if (str) { |
222 std::string lstr(StringToLowerASCII(std::string(str))); | 218 std::string lstr(StringToLowerASCII(std::string(str))); |
223 StringSet string_set(lstr); | 219 StringSet string_set(lstr); |
224 is_intel |= string_set.Contains("intel"); | 220 is_intel |= string_set.Contains("intel"); |
225 is_nvidia_desktop |= string_set.Contains("nvidia"); | 221 is_nvidia |= string_set.Contains("nvidia"); |
226 is_amd |= string_set.Contains("amd") || string_set.Contains("ati"); | 222 is_amd |= string_set.Contains("amd") || string_set.Contains("ati"); |
227 is_mesa |= string_set.Contains("mesa"); | 223 is_mesa |= string_set.Contains("mesa"); |
228 | |
229 is_nvidia_tegra |= string_set.Contains("tegra"); | |
230 if (is_nvidia_tegra) | |
231 is_nvidia_desktop = false; | |
232 is_img |= string_set.Contains("imagination"); | |
233 is_arm |= string_set.Contains("arm"); | |
234 is_qualcomm |= string_set.Contains("qualcomm"); | 224 is_qualcomm |= string_set.Contains("qualcomm"); |
235 } | 225 } |
236 } | 226 } |
237 | 227 |
238 feature_flags_.disable_workarounds = | 228 feature_flags_.disable_workarounds = |
239 CommandLine::ForCurrentProcess()->HasSwitch( | 229 CommandLine::ForCurrentProcess()->HasSwitch( |
240 switches::kDisableGpuDriverBugWorkarounds); | 230 switches::kDisableGpuDriverBugWorkarounds); |
241 | 231 |
242 feature_flags_.enable_shader_name_hashing = | 232 feature_flags_.enable_shader_name_hashing = |
243 CommandLine::ForCurrentProcess()->HasSwitch( | 233 CommandLine::ForCurrentProcess()->HasSwitch( |
244 switches::kEnableShaderNameHashing); | 234 switches::kEnableShaderNameHashing); |
245 | 235 |
246 feature_flags_.enable_virtual_context = is_img; | |
247 | 236 |
248 bool npot_ok = false; | 237 bool npot_ok = false; |
249 | 238 |
250 AddExtensionString("GL_ANGLE_translated_shader_source"); | 239 AddExtensionString("GL_ANGLE_translated_shader_source"); |
251 AddExtensionString("GL_CHROMIUM_async_pixel_transfers"); | 240 AddExtensionString("GL_CHROMIUM_async_pixel_transfers"); |
252 AddExtensionString("GL_CHROMIUM_bind_uniform_location"); | 241 AddExtensionString("GL_CHROMIUM_bind_uniform_location"); |
253 AddExtensionString("GL_CHROMIUM_command_buffer_query"); | 242 AddExtensionString("GL_CHROMIUM_command_buffer_query"); |
254 AddExtensionString("GL_CHROMIUM_command_buffer_latency_query"); | 243 AddExtensionString("GL_CHROMIUM_command_buffer_latency_query"); |
255 AddExtensionString("GL_CHROMIUM_copy_texture"); | 244 AddExtensionString("GL_CHROMIUM_copy_texture"); |
256 AddExtensionString("GL_CHROMIUM_discard_backbuffer"); | 245 AddExtensionString("GL_CHROMIUM_discard_backbuffer"); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 validators_.vertex_attribute.AddValue(GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE); | 654 validators_.vertex_attribute.AddValue(GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE); |
666 } | 655 } |
667 | 656 |
668 if (!disallowed_features_.swap_buffer_complete_callback) | 657 if (!disallowed_features_.swap_buffer_complete_callback) |
669 AddExtensionString("GL_CHROMIUM_swapbuffers_complete_callback"); | 658 AddExtensionString("GL_CHROMIUM_swapbuffers_complete_callback"); |
670 | 659 |
671 if (!feature_flags_.disable_workarounds) { | 660 if (!feature_flags_.disable_workarounds) { |
672 workarounds_.set_texture_filter_before_generating_mipmap = true; | 661 workarounds_.set_texture_filter_before_generating_mipmap = true; |
673 workarounds_.clear_alpha_in_readpixels = true; | 662 workarounds_.clear_alpha_in_readpixels = true; |
674 | 663 |
675 if (is_nvidia_desktop) { | 664 if (is_nvidia) { |
676 workarounds_.use_current_program_after_successful_link = true; | 665 workarounds_.use_current_program_after_successful_link = true; |
677 } | 666 } |
678 | 667 |
679 #if defined(OS_MACOSX) | 668 #if defined(OS_MACOSX) |
680 workarounds_.needs_offscreen_buffer_workaround = is_nvidia_desktop; | 669 workarounds_.needs_offscreen_buffer_workaround = is_nvidia; |
681 workarounds_.needs_glsl_built_in_function_emulation = is_amd; | 670 workarounds_.needs_glsl_built_in_function_emulation = is_amd; |
682 | 671 |
683 if ((is_amd || is_intel) && | 672 if ((is_amd || is_intel) && |
684 gfx::GetGLImplementation() == gfx::kGLImplementationDesktopGL) { | 673 gfx::GetGLImplementation() == gfx::kGLImplementationDesktopGL) { |
685 workarounds_.reverse_point_sprite_coord_origin = true; | 674 workarounds_.reverse_point_sprite_coord_origin = true; |
686 } | 675 } |
687 | 676 |
688 // Limit Intel on Mac to 4096 max tex size and 1024 max cube map tex size. | 677 // Limit Intel on Mac to 4096 max tex size and 1024 max cube map tex size. |
689 // Limit AMD on Mac to 4096 max tex size and max cube map tex size. | 678 // Limit AMD on Mac to 4096 max tex size and max cube map tex size. |
690 // TODO(gman): Update this code to check for a specific version of | 679 // TODO(gman): Update this code to check for a specific version of |
(...skipping 23 matching lines...) Expand all Loading... |
714 if (extensions_.find(str) == std::string::npos) { | 703 if (extensions_.find(str) == std::string::npos) { |
715 extensions_ += (extensions_.empty() ? "" : " ") + str; | 704 extensions_ += (extensions_.empty() ? "" : " ") + str; |
716 } | 705 } |
717 } | 706 } |
718 | 707 |
719 FeatureInfo::~FeatureInfo() { | 708 FeatureInfo::~FeatureInfo() { |
720 } | 709 } |
721 | 710 |
722 } // namespace gles2 | 711 } // namespace gles2 |
723 } // namespace gpu | 712 } // namespace gpu |
OLD | NEW |