Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Unified Diff: gpu/command_buffer/service/feature_info.cc

Issue 2291753002: Prevent crash when using getExtension while a PBO is bound. (Closed)
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/feature_info.cc
diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc
index 6e81ab67bb16f6c40c3775b676c2420785689b79..b25aa088a05aba7d95c5e6fd8e074d793400d1d3 100644
--- a/gpu/command_buffer/service/feature_info.cc
+++ b/gpu/command_buffer/service/feature_info.cc
@@ -80,6 +80,30 @@ class StringSet {
std::set<std::string> string_set_;
};
+class ScopedPixelUnpackBufferOverride {
+ public:
+ explicit ScopedPixelUnpackBufferOverride(
+ ContextType context_type,
+ GLuint binding_override)
+ : original_binding_(0) {
+ if (!(context_type == CONTEXT_TYPE_WEBGL1 ||
+ context_type == CONTEXT_TYPE_OPENGLES2)) {
+ glGetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, &original_binding_);
+ 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.
+ }
+ }
+
+ ~ScopedPixelUnpackBufferOverride() {
+ 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.
+ glBindBuffer(GL_PIXEL_UNPACK_BUFFER,
+ static_cast<GLuint>(original_binding_));
+ }
+ }
+
+ private:
+ GLint original_binding_;
+};
+
} // anonymous namespace.
FeatureInfo::FeatureFlags::FeatureFlags()
@@ -752,6 +776,8 @@ void FeatureInfo::InitializeFeatures() {
}
}
+ 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.
+
if (may_enable_chromium_color_buffer_float) {
static_assert(GL_RGBA32F_ARB == GL_RGBA32F &&
GL_RGBA32F_EXT == GL_RGBA32F &&
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698