mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 11:32:13 +00:00
Merge pull request #99149 from mrsaturnsan/set_max_fps_fix
Fix max FPS initialization
This commit is contained in:
commit
15d09a5767
@ -3032,13 +3032,10 @@ Error RenderingDeviceDriverVulkan::swap_chain_resize(CommandQueueID p_cmd_queue,
|
||||
|
||||
#if defined(SWAPPY_FRAME_PACING_ENABLED)
|
||||
if (swappy_frame_pacer_enable) {
|
||||
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;
|
||||
|
||||
SwappyVk_initAndGetRefreshCycleDuration(get_jni_env(), static_cast<OS_Android *>(OS::get_singleton())->get_godot_java()->get_activity(), physical_device,
|
||||
vk_device, swap_chain->vk_swapchain, &swap_chain->refresh_duration);
|
||||
SwappyVk_setWindow(vk_device, swap_chain->vk_swapchain, static_cast<OS_Android *>(OS::get_singleton())->get_native_window());
|
||||
SwappyVk_setSwapIntervalNS(vk_device, swap_chain->vk_swapchain, MAX(swap_chain->refresh_duration, max_time));
|
||||
SwappyVk_setSwapIntervalNS(vk_device, swap_chain->vk_swapchain, swap_chain->refresh_duration);
|
||||
|
||||
enum SwappyModes {
|
||||
PIPELINE_FORCED_ON,
|
||||
|
@ -2554,7 +2554,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
||||
Engine::get_singleton()->set_physics_ticks_per_second(GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "physics/common/physics_ticks_per_second", PROPERTY_HINT_RANGE, "1,1000,1"), 60));
|
||||
Engine::get_singleton()->set_max_physics_steps_per_frame(GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "physics/common/max_physics_steps_per_frame", PROPERTY_HINT_RANGE, "1,100,1"), 8));
|
||||
Engine::get_singleton()->set_physics_jitter_fix(GLOBAL_DEF("physics/common/physics_jitter_fix", 0.5));
|
||||
Engine::get_singleton()->set_max_fps(GLOBAL_DEF(PropertyInfo(Variant::INT, "application/run/max_fps", PROPERTY_HINT_RANGE, "0,1000,1"), 0));
|
||||
|
||||
GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "audio/driver/output_latency", PROPERTY_HINT_RANGE, "1,100,1"), 15);
|
||||
// Use a safer default output_latency for web to avoid audio cracking on low-end devices, especially mobile.
|
||||
@ -2575,10 +2574,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
||||
OS::get_singleton()->set_environment("MVK_CONFIG_LOG_LEVEL", OS::get_singleton()->_verbose_stdout ? "3" : "1"); // 1 = Errors only, 3 = Info
|
||||
#endif
|
||||
|
||||
if (max_fps >= 0) {
|
||||
Engine::get_singleton()->set_max_fps(max_fps);
|
||||
}
|
||||
|
||||
if (frame_delay == 0) {
|
||||
frame_delay = GLOBAL_DEF(PropertyInfo(Variant::INT, "application/run/frame_delay_msec", PROPERTY_HINT_RANGE, "0,100,1,or_greater"), 0);
|
||||
if (Engine::get_singleton()->is_editor_hint()) {
|
||||
@ -3024,6 +3019,13 @@ Error Main::setup2(bool p_show_boot_logo) {
|
||||
OS::get_singleton()->benchmark_end_measure("Servers", "Display");
|
||||
}
|
||||
|
||||
// Max FPS needs to be set after the DisplayServer is created.
|
||||
Engine::get_singleton()->set_max_fps(GLOBAL_DEF(PropertyInfo(Variant::INT, "application/run/max_fps", PROPERTY_HINT_RANGE, "0,1000,1"), 0));
|
||||
|
||||
if (max_fps >= 0) {
|
||||
Engine::get_singleton()->set_max_fps(max_fps);
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
// If the editor is running in windowed mode, ensure the window rect fits
|
||||
// the screen in case screen count or position has changed.
|
||||
|
Loading…
Reference in New Issue
Block a user