window resize handled, instance improved a bit

This commit is contained in:
Blue 2023-10-14 19:57:47 -03:00
parent e114c36690
commit 2b33897b4a
Signed by: blue
GPG key ID: 9B203B252A63EE38
16 changed files with 182 additions and 115 deletions

View file

@ -1,6 +1,7 @@
#include "logicaldevice.h"
#include "swapchain.h"
#include <iostream>
constexpr int MAX_FRAMES_IN_FLIGHT = 2;
constexpr float queuePriority = 1.0f;
@ -269,6 +270,10 @@ void Engine::LogicalDevice::drawFrame() {
currentFrame = (currentFrame + 1) % MAX_FRAMES_IN_FLIGHT;
}
void Engine::LogicalDevice::setResized() {
framebufferResized = true;
}
VkExtent2D Engine::LogicalDevice::chooseSwapExtent() const {
return surface->chooseSwapExtent(phys->swapChainSupport.capabilities);
}
@ -564,5 +569,6 @@ void Engine::LogicalDevice::recordCommandBuffer(VkCommandBuffer commandBuffer, u
void Engine::LogicalDevice::recreateSwapChain() {
surface->waitForResize();
waitIdle();
phys->recreateSwapChainSupportDetails(surface);
createSwapChain();
}