The last commit fixes glitches in Horizon Zero Dawn with vsync on, for reasons stated in the comment there.
The wined3d implementation already blocks the client's call to `Present()` when `vkAcquireNextImageKHR()` blocks, so is roughly equivalent to this when frame latency and buffer count are equal. It has a frame latency implementation which unblocks after calling `vkQueuePresentKHR()`, rather than waiting for its execution to complete. I think the d3d12 implementation is supposed to do the latter, though using `KHR_present_wait` may be unnecessary overkill. Waiting on queue execution comes with a performance cost either way, so without a compelling reason for a strict implementation, something similar to wined3d makes sense.
Another potential issue is after the call to `ID3D12CommandQueue_Signal()` in `d3d12_swapchain_present()`, the client is free to enqueue more commands when `Present()` returns, so by the time the signal is executed and the swapchain worker blits the image and calls `vkQueuePresentKHR()`, these commands are not necessarily enqueued immediately after the `Signal()`. This may not always be harmless.
--
v2: dxgi: Wait for completion of a pending read of the next buffer before returning from d3d12_swapchain_Present().
dxgi: Wake the condition variable after leaving the critical section in d3d12_swapchain_resize_buffers().
dxgi: Wake the condition variable after leaving the critical section in d3d12_swapchain_present().
https://gitlab.winehq.org/wine/wine/-/merge_requests/5830
Huh. Okay.
I've seen some of those discussions, and something in them did indeed feel strange. (I never understood the context well enough to determine exactly what, and it's not my place to question that, anyways.)
I'll miss you 💔
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5886#note_73870