Compare commits

...

2 Commits

Author SHA1 Message Date
PavelBARABANOV 1cd91f3063 header 2026-02-12 21:48:19 +03:00
PavelBARABANOV c4f977dda6 [vk] Restore original fence behavior except Android polling removal 2026-02-12 20:56:37 +03:00
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
@@ -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
}
}