ash/extensions/ext/
pipeline_properties.rs1use crate::prelude::*;
2use crate::vk;
3use crate::{Device, Instance};
4use std::ffi::CStr;
5use std::mem;
6
7#[derive(Clone)]
9pub struct PipelineProperties {
10 handle: vk::Device,
11 fp: vk::ExtPipelinePropertiesFn,
12}
13
14impl PipelineProperties {
15 pub fn new(instance: &Instance, device: &Device) -> Self {
16 let handle = device.handle();
17 let fp = vk::ExtPipelinePropertiesFn::load(|name| unsafe {
18 mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr()))
19 });
20 Self { handle, fp }
21 }
22
23 #[inline]
25 pub unsafe fn get_pipeline_properties(
26 &self,
27 pipeline_info: &vk::PipelineInfoEXT,
28 pipeline_properties: &mut impl vk::GetPipelinePropertiesEXTParamPipelineProperties,
29 ) -> VkResult<()> {
30 (self.fp.get_pipeline_properties_ext)(
31 self.handle,
32 pipeline_info,
33 <*mut _>::cast(pipeline_properties),
34 )
35 .result()
36 }
37
38 #[inline]
39 pub const fn name() -> &'static CStr {
40 vk::ExtPipelinePropertiesFn::name()
41 }
42
43 #[inline]
44 pub fn fp(&self) -> &vk::ExtPipelinePropertiesFn {
45 &self.fp
46 }
47
48 #[inline]
49 pub fn device(&self) -> vk::Device {
50 self.handle
51 }
52}