vk_master_semaphore: Use fetch_add to increase master semaphore tick

This commit is contained in:
ReinUsesLisp 2021-05-07 00:29:08 -03:00 committed by ameerj
parent b10cf64c48
commit a515036604
2 changed files with 4 additions and 6 deletions

View file

@ -39,9 +39,9 @@ public:
return KnownGpuTick() >= tick;
}
/// Advance to the logical tick.
void NextTick() noexcept {
++current_tick;
/// Advance to the logical tick and return the old one
[[nodiscard]] u64 NextTick() noexcept {
return current_tick.fetch_add(1, std::memory_order::relaxed);
}
/// Refresh the known GPU tick

View file

@ -168,9 +168,7 @@ void VKScheduler::SubmitExecution(VkSemaphore semaphore) {
EndPendingOperations();
InvalidateState();
const u64 signal_value = master_semaphore->CurrentTick();
master_semaphore->NextTick();
const u64 signal_value = master_semaphore->NextTick();
Record([semaphore, signal_value, this](vk::CommandBuffer cmdbuf) {
cmdbuf.End();