mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(EGL) Create egl_bind_api
This commit is contained in:
parent
3d950b2324
commit
53dbd69751
@ -395,6 +395,11 @@ bool egl_init_context(egl_ctx_data_t *egl,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool egl_bind_api(EGLenum egl_api)
|
||||
{
|
||||
return eglBindAPI(egl_api);
|
||||
}
|
||||
|
||||
bool egl_create_context(egl_ctx_data_t *egl, const EGLint *egl_attribs)
|
||||
{
|
||||
EGLContext ctx = eglCreateContext(egl->dpy, egl->config, EGL_NO_CONTEXT,
|
||||
|
@ -100,6 +100,8 @@ bool egl_init_context(egl_ctx_data_t *egl,
|
||||
const EGLint *attrib_ptr,
|
||||
egl_accept_config_cb_t cb);
|
||||
|
||||
bool egl_bind_api(EGLenum egl_api);
|
||||
|
||||
bool egl_create_context(egl_ctx_data_t *egl, const EGLint *egl_attribs);
|
||||
|
||||
bool egl_create_surface(egl_ctx_data_t *egl, void *native_window);
|
||||
|
@ -839,7 +839,7 @@ static bool gfx_ctx_drm_bind_api(void *video_driver,
|
||||
if ((major * 1000 + minor) >= 3001)
|
||||
return false;
|
||||
#endif
|
||||
return eglBindAPI(EGL_OPENGL_API);
|
||||
return egl_bind_api(EGL_OPENGL_API);
|
||||
#else
|
||||
break;
|
||||
#endif
|
||||
@ -850,13 +850,13 @@ static bool gfx_ctx_drm_bind_api(void *video_driver,
|
||||
if (major >= 3)
|
||||
return false;
|
||||
#endif
|
||||
return eglBindAPI(EGL_OPENGL_ES_API);
|
||||
return egl_bind_api(EGL_OPENGL_ES_API);
|
||||
#else
|
||||
break;
|
||||
#endif
|
||||
case GFX_CTX_OPENVG_API:
|
||||
#if defined(HAVE_EGL) && defined(HAVE_VG)
|
||||
return eglBindAPI(EGL_OPENVG_API);
|
||||
return egl_bind_api(EGL_OPENVG_API);
|
||||
#endif
|
||||
case GFX_CTX_NONE:
|
||||
default:
|
||||
|
@ -273,7 +273,7 @@ static bool gfx_ctx_emscripten_bind_api(void *data,
|
||||
switch (api)
|
||||
{
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
return eglBindAPI(EGL_OPENGL_ES_API);
|
||||
return egl_bind_api(EGL_OPENGL_ES_API);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -197,13 +197,13 @@ static enum gfx_ctx_api orbis_ctx_get_api(void *data)
|
||||
}
|
||||
|
||||
static bool orbis_ctx_bind_api(void *data,
|
||||
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
{
|
||||
(void)data;
|
||||
ctx_orbis_api = api;
|
||||
|
||||
if (api == GFX_CTX_OPENGL_ES_API)
|
||||
if (eglBindAPI(EGL_OPENGL_ES_API) != EGL_FALSE)
|
||||
if (egl_bind_api(EGL_OPENGL_ES_API))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -207,13 +207,13 @@ static enum gfx_ctx_api switch_ctx_get_api(void *data)
|
||||
}
|
||||
|
||||
static bool switch_ctx_bind_api(void *data,
|
||||
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
{
|
||||
(void)data;
|
||||
ctx_nx_api = api;
|
||||
|
||||
if (api == GFX_CTX_OPENGL_API)
|
||||
if (eglBindAPI(EGL_OPENGL_API) != EGL_FALSE)
|
||||
if (egl_bind_api(EGL_OPENGL_API))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -377,11 +377,11 @@ static bool gfx_ctx_vc_bind_api(void *data,
|
||||
switch (api)
|
||||
{
|
||||
case GFX_CTX_OPENGL_API:
|
||||
return eglBindAPI(EGL_OPENGL_API);
|
||||
return egl_bind_api(EGL_OPENGL_API);
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
return eglBindAPI(EGL_OPENGL_ES_API);
|
||||
return egl_bind_api(EGL_OPENGL_ES_API);
|
||||
case GFX_CTX_OPENVG_API:
|
||||
return eglBindAPI(EGL_OPENVG_API);
|
||||
return egl_bind_api(EGL_OPENVG_API);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -406,7 +406,7 @@ static void gfx_ctx_vc_destroy(void *data)
|
||||
{
|
||||
if (vc->eglBuffer[i] && peglDestroyImageKHR)
|
||||
{
|
||||
eglBindAPI(EGL_OPENVG_API);
|
||||
egl_bind_api(EGL_OPENVG_API);
|
||||
eglMakeCurrent(vc->egl.dpy,
|
||||
vc->pbuff_surf, vc->pbuff_surf, vc->eglimage_ctx);
|
||||
peglDestroyImageKHR(vc->egl.dpy, vc->eglBuffer[i]);
|
||||
@ -414,7 +414,7 @@ static void gfx_ctx_vc_destroy(void *data)
|
||||
|
||||
if (vc->vgimage[i])
|
||||
{
|
||||
eglBindAPI(EGL_OPENVG_API);
|
||||
egl_bind_api(EGL_OPENVG_API);
|
||||
eglMakeCurrent(vc->egl.dpy,
|
||||
vc->pbuff_surf, vc->pbuff_surf, vc->eglimage_ctx);
|
||||
vgDestroyImage(vc->vgimage[i]);
|
||||
@ -434,7 +434,7 @@ static void gfx_ctx_vc_destroy(void *data)
|
||||
|
||||
if (vc->eglimage_ctx)
|
||||
{
|
||||
eglBindAPI(EGL_OPENVG_API);
|
||||
egl_bind_api(EGL_OPENVG_API);
|
||||
eglMakeCurrent(vc->egl.dpy,
|
||||
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
eglDestroyContext(vc->egl.dpy, vc->eglimage_ctx);
|
||||
@ -448,11 +448,11 @@ static void gfx_ctx_vc_destroy(void *data)
|
||||
|
||||
if (vc->pbuff_surf)
|
||||
{
|
||||
eglBindAPI(EGL_OPENVG_API);
|
||||
egl_bind_api(EGL_OPENVG_API);
|
||||
eglDestroySurface(vc->egl.dpy, vc->pbuff_surf);
|
||||
}
|
||||
|
||||
eglBindAPI(EGL_OPENVG_API);
|
||||
egl_bind_api(EGL_OPENVG_API);
|
||||
eglMakeCurrent(vc->egl.dpy,
|
||||
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
gfx_ctx_vc_bind_api(data, vc_api, 0, 0);
|
||||
@ -542,10 +542,12 @@ static bool gfx_ctx_vc_image_buffer_init(void *data,
|
||||
)
|
||||
return false;
|
||||
|
||||
vc->res = video->input_scale * RARCH_SCALE_BASE;
|
||||
vc->res = video->input_scale * RARCH_SCALE_BASE;
|
||||
|
||||
egl_bind_api(EGL_OPENVG_API);
|
||||
vc->pbuff_surf = eglCreatePbufferSurface(
|
||||
vc->egl.dpy, vc->egl.config, pbufsurface_list);
|
||||
|
||||
eglBindAPI(EGL_OPENVG_API);
|
||||
vc->pbuff_surf = eglCreatePbufferSurface(vc->egl.dpy, vc->egl.config, pbufsurface_list);
|
||||
if (vc->pbuff_surf == EGL_NO_SURFACE)
|
||||
{
|
||||
RARCH_ERR("[VideoCore:EGLImage] failed to create PbufferSurface\n");
|
||||
@ -601,8 +603,9 @@ static bool gfx_ctx_vc_image_buffer_write(void *data, const void *frame, unsigne
|
||||
if (!vc || index >= MAX_EGLIMAGE_TEXTURES)
|
||||
goto error;
|
||||
|
||||
eglBindAPI(EGL_OPENVG_API);
|
||||
eglMakeCurrent(vc->egl.dpy, vc->pbuff_surf, vc->pbuff_surf, vc->eglimage_ctx);
|
||||
egl_bind_api(EGL_OPENVG_API);
|
||||
eglMakeCurrent(vc->egl.dpy, vc->pbuff_surf,
|
||||
vc->pbuff_surf, vc->eglimage_ctx);
|
||||
|
||||
if (!vc->eglBuffer[index] || !vc->vgimage[index])
|
||||
{
|
||||
|
@ -1768,7 +1768,7 @@ static bool gfx_ctx_wl_bind_api(void *video_driver,
|
||||
return false;
|
||||
#endif
|
||||
#ifdef HAVE_EGL
|
||||
if (eglBindAPI(EGL_OPENGL_API) == EGL_TRUE)
|
||||
if (egl_bind_api(EGL_OPENGL_API))
|
||||
return true;
|
||||
#endif
|
||||
#endif
|
||||
@ -1780,7 +1780,7 @@ static bool gfx_ctx_wl_bind_api(void *video_driver,
|
||||
return false;
|
||||
#endif
|
||||
#ifdef HAVE_EGL
|
||||
if (eglBindAPI(EGL_OPENGL_ES_API) == EGL_TRUE)
|
||||
if (egl_bind_api(EGL_OPENGL_ES_API))
|
||||
return true;
|
||||
#endif
|
||||
#endif
|
||||
@ -1788,7 +1788,7 @@ static bool gfx_ctx_wl_bind_api(void *video_driver,
|
||||
case GFX_CTX_OPENVG_API:
|
||||
#ifdef HAVE_VG
|
||||
#ifdef HAVE_EGL
|
||||
if (eglBindAPI(EGL_OPENVG_API) == EGL_TRUE)
|
||||
if (egl_bind_api(EGL_OPENVG_API))
|
||||
return true;
|
||||
#endif
|
||||
#endif
|
||||
|
@ -495,16 +495,16 @@ static bool gfx_ctx_xegl_bind_api(void *video_driver,
|
||||
if ((major * 1000 + minor) >= 3001)
|
||||
break;
|
||||
#endif
|
||||
return eglBindAPI(EGL_OPENGL_API);
|
||||
return egl_bind_api(EGL_OPENGL_API);
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
#ifndef EGL_KHR_create_context
|
||||
if (major >= 3)
|
||||
break;
|
||||
#endif
|
||||
return eglBindAPI(EGL_OPENGL_ES_API);
|
||||
return egl_bind_api(EGL_OPENGL_ES_API);
|
||||
case GFX_CTX_OPENVG_API:
|
||||
#ifdef HAVE_VG
|
||||
return eglBindAPI(EGL_OPENVG_API);
|
||||
return egl_bind_api(EGL_OPENVG_API);
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user