diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 4c86c2b6bc..0586809810 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -1514,7 +1514,8 @@ static bool gl_frame(void *data, const void *frame, if (gl->should_resize) { gl->should_resize = false; - ctx->set_resize(gl, gl->win_width, gl->win_height); + + gfx_ctx_set_resize(gl, gl->win_width, gl->win_height); #ifdef HAVE_FBO if (gl->fbo_inited) @@ -1816,7 +1817,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); - ctx->swap_interval(gl, + gfx_ctx_swap_interval(gl, state ? 0 : settings->video.swap_interval); context_bind_hw_render(gl, true); } @@ -2244,7 +2245,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo gfx_ctx_get_video_size(gl, &gl->full_x, &gl->full_y); RARCH_LOG("Detecting screen resolution %ux%u.\n", gl->full_x, gl->full_y); - ctx_driver->swap_interval(gl, + gfx_ctx_swap_interval(gl, video->vsync ? settings->video.swap_interval : 0); win_width = video->width; diff --git a/gfx/drivers/vg.c b/gfx/drivers/vg.c index cadfdd97ac..d75acf9b76 100644 --- a/gfx/drivers/vg.c +++ b/gfx/drivers/vg.c @@ -67,11 +67,7 @@ static PFNVGCREATEEGLIMAGETARGETKHRPROC pvgCreateEGLImageTargetKHR; static void vg_set_nonblock_state(void *data, bool state) { - vg_t *vg = (vg_t*)data; - const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr(); - - if (ctx) - ctx->swap_interval(vg, state ? 0 : 1); + gfx_ctx_swap_interval(data, state ? 0 : 1); } static INLINE bool vg_query_extension(const char *ext) @@ -106,7 +102,7 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo gfx_ctx_get_video_size(vg, &vg->mScreenWidth, &vg->mScreenHeight); RARCH_LOG("Detecting screen resolution %ux%u.\n", vg->mScreenWidth, vg->mScreenHeight); - ctx->swap_interval(vg, video->vsync ? 1 : 0); + gfx_ctx_swap_interval(vg, video->vsync ? 1 : 0); gfx_ctx_update_window_title(vg); diff --git a/gfx/video_context_driver.c b/gfx/video_context_driver.c index 5350367518..80a1e6cd79 100644 --- a/gfx/video_context_driver.c +++ b/gfx/video_context_driver.c @@ -212,6 +212,22 @@ void gfx_ctx_get_video_size(void *data, ctx->get_video_size(data, width, height); } +void gfx_ctx_swap_interval(void *data, unsigned interval) +{ + const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr(); + + if (ctx) + ctx->swap_interval(data, interval); +} + +void gfx_ctx_set_resize(void *data, unsigned width, unsigned height) +{ + const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr(); + + if (ctx) + ctx->set_resize(data, width, height); +} + /** * find_gfx_ctx_driver_index: * @ident : Identifier of resampler driver to find. diff --git a/gfx/video_context_driver.h b/gfx/video_context_driver.h index 404f6f5709..2da19c2fdc 100644 --- a/gfx/video_context_driver.h +++ b/gfx/video_context_driver.h @@ -230,6 +230,10 @@ void gfx_ctx_update_window_title(void *data); void gfx_ctx_get_video_size(void *data, unsigned *width, unsigned *height); +void gfx_ctx_set_resize(void *data, unsigned width, unsigned height); + +void gfx_ctx_swap_interval(void *data, unsigned interval); + void gfx_ctx_free(void *data); retro_proc_address_t gfx_ctx_get_proc_address(const char *sym);