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 <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 ContextType context_type, | |
| 87 GLuint binding_override) | |
| 88 : original_binding_(0) { | |
| 89 if (!(context_type == CONTEXT_TYPE_WEBGL1 || | |
| 90 context_type == CONTEXT_TYPE_OPENGLES2)) { | |
| 91 glGetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, &original_binding_); | |
| 92 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, binding_override); | |
|
Zhenyao Mo
2016/08/29 19:18:48
A minor optimization: if original_bindings_ == bin
Ken Russell (switch to Gerrit)
2016/08/29 19:36:17
Good point Mo. See also below.
Kai Ninomiya
2016/08/30 23:51:02
Done.
| |
| 93 } | |
| 94 } | |
| 95 | |
| 96 ~ScopedPixelUnpackBufferOverride() { | |
| 97 if (original_binding_) { | |
|
Ken Russell (switch to Gerrit)
2016/08/29 19:36:17
Similar test could be done here to avoid restoring
Kai Ninomiya
2016/08/30 23:51:02
Done.
| |
| 98 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, | |
| 99 static_cast<GLuint>(original_binding_)); | |
| 100 } | |
| 101 } | |
| 102 | |
| 103 private: | |
| 104 GLint original_binding_; | |
| 105 }; | |
| 106 | |
| 83 } // anonymous namespace. | 107 } // anonymous namespace. |
| 84 | 108 |
| 85 FeatureInfo::FeatureFlags::FeatureFlags() | 109 FeatureInfo::FeatureFlags::FeatureFlags() |
| 86 : chromium_framebuffer_multisample(false), | 110 : chromium_framebuffer_multisample(false), |
| 87 chromium_sync_query(false), | 111 chromium_sync_query(false), |
| 88 use_core_framebuffer_multisample(false), | 112 use_core_framebuffer_multisample(false), |
| 89 multisampled_render_to_texture(false), | 113 multisampled_render_to_texture(false), |
| 90 use_img_for_multisampled_render_to_texture(false), | 114 use_img_for_multisampled_render_to_texture(false), |
| 91 chromium_screen_space_antialiasing(false), | 115 chromium_screen_space_antialiasing(false), |
| 92 use_chromium_screen_space_antialiasing_via_shaders(false), | 116 use_chromium_screen_space_antialiasing_via_shaders(false), |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 745 validators_.pixel_type.AddValue(GL_HALF_FLOAT_OES); | 769 validators_.pixel_type.AddValue(GL_HALF_FLOAT_OES); |
| 746 validators_.read_pixel_type.AddValue(GL_HALF_FLOAT_OES); | 770 validators_.read_pixel_type.AddValue(GL_HALF_FLOAT_OES); |
| 747 AddExtensionString("GL_OES_texture_half_float"); | 771 AddExtensionString("GL_OES_texture_half_float"); |
| 748 if (enable_texture_half_float_linear) { | 772 if (enable_texture_half_float_linear) { |
| 749 oes_texture_half_float_linear_available_ = true; | 773 oes_texture_half_float_linear_available_ = true; |
| 750 if (!disallowed_features_.oes_texture_half_float_linear) | 774 if (!disallowed_features_.oes_texture_half_float_linear) |
| 751 EnableOESTextureHalfFloatLinear(); | 775 EnableOESTextureHalfFloatLinear(); |
| 752 } | 776 } |
| 753 } | 777 } |
| 754 | 778 |
| 779 ScopedPixelUnpackBufferOverride scoped_pbo_override(context_type_, 0); | |
|
Ken Russell (switch to Gerrit)
2016/08/29 19:36:17
I think you should move this up to the top of this
Kai Ninomiya
2016/08/30 23:51:02
Done.
| |
| 780 | |
| 755 if (may_enable_chromium_color_buffer_float) { | 781 if (may_enable_chromium_color_buffer_float) { |
| 756 static_assert(GL_RGBA32F_ARB == GL_RGBA32F && | 782 static_assert(GL_RGBA32F_ARB == GL_RGBA32F && |
| 757 GL_RGBA32F_EXT == GL_RGBA32F && | 783 GL_RGBA32F_EXT == GL_RGBA32F && |
| 758 GL_RGB32F_ARB == GL_RGB32F && | 784 GL_RGB32F_ARB == GL_RGB32F && |
| 759 GL_RGB32F_EXT == GL_RGB32F, | 785 GL_RGB32F_EXT == GL_RGB32F, |
| 760 "sized float internal format variations must match"); | 786 "sized float internal format variations must match"); |
| 761 // We don't check extension support beyond ARB_texture_float on desktop GL, | 787 // We don't check extension support beyond ARB_texture_float on desktop GL, |
| 762 // and format support varies between GL configurations. For example, spec | 788 // and format support varies between GL configurations. For example, spec |
| 763 // prior to OpenGL 3.0 mandates framebuffer support only for one | 789 // prior to OpenGL 3.0 mandates framebuffer support only for one |
| 764 // implementation-chosen format, and ES3.0 EXT_color_buffer_float does not | 790 // implementation-chosen format, and ES3.0 EXT_color_buffer_float does not |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1464 if (pos == std::string::npos) { | 1490 if (pos == std::string::npos) { |
| 1465 extensions_ += (extensions_.empty() ? "" : " ") + str; | 1491 extensions_ += (extensions_.empty() ? "" : " ") + str; |
| 1466 } | 1492 } |
| 1467 } | 1493 } |
| 1468 | 1494 |
| 1469 FeatureInfo::~FeatureInfo() { | 1495 FeatureInfo::~FeatureInfo() { |
| 1470 } | 1496 } |
| 1471 | 1497 |
| 1472 } // namespace gles2 | 1498 } // namespace gles2 |
| 1473 } // namespace gpu | 1499 } // namespace gpu |
| OLD | NEW |