Repository navigation
Conversation
The frameRate cap compared each vsync against the last drawn frame with a 4 ms tolerance, so a cap that does not divide the refresh rate came out low (60 fps on a 90 Hz display rendered at 45), and every skipped vsync still cost a frame callback. Use a copy of rive-android's internal RiveFramePacer, which tracks the next due frame time, and post the next frame callback delayed until close to that time, as the Rive composable does.
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.
Stacked on #416.
The
frameRatecap compared each vsync against the last drawn frame with a 4 ms tolerance, so a cap that doesn't divide the refresh rate came out low (60 fps on a 90 Hz display rendered at 45), and every skipped vsync still cost a frame callback. This replaces it with a copy of rive-android's internalRiveFramePacer, which tracks the next due frame time, and posts the next frame callback delayed until shortly before it, as theRivecomposable does.On a 60 Hz emulator (release build, per 10 s): a 45 fps cap went from 293 to 449 draws, and a 15 fps cap from 600 to 294 frame callbacks. 30 fps on 60 Hz still wakes on every vsync, the same as upstream, because the pacer's early-wake margin lands on the vsync before the target. The Frame Rate Cap example page gets a 45 fps option to show the non-divisor case.