Procházet zdrojové kódy

Revert "Only selectively compile Metal & fix some compilation issues"

This reverts commit beda3206e0a17ff8807fff1bbe014b24c2683e3d.
Evan Husted před 1 rokem
rodič
revize
e6bad52945

+ 1 - 1
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,

+ 4 - 2
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)

+ 1 - 1
src/Ryujinx/Ryujinx.csproj

@@ -72,7 +72,7 @@
   <ItemGroup>
     <ProjectReference Include="..\Ryujinx.Audio.Backends.SDL2\Ryujinx.Audio.Backends.SDL2.csproj" />
     <ProjectReference Include="..\Ryujinx.Graphics.Vulkan\Ryujinx.Graphics.Vulkan.csproj" />
-    <ProjectReference Include="..\Ryujinx.Graphics.OpenGL\Ryujinx.Graphics.OpenGL.csproj" />
+    <ProjectReference Include="..\Ryujinx.Graphics.OpenGL\Ryujinx.Graphics.OpenGL.csproj" Condition="'$(RuntimeIdentifier)' != 'osx-x64' AND '$(RuntimeIdentifier)' != 'osx-arm64'" />
     <ProjectReference Include="..\Ryujinx.Graphics.Metal\Ryujinx.Graphics.Metal.csproj" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'linux-arm64' AND '$(RuntimeIdentifier)' != 'win-x64'" />
     <ProjectReference Include="..\Ryujinx.Input\Ryujinx.Input.csproj" />
     <ProjectReference Include="..\Ryujinx.Input.SDL2\Ryujinx.Input.SDL2.csproj" />

+ 2 - 1
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;

+ 0 - 2
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()