mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-08 15:38:34 +00:00
784cf9d594
* Ava UI: `Renderer` refactoring * Fix Vulkan CreateSurface
42 lines
1.3 KiB
C#
42 lines
1.3 KiB
C#
using Silk.NET.Vulkan;
|
|
using SPB.Graphics.Vulkan;
|
|
using SPB.Platform.Metal;
|
|
using SPB.Platform.Win32;
|
|
using SPB.Platform.X11;
|
|
using SPB.Windowing;
|
|
using System;
|
|
|
|
namespace Ryujinx.Ava.UI.Renderer
|
|
{
|
|
public class EmbeddedWindowVulkan : EmbeddedWindow
|
|
{
|
|
public SurfaceKHR CreateSurface(Instance instance)
|
|
{
|
|
NativeWindowBase nativeWindowBase;
|
|
|
|
if (OperatingSystem.IsWindows())
|
|
{
|
|
nativeWindowBase = new SimpleWin32Window(new NativeHandle(WindowHandle));
|
|
}
|
|
else if (OperatingSystem.IsLinux())
|
|
{
|
|
nativeWindowBase = new SimpleX11Window(new NativeHandle(X11Display), new NativeHandle(WindowHandle));
|
|
}
|
|
else if (OperatingSystem.IsMacOS())
|
|
{
|
|
nativeWindowBase = new SimpleMetalWindow(new NativeHandle(NsView), new NativeHandle(MetalLayer));
|
|
}
|
|
else
|
|
{
|
|
throw new PlatformNotSupportedException();
|
|
}
|
|
|
|
return new SurfaceKHR((ulong?)VulkanHelper.CreateWindowSurface(instance.Handle, nativeWindowBase));
|
|
}
|
|
|
|
public SurfaceKHR CreateSurface(Instance instance, Vk api)
|
|
{
|
|
return CreateSurface(instance);
|
|
}
|
|
}
|
|
} |