UI: add a VRR VSync mode using the FifoRelaxed present mode

Add a new VSyncMode.Vrr that selects the FifoRelaxed Vulkan present mode,
letting the display's variable refresh rate (G-Sync/FreeSync) drive the
refresh in fullscreen and smoothing a fluctuating frame rate without
tearing. Reachable by cycling the status-bar VSync button; shown in green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-16 17:43:15 -04:00
parent 31aacdd05b
commit a08051ac4c
4 changed files with 21 additions and 4 deletions
@@ -4,7 +4,8 @@ namespace Ryujinx.Common.Configuration
{
Switch,
Unbounded,
Custom
Custom,
Vrr
}
public static class VSyncModeExtensions
@@ -13,8 +14,9 @@ namespace Ryujinx.Common.Configuration
vsync switch
{
VSyncMode.Switch => customEnabled ? VSyncMode.Custom : VSyncMode.Unbounded,
VSyncMode.Unbounded => VSyncMode.Switch,
VSyncMode.Custom => VSyncMode.Unbounded,
VSyncMode.Unbounded => VSyncMode.Vrr,
VSyncMode.Vrr => VSyncMode.Switch,
_ => VSyncMode.Switch
};
}
+8 -1
View File
@@ -282,7 +282,14 @@ namespace Ryujinx.Graphics.Vulkan
private static PresentModeKHR ChooseSwapPresentMode(PresentModeKHR[] availablePresentModes, VSyncMode vSyncMode)
{
if (vSyncMode == VSyncMode.Unbounded && availablePresentModes.Contains(PresentModeKHR.ImmediateKhr))
// VRR: FifoRelaxed lets the display's variable refresh rate (G-Sync/FreeSync) drive the refresh
// in fullscreen, smoothing a fluctuating frame rate without tearing. Immediate (full VSync off)
// was tried first but could hang the GPU under load, so FifoRelaxed is used instead.
if (vSyncMode == VSyncMode.Vrr && availablePresentModes.Contains(PresentModeKHR.FifoRelaxedKhr))
{
return PresentModeKHR.FifoRelaxedKhr;
}
else if (vSyncMode == VSyncMode.Unbounded && availablePresentModes.Contains(PresentModeKHR.ImmediateKhr))
{
return PresentModeKHR.ImmediateKhr;
}
+3
View File
@@ -18,6 +18,7 @@
<Color x:Key="Switch">#FF2EEAC9</Color>
<Color x:Key="Unbounded">#FFFF4554</Color>
<Color x:Key="Custom">#6483F5</Color>
<Color x:Key="Vrr">#FF4CD964</Color>
<Color x:Key="Warning">#800080</Color>
<Color x:Key="CustomConfig">#00B5B8</Color>
</ResourceDictionary>
@@ -38,6 +39,7 @@
<Color x:Key="Switch">#13c3a4</Color>
<Color x:Key="Unbounded">#FFFF4554</Color>
<Color x:Key="Custom">#6483F5</Color>
<Color x:Key="Vrr">#FF4CD964</Color>
<Color x:Key="Warning">#800080</Color>
<Color x:Key="CustomConfig">#00B5B8</Color>
</ResourceDictionary>
@@ -58,6 +60,7 @@
<Color x:Key="Switch">#FF2EEAC9</Color>
<Color x:Key="Unbounded">#FFFF4554</Color>
<Color x:Key="Custom">#6483F5</Color>
<Color x:Key="Vrr">#FF4CD964</Color>
<Color x:Key="Warning">#FFA500</Color>
<Color x:Key="CustomConfig">#00B5B8</Color>
</ResourceDictionary>
@@ -1369,7 +1369,12 @@ namespace Ryujinx.Ava.UI.ViewModels
VSyncModeColor = new SolidColorBrush(clr);
}
VSyncModeText = args.VSyncMode == "Custom" ? "Custom" : "VSync";
VSyncModeText = args.VSyncMode switch
{
"Custom" => "Custom",
"Vrr" => "VRR",
_ => "VSync"
};
DockedStatusText = args.DockedMode;
AspectRatioStatusText = args.AspectRatio;
GameStatusText = args.GameStatus;