From e6bad52945e7e35e9aee7bd5b49a0918dd28a0e0 Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Sat, 18 Jan 2025 10:56:58 -0600 Subject: [PATCH] Revert "Only selectively compile Metal & fix some compilation issues" This reverts commit beda3206e0a17ff8807fff1bbe014b24c2683e3d. --- src/Ryujinx/AppHost.cs | 2 +- src/Ryujinx/Headless/HeadlessRyujinx.Init.cs | 6 ++++-- src/Ryujinx/Ryujinx.csproj | 2 +- src/Ryujinx/UI/Renderer/EmbeddedWindow.cs | 3 ++- src/Ryujinx/UI/Renderer/EmbeddedWindowMetal.cs | 2 -- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Ryujinx/AppHost.cs b/src/Ryujinx/AppHost.cs index e3a35376c..a35a79e86 100644 --- a/src/Ryujinx/AppHost.cs +++ b/src/Ryujinx/AppHost.cs @@ -897,7 +897,7 @@ namespace Ryujinx.Ava { #pragma warning disable CA1416 // This call site is reachable on all platforms // SelectGraphicsBackend does a check for Mac, on top of checking if it's an ARM Mac. This isn't a problem. - GraphicsBackend.Metal => new MetalRenderer(() => new SharpMetal.QuartzCore.CAMetalLayer(((EmbeddedWindowMetal)RendererHost.EmbeddedWindow).MetalLayer)), + GraphicsBackend.Metal => new MetalRenderer((RendererHost.EmbeddedWindow as EmbeddedWindowMetal)!.CreateSurface), #pragma warning restore CA1416 GraphicsBackend.Vulkan => VulkanRenderer.Create( ConfigurationState.Instance.Graphics.PreferredGpu, diff --git a/src/Ryujinx/Headless/HeadlessRyujinx.Init.cs b/src/Ryujinx/Headless/HeadlessRyujinx.Init.cs index e92a56833..7d75ac7c1 100644 --- a/src/Ryujinx/Headless/HeadlessRyujinx.Init.cs +++ b/src/Ryujinx/Headless/HeadlessRyujinx.Init.cs @@ -12,6 +12,8 @@ using Ryujinx.Common.Logging; using Ryujinx.Common.Utilities; using Ryujinx.Graphics.GAL; using Ryujinx.Graphics.GAL.Multithreading; +using Ryujinx.Graphics.Metal; +using Ryujinx.Graphics.OpenGL; using Ryujinx.Graphics.Vulkan; using Ryujinx.HLE; using Ryujinx.Input; @@ -310,10 +312,10 @@ namespace Ryujinx.Headless if (options.GraphicsBackend == GraphicsBackend.Metal && window is MetalWindow metalWindow && OperatingSystem.IsMacOS()) { - return new Graphics.Metal.MetalRenderer(metalWindow.GetLayer); + return new MetalRenderer(metalWindow.GetLayer); } - return new Graphics.OpenGL.OpenGLRenderer(); + return new OpenGLRenderer(); } private static Switch InitializeEmulationContext(WindowBase window, IRenderer renderer, Options options) diff --git a/src/Ryujinx/Ryujinx.csproj b/src/Ryujinx/Ryujinx.csproj index c7cdef14c..682a08475 100644 --- a/src/Ryujinx/Ryujinx.csproj +++ b/src/Ryujinx/Ryujinx.csproj @@ -72,7 +72,7 @@ - + diff --git a/src/Ryujinx/UI/Renderer/EmbeddedWindow.cs b/src/Ryujinx/UI/Renderer/EmbeddedWindow.cs index 87b66e4f3..eea9be283 100644 --- a/src/Ryujinx/UI/Renderer/EmbeddedWindow.cs +++ b/src/Ryujinx/UI/Renderer/EmbeddedWindow.cs @@ -1,5 +1,6 @@ using Avalonia; using Avalonia.Controls; +using Avalonia.Input; using Avalonia.Platform; using Ryujinx.Ava.Utilities.Configuration; using Ryujinx.Common.Configuration; @@ -27,7 +28,7 @@ namespace Ryujinx.Ava.UI.Renderer protected nint WindowHandle { get; set; } protected nint X11Display { get; set; } protected nint NsView { get; set; } - public nint MetalLayer { get; protected set; } + protected nint MetalLayer { get; set; } public delegate void UpdateBoundsCallbackDelegate(Rect rect); private UpdateBoundsCallbackDelegate _updateBoundsCallback; diff --git a/src/Ryujinx/UI/Renderer/EmbeddedWindowMetal.cs b/src/Ryujinx/UI/Renderer/EmbeddedWindowMetal.cs index 7a2932075..eaf6f7bdf 100644 --- a/src/Ryujinx/UI/Renderer/EmbeddedWindowMetal.cs +++ b/src/Ryujinx/UI/Renderer/EmbeddedWindowMetal.cs @@ -1,10 +1,8 @@ using SharpMetal.QuartzCore; using System; -using System.Runtime.Versioning; namespace Ryujinx.Ava.UI.Renderer { - [SupportedOSPlatform("macos")] public class EmbeddedWindowMetal : EmbeddedWindow { public CAMetalLayer CreateSurface()