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.
 
 
 

36 lines
640 B

use crate::render::Instance;
use ash::vk;
use std::rc::Rc;
pub struct Surface {
handle: vk::SurfaceKHR,
pub instance: Rc<Instance>,
}
impl Surface {
pub fn create(
instance: Rc<Instance>,
window: &crate::hal::Window,
) -> Result<Rc<Self>, crate::hal::ErrSdl> {
let handle = window.vulkan_create_surface(&instance)?;
Ok(Rc::new(Self { handle, instance }))
}
}
impl Drop for Surface {
fn drop(&mut self) {
unsafe {
self.instance.surface_ext.destroy_surface(self.handle, None);
}
}
}
impl std::ops::Deref for Surface {
type Target = vk::SurfaceKHR;
fn deref(&self) -> &Self::Target {
&self.handle
}
}
// EOF