Chromium Code Reviews| 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 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 688 validators_.g_l_state.AddValue(GL_MAX_DRAW_BUFFERS_ARB); | 689 validators_.g_l_state.AddValue(GL_MAX_DRAW_BUFFERS_ARB); |
| 689 GLint max_draw_buffers = 0; | 690 GLint max_draw_buffers = 0; |
| 690 glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &max_draw_buffers); | 691 glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &max_draw_buffers); |
| 691 for (GLenum i = GL_DRAW_BUFFER0_ARB; | 692 for (GLenum i = GL_DRAW_BUFFER0_ARB; |
| 692 i < static_cast<GLenum>(GL_DRAW_BUFFER0_ARB + max_draw_buffers); | 693 i < static_cast<GLenum>(GL_DRAW_BUFFER0_ARB + max_draw_buffers); |
| 693 ++i) { | 694 ++i) { |
| 694 validators_.g_l_state.AddValue(i); | 695 validators_.g_l_state.AddValue(i); |
| 695 } | 696 } |
| 696 } | 697 } |
| 697 | 698 |
| 699 if (extensions.Contains("GL_EXT_frag_depth") || gfx::HasDesktopGLFeatures()) { | |
| 700 AddExtensionString("GL_EXT_frag_depth"); | |
|
greggman
2013/05/28 18:17:58
needs feature_flags_.ext_frag_depth = true;
| |
| 701 } | |
| 702 | |
| 698 if (!disallowed_features_.swap_buffer_complete_callback) | 703 if (!disallowed_features_.swap_buffer_complete_callback) |
| 699 AddExtensionString("GL_CHROMIUM_swapbuffers_complete_callback"); | 704 AddExtensionString("GL_CHROMIUM_swapbuffers_complete_callback"); |
| 700 | 705 |
| 701 bool is_es3 = false; | 706 bool is_es3 = false; |
| 702 const char* str = reinterpret_cast<const char*>(glGetString(GL_VERSION)); | 707 const char* str = reinterpret_cast<const char*>(glGetString(GL_VERSION)); |
| 703 if (str) { | 708 if (str) { |
| 704 std::string lstr(StringToLowerASCII(std::string(str))); | 709 std::string lstr(StringToLowerASCII(std::string(str))); |
| 705 is_es3 = (lstr.substr(0, 12) == "opengl es 3."); | 710 is_es3 = (lstr.substr(0, 12) == "opengl es 3."); |
| 706 } | 711 } |
| 707 | 712 |
| 708 if (is_es3 || extensions.Contains("GL_ARB_sampler_objects")) { | 713 if (is_es3 || extensions.Contains("GL_ARB_sampler_objects")) { |
| 709 feature_flags_.enable_samplers = true; | 714 feature_flags_.enable_samplers = true; |
| 710 // TODO(dsinclair): Add AddExtensionString("GL_CHROMIUM_sampler_objects") | 715 // TODO(dsinclair): Add AddExtensionString("GL_CHROMIUM_sampler_objects") |
| 711 // when available. | 716 // when available. |
| 712 } | 717 } |
| 713 } | 718 } |
| 714 | 719 |
| 715 void FeatureInfo::AddExtensionString(const std::string& str) { | 720 void FeatureInfo::AddExtensionString(const std::string& str) { |
| 716 if (extensions_.find(str) == std::string::npos) { | 721 if (extensions_.find(str) == std::string::npos) { |
| 717 extensions_ += (extensions_.empty() ? "" : " ") + str; | 722 extensions_ += (extensions_.empty() ? "" : " ") + str; |
| 718 } | 723 } |
| 719 } | 724 } |
| 720 | 725 |
| 721 FeatureInfo::~FeatureInfo() { | 726 FeatureInfo::~FeatureInfo() { |
| 722 } | 727 } |
| 723 | 728 |
| 724 } // namespace gles2 | 729 } // namespace gles2 |
| 725 } // namespace gpu | 730 } // namespace gpu |
| OLD | NEW |