Hide the first --print-fps
outputs after the engine has started
The first 2 or 3 prints are inaccurate since the engine has just
started at that point.
(cherry picked from commit 2d56dfb746
)
This commit is contained in:
parent
0f3aff2d77
commit
8d813c4511
2 changed files with 12 additions and 5 deletions
|
@ -2163,6 +2163,7 @@ bool Main::start() {
|
||||||
|
|
||||||
uint64_t Main::last_ticks = 0;
|
uint64_t Main::last_ticks = 0;
|
||||||
uint32_t Main::frames = 0;
|
uint32_t Main::frames = 0;
|
||||||
|
uint32_t Main::hide_print_fps_attempts = 3;
|
||||||
uint32_t Main::frame = 0;
|
uint32_t Main::frame = 0;
|
||||||
bool Main::force_redraw_requested = false;
|
bool Main::force_redraw_requested = false;
|
||||||
int Main::iterating = 0;
|
int Main::iterating = 0;
|
||||||
|
@ -2341,12 +2342,17 @@ bool Main::iteration() {
|
||||||
Engine::get_singleton()->_idle_frames++;
|
Engine::get_singleton()->_idle_frames++;
|
||||||
|
|
||||||
if (frame > 1000000) {
|
if (frame > 1000000) {
|
||||||
if (editor || project_manager) {
|
// Wait a few seconds before printing FPS, as FPS reporting just after the engine has started is inaccurate.
|
||||||
if (print_fps) {
|
if (hide_print_fps_attempts == 0) {
|
||||||
print_line(vformat("Editor FPS: %d (%s mspf)", frames, rtos(1000.0 / frames).pad_decimals(2)));
|
if (editor || project_manager) {
|
||||||
|
if (print_fps) {
|
||||||
|
print_line(vformat("Editor FPS: %d (%s mspf)", frames, rtos(1000.0 / frames).pad_decimals(2)));
|
||||||
|
}
|
||||||
|
} else if (print_fps || GLOBAL_GET("debug/settings/stdout/print_fps")) {
|
||||||
|
print_line(vformat("Project FPS: %d (%s mspf)", frames, rtos(1000.0 / frames).pad_decimals(2)));
|
||||||
}
|
}
|
||||||
} else if (GLOBAL_GET("debug/settings/stdout/print_fps") || print_fps) {
|
} else {
|
||||||
print_line(vformat("Project FPS: %d (%s mspf)", frames, rtos(1000.0 / frames).pad_decimals(2)));
|
hide_print_fps_attempts--;
|
||||||
}
|
}
|
||||||
|
|
||||||
Engine::get_singleton()->_fps = frames;
|
Engine::get_singleton()->_fps = frames;
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
class Main {
|
class Main {
|
||||||
static void print_help(const char *p_binary);
|
static void print_help(const char *p_binary);
|
||||||
static uint64_t last_ticks;
|
static uint64_t last_ticks;
|
||||||
|
static uint32_t hide_print_fps_attempts;
|
||||||
static uint32_t frames;
|
static uint32_t frames;
|
||||||
static uint32_t frame;
|
static uint32_t frame;
|
||||||
static bool force_redraw_requested;
|
static bool force_redraw_requested;
|
||||||
|
|
Loading…
Reference in a new issue