From: Elizabeth Figura zfigura@codeweavers.com
The following cause an image to be immediately visible on Windows:
* Direct3D Present()
* wglSwapBuffers() [after drawing to the back buffer]
* glFlush() [after drawing to the front buffer. Note that glFlush() is both necessary and sufficient.]
* vkQueuePresent()
This is all of the paths that ultimately call client_surface_present().
In order to ensure that pixels are immediately visible on Wine as well, we need to flush immediately after presenting.
Based on a patch by Henri Verbeet. --- dlls/winex11.drv/init.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index 1ea51e9a387..f6fe0aed894 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -415,6 +415,7 @@ static void X11DRV_client_surface_present( struct client_surface *client, HDC hd
NtGdiStretchBlt( surface->hdc_dst, 0, 0, rect_dst.right - rect_dst.left, rect_dst.bottom - rect_dst.top, surface->hdc_src, 0, 0, surface->rect.right, surface->rect.bottom, SRCCOPY, 0 ); + XFlush( gdi_display );
done: if (region) NtGdiDeleteObjectApp( region );
I'm attaching the standalone tests I was using to demonstrate this. They clear to blue when pressing down on the mouse, and green when releasing it. With upstream Wine, they are always one frame behind. [This is actually regardless of whether a parent or child window is used; I wanted to test both cases.]
[presenttest.c](/uploads/efd8ffcb2dcdbd30d7f46e9861ad91b8/presenttest.c)
[presenttest-gl.c](/uploads/03983e80b53ddaf2eb52f36a769e58bc/presenttest-gl.c)
[presenttest-vulkan.c](/uploads/38b761d314043dff80714ad995574a3e/presenttest-vulkan.c)