From e8cdfa92798b5245abf1bc0bd05a1715e9dd0199 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Thu, 29 Sep 2022 21:17:59 +0000 Subject: [PATCH] 1.8.0 (#2) Reviewed-on: https://gitea.moonside.games/MoonsideGames/RefreshCS/pulls/2 --- src/Refresh.cs | 56 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/src/Refresh.cs b/src/Refresh.cs index ef0a9e2..850b75a 100644 --- a/src/Refresh.cs +++ b/src/Refresh.cs @@ -36,7 +36,7 @@ namespace RefreshCS /* Version */ public const uint REFRESH_MAJOR_VERSION = 1; - public const uint REFRESH_MINOR_VERSION = 7; + public const uint REFRESH_MINOR_VERSION = 8; public const uint REFRESH_PATCH_VERSION = 0; public const uint REFRESH_COMPILED_VERSION = ( @@ -315,6 +315,14 @@ namespace RefreshCS IntOpaqueWhite } + public enum Backend + { + DontCare, + Vulkan, + PS5, + Invalid + } + /* Native Structures */ [StructLayout(LayoutKind.Sequential)] @@ -363,13 +371,6 @@ namespace RefreshCS public uint level; } - [StructLayout(LayoutKind.Sequential)] - public struct PresentationParameters - { - public IntPtr deviceWindowHandle; - public PresentMode presentMode; - } - [StructLayout(LayoutKind.Sequential)] public struct SamplerStateCreateInfo { @@ -585,9 +586,14 @@ namespace RefreshCS /* Init/Quit */ + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern Backend Refresh_SelectBackend( + Backend preferredBackend, + out uint flags + ); + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr Refresh_CreateDevice( - in PresentationParameters presentationParameters, byte debugMode ); @@ -940,6 +946,32 @@ namespace RefreshCS /* Submission/Presentation */ + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern byte Refresh_ClaimWindow( + IntPtr device, + IntPtr windowHandle, + PresentMode presentMode + ); + + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern void Refresh_UnclaimWindow( + IntPtr device, + IntPtr windowHandle + ); + + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern void Refresh_SetSwapchainPresentMode( + IntPtr device, + IntPtr windowHandle, + PresentMode presentMode + ); + + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] + public static extern TextureFormat Refresh_GetSwapchainFormat( + IntPtr device, + IntPtr windowHandle + ); + [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr Refresh_AcquireCommandBuffer( IntPtr device, @@ -955,12 +987,6 @@ namespace RefreshCS out uint height ); - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern TextureFormat Refresh_GetSwapchainFormat( - IntPtr device, - IntPtr windowHandle - ); - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void Refresh_Submit( IntPtr device,