Browse Source

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

pull/6727/head
ocornut 1 year ago
parent
commit
d2c7cbcbf9
  1. 1
      docs/CHANGELOG.txt
  2. 10
      imgui.cpp

1
docs/CHANGELOG.txt

@ -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.

10
imgui.cpp

@ -5077,15 +5077,15 @@ 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();
RenderDimmedBackgrounds();
// Add background ImDrawList (for each active viewport)
for (int n = 0; n != g.Viewports.Size; n++)
@ -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

Loading…
Cancel
Save