Skip to content

Commit

Permalink
Initialize View Frame Time estimates to match 120 FPS
Browse files Browse the repository at this point in the history
This prevents the estimation from being extremely high (close to 100,000 FPS)
until enough time has passed to display an accurate estimation.
  • Loading branch information
Calinou committed Aug 28, 2023
1 parent 031f6de commit 15b31f0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions editor/plugins/node_3d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2887,8 +2887,9 @@ void Node3DEditorViewport::_notification(int p_what) {
fps_label->set_visible(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++) {
cpu_time_history[i] = 0;
gpu_time_history[i] = 0;
// Initialize to 120 FPS, so that the initial estimation until we get enough data is always reasonable.
cpu_time_history[i] = 8.333333;
gpu_time_history[i] = 8.333333;
}
cpu_time_history_index = 0;
gpu_time_history_index = 0;
Expand Down

0 comments on commit 15b31f0

Please sign in to comment.