Update [broken]
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 0s

This commit is contained in:
Florian RICHER 2024-11-20 17:45:26 +01:00
parent 8f1172e888
commit 1dc9da0d61
8 changed files with 222 additions and 31 deletions

View file

@ -1,4 +1,7 @@
use crate::display::Window;
use crate::vulkan::vk_framebuffer::VkSwapchainFramebuffer;
use crate::vulkan::vk_render_pass::VkRenderPass;
use crate::vulkan::vk_semaphore::VkSemaphore;
use crate::vulkan::vk_surface::SwapchainSupportDetails;
use crate::vulkan::{VkDevice, VkPhysicalDevice, VkSurface};
use ash::prelude::VkResult;
@ -8,6 +11,7 @@ use std::sync::Arc;
pub struct VkSwapchain {
surface: Arc<VkSurface>,
device: Arc<VkDevice>,
swapchain: Option<vk::SwapchainKHR>,
swapchain_support_details: SwapchainSupportDetails,
@ -59,6 +63,7 @@ impl VkSwapchain {
let mut swapchain = Self {
surface,
device,
swapchain: None,
swapchain_support_details,
desired_image_count,
@ -116,6 +121,16 @@ impl VkSwapchain {
Ok(())
}
pub(super) fn create_framebuffers(&self, render_pass: Arc<VkRenderPass>) -> Option<Vec<VkSwapchainFramebuffer>> {
let present_image_views = self.present_image_views.as_ref()?;
present_image_views.iter().enumerate()
.map(|present_image_view| {
VkSwapchainFramebuffer::new()
})
.collect::<Vec<_>>()
}
pub(super) fn update_resolution(&mut self, width: u32, height: u32) -> VkResult<()> {
log::debug!("New resolution requested ({width}x{height})");
@ -141,6 +156,17 @@ impl VkSwapchain {
Ok(())
}
pub(super) fn acquire_next_image(&self, semaphore: &VkSemaphore) -> VkResult<(u32, bool)> {
unsafe {
self.device.swapchain_loader.acquire_next_image(
self.swapchain.unwrap(),
u64::MAX,
semaphore.handle,
vk::Fence::null(),
)
}
}
fn create_swapchain_info(&self, surface: &VkSurface) -> vk::SwapchainCreateInfoKHR {
vk::SwapchainCreateInfoKHR::default()
.surface(surface.surface)