diff --git a/ash/src/extensions/khr/get_physical_device_properties2.rs b/ash/src/extensions/khr/get_physical_device_properties2.rs new file mode 100644 index 000000000..2a39254ca --- /dev/null +++ b/ash/src/extensions/khr/get_physical_device_properties2.rs @@ -0,0 +1,160 @@ +#![allow(dead_code)] +use crate::prelude::*; +use crate::version::{EntryV1_0, InstanceV1_0}; +use crate::vk; +use std::ffi::CStr; +use std::mem; +use std::ptr; + +#[derive(Clone)] +pub struct GetPhysicalDeviceProperties2 { + handle: vk::Instance, + get_physical_device_properties2_fn: vk::KhrGetPhysicalDeviceProperties2Fn, +} + +impl GetPhysicalDeviceProperties2 { + pub fn new( + entry: &E, + instance: &I, + ) -> GetPhysicalDeviceProperties2 { + let get_physical_device_properties2_fn = + vk::KhrGetPhysicalDeviceProperties2Fn::load(|name| unsafe { + mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) + }); + GetPhysicalDeviceProperties2 { + handle: instance.handle(), + get_physical_device_properties2_fn, + } + } + + pub fn name() -> &'static CStr { + vk::KhrGetPhysicalDeviceProperties2Fn::name() + } + + #[doc = ""] + unsafe fn get_physical_device_features2( + &self, + physical_device: vk::PhysicalDevice, + features: &mut vk::PhysicalDeviceFeatures2KHR, + ) { + self.get_physical_device_properties2_fn + .get_physical_device_features2_khr(physical_device, features); + } + + #[doc = ""] + unsafe fn get_physical_device_format_properties2( + &self, + physical_device: vk::PhysicalDevice, + format: vk::Format, + format_properties: &mut vk::FormatProperties2KHR, + ) { + self.get_physical_device_properties2_fn + .get_physical_device_format_properties2_khr(physical_device, format, format_properties); + } + + #[doc = ""] + unsafe fn get_physical_device_image_format_properties2( + &self, + physical_device: vk::PhysicalDevice, + image_format_info: &vk::PhysicalDeviceImageFormatInfo2KHR, + image_format_properties: &mut vk::ImageFormatProperties2KHR, + ) -> VkResult<()> { + self.get_physical_device_properties2_fn + .get_physical_device_image_format_properties2_khr( + physical_device, + image_format_info, + image_format_properties, + ) + .result() + } + + #[doc = ""] + unsafe fn get_physical_device_memory_properties2( + &self, + physical_device: vk::PhysicalDevice, + memory_properties: &mut vk::PhysicalDeviceMemoryProperties2KHR, + ) { + self.get_physical_device_properties2_fn + .get_physical_device_memory_properties2_khr(physical_device, memory_properties); + } + + #[doc = ""] + unsafe fn get_physical_device_properties2( + &self, + physical_device: vk::PhysicalDevice, + properties: &mut vk::PhysicalDeviceProperties2KHR, + ) { + self.get_physical_device_properties2_fn + .get_physical_device_properties2_khr(physical_device, properties); + } + + unsafe fn get_physical_device_queue_family_properties2_len( + &self, + physical_device: vk::PhysicalDevice, + ) -> usize { + let mut count = mem::zeroed(); + self.get_physical_device_properties2_fn + .get_physical_device_queue_family_properties2_khr( + physical_device, + &mut count, + ptr::null_mut(), + ); + count as usize + } + + #[doc = ""] + unsafe fn get_physical_device_queue_family_properties2( + &self, + physical_device: vk::PhysicalDevice, + queue_family_properties: &mut [vk::QueueFamilyProperties2KHR], + ) { + let mut count = queue_family_properties.len() as u32; + self.get_physical_device_properties2_fn + .get_physical_device_queue_family_properties2_khr( + physical_device, + &mut count, + queue_family_properties.as_mut_ptr(), + ); + } + + unsafe fn get_physical_device_sparse_image_format_properties2_len( + &self, + physical_device: vk::PhysicalDevice, + format_info: &vk::PhysicalDeviceSparseImageFormatInfo2KHR, + ) -> usize { + let mut count = mem::zeroed(); + self.get_physical_device_properties2_fn + .get_physical_device_sparse_image_format_properties2_khr( + physical_device, + format_info, + &mut count, + ptr::null_mut(), + ); + count as usize + } + + #[doc = ""] + unsafe fn get_physical_device_sparse_image_format_properties2( + &self, + physical_device: vk::PhysicalDevice, + format_info: &vk::PhysicalDeviceSparseImageFormatInfo2KHR, + properties: &mut [vk::SparseImageFormatProperties2KHR], + ) { + let mut count = properties.len() as u32; + self.get_physical_device_properties2_fn + .get_physical_device_sparse_image_format_properties2_khr( + physical_device, + format_info, + &mut count, + properties.as_mut_ptr(), + ); + } + + pub fn fp(&self) -> &vk::KhrGetPhysicalDeviceProperties2Fn { + &self.get_physical_device_properties2_fn + } + + pub fn instance(&self) -> vk::Instance { + self.handle + } +} diff --git a/ash/src/extensions/khr/mod.rs b/ash/src/extensions/khr/mod.rs index 22cafa90e..f806bb089 100644 --- a/ash/src/extensions/khr/mod.rs +++ b/ash/src/extensions/khr/mod.rs @@ -10,6 +10,7 @@ pub use self::external_fence_fd::ExternalFenceFd; pub use self::external_memory_fd::ExternalMemoryFd; pub use self::external_semaphore_fd::ExternalSemaphoreFd; pub use self::get_memory_requirements2::GetMemoryRequirements2; +pub use self::get_physical_device_properties2::GetPhysicalDeviceProperties2; pub use self::maintenance1::Maintenance1; pub use self::maintenance3::Maintenance3; pub use self::pipeline_executable_properties::PipelineExecutableProperties; @@ -35,6 +36,7 @@ mod external_fence_fd; mod external_memory_fd; mod external_semaphore_fd; mod get_memory_requirements2; +mod get_physical_device_properties2; mod maintenance1; mod maintenance3; mod pipeline_executable_properties;