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_context.h" | 9 #include "ui/gfx/gl/gl_context.h" |
10 #include "ui/gfx/gl/gl_implementation.h" | 10 #include "ui/gfx/gl/gl_implementation.h" |
| 11 #if defined(OS_MACOSX) |
| 12 #include "ui/gfx/surface/io_surface_support_mac.h" |
| 13 #endif |
11 | 14 |
12 namespace gpu { | 15 namespace gpu { |
13 namespace gles2 { | 16 namespace gles2 { |
14 | 17 |
15 FeatureInfo::FeatureInfo() { | 18 FeatureInfo::FeatureInfo() { |
16 } | 19 } |
17 | 20 |
18 FeatureInfo::~FeatureInfo() { | 21 FeatureInfo::~FeatureInfo() { |
19 } | 22 } |
20 | 23 |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 validators_.get_tex_param_target.AddValue(GL_TEXTURE_EXTERNAL_OES); | 350 validators_.get_tex_param_target.AddValue(GL_TEXTURE_EXTERNAL_OES); |
348 validators_.texture_parameter.AddValue(GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES); | 351 validators_.texture_parameter.AddValue(GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES); |
349 validators_.g_l_state.AddValue(GL_TEXTURE_BINDING_EXTERNAL_OES); | 352 validators_.g_l_state.AddValue(GL_TEXTURE_BINDING_EXTERNAL_OES); |
350 } | 353 } |
351 | 354 |
352 if (ext.Desire("GL_CHROMIUM_stream_texture")) { | 355 if (ext.Desire("GL_CHROMIUM_stream_texture")) { |
353 AddExtensionString("GL_CHROMIUM_stream_texture"); | 356 AddExtensionString("GL_CHROMIUM_stream_texture"); |
354 feature_flags_.chromium_stream_texture = true; | 357 feature_flags_.chromium_stream_texture = true; |
355 } | 358 } |
356 | 359 |
| 360 // Ideally we would only expose this extension on Mac OS X, to |
| 361 // support GL_CHROMIUM_iosurface and the compositor. We don't want |
| 362 // applications to start using it; they should use ordinary non- |
| 363 // power-of-two textures. However, for unit testing purposes we |
| 364 // expose it on all supported platforms. |
| 365 if (ext.HaveAndDesire("GL_ARB_texture_rectangle")) { |
| 366 AddExtensionString("GL_ARB_texture_rectangle"); |
| 367 feature_flags_.arb_texture_rectangle = true; |
| 368 validators_.texture_bind_target.AddValue(GL_TEXTURE_RECTANGLE_ARB); |
| 369 // For the moment we don't add this enum to the texture_target |
| 370 // validator. This implies that the only way to get image data into a |
| 371 // rectangular texture is via glTexImageIOSurface2DCHROMIUM, which is |
| 372 // just fine since again we don't want applications depending on this |
| 373 // extension. |
| 374 validators_.get_tex_param_target.AddValue(GL_TEXTURE_RECTANGLE_ARB); |
| 375 validators_.g_l_state.AddValue(GL_TEXTURE_BINDING_RECTANGLE_ARB); |
| 376 } |
| 377 |
| 378 #if defined(OS_MACOSX) |
| 379 if (IOSurfaceSupport::Initialize()) { |
| 380 AddExtensionString("GL_CHROMIUM_iosurface"); |
| 381 } |
| 382 #endif |
| 383 |
357 // TODO(gman): Add support for these extensions. | 384 // TODO(gman): Add support for these extensions. |
358 // GL_OES_depth32 | 385 // GL_OES_depth32 |
359 // GL_OES_element_index_uint | 386 // GL_OES_element_index_uint |
360 | 387 |
361 feature_flags_.enable_texture_float_linear = enable_texture_float_linear; | 388 feature_flags_.enable_texture_float_linear = enable_texture_float_linear; |
362 feature_flags_.enable_texture_half_float_linear = | 389 feature_flags_.enable_texture_half_float_linear = |
363 enable_texture_half_float_linear; | 390 enable_texture_half_float_linear; |
364 feature_flags_.npot_ok = npot_ok; | 391 feature_flags_.npot_ok = npot_ok; |
365 | 392 |
366 if (ext.HaveAndDesire("GL_CHROMIUM_post_sub_buffer")) { | 393 if (ext.HaveAndDesire("GL_CHROMIUM_post_sub_buffer")) { |
367 AddExtensionString("GL_CHROMIUM_post_sub_buffer"); | 394 AddExtensionString("GL_CHROMIUM_post_sub_buffer"); |
368 } | 395 } |
369 } | 396 } |
370 | 397 |
371 void FeatureInfo::AddExtensionString(const std::string& str) { | 398 void FeatureInfo::AddExtensionString(const std::string& str) { |
372 if (extensions_.find(str) == std::string::npos) { | 399 if (extensions_.find(str) == std::string::npos) { |
373 extensions_ += (extensions_.empty() ? "" : " ") + str; | 400 extensions_ += (extensions_.empty() ? "" : " ") + str; |
374 } | 401 } |
375 } | 402 } |
376 | 403 |
377 } // namespace gles2 | 404 } // namespace gles2 |
378 } // namespace gpu | 405 } // namespace gpu |
OLD | NEW |