mirror of
https://github.com/libretro/RetroArch
synced 2025-01-29 09:32:52 +00:00
Cleanups
This commit is contained in:
parent
707b40d116
commit
6a5770af6d
@ -106,15 +106,7 @@ static void gfx_ctx_cgl_swap_buffers(void *data)
|
||||
|
||||
static bool gfx_ctx_cgl_set_video_mode(void *data,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
(void)data;
|
||||
(void)width;
|
||||
(void)height;
|
||||
(void)fullscreen;
|
||||
|
||||
return true;
|
||||
}
|
||||
bool fullscreen) { return true; }
|
||||
|
||||
static void gfx_ctx_cgl_destroy(void *data)
|
||||
{
|
||||
@ -135,12 +127,7 @@ static void gfx_ctx_cgl_destroy(void *data)
|
||||
|
||||
static void gfx_ctx_cgl_input_driver(void *data,
|
||||
const char *name,
|
||||
input_driver_t **input, void **input_data)
|
||||
{
|
||||
(void)data;
|
||||
(void)input;
|
||||
(void)input_data;
|
||||
}
|
||||
input_driver_t **input, void **input_data) { }
|
||||
|
||||
static gfx_ctx_proc_t gfx_ctx_cgl_get_proc_address(const char *symbol_name)
|
||||
{
|
||||
@ -161,32 +148,13 @@ static gfx_ctx_proc_t gfx_ctx_cgl_get_proc_address(const char *symbol_name)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool gfx_ctx_cgl_has_focus(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool gfx_ctx_cgl_suppress_screensaver(void *data, bool enable)
|
||||
{
|
||||
(void)data;
|
||||
(void)enable;
|
||||
return false;
|
||||
}
|
||||
|
||||
static enum gfx_ctx_api gfx_ctx_cgl_get_api(void *data)
|
||||
{
|
||||
return cgl_api;
|
||||
}
|
||||
static bool gfx_ctx_cgl_has_focus(void *data) { return true; }
|
||||
static bool gfx_ctx_cgl_suppress_screensaver(void *data, bool enable) { return false; }
|
||||
static enum gfx_ctx_api gfx_ctx_cgl_get_api(void *data) { return cgl_api; }
|
||||
|
||||
static bool gfx_ctx_cgl_bind_api(void *data, enum gfx_ctx_api api,
|
||||
unsigned major, unsigned minor)
|
||||
{
|
||||
(void)data;
|
||||
(void)api;
|
||||
(void)major;
|
||||
(void)minor;
|
||||
|
||||
if (api == GFX_CTX_OPENGL_API)
|
||||
{
|
||||
cgl_api = api;
|
||||
@ -196,18 +164,12 @@ static bool gfx_ctx_cgl_bind_api(void *data, enum gfx_ctx_api api,
|
||||
return false;
|
||||
}
|
||||
|
||||
static void gfx_ctx_cgl_show_mouse(void *data, bool state)
|
||||
{
|
||||
(void)data;
|
||||
(void)state;
|
||||
}
|
||||
static void gfx_ctx_cgl_show_mouse(void *data, bool state) { }
|
||||
|
||||
static void gfx_ctx_cgl_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
gfx_ctx_cgl_data_t *cgl = (gfx_ctx_cgl_data_t*)data;
|
||||
|
||||
(void)enable;
|
||||
|
||||
CGLSetCurrentContext(cgl->glCtx);
|
||||
|
||||
/* TODO - needs to handle HW render context too */
|
||||
@ -342,10 +304,7 @@ static uint32_t gfx_ctx_cgl_get_flags(void *data)
|
||||
return flags;
|
||||
}
|
||||
|
||||
static void gfx_ctx_cgl_set_flags(void *data, uint32_t flags)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
static void gfx_ctx_cgl_set_flags(void *data, uint32_t flags) { }
|
||||
|
||||
const gfx_ctx_driver_t gfx_ctx_cgl = {
|
||||
gfx_ctx_cgl_init,
|
||||
|
@ -223,7 +223,10 @@ static bool osmesa_ctx_bind_api(void *data,
|
||||
if (api != GFX_CTX_OPENGL_API)
|
||||
return false;
|
||||
|
||||
/* Use version 2.1 by default */
|
||||
osmesa_api = api;
|
||||
g_osmesa_major = 2;
|
||||
g_osmesa_minor = 1;
|
||||
g_osmesa_profile = OSMESA_COMPAT_PROFILE;
|
||||
|
||||
if (major)
|
||||
@ -231,11 +234,6 @@ static bool osmesa_ctx_bind_api(void *data,
|
||||
g_osmesa_major = major;
|
||||
g_osmesa_minor = minor;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_osmesa_major = 2;
|
||||
g_osmesa_minor = 1;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -326,18 +324,9 @@ static void osmesa_ctx_check_window(void *data, bool *quit,
|
||||
*quit = false;
|
||||
}
|
||||
|
||||
static bool osmesa_ctx_has_focus(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return true;
|
||||
}
|
||||
static bool osmesa_ctx_has_focus(void *data) { return true; }
|
||||
|
||||
static bool osmesa_ctx_suppress_screensaver(void *data, bool enable)
|
||||
{
|
||||
(void)data;
|
||||
(void)enable;
|
||||
return false;
|
||||
}
|
||||
static bool osmesa_ctx_suppress_screensaver(void *data, bool enable) { return false; }
|
||||
|
||||
static void osmesa_ctx_swap_buffers(void *data)
|
||||
{
|
||||
@ -363,12 +352,6 @@ static gfx_ctx_proc_t osmesa_ctx_get_proc_address(const char *name)
|
||||
return (gfx_ctx_proc_t)OSMesaGetProcAddress(name);
|
||||
}
|
||||
|
||||
static void osmesa_ctx_show_mouse(void *data, bool state)
|
||||
{
|
||||
(void)data;
|
||||
(void)state;
|
||||
}
|
||||
|
||||
static uint32_t osmesa_ctx_get_flags(void *data)
|
||||
{
|
||||
uint32_t flags = 0;
|
||||
@ -378,10 +361,8 @@ static uint32_t osmesa_ctx_get_flags(void *data)
|
||||
return flags;
|
||||
}
|
||||
|
||||
static void osmesa_ctx_set_flags(void *data, uint32_t flags)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
static void osmesa_ctx_show_mouse(void *data, bool state) { }
|
||||
static void osmesa_ctx_set_flags(void *data, uint32_t flags) { }
|
||||
|
||||
const gfx_ctx_driver_t gfx_ctx_osmesa =
|
||||
{
|
||||
|
@ -158,12 +158,7 @@ static void gfx_ctx_ps3_check_window(void *data, bool *quit,
|
||||
*resize = true;
|
||||
}
|
||||
|
||||
static bool gfx_ctx_ps3_has_focus(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool gfx_ctx_ps3_has_focus(void *data) { return true; }
|
||||
static bool gfx_ctx_ps3_suppress_screensaver(void *data, bool enable) { return false; }
|
||||
|
||||
static void gfx_ctx_ps3_swap_buffers(void *data)
|
||||
@ -197,9 +192,6 @@ static void *gfx_ctx_ps3_init(void *video_driver)
|
||||
gfx_ctx_ps3_data_t *ps3 = (gfx_ctx_ps3_data_t*)
|
||||
calloc(1, sizeof(gfx_ctx_ps3_data_t));
|
||||
|
||||
(void)video_driver;
|
||||
(void)global;
|
||||
|
||||
if (!ps3)
|
||||
return NULL;
|
||||
|
||||
@ -265,10 +257,7 @@ static void *gfx_ctx_ps3_init(void *video_driver)
|
||||
|
||||
static bool gfx_ctx_ps3_set_video_mode(void *data,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool fullscreen) { return true; }
|
||||
|
||||
static void gfx_ctx_ps3_destroy_resources(gfx_ctx_ps3_data_t *ps3)
|
||||
{
|
||||
@ -304,18 +293,11 @@ static void gfx_ctx_ps3_input_driver(void *data,
|
||||
*input_data = ps3input;
|
||||
}
|
||||
|
||||
static enum gfx_ctx_api gfx_ctx_ps3_get_api(void *data)
|
||||
{
|
||||
return ps3_api;
|
||||
}
|
||||
static enum gfx_ctx_api gfx_ctx_ps3_get_api(void *data) { return ps3_api; }
|
||||
|
||||
static bool gfx_ctx_ps3_bind_api(void *data,
|
||||
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
{
|
||||
(void)data;
|
||||
(void)major;
|
||||
(void)minor;
|
||||
|
||||
ps3_api = api;
|
||||
|
||||
if (
|
||||
@ -394,10 +376,7 @@ static uint32_t gfx_ctx_ps3_get_flags(void *data)
|
||||
return flags;
|
||||
}
|
||||
|
||||
static void gfx_ctx_ps3_set_flags(void *data, uint32_t flags)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
static void gfx_ctx_ps3_set_flags(void *data, uint32_t flags) { }
|
||||
|
||||
const gfx_ctx_driver_t gfx_ctx_ps3 = {
|
||||
gfx_ctx_ps3_init,
|
||||
|
@ -344,9 +344,9 @@ static void sdl_ctx_check_window(void *data, bool *quit,
|
||||
|
||||
if (sdl->g_resized)
|
||||
{
|
||||
*width = sdl->g_new_width;
|
||||
*height = sdl->g_new_height;
|
||||
*resize = true;
|
||||
*width = sdl->g_new_width;
|
||||
*height = sdl->g_new_height;
|
||||
*resize = true;
|
||||
sdl->g_resized = false;
|
||||
}
|
||||
}
|
||||
|
@ -213,18 +213,8 @@ static bool switch_ctx_bind_api(void *data,
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool switch_ctx_has_focus(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return platform_switch_has_focus;
|
||||
}
|
||||
|
||||
static bool switch_ctx_suppress_screensaver(void *data, bool enable)
|
||||
{
|
||||
(void)data;
|
||||
(void)enable;
|
||||
return false;
|
||||
}
|
||||
static bool switch_ctx_has_focus(void *data) { return platform_switch_has_focus; }
|
||||
static bool switch_ctx_suppress_screensaver(void *data, bool enable) { return false; }
|
||||
|
||||
static void switch_ctx_set_swap_interval(void *data,
|
||||
int swap_interval)
|
||||
@ -281,10 +271,7 @@ static uint32_t switch_ctx_get_flags(void *data)
|
||||
return flags;
|
||||
}
|
||||
|
||||
static void switch_ctx_set_flags(void *data, uint32_t flags)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
static void switch_ctx_set_flags(void *data, uint32_t flags) { }
|
||||
|
||||
static float switch_ctx_get_refresh_rate(void *data)
|
||||
{
|
||||
|
@ -146,7 +146,102 @@ static void dispmanx_vsync_callback(DISPMANX_UPDATE_HANDLE_T u, void *data)
|
||||
slock_unlock(vc->vsync_condition_mutex);
|
||||
}
|
||||
|
||||
static void gfx_ctx_vc_destroy(void *data);
|
||||
static void gfx_ctx_vc_destroy(void *data)
|
||||
{
|
||||
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;
|
||||
unsigned i;
|
||||
|
||||
if (!vc)
|
||||
{
|
||||
g_egl_inited = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (vc->egl.dpy)
|
||||
{
|
||||
for (i = 0; i < MAX_EGLIMAGE_TEXTURES; i++)
|
||||
{
|
||||
if (vc->eglBuffer[i] && peglDestroyImageKHR)
|
||||
{
|
||||
egl_bind_api(EGL_OPENVG_API);
|
||||
eglMakeCurrent(vc->egl.dpy,
|
||||
vc->pbuff_surf, vc->pbuff_surf, vc->eglimage_ctx);
|
||||
peglDestroyImageKHR(vc->egl.dpy, vc->eglBuffer[i]);
|
||||
}
|
||||
|
||||
if (vc->vgimage[i])
|
||||
{
|
||||
egl_bind_api(EGL_OPENVG_API);
|
||||
eglMakeCurrent(vc->egl.dpy,
|
||||
vc->pbuff_surf, vc->pbuff_surf, vc->eglimage_ctx);
|
||||
vgDestroyImage(vc->vgimage[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (vc->egl.ctx)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
if (vc->egl.hw_ctx)
|
||||
eglDestroyContext(vc->egl.dpy, vc->egl.hw_ctx);
|
||||
|
||||
if (vc->eglimage_ctx)
|
||||
{
|
||||
egl_bind_api(EGL_OPENVG_API);
|
||||
eglMakeCurrent(vc->egl.dpy,
|
||||
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
eglDestroyContext(vc->egl.dpy, vc->eglimage_ctx);
|
||||
}
|
||||
|
||||
if (vc->egl.surf)
|
||||
{
|
||||
gfx_ctx_vc_bind_api(data, vc_api, 0, 0);
|
||||
eglDestroySurface(vc->egl.dpy, vc->egl.surf);
|
||||
}
|
||||
|
||||
if (vc->pbuff_surf)
|
||||
{
|
||||
egl_bind_api(EGL_OPENVG_API);
|
||||
eglDestroySurface(vc->egl.dpy, vc->pbuff_surf);
|
||||
}
|
||||
|
||||
egl_bind_api(EGL_OPENVG_API);
|
||||
eglMakeCurrent(vc->egl.dpy,
|
||||
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
gfx_ctx_vc_bind_api(data, vc_api, 0, 0);
|
||||
eglMakeCurrent(vc->egl.dpy,
|
||||
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
egl_terminate(vc->egl.dpy);
|
||||
}
|
||||
|
||||
vc->egl.ctx = NULL;
|
||||
vc->egl.hw_ctx = NULL;
|
||||
vc->eglimage_ctx = NULL;
|
||||
vc->egl.surf = NULL;
|
||||
vc->pbuff_surf = NULL;
|
||||
vc->egl.dpy = NULL;
|
||||
vc->egl.config = 0;
|
||||
g_egl_inited = false;
|
||||
|
||||
for (i = 0; i < MAX_EGLIMAGE_TEXTURES; i++)
|
||||
{
|
||||
vc->eglBuffer[i] = NULL;
|
||||
vc->vgimage[i] = 0;
|
||||
}
|
||||
|
||||
/* Stop generating vsync callbacks if we are doing so.
|
||||
* Don't destroy the context while cbs are being generated! */
|
||||
if (vc->vsync_callback_set)
|
||||
vc_dispmanx_vsync_callback(vc->dispman_display, NULL, NULL);
|
||||
|
||||
/* Destroy mutexes and conditions. */
|
||||
slock_free(vc->vsync_condition_mutex);
|
||||
scond_free(vc->vsync_condition);
|
||||
}
|
||||
|
||||
static void *gfx_ctx_vc_init(void *video_driver)
|
||||
{
|
||||
@ -382,103 +477,6 @@ static bool gfx_ctx_vc_bind_api(void *data,
|
||||
return false;
|
||||
}
|
||||
|
||||
static void gfx_ctx_vc_destroy(void *data)
|
||||
{
|
||||
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;
|
||||
unsigned i;
|
||||
|
||||
if (!vc)
|
||||
{
|
||||
g_egl_inited = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (vc->egl.dpy)
|
||||
{
|
||||
for (i = 0; i < MAX_EGLIMAGE_TEXTURES; i++)
|
||||
{
|
||||
if (vc->eglBuffer[i] && peglDestroyImageKHR)
|
||||
{
|
||||
egl_bind_api(EGL_OPENVG_API);
|
||||
eglMakeCurrent(vc->egl.dpy,
|
||||
vc->pbuff_surf, vc->pbuff_surf, vc->eglimage_ctx);
|
||||
peglDestroyImageKHR(vc->egl.dpy, vc->eglBuffer[i]);
|
||||
}
|
||||
|
||||
if (vc->vgimage[i])
|
||||
{
|
||||
egl_bind_api(EGL_OPENVG_API);
|
||||
eglMakeCurrent(vc->egl.dpy,
|
||||
vc->pbuff_surf, vc->pbuff_surf, vc->eglimage_ctx);
|
||||
vgDestroyImage(vc->vgimage[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (vc->egl.ctx)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
if (vc->egl.hw_ctx)
|
||||
eglDestroyContext(vc->egl.dpy, vc->egl.hw_ctx);
|
||||
|
||||
if (vc->eglimage_ctx)
|
||||
{
|
||||
egl_bind_api(EGL_OPENVG_API);
|
||||
eglMakeCurrent(vc->egl.dpy,
|
||||
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
eglDestroyContext(vc->egl.dpy, vc->eglimage_ctx);
|
||||
}
|
||||
|
||||
if (vc->egl.surf)
|
||||
{
|
||||
gfx_ctx_vc_bind_api(data, vc_api, 0, 0);
|
||||
eglDestroySurface(vc->egl.dpy, vc->egl.surf);
|
||||
}
|
||||
|
||||
if (vc->pbuff_surf)
|
||||
{
|
||||
egl_bind_api(EGL_OPENVG_API);
|
||||
eglDestroySurface(vc->egl.dpy, vc->pbuff_surf);
|
||||
}
|
||||
|
||||
egl_bind_api(EGL_OPENVG_API);
|
||||
eglMakeCurrent(vc->egl.dpy,
|
||||
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
gfx_ctx_vc_bind_api(data, vc_api, 0, 0);
|
||||
eglMakeCurrent(vc->egl.dpy,
|
||||
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
egl_terminate(vc->egl.dpy);
|
||||
}
|
||||
|
||||
vc->egl.ctx = NULL;
|
||||
vc->egl.hw_ctx = NULL;
|
||||
vc->eglimage_ctx = NULL;
|
||||
vc->egl.surf = NULL;
|
||||
vc->pbuff_surf = NULL;
|
||||
vc->egl.dpy = NULL;
|
||||
vc->egl.config = 0;
|
||||
g_egl_inited = false;
|
||||
|
||||
for (i = 0; i < MAX_EGLIMAGE_TEXTURES; i++)
|
||||
{
|
||||
vc->eglBuffer[i] = NULL;
|
||||
vc->vgimage[i] = 0;
|
||||
}
|
||||
|
||||
/* Stop generating vsync callbacks if we are doing so.
|
||||
* Don't destroy the context while cbs are being generated! */
|
||||
if (vc->vsync_callback_set)
|
||||
vc_dispmanx_vsync_callback(vc->dispman_display, NULL, NULL);
|
||||
|
||||
/* Destroy mutexes and conditions. */
|
||||
slock_free(vc->vsync_condition_mutex);
|
||||
scond_free(vc->vsync_condition);
|
||||
}
|
||||
|
||||
static void gfx_ctx_vc_input_driver(void *data,
|
||||
const char *name,
|
||||
input_driver_t **input, void **input_data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user