| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 const std::set<std::string>& GetImpl() { | 75 const std::set<std::string>& GetImpl() { |
| 76 return string_set_; | 76 return string_set_; |
| 77 } | 77 } |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 std::set<std::string> string_set_; | 80 std::set<std::string> string_set_; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 class ScopedPixelUnpackBufferOverride { |
| 84 public: |
| 85 explicit ScopedPixelUnpackBufferOverride( |
| 86 bool is_es3_capable, |
| 87 ContextType context_type, |
| 88 GLuint binding_override) |
| 89 : orig_binding_(-1) { |
| 90 if (!(context_type == CONTEXT_TYPE_WEBGL1 || |
| 91 context_type == CONTEXT_TYPE_OPENGLES2) && is_es3_capable) { |
| 92 GLint orig_binding; |
| 93 glGetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, &orig_binding); |
| 94 if (static_cast<GLuint>(orig_binding) != binding_override) { |
| 95 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, binding_override); |
| 96 orig_binding_ = orig_binding; |
| 97 } |
| 98 } |
| 99 } |
| 100 |
| 101 ~ScopedPixelUnpackBufferOverride() { |
| 102 if (orig_binding_ != -1) { |
| 103 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, static_cast<GLuint>(orig_binding_)); |
| 104 } |
| 105 } |
| 106 |
| 107 private: |
| 108 GLint orig_binding_; |
| 109 }; |
| 110 |
| 83 } // anonymous namespace. | 111 } // anonymous namespace. |
| 84 | 112 |
| 85 FeatureInfo::FeatureFlags::FeatureFlags() | 113 FeatureInfo::FeatureFlags::FeatureFlags() |
| 86 : chromium_framebuffer_multisample(false), | 114 : chromium_framebuffer_multisample(false), |
| 87 chromium_sync_query(false), | 115 chromium_sync_query(false), |
| 88 use_core_framebuffer_multisample(false), | 116 use_core_framebuffer_multisample(false), |
| 89 multisampled_render_to_texture(false), | 117 multisampled_render_to_texture(false), |
| 90 use_img_for_multisampled_render_to_texture(false), | 118 use_img_for_multisampled_render_to_texture(false), |
| 91 chromium_screen_space_antialiasing(false), | 119 chromium_screen_space_antialiasing(false), |
| 92 use_chromium_screen_space_antialiasing_via_shaders(false), | 120 use_chromium_screen_space_antialiasing_via_shaders(false), |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 StringSet extensions(gl::GetGLExtensionsFromCurrentContext()); | 344 StringSet extensions(gl::GetGLExtensionsFromCurrentContext()); |
| 317 | 345 |
| 318 const char* version_str = | 346 const char* version_str = |
| 319 reinterpret_cast<const char*>(glGetString(GL_VERSION)); | 347 reinterpret_cast<const char*>(glGetString(GL_VERSION)); |
| 320 const char* renderer_str = | 348 const char* renderer_str = |
| 321 reinterpret_cast<const char*>(glGetString(GL_RENDERER)); | 349 reinterpret_cast<const char*>(glGetString(GL_RENDERER)); |
| 322 | 350 |
| 323 gl_version_info_.reset( | 351 gl_version_info_.reset( |
| 324 new gl::GLVersionInfo(version_str, renderer_str, extensions.GetImpl())); | 352 new gl::GLVersionInfo(version_str, renderer_str, extensions.GetImpl())); |
| 325 | 353 |
| 354 // TODO(kainino): This call to IsES3Capable is sort of a hack to get some |
| 355 // mocked tests working. |
| 356 ScopedPixelUnpackBufferOverride scoped_pbo_override( |
| 357 IsES3Capable(), context_type_, 0); |
| 358 |
| 326 AddExtensionString("GL_ANGLE_translated_shader_source"); | 359 AddExtensionString("GL_ANGLE_translated_shader_source"); |
| 327 AddExtensionString("GL_CHROMIUM_async_pixel_transfers"); | 360 AddExtensionString("GL_CHROMIUM_async_pixel_transfers"); |
| 328 AddExtensionString("GL_CHROMIUM_bind_uniform_location"); | 361 AddExtensionString("GL_CHROMIUM_bind_uniform_location"); |
| 329 AddExtensionString("GL_CHROMIUM_command_buffer_query"); | 362 AddExtensionString("GL_CHROMIUM_command_buffer_query"); |
| 330 AddExtensionString("GL_CHROMIUM_command_buffer_latency_query"); | 363 AddExtensionString("GL_CHROMIUM_command_buffer_latency_query"); |
| 331 AddExtensionString("GL_CHROMIUM_copy_texture"); | 364 AddExtensionString("GL_CHROMIUM_copy_texture"); |
| 332 AddExtensionString("GL_CHROMIUM_deschedule"); | 365 AddExtensionString("GL_CHROMIUM_deschedule"); |
| 333 AddExtensionString("GL_CHROMIUM_get_error_query"); | 366 AddExtensionString("GL_CHROMIUM_get_error_query"); |
| 334 AddExtensionString("GL_CHROMIUM_lose_context"); | 367 AddExtensionString("GL_CHROMIUM_lose_context"); |
| 335 AddExtensionString("GL_CHROMIUM_pixel_transfer_buffer_object"); | 368 AddExtensionString("GL_CHROMIUM_pixel_transfer_buffer_object"); |
| (...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1464 if (pos == std::string::npos) { | 1497 if (pos == std::string::npos) { |
| 1465 extensions_ += (extensions_.empty() ? "" : " ") + str; | 1498 extensions_ += (extensions_.empty() ? "" : " ") + str; |
| 1466 } | 1499 } |
| 1467 } | 1500 } |
| 1468 | 1501 |
| 1469 FeatureInfo::~FeatureInfo() { | 1502 FeatureInfo::~FeatureInfo() { |
| 1470 } | 1503 } |
| 1471 | 1504 |
| 1472 } // namespace gles2 | 1505 } // namespace gles2 |
| 1473 } // namespace gpu | 1506 } // namespace gpu |
| OLD | NEW |