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.
 
 
 

39 lines
897 B

use crate::render::{Device, Uniforms};
use ash::{version::DeviceV1_0, vk};
use std::rc::Rc;
pub struct DescriptorSetLayout {
handle: vk::DescriptorSetLayout,
pub device: Rc<Device>,
}
impl DescriptorSetLayout {
pub fn create(device: Rc<Device>) -> Result<Rc<Self>, vk::Result> {
let create_info = vk::DescriptorSetLayoutCreateInfo {
binding_count: Uniforms::BIND_DESC.len() as u32,
p_bindings: Uniforms::BIND_DESC.as_ptr(),
..Default::default()
};
let handle =
unsafe { device.create_descriptor_set_layout(&create_info, None)? };
Ok(Rc::new(Self { handle, device }))
}
}
impl Drop for DescriptorSetLayout {
fn drop(&mut self) {
unsafe {
self.device.destroy_descriptor_set_layout(self.handle, None);
}
}
}
impl std::ops::Deref for DescriptorSetLayout {
type Target = vk::DescriptorSetLayout;
fn deref(&self) -> &Self::Target {
&self.handle
}
}
// EOF