Misc: Made multiple calls to Render() during the same frame early out faster.

This commit is contained in:
ocornut 2023-08-14 16:23:04 +02:00
parent ac64b65634
commit d2c7cbcbf9
2 changed files with 6 additions and 5 deletions

View File

@ -54,6 +54,7 @@ Other changes:
of individual ImDrawList's buffer sizes when a dimming/modal background is rendered. (#6716)
- ImDrawList: Fixed OOB access in _CalcCircleAutoSegmentCount when passing excessively
large radius to AddCircle(). (#6657, #5317) [@EggsyCRO, @jdpatdiscord]
- Misc: Made multiple calls to Render() during the same frame early out faster.
- Debug Tools: Metrics: Fixed "Drawlists" section and per-viewport equivalent
appearing empty (regression in 1.89.8).
- Demo: Demonstrate out-of-order rendering using ImDrawListSplitter.

View File

@ -5077,14 +5077,14 @@ void ImGui::Render()
if (g.FrameCountEnded != g.FrameCount)
EndFrame();
const bool first_render_of_frame = (g.FrameCountRendered != g.FrameCount);
if (g.FrameCountRendered == g.FrameCount)
return;
g.FrameCountRendered = g.FrameCount;
g.IO.MetricsRenderWindows = 0;
g.IO.MetricsRenderWindows = 0;
CallContextHooks(&g, ImGuiContextHookType_RenderPre);
// Draw modal/window whitening backgrounds
if (first_render_of_frame)
RenderDimmedBackgrounds();
// Add background ImDrawList (for each active viewport)
@ -5112,7 +5112,7 @@ void ImGui::Render()
AddRootWindowToDrawData(windows_to_render_top_most[n]);
// Draw software mouse cursor if requested by io.MouseDrawCursor flag
if (g.IO.MouseDrawCursor && first_render_of_frame && g.MouseCursor != ImGuiMouseCursor_None)
if (g.IO.MouseDrawCursor && g.MouseCursor != ImGuiMouseCursor_None)
RenderMouseCursor(g.IO.MousePos, g.Style.MouseCursorScale, g.MouseCursor, IM_COL32_WHITE, IM_COL32_BLACK, IM_COL32(0, 0, 0, 48));
// Setup ImDrawData structures for end-user