Skip to content

Increased input-to-screen latency on vulkan #6932

@adrian17

Description

@adrian17

Description
Some users (of Ruffle) reported noticeable lag between input and game response, we were very surprised to realize that it doesn't seem to be related to event handling and that it only happens on Vulkan wgpu backend.

Repro steps
In general: write any code that's based on user input, observe the latency between user input and visible response.

Specific repro:
https://github.com/adrian17/wgpu-latency-repro
(This is based on tutorial code https://github.com/sotrh/learn-wgpu/tree/master/code/beginner/tutorial4-buffer , I just updated wgpu and added code to make the triangle follow the mouse)

Just run the code with cargo run --release, move the mouse and observe the triangle following the mouse. Test with different wgpu::Backends values.

Expected vs observed behavior
On DX12 and GL, the triangle seems to follow the cursor very closely, seems to be a frame behind the OS cursor, the latency isn't really noticeable unless I pause the recording. (GL seems to occasionally lag behind slightly more, but that might be my observation error)
On Vulkan, the triangle very noticeably lags behind the cursor.

Extra materials
Vulkan demo:

repro_vulkan.mp4

DX12 demo:

repro_dx12.mp4

Platform
Windows 10, tested on wgpu 0.23, 0.24.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: wsiIssues with swapchain management or windowingbackend: vulkanIssues with Vulkanhelp requiredWe need community help to make this happen.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions