Improving the stability of rendering frame rate #3667
Closed
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.
In the current
rcore.c
, the invocation ofSwapScreenBuffer
in theEndDrawing
function is placed before the frame rate control. This causes the interval between the current frame and the next frame to actually depend on the rendering/update time of the previous frame, rather than the current frame. When the rendering/update time of each frame is inconsistent but still within the frame interval (which is common for triggering events or asset loading in games), FPS stuttering occurs. In this case, the frame rate still maintains the target frame rate, but it gives a sensation of unsmoothness, which becomes particularly noticeable at low frame rates:frame-stutter.mp4
Here is the code snippet used in the mentioned video:
This PR moves the invocation to
SwapScreenBuffer
function after the frame rate control, ensuring that it is called at a consistent frequency to improve frame rate stability.