From 467a1cd4a583edd55db310c82e2823692616e108 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 1 Jul 2022 17:06:56 +0200 Subject: [PATCH] Misc: io.Framerate moving average now converge in 60 frames instead of 120. (#5236, #4138) --- docs/CHANGELOG.txt | 1 + imgui.h | 2 +- imgui_internal.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index ce4666201..ad3b5abdc 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -41,6 +41,7 @@ Other Changes: - InputText: added experimental io.ConfigInputTextEnterKeepActive feature to make pressing Enter keep the input active and select all text. +- Misc: io.Framerate moving average now converge in 60 frames instead of 120. (#5236, #4138) - Backends: Metal: Use __bridge for ARC based systems. (#5403) [@stack] - Backends: OSX: Fixes to support full app creation in C++. (#5403) [@stack] diff --git a/imgui.h b/imgui.h index 8128cb137..bec45f50d 100644 --- a/imgui.h +++ b/imgui.h @@ -1999,7 +1999,7 @@ struct ImGuiIO bool WantSaveIniSettings; // When manual .ini load/save is active (io.IniFilename == NULL), this will be set to notify your application that you can call SaveIniSettingsToMemory() and save yourself. Important: clear io.WantSaveIniSettings yourself after saving! bool NavActive; // Keyboard/Gamepad navigation is currently allowed (will handle ImGuiKey_NavXXX events) = a window is focused and it doesn't use the ImGuiWindowFlags_NoNavInputs flag. bool NavVisible; // Keyboard/Gamepad navigation is visible and allowed (will handle ImGuiKey_NavXXX events). - float Framerate; // Rough estimate of application framerate, in frame per second. Solely for convenience. Rolling average estimation based on io.DeltaTime over 120 frames. + float Framerate; // Estimate of application framerate (rolling average over 60 frames, based on io.DeltaTime), in frame per second. Solely for convenience. Slow applications may not want to use a moving average or may want to reset underlying buffers occasionally. int MetricsRenderVertices; // Vertices output during last call to Render() int MetricsRenderIndices; // Indices output during last call to Render() = number of triangles * 3 int MetricsRenderWindows; // Number of visible windows diff --git a/imgui_internal.h b/imgui_internal.h index d9ddd2ad6..c9be27716 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1828,7 +1828,7 @@ struct ImGuiContext ImGuiStackTool DebugStackTool; // Misc - float FramerateSecPerFrame[120]; // Calculate estimate of framerate for user over the last 2 seconds. + float FramerateSecPerFrame[60]; // Calculate estimate of framerate for user over the last 60 frames.. int FramerateSecPerFrameIdx; int FramerateSecPerFrameCount; float FramerateSecPerFrameAccum;