Skip to main content

jay_ash/extensions/nv/
coverage_reduction_mode.rs

1//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_NV_coverage_reduction_mode.html>
2
3use crate::prelude::*;
4use crate::vk;
5use core::mem;
6use core::ptr;
7
8impl crate::nv::coverage_reduction_mode::Instance {
9    /// Retrieve the number of elements to pass to [`get_physical_device_supported_framebuffer_mixed_samples_combinations()`][Self::get_physical_device_supported_framebuffer_mixed_samples_combinations()]
10    #[inline]
11    pub unsafe fn get_physical_device_supported_framebuffer_mixed_samples_combinations_len(
12        &self,
13        physical_device: vk::PhysicalDevice,
14    ) -> VkResult<usize> {
15        unsafe {
16            let mut count = mem::MaybeUninit::uninit();
17            (self
18                .fp
19                .get_physical_device_supported_framebuffer_mixed_samples_combinations_nv)(
20                physical_device,
21                count.as_mut_ptr(),
22                ptr::null_mut(),
23            )
24            .assume_init_on_success(count)
25            .map(|c| c as usize)
26        }
27    }
28
29    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV.html>
30    ///
31    /// Call [`get_physical_device_supported_framebuffer_mixed_samples_combinations_len()`][Self::get_physical_device_supported_framebuffer_mixed_samples_combinations_len()] to query the number of elements to pass to `out`.
32    /// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
33    #[inline]
34    pub unsafe fn get_physical_device_supported_framebuffer_mixed_samples_combinations(
35        &self,
36        physical_device: vk::PhysicalDevice,
37        out: &mut [vk::FramebufferMixedSamplesCombinationNV<'_>],
38    ) -> VkResult<()> {
39        unsafe {
40            let mut count = out.len() as u32;
41            (self
42                .fp
43                .get_physical_device_supported_framebuffer_mixed_samples_combinations_nv)(
44                physical_device,
45                &mut count,
46                out.as_mut_ptr(),
47            )
48            .result()?;
49            assert_eq!(count as usize, out.len());
50            Ok(())
51        }
52    }
53}