Update more context backends ...

This commit is contained in:
Themaister 2014-03-09 17:11:06 +01:00
parent d0302c9800
commit d3c0431a3b
10 changed files with 218 additions and 156 deletions

View File

@ -445,16 +445,18 @@ static RAScreen* get_chosen_screen(void)
return (RAScreen*)[screens objectAtIndex:g_settings.video.monitor_index];
}
bool apple_gfx_ctx_init(void)
bool apple_gfx_ctx_init(void *data)
{
(void)data;
// Make sure the view was created
[RAGameView get];
g_initialized = true;
return true;
}
void apple_gfx_ctx_destroy(void)
void apple_gfx_ctx_destroy(void *data)
{
(void)data;
g_initialized = false;
[GLContextClass clearCurrentContext];
@ -466,8 +468,9 @@ void apple_gfx_ctx_destroy(void)
g_context = nil;
}
bool apple_gfx_ctx_bind_api(enum gfx_ctx_api api, unsigned major, unsigned minor)
bool apple_gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor)
{
(void)data;
if (api != GLAPIType)
return false;
@ -504,8 +507,9 @@ bool apple_gfx_ctx_bind_api(enum gfx_ctx_api api, unsigned major, unsigned minor
return true;
}
void apple_gfx_ctx_swap_interval(unsigned interval)
void apple_gfx_ctx_swap_interval(void *data, unsigned interval)
{
(void)data;
#ifdef IOS // < No way to disable Vsync on iOS?
// Just skip presents so fast forward still works.
g_is_syncing = interval ? true : false;
@ -516,8 +520,9 @@ void apple_gfx_ctx_swap_interval(unsigned interval)
#endif
}
bool apple_gfx_ctx_set_video_mode(unsigned width, unsigned height, bool fullscreen)
bool apple_gfx_ctx_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen)
{
(void)data;
#ifdef OSX
// TODO: Sceen mode support
@ -543,8 +548,9 @@ bool apple_gfx_ctx_set_video_mode(unsigned width, unsigned height, bool fullscre
return true;
}
void apple_gfx_ctx_get_video_size(unsigned* width, unsigned* height)
void apple_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned* height)
{
(void)data;
RAScreen* screen = get_chosen_screen();
CGRect size;
@ -565,8 +571,9 @@ void apple_gfx_ctx_get_video_size(unsigned* width, unsigned* height)
*height = CGRectGetHeight(size) * [screen scale];
}
void apple_gfx_ctx_update_window_title(void)
void apple_gfx_ctx_update_window_title(void *data)
{
(void)data;
static char buf[128], buf_fps[128];
bool fps_draw = g_settings.fps_show;
bool got_text = gfx_get_fps(buf, sizeof(buf), fps_draw ? buf_fps : NULL, sizeof(buf_fps));
@ -581,20 +588,22 @@ void apple_gfx_ctx_update_window_title(void)
msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1);
}
bool apple_gfx_ctx_has_focus(void)
bool apple_gfx_ctx_has_focus(void *data)
{
(void)data;
return APP_HAS_FOCUS;
}
void apple_gfx_ctx_swap_buffers()
void apple_gfx_ctx_swap_buffers(void *data)
{
bool swap = --g_fast_forward_skips < 0;
if (!swap)
return;
[g_view display];
g_fast_forward_skips = g_is_syncing ? 0 : 3;
(void)data;
bool swap = --g_fast_forward_skips < 0;
if (!swap)
return;
[g_view display];
g_fast_forward_skips = g_is_syncing ? 0 : 3;
}
gfx_ctx_proc_t apple_gfx_ctx_get_proc_address(const char *symbol_name)

View File

