Fix issue with freeing resources

This commit is contained in:
Georg Hagen
2024-07-11 13:22:01 +02:00
parent 22cb48be89
commit 313b01db1b
16 changed files with 300 additions and 156 deletions

View File

@@ -10,7 +10,6 @@
#include "Base/UI/IVulkanWindow.hpp"
#include "Base/EngineConfiguration.hpp"
#include "Scene/DataFormat.hpp"
#include <algorithm>
namespace OpenVulkano::Vulkan
{
@@ -25,13 +24,17 @@ namespace OpenVulkano::Vulkan
CreateSwapChain({window->GetWidth(), window->GetHeight() });
FrameBuffer::Init(device, vk::Extent3D(size, 1));
Logger::RENDER->trace("Initialized swapchain");
}
void SwapChain::Close()
{
FrameBuffer::Close();
DestroySwapChain();
device = nullptr;
FrameBuffer::Close();
window = nullptr;
Logger::RENDER->trace("Closed swapchain");
}
void SwapChain::Resize(const uint32_t newWidth, const uint32_t newHeight)
@@ -40,6 +43,7 @@ namespace OpenVulkano::Vulkan
CreateSwapChain({ newWidth, newHeight });
FrameBuffer::Resize(vk::Extent3D(size, 1));
Logger::RENDER->trace("Resized swapchain");
}
uint32_t SwapChain::AcquireNextImage(const vk::Fence& fence)
@@ -141,6 +145,7 @@ namespace OpenVulkano::Vulkan
for (auto& semaphore : imageAvailableSemaphores)
device->device.destroySemaphore(semaphore);
imageAvailableSemaphores.clear();
Logger::RENDER->trace("Destroyed swapchain");
}
vk::PresentModeKHR SwapChain::ChosePresentMode()