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

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

Issue 2689203002: Check for some extensions before calling potentially NULL GL entry points. (Closed)
Patch Set: Created 3 years, 10 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/gles2_cmd_decoder_passthrough.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc
index 742793d0a190fa8aa0db443b4d0e99801b0abbba..62046b11c52639c414398943ab70fba076d63314 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc
@@ -4,6 +4,7 @@
#include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h"
+#include "base/strings/string_split.h"
#include "gpu/command_buffer/service/feature_info.h"
#include "gpu/command_buffer/service/gl_utils.h"
#include "ui/gl/gl_version_info.h"
@@ -171,9 +172,12 @@ bool GLES2DecoderPassthroughImpl::Initialize(
return false;
}
+ InitializeNativeCaps();
+
// Check for required extensions
if (!feature_info_->feature_flags().angle_robust_client_memory ||
- !feature_info_->feature_flags().chromium_bind_generates_resource) {
+ !feature_info_->feature_flags().chromium_bind_generates_resource ||
+ !has_chromium_copy_texture_ || !has_chromium_copy_compressed_texture_) {
// TODO(geofflang): Verify that ANGLE_webgl_compatibility is enabled if this
// is a WebGL context (depends on crbug.com/671217).
Destroy(true);
@@ -847,6 +851,25 @@ void GLES2DecoderPassthroughImpl::UpdateTextureBinding(GLenum target,
}
}
+void GLES2DecoderPassthroughImpl::InitializeNativeCaps() {
+ has_es3_ = feature_info_->gl_version_info().IsAtLeastGLES(3, 0);
+
+ std::vector<std::string> extension_tokens =
+ base::SplitString(gl::GetGLExtensionsFromCurrentContext(), " ",
+ base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
+ std::unordered_set<std::string> extension_set(extension_tokens.begin(),
+ extension_tokens.end());
+
+ has_ext_discard_framebuffer_ =
+ extension_set.count("GL_EXT_discard_framebuffer") > 0;
+ has_angle_framebuffer_multisample_ =
+ extension_set.count("GL_ANGLE_framebuffer_multisample") > 0;
+ has_chromium_copy_texture_ =
+ extension_set.count("GL_CHROMIUM_copy_texture") > 0;
+ has_chromium_copy_compressed_texture_ =
+ extension_set.count("GL_CHROMIUM_copy_compressed_texture") > 0;
+}
+
#define GLES2_CMD_OP(name) \
{ \
&GLES2DecoderPassthroughImpl::Handle##name, cmds::name::kArgFlags, \

Powered by Google App Engine
This is Rietveld 408576698