Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add frame_interval_secs to WindowOpenOptions #47

Closed
wants to merge 2 commits into from
Closed

Add frame_interval_secs to WindowOpenOptions #47

wants to merge 2 commits into from

Conversation

BillyDM
Copy link
Contributor

@BillyDM BillyDM commented Sep 15, 2020

To achieve lower input latency in iced, I need the frame interval to run at 120fps. Iced sets the wgpu swapchain to Mailbox mode, so rendering still happens at 60fps. However, this causes less misses for the current frame reducing the perceived latency.

@BillyDM
Copy link
Contributor Author

BillyDM commented Sep 15, 2020

I also find that having the default as exactly 60fps feels smoother with less chugging than 15ms. This may be specific to the wgpu swapchain though, so let me know if it should stay 15ms.

@wrl
Copy link
Member

wrl commented Sep 15, 2020

It seems to me like the issue here is that Iced doesn't provide a mechanism for configuring the wgpu swapchain mode, and so in Mailbox mode the draw loop proceeds entirely unsynchronised relative to the vblank.

I'm going to reject this PR because I consider frame timing a window system issue and not one of the application itself. For example, Wayland surfaces receive frame/present requests for drawing their frame, so a Wayland baseview backend wouldn't have a timer at all. Likewise on macOS, we'll be investigating using CVDisplayLink instead of a timer.

X11 is a bit of an outlier in that it doesn't provide a reasonable mechanism for vblank notification for the purposes of timing or triggering frame drawing, and that's largely why we have a very simple timer for the time being. If your wgpu swapchain could be created in the Fifo mode, you would at the very least synchronise your draw loop to vblank (since presenting the drawn buffer blocks until vblank).

Still, this is something I am very interested in solving in the future, but since frame timing is dictated by the window system, you should consider the X11 frame timer a stopgap hack, and for that reason I'm unwilling to expose any part of it in the public API.

@wrl wrl closed this Sep 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants