From 3b415dbc8931c8d812c5d6ab46061e4557b89935 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Fri, 24 Sep 2021 13:52:35 +0200 Subject: [PATCH] vkd3d: Don't spam error if ReleaseSemaphore fails. This function fails if the counter overflows. CP77 hits this case a lot and we should just warn the specific failure instead of a random error. Signed-off-by: Hans-Kristian Arntzen --- libs/vkd3d/command.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index b26e032b..df30b8e1 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -568,7 +568,12 @@ HRESULT d3d12_fence_signal_event(struct d3d12_fence *fence, HANDLE event, enum v case VKD3D_WAITING_EVENT_TYPE_SEMAPHORE: #ifdef _WIN32 - return ReleaseSemaphore(event, 1, NULL) ? S_OK : E_FAIL; + /* Failing to release semaphore is expected if the counter exceeds the maximum limit. + * If the application does not wait for the semaphore once per present, this + * will eventually happen. */ + if (!ReleaseSemaphore(event, 1, NULL)) + WARN("Failed to release semaphore. Application likely forgot to wait for presentation event.\n"); + return S_OK; #else ERR("Semaphores not supported on this platform.\n"); return E_NOTIMPL;