mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-11 06:40:39 +00:00
vk: Optimization - avoid touching the mutex at all if possible even when there is no contention
This commit is contained in:
parent
c9e8b87c60
commit
589ac1c5d4
@ -118,10 +118,9 @@ namespace vk
|
|||||||
|
|
||||||
event* AsyncTaskScheduler::get_primary_sync_label()
|
event* AsyncTaskScheduler::get_primary_sync_label()
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_submit_mutex);
|
if (m_sync_required) [[unlikely]]
|
||||||
|
|
||||||
if (m_sync_required)
|
|
||||||
{
|
{
|
||||||
|
std::lock_guard lock(m_submit_mutex); // For some reason this is inexplicably expensive. WTF!
|
||||||
ensure(m_current_cb);
|
ensure(m_current_cb);
|
||||||
insert_sync_event();
|
insert_sync_event();
|
||||||
m_sync_required = false;
|
m_sync_required = false;
|
||||||
@ -132,13 +131,12 @@ namespace vk
|
|||||||
|
|
||||||
void AsyncTaskScheduler::flush(VkSemaphore wait_semaphore, VkPipelineStageFlags wait_dst_stage_mask)
|
void AsyncTaskScheduler::flush(VkSemaphore wait_semaphore, VkPipelineStageFlags wait_dst_stage_mask)
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_submit_mutex);
|
|
||||||
|
|
||||||
if (!m_current_cb)
|
if (!m_current_cb)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::lock_guard lock(m_submit_mutex);
|
||||||
if (m_sync_required)
|
if (m_sync_required)
|
||||||
{
|
{
|
||||||
insert_sync_event();
|
insert_sync_event();
|
||||||
|
@ -29,7 +29,7 @@ namespace vk
|
|||||||
|
|
||||||
// Sync
|
// Sync
|
||||||
event* m_sync_label = nullptr;
|
event* m_sync_label = nullptr;
|
||||||
bool m_sync_required = false;
|
atomic_t<bool> m_sync_required = false;
|
||||||
|
|
||||||
static constexpr u32 events_pool_size = 16384;
|
static constexpr u32 events_pool_size = 16384;
|
||||||
std::vector<xqueue_event> m_events_pool;
|
std::vector<xqueue_event> m_events_pool;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user