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, gfx_ctx_khr_display_set_flags,
NULL, NULL,
gfx_ctx_khr_display_get_context_data, gfx_ctx_khr_display_get_context_data,
NULL,
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; 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) if (!current_context_data)
return; return;
switch (x_api)
{
case GFX_CTX_OPENGL_API:
case GFX_CTX_OPENGL_ES_API:
#ifdef HAVE_OPENGL
if (release) if (release)
{
glXMakeContextCurrent(g_x11_dpy, None, None, NULL); glXMakeContextCurrent(g_x11_dpy, None, None, NULL);
}
else else
{
glXMakeContextCurrent(g_x11_dpy, glXMakeContextCurrent(g_x11_dpy,
current_context_data->g_glx_win, current_context_data->g_glx_win, current_context_data->g_ctx); 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 #else
NULL, NULL,
#endif #endif
#ifdef HAVE_OPENGL
gfx_ctx_x_make_current gfx_ctx_x_make_current
#else
NULL
#endif
}; };