[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Changing to Static Frame Arrays" vod_platform=youtube id=esRhxNS0Ee8 annotator=Miblo] [1:48][handmade_debug.cpp: Initialise the ProfileGraph dimensions to something relatively large] [4:01][Run the game, see the profile at a more useable default size and set the stage for the day] [5:42][handmade_debug.cpp: Introduce DrawFrameBars which draws stacked bars for multiple frames] [15:55][handmade_debug.cpp: Call DrawFrameBars rather than DrawProfileIn] [17:17][handmade_debug.cpp: Cap the FrameIndex] [18:02][Run the game and see our stack] [18:08][handmade_debug.cpp: Increase the FrameCount to 10] [20:50][handmade_debug.cpp: Just set the RootNode to be the OldestEvent] [22:03][handmade_debug.cpp: Increase the FrameCount to 128] [22:18][Run the game and see a more granular view of what's happening over time] [24:36][handmade_debug.h: Remove debug_frame_region and MAX_REGIONS_PER_FRAME] [25:58]["None of that's a thing"][quote 454] [26:08][handmade_debug.h: Introduce debug_element_frame to allow us to track and time events] [31:07][handmade_debug.h: Introduce FrameOrdinal and MostRecentFrameOrdinal and make functions in handmade_debug.cpp use it] [38:09][handmade_debug.cpp: Work on FreeFrame and FreeOldestFrame, and rework NewFrame as InitFrame] [48:12][handmade_debug.cpp: Introduce IncrementFrameOrdinal and GetCollationFrame] [51:32][handmade_debug.cpp: Work through compile errors] [1:01:48][Run the game and see that it is (almost) working] [1:02:48][Debugger: Break on FreeFrame and inspect the ordinals] [1:09:33][handmade_debug.cpp: Conditionally do a FREELIST_DEALLOCATE in FreeFrame] [1:12:58][handmade_debug.cpp: Scrutinise FreeFrame and do a ZeroStruct on *ElementFrame] [1:14:48][Run the game and reiterate the fact that we're leaking memory] [1:16:25][Q&A] [1:17:10][@EnemyMouse][Do you need to wrap that + FrameOrdinal in the FreeFrame function?] [1:17:48][handmade_debug.cpp: Assert that FrameOrdinal is less than DEBUG_FRAME_COUNT] [1:19:08][handmade_debug.cpp: Keep track of the FreedEventCount] [1:19:55][Run the game, crash and find that we're freeing one more event than we're storing] [1:21:10][handmade_debug.cpp: Remove a FREELIST_DEALLOCATE] [1:21:36][Rebuild and run and find that the bug's gone] [1:22:48][@zilarrezko][I'm a bit behind on Handmade Hero, but do you typically bypass (for something like off-stream coding) all the simplified things like rendering a bitmap like how you were doing (DrawBitmap, like on episode 39), and go straight to the renderer? But as well as other things like structured assets and the like?] [1:25:27][@DudeInBasement1][Thoughts on using a static array instead of the lists?] [1:26:16][@Miblo][insobot had this to say today: "Inheritance and encapsulation two best inventions of mankind". Discuss] [1:26:31][@EnemyMouse][Do you prefer to use modulo or masking for circular indexing? Do compilers replace modulos with bitwise-and if the operand is power of 2 -1?] [1:28:21][@erdomina][Are we still doing the marathon stream to account for the Q&A Monday madness?] [1:28:33][@SoysauceTheKid][The profiler code you had running several weeks ago, what happened to it? Some of the things you had implemented like the multiple lanes seemed to have disappeared] [1:29:07][handmade_debug.cpp: Reenable the profile lanes] [1:30:35][Run the game, see the multiple lanes, enable the software renderer and crash] [1:31:10][handmade_debug.cpp: Disable the recursion for now and run the game] [1:32:39][@zilarrezko][What if you aren't really learning from Handmade Hero? Where I've gone through episodes 1-28 about four times and I thought I knew how to do so. I tried to make the simplified win32 layer to get to the independent layer, and I found that I couldn't do it. The documentation was rough and I forgot what things did what. What would you say to people who find that they aren't learning?] [1:35:29][handmade_debug.cpp: Switch from DrawProfileIn to DrawFrameBars and view the profiler] [1:36:10][Call it] [1:37:42][Promote 4coder] [/video]