From: Conor McCarthy <cmccarthy(a)codeweavers.com> It is generally good practice to flush all work, and this avoids the need to be certain that only one op can be queued per wake. --- dlls/dxgi/swapchain.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c index d68788b8fc5..ca7e89e1e56 100644 --- a/dlls/dxgi/swapchain.c +++ b/dlls/dxgi/swapchain.c @@ -1258,7 +1258,13 @@ static DWORD WINAPI d3d12_swapchain_worker_proc(void *data) while (swapchain->worker_running) { - if (!list_empty(&swapchain->worker_ops)) + if (!SleepConditionVariableCS(&swapchain->worker_cv, &swapchain->worker_cs, INFINITE)) + { + ERR("Cannot sleep on condition variable, last error %ld.\n", GetLastError()); + break; + } + + while (swapchain->worker_running && !list_empty(&swapchain->worker_ops)) { struct d3d12_swapchain_op *op = LIST_ENTRY(list_head(&swapchain->worker_ops), struct d3d12_swapchain_op, entry); @@ -1281,11 +1287,6 @@ static DWORD WINAPI d3d12_swapchain_worker_proc(void *data) EnterCriticalSection(&swapchain->worker_cs); } - else if (!SleepConditionVariableCS(&swapchain->worker_cv, &swapchain->worker_cs, INFINITE)) - { - ERR("Cannot sleep on condition variable, last error %ld.\n", GetLastError()); - break; - } } LeaveCriticalSection(&swapchain->worker_cs); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/5830