|
| 1 | +//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_get_display_properties2.html> |
| 2 | +
|
| 3 | +use crate::prelude::*; |
| 4 | +use crate::vk; |
| 5 | +use core::mem; |
| 6 | +use core::ptr; |
| 7 | + |
| 8 | +impl crate::khr::get_display_properties2::Instance { |
| 9 | + /// Retrieve the number of elements to pass to [`get_physical_device_display_properties2()`][Self::get_physical_device_display_properties2()] |
| 10 | + #[inline] |
| 11 | + pub unsafe fn get_physical_device_display_properties2_len( |
| 12 | + &self, |
| 13 | + physical_device: vk::PhysicalDevice, |
| 14 | + ) -> VkResult<usize> { |
| 15 | + let mut count = mem::MaybeUninit::uninit(); |
| 16 | + (self.fp.get_physical_device_display_properties2_khr)( |
| 17 | + physical_device, |
| 18 | + count.as_mut_ptr(), |
| 19 | + ptr::null_mut(), |
| 20 | + ) |
| 21 | + .assume_init_on_success(count) |
| 22 | + .map(|c| c as usize) |
| 23 | + } |
| 24 | + |
| 25 | + /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceDisplayProperties2KHR.html> |
| 26 | + /// |
| 27 | + /// Call [`get_physical_device_display_properties2_len()`][Self::get_physical_device_display_properties2_len()] to query the number of elements to pass to `out`. |
| 28 | + /// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer. |
| 29 | + #[inline] |
| 30 | + #[doc(alias = "vkGetPhysicalDeviceDisplayProperties2KHR")] |
| 31 | + pub unsafe fn get_physical_device_display_properties2( |
| 32 | + &self, |
| 33 | + physical_device: vk::PhysicalDevice, |
| 34 | + out: &mut [vk::DisplayProperties2KHR<'_>], |
| 35 | + ) -> VkResult<()> { |
| 36 | + let mut count = out.len() as u32; |
| 37 | + (self.fp.get_physical_device_display_properties2_khr)( |
| 38 | + physical_device, |
| 39 | + &mut count, |
| 40 | + out.as_mut_ptr(), |
| 41 | + ) |
| 42 | + .result()?; |
| 43 | + assert_eq!(count as usize, out.len()); |
| 44 | + Ok(()) |
| 45 | + } |
| 46 | + |
| 47 | + /// Retrieve the number of elements to pass to [`get_physical_device_display_plane_properties2()`][Self::get_physical_device_display_plane_properties2()] |
| 48 | + #[inline] |
| 49 | + pub unsafe fn get_physical_device_display_plane_properties2_len( |
| 50 | + &self, |
| 51 | + physical_device: vk::PhysicalDevice, |
| 52 | + ) -> VkResult<usize> { |
| 53 | + let mut count = mem::MaybeUninit::uninit(); |
| 54 | + (self.fp.get_physical_device_display_plane_properties2_khr)( |
| 55 | + physical_device, |
| 56 | + count.as_mut_ptr(), |
| 57 | + ptr::null_mut(), |
| 58 | + ) |
| 59 | + .assume_init_on_success(count) |
| 60 | + .map(|c| c as usize) |
| 61 | + } |
| 62 | + |
| 63 | + /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceDisplayPlaneProperties2KHR.html> |
| 64 | + /// |
| 65 | + /// Call [`get_physical_device_display_plane_properties2_len()`][Self::get_physical_device_display_plane_properties2_len()] to query the number of elements to pass to `out`. |
| 66 | + /// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer. |
| 67 | + #[inline] |
| 68 | + #[doc(alias = "vkGetPhysicalDeviceDisplayPlaneProperties2KHR")] |
| 69 | + pub unsafe fn get_physical_device_display_plane_properties2( |
| 70 | + &self, |
| 71 | + physical_device: vk::PhysicalDevice, |
| 72 | + out: &mut [vk::DisplayPlaneProperties2KHR<'_>], |
| 73 | + ) -> VkResult<()> { |
| 74 | + let mut count = out.len() as u32; |
| 75 | + (self.fp.get_physical_device_display_plane_properties2_khr)( |
| 76 | + physical_device, |
| 77 | + &mut count, |
| 78 | + out.as_mut_ptr(), |
| 79 | + ) |
| 80 | + .result()?; |
| 81 | + assert_eq!(count as usize, out.len()); |
| 82 | + Ok(()) |
| 83 | + } |
| 84 | + |
| 85 | + /// Retrieve the number of elements to pass to [`get_display_mode_properties2()`][Self::get_display_mode_properties2()] |
| 86 | + #[inline] |
| 87 | + pub unsafe fn get_display_mode_properties2_len( |
| 88 | + &self, |
| 89 | + physical_device: vk::PhysicalDevice, |
| 90 | + display: vk::DisplayKHR, |
| 91 | + ) -> VkResult<usize> { |
| 92 | + let mut count = mem::MaybeUninit::uninit(); |
| 93 | + (self.fp.get_display_mode_properties2_khr)( |
| 94 | + physical_device, |
| 95 | + display, |
| 96 | + count.as_mut_ptr(), |
| 97 | + ptr::null_mut(), |
| 98 | + ) |
| 99 | + .assume_init_on_success(count) |
| 100 | + .map(|c| c as usize) |
| 101 | + } |
| 102 | + |
| 103 | + /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetDisplayModeProperties2KHR.html> |
| 104 | + /// |
| 105 | + /// Call [`get_display_mode_properties2_len()`][Self::get_display_mode_properties2_len()] to query the number of elements to pass to `out`. |
| 106 | + /// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer. |
| 107 | + #[inline] |
| 108 | + #[doc(alias = "vkGetDisplayModeProperties2KHR")] |
| 109 | + pub unsafe fn get_display_mode_properties2( |
| 110 | + &self, |
| 111 | + physical_device: vk::PhysicalDevice, |
| 112 | + display: vk::DisplayKHR, |
| 113 | + out: &mut [vk::DisplayModeProperties2KHR<'_>], |
| 114 | + ) -> VkResult<()> { |
| 115 | + let mut count = out.len() as u32; |
| 116 | + (self.fp.get_display_mode_properties2_khr)( |
| 117 | + physical_device, |
| 118 | + display, |
| 119 | + &mut count, |
| 120 | + out.as_mut_ptr(), |
| 121 | + ) |
| 122 | + .result()?; |
| 123 | + assert_eq!(count as usize, out.len()); |
| 124 | + Ok(()) |
| 125 | + } |
| 126 | + |
| 127 | + /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetDisplayPlaneCapabilities2KHR.html> |
| 128 | + #[inline] |
| 129 | + #[doc(alias = "vkGetDisplayPlaneCapabilities2KHR")] |
| 130 | + pub unsafe fn get_display_plane_capabilities2( |
| 131 | + &self, |
| 132 | + physical_device: vk::PhysicalDevice, |
| 133 | + display_plane_info: &vk::DisplayPlaneInfo2KHR<'_>, |
| 134 | + capabilities: &mut vk::DisplayPlaneCapabilities2KHR<'_>, |
| 135 | + ) -> VkResult<()> { |
| 136 | + (self.fp.get_display_plane_capabilities2_khr)( |
| 137 | + physical_device, |
| 138 | + display_plane_info, |
| 139 | + capabilities, |
| 140 | + ) |
| 141 | + .result() |
| 142 | + } |
| 143 | +} |
0 commit comments