renderer_vulkan: Fix present mailbox shutdown sequence
This commit is contained in:
@@ -142,7 +142,7 @@ RendererVulkan::~RendererVulkan() {
|
||||
vmaDestroyImage(instance.GetAllocator(), info.texture.image, info.texture.allocation);
|
||||
}
|
||||
|
||||
render_window.mailbox.reset();
|
||||
mailbox.reset();
|
||||
}
|
||||
|
||||
void RendererVulkan::Sync() {
|
||||
|
@@ -49,9 +49,6 @@ PresentMailbox::PresentMailbox(const Instance& instance_, Swapchain& swapchain_,
|
||||
}
|
||||
|
||||
PresentMailbox::~PresentMailbox() {
|
||||
free_queue.Clear();
|
||||
present_queue.Clear();
|
||||
|
||||
const vk::Device device = instance.GetDevice();
|
||||
device.destroyCommandPool(command_pool);
|
||||
for (auto& frame : swap_chain) {
|
||||
@@ -180,6 +177,9 @@ void PresentMailbox::PresentThread(std::stop_token token) {
|
||||
Common::SetCurrentThreadName("VulkanPresent");
|
||||
do {
|
||||
Frame* frame = present_queue.PopWait(token);
|
||||
if (token.stop_requested()) {
|
||||
continue;
|
||||
}
|
||||
CopyToSwapchain(frame);
|
||||
free_queue.Push(frame);
|
||||
} while (!token.stop_requested());
|
||||
|
@@ -55,10 +55,10 @@ private:
|
||||
RenderpassCache& renderpass_cache;
|
||||
vk::CommandPool command_pool;
|
||||
vk::Queue graphics_queue;
|
||||
std::jthread present_thread;
|
||||
std::array<Frame, SWAP_CHAIN_SIZE> swap_chain{};
|
||||
Common::SPSCQueue<Frame*> free_queue{};
|
||||
Common::SPSCQueue<Frame*, true> present_queue{};
|
||||
std::jthread present_thread;
|
||||
std::mutex swapchain_mutex;
|
||||
std::condition_variable swapchain_cv;
|
||||
};
|
||||
|
Reference in New Issue
Block a user