Make swapchain from_ci not raw

This commit is contained in:
hodasemi 2023-11-29 12:20:28 +01:00
parent 382d8e1179
commit 8e5e6a8c3c

View file

@ -133,11 +133,24 @@ impl Swapchain {
device: Arc<Device>, device: Arc<Device>,
swapchain_ci: &VkSwapchainCreateInfoKHR, swapchain_ci: &VkSwapchainCreateInfoKHR,
) -> Result<Arc<Self>> { ) -> Result<Arc<Self>> {
Ok(Self::from_raw( Ok(Arc::new(Swapchain {
device.clone(), width: AtomicU32::new(swapchain_ci.imageExtent.width),
swapchain_ci, height: AtomicU32::new(swapchain_ci.imageExtent.height),
device.create_swapchain(swapchain_ci)?, usage: swapchain_ci.imageUsage,
)) index: AtomicU32::new(0),
surface: Surface::from_vk_surface(
swapchain_ci.surface,
device.physical_device().instance(),
),
create_info: Mutex::new(swapchain_ci.clone()),
swapchain: Mutex::new(device.create_swapchain(swapchain_ci)?),
device,
raw: false,
}))
} }
pub fn from_raw( pub fn from_raw(