Conversation
…mits The limiter waited in Present while GTA measures its frame delta in CTimer::Update, so everything between the two leaked into the delta and the game clock, which only adds whole milliseconds per frame, became an uneven mix of ticks. The wait now runs right before GTA samples its clock, where 1.6 waited. Present only paces frames the game timer never saw. The waitable timer is high resolution where available and the spin margin may grow to 2 ms when the timer keeps waking up late.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The frame limiter waited in
Present, but GTA measures its frame delta inCTimer::Update. Everything between the two (message pump, input, pre frame pulse) takes a different amount of time every frame, and all of it leaked into the delta GTA saw.CTimer::UpdateVariablesaddsfloor(delta_ms)to the game clock, so at 240 FPS the 4.17 ms frames turned into a random mix of 4 and 5 ms ticks. That is the aim jitter, and it is why 144 with VSync looked fine while 240 did not.The wait now runs in
CCore::OnGameTimerUpdate, right before the clock is sampled, which is exactly where 1.6 waited.Presentonly paces frames the game timer never ticked for (minimized, loading). The waitable timer is created high resolution where Windows supports it, and the spin margin may grow to 2 ms when the timer keeps waking up late instead of being capped below what it actually needs.Unlimited FPS has no pacing at all, so any jitter there is the game running above 300 FPS and is outside the limiter.
Fixes #5335
Test plan
Cap at 240 on a machine that reaches it, aim with a weapon and strafe. Repeat at 120 and 144. Frame times in the frame graph stay flat and the camera stays smooth. Minimize and restore, alt-tab, join and disconnect, the limiter keeps working through all of it.
Checklist