diff --git a/command.c b/command.c index d837abbaa6..24de060f86 100644 --- a/command.c +++ b/command.c @@ -1933,28 +1933,15 @@ bool command_event(enum event_command cmd, void *data) #endif break; case CMD_EVENT_REINIT: - { - struct retro_hw_render_callback *hwr = - video_driver_get_hw_context(); - - if (hwr->cache_context) - video_driver_set_video_cache_context(); - else - video_driver_unset_video_cache_context(); - - video_driver_unset_video_cache_context_ack(); - command_event(CMD_EVENT_RESET_CONTEXT, NULL); - video_driver_unset_video_cache_context(); - - /* Poll input to avoid possibly stale data to corrupt things. */ - input_driver_poll(); + video_driver_reinit(); + /* Poll input to avoid possibly stale data to corrupt things. */ + input_driver_poll(); #ifdef HAVE_MENU - menu_display_set_framebuffer_dirty_flag(); - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) - command_event(CMD_EVENT_VIDEO_SET_BLOCKING_STATE, NULL); + menu_display_set_framebuffer_dirty_flag(); + if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + command_event(CMD_EVENT_VIDEO_SET_BLOCKING_STATE, NULL); #endif - } break; case CMD_EVENT_CHEATS_DEINIT: cheat_manager_state_free(); diff --git a/gfx/video_driver.c b/gfx/video_driver.c index a9548a996c..bc1efa9d0f 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -1784,6 +1784,21 @@ void video_driver_save_settings(config_file_t *conf) global->console.screen.flicker_filter_index); } +void video_driver_reinit(void) +{ + struct retro_hw_render_callback *hwr = + video_driver_get_hw_context(); + + if (hwr->cache_context) + video_driver_cache_context = true; + else + video_driver_cache_context = false; + + video_driver_cache_context_ack = false; + command_event(CMD_EVENT_RESET_CONTEXT, NULL); + video_driver_cache_context = false; +} + void video_driver_set_own_driver(void) { video_driver_data_own = true; @@ -1830,16 +1845,6 @@ void video_driver_set_context_negotiation_interface( hw_render_context_negotiation = iface; } -void video_driver_set_video_cache_context(void) -{ - video_driver_cache_context = true; -} - -void video_driver_unset_video_cache_context(void) -{ - video_driver_cache_context = false; -} - bool video_driver_is_video_cache_context(void) { return video_driver_cache_context; diff --git a/gfx/video_driver.h b/gfx/video_driver.h index 47b256affd..dcc756d926 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -262,11 +262,8 @@ const struct retro_hw_render_context_negotiation_interface *video_driver_get_context_negotiation_interface(void); void video_driver_set_context_negotiation_interface(const struct retro_hw_render_context_negotiation_interface *iface); -void video_driver_set_video_cache_context(void); -void video_driver_unset_video_cache_context(void); bool video_driver_is_video_cache_context(void); void video_driver_set_video_cache_context_ack(void); -void video_driver_unset_video_cache_context_ack(void); bool video_driver_is_video_cache_context_ack(void); void video_driver_set_active(void); bool video_driver_is_active(void); @@ -369,6 +366,8 @@ void video_driver_get_size(unsigned *width, unsigned *height); void video_driver_set_size(unsigned *width, unsigned *height); +void video_driver_unset_video_cache_context_ack(void); + float video_driver_get_aspect_ratio(void); void video_driver_set_aspect_ratio_value(float value); @@ -483,6 +482,8 @@ bool video_driver_texture_load(void *data, bool video_driver_texture_unload(uintptr_t *id); +void video_driver_reinit(void); + extern video_driver_t video_gl; extern video_driver_t video_vulkan; extern video_driver_t video_psp1;