Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HTML5] Fix target_fps when window loses focus. #48543

Merged
merged 2 commits into from
May 8, 2021

Conversation

Faless
Copy link
Collaborator

@Faless Faless commented May 7, 2021

We don't get updates when the window is unfocused/minimized, so we must detect the situation where the counted ticks start drifting away resulting in more frames drawn than needed.
This commit adds a check to ensure that the target ticks do not drift away more than one second.

Fixes #48061

(the first commit is the usual RasterizerDummy fix, the second commit should be cherry-pickable).

@Faless Faless added bug platform:web topic:porting cherrypick:3.x Considered for cherry-picking into a future 3.x release cherrypick:3.3 labels May 7, 2021
@Faless Faless added this to the 4.0 milestone May 7, 2021
@Faless Faless requested review from a team as code owners May 7, 2021 17:14
platform/javascript/javascript_main.cpp Outdated Show resolved Hide resolved
We don't get updates when the window is unfocused/minimized, so we must
detect the situation where the counted ticks start drifting away
resulting in more frames drawn than needed.
This commit adds a check to ensure that the target ticks do not drift
away more than one second.
@Faless Faless merged commit 871d067 into godotengine:master May 8, 2021
@akien-mga
Copy link
Member

Cherry-picked for 3.4.

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label May 9, 2021
@akien-mga
Copy link
Member

Cherry-picked for 3.3.1.

@h0lley
Copy link

h0lley commented May 18, 2021

I have encountered an issue in my game where I had to change logic after updating Godot:
before, OS.vsync_enabled was prioritized over Engine.target_fps, that is to say the target FPS was disregarded if vsync was enabled. Now, it is the other way around, so when using vsync, one has to avoid setting target FPS to something other than 0.

Could this be caused by this commit and if so, is this intentional?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vertical synchronization is reactivated when the window regains focus
3 participants