mirror of
https://github.com/libretro/RetroArch
synced 2025-02-26 15:39:55 +00:00
Improvements to unsetting the video driver callback
This commit is contained in:
parent
4c16640f64
commit
4fd5f1cad6
@ -376,6 +376,12 @@ static void event_init_controllers(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void event_deinit_core_interfaces(void)
|
||||
{
|
||||
video_driver_callback_destroy_context();
|
||||
video_driver_unset_callback();
|
||||
}
|
||||
|
||||
static void event_deinit_core(bool reinit)
|
||||
{
|
||||
#ifdef HAVE_CHEEVOS
|
||||
@ -383,14 +389,15 @@ static void event_deinit_core(bool reinit)
|
||||
cheevos_unload();
|
||||
#endif
|
||||
|
||||
event_deinit_core_interfaces();
|
||||
core.retro_unload_game();
|
||||
core.retro_deinit();
|
||||
|
||||
if (reinit)
|
||||
event_command(EVENT_CMD_DRIVERS_DEINIT);
|
||||
|
||||
/* auto overrides: reload the original config */
|
||||
if(runloop_ctl(RUNLOOP_CTL_IS_OVERRIDES_ACTIVE, NULL))
|
||||
/* auto overrides: reload the original config */
|
||||
if (runloop_ctl(RUNLOOP_CTL_IS_OVERRIDES_ACTIVE, NULL))
|
||||
{
|
||||
config_unload_override();
|
||||
runloop_ctl(RUNLOOP_CTL_UNSET_OVERRIDES_ACTIVE, NULL);
|
||||
|
9
driver.c
9
driver.c
@ -405,15 +405,6 @@ static void uninit_drivers(int flags)
|
||||
if (flags & DRIVERS_VIDEO_INPUT)
|
||||
video_driver_ctl(RARCH_DISPLAY_CTL_DEINIT, NULL);
|
||||
|
||||
if (flags & DRIVER_VIDEO)
|
||||
{
|
||||
const struct retro_hw_render_callback *hw_render =
|
||||
(const struct retro_hw_render_callback*)video_driver_callback();
|
||||
|
||||
if (hw_render->context_destroy && !video_driver_ctl(RARCH_DISPLAY_CTL_IS_VIDEO_CACHE_CONTEXT, NULL))
|
||||
hw_render->context_destroy();
|
||||
}
|
||||
|
||||
if ((flags & DRIVER_VIDEO) && !video_driver_ctl(RARCH_DISPLAY_CTL_OWNS_DRIVER, NULL))
|
||||
video_driver_ctl(RARCH_DISPLAY_CTL_DESTROY_DATA, NULL);
|
||||
|
||||
|
@ -457,15 +457,6 @@ error:
|
||||
retro_fail(1, "init_video_input()");
|
||||
}
|
||||
|
||||
static void video_driver_unset_callback(void)
|
||||
{
|
||||
struct retro_hw_render_callback *hw_render =
|
||||
video_driver_callback();
|
||||
|
||||
if (hw_render)
|
||||
hw_render = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* video_monitor_compute_fps_statistics:
|
||||
*
|
||||
@ -518,10 +509,24 @@ static void deinit_pixel_converter(void)
|
||||
video_driver_scaler_ptr = NULL;
|
||||
}
|
||||
|
||||
void video_driver_callback_destroy_context(void)
|
||||
{
|
||||
const struct retro_hw_render_callback *hw_render =
|
||||
(const struct retro_hw_render_callback*)video_driver_callback();
|
||||
if (hw_render->context_destroy)
|
||||
hw_render->context_destroy();
|
||||
}
|
||||
|
||||
static bool uninit_video_input(void)
|
||||
{
|
||||
event_command(EVENT_CMD_OVERLAY_DEINIT);
|
||||
|
||||
if (!video_driver_ctl(RARCH_DISPLAY_CTL_IS_VIDEO_CACHE_CONTEXT, NULL))
|
||||
{
|
||||
video_driver_callback_destroy_context();
|
||||
video_driver_unset_callback();
|
||||
}
|
||||
|
||||
if (
|
||||
!input_driver_ctl(RARCH_INPUT_CTL_OWNS_DRIVER, NULL) &&
|
||||
!input_driver_data_ptr_is_same(video_driver_data)
|
||||
@ -539,7 +544,6 @@ static bool uninit_video_input(void)
|
||||
|
||||
deinit_video_filter();
|
||||
|
||||
video_driver_unset_callback();
|
||||
event_command(EVENT_CMD_SHADER_DIR_DEINIT);
|
||||
video_monitor_compute_fps_statistics();
|
||||
|
||||
@ -1080,6 +1084,12 @@ struct retro_hw_render_callback *video_driver_callback(void)
|
||||
return &video_driver_state.hw_render_callback;
|
||||
}
|
||||
|
||||
void video_driver_unset_callback(void)
|
||||
{
|
||||
memset(&video_driver_state.hw_render_callback, 0,
|
||||
sizeof(video_driver_state.hw_render_callback));
|
||||
}
|
||||
|
||||
static bool video_driver_frame_filter(const void *data,
|
||||
unsigned width, unsigned height,
|
||||
size_t pitch,
|
||||
|
@ -425,6 +425,8 @@ float video_driver_get_aspect_ratio(void);
|
||||
void video_driver_set_aspect_ratio_value(float value);
|
||||
|
||||
struct retro_hw_render_callback *video_driver_callback(void);
|
||||
void video_driver_unset_callback(void);
|
||||
void video_driver_callback_destroy_context(void);
|
||||
|
||||
rarch_softfilter_t *video_driver_frame_filter_get_ptr(void);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user