| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 #include "gpu/command_buffer/service/feature_info.h" | 7 #include "gpu/command_buffer/service/feature_info.h" |
| 8 #include "gpu/command_buffer/service/gl_utils.h" | 8 #include "gpu/command_buffer/service/gl_utils.h" |
| 9 #include "ui/gfx/gl/gl_implementation.h" | 9 #include "ui/gfx/gl/gl_implementation.h" |
| 10 | 10 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 bool desire_all_features_; | 74 bool desire_all_features_; |
| 75 | 75 |
| 76 // Extensions that exist. | 76 // Extensions that exist. |
| 77 std::set<std::string> have_extensions_; | 77 std::set<std::string> have_extensions_; |
| 78 | 78 |
| 79 // Extensions that are desired but may not exist. | 79 // Extensions that are desired but may not exist. |
| 80 std::set<std::string> desired_extensions_; | 80 std::set<std::string> desired_extensions_; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 bool FeatureInfo::Initialize(const char* allowed_features) { | 83 bool FeatureInfo::Initialize(const char* allowed_features) { |
| 84 disallowed_extensions_ = DisallowedExtensions(); | 84 disallowed_features_ = DisallowedFeatures(); |
| 85 AddFeatures(allowed_features); | 85 AddFeatures(allowed_features); |
| 86 return true; | 86 return true; |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool FeatureInfo::Initialize(const DisallowedExtensions& disallowed_extensions, | 89 bool FeatureInfo::Initialize(const DisallowedFeatures& disallowed_features, |
| 90 const char* allowed_features) { | 90 const char* allowed_features) { |
| 91 disallowed_extensions_ = disallowed_extensions; | 91 disallowed_features_ = disallowed_features; |
| 92 AddFeatures(allowed_features); | 92 AddFeatures(allowed_features); |
| 93 return true; | 93 return true; |
| 94 } | 94 } |
| 95 | 95 |
| 96 void FeatureInfo::AddFeatures(const char* desired_features) { | 96 void FeatureInfo::AddFeatures(const char* desired_features) { |
| 97 // Figure out what extensions to turn on. | 97 // Figure out what extensions to turn on. |
| 98 ExtensionHelper ext( | 98 ExtensionHelper ext( |
| 99 reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)), | 99 reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)), |
| 100 desired_features); | 100 desired_features); |
| 101 | 101 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 294 |
| 295 if (enable_texture_half_float) { | 295 if (enable_texture_half_float) { |
| 296 validators_.pixel_type.AddValue(GL_HALF_FLOAT_OES); | 296 validators_.pixel_type.AddValue(GL_HALF_FLOAT_OES); |
| 297 AddExtensionString("GL_OES_texture_half_float"); | 297 AddExtensionString("GL_OES_texture_half_float"); |
| 298 if (enable_texture_half_float_linear) { | 298 if (enable_texture_half_float_linear) { |
| 299 AddExtensionString("GL_OES_texture_half_float_linear"); | 299 AddExtensionString("GL_OES_texture_half_float_linear"); |
| 300 } | 300 } |
| 301 } | 301 } |
| 302 | 302 |
| 303 // Check for multisample support | 303 // Check for multisample support |
| 304 if (!disallowed_extensions_.multisampling && | 304 if (!disallowed_features_.multisampling && |
| 305 ext.Desire("GL_CHROMIUM_framebuffer_multisample") && | 305 ext.Desire("GL_CHROMIUM_framebuffer_multisample") && |
| 306 (ext.Have("GL_EXT_framebuffer_multisample") || | 306 (ext.Have("GL_EXT_framebuffer_multisample") || |
| 307 ext.Have("GL_ANGLE_framebuffer_multisample"))) { | 307 ext.Have("GL_ANGLE_framebuffer_multisample"))) { |
| 308 feature_flags_.chromium_framebuffer_multisample = true; | 308 feature_flags_.chromium_framebuffer_multisample = true; |
| 309 validators_.frame_buffer_target.AddValue(GL_READ_FRAMEBUFFER_EXT); | 309 validators_.frame_buffer_target.AddValue(GL_READ_FRAMEBUFFER_EXT); |
| 310 validators_.frame_buffer_target.AddValue(GL_DRAW_FRAMEBUFFER_EXT); | 310 validators_.frame_buffer_target.AddValue(GL_DRAW_FRAMEBUFFER_EXT); |
| 311 validators_.g_l_state.AddValue(GL_READ_FRAMEBUFFER_BINDING_EXT); | 311 validators_.g_l_state.AddValue(GL_READ_FRAMEBUFFER_BINDING_EXT); |
| 312 validators_.g_l_state.AddValue(GL_MAX_SAMPLES_EXT); | 312 validators_.g_l_state.AddValue(GL_MAX_SAMPLES_EXT); |
| 313 validators_.render_buffer_parameter.AddValue(GL_RENDERBUFFER_SAMPLES_EXT); | 313 validators_.render_buffer_parameter.AddValue(GL_RENDERBUFFER_SAMPLES_EXT); |
| 314 AddExtensionString("GL_CHROMIUM_framebuffer_multisample"); | 314 AddExtensionString("GL_CHROMIUM_framebuffer_multisample"); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 } | 349 } |
| 350 | 350 |
| 351 void FeatureInfo::AddExtensionString(const std::string& str) { | 351 void FeatureInfo::AddExtensionString(const std::string& str) { |
| 352 if (extensions_.find(str) == std::string::npos) { | 352 if (extensions_.find(str) == std::string::npos) { |
| 353 extensions_ += (extensions_.empty() ? "" : " ") + str; | 353 extensions_ += (extensions_.empty() ? "" : " ") + str; |
| 354 } | 354 } |
| 355 } | 355 } |
| 356 | 356 |
| 357 } // namespace gles2 | 357 } // namespace gles2 |
| 358 } // namespace gpu | 358 } // namespace gpu |
| OLD | NEW |