VulkanEmbeddedWindow.cs 931 B

123456789101112131415161718192021222324252627282930313233
  1. using Ryujinx.Ava.Ui.Controls;
  2. using Silk.NET.Vulkan;
  3. using SPB.Graphics.Vulkan;
  4. using SPB.Platform.Win32;
  5. using SPB.Platform.X11;
  6. using SPB.Windowing;
  7. using System;
  8. namespace Ryujinx.Ava.Ui
  9. {
  10. public class VulkanEmbeddedWindow : EmbeddedWindow
  11. {
  12. private NativeWindowBase _window;
  13. public SurfaceKHR CreateSurface(Instance instance)
  14. {
  15. if (OperatingSystem.IsWindows())
  16. {
  17. _window = new SimpleWin32Window(new NativeHandle(WindowHandle));
  18. }
  19. else if (OperatingSystem.IsLinux())
  20. {
  21. _window = new SimpleX11Window(new NativeHandle(X11Display), new NativeHandle(WindowHandle));
  22. }
  23. else
  24. {
  25. throw new PlatformNotSupportedException();
  26. }
  27. return new SurfaceKHR((ulong?)VulkanHelper.CreateWindowSurface(instance.Handle, _window));
  28. }
  29. }
  30. }