// Vulkan support reference // https://www.glfw.org/docs/latest/group__vulkan.html // Hand-written member of the Vulkan library. CreateWindowSurface fixed-pins the out-parameter into // a pointer and hardcodes a null allocator - not mechanically derivable - so it stays here. The // rest of the Vulkan library is generated into Generated/Libraries/Glfw.Vulkan.gen.cs and merges // into this same partial class. namespace Brutal.GlfwApi; public static unsafe partial class Glfw { /// Creates a Vulkan surface for the specified window. /// /// This function creates a Vulkan surface for the specified window. /// /// If the Vulkan loader or at least one minimally functional ICD were not found, this function returns /// VK_ERROR_INITIALIZATION_FAILED and generates a error. Call /// Glfw.VulkanSupported to check whether Vulkan is at least minimally available. /// /// If the required window surface creation instance extensions are not available or the specified instance was not /// created with these extensions enabled, /// this function returns VK_ERROR_EXTENSION_NOT_PRESENT and generates a error. Call /// GetRequiredInstanceExtensions to check what instance extensions /// are required. /// /// The window surface cannot be shared with another API so the window must have been created with the /// hint set to otherwise it /// generates a error and returns VK_ERROR_NATIVE_WINDOW_IN_USE_KHR. /// /// The window surface must be destroyed before the specified Vulkan instance. It is the responsibility of the /// caller to destroy the window surface. GLFW does not destroy it for you. /// Call vkGetInstanceProcAddr on the surface to destroy it. /// /// If an error occurs before the creation call is made, GLFW returns the Vulkan error code most appropriate for /// the error. Appropriate use of Glfw.VulkanSupported and /// GetRequiredInstanceExtensions should eliminate /// almost all occurrences of this error. /// /// macOS: GLFW prefers the VK_EXT_metal_surface extension, with the VK_MVK_macos_surface extension /// as a fallback. The VK_EXT_metal_surface extension is the preferred extension for macOS and is the only /// one that supports Metal. /// /// macOS: This function creates and sets a CAMetalLayer instance for the window content view, which is /// required for MoltenVK to function. /// /// /// , /// , /// , /// /// /// This function may be called from any thread. /// Creating a Vulkan window surface public static int CreateWindowSurface(nint instance, GlfwWindow window, out ulong surface) { fixed (ulong* surfacePtr = &surface) { // Call the internal function to create the window surface return PInvoke.CreateWindowSurface(instance, window, null, surfacePtr); } } }