[vk] Restore original fence behavior except Android polling removal

This commit is contained in:
PavelBARABANOV 2026-02-12 20:56:37 +03:00
parent c263b6af6f
commit c4f977dda6
1 changed files with 6 additions and 23 deletions

View File

@ -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
}
}