mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-30 20:51:06 +01:00 
			
		
		
		
	Tweak computation of io.Framerate so it is less biased toward high-values in the first 120 frames. (#4138)
This commit is contained in:
		| @@ -62,6 +62,7 @@ Other Changes: | |||||||
| - LabelText: Fixed clipping of multi-line value text when label is single-line. (#4004) | - LabelText: Fixed clipping of multi-line value text when label is single-line. (#4004) | ||||||
| - LabelText: Fixed vertical alignment of single-line value text when label is multi-line. (#4004) | - LabelText: Fixed vertical alignment of single-line value text when label is multi-line. (#4004) | ||||||
| - Popups: Added 'OpenPopup(ImGuiID id)' overload to facilitate calling from nested stacks. (#3993, #331) [@zlash] | - Popups: Added 'OpenPopup(ImGuiID id)' overload to facilitate calling from nested stacks. (#3993, #331) [@zlash] | ||||||
|  | - Tweak computation of io.Framerate so it is less biased toward high-values in the first 120 frames. (#4138) | ||||||
| - Optimization: Disabling some of MSVC most aggressive Debug runtime checks for some simple/low-level functions | - Optimization: Disabling some of MSVC most aggressive Debug runtime checks for some simple/low-level functions | ||||||
|   (e.g. ImVec2, ImVector) leading to a 10-20% increase of performances with MSVC "default" Debug settings. |   (e.g. ImVec2, ImVector) leading to a 10-20% increase of performances with MSVC "default" Debug settings. | ||||||
| - ImDrawList: Add and use SSE-enabled ImRsqrt() in place of 1.0f / ImSqrt(). (#4091) [@wolfpld] | - ImDrawList: Add and use SSE-enabled ImRsqrt() in place of 1.0f / ImSqrt(). (#4091) [@wolfpld] | ||||||
|   | |||||||
| @@ -3923,7 +3923,8 @@ void ImGui::NewFrame() | |||||||
|     g.FramerateSecPerFrameAccum += g.IO.DeltaTime - g.FramerateSecPerFrame[g.FramerateSecPerFrameIdx]; |     g.FramerateSecPerFrameAccum += g.IO.DeltaTime - g.FramerateSecPerFrame[g.FramerateSecPerFrameIdx]; | ||||||
|     g.FramerateSecPerFrame[g.FramerateSecPerFrameIdx] = g.IO.DeltaTime; |     g.FramerateSecPerFrame[g.FramerateSecPerFrameIdx] = g.IO.DeltaTime; | ||||||
|     g.FramerateSecPerFrameIdx = (g.FramerateSecPerFrameIdx + 1) % IM_ARRAYSIZE(g.FramerateSecPerFrame); |     g.FramerateSecPerFrameIdx = (g.FramerateSecPerFrameIdx + 1) % IM_ARRAYSIZE(g.FramerateSecPerFrame); | ||||||
|     g.IO.Framerate = (g.FramerateSecPerFrameAccum > 0.0f) ? (1.0f / (g.FramerateSecPerFrameAccum / (float)IM_ARRAYSIZE(g.FramerateSecPerFrame))) : FLT_MAX; |     g.FramerateSecPerFrameCount = ImMin(g.FramerateSecPerFrameCount + 1, IM_ARRAYSIZE(g.FramerateSecPerFrame)); | ||||||
|  |     g.IO.Framerate = (g.FramerateSecPerFrameAccum > 0.0f) ? (1.0f / (g.FramerateSecPerFrameAccum / (float)g.FramerateSecPerFrameCount)) : FLT_MAX; | ||||||
|  |  | ||||||
|     UpdateViewportsNewFrame(); |     UpdateViewportsNewFrame(); | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								imgui.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								imgui.h
									
									
									
									
									
								
							| @@ -1864,7 +1864,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        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        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). |     bool        NavVisible;                     // Keyboard/Gamepad navigation is visible and allowed (will handle ImGuiKey_NavXXX events). | ||||||
|     float       Framerate;                      // Application framerate estimate, in frame per second. Solely for convenience. Rolling average estimation based on io.DeltaTime over 120 frames. |     float       Framerate;                      // Rough estimate of application framerate, in frame per second. Solely for convenience. Rolling average estimation based on io.DeltaTime over 120 frames. | ||||||
|     int         MetricsRenderVertices;          // Vertices output during last call to Render() |     int         MetricsRenderVertices;          // Vertices output during last call to Render() | ||||||
|     int         MetricsRenderIndices;           // Indices output during last call to Render() = number of triangles * 3 |     int         MetricsRenderIndices;           // Indices output during last call to Render() = number of triangles * 3 | ||||||
|     int         MetricsRenderWindows;           // Number of visible windows |     int         MetricsRenderWindows;           // Number of visible windows | ||||||
|   | |||||||
| @@ -1586,6 +1586,7 @@ struct ImGuiContext | |||||||
|     // Misc |     // Misc | ||||||
|     float                   FramerateSecPerFrame[120];          // Calculate estimate of framerate for user over the last 2 seconds. |     float                   FramerateSecPerFrame[120];          // Calculate estimate of framerate for user over the last 2 seconds. | ||||||
|     int                     FramerateSecPerFrameIdx; |     int                     FramerateSecPerFrameIdx; | ||||||
|  |     int                     FramerateSecPerFrameCount; | ||||||
|     float                   FramerateSecPerFrameAccum; |     float                   FramerateSecPerFrameAccum; | ||||||
|     int                     WantCaptureMouseNextFrame;          // Explicit capture via CaptureKeyboardFromApp()/CaptureMouseFromApp() sets those flags |     int                     WantCaptureMouseNextFrame;          // Explicit capture via CaptureKeyboardFromApp()/CaptureMouseFromApp() sets those flags | ||||||
|     int                     WantCaptureKeyboardNextFrame; |     int                     WantCaptureKeyboardNextFrame; | ||||||
| @@ -1733,7 +1734,7 @@ struct ImGuiContext | |||||||
|         DebugItemPickerBreakId = 0; |         DebugItemPickerBreakId = 0; | ||||||
|  |  | ||||||
|         memset(FramerateSecPerFrame, 0, sizeof(FramerateSecPerFrame)); |         memset(FramerateSecPerFrame, 0, sizeof(FramerateSecPerFrame)); | ||||||
|         FramerateSecPerFrameIdx = 0; |         FramerateSecPerFrameIdx = FramerateSecPerFrameCount = 0; | ||||||
|         FramerateSecPerFrameAccum = 0.0f; |         FramerateSecPerFrameAccum = 0.0f; | ||||||
|         WantCaptureMouseNextFrame = WantCaptureKeyboardNextFrame = WantTextInputNextFrame = -1; |         WantCaptureMouseNextFrame = WantCaptureKeyboardNextFrame = WantTextInputNextFrame = -1; | ||||||
|         memset(TempBuffer, 0, sizeof(TempBuffer)); |         memset(TempBuffer, 0, sizeof(TempBuffer)); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user