| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 FeatureInfo::Workarounds::Workarounds() | 87 FeatureInfo::Workarounds::Workarounds() |
| 88 : clear_alpha_in_readpixels(false), | 88 : clear_alpha_in_readpixels(false), |
| 89 needs_glsl_built_in_function_emulation(false), | 89 needs_glsl_built_in_function_emulation(false), |
| 90 needs_offscreen_buffer_workaround(false), | 90 needs_offscreen_buffer_workaround(false), |
| 91 reverse_point_sprite_coord_origin(false), | 91 reverse_point_sprite_coord_origin(false), |
| 92 set_texture_filter_before_generating_mipmap(false), | 92 set_texture_filter_before_generating_mipmap(false), |
| 93 use_current_program_after_successful_link(false), | 93 use_current_program_after_successful_link(false), |
| 94 restore_scissor_on_fbo_change(false), | 94 restore_scissor_on_fbo_change(false), |
| 95 flush_on_context_switch(false), | 95 flush_on_context_switch(false), |
| 96 delete_instead_of_resize_fbo(false), | 96 delete_instead_of_resize_fbo(false), |
| 97 use_client_side_arrays_for_stream_buffers(false), |
| 97 max_texture_size(0), | 98 max_texture_size(0), |
| 98 max_cube_map_texture_size(0) { | 99 max_cube_map_texture_size(0) { |
| 99 } | 100 } |
| 100 | 101 |
| 101 FeatureInfo::FeatureInfo() { | 102 FeatureInfo::FeatureInfo() { |
| 102 static const GLenum kAlphaTypes[] = { | 103 static const GLenum kAlphaTypes[] = { |
| 103 GL_UNSIGNED_BYTE, | 104 GL_UNSIGNED_BYTE, |
| 104 }; | 105 }; |
| 105 static const GLenum kRGBTypes[] = { | 106 static const GLenum kRGBTypes[] = { |
| 106 GL_UNSIGNED_BYTE, | 107 GL_UNSIGNED_BYTE, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 static GLenum string_ids[] = { | 162 static GLenum string_ids[] = { |
| 162 GL_VENDOR, | 163 GL_VENDOR, |
| 163 GL_RENDERER, | 164 GL_RENDERER, |
| 164 }; | 165 }; |
| 165 bool is_intel = false; | 166 bool is_intel = false; |
| 166 bool is_nvidia = false; | 167 bool is_nvidia = false; |
| 167 bool is_amd = false; | 168 bool is_amd = false; |
| 168 bool is_mesa = false; | 169 bool is_mesa = false; |
| 169 bool is_qualcomm = false; | 170 bool is_qualcomm = false; |
| 170 bool is_imagination = false; | 171 bool is_imagination = false; |
| 172 bool is_arm = false; |
| 171 for (size_t ii = 0; ii < arraysize(string_ids); ++ii) { | 173 for (size_t ii = 0; ii < arraysize(string_ids); ++ii) { |
| 172 const char* str = reinterpret_cast<const char*>( | 174 const char* str = reinterpret_cast<const char*>( |
| 173 glGetString(string_ids[ii])); | 175 glGetString(string_ids[ii])); |
| 174 if (str) { | 176 if (str) { |
| 175 std::string lstr(StringToLowerASCII(std::string(str))); | 177 std::string lstr(StringToLowerASCII(std::string(str))); |
| 176 StringSet string_set(lstr); | 178 StringSet string_set(lstr); |
| 177 is_intel |= string_set.Contains("intel"); | 179 is_intel |= string_set.Contains("intel"); |
| 178 is_nvidia |= string_set.Contains("nvidia"); | 180 is_nvidia |= string_set.Contains("nvidia"); |
| 179 is_amd |= string_set.Contains("amd") || string_set.Contains("ati"); | 181 is_amd |= string_set.Contains("amd") || string_set.Contains("ati"); |
| 180 is_mesa |= string_set.Contains("mesa"); | 182 is_mesa |= string_set.Contains("mesa"); |
| 181 is_qualcomm |= string_set.Contains("qualcomm"); | 183 is_qualcomm |= string_set.Contains("qualcomm"); |
| 182 is_imagination |= string_set.Contains("imagination"); | 184 is_imagination |= string_set.Contains("imagination"); |
| 185 is_arm |= string_set.Contains("arm"); |
| 183 } | 186 } |
| 184 } | 187 } |
| 185 | 188 |
| 186 feature_flags_.disable_workarounds = | 189 feature_flags_.disable_workarounds = |
| 187 CommandLine::ForCurrentProcess()->HasSwitch( | 190 CommandLine::ForCurrentProcess()->HasSwitch( |
| 188 switches::kDisableGpuDriverBugWorkarounds); | 191 switches::kDisableGpuDriverBugWorkarounds); |
| 189 | 192 |
| 190 feature_flags_.enable_shader_name_hashing = | 193 feature_flags_.enable_shader_name_hashing = |
| 191 !CommandLine::ForCurrentProcess()->HasSwitch( | 194 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 192 switches::kDisableShaderNameHashing); | 195 switches::kDisableShaderNameHashing); |
| 193 | 196 |
| 194 | |
| 195 bool npot_ok = false; | 197 bool npot_ok = false; |
| 196 | 198 |
| 197 AddExtensionString("GL_ANGLE_translated_shader_source"); | 199 AddExtensionString("GL_ANGLE_translated_shader_source"); |
| 198 AddExtensionString("GL_CHROMIUM_async_pixel_transfers"); | 200 AddExtensionString("GL_CHROMIUM_async_pixel_transfers"); |
| 199 AddExtensionString("GL_CHROMIUM_bind_uniform_location"); | 201 AddExtensionString("GL_CHROMIUM_bind_uniform_location"); |
| 200 AddExtensionString("GL_CHROMIUM_command_buffer_query"); | 202 AddExtensionString("GL_CHROMIUM_command_buffer_query"); |
| 201 AddExtensionString("GL_CHROMIUM_command_buffer_latency_query"); | 203 AddExtensionString("GL_CHROMIUM_command_buffer_latency_query"); |
| 202 AddExtensionString("GL_CHROMIUM_copy_texture"); | 204 AddExtensionString("GL_CHROMIUM_copy_texture"); |
| 203 AddExtensionString("GL_CHROMIUM_discard_backbuffer"); | 205 AddExtensionString("GL_CHROMIUM_discard_backbuffer"); |
| 204 AddExtensionString("GL_CHROMIUM_get_error_query"); | 206 AddExtensionString("GL_CHROMIUM_get_error_query"); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 } | 332 } |
| 331 validators_.render_buffer_format.AddValue(GL_DEPTH24_STENCIL8); | 333 validators_.render_buffer_format.AddValue(GL_DEPTH24_STENCIL8); |
| 332 } | 334 } |
| 333 | 335 |
| 334 if (extensions.Contains("GL_OES_vertex_array_object") || | 336 if (extensions.Contains("GL_OES_vertex_array_object") || |
| 335 extensions.Contains("GL_ARB_vertex_array_object") || | 337 extensions.Contains("GL_ARB_vertex_array_object") || |
| 336 extensions.Contains("GL_APPLE_vertex_array_object")) { | 338 extensions.Contains("GL_APPLE_vertex_array_object")) { |
| 337 feature_flags_.native_vertex_array_object = true; | 339 feature_flags_.native_vertex_array_object = true; |
| 338 } | 340 } |
| 339 | 341 |
| 342 // If the driver doesn't like uploading lots of buffer data constantly |
| 343 // work around it by using client side arrays. |
| 344 if (is_arm || is_imagination) { |
| 345 workarounds_.use_client_side_arrays_for_stream_buffers = true; |
| 346 } |
| 347 |
| 348 // If we're using client_side_arrays we have to emulate |
| 349 // vertex array objects since vertex array objects do not work |
| 350 // with client side arrays. |
| 351 if (workarounds_.use_client_side_arrays_for_stream_buffers) { |
| 352 feature_flags_.native_vertex_array_object = false; |
| 353 } |
| 354 |
| 340 if (extensions.Contains("GL_OES_element_index_uint") || | 355 if (extensions.Contains("GL_OES_element_index_uint") || |
| 341 gfx::HasDesktopGLFeatures()) { | 356 gfx::HasDesktopGLFeatures()) { |
| 342 AddExtensionString("GL_OES_element_index_uint"); | 357 AddExtensionString("GL_OES_element_index_uint"); |
| 343 validators_.index_type.AddValue(GL_UNSIGNED_INT); | 358 validators_.index_type.AddValue(GL_UNSIGNED_INT); |
| 344 } | 359 } |
| 345 | 360 |
| 346 bool enable_texture_format_bgra8888 = false; | 361 bool enable_texture_format_bgra8888 = false; |
| 347 bool enable_read_format_bgra = false; | 362 bool enable_read_format_bgra = false; |
| 348 // Check if we should allow GL_EXT_texture_format_BGRA8888 | 363 // Check if we should allow GL_EXT_texture_format_BGRA8888 |
| 349 if (extensions.Contains("GL_EXT_texture_format_BGRA8888") || | 364 if (extensions.Contains("GL_EXT_texture_format_BGRA8888") || |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 if (extensions_.find(str) == std::string::npos) { | 669 if (extensions_.find(str) == std::string::npos) { |
| 655 extensions_ += (extensions_.empty() ? "" : " ") + str; | 670 extensions_ += (extensions_.empty() ? "" : " ") + str; |
| 656 } | 671 } |
| 657 } | 672 } |
| 658 | 673 |
| 659 FeatureInfo::~FeatureInfo() { | 674 FeatureInfo::~FeatureInfo() { |
| 660 } | 675 } |
| 661 | 676 |
| 662 } // namespace gles2 | 677 } // namespace gles2 |
| 663 } // namespace gpu | 678 } // namespace gpu |
| OLD | NEW |