| 1 | //! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_win32_surface.html> |
| 2 | |
| 3 | use crate::prelude::*; |
| 4 | use crate::vk; |
| 5 | use crate::RawPtr; |
| 6 | use core::mem; |
| 7 | |
| 8 | impl crate::khr::win32_surface::Instance { |
| 9 | /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCreateWin32SurfaceKHR.html> |
| 10 | #[inline] |
| 11 | pub unsafe fn create_win32_surface( |
| 12 | &self, |
| 13 | create_info: &vk::Win32SurfaceCreateInfoKHR<'_>, |
| 14 | allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>, |
| 15 | ) -> VkResult<vk::SurfaceKHR> { |
| 16 | let mut surface = mem::MaybeUninit::uninit(); |
| 17 | (self.fp.create_win32_surface_khr)( |
| 18 | self.handle, |
| 19 | create_info, |
| 20 | allocation_callbacks.as_raw_ptr(), |
| 21 | surface.as_mut_ptr(), |
| 22 | ) |
| 23 | .assume_init_on_success(surface) |
| 24 | } |
| 25 | |
| 26 | /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceWin32PresentationSupportKHR.html> |
| 27 | #[inline] |
| 28 | pub unsafe fn get_physical_device_win32_presentation_support( |
| 29 | &self, |
| 30 | physical_device: vk::PhysicalDevice, |
| 31 | queue_family_index: u32, |
| 32 | ) -> bool { |
| 33 | let b = (self.fp.get_physical_device_win32_presentation_support_khr)( |
| 34 | physical_device, |
| 35 | queue_family_index, |
| 36 | ); |
| 37 | |
| 38 | b > 0 |
| 39 | } |
| 40 | } |