mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-22 03:32:02 +00:00
Change vsync signal to happen at 60hz, regardless of swap interval (#3642)
* Change vsync signal to happen at 60hz, regardless of swap interval * Update Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs Co-authored-by: gdkchan <gab.dark.100@gmail.com> * Fix softlock when toggling vsync Co-authored-by: gdkchan <gab.dark.100@gmail.com>
This commit is contained in:
parent
67cbdc3a6a
commit
38275f9056
1 changed files with 9 additions and 2 deletions
|
@ -35,6 +35,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
||||||
private long _1msTicks;
|
private long _1msTicks;
|
||||||
|
|
||||||
private int _swapInterval;
|
private int _swapInterval;
|
||||||
|
private int _swapIntervalDelay;
|
||||||
|
|
||||||
private readonly object Lock = new object();
|
private readonly object Lock = new object();
|
||||||
|
|
||||||
|
@ -91,7 +92,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_ticksPerFrame = Stopwatch.Frequency / (TargetFps / _swapInterval);
|
_ticksPerFrame = Stopwatch.Frequency / TargetFps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,9 +322,15 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
||||||
lastTicks = ticks;
|
lastTicks = ticks;
|
||||||
|
|
||||||
if (_ticks >= _ticksPerFrame)
|
if (_ticks >= _ticksPerFrame)
|
||||||
|
{
|
||||||
|
if (_swapIntervalDelay-- == 0)
|
||||||
{
|
{
|
||||||
Compose();
|
Compose();
|
||||||
|
|
||||||
|
// When a frame is presented, delay the next one by its swap interval value.
|
||||||
|
_swapIntervalDelay = Math.Max(0, _swapInterval - 1);
|
||||||
|
}
|
||||||
|
|
||||||
_device.System?.SignalVsync();
|
_device.System?.SignalVsync();
|
||||||
|
|
||||||
// Apply a maximum bound of 3 frames to the tick remainder, in case some event causes Ryujinx to pause for a long time or messes with the timer.
|
// Apply a maximum bound of 3 frames to the tick remainder, in case some event causes Ryujinx to pause for a long time or messes with the timer.
|
||||||
|
|
Loading…
Reference in a new issue