Skip to content

Commit

Permalink
metal: also disable vsync for custom refresh rates
Browse files Browse the repository at this point in the history
  • Loading branch information
GreemDev committed Dec 29, 2024
1 parent 9ee3f1f commit 1fbb0d8
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/Ryujinx.Graphics.Metal/Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ class Window : IWindow, IDisposable

private int _requestedWidth;
private int _requestedHeight;

// private bool _vsyncEnabled;

private AntiAliasing _currentAntiAliasing;
private bool _updateEffect;
private IPostProcessingEffect _effect;
private IScalingFilter _scalingFilter;
private bool _isLinear;

public bool IsVSyncEnabled => _metalLayer.DisplaySyncEnabled;

// private float _scalingFilterLevel;
private bool _updateScalingFilter;
private ScalingFilter _currentScalingFilter;
Expand All @@ -40,7 +42,7 @@ public Window(MetalRenderer renderer, CAMetalLayer metalLayer)
_metalLayer = metalLayer;
}

private unsafe void ResizeIfNeeded()
private void ResizeIfNeeded()
{
if (_requestedWidth != 0 && _requestedHeight != 0)
{
Expand All @@ -54,7 +56,7 @@ private unsafe void ResizeIfNeeded()
}
}

public unsafe void Present(ITexture texture, ImageCrop crop, Action swapBuffersCallback)
public void Present(ITexture texture, ImageCrop crop, Action swapBuffersCallback)
{
if (_renderer.Pipeline is Pipeline pipeline && texture is Texture tex)
{
Expand Down Expand Up @@ -141,15 +143,7 @@ public void SetSize(int width, int height)

public void ChangeVSyncMode(VSyncMode vSyncMode)
{
switch (vSyncMode)
{
case VSyncMode.Unbounded:
_metalLayer.DisplaySyncEnabled = false;
break;
case VSyncMode.Switch:
_metalLayer.DisplaySyncEnabled = true;
break;
}
_metalLayer.DisplaySyncEnabled = vSyncMode is VSyncMode.Switch;
}

public void SetAntiAliasing(AntiAliasing effect)
Expand Down

0 comments on commit 1fbb0d8

Please sign in to comment.