glfw: add glfw.getPhysicalDevicePresentationSupport

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2021-10-18 20:11:27 -07:00 committed by Stephen Gutekanst
parent 658847c8d9
commit e7b8f2483c

View file

@ -106,34 +106,37 @@ pub inline fn getInstanceProcAddress(vk_instance: ?*opaque {}, proc_name: [*c]co
return null; return null;
} }
// TODO(vulkan): /// Returns whether the specified queue family can present images.
// /// Returns whether the specified queue family can present images. ///
// /// /// This function returns whether the specified queue family of the specified physical device
// /// This function returns whether the specified queue family of the specified physical device /// supports presentation to the platform GLFW was built for.
// /// supports presentation to the platform GLFW was built for. ///
// /// /// If Vulkan or the required window surface creation instance extensions are not available on the
// /// If Vulkan or the required window surface creation instance extensions are not available on the /// machine, or if the specified instance was not created with the required extensions, this
// /// machine, or if the specified instance was not created with the required extensions, this /// function returns `GLFW_FALSE` and generates a glfw.Error.APIUnavailable error. Call
// /// function returns `GLFW_FALSE` and generates a glfw.Error.APIUnavailable error. Call /// glfw.vulkanSupported to check whether Vulkan is at least minimally available and
// /// glfw.vulkanSupported to check whether Vulkan is at least minimally available and /// glfw.getRequiredInstanceExtensions to check what instance extensions are required.
// /// glfw.getRequiredInstanceExtensions to check what instance extensions are required. ///
// /// /// @param[in] instance The instance that the physical device belongs to.
// /// @param[in] instance The instance that the physical device belongs to. /// @param[in] device The physical device that the queue family belongs to.
// /// @param[in] device The physical device that the queue family belongs to. /// @param[in] queuefamily The index of the queue family to query.
// /// @param[in] queuefamily The index of the queue family to query. /// @return `GLFW_TRUE` if the queue family supports presentation, or
// /// @return `GLFW_TRUE` if the queue family supports presentation, or /// `GLFW_FALSE` otherwise.
// /// `GLFW_FALSE` otherwise. ///
// /// /// Possible errors include glfw.Error.NotInitialized, glfw.Error.APIUnavailable and glfw.Error.PlatformError.
// /// Possible errors include glfw.Error.NotInitialized, glfw.Error.APIUnavailable and glfw.Error.PlatformError. ///
// /// /// macos: This function currently always returns `GLFW_TRUE`, as the `VK_MVK_macos_surface`
// /// macos: This function currently always returns `GLFW_TRUE`, as the `VK_MVK_macos_surface` /// extension does not provide a `vkGetPhysicalDevice*PresentationSupport` type function.
// /// extension does not provide a `vkGetPhysicalDevice*PresentationSupport` type function. ///
// /// /// @thread_safety This function may be called from any thread. For synchronization details of
// /// @thread_safety This function may be called from any thread. For synchronization details of /// Vulkan objects, see the Vulkan specification.
// /// Vulkan objects, see the Vulkan specification. ///
// /// /// see also: vulkan_present
// /// see also: vulkan_present pub inline fn getPhysicalDevicePresentationSupport(vk_instance: *opaque {}, vk_physical_device: *opaque {}, queue_family: u32) Error!bool {
// GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); const v = c.glfwGetPhysicalDevicePresentationSupport(@ptrCast(c.VkInstance, vk_instance), @ptrCast(c.VkPhysicalDevice, vk_physical_device), queue_family);
try getError();
return v == c.GLFW_TRUE;
}
// TODO(vulkan): // TODO(vulkan):
// /// Creates a Vulkan surface for the specified window. // /// Creates a Vulkan surface for the specified window.