diff --git a/ash/src/extensions/khr/mod.rs b/ash/src/extensions/khr/mod.rs index 6b5a788..8334184 100644 --- a/ash/src/extensions/khr/mod.rs +++ b/ash/src/extensions/khr/mod.rs @@ -3,6 +3,7 @@ pub use self::display::Display; pub use self::display_swapchain::DisplaySwapchain; pub use self::draw_indirect_count::DrawIndirectCount; pub use self::external_memory_fd::ExternalMemoryFd; +pub use self::pipeline_executable_properties::PipelineExecutableProperties; pub use self::push_descriptor::PushDescriptor; pub use self::ray_tracing::RayTracing; pub use self::surface::Surface; @@ -18,6 +19,7 @@ mod display; mod display_swapchain; mod draw_indirect_count; mod external_memory_fd; +mod pipeline_executable_properties; mod push_descriptor; mod ray_tracing; mod surface; diff --git a/ash/src/extensions/khr/pipeline_executable_properties.rs b/ash/src/extensions/khr/pipeline_executable_properties.rs new file mode 100644 index 0000000..493be7f --- /dev/null +++ b/ash/src/extensions/khr/pipeline_executable_properties.rs @@ -0,0 +1,129 @@ +#![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 PipelineExecutableProperties { + handle: vk::Instance, + pipeline_executable_properties_fn: vk::KhrPipelineExecutablePropertiesFn, +} + +impl PipelineExecutableProperties { + pub fn new( + entry: &E, + instance: &I, + ) -> PipelineExecutableProperties { + let pipeline_executable_properties_fn = + vk::KhrPipelineExecutablePropertiesFn::load(|name| unsafe { + mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) + }); + + PipelineExecutableProperties { + handle: instance.handle(), + pipeline_executable_properties_fn, + } + } + + pub fn name() -> &'static CStr { + vk::KhrPipelineExecutablePropertiesFn::name() + } + + #[doc = "https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkGetPipelineExecutableInternalRepresentationsKHR.html"] + pub unsafe fn get_pipeline_executable_internal_representations( + &self, + device: vk::Device, + executable_info: &vk::PipelineExecutableInfoKHR, + ) -> VkResult> { + let mut count = 0; + self.pipeline_executable_properties_fn + .get_pipeline_executable_internal_representations_khr( + device, + executable_info, + &mut count, + ptr::null_mut(), + ); + let mut v: Vec<_> = vec![Default::default(); count as usize]; + let err_code = self + .pipeline_executable_properties_fn + .get_pipeline_executable_internal_representations_khr( + device, + executable_info, + &mut count, + v.as_mut_ptr(), + ); + match err_code { + vk::Result::SUCCESS => Ok(v), + _ => Err(err_code), + } + } + + #[doc = "https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkGetPipelineExecutablePropertiesKHR.html"] + pub unsafe fn get_pipeline_executable_properties( + &self, + device: vk::Device, + pipeline_info: &vk::PipelineInfoKHR, + ) -> VkResult> { + let mut count = 0; + self.pipeline_executable_properties_fn + .get_pipeline_executable_properties_khr( + device, + pipeline_info, + &mut count, + ptr::null_mut(), + ); + let mut v: Vec<_> = vec![Default::default(); count as usize]; + let err_code = self + .pipeline_executable_properties_fn + .get_pipeline_executable_properties_khr( + device, + pipeline_info, + &mut count, + v.as_mut_ptr(), + ); + match err_code { + vk::Result::SUCCESS => Ok(v), + _ => Err(err_code), + } + } + + #[doc = "https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkGetPipelineExecutableStatisticsKHR.html"] + pub unsafe fn get_pipeline_executable_statistics( + &self, + device: vk::Device, + executable_info: &vk::PipelineExecutableInfoKHR, + ) -> VkResult> { + let mut count = 0; + self.pipeline_executable_properties_fn + .get_pipeline_executable_statistics_khr( + device, + executable_info, + &mut count, + ptr::null_mut(), + ); + let mut v: Vec<_> = vec![Default::default(); count as usize]; + let err_code = self + .pipeline_executable_properties_fn + .get_pipeline_executable_statistics_khr( + device, + executable_info, + &mut count, + v.as_mut_ptr(), + ); + match err_code { + vk::Result::SUCCESS => Ok(v), + _ => Err(err_code), + } + } + + pub fn fp(&self) -> &vk::KhrPipelineExecutablePropertiesFn { + &self.pipeline_executable_properties_fn + } + + pub fn instance(&self) -> vk::Instance { + self.handle + } +}