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

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

Issue 2291753002: Prevent crash when using getExtension while a PBO is bound. (Closed)
Patch Set: small corrections 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
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..ed641a619a9bea6e5f85e8a99b9a9cd62604585a 100644
--- a/gpu/command_buffer/service/feature_info.cc
+++ b/gpu/command_buffer/service/feature_info.cc
@@ -80,6 +80,34 @@ class StringSet {
std::set<std::string> string_set_;
};
+class ScopedPixelUnpackBufferOverride {
+ public:
+ explicit ScopedPixelUnpackBufferOverride(
+ bool is_es3_capable,
+ ContextType context_type,
+ GLuint binding_override)
+ : orig_binding_(-1) {
+ if (!(context_type == CONTEXT_TYPE_WEBGL1 ||
+ context_type == CONTEXT_TYPE_OPENGLES2) && is_es3_capable) {
+ GLint orig_binding;
+ glGetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, &orig_binding);
+ if (static_cast<GLuint>(orig_binding) != binding_override) {
+ glBindBuffer(GL_PIXEL_UNPACK_BUFFER, binding_override);
+ orig_binding_ = orig_binding;
+ }
+ }
+ }
+
+ ~ScopedPixelUnpackBufferOverride() {
+ if (orig_binding_ != -1) {
+ glBindBuffer(GL_PIXEL_UNPACK_BUFFER, static_cast<GLuint>(orig_binding_));
+ }
+ }
+
+ private:
+ GLint orig_binding_;
+};
+
} // anonymous namespace.
FeatureInfo::FeatureFlags::FeatureFlags()
@@ -323,6 +351,11 @@ void FeatureInfo::InitializeFeatures() {
gl_version_info_.reset(
new gl::GLVersionInfo(version_str, renderer_str, extensions.GetImpl()));
+ // TODO(kainino): This call to IsES3Capable is sort of a hack to get some
+ // mocked tests working.
+ ScopedPixelUnpackBufferOverride scoped_pbo_override(
+ IsES3Capable(), context_type_, 0);
+
AddExtensionString("GL_ANGLE_translated_shader_source");
AddExtensionString("GL_CHROMIUM_async_pixel_transfers");
AddExtensionString("GL_CHROMIUM_bind_uniform_location");
« no previous file with comments | « gpu/command_buffer/service/context_group_unittest.cc ('k') | gpu/command_buffer/service/feature_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698