diff options
author | Edward O'Callaghan <funfunctor@folklore1984.net> | 2017-02-27 11:42:53 +1100 |
---|---|---|
committer | Edward O'Callaghan <funfunctor@folklore1984.net> | 2017-02-27 11:42:53 +1100 |
commit | 90b3a7b33bcb55bb345d66d1ac075e0ae4e84800 (patch) | |
tree | a30469c979e4bb9d3e45f22269be30691273326c /src | |
parent | ff015da9777de39db0a010dec2d0833ceba2165b (diff) |
src/egl.c: error check eglCreateWindowSurface() call
Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/egl.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -105,7 +105,13 @@ void init_egl(struct display * d) if (!d->egl_ctx) fprintf(stderr, "cannot create EGL context\n"); - d->egl_surface = eglCreateWindowSurface(d->egl_display, d->egl_conf, (EGLNativeWindowType)d->dev->gbm_surface, NULL); + assert(d->dev->gbm_surface); + EGLNativeWindowType native_surface = (EGLNativeWindowType) d->dev->gbm_surface; + d->egl_surface = eglCreateWindowSurface(d->egl_display, d->egl_conf, native_surface, NULL); + if (d->egl_surface == EGL_NO_SURFACE) { + fprintf(stderr, "cannot create EGL surface\n"); + assert(0); + } /* connect the context to the surface */ eglMakeCurrent(d->egl_display, d->egl_surface, d->egl_surface, d->egl_ctx); |