Skip to content

Commit e447a43

Browse files
committed
Scanline Sync tweaks
1 parent 16e9950 commit e447a43

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

gfx/video_driver.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5364,11 +5364,13 @@ static INLINE void video_driver_scanline_before_frame(video_driver_state_t *vide
53645364
}
53655365
else if (video_st->frame_count > refresh_rate)
53665366
{
5367-
/* Disable if the core frame takes too long or has too much deviation */
5368-
double stddev = 0.0;
5369-
video_monitor_fps_statistics(NULL, &stddev, NULL);
5367+
/* Disable if the core and/or frame takes too long */
5368+
uint16_t frame_time_index = video_st->frame_time_count & (MEASURE_FRAME_TIME_SAMPLES_COUNT - 1);
5369+
uint16_t sample_index = (uint16_t)((frame_time_index - 1) & (MEASURE_FRAME_TIME_SAMPLES_COUNT - 1));
5370+
retro_time_t frame_time = video_st->frame_time_samples[sample_index];
53705371

5371-
if (stddev > 0.75f || core_run_time > frame_time_target)
5372+
if ( core_run_time > frame_time_target
5373+
|| frame_time > frame_time_target * 2)
53725374
{
53735375
scanline_next = 0;
53745376
scanline_hold = refresh_rate / 2;
@@ -5394,7 +5396,7 @@ static INLINE void video_driver_scanline_before_frame(video_driver_state_t *vide
53945396
/* Core time based minimum nudge */
53955397
while ( corelines > 0
53965398
&& scanline_next >= -corelines
5397-
&& core_run_time < frame_time_target / 4)
5399+
&& core_run_time < frame_time_target / 3)
53985400
{
53995401
scanline_next--;
54005402
corelines--;

0 commit comments

Comments
 (0)