ash/extensions/khr/
get_physical_device_properties2.rs

1//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_get_physical_device_properties2.html>
2
3use crate::prelude::*;
4use crate::vk;
5use core::mem;
6use core::ptr;
7
8impl crate::khr::get_physical_device_properties2::Instance {
9    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceFeatures2KHR.html>
10    #[inline]
11    pub unsafe fn get_physical_device_features2(
12        &self,
13        physical_device: vk::PhysicalDevice,
14        features: &mut vk::PhysicalDeviceFeatures2KHR<'_>,
15    ) {
16        (self.fp.get_physical_device_features2_khr)(physical_device, features);
17    }
18
19    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceFormatProperties2KHR.html>
20    #[inline]
21    pub unsafe fn get_physical_device_format_properties2(
22        &self,
23        physical_device: vk::PhysicalDevice,
24        format: vk::Format,
25        format_properties: &mut vk::FormatProperties2KHR<'_>,
26    ) {
27        (self.fp.get_physical_device_format_properties2_khr)(
28            physical_device,
29            format,
30            format_properties,
31        );
32    }
33
34    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceImageFormatProperties2KHR.html>
35    #[inline]
36    pub unsafe fn get_physical_device_image_format_properties2(
37        &self,
38        physical_device: vk::PhysicalDevice,
39        image_format_info: &vk::PhysicalDeviceImageFormatInfo2KHR<'_>,
40        image_format_properties: &mut vk::ImageFormatProperties2KHR<'_>,
41    ) -> VkResult<()> {
42        (self.fp.get_physical_device_image_format_properties2_khr)(
43            physical_device,
44            image_format_info,
45            image_format_properties,
46        )
47        .result()
48    }
49
50    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceMemoryProperties2KHR.html>
51    #[inline]
52    pub unsafe fn get_physical_device_memory_properties2(
53        &self,
54        physical_device: vk::PhysicalDevice,
55        memory_properties: &mut vk::PhysicalDeviceMemoryProperties2KHR<'_>,
56    ) {
57        (self.fp.get_physical_device_memory_properties2_khr)(physical_device, memory_properties);
58    }
59
60    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceProperties2KHR.html>
61    #[inline]
62    pub unsafe fn get_physical_device_properties2(
63        &self,
64        physical_device: vk::PhysicalDevice,
65        properties: &mut vk::PhysicalDeviceProperties2KHR<'_>,
66    ) {
67        (self.fp.get_physical_device_properties2_khr)(physical_device, properties);
68    }
69
70    /// Retrieve the number of elements to pass to [`get_physical_device_queue_family_properties2()`][Self::get_physical_device_queue_family_properties2()]
71    #[inline]
72    pub unsafe fn get_physical_device_queue_family_properties2_len(
73        &self,
74        physical_device: vk::PhysicalDevice,
75    ) -> usize {
76        let mut count = mem::MaybeUninit::uninit();
77        (self.fp.get_physical_device_queue_family_properties2_khr)(
78            physical_device,
79            count.as_mut_ptr(),
80            ptr::null_mut(),
81        );
82        count.assume_init() as usize
83    }
84
85    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceQueueFamilyProperties2KHR.html>
86    ///
87    /// Call [`get_physical_device_queue_family_properties2_len()`][Self::get_physical_device_queue_family_properties2_len()] to query the number of elements to pass to `out`.
88    /// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
89    #[inline]
90    pub unsafe fn get_physical_device_queue_family_properties2(
91        &self,
92        physical_device: vk::PhysicalDevice,
93        out: &mut [vk::QueueFamilyProperties2KHR<'_>],
94    ) {
95        let mut count = out.len() as u32;
96        (self.fp.get_physical_device_queue_family_properties2_khr)(
97            physical_device,
98            &mut count,
99            out.as_mut_ptr(),
100        );
101        assert_eq!(count as usize, out.len());
102    }
103
104    /// Retrieve the number of elements to pass to [`get_physical_device_sparse_image_format_properties2()`][Self::get_physical_device_sparse_image_format_properties2()]
105    #[inline]
106    pub unsafe fn get_physical_device_sparse_image_format_properties2_len(
107        &self,
108        physical_device: vk::PhysicalDevice,
109        format_info: &vk::PhysicalDeviceSparseImageFormatInfo2KHR<'_>,
110    ) -> usize {
111        let mut count = mem::MaybeUninit::uninit();
112        (self
113            .fp
114            .get_physical_device_sparse_image_format_properties2_khr)(
115            physical_device,
116            format_info,
117            count.as_mut_ptr(),
118            ptr::null_mut(),
119        );
120        count.assume_init() as usize
121    }
122
123    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSparseImageFormatProperties2KHR.html>
124    ///
125    /// Call [`get_physical_device_sparse_image_format_properties2_len()`][Self::get_physical_device_sparse_image_format_properties2_len()] to query the number of elements to pass to `out`.
126    /// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
127    #[inline]
128    pub unsafe fn get_physical_device_sparse_image_format_properties2(
129        &self,
130        physical_device: vk::PhysicalDevice,
131        format_info: &vk::PhysicalDeviceSparseImageFormatInfo2KHR<'_>,
132        out: &mut [vk::SparseImageFormatProperties2KHR<'_>],
133    ) {
134        let mut count = out.len() as u32;
135        (self
136            .fp
137            .get_physical_device_sparse_image_format_properties2_khr)(
138            physical_device,
139            format_info,
140            &mut count,
141            out.as_mut_ptr(),
142        );
143        assert_eq!(count as usize, out.len());
144    }
145}