Introduced temporary solution to window minimization.

This commit is contained in:
connellpaxton 2024-01-23 16:08:29 -05:00
parent 0bd5a1780a
commit e1c7f2d80a

View File

@ -6,6 +6,10 @@
#include <util/log.hpp> #include <util/log.hpp>
/* TODO: Make solution that doesn't involve using GLFW directly here for minimization */
#include <GLFW/glfw3.h>
Swapchain::Swapchain(Window& win, vk::Device dev, vk::PhysicalDevice phys_dev, const vk::SurfaceKHR& surface, RenderPass render_pass) Swapchain::Swapchain(Window& win, vk::Device dev, vk::PhysicalDevice phys_dev, const vk::SurfaceKHR& surface, RenderPass render_pass)
: win(win), dev(dev), phys_dev(phys_dev), surface(surface), render_pass(render_pass) { : win(win), dev(dev), phys_dev(phys_dev), surface(surface), render_pass(render_pass) {
create(); create();
@ -130,6 +134,12 @@ void Swapchain::create(vk::SwapchainKHR old_swapchain) {
void Swapchain::recreate() { void Swapchain::recreate() {
vk::Extent2D ext;
do {
ext = win.getDimensions();
glfwWaitEvents();
} while (!ext.width || !ext.height);
dev.waitIdle(); dev.waitIdle();
cleanup(); cleanup();
auto save = swapchain; auto save = swapchain;