diff --git a/gfx/video_context_driver.c b/gfx/video_context_driver.c index 80ec396699..f5bcaa9962 100644 --- a/gfx/video_context_driver.c +++ b/gfx/video_context_driver.c @@ -80,8 +80,6 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = { NULL }; -static const gfx_ctx_driver_t *current_video_context; -static void *video_context_data; /** * find_gfx_ctx_driver_index: @@ -180,7 +178,7 @@ static const gfx_ctx_driver_t *gfx_ctx_init(void *data, ctx->bind_hw_render(ctx_data, settings->video.shared_context && hw_render_ctx); - video_context_data = ctx_data; + gfx_ctx_ctl(GFX_CTL_SET_VIDEO_CONTEXT_DATA, ctx_data); return ctx; } @@ -254,6 +252,9 @@ const gfx_ctx_driver_t *gfx_ctx_init_first(void *data, bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data) { + static const gfx_ctx_driver_t *current_video_context = NULL; + static void *video_context_data = NULL; + switch (state) { case GFX_CTL_CHECK_WINDOW: @@ -432,6 +433,9 @@ bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data) current_video_context->get_video_size(video_context_data, &mode_info->width, &mode_info->height); } break; + case GFX_CTL_SET_VIDEO_CONTEXT_DATA: + video_context_data = data; + break; case GFX_CTL_NONE: default: break; diff --git a/gfx/video_context_driver.h b/gfx/video_context_driver.h index 426aa50e39..f0ae458e6b 100644 --- a/gfx/video_context_driver.h +++ b/gfx/video_context_driver.h @@ -82,7 +82,8 @@ enum gfx_ctx_ctl_state GFX_CTL_IDENT_GET, GFX_CTL_SET_VIDEO_MODE, GFX_CTL_SET_RESIZE, - GFX_CTL_GET_VIDEO_SIZE + GFX_CTL_GET_VIDEO_SIZE, + GFX_CTL_SET_VIDEO_CONTEXT_DATA }; typedef void (*gfx_ctx_proc_t)(void);