diff --git a/gfx/d3d/d3d.cpp b/gfx/d3d/d3d.cpp index 50d8e4b2f1..c1ade1fffa 100644 --- a/gfx/d3d/d3d.cpp +++ b/gfx/d3d/d3d.cpp @@ -566,8 +566,7 @@ static bool d3d_construct(d3d_video_t *d3d, if (!d3d_initialize(d3d, &d3d->video_info)) return false; - if (input && input_data && ctx && ctx->input_driver) - ctx->input_driver(d3d, input, input_data); + gfx_ctx_input_driver(d3d, input, input_data); RARCH_LOG("[D3D]: Init complete.\n"); return true; diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index b5ae4e5712..9a042c11f2 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -2414,8 +2414,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo goto error; #endif - if (input && input_data) - ctx_driver->input_driver(gl, input, input_data); + gfx_ctx_input_driver(gl, input, input_data); if (settings->video.font_enable) { diff --git a/gfx/drivers/vg.c b/gfx/drivers/vg.c index d75acf9b76..266c284015 100644 --- a/gfx/drivers/vg.c +++ b/gfx/drivers/vg.c @@ -135,7 +135,7 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo video->smooth ? VG_IMAGE_QUALITY_BETTER : VG_IMAGE_QUALITY_NONANTIALIASED); vg_set_nonblock_state(vg, !video->vsync); - ctx->input_driver(vg, input, input_data); + gfx_ctx_input_driver(vg, input, input_data); if (settings->video.font_enable && font_renderer_create_default(&vg->font_driver, &vg->mFontRenderer, *settings->video.font_path ? settings->video.font_path : NULL, settings->video.font_size)) diff --git a/gfx/video_context_driver.c b/gfx/video_context_driver.c index 80a1e6cd79..8d15a93559 100644 --- a/gfx/video_context_driver.c +++ b/gfx/video_context_driver.c @@ -228,6 +228,15 @@ void gfx_ctx_set_resize(void *data, unsigned width, unsigned height) ctx->set_resize(data, width, height); } +void gfx_ctx_input_driver(void *data, + const input_driver_t **input, void **input_data) +{ + const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr(); + + if (ctx) + ctx->input_driver(data, input, input_data); +} + /** * 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 2da19c2fdc..8b54dfc3e2 100644 --- a/gfx/video_context_driver.h +++ b/gfx/video_context_driver.h @@ -236,6 +236,9 @@ void gfx_ctx_swap_interval(void *data, unsigned interval); void gfx_ctx_free(void *data); +void gfx_ctx_input_driver(void *data, + const input_driver_t **input, void **input_data); + retro_proc_address_t gfx_ctx_get_proc_address(const char *sym); #ifdef __cplusplus