UI: Add Metal surface creation for MoltenVK (#3980)

* Initial implementation of metal surface across UIs

* Fix SDL2 on windows

* Update Ryujinx/Ryujinx.csproj

Co-authored-by: Mary-nyan <thog@protonmail.com>

* Address Feedback

Co-authored-by: Mary-nyan <thog@protonmail.com>
This commit is contained in:
riperiperi 2022-12-06 22:00:25 +00:00 committed by GitHub
parent d3709a753f
commit e211c3f00a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 495 additions and 63 deletions

View file

@ -1,9 +1,11 @@
using Gdk;
using Ryujinx.Common.Configuration;
using Ryujinx.Input.HLE;
using Ryujinx.Ui.Helper;
using SPB.Graphics.Vulkan;
using SPB.Platform.Win32;
using SPB.Platform.X11;
using SPB.Platform.Metal;
using SPB.Windowing;
using System;
using System.Runtime.InteropServices;
@ -13,6 +15,7 @@ namespace Ryujinx.Ui
public class VKRenderer : RendererWidgetBase
{
public NativeWindowBase NativeWindow { get; private set; }
private UpdateBoundsCallbackDelegate _updateBoundsCallback;
public VKRenderer(InputManager inputManager, GraphicsDebugLevel glLogLevel) : base(inputManager, glLogLevel) { }
@ -31,6 +34,12 @@ namespace Ryujinx.Ui
return new SimpleX11Window(new NativeHandle(displayHandle), new NativeHandle(windowHandle));
}
else if (OperatingSystem.IsMacOS())
{
IntPtr metalLayer = MetalHelper.GetMetalLayer(Display, Window, out IntPtr nsView, out _updateBoundsCallback);
return new SimpleMetalWindow(new NativeHandle(nsView), new NativeHandle(metalLayer));
}
throw new NotImplementedException();
}
@ -53,7 +62,11 @@ namespace Ryujinx.Ui
WaitEvent.Set();
}
return base.OnConfigureEvent(evnt);
bool result = base.OnConfigureEvent(evnt);
_updateBoundsCallback?.Invoke(Window);
return result;
}
public unsafe IntPtr CreateWindowSurface(IntPtr instance)