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_util.h" | 10 #include "base/string_util.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 angle_translated_shader_source(false), | 108 angle_translated_shader_source(false), |
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 } | 120 } |
120 | 121 |
121 FeatureInfo::Workarounds::Workarounds() : | 122 FeatureInfo::Workarounds::Workarounds() : |
122 #define GPU_OP(type, name) name(false), | 123 #define GPU_OP(type, name) name(false), |
123 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) | 124 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) |
124 #undef GPU_OP | 125 #undef GPU_OP |
125 max_texture_size(0), | 126 max_texture_size(0), |
126 max_cube_map_texture_size(0) { | 127 max_cube_map_texture_size(0) { |
127 } | 128 } |
128 | 129 |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 validators_.g_l_state.AddValue(GL_MAX_DRAW_BUFFERS_ARB); | 610 validators_.g_l_state.AddValue(GL_MAX_DRAW_BUFFERS_ARB); |
610 GLint max_draw_buffers = 0; | 611 GLint max_draw_buffers = 0; |
611 glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &max_draw_buffers); | 612 glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &max_draw_buffers); |
612 for (GLenum i = GL_DRAW_BUFFER0_ARB; | 613 for (GLenum i = GL_DRAW_BUFFER0_ARB; |
613 i < static_cast<GLenum>(GL_DRAW_BUFFER0_ARB + max_draw_buffers); | 614 i < static_cast<GLenum>(GL_DRAW_BUFFER0_ARB + max_draw_buffers); |
614 ++i) { | 615 ++i) { |
615 validators_.g_l_state.AddValue(i); | 616 validators_.g_l_state.AddValue(i); |
616 } | 617 } |
617 } | 618 } |
618 | 619 |
| 620 if (extensions.Contains("GL_EXT_frag_depth") || gfx::HasDesktopGLFeatures()) { |
| 621 AddExtensionString("GL_EXT_frag_depth"); |
| 622 feature_flags_.ext_frag_depth = true; |
| 623 } |
| 624 |
619 if (!disallowed_features_.swap_buffer_complete_callback) | 625 if (!disallowed_features_.swap_buffer_complete_callback) |
620 AddExtensionString("GL_CHROMIUM_swapbuffers_complete_callback"); | 626 AddExtensionString("GL_CHROMIUM_swapbuffers_complete_callback"); |
621 | 627 |
622 bool is_es3 = false; | 628 bool is_es3 = false; |
623 const char* str = reinterpret_cast<const char*>(glGetString(GL_VERSION)); | 629 const char* str = reinterpret_cast<const char*>(glGetString(GL_VERSION)); |
624 if (str) { | 630 if (str) { |
625 std::string lstr(StringToLowerASCII(std::string(str))); | 631 std::string lstr(StringToLowerASCII(std::string(str))); |
626 is_es3 = (lstr.substr(0, 12) == "opengl es 3."); | 632 is_es3 = (lstr.substr(0, 12) == "opengl es 3."); |
627 } | 633 } |
628 | 634 |
629 if (is_es3 || extensions.Contains("GL_ARB_sampler_objects")) { | 635 if (is_es3 || extensions.Contains("GL_ARB_sampler_objects")) { |
630 feature_flags_.enable_samplers = true; | 636 feature_flags_.enable_samplers = true; |
631 // TODO(dsinclair): Add AddExtensionString("GL_CHROMIUM_sampler_objects") | 637 // TODO(dsinclair): Add AddExtensionString("GL_CHROMIUM_sampler_objects") |
632 // when available. | 638 // when available. |
633 } | 639 } |
634 } | 640 } |
635 | 641 |
636 void FeatureInfo::AddExtensionString(const std::string& str) { | 642 void FeatureInfo::AddExtensionString(const std::string& str) { |
637 if (extensions_.find(str) == std::string::npos) { | 643 if (extensions_.find(str) == std::string::npos) { |
638 extensions_ += (extensions_.empty() ? "" : " ") + str; | 644 extensions_ += (extensions_.empty() ? "" : " ") + str; |
639 } | 645 } |
640 } | 646 } |
641 | 647 |
642 FeatureInfo::~FeatureInfo() { | 648 FeatureInfo::~FeatureInfo() { |
643 } | 649 } |
644 | 650 |
645 } // namespace gles2 | 651 } // namespace gles2 |
646 } // namespace gpu | 652 } // namespace gpu |
OLD | NEW |