mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 21:32:50 +00:00
vk: Properly clean up async scheduler
This commit is contained in:
parent
41f5158247
commit
c9e8b87c60
@ -67,18 +67,11 @@ namespace vk
|
|||||||
|
|
||||||
AsyncTaskScheduler::~AsyncTaskScheduler()
|
AsyncTaskScheduler::~AsyncTaskScheduler()
|
||||||
{
|
{
|
||||||
*g_fxo->get<async_scheduler_thread>() = thread_state::aborting;
|
if (!m_async_command_queue.empty())
|
||||||
while (has_refs()) _mm_pause();
|
|
||||||
|
|
||||||
for (auto& cb : m_async_command_queue)
|
|
||||||
{
|
{
|
||||||
cb.destroy();
|
// Driver resources should be destroyed before driver is detached or you get crashes. RAII won't save you here.
|
||||||
|
rsx_log.error("Async task scheduler resources were not freed correctly!");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_async_command_queue.clear();
|
|
||||||
m_next_cb_index = 0;
|
|
||||||
m_command_pool.destroy();
|
|
||||||
m_events_pool.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
command_buffer* AsyncTaskScheduler::get_current()
|
command_buffer* AsyncTaskScheduler::get_current()
|
||||||
@ -158,4 +151,20 @@ namespace vk
|
|||||||
m_current_cb = nullptr;
|
m_current_cb = nullptr;
|
||||||
m_sync_required = false;
|
m_sync_required = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AsyncTaskScheduler::kill()
|
||||||
|
{
|
||||||
|
*g_fxo->get<async_scheduler_thread>() = thread_state::aborting;
|
||||||
|
while (has_refs()) _mm_pause();
|
||||||
|
|
||||||
|
for (auto& cb : m_async_command_queue)
|
||||||
|
{
|
||||||
|
cb.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_async_command_queue.clear();
|
||||||
|
m_next_cb_index = 0;
|
||||||
|
m_command_pool.destroy();
|
||||||
|
m_events_pool.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@ namespace vk
|
|||||||
event* get_primary_sync_label();
|
event* get_primary_sync_label();
|
||||||
|
|
||||||
void flush(VkSemaphore wait_semaphore = VK_NULL_HANDLE, VkPipelineStageFlags wait_dst_stage_mask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
|
void flush(VkSemaphore wait_semaphore = VK_NULL_HANDLE, VkPipelineStageFlags wait_dst_stage_mask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
|
||||||
|
void kill();
|
||||||
|
|
||||||
// Thread entry-point
|
// Thread entry-point
|
||||||
void operator()();
|
void operator()();
|
||||||
|
@ -558,6 +558,9 @@ VKGSRender::~VKGSRender()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Globals. TODO: Refactor lifetime management
|
||||||
|
g_fxo->get<vk::async_scheduler_thread>()->kill();
|
||||||
|
|
||||||
//Wait for device to finish up with resources
|
//Wait for device to finish up with resources
|
||||||
vkDeviceWaitIdle(*m_device);
|
vkDeviceWaitIdle(*m_device);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user