mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-08-08 09:09:46 +00:00
vk: Avoid use-after-free fence object
This commit is contained in:
parent
e9c3ab7ae6
commit
1c5667f0ce
1 changed files with 12 additions and 5 deletions
|
@ -94,14 +94,16 @@ struct command_buffer_chunk: public vk::command_buffer
|
||||||
|
|
||||||
bool poke()
|
bool poke()
|
||||||
{
|
{
|
||||||
|
reader_lock lock(guard_mutex);
|
||||||
|
|
||||||
if (vkGetFenceStatus(m_device, submit_fence) == VK_SUCCESS)
|
if (vkGetFenceStatus(m_device, submit_fence) == VK_SUCCESS)
|
||||||
{
|
{
|
||||||
std::lock_guard<shared_mutex> lock(guard_mutex);
|
lock.upgrade();
|
||||||
|
|
||||||
if (pending)
|
if (pending)
|
||||||
{
|
{
|
||||||
vk::reset_fence(&submit_fence);
|
|
||||||
pending = false;
|
pending = false;
|
||||||
|
vk::reset_fence(&submit_fence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +112,7 @@ struct command_buffer_chunk: public vk::command_buffer
|
||||||
|
|
||||||
void wait()
|
void wait()
|
||||||
{
|
{
|
||||||
std::lock_guard<shared_mutex> lock(guard_mutex);
|
reader_lock lock(guard_mutex);
|
||||||
|
|
||||||
if (!pending)
|
if (!pending)
|
||||||
return;
|
return;
|
||||||
|
@ -124,8 +126,13 @@ struct command_buffer_chunk: public vk::command_buffer
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
vk::reset_fence(&submit_fence);
|
lock.upgrade();
|
||||||
pending = false;
|
|
||||||
|
if (pending)
|
||||||
|
{
|
||||||
|
vk::reset_fence(&submit_fence);
|
||||||
|
pending = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue