Skip to content

Conversation

@msiglreith
Copy link
Member

Addresses #2005

Temporarily increase the timer resolution for the wait operation. By default it's around 16ms which is too long for most realtime applications and leads to unpredictable results. A future enhancement in this direction could be allow the user to control it. Possible use case would be UI application with some animations running with minimal energy impact.

Reported by https://twitter.com/olson_dan/status/1428840173354160128?s=20
With the given change for the wgpu water example the framerate is much closer to the target of 16.6ms on my system.

Before

Avg frame time 28.707153ms
Avg frame time 28.356724ms
Avg frame time 28.303003ms
Avg frame time 28.835732ms
Avg frame time 29.122643ms
Avg frame time 27.729534ms

After

Avg frame time 16.845396ms
Avg frame time 16.859407ms
Avg frame time 16.840519ms
Avg frame time 16.862593ms
Avg frame time 16.856462ms
Avg frame time 16.870092ms
Avg frame time 16.868887ms
  • Tested on all platforms changed
  • Compilation warnings were addressed
  • cargo fmt has been run on this branch
  • cargo doc builds successfully
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality
  • Updated feature matrix, if new features were added or implemented

@msiglreith msiglreith added DS - win32 Affects the Win32/Windows backend C - waiting on maintainer A maintainer must review this code labels Aug 22, 2021
@msiglreith msiglreith requested a review from maroider August 22, 2021 11:20
Copy link
Member

@maroider maroider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having this be user-configurable in some way sounds like a good idea, given the potential battery-savings, but that can be added later.

PS: Your branch name is misspelled (resolition != resolution).

@msiglreith msiglreith force-pushed the waituntil-resolition branch from 8e743af to cdb0b30 Compare October 25, 2021 16:15
@filnet filnet mentioned this pull request Nov 1, 2021
9 tasks
@maroider maroider linked an issue Nov 2, 2021 that may be closed by this pull request
Copy link
Member

@maroider maroider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a once-over and marked everything that looked to be resolved as "resolved".
I only have a couple of nitpicks.

@msiglreith
Copy link
Member Author

Thanks for reviewing again, addressed the remaining parts

@msiglreith msiglreith merged commit cfbe846 into rust-windowing:master Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C - waiting on maintainer A maintainer must review this code DS - win32 Affects the Win32/Windows backend

Development

Successfully merging this pull request may close these issues.

[Windows] WaitUntil timer inaccurate

3 participants