MCPcopy Create free account
hub / github.com/RenderKit/embree / ErrorCheckEndFrameSanityChecks

Method ErrorCheckEndFrameSanityChecks

tutorials/common/imgui/imgui.cpp:8759–8793  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8757}
8758
8759static void ImGui::ErrorCheckEndFrameSanityChecks()
8760{
8761 ImGuiContext& g = *GImGui;
8762
8763 // Verify that io.KeyXXX fields haven't been tampered with. Key mods should not be modified between NewFrame() and EndFrame()
8764 // One possible reason leading to this assert is that your backends update inputs _AFTER_ NewFrame().
8765 // It is known that when some modal native windows called mid-frame takes focus away, some backends such as GLFW will
8766 // send key release events mid-frame. This would normally trigger this assertion and lead to sheared inputs.
8767 // We silently accommodate for this case by ignoring/ the case where all io.KeyXXX modifiers were released (aka key_mod_flags == 0),
8768 // while still correctly asserting on mid-frame key press events.
8769 const ImGuiKeyChord key_mods = GetMergedModsFromBools();
8770 IM_ASSERT((key_mods == 0 || g.IO.KeyMods == key_mods) && "Mismatching io.KeyCtrl/io.KeyShift/io.KeyAlt/io.KeySuper vs io.KeyMods");
8771 IM_UNUSED(key_mods);
8772
8773 // [EXPERIMENTAL] Recover from errors: You may call this yourself before EndFrame().
8774 //ErrorCheckEndFrameRecover();
8775
8776 // Report when there is a mismatch of Begin/BeginChild vs End/EndChild calls. Important: Remember that the Begin/BeginChild API requires you
8777 // to always call End/EndChild even if Begin/BeginChild returns false! (this is unfortunately inconsistent with most other Begin* API).
8778 if (g.CurrentWindowStack.Size != 1)
8779 {
8780 if (g.CurrentWindowStack.Size > 1)
8781 {
8782 IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size == 1, "Mismatched Begin/BeginChild vs End/EndChild calls: did you forget to call End/EndChild?");
8783 while (g.CurrentWindowStack.Size > 1)
8784 End();
8785 }
8786 else
8787 {
8788 IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size == 1, "Mismatched Begin/BeginChild vs End/EndChild calls: did you call End/EndChild too much?");
8789 }
8790 }
8791
8792 IM_ASSERT_USER_ERROR(g.GroupStack.Size == 0, "Missing EndGroup call!");
8793}
8794
8795// Experimental recovery from incorrect usage of BeginXXX/EndXXX/PushXXX/PopXXX calls.
8796// Must be called during or before EndFrame().

Callers

nothing calls this directly

Calls 1

GetMergedModsFromBoolsFunction · 0.85

Tested by

no test coverage detected