-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Fix max FPS initialization #99149
Fix max FPS initialization #99149
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I think this is a safe change because max_fps is only ever read in two places:
- The main loop (which doesn't start until well after this)
- The initialization of the Vulkan RDD
With this change we don't need to grab the max_fps
from engine when initializing Vulkan because we can trust that it will be updated later.
Accordingly, we could remove the calculation of max_fps
and max_time
here:
godot/drivers/vulkan/rendering_device_driver_vulkan.cpp
Lines 3035 to 3036 in cb411fa
const double max_fps = Engine::get_singleton()->get_max_fps(); | |
const uint64_t max_time = max_fps > 0 ? uint64_t((1000.0 * 1000.0 * 1000.0) / max_fps) : 0; |
And just set the swap interval to swap_chain->refresh_duration
Added the requested change :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me! The commits just need to be squashed
Remove unnecessary get_max_fps
c96ea43
to
4b94162
Compare
Squashed! :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Thanks! Congratulations on your first contribution! 🎉 |
Max FPS needs to be initially set after the DisplayServer is created. Otherwise the Renderer will not get the max FPS value propagated to it.