Always destroy surface

This commit is contained in:
hodasemi 2023-05-11 20:02:47 +02:00
parent 873469378d
commit abc8c6ccfc

View file

@ -8,7 +8,6 @@ const UNORM_FORMATS: [VkFormat; 2] = [VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_B8G8R8
#[derive(Debug)]
pub struct Surface {
external_source: bool,
instance: Arc<Instance>,
surface: VkSurfaceKHR,
}
@ -16,7 +15,6 @@ pub struct Surface {
impl Surface {
pub fn from_vk_surface(surface: VkSurfaceKHR, instance: &Arc<Instance>) -> Arc<Surface> {
Arc::new(Surface {
external_source: true,
instance: instance.clone(),
surface,
})
@ -73,8 +71,6 @@ impl_vk_handle!(Surface, VkSurfaceKHR, surface);
impl Drop for Surface {
fn drop(&mut self) {
if !self.external_source {
self.instance.destroy_surface(self.surface)
}
self.instance.destroy_surface(self.surface)
}
}