Initialize View Frame Time estimates to match 120 FPS

This prevents the estimation from being extremely high (close to 100,000 FPS)
until enough time has passed to display an accurate estimation.
This commit is contained in:
Hugo Locurcio 2023-08-01 17:43:32 +02:00
parent 031f6deefb
commit 15b31f0891
No known key found for this signature in database
GPG Key ID: 39E8F8BE30B0A49C
1 changed files with 3 additions and 2 deletions

View File

@ -2887,8 +2887,9 @@ void Node3DEditorViewport::_notification(int p_what) {
fps_label->set_visible(show_fps); fps_label->set_visible(show_fps);
RS::get_singleton()->viewport_set_measure_render_time(viewport->get_viewport_rid(), show_fps); RS::get_singleton()->viewport_set_measure_render_time(viewport->get_viewport_rid(), show_fps);
for (int i = 0; i < FRAME_TIME_HISTORY; i++) { for (int i = 0; i < FRAME_TIME_HISTORY; i++) {
cpu_time_history[i] = 0; // Initialize to 120 FPS, so that the initial estimation until we get enough data is always reasonable.
gpu_time_history[i] = 0; cpu_time_history[i] = 8.333333;
gpu_time_history[i] = 8.333333;
} }
cpu_time_history_index = 0; cpu_time_history_index = 0;
gpu_time_history_index = 0; gpu_time_history_index = 0;