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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 angle_pack_reverse_row_order(false), | 112 angle_pack_reverse_row_order(false), |
113 arb_texture_rectangle(false), | 113 arb_texture_rectangle(false), |
114 angle_instanced_arrays(false), | 114 angle_instanced_arrays(false), |
115 occlusion_query_boolean(false), | 115 occlusion_query_boolean(false), |
116 use_arb_occlusion_query2_for_occlusion_query_boolean(false), | 116 use_arb_occlusion_query2_for_occlusion_query_boolean(false), |
117 use_arb_occlusion_query_for_occlusion_query_boolean(false), | 117 use_arb_occlusion_query_for_occlusion_query_boolean(false), |
118 native_vertex_array_object(false), | 118 native_vertex_array_object(false), |
119 enable_shader_name_hashing(false), | 119 enable_shader_name_hashing(false), |
120 enable_samplers(false), | 120 enable_samplers(false), |
121 ext_draw_buffers(false), | 121 ext_draw_buffers(false), |
122 ext_frag_depth(false) { | 122 ext_frag_depth(false), |
| 123 use_async_readpixels(false) { |
123 } | 124 } |
124 | 125 |
125 FeatureInfo::Workarounds::Workarounds() : | 126 FeatureInfo::Workarounds::Workarounds() : |
126 #define GPU_OP(type, name) name(false), | 127 #define GPU_OP(type, name) name(false), |
127 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) | 128 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) |
128 #undef GPU_OP | 129 #undef GPU_OP |
129 max_texture_size(0), | 130 max_texture_size(0), |
130 max_cube_map_texture_size(0) { | 131 max_cube_map_texture_size(0) { |
131 } | 132 } |
132 | 133 |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 ++i) { | 636 ++i) { |
636 validators_.g_l_state.AddValue(i); | 637 validators_.g_l_state.AddValue(i); |
637 } | 638 } |
638 } | 639 } |
639 | 640 |
640 if (extensions.Contains("GL_EXT_frag_depth") || gfx::HasDesktopGLFeatures()) { | 641 if (extensions.Contains("GL_EXT_frag_depth") || gfx::HasDesktopGLFeatures()) { |
641 AddExtensionString("GL_EXT_frag_depth"); | 642 AddExtensionString("GL_EXT_frag_depth"); |
642 feature_flags_.ext_frag_depth = true; | 643 feature_flags_.ext_frag_depth = true; |
643 } | 644 } |
644 | 645 |
| 646 bool ui_gl_fence_works = |
| 647 extensions.Contains("GL_NV_fence") || |
| 648 extensions.Contains("GL_ARB_sync"); |
| 649 |
| 650 if (ui_gl_fence_works && |
| 651 extensions.Contains("GL_ARB_pixel_buffer_object") && |
| 652 !workarounds_.disable_async_readpixels) { |
| 653 feature_flags_.use_async_readpixels = true; |
| 654 } |
| 655 |
645 if (!disallowed_features_.swap_buffer_complete_callback) | 656 if (!disallowed_features_.swap_buffer_complete_callback) |
646 AddExtensionString("GL_CHROMIUM_swapbuffers_complete_callback"); | 657 AddExtensionString("GL_CHROMIUM_swapbuffers_complete_callback"); |
647 | 658 |
648 bool is_es3 = false; | 659 bool is_es3 = false; |
649 const char* str = reinterpret_cast<const char*>(glGetString(GL_VERSION)); | 660 const char* str = reinterpret_cast<const char*>(glGetString(GL_VERSION)); |
650 if (str) { | 661 if (str) { |
651 std::string lstr(StringToLowerASCII(std::string(str))); | 662 std::string lstr(StringToLowerASCII(std::string(str))); |
652 is_es3 = (lstr.substr(0, 12) == "opengl es 3."); | 663 is_es3 = (lstr.substr(0, 12) == "opengl es 3."); |
653 } | 664 } |
654 | 665 |
655 if (is_es3 || extensions.Contains("GL_ARB_sampler_objects")) { | 666 if (is_es3 || extensions.Contains("GL_ARB_sampler_objects")) { |
656 feature_flags_.enable_samplers = true; | 667 feature_flags_.enable_samplers = true; |
657 // TODO(dsinclair): Add AddExtensionString("GL_CHROMIUM_sampler_objects") | 668 // TODO(dsinclair): Add AddExtensionString("GL_CHROMIUM_sampler_objects") |
658 // when available. | 669 // when available. |
659 } | 670 } |
660 } | 671 } |
661 | 672 |
662 void FeatureInfo::AddExtensionString(const std::string& str) { | 673 void FeatureInfo::AddExtensionString(const std::string& str) { |
663 if (extensions_.find(str) == std::string::npos) { | 674 if (extensions_.find(str) == std::string::npos) { |
664 extensions_ += (extensions_.empty() ? "" : " ") + str; | 675 extensions_ += (extensions_.empty() ? "" : " ") + str; |
665 } | 676 } |
666 } | 677 } |
667 | 678 |
668 FeatureInfo::~FeatureInfo() { | 679 FeatureInfo::~FeatureInfo() { |
669 } | 680 } |
670 | 681 |
671 } // namespace gles2 | 682 } // namespace gles2 |
672 } // namespace gpu | 683 } // namespace gpu |
OLD | NEW |