OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/gfx/gl/gl_implementation.h" | 7 #include "app/gfx/gl/gl_implementation.h" |
8 #include "gpu/command_buffer/service/feature_info.h" | 8 #include "gpu/command_buffer/service/feature_info.h" |
9 #include "gpu/command_buffer/service/gl_utils.h" | 9 #include "gpu/command_buffer/service/gl_utils.h" |
10 #include "gpu/GLES2/gles2_command_buffer.h" | 10 #include "gpu/GLES2/gles2_command_buffer.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 bool desire_all_features_; | 72 bool desire_all_features_; |
73 | 73 |
74 // Extensions that exist. | 74 // Extensions that exist. |
75 std::set<std::string> have_extensions_; | 75 std::set<std::string> have_extensions_; |
76 | 76 |
77 // Extensions that are desired but may not exist. | 77 // Extensions that are desired but may not exist. |
78 std::set<std::string> desired_extensions_; | 78 std::set<std::string> desired_extensions_; |
79 }; | 79 }; |
80 | 80 |
81 bool FeatureInfo::Initialize(const char* allowed_features) { | 81 bool FeatureInfo::Initialize(const char* allowed_features) { |
| 82 disallowed_extensions_ = DisallowedExtensions(); |
82 AddFeatures(allowed_features); | 83 AddFeatures(allowed_features); |
83 return true; | 84 return true; |
84 } | 85 } |
| 86 |
| 87 bool FeatureInfo::Initialize(const DisallowedExtensions& disallowed_extensions, |
| 88 const char* allowed_features) { |
| 89 disallowed_extensions_ = disallowed_extensions; |
| 90 AddFeatures(allowed_features); |
| 91 return true; |
| 92 } |
85 | 93 |
86 void FeatureInfo::AddFeatures(const char* desired_features) { | 94 void FeatureInfo::AddFeatures(const char* desired_features) { |
87 // Figure out what extensions to turn on. | 95 // Figure out what extensions to turn on. |
88 ExtensionHelper ext( | 96 ExtensionHelper ext( |
89 reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)), | 97 reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)), |
90 desired_features); | 98 desired_features); |
91 | 99 |
92 bool npot_ok = false; | 100 bool npot_ok = false; |
93 | 101 |
94 AddExtensionString("GL_CHROMIUM_map_sub"); | 102 AddExtensionString("GL_CHROMIUM_map_sub"); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 276 |
269 if (enable_texture_half_float) { | 277 if (enable_texture_half_float) { |
270 validators_.pixel_type.AddValue(GL_HALF_FLOAT_OES); | 278 validators_.pixel_type.AddValue(GL_HALF_FLOAT_OES); |
271 AddExtensionString("GL_OES_texture_half_float"); | 279 AddExtensionString("GL_OES_texture_half_float"); |
272 if (enable_texture_half_float_linear) { | 280 if (enable_texture_half_float_linear) { |
273 AddExtensionString("GL_OES_texture_half_float_linear"); | 281 AddExtensionString("GL_OES_texture_half_float_linear"); |
274 } | 282 } |
275 } | 283 } |
276 | 284 |
277 // Check for multisample support | 285 // Check for multisample support |
278 if (ext.Desire("GL_CHROMIUM_framebuffer_multisample") && | 286 if (!disallowed_extensions_.multisampling && |
| 287 ext.Desire("GL_CHROMIUM_framebuffer_multisample") && |
279 (ext.Have("GL_EXT_framebuffer_multisample") || | 288 (ext.Have("GL_EXT_framebuffer_multisample") || |
280 ext.Have("GL_ANGLE_framebuffer_multisample"))) { | 289 ext.Have("GL_ANGLE_framebuffer_multisample"))) { |
281 feature_flags_.chromium_framebuffer_multisample = true; | 290 feature_flags_.chromium_framebuffer_multisample = true; |
282 validators_.frame_buffer_target.AddValue(GL_READ_FRAMEBUFFER_EXT); | 291 validators_.frame_buffer_target.AddValue(GL_READ_FRAMEBUFFER_EXT); |
283 validators_.frame_buffer_target.AddValue(GL_DRAW_FRAMEBUFFER_EXT); | 292 validators_.frame_buffer_target.AddValue(GL_DRAW_FRAMEBUFFER_EXT); |
284 validators_.g_l_state.AddValue(GL_READ_FRAMEBUFFER_BINDING_EXT); | 293 validators_.g_l_state.AddValue(GL_READ_FRAMEBUFFER_BINDING_EXT); |
285 validators_.g_l_state.AddValue(GL_MAX_SAMPLES_EXT); | 294 validators_.g_l_state.AddValue(GL_MAX_SAMPLES_EXT); |
286 validators_.render_buffer_parameter.AddValue(GL_RENDERBUFFER_SAMPLES_EXT); | 295 validators_.render_buffer_parameter.AddValue(GL_RENDERBUFFER_SAMPLES_EXT); |
287 AddExtensionString("GL_CHROMIUM_framebuffer_multisample"); | 296 AddExtensionString("GL_CHROMIUM_framebuffer_multisample"); |
288 } | 297 } |
(...skipping 28 matching lines...) Expand all Loading... |
317 if (extensions_.find(str) == std::string::npos) { | 326 if (extensions_.find(str) == std::string::npos) { |
318 extensions_ += (extensions_.empty() ? "" : " ") + str; | 327 extensions_ += (extensions_.empty() ? "" : " ") + str; |
319 } | 328 } |
320 } | 329 } |
321 | 330 |
322 } // namespace gles2 | 331 } // namespace gles2 |
323 } // namespace gpu | 332 } // namespace gpu |
324 | 333 |
325 | 334 |
326 | 335 |
OLD | NEW |