Skip to content

Commit

Permalink
Call eglGetError() before other EGL calls that will wipe it
Browse files Browse the repository at this point in the history
  • Loading branch information
wmww authored and robert-ancell committed Jul 21, 2020
1 parent 4a879af commit 57b6d9e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions shell/platform/linux/fl_renderer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,12 @@ gboolean fl_renderer_setup(FlRenderer* self, GError** error) {
}

if (!eglBindAPI(EGL_OPENGL_ES_API)) {
EGLint egl_error = eglGetError(); // must be before egl_config_to_string().
g_autofree gchar* config_string =
egl_config_to_string(priv->egl_display, priv->egl_config);
g_set_error(error, fl_renderer_error_quark(), FL_RENDERER_ERROR_FAILED,
"Failed to bind EGL OpenGL ES API using configuration (%s): %s",
config_string, egl_error_to_string(eglGetError()));
config_string, egl_error_to_string(egl_error));
return FALSE;
}

Expand Down Expand Up @@ -136,23 +137,25 @@ gboolean fl_renderer_start(FlRenderer* self, GError** error) {
priv->egl_surface = FL_RENDERER_GET_CLASS(self)->create_surface(
self, priv->egl_display, priv->egl_config);
if (priv->egl_surface == EGL_NO_SURFACE) {
EGLint egl_error = eglGetError(); // must be before egl_config_to_string().
g_autofree gchar* config_string =
egl_config_to_string(priv->egl_display, priv->egl_config);
g_set_error(error, fl_renderer_error_quark(), FL_RENDERER_ERROR_FAILED,
"Failed to create EGL surface using configuration (%s): %s",
config_string, egl_error_to_string(eglGetError()));
config_string, egl_error_to_string(egl_error));
return FALSE;
}

EGLint context_attributes[] = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE};
priv->egl_context = eglCreateContext(priv->egl_display, priv->egl_config,
EGL_NO_CONTEXT, context_attributes);
if (priv->egl_context == EGL_NO_CONTEXT) {
EGLint egl_error = eglGetError(); // must be before egl_config_to_string().
g_autofree gchar* config_string =
egl_config_to_string(priv->egl_display, priv->egl_config);
g_set_error(error, fl_renderer_error_quark(), FL_RENDERER_ERROR_FAILED,
"Failed to create EGL context using configuration (%s): %s",
config_string, egl_error_to_string(eglGetError()));
config_string, egl_error_to_string(egl_error));
return FALSE;
}

Expand Down

0 comments on commit 57b6d9e

Please sign in to comment.