From dbc81f3f857e248d5eb6e3e61ffa2612944872da Mon Sep 17 00:00:00 2001 From: cyrildelzandre-gif Date: Sun, 30 Aug 2026 06:26:04 +0200 Subject: [PATCH 1/2] Profiling: never clamp the result page below 1 On the first frames after profiling is enabled there are no results yet, so numberOfPages is 0 - and CurrentResultPage, clamped with Math.Min against it, dropped to 0 and stayed there. The profiler then showed page 0 of N over an empty list once results arrived. Co-Authored-By: Claude Fable 5 (cherry picked from commit dd27c245f36853a7135b9b0b948af33e1c87bce3) --- sources/engine/Stride.Engine/Profiling/GameProfilingSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/engine/Stride.Engine/Profiling/GameProfilingSystem.cs b/sources/engine/Stride.Engine/Profiling/GameProfilingSystem.cs index d4b234d2dc..d1c142f866 100644 --- a/sources/engine/Stride.Engine/Profiling/GameProfilingSystem.cs +++ b/sources/engine/Stride.Engine/Profiling/GameProfilingSystem.cs @@ -149,7 +149,7 @@ private void UpdateProfilingStrings(bool containsMarks) var availableDisplayHeight = viewportHeight - 2 * TextRowHeight - 3 * TopRowHeight; var elementsPerPage = (int)Math.Floor(availableDisplayHeight / TextRowHeight); numberOfPages = (uint)Math.Ceiling(profilingResults.Count / (float)elementsPerPage); - CurrentResultPage = Math.Min(CurrentResultPage, numberOfPages); + CurrentResultPage = Math.Max(1, Math.Min(CurrentResultPage, numberOfPages)); char sortByTimeIndicator = SortingMode == GameProfilingSorting.ByTime ? 'v' : ' '; char sortByAvgTimeIndicator = SortingMode == GameProfilingSorting.ByAverageTime ? 'v' : ' '; From c7f3fbf44375a5f78c1994cf3b2e598f77968cdb Mon Sep 17 00:00:00 2001 From: "nicogo.eth" Date: Sun, 13 Sep 2026 12:30:11 +0200 Subject: [PATCH 2/2] Profiling: clamp the result page with uint.Clamp Co-Authored-By: Claude Fable 5.1 --- sources/engine/Stride.Engine/Profiling/GameProfilingSystem.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/engine/Stride.Engine/Profiling/GameProfilingSystem.cs b/sources/engine/Stride.Engine/Profiling/GameProfilingSystem.cs index d1c142f866..c361e8109d 100644 --- a/sources/engine/Stride.Engine/Profiling/GameProfilingSystem.cs +++ b/sources/engine/Stride.Engine/Profiling/GameProfilingSystem.cs @@ -149,7 +149,8 @@ private void UpdateProfilingStrings(bool containsMarks) var availableDisplayHeight = viewportHeight - 2 * TextRowHeight - 3 * TopRowHeight; var elementsPerPage = (int)Math.Floor(availableDisplayHeight / TextRowHeight); numberOfPages = (uint)Math.Ceiling(profilingResults.Count / (float)elementsPerPage); - CurrentResultPage = Math.Max(1, Math.Min(CurrentResultPage, numberOfPages)); + // No results yet leaves numberOfPages at 0; the page still stays at 1 or more. + CurrentResultPage = uint.Clamp(CurrentResultPage, 1, Math.Max(1, numberOfPages)); char sortByTimeIndicator = SortingMode == GameProfilingSorting.ByTime ? 'v' : ' '; char sortByAvgTimeIndicator = SortingMode == GameProfilingSorting.ByAverageTime ? 'v' : ' ';