Export triangle to external scene
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 1s

This commit is contained in:
Florian RICHER 2024-11-27 22:16:26 +01:00
parent 4b08b7359d
commit 7b5cae8322
Signed by: florian.richer
GPG key ID: C73D37CBED7BFC77
18 changed files with 121 additions and 65 deletions

View file

@ -8,22 +8,22 @@ pub struct VkSwapchain {
surface: Arc<VkSurface>,
device: Arc<VkDevice>,
pub(super) handle: Option<vk::SwapchainKHR>,
pub handle: Option<vk::SwapchainKHR>,
swapchain_support_details: SwapchainSupportDetails,
pub(super) desired_image_count: u32,
pub(super) surface_format: vk::SurfaceFormatKHR,
pub(super) surface_resolution: vk::Extent2D,
pub(super) new_requested_surface_resolution: Option<vk::Extent2D>,
pub(super) present_mode: vk::PresentModeKHR,
pub(super) pre_transform: vk::SurfaceTransformFlagsKHR,
pub desired_image_count: u32,
pub surface_format: vk::SurfaceFormatKHR,
pub surface_resolution: vk::Extent2D,
pub new_requested_surface_resolution: Option<vk::Extent2D>,
pub present_mode: vk::PresentModeKHR,
pub pre_transform: vk::SurfaceTransformFlagsKHR,
pub(super) present_images: Option<Vec<vk::Image>>,
pub(super) present_image_views: Option<Vec<Arc<vk::ImageView>>>,
pub present_images: Option<Vec<vk::Image>>,
pub present_image_views: Option<Vec<Arc<vk::ImageView>>>,
}
impl VkSwapchain {
pub(super) fn new(
pub fn new(
window: &Window,
surface: &Arc<VkSurface>,
device: &Arc<VkDevice>,
@ -78,7 +78,7 @@ impl VkSwapchain {
Ok(swapchain)
}
pub(super) fn create_swapchain(&mut self) -> VkResult<()> {
pub fn create_swapchain(&mut self) -> VkResult<()> {
if let Some(new_requested_surface_resolution) = self.new_requested_surface_resolution {
self.surface_resolution = new_requested_surface_resolution;
self.new_requested_surface_resolution = None;
@ -125,7 +125,7 @@ impl VkSwapchain {
Ok(())
}
pub(super) fn create_framebuffers(
pub fn create_framebuffers(
&self,
render_pass: &Arc<VkRenderPass>,
) -> Option<Vec<Arc<VkFramebuffer>>> {
@ -148,7 +148,7 @@ impl VkSwapchain {
)
}
pub(super) fn update_resolution(&mut self, width: u32, height: u32) -> VkResult<()> {
pub fn update_resolution(&mut self, width: u32, height: u32) -> VkResult<()> {
log::debug!("New resolution requested ({width}x{height})");
let chosen_extent = Self::choose_swapchain_extent(
@ -171,7 +171,7 @@ impl VkSwapchain {
Ok(())
}
pub(super) fn acquire_next_image(&self, semaphore: &VkSemaphore) -> VkResult<(u32, bool)> {
pub fn acquire_next_image(&self, semaphore: &VkSemaphore) -> VkResult<(u32, bool)> {
unsafe {
self.device.swapchain_loader.acquire_next_image(
self.handle.unwrap(),
@ -182,7 +182,7 @@ impl VkSwapchain {
}
}
pub(super) fn is_dirty(&self) -> bool {
pub fn is_dirty(&self) -> bool {
self.new_requested_surface_resolution.is_some()
}