(Gfx drivers context) Cleanup EGL calls

This commit is contained in:
twinaphex 2020-01-06 18:27:18 +01:00
parent a11d955dd8
commit fa7859ad13
8 changed files with 21 additions and 39 deletions

View File

@ -875,8 +875,6 @@ static gfx_ctx_proc_t gfx_ctx_drm_get_proc_address(const char *symbol)
case GFX_CTX_OPENVG_API:
#ifdef HAVE_EGL
return egl_get_proc_address(symbol);
#else
break;
#endif
case GFX_CTX_NONE:
default:

View File

@ -165,7 +165,9 @@ static void gfx_ctx_emscripten_destroy(void *data)
if (!emscripten)
return;
#ifdef HAVE_EGL
egl_destroy(&emscripten->egl);
#endif
free(data);
}
@ -272,8 +274,10 @@ static bool gfx_ctx_emscripten_bind_api(void *data,
switch (api)
{
#ifdef HAVE_EGL
case GFX_CTX_OPENGL_ES_API:
return egl_bind_api(EGL_OPENGL_ES_API);
#endif
default:
break;
}

View File

@ -122,16 +122,13 @@ static void *gfx_ctx_mali_fbdev_init(video_frame_info_t *video_info,
#ifdef HAVE_EGL
if (!egl_init_context(&mali->egl, EGL_NONE, EGL_DEFAULT_DISPLAY,
&major, &minor, &n, attribs, NULL))
{
egl_report_error();
goto error;
}
#endif
return mali;
error:
RARCH_ERR("[Mali fbdev]: EGL error: %d.\n", eglGetError());
egl_report_error();
gfx_ctx_mali_fbdev_destroy(video_driver);
return NULL;
}
@ -190,10 +187,7 @@ static bool gfx_ctx_mali_fbdev_set_video_mode(void *data,
#ifdef HAVE_EGL
if (!egl_create_context(&mali->egl, attribs))
{
egl_report_error();
goto error;
}
#endif
#ifdef HAVE_EGL
@ -206,7 +200,7 @@ static bool gfx_ctx_mali_fbdev_set_video_mode(void *data,
error:
if (fd >= 0)
close(fd);
RARCH_ERR("[Mali fbdev]: EGL error: %d.\n", eglGetError());
egl_report_error();
gfx_ctx_mali_fbdev_destroy(data);
return false;
}

View File

@ -90,17 +90,14 @@ static void *gfx_ctx_opendingux_init(video_frame_info_t *video_info, void *video
if (!egl_init_context(&viv->egl, EGL_NONE, EGL_DEFAULT_DISPLAY,
&major, &minor,
&n, attribs, NULL))
{
egl_report_error();
goto error;
}
#endif
return viv;
#ifdef HAVE_EGL
error:
RARCH_ERR("[opendingux fbdev]: EGL error: %d.\n", eglGetError());
egl_report_error();
#endif
gfx_ctx_opendingux_destroy(viv);
return NULL;
@ -159,10 +156,7 @@ static bool gfx_ctx_opendingux_set_video_mode(void *data,
#ifdef HAVE_EGL
if (!egl_create_context(&viv->egl, attribs))
{
egl_report_error();
goto error;
}
viv->native_window = 0;
if (!egl_create_surface(&viv->egl, viv->native_window))
@ -173,7 +167,7 @@ static bool gfx_ctx_opendingux_set_video_mode(void *data,
#ifdef HAVE_EGL
error:
RARCH_ERR("[opendingux fbdev]: EGL error: %d.\n", eglGetError());
egl_report_error();
#endif
gfx_ctx_opendingux_destroy(data);
return false;

View File

@ -163,10 +163,7 @@ static bool orbis_ctx_set_video_mode(void *data,
#ifdef HAVE_EGL
if (!egl_create_context(&ctx_orbis->egl, contextAttributeList))
{
egl_report_error();
goto error;
}
#endif
#ifdef HAVE_EGL
@ -177,7 +174,9 @@ static bool orbis_ctx_set_video_mode(void *data,
return true;
error:
printf("[ctx_orbis]: EGL error: %d.\n", eglGetError());
#ifdef HAVE_EGL
egl_report_error();
#endif
orbis_ctx_destroy(data);
return false;
@ -202,9 +201,11 @@ static bool orbis_ctx_bind_api(void *data,
(void)data;
ctx_orbis_api = api;
#ifdef HAVE_EGL
if (api == GFX_CTX_OPENGL_ES_API)
if (egl_bind_api(EGL_OPENGL_ES_API))
return true;
#endif
return false;
}

View File

@ -135,16 +135,10 @@ static void *gfx_ctx_qnx_init(video_frame_info_t *video_info, void *video_driver
#ifdef HAVE_EGL
if (!egl_init_context(&qnx->egl, EGL_NONE, EGL_DEFAULT_DISPLAY, &major, &minor,
&n, attribs, NULL))
{
egl_report_error();
goto error;
}
if (!egl_create_context(&qnx->egl, context_attributes))
{
egl_report_error();
goto error;
}
#endif
if(!screen_win)
@ -266,7 +260,7 @@ static void *gfx_ctx_qnx_init(video_frame_info_t *video_info, void *video_driver
return qnx;
error:
RARCH_ERR("EGL error: %d.\n", eglGetError());
egl_report_error();
gfx_ctx_qnx_destroy(video_driver);
screen_error:
screen_stop_events(screen_ctx);

View File

@ -376,12 +376,14 @@ static bool gfx_ctx_vc_bind_api(void *data,
switch (api)
{
#ifdef HAVE_EGL
case GFX_CTX_OPENGL_API:
return egl_bind_api(EGL_OPENGL_API);
case GFX_CTX_OPENGL_ES_API:
return egl_bind_api(EGL_OPENGL_ES_API);
case GFX_CTX_OPENVG_API:
return egl_bind_api(EGL_OPENVG_API);
#endif
default:
break;
}
@ -458,7 +460,7 @@ static void gfx_ctx_vc_destroy(void *data)
gfx_ctx_vc_bind_api(data, vc_api, 0, 0);
eglMakeCurrent(vc->egl.dpy,
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglTerminate(vc->egl.dpy);
egl_terminate(vc->egl.dpy);
}
vc->egl.ctx = NULL;

View File

@ -93,18 +93,16 @@ static void *gfx_ctx_vivante_init(video_frame_info_t *video_info, void *video_dr
system("setterm -cursor off");
#ifdef HAVE_EGL
if (!egl_init_context(&viv->egl, EGL_NONE, EGL_DEFAULT_DISPLAY, &major, &minor,
if (!egl_init_context(&viv->egl, EGL_NONE,
EGL_DEFAULT_DISPLAY, &major, &minor,
&n, attribs, NULL))
{
egl_report_error();
goto error;
}
#endif
return viv;
error:
RARCH_ERR("[Vivante fbdev]: EGL error: %d.\n", eglGetError());
egl_report_error();
gfx_ctx_vivante_destroy(viv);
return NULL;
}
@ -164,10 +162,7 @@ static bool gfx_ctx_vivante_set_video_mode(void *data,
#ifdef HAVE_EGL
if (!egl_create_context(&viv->egl, attribs))
{
egl_report_error();
goto error;
}
#endif
viv->native_window = fbCreateWindow(fbGetDisplayByIndex(0), 0, 0, 0, 0);
@ -180,7 +175,7 @@ static bool gfx_ctx_vivante_set_video_mode(void *data,
return true;
error:
RARCH_ERR("[Vivante fbdev]: EGL error: %d.\n", eglGetError());
egl_report_error();
gfx_ctx_vivante_destroy(data);
return false;
}