@ -20,15 +20,15 @@
#include "../../gfx/gfx_context.h"
// These functions must only be called in gfx/context/apple_gl_context.c
bool apple_gfx_ctx_init(void);
void apple_gfx_ctx_destroy(void);
bool apple_gfx_ctx_bind_api(enum gfx_ctx_api api, unsigned major, unsigned minor);
void apple_gfx_ctx_swap_interval(unsigned interval);
bool apple_gfx_ctx_set_video_mode(unsigned width, unsigned height, bool fullscreen);
void apple_gfx_ctx_get_video_size(unsigned* width, unsigned* height);
void apple_gfx_ctx_update_window_title(void);
bool apple_gfx_ctx_has_focus(void);
void apple_gfx_ctx_swap_buffers(void);
bool apple_gfx_ctx_init(void *data);
void apple_gfx_ctx_destroy(void *data);
bool apple_gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor);
void apple_gfx_ctx_swap_interval(void *data, unsigned interval);
bool apple_gfx_ctx_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen);
void apple_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned* height);
void apple_gfx_ctx_update_window_title(void *data);
bool apple_gfx_ctx_has_focus(void *data);
void apple_gfx_ctx_swap_buffers(void *data);
gfx_ctx_proc_t apple_gfx_ctx_get_proc_address(const char *symbol_name);
#ifdef IOS

View File

