aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Headless.SDL2/Vulkan/VulkanWindow.cs
diff options
context:
space:
mode:
authorriperiperi <rhy3756547@hotmail.com>2022-12-06 22:00:25 +0000
committerGitHub <noreply@github.com>2022-12-06 19:00:25 -0300
commite211c3f00a847f50b286349918e5c51967862e93 (patch)
tree5c703923741ee42362c86fef3981bdf745f881a4 /Ryujinx.Headless.SDL2/Vulkan/VulkanWindow.cs
parentd3709a753f88e6b02d6a1760835227a7fdcc5a19 (diff)
UI: Add Metal surface creation for MoltenVK (#3980)1.1.439
* 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>
Diffstat (limited to 'Ryujinx.Headless.SDL2/Vulkan/VulkanWindow.cs')
-rw-r--r--Ryujinx.Headless.SDL2/Vulkan/VulkanWindow.cs28
1 files changed, 24 insertions, 4 deletions
diff --git a/Ryujinx.Headless.SDL2/Vulkan/VulkanWindow.cs b/Ryujinx.Headless.SDL2/Vulkan/VulkanWindow.cs
index 6eacadc1..18323339 100644
--- a/Ryujinx.Headless.SDL2/Vulkan/VulkanWindow.cs
+++ b/Ryujinx.Headless.SDL2/Vulkan/VulkanWindow.cs
@@ -1,6 +1,7 @@
using Ryujinx.Common.Configuration;
using Ryujinx.Common.Logging;
using Ryujinx.Input.HLE;
+using Ryujinx.SDL2.Common;
using System;
using System.Runtime.InteropServices;
using static SDL2.SDL;
@@ -26,15 +27,34 @@ namespace Ryujinx.Headless.SDL2.Vulkan
MouseDriver.SetClientSize(DefaultWidth, DefaultHeight);
}
+ private void BasicInvoke(Action action)
+ {
+ action();
+ }
+
public unsafe IntPtr CreateWindowSurface(IntPtr instance)
{
- if (SDL_Vulkan_CreateSurface(WindowHandle, instance, out ulong surfaceHandle) == SDL_bool.SDL_FALSE)
+ ulong surfaceHandle = 0;
+
+ Action createSurface = () =>
{
- string errorMessage = $"SDL_Vulkan_CreateSurface failed with error \"{SDL_GetError()}\"";
+ if (SDL_Vulkan_CreateSurface(WindowHandle, instance, out surfaceHandle) == SDL_bool.SDL_FALSE)
+ {
+ string errorMessage = $"SDL_Vulkan_CreateSurface failed with error \"{SDL_GetError()}\"";
- Logger.Error?.Print(LogClass.Application, errorMessage);
+ Logger.Error?.Print(LogClass.Application, errorMessage);
- throw new Exception(errorMessage);
+ throw new Exception(errorMessage);
+ }
+ };
+
+ if (SDL2Driver.MainThreadDispatcher != null)
+ {
+ SDL2Driver.MainThreadDispatcher(createSurface);
+ }
+ else
+ {
+ createSurface();
}
return (IntPtr)surfaceHandle;