diff --git a/src/SDL2.cs b/src/SDL2.cs index c06d592e..16385d59 100644 --- a/src/SDL2.cs +++ b/src/SDL2.cs @@ -29,6 +29,7 @@ #region Using Statements using System; using System.Diagnostics; +using System.Linq; #if NET6_0_OR_GREATER using System.Diagnostics.CodeAnalysis; #endif @@ -2431,10 +2432,26 @@ IntPtr pNames [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern SDL_bool SDL_Vulkan_GetInstanceExtensions( IntPtr window, - out uint pCount, + ref uint pCount, IntPtr[] pNames ); + /* window refers to an SDL_Window*. + * Only available in 2.0.6 or higher. + */ + public static SDL_bool SDL_Vulkan_GetInstanceExtensions(IntPtr window, out string[] names) + { + names = new string[0]; + uint count; + SDL_bool result = SDL_Vulkan_GetInstanceExtensions(window, out count, IntPtr.Zero); + if (result == SDL_bool.SDL_FALSE) return result; + IntPtr[] pNames = new IntPtr[count]; + result = SDL_Vulkan_GetInstanceExtensions(window, ref count, pNames); + if (result == SDL_bool.SDL_FALSE) return result; + names = pNames.Select(pointer => UTF8_ToManaged(pointer)).ToArray(); + return result; + } + /* window refers to an SDL_Window. * instance refers to a VkInstance. * surface refers to a VkSurfaceKHR.