Handmade Hero»Forums»Code
Jay
18 posts
Debug code max region with only 2 translation unit
Edited by Jay on
Hi.

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.

1
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?
30 posts
Debug code max region with only 2 translation unit
Edited by r2d2 on
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.
30 posts
Debug code max region with only 2 translation unit
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
Anders
20 posts
Professional (non-game)developer living in Stockholm, Sweden. Born '84. Gamer since five years of age, computer nerd since six.
Debug code max region with only 2 translation unit
Edited by Anders on
I have 3 translation units. Platform is Windows 10.

I just got this bug as well. I tried raising the constant up to 1024, but the count just kept on hitting the limit anyway. The bug happened both with a build using my own code and also with Casey's source code.

After reading some in both threads (one is linked in another post above) I just commented out the TIMED_FUNCTION() and TIMED_BLOCK macro calls in handmade_optimized.cpp and it stopped crashing.

It's very hard for me to debug this, so I'll just keep it like this until future episodes where it perhaps solves itself with Casey's upcoming changes.