@ -41,14 +41,16 @@ GLfloat _angle;
static enum gfx_ctx_api g_api;
static void gfx_ctx_set_swap_interval(unsigned interval)
static void gfx_ctx_set_swap_interval(void *data, unsigned interval)
{
(void)data;
RARCH_LOG("gfx_ctx_set_swap_interval(%d).\n", interval);
eglSwapInterval(g_egl_dpy, interval);
}
static void gfx_ctx_destroy(void)
static void gfx_ctx_destroy(void *data)
{
(void)data;
RARCH_LOG("gfx_ctx_destroy().\n");
eglMakeCurrent(g_egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglDestroyContext(g_egl_dpy, g_egl_ctx);
@ -62,8 +64,9 @@ static void gfx_ctx_destroy(void)
g_resize = false;
}
static void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
static void gfx_ctx_get_video_size(void *data, unsigned *width, unsigned *height)
{
(void)data;
if (g_egl_dpy)
{
EGLint gl_width, gl_height;
@ -79,7 +82,7 @@ static void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
}
}
static bool gfx_ctx_init(void)
static bool gfx_ctx_init(void *data)
{
struct android_app *android_app = (struct android_app*)g_android;
const EGLint attribs[] = {
@ -154,16 +157,17 @@ static bool gfx_ctx_init(void)
error:
RARCH_ERR("EGL error: %d.\n", eglGetError());
gfx_ctx_destroy();
gfx_ctx_destroy(data);
return false;
}
static void gfx_ctx_swap_buffers(void)
static void gfx_ctx_swap_buffers(void *data)
{
(void)data;
eglSwapBuffers(g_egl_dpy, g_egl_surf);
}
static void gfx_ctx_check_window(bool *quit,
static void gfx_ctx_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
{
(void)frame_count;
@ -171,7 +175,7 @@ static void gfx_ctx_check_window(bool *quit,
*quit = false;
unsigned new_width, new_height;
gfx_ctx_get_video_size(&new_width, &new_height);
gfx_ctx_get_video_size(data, &new_width, &new_height);
if (new_width != *width || new_height != *height)
{
*width = new_width;
@ -184,14 +188,16 @@ static void gfx_ctx_check_window(bool *quit,
*quit = true;
}
static void gfx_ctx_set_resize(unsigned width, unsigned height)
static void gfx_ctx_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
}
static void gfx_ctx_update_window_title(void)
static void gfx_ctx_update_window_title(void *data)
{
(void)data;
char buf[128], buf_fps[128];
bool fps_draw = g_settings.fps_show;
gfx_get_fps(buf, sizeof(buf), fps_draw ? buf_fps : NULL, sizeof(buf_fps));
@ -200,32 +206,25 @@ static void gfx_ctx_update_window_title(void)
msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1);
}
static bool gfx_ctx_set_video_mode(
static bool gfx_ctx_set_video_mode(void *data,
unsigned width, unsigned height,
bool fullscreen)
{
(void)data;
(void)width;
(void)height;
(void)fullscreen;
return true;
}
static void gfx_ctx_input_driver(const input_driver_t **input, void **input_data)
static void gfx_ctx_input_driver(void *data, const input_driver_t **input, void **input_data)
{
(void)data;
void *androidinput = input_android.init();
*input = androidinput ? &input_android : NULL;
*input_data = androidinput;
}
static unsigned gfx_ctx_get_resolution_width(unsigned resolution_id)
{
int gl_width;
eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_WIDTH, &gl_width);
return gl_width;
}
static gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol)
{
rarch_assert(sizeof(void*) == sizeof(void (*)(void)));
@ -237,31 +236,21 @@ static gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol)
return ret;
}
static bool gfx_ctx_bind_api(enum gfx_ctx_api api, unsigned major, unsigned minor)
static bool gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor)
{
(void)data;
(void)major;
(void)minor;
g_api = api;
return api == GFX_CTX_OPENGL_ES_API;
}
static bool gfx_ctx_has_focus(void)
static bool gfx_ctx_has_focus(void *data)
{
(void)data;
return true;
}
#ifdef HAVE_EGL
static bool gfx_ctx_init_egl_image_buffer(const video_info_t *video)
{
return false;
}
static bool gfx_ctx_write_egl_image(const void *frame, unsigned width, unsigned height, unsigned pitch, bool rgb32, unsigned index, void **image_handle)
{
return false;
}
#endif
const gfx_ctx_driver_t gfx_ctx_android = {
gfx_ctx_init,
gfx_ctx_destroy,
@ -278,8 +267,8 @@ const gfx_ctx_driver_t gfx_ctx_android = {
gfx_ctx_input_driver,
gfx_ctx_get_proc_address,
#ifdef HAVE_EGL
gfx_ctx_init_egl_image_buffer,
gfx_ctx_write_egl_image,
NULL,
NULL,
#endif
NULL,
"android",

View File

@ -28,9 +28,10 @@
#include "../../apple/common/rarch_wrapper.h"
static void gfx_ctx_check_window(bool *quit,
static void gfx_ctx_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
{
(void)data;
(void)frame_count;
*quit = false;
@ -45,14 +46,16 @@ static void gfx_ctx_check_window(bool *quit,
}
}
static void gfx_ctx_set_resize(unsigned width, unsigned height)
static void gfx_ctx_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
}
static void gfx_ctx_input_driver(const input_driver_t **input, void **input_data)
static void gfx_ctx_input_driver(void *data, const input_driver_t **input, void **input_data)
{
(void)data;
*input = NULL;
*input_data = NULL;
}

View File

@ -52,14 +52,16 @@ GLfloat _angle;
static enum gfx_ctx_api g_api;
static void gfx_ctx_set_swap_interval(unsigned interval)
static void gfx_ctx_set_swap_interval(void *data, unsigned interval)
{
(void)data;
RARCH_LOG("gfx_ctx_set_swap_interval(%d).\n", interval);
eglSwapInterval(g_egl_dpy, interval);
}
static void gfx_ctx_destroy(void)
static void gfx_ctx_destroy(void *data)
{
(void)data;
RARCH_LOG("gfx_ctx_destroy().\n");
eglMakeCurrent(g_egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglDestroyContext(g_egl_dpy, g_egl_ctx);
@ -74,8 +76,9 @@ static void gfx_ctx_destroy(void)
g_resize = false;
}
static void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
static void gfx_ctx_get_video_size(void *data, unsigned *width, unsigned *height)
{
(void)data;
if (g_egl_dpy)
{
EGLint gl_width, gl_height;
@ -91,7 +94,7 @@ static void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
}
}
static bool gfx_ctx_init(void)
static bool gfx_ctx_init(void *data)
{
/* Create a screen context that will be used to
* create an EGL surface to receive libscreen events */
@ -282,20 +285,22 @@ static bool gfx_ctx_init(void)
error:
RARCH_ERR("EGL error: %d.\n", eglGetError());
gfx_ctx_destroy();
gfx_ctx_destroy(data);
screen_error:
screen_stop_events(screen_ctx);
return false;
}
static void gfx_ctx_swap_buffers(void)
static void gfx_ctx_swap_buffers(void *data)
{
(void)data;
eglSwapBuffers(g_egl_dpy, g_egl_surf);
}
static void gfx_ctx_check_window(bool *quit,
static void gfx_ctx_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
{
(void)data;
(void)frame_count;
*quit = false;
@ -314,14 +319,16 @@ static void gfx_ctx_check_window(bool *quit,
*quit = true;
}
static void gfx_ctx_set_resize(unsigned width, unsigned height)
static void gfx_ctx_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
}
static void gfx_ctx_update_window_title(void)
static void gfx_ctx_update_window_title(void *data)
{
(void)data;
char buf[128], buf_fps[128];
bool fps_draw = g_settings.fps_show;
gfx_get_fps(buf, sizeof(buf), fps_draw ? buf_fps : NULL, sizeof(buf_fps));
@ -330,10 +337,11 @@ static void gfx_ctx_update_window_title(void)
msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1);
}
static bool gfx_ctx_set_video_mode(
static bool gfx_ctx_set_video_mode(void *data,
unsigned width, unsigned height,
bool fullscreen)
{
(void)data;
(void)width;
(void)height;
(void)fullscreen;
@ -341,21 +349,14 @@ static bool gfx_ctx_set_video_mode(
}
static void gfx_ctx_input_driver(const input_driver_t **input, void **input_data)
static void gfx_ctx_input_driver(void *data, const input_driver_t **input, void **input_data)
{
(void)data;
*input = NULL;
*input_data = NULL;
}
static unsigned gfx_ctx_get_resolution_width(unsigned resolution_id)
{
int gl_width;
eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_WIDTH, &gl_width);
return gl_width;
}
static gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol)
static gfx_ctx_proc_t gfx_ctx_get_proc_address(void *data, const char *symbol)
{
rarch_assert(sizeof(void*) == sizeof(void (*)(void)));
gfx_ctx_proc_t ret;
@ -366,16 +367,18 @@ static gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol)
return ret;
}
static bool gfx_ctx_bind_api(enum gfx_ctx_api api, unsigned major, unsigned minor)
static bool gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor)
{
(void)data;
(void)major;
(void)minor;
g_api = api;
return api == GFX_CTX_OPENGL_ES_API;
}
static bool gfx_ctx_has_focus(void)
static bool gfx_ctx_has_focus(void *data)
{
(void)data;
return true;
}

View File

@ -102,8 +102,9 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT message,
}
#endif
static void gfx_ctx_d3d_swap_buffers(void)
static void gfx_ctx_d3d_swap_buffers(void *data)
{
(void)data;
d3d_video_t *d3d = (d3d_video_t*)driver.video_data;
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
@ -118,8 +119,9 @@ static void gfx_ctx_d3d_swap_buffers(void)
#endif
}
static void gfx_ctx_d3d_update_title(void)
static void gfx_ctx_d3d_update_title(void *data)
{
(void)data;
d3d_video_t *d3d = (d3d_video_t*)driver.video_data;
char buffer[128], buffer_fps[128];
bool fps_draw = g_settings.fps_show;
@ -148,8 +150,9 @@ static void gfx_ctx_d3d_update_title(void)
g_extern.frame_count++;
}
static void gfx_ctx_d3d_show_mouse(bool state)
static void gfx_ctx_d3d_show_mouse(void *data, bool state)
{
(void)data;
#ifdef HAVE_WINDOW
if (state)
while (ShowCursor(TRUE) < 0);
@ -262,9 +265,10 @@ void d3d_make_d3dpp(void *data, const video_info_t *info, D3DPRESENT_PARAMETERS
#endif
}
static void gfx_ctx_d3d_check_window(bool *quit,
static void gfx_ctx_d3d_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
{
(void)data;
d3d_video_t *d3d = (d3d_video_t*)driver.video_data;
*quit = false;
*resize = false;
@ -285,8 +289,9 @@ static void gfx_ctx_d3d_check_window(bool *quit,
#endif
}
static bool gfx_ctx_d3d_has_focus(void)
static bool gfx_ctx_d3d_has_focus(void *data)
{
(void)data;
#ifdef _XBOX
return true;
#else
@ -295,8 +300,9 @@ static bool gfx_ctx_d3d_has_focus(void)
#endif
}
static bool gfx_ctx_d3d_bind_api(enum gfx_ctx_api api, unsigned major, unsigned minor)
static bool gfx_ctx_d3d_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor)
{
(void)data;
(void)major;
(void)minor;
(void)api;
@ -307,13 +313,15 @@ static bool gfx_ctx_d3d_bind_api(enum gfx_ctx_api api, unsigned major, unsigned
#endif
}
static bool gfx_ctx_d3d_init(void)
static bool gfx_ctx_d3d_init(void *data)
{
(void)data;
return true;
}
static void gfx_ctx_d3d_destroy(void)
static void gfx_ctx_d3d_destroy(void *data)
{
(void)data;
#ifdef _XBOX
d3d_video_t * d3d = (d3d_video_t*)driver.video_data;
@ -327,8 +335,9 @@ static void gfx_ctx_d3d_destroy(void)
#endif
}
static void gfx_ctx_d3d_input_driver(const input_driver_t **input, void **input_data)
static void gfx_ctx_d3d_input_driver(void *data, const input_driver_t **input, void **input_data)
{
(void)data;
#ifdef _XBOX
void *xinput = input_xinput.init();
*input = xinput ? (const input_driver_t*)&input_xinput : NULL;
@ -340,8 +349,9 @@ static void gfx_ctx_d3d_input_driver(const input_driver_t **input, void **input_
#endif
}
static void gfx_ctx_d3d_get_video_size(unsigned *width, unsigned *height)
static void gfx_ctx_d3d_get_video_size(void *data, unsigned *width, unsigned *height)
{
(void)data;
#ifdef _XBOX
(void)width;
(void)height;
@ -437,8 +447,9 @@ static void gfx_ctx_d3d_get_video_size(unsigned *width, unsigned *height)
#endif
}
static void gfx_ctx_d3d_swap_interval(unsigned interval)
static void gfx_ctx_d3d_swap_interval(void *data, unsigned interval)
{
(void)data;
#ifdef _XBOX
d3d_video_t *d3d = (d3d_video_t*)driver.video_data;
LPDIRECT3DDEVICE d3dr = d3d->dev;

View File

@ -24,10 +24,12 @@ static void gfx_ctx_set_swap_interval(unsigned interval)
(void)interval;
}
static void gfx_ctx_destroy(void)
{}
static void gfx_ctx_destroy(void *data)
{
(void)data;
}
static void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
static void gfx_ctx_get_video_size(void *data, unsigned *width, unsigned *height)
{}
static bool gfx_ctx_init(void)
@ -35,12 +37,15 @@ static bool gfx_ctx_init(void)
return true;
}
static void gfx_ctx_swap_buffers(void)
static void gfx_ctx_swap_buffers(void *data)
// video_data can have changed here ...
video_data = driver.video_data;
{}
static void gfx_ctx_check_window(bool *quit,
static void gfx_ctx_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
{
(void)data;
(void)frame_count;
*quit = false;
@ -55,22 +60,25 @@ static void gfx_ctx_check_window(bool *quit,
}
}
static void gfx_ctx_set_resize(unsigned width, unsigned height)
static void gfx_ctx_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
}
static void gfx_ctx_update_window_title(void)
static void gfx_ctx_update_window_title(void *data)
{
(void)data;
char buf[128], buf_fps[128];
gfx_get_fps(buf, sizeof(buf), buf_fps, sizeof(buf_fps));
}
static bool gfx_ctx_set_video_mode(
static bool gfx_ctx_set_video_mode(void *data,
unsigned width, unsigned height,
bool fullscreen)
{
(void)data;
(void)width;
(void)height;
(void)fullscreen;
@ -78,20 +86,23 @@ static bool gfx_ctx_set_video_mode(
}
static void gfx_ctx_input_driver(const input_driver_t **input, void **input_data)
static void gfx_ctx_input_driver(void *data, const input_driver_t **input, void **input_data)
{
(void)data;
*input = NULL;
*input_data = NULL;
}
static bool gfx_ctx_bind_api(enum gfx_ctx_api api)
static bool gfx_ctx_bind_api(void *data, enum gfx_ctx_api api)
{
(void)data;
(void)api;
return true;
}
static bool gfx_ctx_has_focus(void)
static bool gfx_ctx_has_focus(void *data)
{
(void)data;
return true;
}

View File

@ -62,8 +62,9 @@ static unsigned gfx_ctx_get_resolution_height(unsigned resolution_id)
return resolution.height;
}
static float gfx_ctx_get_aspect_ratio(void)
static float gfx_ctx_get_aspect_ratio(void *data)
{
(void)data;
CellVideoOutState videoState;
cellVideoOutGetState(CELL_VIDEO_OUT_PRIMARY, 0, &videoState);
@ -78,7 +79,7 @@ static float gfx_ctx_get_aspect_ratio(void)
return 16.0f/9.0f;
}
static void gfx_ctx_get_available_resolutions (void)
static void gfx_ctx_get_available_resolutions(void)
{
bool defaultresolution;
uint32_t resolution_count;
@ -137,8 +138,9 @@ static void gfx_ctx_get_available_resolutions (void)
g_extern.console.screen.resolutions.check = true;
}
static void gfx_ctx_set_swap_interval(unsigned interval)
static void gfx_ctx_set_swap_interval(void *data, unsigned interval)
{
(void)data;
#if defined(HAVE_PSGL)
if (gl_context)
{
@ -150,10 +152,10 @@ static void gfx_ctx_set_swap_interval(unsigned interval)
#endif
}
static void gfx_ctx_check_window(bool *quit,
static void gfx_ctx_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
{
gl_t *gl = driver.video_data;
gl_t *gl = data;
*quit = false;
*resize = false;
@ -165,13 +167,15 @@ static void gfx_ctx_check_window(bool *quit,
*resize = true;
}
static bool gfx_ctx_has_focus(void)
static bool gfx_ctx_has_focus(void *data)
{
(void)data;
return true;
}
static void gfx_ctx_swap_buffers(void)
static void gfx_ctx_swap_buffers(void *data)
{
(void)data;
#ifdef HAVE_LIBDBGFONT
cellDbgFontDraw();
#endif
@ -183,10 +187,11 @@ static void gfx_ctx_swap_buffers(void)
#endif
}
static void gfx_ctx_set_resize(unsigned width, unsigned height) { }
static void gfx_ctx_set_resize(void *data, unsigned width, unsigned height) { }
static void gfx_ctx_update_window_title(void)
static void gfx_ctx_update_window_title(void *data)
{
(void)data;
char buf[128], buf_fps[128];
bool fps_draw = g_settings.fps_show;
gfx_get_fps(buf, sizeof(buf), fps_draw ? buf_fps : NULL, sizeof(buf_fps));
@ -195,15 +200,17 @@ static void gfx_ctx_update_window_title(void)
msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1);
}
static void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
static void gfx_ctx_get_video_size(void *data, unsigned *width, unsigned *height)
{
(void)data;
#if defined(HAVE_PSGL)
psglGetDeviceDimensions(gl_device, width, height);
#endif
}
static bool gfx_ctx_init(void)
static bool gfx_ctx_init(void *data)
{
(void)data;
#if defined(HAVE_PSGL)
PSGLinitOptions options = {
.enable = PSGL_INIT_MAX_SPUS | PSGL_INIT_INITIALIZE_SPUS,
@ -269,15 +276,17 @@ static bool gfx_ctx_init(void)
return true;
}
static bool gfx_ctx_set_video_mode(
static bool gfx_ctx_set_video_mode(void *data,
unsigned width, unsigned height,
bool fullscreen)
{
(void)data;
return true;
}
static void gfx_ctx_destroy(void)
static void gfx_ctx_destroy(void *data)
{
(void)data;
#if defined(HAVE_PSGL)
psglDestroyContext(gl_context);
psglDestroyDevice(gl_device);
@ -286,15 +295,17 @@ static void gfx_ctx_destroy(void)
#endif
}
static void gfx_ctx_input_driver(const input_driver_t **input, void **input_data)
static void gfx_ctx_input_driver(void *data, const input_driver_t **input, void **input_data)
{
(void)data;
void *ps3input = input_ps3.init();
*input = ps3input ? &input_ps3 : NULL;
*input_data = ps3input;
}
static bool gfx_ctx_bind_api(enum gfx_ctx_api api, unsigned major, unsigned minor)
static bool gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor)
{
(void)data;
(void)major;
(void)minor;
return api == GFX_CTX_OPENGL_API || GFX_CTX_OPENGL_ES_API;

View File

@ -76,8 +76,9 @@ static void sighandler(int sig)
g_quit = 1;
}
static void gfx_ctx_swap_interval(unsigned interval)
static void gfx_ctx_swap_interval(void *data, unsigned interval)
{
(void)data;
// Can be called before initialization.
// Some contexts require that swap interval is known at startup time.
g_interval = interval;
@ -85,9 +86,10 @@ static void gfx_ctx_swap_interval(unsigned interval)
eglSwapInterval(g_egl_dpy, interval);
}
static void gfx_ctx_check_window(bool *quit,
static void gfx_ctx_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
{
(void)data;
(void)frame_count;
(void)width;
(void)height;
@ -96,19 +98,22 @@ static void gfx_ctx_check_window(bool *quit,
*quit = g_quit;
}
static void gfx_ctx_swap_buffers(void)
static void gfx_ctx_swap_buffers(void *data)
{
(void)data;
eglSwapBuffers(g_egl_dpy, g_egl_surf);
}
static void gfx_ctx_set_resize(unsigned width, unsigned height)
static void gfx_ctx_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
}
static void gfx_ctx_update_window_title(void)
static void gfx_ctx_update_window_title(void *data)
{
(void)data;
char buf[128], buf_fps[128];
bool fps_draw = g_settings.fps_show;
gfx_get_fps(buf, sizeof(buf), fps_draw ? buf_fps : NULL, sizeof(buf_fps));
@ -117,15 +122,16 @@ static void gfx_ctx_update_window_title(void)
msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1);
}
static void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
static void gfx_ctx_get_video_size(void *data, unsigned *width, unsigned *height)
{
(void)data;
*width = g_fb_width;
*height = g_fb_height;
}
static void gfx_ctx_destroy(void);
static void gfx_ctx_destroy(void *data);
static bool gfx_ctx_init(void)
static bool gfx_ctx_init(void *data)
{
RARCH_LOG("[VC/EGL]: Initializing...\n");
if (g_inited)
@ -223,11 +229,11 @@ static bool gfx_ctx_init(void)
return true;
error:
gfx_ctx_destroy();
gfx_ctx_destroy(data);
return false;
}
static bool gfx_ctx_set_video_mode(
static bool gfx_ctx_set_video_mode(void *data,
unsigned width, unsigned height,
bool fullscreen)
{
@ -241,14 +247,15 @@ static bool gfx_ctx_set_video_mode(
sigaction(SIGINT, &sa, NULL);
sigaction(SIGTERM, &sa, NULL);
gfx_ctx_swap_interval(g_interval);
gfx_ctx_swap_interval(data, g_interval);
g_inited = true;
return true;
}
static bool gfx_ctx_bind_api(enum gfx_ctx_api api, unsigned major, unsigned minor)
static bool gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor)
{
(void)data;
(void)major;
(void)minor;
g_api = api;
@ -265,8 +272,9 @@ static bool gfx_ctx_bind_api(enum gfx_ctx_api api, unsigned major, unsigned mino
}
}
static void gfx_ctx_destroy(void)
static void gfx_ctx_destroy(void *data)
{
(void)data;
unsigned i;
if (g_egl_dpy)
{
@ -335,14 +343,16 @@ static void gfx_ctx_destroy(void)
}
}
static void gfx_ctx_input_driver(const input_driver_t **input, void **input_data)
static void gfx_ctx_input_driver(void *data, const input_driver_t **input, void **input_data)
{
(void)data;
*input = NULL;
*input_data = NULL;
}
static bool gfx_ctx_has_focus(void)
static bool gfx_ctx_has_focus(void *data)
{
(void)data;
return g_inited;
}
@ -351,8 +361,9 @@ static gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol)
return eglGetProcAddress(symbol);
}
static float gfx_ctx_translate_aspect(unsigned width, unsigned height)
static float gfx_ctx_translate_aspect(void *data, unsigned width, unsigned height)
{
(void)data;
// check for SD televisions: they should always be 4:3.
if ((width == 640 || width == 720) && (height == 480 || height == 576))
return 4.0f / 3.0f;
@ -360,8 +371,9 @@ static float gfx_ctx_translate_aspect(unsigned width, unsigned height)
return (float)width / height;
}
static bool gfx_ctx_init_egl_image_buffer(const video_info_t *video)
static bool gfx_ctx_init_egl_image_buffer(void *data, const video_info_t *video)
{
(void)data;
if (g_api == GFX_CTX_OPENVG_API) // don't bother, we just use VGImages for our EGLImage anyway
{
return false;
@ -434,8 +446,9 @@ fail:
return false;
}
static bool gfx_ctx_write_egl_image(const void *frame, unsigned width, unsigned height, unsigned pitch, bool rgb32, unsigned index, void **image_handle)
static bool gfx_ctx_write_egl_image(void *data, const void *frame, unsigned width, unsigned height, unsigned pitch, bool rgb32, unsigned index, void **image_handle)
{
(void)data;
bool ret = false;
if (index >= MAX_EGLIMAGE_TEXTURES)

View File

@ -236,8 +236,9 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
return DefWindowProc(hwnd, message, wparam, lparam);
}
static void gfx_ctx_swap_interval(unsigned interval)
static void gfx_ctx_swap_interval(void *data, unsigned interval)
{
(void)data;
g_interval = interval;
if (g_hrc && p_swap_interval)
@ -248,9 +249,10 @@ static void gfx_ctx_swap_interval(unsigned interval)
}
}
static void gfx_ctx_check_window(bool *quit,
static void gfx_ctx_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
{
(void)data;
(void)frame_count;
MSG msg;
@ -270,19 +272,22 @@ static void gfx_ctx_check_window(bool *quit,
}
}
static void gfx_ctx_swap_buffers(void)
static void gfx_ctx_swap_buffers(void *data)
{
(void)data;
SwapBuffers(g_hdc);
}
static void gfx_ctx_set_resize(unsigned width, unsigned height)
static void gfx_ctx_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
}
static void gfx_ctx_update_window_title(void)
static void gfx_ctx_update_window_title(void *data)
{
(void)data;
char buf[128], buf_fps[128];
bool fps_draw = g_settings.fps_show;
if (gfx_get_fps(buf, sizeof(buf), fps_draw ? buf_fps : NULL, sizeof(buf_fps)))
@ -292,8 +297,9 @@ static void gfx_ctx_update_window_title(void)
msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1);
}
static void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
static void gfx_ctx_get_video_size(void *data, unsigned *width, unsigned *height)
{
(void)data;
if (!g_hwnd)
{
HMONITOR hm_to_use = NULL;
@ -317,8 +323,9 @@ static BOOL CALLBACK monitor_enum_proc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT
return TRUE;
}
static bool gfx_ctx_init(void)
static bool gfx_ctx_init(void *data)
{
(void)data;
if (g_inited)
return false;
@ -380,7 +387,7 @@ static void monitor_info(MONITORINFOEX *mon, HMONITOR *hm_to_use)
GetMonitorInfo(*hm_to_use, (MONITORINFO*)mon);
}
static bool gfx_ctx_set_video_mode(
static bool gfx_ctx_set_video_mode(void *data,
unsigned width, unsigned height,
bool fullscreen)
{
@ -469,12 +476,13 @@ static bool gfx_ctx_set_video_mode(
return true;
error:
gfx_ctx_destroy();
gfx_ctx_destroy(data);
return false;
}
static void gfx_ctx_destroy(void)
static void gfx_ctx_destroy(void *data)
{
(void)data;
if (g_hrc)
{
glFinish();
@ -516,15 +524,17 @@ static void gfx_ctx_destroy(void)
p_swap_interval = NULL;
}
static void gfx_ctx_input_driver(const input_driver_t **input, void **input_data)
static void gfx_ctx_input_driver(void *data, const input_driver_t **input, void **input_data)
{
(void)data;
dinput = input_dinput.init();
*input = dinput ? &input_dinput : NULL;
*input_data = dinput;
}
static bool gfx_ctx_has_focus(void)
static bool gfx_ctx_has_focus(void *data)
{
(void)data;
if (!g_inited)
return false;
@ -536,15 +546,17 @@ static gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol)
return (gfx_ctx_proc_t)wglGetProcAddress(symbol);
}
static bool gfx_ctx_bind_api(enum gfx_ctx_api api, unsigned major, unsigned minor)
static bool gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor)
{
(void)data;
g_major = major;
g_minor = minor;
return api == GFX_CTX_OPENGL_API;
}
static void gfx_ctx_show_mouse(bool state)
static void gfx_ctx_show_mouse(void *data, bool state)
{
(void)data;
show_cursor(state);
}