mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-29 04:26:24 +02:00
metal: Try and see if this lets VSync turn off.
(cherry picked from commit 9558b37716
)
This commit is contained in:
parent
17233d30da
commit
c9b2a6b1f1
5 changed files with 53 additions and 9 deletions
|
@ -0,0 +1,21 @@
|
|||
using SharpMetal;
|
||||
using SharpMetal.ObjectiveCCore;
|
||||
using SharpMetal.QuartzCore;
|
||||
using System.Runtime.Versioning;
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace Ryujinx.Graphics.Metal.SharpMetalExtensions
|
||||
{
|
||||
[SupportedOSPlatform("OSX")]
|
||||
public static class CAMetalLayerExtensions
|
||||
{
|
||||
private static readonly Selector sel_displaySyncEnabled = "displaySyncEnabled";
|
||||
private static readonly Selector sel_setDisplaySyncEnabled = "setDisplaySyncEnabled:";
|
||||
|
||||
public static bool IsDisplaySyncEnabled(this CAMetalLayer metalLayer)
|
||||
=> ObjectiveCRuntime.bool_objc_msgSend(metalLayer.NativePtr, sel_displaySyncEnabled);
|
||||
|
||||
public static void SetDisplaySyncEnabled(this CAMetalLayer metalLayer, bool enabled)
|
||||
=> ObjectiveCRuntime.objc_msgSend(metalLayer.NativePtr, sel_setDisplaySyncEnabled, enabled);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SharpMetal" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -5,12 +5,9 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Ryujinx.Common\Ryujinx.Common.csproj" />
|
||||
<ProjectReference Include="..\Ryujinx.Graphics.GAL\Ryujinx.Graphics.GAL.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SharpMetal" />
|
||||
<ProjectReference Include="..\Ryujinx.Common\Ryujinx.Common.csproj" />
|
||||
<ProjectReference Include="..\Ryujinx.Graphics.GAL\Ryujinx.Graphics.GAL.csproj" />
|
||||
<ProjectReference Include="..\Ryujinx.Graphics.Metal.SharpMetalExtensions\Ryujinx.Graphics.Metal.SharpMetalExtensions.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Graphics.GAL;
|
||||
using Ryujinx.Graphics.Metal.Effects;
|
||||
using Ryujinx.Graphics.Metal.SharpMetalExtensions;
|
||||
using SharpMetal.ObjectiveCCore;
|
||||
using SharpMetal.QuartzCore;
|
||||
using System;
|
||||
|
@ -140,7 +141,15 @@ namespace Ryujinx.Graphics.Metal
|
|||
|
||||
public void ChangeVSyncMode(VSyncMode vSyncMode)
|
||||
{
|
||||
//_vSyncMode = vSyncMode;
|
||||
switch (vSyncMode)
|
||||
{
|
||||
case VSyncMode.Unbounded:
|
||||
_metalLayer.SetDisplaySyncEnabled(false);
|
||||
break;
|
||||
case VSyncMode.Switch:
|
||||
_metalLayer.SetDisplaySyncEnabled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetAntiAliasing(AntiAliasing effect)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue