ash/extensions/ext/
sample_locations.rs

1use crate::vk;
2use crate::{Entry, Instance};
3use std::ffi::CStr;
4use std::mem;
5
6/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_EXT_sample_locations.html>
7#[derive(Clone)]
8pub struct SampleLocations {
9    fp: vk::ExtSampleLocationsFn,
10}
11
12impl SampleLocations {
13    pub fn new(entry: &Entry, instance: &Instance) -> Self {
14        let fp = vk::ExtSampleLocationsFn::load(|name| unsafe {
15            mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
16        });
17        Self { fp }
18    }
19
20    /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceMultisamplePropertiesEXT.html>
21    #[inline]
22    pub unsafe fn get_physical_device_multisample_properties(
23        &self,
24        physical_device: vk::PhysicalDevice,
25        samples: vk::SampleCountFlags,
26        multisample_properties: &mut vk::MultisamplePropertiesEXT,
27    ) {
28        (self.fp.get_physical_device_multisample_properties_ext)(
29            physical_device,
30            samples,
31            multisample_properties,
32        )
33    }
34
35    /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetSampleLocationsEXT.html>
36    #[inline]
37    pub unsafe fn cmd_set_sample_locations(
38        &self,
39        command_buffer: vk::CommandBuffer,
40        sample_locations_info: &vk::SampleLocationsInfoEXT,
41    ) {
42        (self.fp.cmd_set_sample_locations_ext)(command_buffer, sample_locations_info)
43    }
44
45    #[inline]
46    pub const fn name() -> &'static CStr {
47        vk::ExtSampleLocationsFn::name()
48    }
49
50    #[inline]
51    pub fn fp(&self) -> &vk::ExtSampleLocationsFn {
52        &self.fp
53    }
54}