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

Unified Diff: ui/gl/gl_context_egl.cc

Issue 2313353002: If ES3 EGL config selection fails, fall back to ES2. (Closed)
Patch Set: Created 4 years, 3 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 | ui/gl/gl_surface_egl.cc » ('j') | ui/gl/gl_surface_egl.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.";
« no previous file with comments | « no previous file | ui/gl/gl_surface_egl.cc » ('j') | ui/gl/gl_surface_egl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698