From cc3b95eee1ea86e1adfcd52b87fd8c14371456b5 Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Sat, 1 Feb 2025 03:28:26 -0600 Subject: [PATCH 1/4] misc: chore: More descriptive error for trying to create a Metal EmbeddedWindow on non-ARM Mac --- src/Ryujinx/UI/Renderer/EmbeddedWindowMetal.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Ryujinx/UI/Renderer/EmbeddedWindowMetal.cs b/src/Ryujinx/UI/Renderer/EmbeddedWindowMetal.cs index eaf6f7bdf..9e92d9289 100644 --- a/src/Ryujinx/UI/Renderer/EmbeddedWindowMetal.cs +++ b/src/Ryujinx/UI/Renderer/EmbeddedWindowMetal.cs @@ -1,3 +1,4 @@ +using Ryujinx.Common.Helper; using SharpMetal.QuartzCore; using System; @@ -7,14 +8,12 @@ namespace Ryujinx.Ava.UI.Renderer { public CAMetalLayer CreateSurface() { - if (OperatingSystem.IsMacOS()) + if (OperatingSystem.IsMacOS() && RunningPlatform.IsArm) { return new CAMetalLayer(MetalLayer); } - else - { - throw new NotSupportedException(); - } + + throw new NotSupportedException($"Cannot create a {nameof(CAMetalLayer)} without being on ARM Mac."); } } } From a4a15a4c800d2c2200c45dbac5caa62035e975a3 Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Sat, 1 Feb 2025 03:28:49 -0600 Subject: [PATCH 2/4] misc: chore: simplify graphics backend selection logic in RendererHost constructor --- src/Ryujinx/UI/Renderer/RendererHost.cs | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Ryujinx/UI/Renderer/RendererHost.cs b/src/Ryujinx/UI/Renderer/RendererHost.cs index 7dfec8d62..f755b6d70 100644 --- a/src/Ryujinx/UI/Renderer/RendererHost.cs +++ b/src/Ryujinx/UI/Renderer/RendererHost.cs @@ -43,19 +43,19 @@ namespace Ryujinx.Ava.UI.Renderer public RendererHost(string titleId) { - switch (TitleIDs.SelectGraphicsBackend(titleId, ConfigurationState.Instance.Graphics.GraphicsBackend)) - { - case GraphicsBackend.OpenGl: - EmbeddedWindow = new EmbeddedWindowOpenGL(); - break; - case GraphicsBackend.Metal: - EmbeddedWindow = new EmbeddedWindowMetal(); - break; - case GraphicsBackend.Vulkan: - EmbeddedWindow = new EmbeddedWindowVulkan(); - break; - } - + Focusable = true; + FlowDirection = FlowDirection.LeftToRight; + + EmbeddedWindow = +#pragma warning disable CS8509 + TitleIDs.SelectGraphicsBackend(titleId, ConfigurationState.Instance.Graphics.GraphicsBackend) switch +#pragma warning restore CS8509 + { + GraphicsBackend.OpenGl => new EmbeddedWindowOpenGL(), + GraphicsBackend.Metal => new EmbeddedWindowMetal(), + GraphicsBackend.Vulkan => new EmbeddedWindowVulkan(), + }; + string backendText = EmbeddedWindow switch { EmbeddedWindowVulkan => "Vulkan", From 2c9a26c11c99d5a084c24098f1ee11b65489aea6 Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Sat, 1 Feb 2025 03:29:24 -0600 Subject: [PATCH 3/4] misc: chore: Regular Architecture bool properties in RunningPlatform without OS constraint --- src/Ryujinx.Common/Helpers/RunningPlatform.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Ryujinx.Common/Helpers/RunningPlatform.cs b/src/Ryujinx.Common/Helpers/RunningPlatform.cs index 61f5bd614..8d85c4a3c 100644 --- a/src/Ryujinx.Common/Helpers/RunningPlatform.cs +++ b/src/Ryujinx.Common/Helpers/RunningPlatform.cs @@ -10,14 +10,18 @@ namespace Ryujinx.Common.Helper public static bool IsMacOS => OperatingSystem.IsMacOS(); public static bool IsWindows => OperatingSystem.IsWindows(); public static bool IsLinux => OperatingSystem.IsLinux(); + + public static bool IsArm => RuntimeInformation.OSArchitecture is Architecture.Arm64; + + public static bool IsX64 => RuntimeInformation.OSArchitecture is Architecture.X64; - public static bool IsIntelMac => IsMacOS && RuntimeInformation.OSArchitecture is Architecture.X64; - public static bool IsArmMac => IsMacOS && RuntimeInformation.OSArchitecture is Architecture.Arm64; + public static bool IsIntelMac => IsMacOS && IsX64; + public static bool IsArmMac => IsMacOS && IsArm; - public static bool IsX64Windows => IsWindows && (RuntimeInformation.OSArchitecture is Architecture.X64); - public static bool IsArmWindows => IsWindows && (RuntimeInformation.OSArchitecture is Architecture.Arm64); + public static bool IsX64Windows => IsWindows && IsX64; + public static bool IsArmWindows => IsWindows && IsArm; - public static bool IsX64Linux => IsLinux && (RuntimeInformation.OSArchitecture is Architecture.X64); - public static bool IsArmLinux => IsLinux && (RuntimeInformation.OSArchitecture is Architecture.Arm64); + public static bool IsX64Linux => IsLinux && IsX64; + public static bool IsArmLinux => IsLinux && IsArmMac; } } From 9f94aa1c79fe2043d95b563d198ca1940581fca2 Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Sat, 1 Feb 2025 03:30:13 -0600 Subject: [PATCH 4/4] misc: chore: gpu: Lower default Syncpoint wait timeout from 1 second to 500ms --- .../Synchronization/SynchronizationManager.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs b/src/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs index b68a64a47..7165af6ad 100644 --- a/src/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs +++ b/src/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs @@ -83,11 +83,11 @@ namespace Ryujinx.Graphics.Gpu.Synchronization // TODO: Remove this when GPU channel scheduling will be implemented. if (timeout == Timeout.InfiniteTimeSpan) { - timeout = TimeSpan.FromSeconds(1); + timeout = TimeSpan.FromMilliseconds(500); } using ManualResetEvent waitEvent = new(false); - SyncpointWaiterHandle info = _syncpoints[id].RegisterCallback(threshold, (x) => waitEvent.Set()); + SyncpointWaiterHandle info = _syncpoints[id].RegisterCallback(threshold, _ => waitEvent.Set()); if (info == null) { @@ -96,7 +96,7 @@ namespace Ryujinx.Graphics.Gpu.Synchronization bool signaled = waitEvent.WaitOne(timeout); - if (!signaled && info != null) + if (!signaled) { Logger.Error?.Print(LogClass.Gpu, $"Wait on syncpoint {id} for threshold {threshold} took more than {timeout.TotalMilliseconds}ms, resuming execution...");