mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
Don't use egl_common's 'api' variable anymore
This commit is contained in:
parent
fd7a62f5ca
commit
22a677b3a8
@ -102,7 +102,6 @@ void egl_destroy(void *data)
|
|||||||
egl->dpy = EGL_NO_DISPLAY;
|
egl->dpy = EGL_NO_DISPLAY;
|
||||||
egl->config = 0;
|
egl->config = 0;
|
||||||
g_egl_quit = 0;
|
g_egl_quit = 0;
|
||||||
egl->api = GFX_CTX_NONE;
|
|
||||||
g_egl_inited = false;
|
g_egl_inited = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,7 +208,6 @@ bool egl_init_context(void *data, NativeDisplayType display,
|
|||||||
if (!eglChooseConfig(egl->dpy, attrib_ptr, &egl->config, 1, n) || *n != 1)
|
if (!eglChooseConfig(egl->dpy, attrib_ptr, &egl->config, 1, n) || *n != 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
egl->api = g_egl_api;
|
|
||||||
egl->major = g_egl_major;
|
egl->major = g_egl_major;
|
||||||
egl->minor = g_egl_minor;
|
egl->minor = g_egl_minor;
|
||||||
|
|
||||||
|
@ -53,7 +53,6 @@ typedef struct
|
|||||||
|
|
||||||
unsigned major;
|
unsigned major;
|
||||||
unsigned minor;
|
unsigned minor;
|
||||||
enum gfx_ctx_api api;
|
|
||||||
|
|
||||||
/* egl "private" */
|
/* egl "private" */
|
||||||
bool use_hw_ctx;
|
bool use_hw_ctx;
|
||||||
|
@ -315,8 +315,6 @@ static bool gfx_ctx_qnx_bind_api(void *data,
|
|||||||
(void)major;
|
(void)major;
|
||||||
(void)minor;
|
(void)minor;
|
||||||
|
|
||||||
g_egl_api = api;
|
|
||||||
|
|
||||||
return api == GFX_CTX_OPENGL_ES_API;
|
return api == GFX_CTX_OPENGL_ES_API;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,7 +434,7 @@ error:
|
|||||||
|
|
||||||
static EGLint *egl_fill_attribs(gfx_ctx_drm_egl_data_t *drm, EGLint *attr)
|
static EGLint *egl_fill_attribs(gfx_ctx_drm_egl_data_t *drm, EGLint *attr)
|
||||||
{
|
{
|
||||||
switch (drm->egl.api)
|
switch (drm_api)
|
||||||
{
|
{
|
||||||
#ifdef EGL_KHR_create_context
|
#ifdef EGL_KHR_create_context
|
||||||
case GFX_CTX_OPENGL_API:
|
case GFX_CTX_OPENGL_API:
|
||||||
|
@ -51,6 +51,7 @@ typedef struct {
|
|||||||
unsigned res;
|
unsigned res;
|
||||||
} vc_ctx_data_t;
|
} vc_ctx_data_t;
|
||||||
|
|
||||||
|
static enum gfx_ctx_api vc_api;
|
||||||
static PFNEGLCREATEIMAGEKHRPROC peglCreateImageKHR;
|
static PFNEGLCREATEIMAGEKHRPROC peglCreateImageKHR;
|
||||||
static PFNEGLDESTROYIMAGEKHRPROC peglDestroyImageKHR;
|
static PFNEGLDESTROYIMAGEKHRPROC peglDestroyImageKHR;
|
||||||
|
|
||||||
@ -186,7 +187,7 @@ static void *gfx_ctx_vc_init(void *video_driver)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!egl_create_context(vc, (g_egl_api == GFX_CTX_OPENGL_ES_API) ? context_attributes : NULL))
|
if (!egl_create_context(vc, (vc_api == GFX_CTX_OPENGL_ES_API) ? context_attributes : NULL))
|
||||||
{
|
{
|
||||||
egl_report_error();
|
egl_report_error();
|
||||||
goto error;
|
goto error;
|
||||||
@ -303,7 +304,7 @@ static bool gfx_ctx_vc_bind_api(void *data,
|
|||||||
(void)major;
|
(void)major;
|
||||||
(void)minor;
|
(void)minor;
|
||||||
|
|
||||||
g_egl_api = api;
|
vc_api = api;
|
||||||
|
|
||||||
switch (api)
|
switch (api)
|
||||||
{
|
{
|
||||||
@ -354,7 +355,7 @@ static void gfx_ctx_vc_destroy(void *data)
|
|||||||
|
|
||||||
if (vc->egl.ctx)
|
if (vc->egl.ctx)
|
||||||
{
|
{
|
||||||
gfx_ctx_vc_bind_api(data, vc->egl.api, 0, 0);
|
gfx_ctx_vc_bind_api(data, vc_api, 0, 0);
|
||||||
eglMakeCurrent(vc->egl.dpy,
|
eglMakeCurrent(vc->egl.dpy,
|
||||||
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
eglDestroyContext(vc->egl.dpy, vc->egl.ctx);
|
eglDestroyContext(vc->egl.dpy, vc->egl.ctx);
|
||||||
@ -373,7 +374,7 @@ static void gfx_ctx_vc_destroy(void *data)
|
|||||||
|
|
||||||
if (vc->egl.surf)
|
if (vc->egl.surf)
|
||||||
{
|
{
|
||||||
gfx_ctx_vc_bind_api(data, g_egl_api, 0, 0);
|
gfx_ctx_vc_bind_api(data, vc_api, 0, 0);
|
||||||
eglDestroySurface(vc->egl.dpy, vc->egl.surf);
|
eglDestroySurface(vc->egl.dpy, vc->egl.surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,7 +387,7 @@ static void gfx_ctx_vc_destroy(void *data)
|
|||||||
eglBindAPI(EGL_OPENVG_API);
|
eglBindAPI(EGL_OPENVG_API);
|
||||||
eglMakeCurrent(vc->egl.dpy,
|
eglMakeCurrent(vc->egl.dpy,
|
||||||
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
gfx_ctx_vc_bind_api(data, vc->egl.api, 0, 0);
|
gfx_ctx_vc_bind_api(data, vc_api, 0, 0);
|
||||||
eglMakeCurrent(vc->egl.dpy,
|
eglMakeCurrent(vc->egl.dpy,
|
||||||
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
eglTerminate(vc->egl.dpy);
|
eglTerminate(vc->egl.dpy);
|
||||||
@ -459,7 +460,7 @@ static bool gfx_ctx_vc_image_buffer_init(void *data,
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Don't bother, we just use VGImages for our EGLImage anyway. */
|
/* Don't bother, we just use VGImages for our EGLImage anyway. */
|
||||||
if (vc->egl.api == GFX_CTX_OPENVG_API)
|
if (vc_api == GFX_CTX_OPENVG_API)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
peglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC)
|
peglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC)
|
||||||
@ -496,7 +497,7 @@ static bool gfx_ctx_vc_image_buffer_init(void *data,
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx_ctx_vc_bind_api(NULL, vc->egl.api, 0, 0);
|
gfx_ctx_vc_bind_api(NULL, vc_api, 0, 0);
|
||||||
eglMakeCurrent(vc->egl.dpy, vc->egl.surf, vc->egl.surf, vc->egl.ctx);
|
eglMakeCurrent(vc->egl.dpy, vc->egl.surf, vc->egl.surf, vc->egl.ctx);
|
||||||
|
|
||||||
vc->smooth = video->smooth;
|
vc->smooth = video->smooth;
|
||||||
@ -515,7 +516,7 @@ fail:
|
|||||||
vc->pbuff_surf = EGL_NO_CONTEXT;
|
vc->pbuff_surf = EGL_NO_CONTEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx_ctx_vc_bind_api(NULL, g_egl_api, 0, 0);
|
gfx_ctx_vc_bind_api(NULL, vc_api, 0, 0);
|
||||||
eglMakeCurrent(vc->egl.dpy, vc->egl.surf, vc->egl.surf, vc->egl.ctx);
|
eglMakeCurrent(vc->egl.dpy, vc->egl.surf, vc->egl.surf, vc->egl.ctx);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -559,7 +560,7 @@ static bool gfx_ctx_vc_image_buffer_write(void *data, const void *frame, unsigne
|
|||||||
height);
|
height);
|
||||||
*image_handle = vc->eglBuffer[index];
|
*image_handle = vc->eglBuffer[index];
|
||||||
|
|
||||||
gfx_ctx_vc_bind_api(NULL, vc->egl.api, 0, 0);
|
gfx_ctx_vc_bind_api(NULL, vc_api, 0, 0);
|
||||||
eglMakeCurrent(vc->egl.dpy, vc->egl.surf, vc->egl.surf, vc->egl.ctx);
|
eglMakeCurrent(vc->egl.dpy, vc->egl.surf, vc->egl.surf, vc->egl.ctx);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -523,7 +523,7 @@ static void *gfx_ctx_wl_init(void *video_driver)
|
|||||||
(void)video_driver;
|
(void)video_driver;
|
||||||
|
|
||||||
#ifdef HAVE_EGL
|
#ifdef HAVE_EGL
|
||||||
switch (wl->egl.api)
|
switch (wl_api)
|
||||||
{
|
{
|
||||||
case GFX_CTX_OPENGL_API:
|
case GFX_CTX_OPENGL_API:
|
||||||
#ifdef HAVE_OPENGL
|
#ifdef HAVE_OPENGL
|
||||||
@ -626,7 +626,7 @@ error:
|
|||||||
#ifdef HAVE_EGL
|
#ifdef HAVE_EGL
|
||||||
static EGLint *egl_fill_attribs(gfx_ctx_wayland_data_t *wl, EGLint *attr)
|
static EGLint *egl_fill_attribs(gfx_ctx_wayland_data_t *wl, EGLint *attr)
|
||||||
{
|
{
|
||||||
switch (wl->egl.api)
|
switch (wl_api)
|
||||||
{
|
{
|
||||||
#ifdef EGL_KHR_create_context
|
#ifdef EGL_KHR_create_context
|
||||||
case GFX_CTX_OPENGL_API:
|
case GFX_CTX_OPENGL_API:
|
||||||
|
@ -33,7 +33,9 @@ typedef struct {
|
|||||||
bool should_reset_mode;
|
bool should_reset_mode;
|
||||||
} xegl_ctx_data_t;
|
} xegl_ctx_data_t;
|
||||||
|
|
||||||
static int egl_nul_handler(Display *dpy, XErrorEvent *event)
|
static enum gfx_ctx_api x_api;
|
||||||
|
|
||||||
|
static int x_nul_handler(Display *dpy, XErrorEvent *event)
|
||||||
{
|
{
|
||||||
(void)dpy;
|
(void)dpy;
|
||||||
(void)event;
|
(void)event;
|
||||||
@ -130,7 +132,7 @@ static void *gfx_ctx_xegl_init(void *video_driver)
|
|||||||
if (!xegl)
|
if (!xegl)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
switch (xegl->egl.api)
|
switch (x_api)
|
||||||
{
|
{
|
||||||
case GFX_CTX_OPENGL_API:
|
case GFX_CTX_OPENGL_API:
|
||||||
attrib_ptr = egl_attribs_gl;
|
attrib_ptr = egl_attribs_gl;
|
||||||
@ -172,7 +174,7 @@ error:
|
|||||||
|
|
||||||
static EGLint *xegl_fill_attribs(xegl_ctx_data_t *xegl, EGLint *attr)
|
static EGLint *xegl_fill_attribs(xegl_ctx_data_t *xegl, EGLint *attr)
|
||||||
{
|
{
|
||||||
switch (xegl->egl.api)
|
switch (x_api)
|
||||||
{
|
{
|
||||||
#ifdef EGL_KHR_create_context
|
#ifdef EGL_KHR_create_context
|
||||||
case GFX_CTX_OPENGL_API:
|
case GFX_CTX_OPENGL_API:
|
||||||
@ -378,7 +380,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
|
|||||||
/* This can blow up on some drivers. It's not fatal,
|
/* This can blow up on some drivers. It's not fatal,
|
||||||
* so override errors for this call.
|
* so override errors for this call.
|
||||||
*/
|
*/
|
||||||
old_handler = XSetErrorHandler(egl_nul_handler);
|
old_handler = XSetErrorHandler(x_nul_handler);
|
||||||
XSetInputFocus(g_x11_dpy, g_x11_win, RevertToNone, CurrentTime);
|
XSetInputFocus(g_x11_dpy, g_x11_win, RevertToNone, CurrentTime);
|
||||||
XSync(g_x11_dpy, False);
|
XSync(g_x11_dpy, False);
|
||||||
XSetErrorHandler(old_handler);
|
XSetErrorHandler(old_handler);
|
||||||
@ -445,7 +447,7 @@ static bool gfx_ctx_xegl_bind_api(void *video_driver,
|
|||||||
{
|
{
|
||||||
g_egl_major = major;
|
g_egl_major = major;
|
||||||
g_egl_minor = minor;
|
g_egl_minor = minor;
|
||||||
g_egl_api = api;
|
x_api = api;
|
||||||
|
|
||||||
switch (api)
|
switch (api)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user