aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Ava/Ui/Controls/VulkanEmbeddedWindow.cs
blob: d2c980ddf3f93ff7f32f6ad017b8d2d2d62f5ec6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using Ryujinx.Ava.Ui.Controls;
using Silk.NET.Vulkan;
using SPB.Graphics.Vulkan;
using SPB.Platform.Win32;
using SPB.Platform.X11;
using SPB.Windowing;
using System;

namespace Ryujinx.Ava.Ui
{
    public class VulkanEmbeddedWindow : EmbeddedWindow
    {
        private NativeWindowBase _window;

        public SurfaceKHR CreateSurface(Instance instance)
        {
            if (OperatingSystem.IsWindows())
            {
                _window = new SimpleWin32Window(new NativeHandle(WindowHandle));
            }
            else if (OperatingSystem.IsLinux())
            {
                _window = X11Window;
            }
            else
            {
                throw new PlatformNotSupportedException();
            }

            return new SurfaceKHR((ulong?)VulkanHelper.CreateWindowSurface(instance.Handle, _window));
        }
    }
}