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