Don't use egl_common's 'api' variable anymore

This commit is contained in:
twinaphex 2016-02-22 11:54:19 +01:00
parent fd7a62f5ca
commit 22a677b3a8
7 changed files with 20 additions and 22 deletions

View File

@ -102,7 +102,6 @@ void egl_destroy(void *data)
egl->dpy = EGL_NO_DISPLAY;
egl->config = 0;
g_egl_quit = 0;
egl->api = GFX_CTX_NONE;
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)
return false;
egl->api = g_egl_api;
egl->major = g_egl_major;
egl->minor = g_egl_minor;

View File

@ -53,7 +53,6 @@ typedef struct
unsigned major;
unsigned minor;
enum gfx_ctx_api api;
/* egl "private" */
bool use_hw_ctx;

View File

@ -315,8 +315,6 @@ static bool gfx_ctx_qnx_bind_api(void *data,
(void)major;
(void)minor;
g_egl_api = api;
return api == GFX_CTX_OPENGL_ES_API;
}

View File

@ -434,7 +434,7 @@ error:
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
case GFX_CTX_OPENGL_API:

View File

@ -51,6 +51,7 @@ typedef struct {
unsigned res;
} vc_ctx_data_t;
static enum gfx_ctx_api vc_api;
static PFNEGLCREATEIMAGEKHRPROC peglCreateImageKHR;
static PFNEGLDESTROYIMAGEKHRPROC peglDestroyImageKHR;
@ -186,7 +187,7 @@ static void *gfx_ctx_vc_init(void *video_driver)
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();
goto error;
@ -303,7 +304,7 @@ static bool gfx_ctx_vc_bind_api(void *data,
(void)major;
(void)minor;
g_egl_api = api;
vc_api = api;
switch (api)
{
@ -354,7 +355,7 @@ static void gfx_ctx_vc_destroy(void *data)
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,
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglDestroyContext(vc->egl.dpy, vc->egl.ctx);
@ -373,7 +374,7 @@ static void gfx_ctx_vc_destroy(void *data)
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);
}
@ -386,7 +387,7 @@ static void gfx_ctx_vc_destroy(void *data)
eglBindAPI(EGL_OPENVG_API);
eglMakeCurrent(vc->egl.dpy,
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,
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
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. */
if (vc->egl.api == GFX_CTX_OPENVG_API)
if (vc_api == GFX_CTX_OPENVG_API)
return false;
peglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC)
@ -496,7 +497,7 @@ static bool gfx_ctx_vc_image_buffer_init(void *data,
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);
vc->smooth = video->smooth;
@ -515,7 +516,7 @@ fail:
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);
return false;
@ -559,7 +560,7 @@ static bool gfx_ctx_vc_image_buffer_write(void *data, const void *frame, unsigne
height);
*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);
return ret;

View File

@ -523,7 +523,7 @@ static void *gfx_ctx_wl_init(void *video_driver)
(void)video_driver;
#ifdef HAVE_EGL
switch (wl->egl.api)
switch (wl_api)
{
case GFX_CTX_OPENGL_API:
#ifdef HAVE_OPENGL
@ -626,7 +626,7 @@ error:
#ifdef HAVE_EGL
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
case GFX_CTX_OPENGL_API:

View File

@ -33,7 +33,9 @@ typedef struct {
bool should_reset_mode;
} 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)event;
@ -130,7 +132,7 @@ static void *gfx_ctx_xegl_init(void *video_driver)
if (!xegl)
return NULL;
switch (xegl->egl.api)
switch (x_api)
{
case GFX_CTX_OPENGL_API:
attrib_ptr = egl_attribs_gl;
@ -172,7 +174,7 @@ error:
static EGLint *xegl_fill_attribs(xegl_ctx_data_t *xegl, EGLint *attr)
{
switch (xegl->egl.api)
switch (x_api)
{
#ifdef EGL_KHR_create_context
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,
* 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);
XSync(g_x11_dpy, False);
XSetErrorHandler(old_handler);
@ -445,7 +447,7 @@ static bool gfx_ctx_xegl_bind_api(void *video_driver,
{
g_egl_major = major;
g_egl_minor = minor;
g_egl_api = api;
x_api = api;
switch (api)
{