mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-08-03 14:50:40 +00:00
vk: Improve flush queue sync between cell threads
This commit is contained in:
parent
786bcb0d1b
commit
ccb23d70a5
2 changed files with 10 additions and 4 deletions
|
@ -664,9 +664,12 @@ bool VKGSRender::on_access_violation(u32 address, bool is_writing)
|
||||||
//Just stall and get what we have at this point
|
//Just stall and get what we have at this point
|
||||||
if (std::this_thread::get_id() != rsx_thread)
|
if (std::this_thread::get_id() != rsx_thread)
|
||||||
{
|
{
|
||||||
//TODO: Guard this when the renderer is flushing the command queue, might deadlock otherwise
|
{
|
||||||
m_flush_commands = true;
|
std::lock_guard<std::mutex> lock(m_flush_queue_mutex);
|
||||||
m_queued_threads++;
|
|
||||||
|
m_flush_commands = true;
|
||||||
|
m_queued_threads++;
|
||||||
|
}
|
||||||
|
|
||||||
//This is awful!
|
//This is awful!
|
||||||
while (m_flush_commands) _mm_pause();
|
while (m_flush_commands) _mm_pause();
|
||||||
|
@ -1200,6 +1203,8 @@ void VKGSRender::do_local_task()
|
||||||
{
|
{
|
||||||
if (m_flush_commands)
|
if (m_flush_commands)
|
||||||
{
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(m_flush_queue_mutex);
|
||||||
|
|
||||||
//TODO: Determine if a hard sync is necessary
|
//TODO: Determine if a hard sync is necessary
|
||||||
//Pipeline barriers later may do a better job synchronizing than wholly stalling the pipeline
|
//Pipeline barriers later may do a better job synchronizing than wholly stalling the pipeline
|
||||||
flush_command_queue();
|
flush_command_queue();
|
||||||
|
|
|
@ -164,8 +164,9 @@ private:
|
||||||
bool m_flush_draw_buffers = false;
|
bool m_flush_draw_buffers = false;
|
||||||
s32 m_last_flushable_cb = -1;
|
s32 m_last_flushable_cb = -1;
|
||||||
|
|
||||||
|
std::mutex m_flush_queue_mutex;
|
||||||
std::atomic<bool> m_flush_commands = false;
|
std::atomic<bool> m_flush_commands = false;
|
||||||
std::atomic<int> m_queued_threads = 0;
|
std::atomic<int> m_queued_threads = { 0 };
|
||||||
|
|
||||||
std::thread::id rsx_thread;
|
std::thread::id rsx_thread;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue