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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 angle_pack_reverse_row_order(false), | 109 angle_pack_reverse_row_order(false), |
110 arb_texture_rectangle(false), | 110 arb_texture_rectangle(false), |
111 angle_instanced_arrays(false), | 111 angle_instanced_arrays(false), |
112 occlusion_query_boolean(false), | 112 occlusion_query_boolean(false), |
113 use_arb_occlusion_query2_for_occlusion_query_boolean(false), | 113 use_arb_occlusion_query2_for_occlusion_query_boolean(false), |
114 use_arb_occlusion_query_for_occlusion_query_boolean(false), | 114 use_arb_occlusion_query_for_occlusion_query_boolean(false), |
115 native_vertex_array_object(false), | 115 native_vertex_array_object(false), |
116 enable_shader_name_hashing(false), | 116 enable_shader_name_hashing(false), |
117 enable_samplers(false), | 117 enable_samplers(false), |
118 ext_draw_buffers(false), | 118 ext_draw_buffers(false), |
119 ext_frag_depth(false) { | 119 ext_frag_depth(false), |
120 use_async_readpixels(false) { | |
120 } | 121 } |
121 | 122 |
122 FeatureInfo::Workarounds::Workarounds() : | 123 FeatureInfo::Workarounds::Workarounds() : |
123 #define GPU_OP(type, name) name(false), | 124 #define GPU_OP(type, name) name(false), |
124 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) | 125 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) |
125 #undef GPU_OP | 126 #undef GPU_OP |
126 max_texture_size(0), | 127 max_texture_size(0), |
127 max_cube_map_texture_size(0) { | 128 max_cube_map_texture_size(0) { |
128 } | 129 } |
129 | 130 |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
615 ++i) { | 616 ++i) { |
616 validators_.g_l_state.AddValue(i); | 617 validators_.g_l_state.AddValue(i); |
617 } | 618 } |
618 } | 619 } |
619 | 620 |
620 if (extensions.Contains("GL_EXT_frag_depth") || gfx::HasDesktopGLFeatures()) { | 621 if (extensions.Contains("GL_EXT_frag_depth") || gfx::HasDesktopGLFeatures()) { |
621 AddExtensionString("GL_EXT_frag_depth"); | 622 AddExtensionString("GL_EXT_frag_depth"); |
622 feature_flags_.ext_frag_depth = true; | 623 feature_flags_.ext_frag_depth = true; |
623 } | 624 } |
624 | 625 |
626 bool ui_gl_fence_works = | |
627 extensions.Contains("GL_NV_fence") || | |
628 extensions.Contains("GL_ARB_sync"); | |
629 | |
630 if (ui_gl_fence_works && | |
631 extensions.Contains("GL_ARB_pixel_buffer_object") && | |
632 !command_line.HasSwitch(switches::kForceSynchronousGLReadPixels)) { | |
piman
2013/06/17 19:55:06
nit: fold the command line option into the kGpuDri
hubbe
2013/06/25 20:02:51
Entry added, not sure exactly how it's supposed to
| |
633 feature_flags_.use_async_readpixels = true; | |
634 } | |
635 | |
625 if (!disallowed_features_.swap_buffer_complete_callback) | 636 if (!disallowed_features_.swap_buffer_complete_callback) |
626 AddExtensionString("GL_CHROMIUM_swapbuffers_complete_callback"); | 637 AddExtensionString("GL_CHROMIUM_swapbuffers_complete_callback"); |
627 | 638 |
628 bool is_es3 = false; | 639 bool is_es3 = false; |
629 const char* str = reinterpret_cast<const char*>(glGetString(GL_VERSION)); | 640 const char* str = reinterpret_cast<const char*>(glGetString(GL_VERSION)); |
630 if (str) { | 641 if (str) { |
631 std::string lstr(StringToLowerASCII(std::string(str))); | 642 std::string lstr(StringToLowerASCII(std::string(str))); |
632 is_es3 = (lstr.substr(0, 12) == "opengl es 3."); | 643 is_es3 = (lstr.substr(0, 12) == "opengl es 3."); |
633 } | 644 } |
634 | 645 |
635 if (is_es3 || extensions.Contains("GL_ARB_sampler_objects")) { | 646 if (is_es3 || extensions.Contains("GL_ARB_sampler_objects")) { |
636 feature_flags_.enable_samplers = true; | 647 feature_flags_.enable_samplers = true; |
637 // TODO(dsinclair): Add AddExtensionString("GL_CHROMIUM_sampler_objects") | 648 // TODO(dsinclair): Add AddExtensionString("GL_CHROMIUM_sampler_objects") |
638 // when available. | 649 // when available. |
639 } | 650 } |
640 } | 651 } |
641 | 652 |
642 void FeatureInfo::AddExtensionString(const std::string& str) { | 653 void FeatureInfo::AddExtensionString(const std::string& str) { |
643 if (extensions_.find(str) == std::string::npos) { | 654 if (extensions_.find(str) == std::string::npos) { |
644 extensions_ += (extensions_.empty() ? "" : " ") + str; | 655 extensions_ += (extensions_.empty() ? "" : " ") + str; |
645 } | 656 } |
646 } | 657 } |
647 | 658 |
648 FeatureInfo::~FeatureInfo() { | 659 FeatureInfo::~FeatureInfo() { |
649 } | 660 } |
650 | 661 |
651 } // namespace gles2 | 662 } // namespace gles2 |
652 } // namespace gpu | 663 } // namespace gpu |
OLD | NEW |