Updated swapchain to recreate swapchain with the proper extent required and re-poll the window features on resize.

Swapchain will no longer trigger a resize (internally) if the previous (non-zero) size is equal to the current size
This commit is contained in:
2025-07-10 21:48:12 +10:00
parent 42e6285977
commit 8ccafddb64
2 changed files with 31 additions and 12 deletions

View File

@@ -22,11 +22,13 @@ namespace basalt
void create_framebuffers(VkRenderPass render_pass);
u32 wait_acquire_reset(bool wait_all=VK_TRUE, u64 timeout=UINT64_MAX, VkFence fence=VK_NULL_HANDLE);
basalt::SwapchainSupportDetails details;
basalt::darray<VkSemaphore> semaphores_image_available;
basalt::darray<VkSemaphore> semaphores_render_finished;
basalt::darray<VkFence> fences_in_flight;
basalt::SwapchainSupportDetails details;
basalt::darray<VkSurfaceFormatKHR> allowed_formats;
basalt::darray<VkPresentModeKHR> allowed_present_modes;
basalt::darray<VkImage> swapchain_images;
basalt::darray<VkImageView> swapchain_image_views;
basalt::darray<VkFramebuffer> framebuffers;
@@ -34,12 +36,13 @@ namespace basalt
basalt::Window* window = nullptr;
VkSwapchainKHR swapchain = VK_NULL_HANDLE;
VkExtent2D swapchain_extent;
VkExtent2D prev_extent;
u32 image_count = -1;
u32 max_frames_in_flight = 2;
u32 current_frame = 0;
bool framebuffers_created = false;
private:
void create (const std::initializer_list<VkSurfaceFormatKHR>& allowed_formats,
const std::initializer_list<VkPresentModeKHR> allowed_present_modes, VkSwapchainKHR prev_swapchain=VK_NULL_HANDLE);
void create (const basalt::darray<VkSurfaceFormatKHR>& allowed_formats,
const basalt::darray<VkPresentModeKHR>& allowed_present_modes, VkSwapchainKHR prev_swapchain=VK_NULL_HANDLE);
};
}