Browse Source

[vk] Restore original fence behavior except Android polling removal

vk-symph
PavelBARABANOV 3 weeks ago
parent
commit
c4f977dda6
  1. 29
      src/video_core/renderer_vulkan/vk_master_semaphore.cpp

29
src/video_core/renderer_vulkan/vk_master_semaphore.cpp

@ -80,9 +80,7 @@ void MasterSemaphore::Wait(u64 tick) {
if (!semaphore) {
// If we don't support timeline semaphores, wait for the value normally
std::unique_lock lk{free_mutex};
free_cv.wait(lk, [&] {
return gpu_tick.load(std::memory_order_acquire) >= tick;
});
free_cv.wait(lk, [&] { return gpu_tick.load(std::memory_order_relaxed) >= tick; });
return;
}
@ -217,33 +215,18 @@ void MasterSemaphore::WaitThread(std::stop_token token) {
std::tie(host_tick, fence) = std::move(wait_queue.front());
wait_queue.pop();
}
#ifdef ANDROID
VkResult status;
do {
status = fence.GetStatus();
if (status == VK_NOT_READY) {
std::this_thread::sleep_for(std::chrono::microseconds(100));
}
} while (status == VK_NOT_READY);
if (status == VK_SUCCESS) {
fence.Reset();
} else {
vk::Check(status);
continue;
}
#else
fence.Wait();
fence.Reset();
#endif
{
std::scoped_lock lock{free_mutex};
free_queue.push_front(std::move(fence));
gpu_tick.store(host_tick, std::memory_order_release);
gpu_tick.store(host_tick);
}
#ifdef ANDROID
free_cv.notify_all();
#else
free_cv.notify_one();
#endif
}
}

Loading…
Cancel
Save