-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fixing DearIMGUI NewFrame()/EndFrame()
cycle.
#2834
Conversation
I just tried on my work laptop:
Same result with Aspen Grove (without 627d85b): |
I added debug macros and tried again (on work laptop):
But when I set a data breakpoint to
|
Mystery explained - for some reason, @paroj Any idea why
|
_getViewport() gives you the currently active viewport. Depending on when you ask, this might be the shadowmap. This is how I attached ImGui code to one specific Viewport in Ogre: |
404a390
to
e28216b
Compare
@paroj problem found: Checking I fixed it by adding check against the game's viewport pointer. Your solution OGRECave/ogre@6ea11c9#diff-ba044a06f13f5520d6a7f71483b63942b77482b9f1c948fac74fc8159eec544a is'n applicable here because it requires all GUI to be drawn in I moved the branch with debug logging to https://github.com/only-a-ptr/rigs-of-rods/commits/archive/imgui-NewFrameEndFrame-debug and only applied the fix here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm getting debug asserts from DearIMGUI that
NewFrame()/EndFrame()
functions are not being called in sync. It only happens at certain stage of loading certain terrains. Things to know before moving further:NewFrame()
is invoked from main()Render()
is called from withinOgre::RenderQueueListener::renderQueueStarted()
callback implemented in OgreImGuirenderOneFrame()
is invoked from 2 places: main() for regular gameplay frames and progress window [which itself is invoked indirectly from main] when loading things.Original concern
Update: root cause found
IM_ASSERT((g.FrameCount == 0 || g.FrameCountEnded == g.FrameCount) && "Forgot to call Render() or EndFrame() at the end of the previous frame?");
inNewFrameSanityChecks()
. This happens during loading Aspen Grove terrain. When continued with debugger, the game runs fine. See logs:RoR-reverted-debuggerAbort.log
RoR-reverted-debuggerContinueGameRuns.log
Note that Train Valley loads without problem.
The reverted commit 627d85b
it fixed the Aspen Grove case, but introduced another in Train Valley terrain:
IM_ASSERT(g.FrameScopeActive); // Forgot to call ImGui::NewFrame()
inBegin()
. Continuing with debugger triggers the FrameCount assert, then FrameScope again, then FrameCount again and then it hangs inCollisions::hashfunc()
. See logs.RoR-upstream-debugerAbort.log
RoR-upstream-debuggerContinue3x.log
Test PC spec:
Tomorrow I'll add debug checks and re-run it to see when it breaks.