Skip to content

Commit

Permalink
oops
Browse files Browse the repository at this point in the history
  • Loading branch information
GreemDev committed Dec 27, 2024
1 parent e9fdf32 commit b4fd4c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 83 deletions.
8 changes: 7 additions & 1 deletion src/Ryujinx/Headless/HeadlessRyujinx.Init.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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;
Expand Down Expand Up @@ -281,7 +282,7 @@ private static InputConfig HandlePlayerConfiguration(string inputProfileName, st
return config;
}

private static IRenderer CreateRenderer(Options options, WindowBase window)
private static IRenderer CreateRenderer(Options options, WindowBase window)
{
if (options.GraphicsBackend == GraphicsBackend.Vulkan && window is VulkanWindow vulkanWindow)
{
Expand Down Expand Up @@ -310,6 +311,11 @@ private static IRenderer CreateRenderer(Options options, WindowBase window)
preferredGpuId);
}

if (options.GraphicsBackend == GraphicsBackend.Metal && window is MetalWindow metalWindow && OperatingSystem.IsMacOS())
{
return new MetalRenderer(metalWindow.GetLayer);
}

return new OpenGLRenderer();
}

Expand Down
82 changes: 0 additions & 82 deletions src/Ryujinx/Headless/HeadlessRyujinx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -347,88 +347,6 @@ private static WindowBase CreateWindow(Options options)
};
}

private static IRenderer CreateRenderer(Options options, WindowBase window)
{
if (options.GraphicsBackend == GraphicsBackend.Vulkan && window is VulkanWindow vulkanWindow)
{
string preferredGpuId = string.Empty;
Vk api = Vk.GetApi();

if (!string.IsNullOrEmpty(options.PreferredGPUVendor))
{
string preferredGpuVendor = options.PreferredGPUVendor.ToLowerInvariant();
var devices = VulkanRenderer.GetPhysicalDevices(api);

foreach (var device in devices)
{
if (device.Vendor.ToLowerInvariant() == preferredGpuVendor)
{
preferredGpuId = device.Id;
break;
}
}
}

return new VulkanRenderer(
api,
(instance, vk) => new SurfaceKHR((ulong)(vulkanWindow.CreateWindowSurface(instance.Handle))),
vulkanWindow.GetRequiredInstanceExtensions,
preferredGpuId);
}

if (options.GraphicsBackend == GraphicsBackend.Metal && window is MetalWindow metalWindow && OperatingSystem.IsMacOS())
{
return new MetalRenderer(metalWindow.GetLayer);
}

return new OpenGLRenderer();
}

private static Switch InitializeEmulationContext(WindowBase window, IRenderer renderer, Options options)
{
BackendThreading threadingMode = options.BackendThreading;

bool threadedGAL = threadingMode == BackendThreading.On || (threadingMode == BackendThreading.Auto && renderer.PreferThreading);

if (threadedGAL)
{
renderer = new ThreadedRenderer(renderer);
}

HLEConfiguration configuration = new(_virtualFileSystem,
_libHacHorizonManager,
_contentManager,
_accountManager,
_userChannelPersistence,
renderer,
new SDL2HardwareDeviceDriver(),
options.DramSize,
window,
options.SystemLanguage,
options.SystemRegion,
options.VSyncMode,
!options.DisableDockedMode,
!options.DisablePTC,
options.EnableInternetAccess,
!options.DisableFsIntegrityChecks ? IntegrityCheckLevel.ErrorOnInvalid : IntegrityCheckLevel.None,
options.FsGlobalAccessLogMode,
options.SystemTimeOffset,
options.SystemTimeZone,
options.MemoryManagerMode,
options.IgnoreMissingServices,
options.AspectRatio,
options.AudioVolume,
options.UseHypervisor ?? true,
options.MultiplayerLanInterfaceId,
Common.Configuration.Multiplayer.MultiplayerMode.Disabled,
false,
string.Empty,
string.Empty,
options.CustomVSyncInterval);

return new Switch(configuration);
}

private static void ExecutionEntrypoint()
{
if (OperatingSystem.IsWindows())
Expand Down

0 comments on commit b4fd4c3

Please sign in to comment.