Handmade Hero » Forums » Code » Debug code max region with only 2 translation unit
18 posts
#5536 Debug code max region with only 2 translation unit
1 year, 8 months ago Edited by Jay on Dec. 31, 2015, 8:23 p.m.


I'm on day 185 "Finishing Basic Debug Collation" and I am having some issues.

When I run Casey's code it displays some data like it does on the stream. However with my code it hits the frame region count assertion on AddRegion.

Assert(currentFrame->RegionCount < MAX_REGIONS_PER_FRAME);

Unlike Casey, my render bitmap code is not in a separate translation unit so I only have two, main and platform. Could it be this is causing an issue?

If I move Casey optimised rectangle call back into render group his code also crashes at the same assertion.

I've gone up to day 190 making the same changes as Casey to my code and I still get the same issue.

Has anyone else had trouble with this?
25 posts
#12938 Debug code max region with only 2 translation unit
3 weeks, 5 days ago Edited by on Aug. 25, 2017, 7:09 a.m.

Sorry to dig up an old thread, but I'm also struggling with the same issue at the moment. Jay, if you're still around, have you managed to fix it?

Assistance is welcome. I'll report if I manage to get to the bottom of this.

Just to clarify, I have the same setup as Casey with 3 translation units. My platform layer is OS X, though.
25 posts
#12946 Debug code max region with only 2 translation unit
3 weeks, 3 days ago

Right, after spending some quality time in lldb trying to figure out how it all works I gave up and pushed through the next two episodes (186 & 187) to check out how Casey debugged the issue.

The curious thing is that he also encountered the same crash due to the overflow in amount of regions. He ended up just raising the max amount. This solution has helped me as well. I don't have any specific ideas why my build has produced a larger amount of regions per frame, maybe because my build draws more stuff for the 4k display? I dunno. Hopefully, it becomes more clear in the upcoming videos.

What's curious, the original issue discussed in the videos (debug graphs disappearing due to how MSVC inlines the recording functions) has never happened on my clang build. That was another thing that was bugging me when I ported the Day 185 code but it makes sense now.

Here's also a forum thread that was discussing the bug after the Day 186 video https://hero.handmade.network/for...poiler:_found_the_bug_for_day_186