From 86cced8eab789d4df55458b982f6968235f63623 Mon Sep 17 00:00:00 2001 From: Tony <45124675+sonninnos@users.noreply.github.com> Date: Sat, 29 Jan 2022 11:57:01 +0200 Subject: [PATCH] Fix frameskipping with duped frames (#13560) --- gfx/video_driver.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 74efd3a9d5..3ac2f0f699 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -3572,6 +3572,9 @@ void video_driver_frame(const void *data, unsigned width, static retro_time_t fps_time; static float last_fps, frame_time; static uint64_t last_used_memory, last_total_memory; + /* Initialise 'last_frame_duped' to 'true' + * to ensure that the first frame is rendered */ + static bool last_frame_duped = true; retro_time_t new_time; video_frame_info_t video_info; video_driver_state_t *video_st= &video_driver_st; @@ -3618,7 +3621,14 @@ void video_driver_frame(const void *data, unsigned width, video_driver_build_info(&video_info); - render_frame |= video_info.menu_is_alive; + /* Always render a frame if: + * - Menu is open + * - The last frame was NULL and the + * current frame is not (i.e. if core was + * previously sending duped frames, ensure + * that the next frame update is captured) */ + render_frame |= video_info.menu_is_alive || (last_frame_duped && !!data); + last_frame_duped = !data; if (!render_frame) runloop_st->fastforward_frameskip_frames_current--;