Skip to content

Improve the frame rate limiting algorithm - #10

Open
HEIHUAa wants to merge 1 commit into
CodenameCrew:cnefrom
HEIHUAa:fps
Open

HEIHUAa wants to merge 1 commit into
CodenameCrew:cnefrom
HEIHUAa:fps

Conversation

@HEIHUAa

@HEIHUAa HEIHUAa commented Sep 15, 2026

Copy link
Copy Markdown

This pull request improves the frame rate limiting algorithm. Previously, the frame rate limit was not very stable; this change makes the limited frame rate more stable. A typical scenario is that previously, limiting to 1000 FPS would actually fluctuate between 800 and 900. With this change, it can be stably limited to 1000. Frame rate limits such as 60, 120, 144, and 160 will also be more stable than before.


The specific reason is that the previously used SDL_DelayPrecise operation had some wake-up latency, causing the actual frame rate to be unstable. The new approach uses busy-waiting for the last 1.5 milliseconds to eliminate that latency.

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.

1 participant