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/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 angle_pack_reverse_row_order(false), | 110 angle_pack_reverse_row_order(false), |
111 arb_texture_rectangle(false), | 111 arb_texture_rectangle(false), |
112 angle_instanced_arrays(false), | 112 angle_instanced_arrays(false), |
113 occlusion_query_boolean(false), | 113 occlusion_query_boolean(false), |
114 use_arb_occlusion_query2_for_occlusion_query_boolean(false), | 114 use_arb_occlusion_query2_for_occlusion_query_boolean(false), |
115 use_arb_occlusion_query_for_occlusion_query_boolean(false), | 115 use_arb_occlusion_query_for_occlusion_query_boolean(false), |
116 native_vertex_array_object(false), | 116 native_vertex_array_object(false), |
117 enable_shader_name_hashing(false), | 117 enable_shader_name_hashing(false), |
118 enable_samplers(false), | 118 enable_samplers(false), |
119 ext_draw_buffers(false), | 119 ext_draw_buffers(false), |
120 ext_frag_depth(false) { | 120 ext_frag_depth(false), |
| 121 use_async_readpixels(false) { |
121 } | 122 } |
122 | 123 |
123 FeatureInfo::Workarounds::Workarounds() : | 124 FeatureInfo::Workarounds::Workarounds() : |
124 #define GPU_OP(type, name) name(false), | 125 #define GPU_OP(type, name) name(false), |
125 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) | 126 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) |
126 #undef GPU_OP | 127 #undef GPU_OP |
127 max_texture_size(0), | 128 max_texture_size(0), |
128 max_cube_map_texture_size(0) { | 129 max_cube_map_texture_size(0) { |
129 } | 130 } |
130 | 131 |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 ++i) { | 617 ++i) { |
617 validators_.g_l_state.AddValue(i); | 618 validators_.g_l_state.AddValue(i); |
618 } | 619 } |
619 } | 620 } |
620 | 621 |
621 if (extensions.Contains("GL_EXT_frag_depth") || gfx::HasDesktopGLFeatures()) { | 622 if (extensions.Contains("GL_EXT_frag_depth") || gfx::HasDesktopGLFeatures()) { |
622 AddExtensionString("GL_EXT_frag_depth"); | 623 AddExtensionString("GL_EXT_frag_depth"); |
623 feature_flags_.ext_frag_depth = true; | 624 feature_flags_.ext_frag_depth = true; |
624 } | 625 } |
625 | 626 |
| 627 bool ui_gl_fence_works = |
| 628 extensions.Contains("GL_NV_fence") || |
| 629 extensions.Contains("GL_ARB_sync"); |
| 630 |
| 631 if (ui_gl_fence_works && |
| 632 extensions.Contains("GL_ARB_pixel_buffer_object") && |
| 633 !workarounds_.disable_async_readpixels) { |
| 634 feature_flags_.use_async_readpixels = true; |
| 635 } |
| 636 |
626 if (!disallowed_features_.swap_buffer_complete_callback) | 637 if (!disallowed_features_.swap_buffer_complete_callback) |
627 AddExtensionString("GL_CHROMIUM_swapbuffers_complete_callback"); | 638 AddExtensionString("GL_CHROMIUM_swapbuffers_complete_callback"); |
628 | 639 |
629 bool is_es3 = false; | 640 bool is_es3 = false; |
630 const char* str = reinterpret_cast<const char*>(glGetString(GL_VERSION)); | 641 const char* str = reinterpret_cast<const char*>(glGetString(GL_VERSION)); |
631 if (str) { | 642 if (str) { |
632 std::string lstr(StringToLowerASCII(std::string(str))); | 643 std::string lstr(StringToLowerASCII(std::string(str))); |
633 is_es3 = (lstr.substr(0, 12) == "opengl es 3."); | 644 is_es3 = (lstr.substr(0, 12) == "opengl es 3."); |
634 } | 645 } |
635 | 646 |
636 if (is_es3 || extensions.Contains("GL_ARB_sampler_objects")) { | 647 if (is_es3 || extensions.Contains("GL_ARB_sampler_objects")) { |
637 feature_flags_.enable_samplers = true; | 648 feature_flags_.enable_samplers = true; |
638 // TODO(dsinclair): Add AddExtensionString("GL_CHROMIUM_sampler_objects") | 649 // TODO(dsinclair): Add AddExtensionString("GL_CHROMIUM_sampler_objects") |
639 // when available. | 650 // when available. |
640 } | 651 } |
641 } | 652 } |
642 | 653 |
643 void FeatureInfo::AddExtensionString(const std::string& str) { | 654 void FeatureInfo::AddExtensionString(const std::string& str) { |
644 if (extensions_.find(str) == std::string::npos) { | 655 if (extensions_.find(str) == std::string::npos) { |
645 extensions_ += (extensions_.empty() ? "" : " ") + str; | 656 extensions_ += (extensions_.empty() ? "" : " ") + str; |
646 } | 657 } |
647 } | 658 } |
648 | 659 |
649 FeatureInfo::~FeatureInfo() { | 660 FeatureInfo::~FeatureInfo() { |
650 } | 661 } |
651 | 662 |
652 } // namespace gles2 | 663 } // namespace gles2 |
653 } // namespace gpu | 664 } // namespace gpu |
OLD | NEW |