Index: ui/gl/gl_context_egl.cc |
diff --git a/ui/gl/gl_context_egl.cc b/ui/gl/gl_context_egl.cc |
index fad588bbfe3b1330afba0d0a278b1deebca6668f..6af5611d08ffee62bc4e5fe8e1bd08567e12b877 100644 |
--- a/ui/gl/gl_context_egl.cc |
+++ b/ui/gl/gl_context_egl.cc |
@@ -40,9 +40,21 @@ bool GLContextEGL::Initialize( |
DCHECK(compatible_surface); |
DCHECK(!context_); |
+ display_ = compatible_surface->GetDisplay(); |
+ config_ = compatible_surface->GetConfig(); |
+ |
+ EGLint config_renderable_type = 0; |
+ if (!eglGetConfigAttrib(display_, config_, EGL_RENDERABLE_TYPE, |
+ &config_renderable_type)) { |
+ LOG(ERROR) << "eglGetConfigAttrib failed with error " |
+ << GetLastEGLErrorString(); |
+ return false; |
+ } |
+ |
EGLint context_client_version = 2; |
if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kEnableUnsafeES3APIs)) { |
+ switches::kEnableUnsafeES3APIs) && |
+ (config_renderable_type & EGL_OPENGL_ES3_BIT) != 0) { |
context_client_version = 3; |
} |
@@ -57,9 +69,6 @@ bool GLContextEGL::Initialize( |
EGL_NONE |
}; |
- display_ = compatible_surface->GetDisplay(); |
- config_ = compatible_surface->GetConfig(); |
- |
const EGLint* context_attributes = nullptr; |
if (GLSurfaceEGL::IsCreateContextRobustnessSupported()) { |
DVLOG(1) << "EGL_EXT_create_context_robustness supported."; |