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