| 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), | |
| 98 max_texture_size(0), | 97 max_texture_size(0), |
| 99 max_cube_map_texture_size(0) { | 98 max_cube_map_texture_size(0) { |
| 100 } | 99 } |
| 101 | 100 |
| 102 FeatureInfo::FeatureInfo() { | 101 FeatureInfo::FeatureInfo() { |
| 103 static const GLenum kAlphaTypes[] = { | 102 static const GLenum kAlphaTypes[] = { |
| 104 GL_UNSIGNED_BYTE, | 103 GL_UNSIGNED_BYTE, |
| 105 }; | 104 }; |
| 106 static const GLenum kRGBTypes[] = { | 105 static const GLenum kRGBTypes[] = { |
| 107 GL_UNSIGNED_BYTE, | 106 GL_UNSIGNED_BYTE, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 static GLenum string_ids[] = { | 161 static GLenum string_ids[] = { |
| 163 GL_VENDOR, | 162 GL_VENDOR, |
| 164 GL_RENDERER, | 163 GL_RENDERER, |
| 165 }; | 164 }; |
| 166 bool is_intel = false; | 165 bool is_intel = false; |
| 167 bool is_nvidia = false; | 166 bool is_nvidia = false; |
| 168 bool is_amd = false; | 167 bool is_amd = false; |
| 169 bool is_mesa = false; | 168 bool is_mesa = false; |
| 170 bool is_qualcomm = false; | 169 bool is_qualcomm = false; |
| 171 bool is_imagination = false; | 170 bool is_imagination = false; |
| 172 bool is_arm = false; | |
| 173 for (size_t ii = 0; ii < arraysize(string_ids); ++ii) { | 171 for (size_t ii = 0; ii < arraysize(string_ids); ++ii) { |
| 174 const char* str = reinterpret_cast<const char*>( | 172 const char* str = reinterpret_cast<const char*>( |
| 175 glGetString(string_ids[ii])); | 173 glGetString(string_ids[ii])); |
| 176 if (str) { | 174 if (str) { |
| 177 std::string lstr(StringToLowerASCII(std::string(str))); | 175 std::string lstr(StringToLowerASCII(std::string(str))); |
| 178 StringSet string_set(lstr); | 176 StringSet string_set(lstr); |
| 179 is_intel |= string_set.Contains("intel"); | 177 is_intel |= string_set.Contains("intel"); |
| 180 is_nvidia |= string_set.Contains("nvidia"); | 178 is_nvidia |= string_set.Contains("nvidia"); |
| 181 is_amd |= string_set.Contains("amd") || string_set.Contains("ati"); | 179 is_amd |= string_set.Contains("amd") || string_set.Contains("ati"); |
| 182 is_mesa |= string_set.Contains("mesa"); | 180 is_mesa |= string_set.Contains("mesa"); |
| 183 is_qualcomm |= string_set.Contains("qualcomm"); | 181 is_qualcomm |= string_set.Contains("qualcomm"); |
| 184 is_imagination |= string_set.Contains("imagination"); | 182 is_imagination |= string_set.Contains("imagination"); |
| 185 is_arm |= string_set.Contains("arm"); | |
| 186 } | 183 } |
| 187 } | 184 } |
| 188 | 185 |
| 189 feature_flags_.disable_workarounds = | 186 feature_flags_.disable_workarounds = |
| 190 CommandLine::ForCurrentProcess()->HasSwitch( | 187 CommandLine::ForCurrentProcess()->HasSwitch( |
| 191 switches::kDisableGpuDriverBugWorkarounds); | 188 switches::kDisableGpuDriverBugWorkarounds); |
| 192 | 189 |
| 193 feature_flags_.enable_shader_name_hashing = | 190 feature_flags_.enable_shader_name_hashing = |
| 194 !CommandLine::ForCurrentProcess()->HasSwitch( | 191 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 195 switches::kDisableShaderNameHashing); | 192 switches::kDisableShaderNameHashing); |
| 196 | 193 |
| 194 |
| 197 bool npot_ok = false; | 195 bool npot_ok = false; |
| 198 | 196 |
| 199 AddExtensionString("GL_ANGLE_translated_shader_source"); | 197 AddExtensionString("GL_ANGLE_translated_shader_source"); |
| 200 AddExtensionString("GL_CHROMIUM_async_pixel_transfers"); | 198 AddExtensionString("GL_CHROMIUM_async_pixel_transfers"); |
| 201 AddExtensionString("GL_CHROMIUM_bind_uniform_location"); | 199 AddExtensionString("GL_CHROMIUM_bind_uniform_location"); |
| 202 AddExtensionString("GL_CHROMIUM_command_buffer_query"); | 200 AddExtensionString("GL_CHROMIUM_command_buffer_query"); |
| 203 AddExtensionString("GL_CHROMIUM_command_buffer_latency_query"); | 201 AddExtensionString("GL_CHROMIUM_command_buffer_latency_query"); |
| 204 AddExtensionString("GL_CHROMIUM_copy_texture"); | 202 AddExtensionString("GL_CHROMIUM_copy_texture"); |
| 205 AddExtensionString("GL_CHROMIUM_discard_backbuffer"); | 203 AddExtensionString("GL_CHROMIUM_discard_backbuffer"); |
| 206 AddExtensionString("GL_CHROMIUM_get_error_query"); | 204 AddExtensionString("GL_CHROMIUM_get_error_query"); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 } | 330 } |
| 333 validators_.render_buffer_format.AddValue(GL_DEPTH24_STENCIL8); | 331 validators_.render_buffer_format.AddValue(GL_DEPTH24_STENCIL8); |
| 334 } | 332 } |
| 335 | 333 |
| 336 if (extensions.Contains("GL_OES_vertex_array_object") || | 334 if (extensions.Contains("GL_OES_vertex_array_object") || |
| 337 extensions.Contains("GL_ARB_vertex_array_object") || | 335 extensions.Contains("GL_ARB_vertex_array_object") || |
| 338 extensions.Contains("GL_APPLE_vertex_array_object")) { | 336 extensions.Contains("GL_APPLE_vertex_array_object")) { |
| 339 feature_flags_.native_vertex_array_object = true; | 337 feature_flags_.native_vertex_array_object = true; |
| 340 } | 338 } |
| 341 | 339 |
| 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 | |
| 355 if (extensions.Contains("GL_OES_element_index_uint") || | 340 if (extensions.Contains("GL_OES_element_index_uint") || |
| 356 gfx::HasDesktopGLFeatures()) { | 341 gfx::HasDesktopGLFeatures()) { |
| 357 AddExtensionString("GL_OES_element_index_uint"); | 342 AddExtensionString("GL_OES_element_index_uint"); |
| 358 validators_.index_type.AddValue(GL_UNSIGNED_INT); | 343 validators_.index_type.AddValue(GL_UNSIGNED_INT); |
| 359 } | 344 } |
| 360 | 345 |
| 361 bool enable_texture_format_bgra8888 = false; | 346 bool enable_texture_format_bgra8888 = false; |
| 362 bool enable_read_format_bgra = false; | 347 bool enable_read_format_bgra = false; |
| 363 // Check if we should allow GL_EXT_texture_format_BGRA8888 | 348 // Check if we should allow GL_EXT_texture_format_BGRA8888 |
| 364 if (extensions.Contains("GL_EXT_texture_format_BGRA8888") || | 349 if (extensions.Contains("GL_EXT_texture_format_BGRA8888") || |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 if (extensions_.find(str) == std::string::npos) { | 654 if (extensions_.find(str) == std::string::npos) { |
| 670 extensions_ += (extensions_.empty() ? "" : " ") + str; | 655 extensions_ += (extensions_.empty() ? "" : " ") + str; |
| 671 } | 656 } |
| 672 } | 657 } |
| 673 | 658 |
| 674 FeatureInfo::~FeatureInfo() { | 659 FeatureInfo::~FeatureInfo() { |
| 675 } | 660 } |
| 676 | 661 |
| 677 } // namespace gles2 | 662 } // namespace gles2 |
| 678 } // namespace gpu | 663 } // namespace gpu |
| OLD | NEW |