Rewrite gfx_ctx_x_make_current a bit and turn it into a

static function
This commit is contained in:
twinaphex 2016-08-31 15:24:56 +02:00
parent 90a303050f
commit 12cfb3bfce
2 changed files with 17 additions and 13 deletions

View File

@ -258,7 +258,6 @@ const gfx_ctx_driver_t gfx_ctx_khr_display = {
gfx_ctx_khr_display_set_flags,
NULL,
gfx_ctx_khr_display_get_context_data,
NULL,
NULL
};

View File

@ -917,19 +917,28 @@ static void gfx_ctx_x_set_flags(void *data, uint32_t flags)
x->core_hw_context_enable = true;
}
void gfx_ctx_x_make_current(bool release)
static void gfx_ctx_x_make_current(bool release)
{
if (!current_context_data)
return;
if (release)
switch (x_api)
{
glXMakeContextCurrent(g_x11_dpy, None, None, NULL);
}
else
{
glXMakeContextCurrent(g_x11_dpy,
current_context_data->g_glx_win, current_context_data->g_glx_win, current_context_data->g_ctx);
case GFX_CTX_OPENGL_API:
case GFX_CTX_OPENGL_ES_API:
#ifdef HAVE_OPENGL
if (release)
glXMakeContextCurrent(g_x11_dpy, None, None, NULL);
else
glXMakeContextCurrent(g_x11_dpy,
current_context_data->g_glx_win,
current_context_data->g_glx_win, current_context_data->g_ctx);
#endif
break;
case GFX_CTX_NONE:
default:
break;
}
}
@ -967,10 +976,6 @@ const gfx_ctx_driver_t gfx_ctx_x = {
#else
NULL,
#endif
#ifdef HAVE_OPENGL
gfx_ctx_x_make_current
#else
NULL
#endif
};