1 use crate::prelude::*; 2 use crate::vk; 3 use crate::{Device, Instance}; 4 use std::ffi::CStr; 5 use std::mem; 6 7 #[derive(Clone)] 8 pub struct PipelineExecutableProperties { 9 handle: vk::Device, 10 fp: vk::KhrPipelineExecutablePropertiesFn, 11 } 12 13 impl PipelineExecutableProperties { new(instance: &Instance, device: &Device) -> Self14 pub fn new(instance: &Instance, device: &Device) -> Self { 15 let handle = device.handle(); 16 let fp = vk::KhrPipelineExecutablePropertiesFn::load(|name| unsafe { 17 mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr())) 18 }); 19 Self { handle, fp } 20 } 21 22 /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPipelineExecutableInternalRepresentationsKHR.html> 23 #[inline] get_pipeline_executable_internal_representations( &self, executable_info: &vk::PipelineExecutableInfoKHR, ) -> VkResult<Vec<vk::PipelineExecutableInternalRepresentationKHR>>24 pub unsafe fn get_pipeline_executable_internal_representations( 25 &self, 26 executable_info: &vk::PipelineExecutableInfoKHR, 27 ) -> VkResult<Vec<vk::PipelineExecutableInternalRepresentationKHR>> { 28 read_into_defaulted_vector(|count, data| { 29 (self.fp.get_pipeline_executable_internal_representations_khr)( 30 self.handle, 31 executable_info, 32 count, 33 data, 34 ) 35 }) 36 } 37 38 /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPipelineExecutablePropertiesKHR.html> 39 #[inline] get_pipeline_executable_properties( &self, pipeline_info: &vk::PipelineInfoKHR, ) -> VkResult<Vec<vk::PipelineExecutablePropertiesKHR>>40 pub unsafe fn get_pipeline_executable_properties( 41 &self, 42 pipeline_info: &vk::PipelineInfoKHR, 43 ) -> VkResult<Vec<vk::PipelineExecutablePropertiesKHR>> { 44 read_into_defaulted_vector(|count, data| { 45 (self.fp.get_pipeline_executable_properties_khr)( 46 self.handle, 47 pipeline_info, 48 count, 49 data, 50 ) 51 }) 52 } 53 54 /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPipelineExecutableStatisticsKHR.html> 55 #[inline] get_pipeline_executable_statistics( &self, executable_info: &vk::PipelineExecutableInfoKHR, ) -> VkResult<Vec<vk::PipelineExecutableStatisticKHR>>56 pub unsafe fn get_pipeline_executable_statistics( 57 &self, 58 executable_info: &vk::PipelineExecutableInfoKHR, 59 ) -> VkResult<Vec<vk::PipelineExecutableStatisticKHR>> { 60 read_into_defaulted_vector(|count, data| { 61 (self.fp.get_pipeline_executable_statistics_khr)( 62 self.handle, 63 executable_info, 64 count, 65 data, 66 ) 67 }) 68 } 69 70 #[inline] name() -> &'static CStr71 pub const fn name() -> &'static CStr { 72 vk::KhrPipelineExecutablePropertiesFn::name() 73 } 74 75 #[inline] fp(&self) -> &vk::KhrPipelineExecutablePropertiesFn76 pub fn fp(&self) -> &vk::KhrPipelineExecutablePropertiesFn { 77 &self.fp 78 } 79 80 #[inline] device(&self) -> vk::Device81 pub fn device(&self) -> vk::Device { 82 self.handle 83 } 84 } 85