[video output=day183 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Platform Layer Debug Events" vod_platform=youtube id=tdrTk9Ba3VM annotator=Miblo annotator=debiatan] [00:08][Recap and plan for today] [01:56][Removing the obsolete debug_frame_end_info] [02:15][In place of that, we could have an array of counters for the platform layer translation unit] [03:05][But we can also write directly to the GlobalDebugTable] [05:14][Introducing manual_timed_block to have more flexibility recording events] [08:28][Implementing BEGIN_BLOCK and END_BLOCK] [09:02][Naming blocks so that we can pair BEGIN_ and END_BLOCKs] [09:50][We want to avoid creating scopes for the only purpose of timing what's inside] [10:13][Let's write the usage code first] [13:30][Naming also the END_BLOCKs] [15:03][Implementing the named BEGIN_BLOCK] [18:34][Implementing the named END_BLOCK] [19:47][Renaming TIMED_BLOCK as TIMED_FUNCTION] [20:57][Making the code compile after all the changes to the debug system] [22:58][Reintroducing TIMED_BLOCK and consolidating it with TIMED_FUNCTION] [26:00][There's a compilation problem related to BEGIN_BLOCK] [27:32][Debugging the macro by commenting parts of it out] [28:06][The problem was one of conflicting names] [28:56][Grabbing the GlobalDebugTable at DLL-load time] [30:13][Changing the type of the global debug table to be a pointer] [32:08][Introducing a placeholder GlobalDebugTable in the platform layer] [33:00][The program crashes] [34:55][We did not initialize the counter inside the timed_block constructor] [35:06][Testing the last changes. The platform layer writes now to a separate debug memory] [35:31][Hooking up the debug table from the game code after loading the game DLL] [36:55][The debug array could also live in the platform layer side, but that option would have its own problems] [38:57][The sharing of the debug_table could be better] [40:10][The platform counters still don't show up in the visualization] [40:59][We were not printing the platform layer records yet!] [41:44][Adding the RecordCount per translation unit to the debug table] [46:02][Figuring out the platform layer record count] [47:42][Testing again] [48:37][The Win32Loop closes after DEBUGFrameEnd is invoked, so its value is incorrect] [50:25][We want to have a way of establishing frame boundaries] [51:20][Introducing FRAME_MARKER] [52:13][New debug_event_type: DebugEvent_FrameMarker] [54:14][Testing it] [55:10][(Blackboard) Structure and plans for the debug log. We want to keep a history longer than one frame] [57:02][We need to allocate more memory. Maybe it should come from the platform layer] [58:10][Is the amount of data we want to keep in the static section going to be a problem?] [59:33][Instead of two ping-pong arrays, we have now sixty-four] [1:00:30][Now we can look across frames and we don't need the snapshots anymore] [1:01:20][Not as good as a circular buffer but it will do] [1:02:43][Q&A][:speech] [1:03:11][@Hotspur_][Are you going to start the hardware renderer before starting on game logic? Or are you going to wait until software doesn't cut it? Or are you waiting for Vulkan?] [1:04:09][@TheiBurley][Do you just use the blue line selector and green cursor to make it easier to follow on stream, or is that how you normally like it? I feel like it would get fatiguing on the eyes] [1:04:34][@elxenoaizd][When do you think it is a good idea to use somebody else's library / system instead of implementing our own? (e.g. Do you use anything from the C standard library?)] [1:07:08][@cubercaleb][Missed the first half of the stream, are you saving the past 60 frames into a buffer?] [1:07:40][@elxenoaizd][If a miracle happens and C++ starts doing things right and addresses the issues in the implementations of most of their features, would you use their features like templates etc., or stick to metaprogramming etc.?] [1:08:02][@JamesWidman][In the debug display, are we going to see something like Brendan Gregg's flame graphs (where function call depth is represented on the Y axis)?] [1:08:27][@insofaras][I think a lot of people would like to see how to write a hardware renderer, myself included][quote 226] [1:10:33][@CaptainKraft][Getting good at writing game engines: make lots of them or work on a few larger ones and continue improving them?] [1:12:07][Close it down][:speech] [/video]