diff --git a/Changelog.md b/Changelog.md index 741d15e..fed5440 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Added `VK_EXT_sample_locations` device extension (#616) - Update Vulkan-Headers to 1.3.211 (#605, #608) - Added `VK_EXT_image_drm_format_modifier` device extension (#603) diff --git a/ash/src/extensions/ext/mod.rs b/ash/src/extensions/ext/mod.rs index 0a71ffd..2de7c80 100644 --- a/ash/src/extensions/ext/mod.rs +++ b/ash/src/extensions/ext/mod.rs @@ -13,6 +13,7 @@ pub use self::image_drm_format_modifier::ImageDrmFormatModifier; pub use self::metal_surface::MetalSurface; pub use self::physical_device_drm::PhysicalDeviceDrm; pub use self::private_data::PrivateData; +pub use self::sample_locations::SampleLocations; pub use self::tooling_info::ToolingInfo; mod buffer_device_address; @@ -30,4 +31,5 @@ mod image_drm_format_modifier; mod metal_surface; mod physical_device_drm; mod private_data; +mod sample_locations; mod tooling_info; diff --git a/ash/src/extensions/ext/sample_locations.rs b/ash/src/extensions/ext/sample_locations.rs new file mode 100644 index 0000000..c83c530 --- /dev/null +++ b/ash/src/extensions/ext/sample_locations.rs @@ -0,0 +1,50 @@ +use crate::vk; +use crate::{Entry, Instance}; +use std::ffi::CStr; +use std::mem; + +/// +#[derive(Clone)] +pub struct SampleLocations { + fp: vk::ExtSampleLocationsFn, +} + +impl SampleLocations { + pub fn new(entry: &Entry, instance: &Instance) -> Self { + let fp = vk::ExtSampleLocationsFn::load(|name| unsafe { + mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) + }); + Self { fp } + } + + /// + pub unsafe fn get_physical_device_multisample_properties( + &self, + physical_device: vk::PhysicalDevice, + samples: vk::SampleCountFlags, + multisample_properties: &mut vk::MultisamplePropertiesEXT, + ) { + (self.fp.get_physical_device_multisample_properties_ext)( + physical_device, + samples, + multisample_properties, + ) + } + + /// + pub unsafe fn cmd_set_sample_locations( + &self, + command_buffer: vk::CommandBuffer, + sample_locations_info: &vk::SampleLocationsInfoEXT, + ) { + (self.fp.cmd_set_sample_locations_ext)(command_buffer, sample_locations_info) + } + + pub const fn name() -> &'static CStr { + vk::ExtSampleLocationsFn::name() + } + + pub fn fp(&self) -> &vk::ExtSampleLocationsFn { + &self.fp + } +}