(X contexts) Cleanups

This commit is contained in:
twinaphex 2016-10-08 14:37:26 +02:00
parent f698e0cfac
commit 3b1cf79c63
2 changed files with 27 additions and 37 deletions

View File

@ -276,18 +276,17 @@ static void gfx_ctx_x_swap_buffers(void *data)
static void gfx_ctx_x_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
{
#ifdef HAVE_VULKAN
gfx_ctx_x_data_t *x = (gfx_ctx_x_data_t*)data;
#endif
x11_check_window(data, quit, resize, width, height, frame_count);
switch (x_api)
{
case GFX_CTX_VULKAN_API:
#ifdef HAVE_VULKAN
if (x->vk.need_new_swapchain)
*resize = true;
{
gfx_ctx_x_data_t *x = (gfx_ctx_x_data_t*)data;
if (x->vk.need_new_swapchain)
*resize = true;
}
#endif
break;
@ -300,9 +299,6 @@ static void gfx_ctx_x_check_window(void *data, bool *quit,
static bool gfx_ctx_x_set_resize(void *data,
unsigned width, unsigned height)
{
#ifdef HAVE_VULKAN
gfx_ctx_x_data_t *x = (gfx_ctx_x_data_t*)data;
#endif
(void)data;
(void)width;
(void)height;
@ -311,14 +307,17 @@ static bool gfx_ctx_x_set_resize(void *data,
{
case GFX_CTX_VULKAN_API:
#ifdef HAVE_VULKAN
if (!vulkan_create_swapchain(&x->vk, width, height, x->g_interval))
{
RARCH_ERR("[X/Vulkan]: Failed to update swapchain.\n");
return false;
}
gfx_ctx_x_data_t *x = (gfx_ctx_x_data_t*)data;
if (!vulkan_create_swapchain(&x->vk, width, height, x->g_interval))
{
RARCH_ERR("[X/Vulkan]: Failed to update swapchain.\n");
return false;
}
x->vk.context.invalid_swapchain = true;
x->vk.need_new_swapchain = false;
x->vk.context.invalid_swapchain = true;
x->vk.need_new_swapchain = false;
}
#endif
break;
@ -830,12 +829,12 @@ static bool gfx_ctx_x_bind_api(void *data, enum gfx_ctx_api api,
g_major = major;
g_minor = minor;
x_api = api;
switch (api)
{
case GFX_CTX_OPENGL_API:
#ifdef HAVE_OPENGL
x_api = GFX_CTX_OPENGL_API;
return true;
#else
break;
@ -853,7 +852,6 @@ static bool gfx_ctx_x_bind_api(void *data, enum gfx_ctx_api api,
g_major = 2; /* ES 2.0. */
g_minor = 0;
}
x_api = GFX_CTX_OPENGL_ES_API;
return ret;
}
#else
@ -861,7 +859,6 @@ static bool gfx_ctx_x_bind_api(void *data, enum gfx_ctx_api api,
#endif
case GFX_CTX_VULKAN_API:
#ifdef HAVE_VULKAN
x_api = api;
return true;
#else
break;

View File

@ -43,7 +43,7 @@ typedef struct
bool should_reset_mode;
} xegl_ctx_data_t;
static enum gfx_ctx_api x_api;
static enum gfx_ctx_api x_api = GFX_CTX_NONE;
static int x_nul_handler(Display *dpy, XErrorEvent *event)
{
@ -84,6 +84,14 @@ static void gfx_ctx_xegl_destroy(void *data)
*/
}
#define XEGL_ATTRIBS_BASE \
EGL_SURFACE_TYPE, EGL_WINDOW_BIT, \
EGL_RED_SIZE, 1, \
EGL_GREEN_SIZE, 1, \
EGL_BLUE_SIZE, 1, \
EGL_ALPHA_SIZE, 0, \
EGL_DEPTH_SIZE, 0
static bool gfx_ctx_xegl_set_resize(void *data,
unsigned width, unsigned height)
{
@ -93,14 +101,6 @@ static bool gfx_ctx_xegl_set_resize(void *data,
return false;
}
#define XEGL_ATTRIBS_BASE \
EGL_SURFACE_TYPE, EGL_WINDOW_BIT, \
EGL_RED_SIZE, 1, \
EGL_GREEN_SIZE, 1, \
EGL_BLUE_SIZE, 1, \
EGL_ALPHA_SIZE, 0, \
EGL_DEPTH_SIZE, 0
static void *gfx_ctx_xegl_init(void *video_driver)
{
#ifdef HAVE_EGL
@ -437,14 +437,6 @@ static void gfx_ctx_xegl_input_driver(void *data,
*input_data = xinput;
}
static bool gfx_ctx_xegl_has_focus(void *data)
{
if (!g_egl_inited)
return false;
return x11_has_focus(data);
}
static bool gfx_ctx_xegl_suppress_screensaver(void *data, bool enable)
{
(void)data;
@ -562,7 +554,6 @@ static gfx_ctx_proc_t gfx_ctx_xegl_get_proc_address(const char *symbol)
{
switch (x_api)
{
case GFX_CTX_OPENGL_API:
case GFX_CTX_OPENGL_ES_API:
case GFX_CTX_OPENVG_API:
#ifdef HAVE_EGL
@ -570,6 +561,8 @@ static gfx_ctx_proc_t gfx_ctx_xegl_get_proc_address(const char *symbol)
#else
break;
#endif
case GFX_CTX_OPENGL_API:
break;
case GFX_CTX_NONE:
default:
break;
@ -606,7 +599,7 @@ const gfx_ctx_driver_t gfx_ctx_x_egl =
x11_update_window_title,
x11_check_window,
gfx_ctx_xegl_set_resize,
gfx_ctx_xegl_has_focus,
x11_has_focus,
gfx_ctx_xegl_suppress_screensaver,
gfx_ctx_xegl_has_windowed,
gfx_ctx_xegl_swap_buffers,