You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

46 lines
950 B

use crate::render::DescriptorSetLayout;
use ash::{version::DeviceV1_0, vk};
use std::rc::Rc;
pub struct PipelineLayout {
handle: vk::PipelineLayout,
pub descriptor: Rc<DescriptorSetLayout>,
}
impl PipelineLayout {
pub fn create(
descriptor: Rc<DescriptorSetLayout>,
) -> Result<Rc<Self>, vk::Result> {
let set_layouts = [ **descriptor ];
let create_info = vk::PipelineLayoutCreateInfo {
set_layout_count: set_layouts.len() as u32,
p_set_layouts: set_layouts.as_ptr(),
..Default::default()
};
let handle = unsafe {
descriptor.device.create_pipeline_layout(&create_info, None)?
};
Ok(Rc::new(Self { handle, descriptor }))
}
}
impl Drop for PipelineLayout {
fn drop(&mut self) {
unsafe {
self.descriptor.device.destroy_pipeline_layout(self.handle, None);
}
}
}
impl std::ops::Deref for PipelineLayout {
type Target = vk::PipelineLayout;
fn deref(&self) -> &Self::Target {
&self.handle
}
}
// EOF