Explorar o código

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.

(cherry picked from commit 15b31f0891fde06da4fa617276705b1d6404b2dd)
Hugo Locurcio %!s(int64=2) %!d(string=hai) anos
pai
achega
8d6493fae4
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      editor/plugins/node_3d_editor_plugin.cpp

+ 3 - 2
editor/plugins/node_3d_editor_plugin.cpp

@@ -2832,8 +2832,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;