From c257374dcd62512200981011a266d0fa00b9e277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Higor=20Eur=C3=ADpedes?= Date: Tue, 8 Dec 2015 12:18:57 -0300 Subject: [PATCH] (video_context_driver) Make better use of the data argument in context calls --- gfx/drivers/gl.c | 46 +++++------ gfx/drivers_context/bbqnx_ctx.c | 8 +- gfx/drivers_context/cgl_ctx.c | 6 +- gfx/drivers_context/cocoa_gl_ctx.m | 6 +- gfx/drivers_context/d3d_ctx.cpp | 6 +- gfx/drivers_context/drm_egl_ctx.c | 21 ++--- gfx/drivers_context/emscriptenegl_ctx.c | 12 +-- gfx/drivers_context/gfx_null_ctx.c | 6 +- gfx/drivers_context/glx_ctx.c | 25 +++--- gfx/drivers_context/mali_fbdev_ctx.c | 8 +- gfx/drivers_context/ps3_ctx.c | 20 ++--- gfx/drivers_context/sdl_gl_ctx.c | 32 +++----- gfx/drivers_context/vc_egl_ctx.c | 10 +-- gfx/drivers_context/vivante_fbdev_ctx.c | 10 +-- gfx/drivers_context/wayland_ctx.c | 50 ++++-------- gfx/drivers_context/wgl_ctx.cpp | 10 +-- gfx/drivers_context/xegl_ctx.c | 10 +-- gfx/video_context_driver.c | 103 +++++++++++------------- gfx/video_context_driver.h | 59 ++++++-------- gfx/video_driver.c | 6 +- 20 files changed, 191 insertions(+), 263 deletions(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 16ae293fc4..6041f3b228 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -108,7 +108,7 @@ static const GLfloat white_color[] = { static INLINE void context_bind_hw_render(gl_t *gl, bool enable) { if (gl && gl->shared_context_use) - gfx_ctx_bind_hw_render(gl, enable); + gfx_ctx_bind_hw_render(enable); } static INLINE bool gl_query_extension(gl_t *gl, const char *ext) @@ -851,7 +851,7 @@ static void gl_set_viewport(void *data, unsigned viewport_width, video_driver_get_size(&width, &height); - gfx_ctx_translate_aspect(gl, &device_aspect, + gfx_ctx_translate_aspect(&device_aspect, viewport_width, viewport_height); if (settings->video.scale_integer && !force_full) @@ -951,7 +951,7 @@ static void gl_set_rotation(void *data, unsigned rotation) static void gl_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen) { - gfx_ctx_set_video_mode(data, width, height, fullscreen); + gfx_ctx_set_video_mode(width, height, fullscreen); } #ifdef HAVE_FBO @@ -1680,7 +1680,7 @@ static bool gl_frame(void *data, const void *frame, { gl->should_resize = false; - gfx_ctx_set_resize(gl, width, height); + gfx_ctx_set_resize(width, height); #ifdef HAVE_FBO if (gl->fbo_inited) @@ -1809,7 +1809,7 @@ static bool gl_frame(void *data, const void *frame, gl_render_overlay(gl); #endif - gfx_ctx_update_window_title(gl); + gfx_ctx_update_window_title(); retro_perf_stop(&frame_run); @@ -1856,11 +1856,11 @@ static bool gl_frame(void *data, const void *frame, && !input_driver_ctl(RARCH_INPUT_CTL_IS_NONBLOCK_STATE, NULL) && !is_slowmotion && !is_paused) { - gfx_ctx_swap_buffers(gl); + gfx_ctx_swap_buffers(); glClear(GL_COLOR_BUFFER_BIT); } - gfx_ctx_swap_buffers(gl); + gfx_ctx_swap_buffers(); #ifdef HAVE_GL_SYNC if (settings->video.hard_sync && gl->have_sync) @@ -1987,7 +1987,7 @@ static void gl_free(void *data) } #endif - gfx_ctx_free(gl); + gfx_ctx_free(); free(gl->empty_buf); free(gl->conv_buffer); @@ -2005,7 +2005,7 @@ static void gl_set_nonblock_state(void *data, bool state) RARCH_LOG("[GL]: VSync => %s\n", state ? "off" : "on"); context_bind_hw_render(gl, false); - gfx_ctx_swap_interval(gl, + gfx_ctx_swap_interval( state ? 0 : settings->video.swap_interval); context_bind_hw_render(gl, true); } @@ -2467,10 +2467,10 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo RARCH_LOG("Found GL context: %s\n", ctx_driver->ident); - gfx_ctx_get_video_size(gl, &gl->full_x, &gl->full_y); + gfx_ctx_get_video_size(&gl->full_x, &gl->full_y); RARCH_LOG("Detecting screen resolution %ux%u.\n", gl->full_x, gl->full_y); - gfx_ctx_swap_interval(gl, + gfx_ctx_swap_interval( video->vsync ? settings->video.swap_interval : 0); win_width = video->width; @@ -2482,7 +2482,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo win_height = gl->full_y; } - if (!gfx_ctx_set_video_mode(gl, win_width, win_height, video->fullscreen)) + if (!gfx_ctx_set_video_mode(win_width, win_height, video->fullscreen)) goto error; /* Clear out potential error flags in case we use cached context. */ @@ -2513,7 +2513,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo gl->fullscreen = video->fullscreen; /* Get real known video size, which might have been altered by context. */ - gfx_ctx_get_video_size(gl, &temp_width, &temp_height); + gfx_ctx_get_video_size(&temp_width, &temp_height); if (temp_width != 0 && temp_height != 0) video_driver_set_size(&temp_width, &temp_height); @@ -2641,7 +2641,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo goto error; #endif - gfx_ctx_input_driver(gl, input, input_data); + gfx_ctx_input_driver(input, input_data); if (settings->video.font_enable) { @@ -2677,7 +2677,7 @@ static bool gl_alive(void *data) /* Needed because some context drivers don't track their sizes */ video_driver_get_size(&temp_width, &temp_height); - if (gfx_ctx_check_window(data, &quit, + if (gfx_ctx_check_window(&quit, &resize, &temp_width, &temp_height)) { if (quit) @@ -2696,17 +2696,17 @@ static bool gl_alive(void *data) static bool gl_focus(void *data) { - return gfx_ctx_focus(data); + return gfx_ctx_focus(); } static bool gl_suppress_screensaver(void *data, bool enable) { - return gfx_ctx_suppress_screensaver(data, enable); + return gfx_ctx_suppress_screensaver(enable); } static bool gl_has_windowed(void *data) { - return gfx_ctx_has_windowed(data); + return gfx_ctx_has_windowed(); } static void gl_update_tex_filter_frame(gl_t *gl) @@ -3189,7 +3189,7 @@ static void gl_overlay_enable(void *data, bool state) gl->overlay_enable = state; if (gl->fullscreen) - gfx_ctx_show_mouse(gl, state); + gfx_ctx_show_mouse(state); } static void gl_overlay_full_screen(void *data, bool enable) @@ -3381,7 +3381,7 @@ static void gl_set_osd_msg(void *data, const char *msg, static void gl_show_mouse(void *data, bool state) { - gfx_ctx_show_mouse(data, state); + gfx_ctx_show_mouse(state); } static struct video_shader *gl_get_current_shader(void *data) @@ -3393,17 +3393,17 @@ static struct video_shader *gl_get_current_shader(void *data) static void gl_get_video_output_size(void *data, unsigned *width, unsigned *height) { - gfx_ctx_get_video_output_size(data, width, height); + gfx_ctx_get_video_output_size(width, height); } static void gl_get_video_output_prev(void *data) { - gfx_ctx_get_video_output_prev(data); + gfx_ctx_get_video_output_prev(); } static void gl_get_video_output_next(void *data) { - gfx_ctx_get_video_output_next(data); + gfx_ctx_get_video_output_next(); } static const video_poke_interface_t gl_poke_interface = { diff --git a/gfx/drivers_context/bbqnx_ctx.c b/gfx/drivers_context/bbqnx_ctx.c index c3855eceb9..ee0adb49a8 100644 --- a/gfx/drivers_context/bbqnx_ctx.c +++ b/gfx/drivers_context/bbqnx_ctx.c @@ -47,7 +47,7 @@ static void gfx_ctx_qnx_destroy(void *data) g_resize = false; } -static bool gfx_ctx_qnx_init(void *data) +static void *gfx_ctx_qnx_init(void *video_driver) { EGLint n; EGLint major, minor; @@ -214,14 +214,14 @@ static bool gfx_ctx_qnx_init(void *data) if (!egl_create_surface(screen_win)) goto error; - return true; + return "egl"; error: RARCH_ERR("EGL error: %d.\n", eglGetError()); - gfx_ctx_qnx_destroy(data); + gfx_ctx_qnx_destroy(video_driver); screen_error: screen_stop_events(screen_ctx); - return false; + return NULL; } static void gfx_ctx_qnx_check_window(void *data, bool *quit, diff --git a/gfx/drivers_context/cgl_ctx.c b/gfx/drivers_context/cgl_ctx.c index 56715d1c97..2279878be6 100644 --- a/gfx/drivers_context/cgl_ctx.c +++ b/gfx/drivers_context/cgl_ctx.c @@ -304,7 +304,7 @@ static CGSSurfaceID attach_gl_context_to_window(CGLContextObj glCtx, return sid; } -static bool gfx_ctx_cgl_init(void *data) +static void *gfx_ctx_cgl_init(void *video_driver) { CGError err; gfx_ctx_cgl_data_t *cgl = (gfx_ctx_cgl_data_t*)calloc(1, sizeof(gfx_ctx_cgl_data_t)); @@ -333,12 +333,12 @@ static bool gfx_ctx_cgl_init(void *data) gfx_ctx_data_set(cgl); - return true; + return cgl; error: gfx_ctx_cgl_destroy(cgl); - return false; + return NULL; } const gfx_ctx_driver_t gfx_ctx_cgl = { diff --git a/gfx/drivers_context/cocoa_gl_ctx.m b/gfx/drivers_context/cocoa_gl_ctx.m index 3f203a5768..e3cd933a49 100644 --- a/gfx/drivers_context/cocoa_gl_ctx.m +++ b/gfx/drivers_context/cocoa_gl_ctx.m @@ -148,9 +148,9 @@ void cocoagl_gfx_ctx_update(void) #endif } -static bool cocoagl_gfx_ctx_init(void *data) +static void *cocoagl_gfx_ctx_init(void *video_driver) { - (void)data; + (void)video_driver; #if defined(HAVE_COCOA) CocoaView *g_view = (CocoaView*)nsview_get_ptr(); @@ -196,7 +196,7 @@ static bool cocoagl_gfx_ctx_init(void *data) [g_context makeCurrentContext]; // Make sure the view was created [CocoaView get]; - return true; + return "cocoa"; } static void cocoagl_gfx_ctx_destroy(void *data) diff --git a/gfx/drivers_context/d3d_ctx.cpp b/gfx/drivers_context/d3d_ctx.cpp index 0bb9646510..153a44c2a6 100644 --- a/gfx/drivers_context/d3d_ctx.cpp +++ b/gfx/drivers_context/d3d_ctx.cpp @@ -159,13 +159,13 @@ static bool gfx_ctx_d3d_bind_api(void *data, #endif } -static bool gfx_ctx_d3d_init(void *data) +static void *gfx_ctx_d3d_init(void *video_driver) { - (void)data; + (void)video_driver; win32_monitor_init(); - return true; + return "d3d"; } static void gfx_ctx_d3d_destroy(void *data) diff --git a/gfx/drivers_context/drm_egl_ctx.c b/gfx/drivers_context/drm_egl_ctx.c index 67e5b90463..2ae4ff6675 100644 --- a/gfx/drivers_context/drm_egl_ctx.c +++ b/gfx/drivers_context/drm_egl_ctx.c @@ -250,8 +250,7 @@ static void gfx_ctx_drm_egl_update_window_title(void *data) static void gfx_ctx_drm_egl_get_video_size(void *data, unsigned *width, unsigned *height) { - gfx_ctx_drm_egl_data_t *drm = (gfx_ctx_drm_egl_data_t*) - gfx_ctx_data_get_ptr(); + gfx_ctx_drm_egl_data_t *drm = (gfx_ctx_drm_egl_data_t*)data; if (!drm) return; @@ -307,7 +306,7 @@ static void gfx_ctx_drm_egl_destroy_resources(gfx_ctx_drm_egl_data_t *drm) g_next_bo = NULL; } -static bool gfx_ctx_drm_egl_init(void *data) +static void *gfx_ctx_drm_egl_init(void *video_driver) { int fd, i; unsigned monitor_index; @@ -317,7 +316,7 @@ static bool gfx_ctx_drm_egl_init(void *data) gfx_ctx_drm_egl_data_t *drm = (gfx_ctx_drm_egl_data_t*)calloc(1, sizeof(gfx_ctx_drm_egl_data_t)); if (!drm) - return false; + return NULL; fd = -1; gpu_descriptors = dir_list_new("/dev/dri", NULL, false, false); @@ -368,8 +367,6 @@ nextgpu: dir_list_free(gpu_descriptors); - gfx_ctx_data_set(drm); - /* Setup the flip handler. */ g_drm_fds.fd = fd; g_drm_fds.events = POLLIN; @@ -378,7 +375,7 @@ nextgpu: g_drm_fd = fd; - return true; + return drm; error: dir_list_free(gpu_descriptors); @@ -388,7 +385,7 @@ error: if (drm) free(drm); - return false; + return NULL; } static EGLint *egl_fill_attribs(EGLint *attr) @@ -499,8 +496,7 @@ static bool gfx_ctx_drm_egl_set_video_mode(void *data, int i, ret = 0; struct drm_fb *fb = NULL; settings_t *settings = config_get_ptr(); - gfx_ctx_drm_egl_data_t *drm = (gfx_ctx_drm_egl_data_t*) - gfx_ctx_data_get_ptr(); + gfx_ctx_drm_egl_data_t *drm = (gfx_ctx_drm_egl_data_t*)data; if (!drm) return false; @@ -631,14 +627,13 @@ error: static void gfx_ctx_drm_egl_destroy(void *data) { - gfx_ctx_drm_egl_data_t *drm = (gfx_ctx_drm_egl_data_t*) - gfx_ctx_data_get_ptr(); + gfx_ctx_drm_egl_data_t *drm = (gfx_ctx_drm_egl_data_t*)data; if (!drm) return; gfx_ctx_drm_egl_destroy_resources(drm); - gfx_ctx_free_data(); + free(drm); } static void gfx_ctx_drm_egl_input_driver(void *data, diff --git a/gfx/drivers_context/emscriptenegl_ctx.c b/gfx/drivers_context/emscriptenegl_ctx.c index 0518fff611..76f4646b9e 100644 --- a/gfx/drivers_context/emscriptenegl_ctx.c +++ b/gfx/drivers_context/emscriptenegl_ctx.c @@ -101,7 +101,7 @@ static void gfx_ctx_emscripten_get_video_size(void *data, static void gfx_ctx_emscripten_destroy(void *data); -static bool gfx_ctx_emscripten_init(void *data) +static void *gfx_ctx_emscripten_init(void *video_driver) { EGLint width, height, n, major, minor; static const EGLint attribute_list[] = @@ -119,12 +119,12 @@ static bool gfx_ctx_emscripten_init(void *data) EGL_NONE }; - (void)data; + (void)video_driver; if (g_egl_inited) { RARCH_LOG("[EMSCRIPTEN/EGL]: Attempted to re-initialize driver.\n"); - return true; + return (void*)"emscripten"; } if (!egl_init_context(EGL_DEFAULT_DISPLAY, &major, &minor, @@ -149,11 +149,11 @@ static bool gfx_ctx_emscripten_init(void *data) g_fb_height = height; RARCH_LOG("[EMSCRIPTEN/EGL]: Dimensions: %ux%u\n", width, height); - return true; + return (void*)"emscripten"; error: - gfx_ctx_emscripten_destroy(data); - return false; + gfx_ctx_emscripten_destroy(video_driver); + return NULL; } static bool gfx_ctx_emscripten_set_video_mode(void *data, diff --git a/gfx/drivers_context/gfx_null_ctx.c b/gfx/drivers_context/gfx_null_ctx.c index 31cf3c39e7..96921fef1a 100644 --- a/gfx/drivers_context/gfx_null_ctx.c +++ b/gfx/drivers_context/gfx_null_ctx.c @@ -125,11 +125,11 @@ static void gfx_ctx_null_bind_hw_render(void *data, bool enable) (void)enable; } -static bool gfx_ctx_null_init(void *data) +static void *gfx_ctx_null_init(void *video_driver) { - (void)data; + (void)video_driver; - return true; + return (void*)"null"; } const gfx_ctx_driver_t gfx_ctx_null = { diff --git a/gfx/drivers_context/glx_ctx.c b/gfx/drivers_context/glx_ctx.c index 60753ce8db..8bfb3b28fc 100644 --- a/gfx/drivers_context/glx_ctx.c +++ b/gfx/drivers_context/glx_ctx.c @@ -116,8 +116,7 @@ static void ctx_glx_destroy_resources(gfx_ctx_glx_data_t *glx) static void gfx_ctx_glx_destroy(void *data) { - gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*) - gfx_ctx_data_get_ptr(); + gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)data; if (!glx) return; @@ -125,13 +124,12 @@ static void gfx_ctx_glx_destroy(void *data) (void)data; ctx_glx_destroy_resources(glx); - gfx_ctx_free_data(); + free(data); } static void gfx_ctx_glx_swap_interval(void *data, unsigned interval) { - gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*) - gfx_ctx_data_get_ptr(); + gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)data; glx->g_interval = interval; @@ -156,8 +154,7 @@ static void gfx_ctx_glx_swap_interval(void *data, unsigned interval) static void gfx_ctx_glx_swap_buffers(void *data) { - gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*) - gfx_ctx_data_get_ptr(); + gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)data; if (glx->g_is_double) glXSwapBuffers(g_x11_dpy, glx->g_glx_win); @@ -171,7 +168,7 @@ static void gfx_ctx_glx_set_resize(void *data, (void)height; } -static bool gfx_ctx_glx_init(void *data) +static void *gfx_ctx_glx_init(void *data) { static const int visual_attribs[] = { GLX_X_RENDERABLE , True, @@ -241,9 +238,7 @@ static bool gfx_ctx_glx_init(void *data) glx->g_fbc = fbcs[0]; XFree(fbcs); - gfx_ctx_data_set(glx); - - return true; + return glx; error: ctx_glx_destroy_resources(glx); @@ -252,7 +247,7 @@ error: free(glx); g_x11_screen = 0; - return false; + return NULL; } static bool gfx_ctx_glx_set_video_mode(void *data, @@ -266,8 +261,7 @@ static bool gfx_ctx_glx_set_video_mode(void *data, XSetWindowAttributes swa = {0}; int (*old_handler)(Display*, XErrorEvent*) = NULL; settings_t *settings = config_get_ptr(); - gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*) - gfx_ctx_data_get_ptr(); + gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)data; x11_install_sighandlers(); @@ -555,8 +549,7 @@ static void gfx_ctx_glx_show_mouse(void *data, bool state) static void gfx_ctx_glx_bind_hw_render(void *data, bool enable) { - gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*) - gfx_ctx_data_get_ptr(); + gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)data; if (!glx) return; diff --git a/gfx/drivers_context/mali_fbdev_ctx.c b/gfx/drivers_context/mali_fbdev_ctx.c index 2ae81a368b..29754e9bbf 100644 --- a/gfx/drivers_context/mali_fbdev_ctx.c +++ b/gfx/drivers_context/mali_fbdev_ctx.c @@ -61,7 +61,7 @@ static void gfx_ctx_mali_fbdev_get_video_size(void *data, *height = g_height; } -static bool gfx_ctx_mali_fbdev_init(void *data) +static void *gfx_ctx_mali_fbdev_init(void *video_driver) { EGLint n; EGLint major, minor; @@ -88,12 +88,12 @@ static bool gfx_ctx_mali_fbdev_init(void *data) goto error; } - return true; + return (void*)"mali"; error: RARCH_ERR("[Mali fbdev]: EGL error: %d.\n", eglGetError()); - gfx_ctx_mali_fbdev_destroy(data); - return false; + gfx_ctx_mali_fbdev_destroy(video_driver); + return NULL; } static void gfx_ctx_mali_fbdev_check_window(void *data, bool *quit, diff --git a/gfx/drivers_context/ps3_ctx.c b/gfx/drivers_context/ps3_ctx.c index 58625f4c5e..b76e504c7d 100644 --- a/gfx/drivers_context/ps3_ctx.c +++ b/gfx/drivers_context/ps3_ctx.c @@ -207,10 +207,7 @@ static void gfx_ctx_ps3_update_window_title(void *data) static void gfx_ctx_ps3_get_video_size(void *data, unsigned *width, unsigned *height) { - gfx_ctx_ps3_data_t *ps3 = (gfx_ctx_ps3_data_t*) - gfx_ctx_data_get_ptr(); - - (void)data; + gfx_ctx_ps3_data_t *ps3 = (gfx_ctx_ps3_data_t*)data; #if defined(HAVE_PSGL) if (ps3) @@ -218,7 +215,7 @@ static void gfx_ctx_ps3_get_video_size(void *data, #endif } -static bool gfx_ctx_ps3_init(void *data) +static void *gfx_ctx_ps3_init(void *video_driver) { #ifdef HAVE_PSGL PSGLdeviceParameters params; @@ -228,11 +225,11 @@ static bool gfx_ctx_ps3_init(void *data) gfx_ctx_ps3_data_t *ps3 = (gfx_ctx_ps3_data_t*) calloc(1, sizeof(gfx_ctx_ps3_data_t)); - (void)data; + (void)video_driver; (void)global; if (!ps3) - return false; + return NULL; #if defined(HAVE_PSGL) options.enable = PSGL_INIT_MAX_SPUS | PSGL_INIT_INITIALIZE_SPUS; @@ -291,9 +288,7 @@ static bool gfx_ctx_ps3_init(void *data) gfx_ctx_ps3_get_available_resolutions(); - gfx_ctx_data_set(ps3); - - return true; + return ps3; } static bool gfx_ctx_ps3_set_video_mode(void *data, @@ -326,10 +321,7 @@ static void gfx_ctx_ps3_destroy_resources(gfx_ctx_ps3_data_t *ps3) static void gfx_ctx_ps3_destroy(void *data) { - gfx_ctx_ps3_data_t *ps3 = (gfx_ctx_ps3_data_t*) - gfx_ctx_data_get_ptr(); - - (void)data; + gfx_ctx_ps3_data_t *ps3 = (gfx_ctx_ps3_data_t*)data; if (!ps3) return; diff --git a/gfx/drivers_context/sdl_gl_ctx.c b/gfx/drivers_context/sdl_gl_ctx.c index 0b653feda9..9dadc7dde4 100644 --- a/gfx/drivers_context/sdl_gl_ctx.c +++ b/gfx/drivers_context/sdl_gl_ctx.c @@ -65,13 +65,13 @@ static void sdl_ctx_destroy_resources(gfx_ctx_sdl_data_t *sdl) SDL_QuitSubSystem(SDL_INIT_VIDEO); } -static bool sdl_ctx_init(void *data) +static void *sdl_ctx_init(void *video_driver) { gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*) calloc(1, sizeof(gfx_ctx_sdl_data_t)); if (!sdl) - return false; + return NULL; #ifdef HAVE_X11 XInitThreads(); @@ -88,9 +88,7 @@ static bool sdl_ctx_init(void *data) RARCH_LOG("[SDL_GL] SDL %i.%i.%i gfx context driver initialized.\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL); - gfx_ctx_data_set(sdl); - - return true; + return sdl; error: RARCH_WARN("[SDL_GL]: Failed to initialize SDL gfx context driver: %s\n", @@ -101,20 +99,18 @@ error: if (sdl) free(sdl); - return false; + return NULL; } static void sdl_ctx_destroy(void *data) { - gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)gfx_ctx_data_get_ptr(); + gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data; if (!sdl) return; - - (void)data; sdl_ctx_destroy_resources(sdl); - gfx_ctx_free_data(); + free(sdl); } static bool sdl_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned major, @@ -162,9 +158,7 @@ static bool sdl_ctx_set_video_mode(void *data, unsigned width, unsigned height, { unsigned fsflag = 0; settings_t *settings = config_get_ptr(); - gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)gfx_ctx_data_get_ptr(); - - (void)data; + gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data; sdl->g_new_width = width; sdl->g_new_height = height; @@ -231,7 +225,7 @@ static void sdl_ctx_get_video_size(void *data, unsigned *width, unsigned *height) { settings_t *settings = config_get_ptr(); - gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)gfx_ctx_data_get_ptr(); + gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data; if (!sdl) return; @@ -269,7 +263,7 @@ static void sdl_ctx_update_window_title(void *data) char buf[128] = {0}; char buf_fps[128] = {0}; settings_t *settings = config_get_ptr(); - gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)gfx_ctx_data_get_ptr(); + gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data; if (!sdl) return; @@ -291,9 +285,7 @@ static void sdl_ctx_check_window(void *data, bool *quit, bool *resize,unsigned * unsigned *height, unsigned frame_count) { SDL_Event event; - gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)gfx_ctx_data_get_ptr(); - - (void)data; + gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data; SDL_PumpEvents(); @@ -354,7 +346,7 @@ static bool sdl_ctx_has_focus(void *data) unsigned flags; #ifdef HAVE_SDL2 - gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)gfx_ctx_data_get_ptr(); + gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data; flags = (SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_MOUSE_FOCUS); return (SDL_GetWindowFlags(sdl->g_win) & flags) == flags; #else @@ -381,7 +373,7 @@ static bool sdl_ctx_has_windowed(void *data) static void sdl_ctx_swap_buffers(void *data) { #ifdef HAVE_SDL2 - gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)gfx_ctx_data_get_ptr(); + gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data; SDL_GL_SwapWindow(sdl->g_win); #else SDL_GL_SwapBuffers(); diff --git a/gfx/drivers_context/vc_egl_ctx.c b/gfx/drivers_context/vc_egl_ctx.c index 5aefc075e1..016bbc5e16 100644 --- a/gfx/drivers_context/vc_egl_ctx.c +++ b/gfx/drivers_context/vc_egl_ctx.c @@ -131,7 +131,7 @@ static void gfx_ctx_vc_get_video_size(void *data, static void gfx_ctx_vc_destroy(void *data); -static bool gfx_ctx_vc_init(void *data) +static void *gfx_ctx_vc_init(void *video_driver) { VC_DISPMANX_ALPHA_T alpha; EGLint n, major, minor; @@ -164,7 +164,7 @@ static bool gfx_ctx_vc_init(void *data) if (g_egl_inited) { RARCH_ERR("[VC/EGL]: Attempted to re-initialize driver.\n"); - return false; + return (void*)"vc"; } bcm_host_init(); @@ -262,11 +262,11 @@ static bool gfx_ctx_vc_init(void *data) if (!egl_create_surface(&nativewindow)) goto error; - return true; + return (void*)"vc"; error: - gfx_ctx_vc_destroy(data); - return false; + gfx_ctx_vc_destroy(video_driver); + return NULL; } static bool gfx_ctx_vc_set_video_mode(void *data, diff --git a/gfx/drivers_context/vivante_fbdev_ctx.c b/gfx/drivers_context/vivante_fbdev_ctx.c index b8d979d2ed..238f8b685f 100644 --- a/gfx/drivers_context/vivante_fbdev_ctx.c +++ b/gfx/drivers_context/vivante_fbdev_ctx.c @@ -32,7 +32,7 @@ static void gfx_ctx_vivante_destroy(void *data) g_resize = false; } -static bool gfx_ctx_vivante_init(void *data) +static void *gfx_ctx_vivante_init(void *video_driver) { EGLint n; EGLint major, minor; @@ -50,7 +50,7 @@ static bool gfx_ctx_vivante_init(void *data) EGL_NONE }; - (void)data; + (void)video_driver; egl_install_sighandlers(); @@ -61,12 +61,12 @@ static bool gfx_ctx_vivante_init(void *data) goto error; } - return true; + return (void*)"vivante"; error: RARCH_ERR("[Vivante fbdev]: EGL error: %d.\n", eglGetError()); - gfx_ctx_vivante_destroy(data); - return false; + gfx_ctx_vivante_destroy(video_driver); + return NULL; } static void gfx_ctx_vivante_check_window(void *data, bool *quit, diff --git a/gfx/drivers_context/wayland_ctx.c b/gfx/drivers_context/wayland_ctx.c index 2e781e799b..2a04a1d556 100644 --- a/gfx/drivers_context/wayland_ctx.c +++ b/gfx/drivers_context/wayland_ctx.c @@ -65,10 +65,8 @@ static void shell_surface_handle_configure(void *data, struct wl_shell_surface *shell_surface, uint32_t edges, int32_t width, int32_t height) { - gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*) - gfx_ctx_data_get_ptr(); + gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; - (void)data; (void)shell_surface; (void)edges; @@ -96,10 +94,8 @@ static const struct wl_shell_surface_listener shell_surface_listener = { static void registry_handle_global(void *data, struct wl_registry *reg, uint32_t id, const char *interface, uint32_t version) { - gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*) - gfx_ctx_data_get_ptr(); + gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; - (void)data; (void)version; if (!strcmp(interface, "wl_compositor")) @@ -218,10 +214,7 @@ static void gfx_ctx_wl_check_window(void *data, bool *quit, static void gfx_ctx_wl_set_resize(void *data, unsigned width, unsigned height) { - gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*) - gfx_ctx_data_get_ptr(); - - (void)data; + gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; wl_egl_window_resize(wl->g_win, width, height, 0, 0); } @@ -231,10 +224,7 @@ static void gfx_ctx_wl_update_window_title(void *data) char buf[128] = {0}; char buf_fps[128] = {0}; settings_t *settings = config_get_ptr(); - gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*) - gfx_ctx_data_get_ptr(); - - (void)data; + gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; if (video_monitor_get_fps(buf, sizeof(buf), buf_fps, sizeof(buf_fps))) @@ -247,10 +237,7 @@ static void gfx_ctx_wl_update_window_title(void *data) static void gfx_ctx_wl_get_video_size(void *data, unsigned *width, unsigned *height) { - gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*) - gfx_ctx_data_get_ptr(); - - (void)data; + gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; *width = wl->g_width; *height = wl->g_height; @@ -267,7 +254,7 @@ static void gfx_ctx_wl_get_video_size(void *data, EGL_ALPHA_SIZE, 0, \ EGL_DEPTH_SIZE, 0 -static bool gfx_ctx_wl_init(void *data) +static void *gfx_ctx_wl_init(void *video_driver) { static const EGLint egl_attribs_gl[] = { WL_EGL_ATTRIBS_BASE, @@ -301,10 +288,10 @@ static bool gfx_ctx_wl_init(void *data) gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*) calloc(1, sizeof(gfx_ctx_wayland_data_t)); - (void)data; + (void)video_driver; if (!wl) - return false; + return NULL; switch (g_egl_api) { @@ -335,8 +322,6 @@ static bool gfx_ctx_wl_init(void *data) goto error; } - gfx_ctx_data_set(wl); - wl->g_registry = wl_display_get_registry(wl->g_dpy); wl_registry_add_listener(wl->g_registry, ®istry_listener, NULL); wl_display_dispatch(wl->g_dpy); @@ -365,7 +350,7 @@ static bool gfx_ctx_wl_init(void *data) if (n == 0 || !egl_has_config()) goto error; - return true; + return wl; error: gfx_ctx_wl_destroy_resources(wl); @@ -373,9 +358,7 @@ error: if (wl) free(wl); - gfx_ctx_free_data(); - - return false; + return NULL; } static EGLint *egl_fill_attribs(EGLint *attr) @@ -442,17 +425,14 @@ static EGLint *egl_fill_attribs(EGLint *attr) static void gfx_ctx_wl_destroy(void *data) { - gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*) - gfx_ctx_data_get_ptr(); - - (void)data; + gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; if (!wl) return; gfx_ctx_wl_destroy_resources(wl); - gfx_ctx_free_data(); + free(wl); } static bool gfx_ctx_wl_set_video_mode(void *data, @@ -461,8 +441,7 @@ static bool gfx_ctx_wl_set_video_mode(void *data, { EGLint egl_attribs[16]; EGLint *attr = NULL; - gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*) - gfx_ctx_data_get_ptr(); + gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; egl_install_sighandlers(); @@ -679,8 +658,7 @@ static const struct wl_pointer_listener pointer_listener = { static void seat_handle_capabilities(void *data, struct wl_seat *seat, unsigned caps) { - gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*) - gfx_ctx_data_get_ptr(); + gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !wl->g_wl_keyboard) { diff --git a/gfx/drivers_context/wgl_ctx.cpp b/gfx/drivers_context/wgl_ctx.cpp index 6bbb8c8f89..4620d7f438 100644 --- a/gfx/drivers_context/wgl_ctx.cpp +++ b/gfx/drivers_context/wgl_ctx.cpp @@ -295,23 +295,23 @@ static void gfx_ctx_wgl_get_video_size(void *data, unsigned *width, unsigned *he } } -static bool gfx_ctx_wgl_init(void *data) +static void *gfx_ctx_wgl_init(void *video_driver) { WNDCLASSEX wndclass = {0}; - (void)data; + (void)video_driver; if (g_inited) - return false; + return NULL; win32_window_reset(); win32_monitor_init(); wndclass.lpfnWndProc = WndProcGL; if (!win32_window_init(&wndclass, true, NULL)) - return false; + return NULL; - return true; + return (void*)"wgl"; } static void gfx_ctx_wgl_destroy(void *data) diff --git a/gfx/drivers_context/xegl_ctx.c b/gfx/drivers_context/xegl_ctx.c index c4fe8fe932..08c50bab79 100644 --- a/gfx/drivers_context/xegl_ctx.c +++ b/gfx/drivers_context/xegl_ctx.c @@ -81,7 +81,7 @@ EGL_BLUE_SIZE, 1, \ EGL_ALPHA_SIZE, 0, \ EGL_DEPTH_SIZE, 0 -static bool gfx_ctx_xegl_init(void *data) +static void *gfx_ctx_xegl_init(void *video_driver) { static const EGLint egl_attribs_gl[] = { XEGL_ATTRIBS_BASE, @@ -114,7 +114,7 @@ static bool gfx_ctx_xegl_init(void *data) EGLint n; if (g_egl_inited) - return false; + return NULL; XInitThreads(); @@ -151,11 +151,11 @@ static bool gfx_ctx_xegl_init(void *data) if (n == 0 || !egl_has_config()) goto error; - return true; + return (void*)"xegl"; error: - gfx_ctx_xegl_destroy(data); - return false; + gfx_ctx_xegl_destroy(video_driver); + return NULL; } static EGLint *xegl_fill_attribs(EGLint *attr) diff --git a/gfx/video_context_driver.c b/gfx/video_context_driver.c index 93fe75ef9a..cbd31a5607 100644 --- a/gfx/video_context_driver.c +++ b/gfx/video_context_driver.c @@ -98,24 +98,10 @@ void gfx_ctx_destroy(const gfx_ctx_driver_t *ctx_driver) current_video_context = NULL; } -void gfx_ctx_data_set(void *ptr) -{ - if (!ptr) - return; - video_context_data = ptr; -} - -void gfx_ctx_free_data(void) -{ - if (video_context_data) - free(video_context_data); - video_context_data = NULL; -} - -void gfx_ctx_free(void *data) +void gfx_ctx_free(void) { if (current_video_context->destroy) - current_video_context->destroy(data); + current_video_context->destroy(video_context_data); current_video_context = NULL; } @@ -128,78 +114,78 @@ const char *gfx_ctx_get_ident(void) return ctx->ident; } -void gfx_ctx_update_window_title(void *data) +void gfx_ctx_update_window_title(void) { if (current_video_context->update_window_title) - current_video_context->update_window_title(data); + current_video_context->update_window_title(video_context_data); } -void gfx_ctx_get_video_output_size(void *data, +void gfx_ctx_get_video_output_size( unsigned *width, unsigned *height) { const gfx_ctx_driver_t *ctx = current_video_context; if (ctx->get_video_output_size) - ctx->get_video_output_size(data, width, height); + ctx->get_video_output_size(video_context_data, width, height); } -bool gfx_ctx_get_video_output_prev(void *data) +bool gfx_ctx_get_video_output_prev(void) { if (current_video_context->get_video_output_prev) { - current_video_context->get_video_output_prev(data); + current_video_context->get_video_output_prev(video_context_data); return true; } return false; } -bool gfx_ctx_get_video_output_next(void *data) +bool gfx_ctx_get_video_output_next(void) { if (current_video_context->get_video_output_next) { - current_video_context->get_video_output_next(data); + current_video_context->get_video_output_next(video_context_data); return true; } return false; } -void gfx_ctx_swap_buffers(void *data) +void gfx_ctx_swap_buffers(void) { if (!current_video_context) return; if (current_video_context->swap_buffers) - current_video_context->swap_buffers(data); + current_video_context->swap_buffers(video_context_data); } -void gfx_ctx_bind_hw_render(void *data, bool enable) +void gfx_ctx_bind_hw_render(bool enable) { if (current_video_context->bind_hw_render) - current_video_context->bind_hw_render(data, enable); + current_video_context->bind_hw_render(video_context_data, enable); } -bool gfx_ctx_focus(void *data) +bool gfx_ctx_focus(void) { - if (data && current_video_context->has_focus) - return current_video_context->has_focus(data); + if (video_context_data && current_video_context->has_focus) + return current_video_context->has_focus(video_context_data); return false; } -bool gfx_ctx_set_video_mode(void *data, +bool gfx_ctx_set_video_mode( unsigned width, unsigned height, bool fullscreen) { if (current_video_context->set_video_mode) - return current_video_context->set_video_mode(data, width, height, fullscreen); + return current_video_context->set_video_mode(video_context_data, width, height, fullscreen); return false; } -void gfx_ctx_translate_aspect(void *data, float *aspect, +void gfx_ctx_translate_aspect(float *aspect, unsigned width, unsigned height) { if (current_video_context->translate_aspect) - *aspect = current_video_context->translate_aspect(data, width, height); + *aspect = current_video_context->translate_aspect(video_context_data, width, height); } bool gfx_ctx_get_metrics(enum display_metric_types type, float *value) @@ -234,64 +220,64 @@ retro_proc_address_t gfx_ctx_get_proc_address(const char *sym) return current_video_context->get_proc_address(sym); } -void gfx_ctx_show_mouse(void *data, bool state) +void gfx_ctx_show_mouse(bool state) { - if (data && current_video_context->show_mouse) - current_video_context->show_mouse(data, state); + if (video_context_data && current_video_context->show_mouse) + current_video_context->show_mouse(video_context_data, state); } -bool gfx_ctx_has_windowed(void *data) +bool gfx_ctx_has_windowed(void) { - if (data) - return current_video_context->has_windowed(data); + if (video_context_data) + return current_video_context->has_windowed(video_context_data); return true; } -bool gfx_ctx_check_window(void *data, bool *quit, bool *resize, +bool gfx_ctx_check_window(bool *quit, bool *resize, unsigned *width, unsigned *height) { uint64_t *frame_count; video_driver_ctl(RARCH_DISPLAY_CTL_GET_FRAME_COUNT, &frame_count); - if (!data) + if (!video_context_data) return false; - current_video_context->check_window(data, quit, resize, width, height, (unsigned int)*frame_count); + current_video_context->check_window(video_context_data, quit, resize, width, height, (unsigned int)*frame_count); return true; } -bool gfx_ctx_suppress_screensaver(void *data, bool enable) +bool gfx_ctx_suppress_screensaver(bool enable) { - if (data && current_video_context) - return current_video_context->suppress_screensaver(data, enable); + if (video_context_data && current_video_context) + return current_video_context->suppress_screensaver(video_context_data, enable); return false; } -void gfx_ctx_get_video_size(void *data, +void gfx_ctx_get_video_size( unsigned *width, unsigned *height) { - current_video_context->get_video_size(data, width, height); + current_video_context->get_video_size(video_context_data, width, height); } -void gfx_ctx_swap_interval(void *data, unsigned interval) +void gfx_ctx_swap_interval(unsigned interval) { if (current_video_context) - current_video_context->swap_interval(data, interval); + current_video_context->swap_interval(video_context_data, interval); } -void gfx_ctx_set_resize(void *data, unsigned width, unsigned height) +void gfx_ctx_set_resize(unsigned width, unsigned height) { if (current_video_context) - current_video_context->set_resize(data, width, height); + current_video_context->set_resize(video_context_data, width, height); } -void gfx_ctx_input_driver(void *data, +void gfx_ctx_input_driver( const input_driver_t **input, void **input_data) { if (current_video_context) - current_video_context->input_driver(data, input, input_data); + current_video_context->input_driver(video_context_data, input, input_data); } /** @@ -375,15 +361,16 @@ static const gfx_ctx_driver_t *gfx_ctx_init(void *data, if (ctx->bind_api(data, api, major, minor)) { - bool initialized = ctx->init(data); + void *ctx_data = ctx->init(data); - if (!initialized) + if (!ctx_data) return NULL; if (ctx->bind_hw_render) - ctx->bind_hw_render(data, + ctx->bind_hw_render(ctx_data, settings->video.shared_context && hw_render_ctx); + video_context_data = ctx_data; return ctx; } diff --git a/gfx/video_context_driver.h b/gfx/video_context_driver.h index 0c24c0b662..7ace778d5d 100644 --- a/gfx/video_context_driver.h +++ b/gfx/video_context_driver.h @@ -53,17 +53,14 @@ enum display_metric_types typedef void (*gfx_ctx_proc_t)(void); -/* The opaque void* argument should be the overlying driver data - * (e.g. gl_t for OpenGL contexts). - * - * This will allow us in the future to have separate contexts - * to separate gl_t structs (if needed). - * - * For now, this is only relevant for D3D. */ - typedef struct gfx_ctx_driver { - bool (*init)(void *data); + /* The opaque pointer is the underlying video driver data (e.g. gl_t for + * OpenGL contexts). Although not advised, the context driver is allowed + * to hold a pointer to it as the context never outlives the video driver. + * + * The context driver is responsible for it's own data.*/ + void* (*init)(void *video_driver); void (*destroy)(void *data); /* Which API to bind to. */ @@ -203,16 +200,15 @@ void find_prev_gfx_context_driver(void); bool gfx_ctx_get_metrics(enum display_metric_types type, float *value); -void gfx_ctx_translate_aspect(void *data, float *aspect, +void gfx_ctx_translate_aspect(float *aspect, unsigned width, unsigned height); -bool gfx_ctx_set_video_mode(void *data, - unsigned width, unsigned height, +bool gfx_ctx_set_video_mode(unsigned width, unsigned height, bool fullscreen); -void gfx_ctx_swap_buffers(void *data); +void gfx_ctx_swap_buffers(void); -bool gfx_ctx_focus(void *data); +bool gfx_ctx_focus(void); bool gfx_ctx_image_buffer_init(void *data, const video_info_t *info); @@ -220,47 +216,42 @@ bool gfx_ctx_image_buffer_write(void *data, const void *frame, unsigned width, unsigned height, unsigned pitch, bool rgb32, unsigned index, void **image_handle); -void gfx_ctx_show_mouse(void *data, bool state); +void gfx_ctx_show_mouse(bool state); -bool gfx_ctx_has_windowed(void *data); +bool gfx_ctx_has_windowed(void); -bool gfx_ctx_check_window(void *data, bool *quit, bool *resize, +bool gfx_ctx_check_window(bool *quit, bool *resize, unsigned *width, unsigned *height); -bool gfx_ctx_suppress_screensaver(void *data, bool enable); +bool gfx_ctx_suppress_screensaver(bool enable); -void gfx_ctx_update_window_title(void *data); +void gfx_ctx_update_window_title(void); -void gfx_ctx_get_video_size(void *data, unsigned *width, unsigned *height); +void gfx_ctx_get_video_size(unsigned *width, unsigned *height); -void gfx_ctx_set_resize(void *data, unsigned width, unsigned height); +void gfx_ctx_set_resize(unsigned width, unsigned height); -void gfx_ctx_swap_interval(void *data, unsigned interval); +void gfx_ctx_swap_interval(unsigned interval); -void gfx_ctx_bind_hw_render(void *data, bool enable); +void gfx_ctx_bind_hw_render(bool enable); -void gfx_ctx_get_video_output_size(void *data, - unsigned *width, unsigned *height); +void gfx_ctx_get_video_output_size(unsigned *width, unsigned *height); -bool gfx_ctx_get_video_output_prev(void *data); +bool gfx_ctx_get_video_output_prev(void); -bool gfx_ctx_get_video_output_next(void *data); +bool gfx_ctx_get_video_output_next(void); const char *gfx_ctx_get_ident(void); -void gfx_ctx_free(void *data); +void gfx_ctx_free(void); -void gfx_ctx_input_driver(void *data, - const input_driver_t **input, void **input_data); +void gfx_ctx_input_driver( + const input_driver_t **input, void **input_data); retro_proc_address_t gfx_ctx_get_proc_address(const char *sym); void *gfx_ctx_data_get_ptr(void); -void gfx_ctx_data_set(void *ptr); - -void gfx_ctx_free_data(void); - void gfx_ctx_set(const gfx_ctx_driver_t *ctx_driver); void gfx_ctx_destroy(const gfx_ctx_driver_t *ctx_driver); diff --git a/gfx/video_driver.c b/gfx/video_driver.c index e7a6f3b056..ec05128c01 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -797,7 +797,7 @@ bool video_driver_set_video_mode(unsigned width, return true; } - return gfx_ctx_set_video_mode(gfx_ctx_data_get_ptr(), width, height, fullscreen); + return gfx_ctx_set_video_mode(width, height, fullscreen); } bool video_driver_get_video_output_size(unsigned *width, unsigned *height) @@ -1485,7 +1485,7 @@ bool video_driver_ctl(enum rarch_display_ctl_state state, void *data) video_driver_poke->get_video_output_next(video_driver_data); return true; } - return gfx_ctx_get_video_output_next(gfx_ctx_data_get_ptr()); + return gfx_ctx_get_video_output_next(); case RARCH_DISPLAY_CTL_GET_PREV_VIDEO_OUT: if (!video_driver_poke) return false; @@ -1495,7 +1495,7 @@ bool video_driver_ctl(enum rarch_display_ctl_state state, void *data) video_driver_poke->get_video_output_prev(video_driver_data); return true; } - return gfx_ctx_get_video_output_next(gfx_ctx_data_get_ptr()); + return gfx_ctx_get_video_output_next(); case RARCH_DISPLAY_CTL_INIT: return init_video(); case RARCH_DISPLAY_CTL_DESTROY_DATA: