Skip to content

Commit

Permalink
Display real FPS in the 3D editor instead of estimating based on CPU/…
Browse files Browse the repository at this point in the history
…GPU time

This reverts to the 3.x method for displaying FPS in the View Frame Time panel.
This has two consequences:

- The reported FPS will no longer go past V-Sync or framerate limiters.
- Unfocusing the window will display a low framerate (10 FPS by default),
  since the FPS is actually being limited by the engine's low-processor mode.

Constant redrawing is still forced while the panel is visible, so there's
no risk of having low-processor mode interfere.
  • Loading branch information
Calinou committed Aug 1, 2023
1 parent dcd187d commit 43065f1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions editor/plugins/node_3d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2892,8 +2892,8 @@ void Node3DEditorViewport::_notification(int p_what) {
frame_time_gradient->get_color_at_offset(
Math::remap(gpu_time, 0, 30, 0, 1)));

const double fps = 1000.0 / gpu_time;
fps_label->set_text(vformat(TTR("FPS: %d"), fps));
const double fps = Engine::get_singleton()->get_frames_per_second();
fps_label->set_text(vformat(TTR("Editor FPS: %d"), fps));
// Middle point is at 60 FPS.
fps_label->add_theme_color_override(
"font_color",
Expand Down

0 comments on commit 43065f1

Please sign in to comment.