[video output=day249 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Cleaning Up Debug Macros" vod_platform=youtube id=NVnlQ7KMGa8 annotator=ffsjs annotator=Miblo] [0:08][Welcome, let's jump directly into the revamping of the debug code] [0:44][Recap: The debug system is relatively usable, but all names are always forced through the hierarchy system, so it creates dummy nodes for things] [1:19][We also want to make the profiler functional again] [1:57][handmade.cpp: Add DEBUG_PROFILE() to the debug data block] [2:42][handmade_debug_interface.h: Define DEBUG_PROFILE] [6:10][We have debug elements (which can exist in multiple hierarchies) and debug events (things that came to the stream and which we are trying to record)] [6:46][handmade_debug.cpp: Add an empty case for DebugType_CounterFunctionList and check if using the pre-existing debug element is sufficient for the profile] [9:21][handmade_debug.cpp: Check it DebugType_MarkDebugValue is still used and remove it] [11:18][handmade.cpp: Check if the debug system supports nested data blocks] [13:15][handmade_debug.cpp: Include the DebugType_CounterFunctionList case in the DEBUGDrawElement] [14:47][handmade_debug.cpp: Remove the previously added interception call for DebugType_CounterFunctionList (the empty case)] [16:05][handmade.cpp: Refine the data blocks syntax] [23:10][handemade_debug_interface.h: Rewrite the DEBUG_DATA_BLOCK in order to accomodate the changes made to the API] [25:53][Implementing the constructor for the data block begin and end] [27:28][handmade_debug.cpp: Check to see where the GUIDs are used] [29:10][handmade_debug_interface.h: Considering passing GUIDs through the RecordDebugEvent call graph] [33:52][Add "Name" to the UniqueFileCounterString(), remove BlockName from RecordDebugEvent and the debug_event struct] [37:06][Rename UniqueFileCounterString to DEBUG_NAME] [37:55][Check if Counter is used and remove it, simplifying FRAME_MARKER()] [39:22][Clean up BEGIN_BLOCK_() and END_BLOCK_() and add GUIDs to calls to RecordDebugEvent] [40:29][Clean up BEGIN_BLOCK(Name) and END_BLOCK(Name) by passing only the DEBUG_NAME(Name)] [41:25][Clean up the timed_block struct] [43:15][Clean up the TIMED_BLOCK and TIMED_FUNCTION macros] [45:35][Analyze the END_BLOCK("~timed_block") call] [51:28][Preprocess and search for "~timed_block"] [54:24][The debug code was not preprocessed because of the missing -D_HANDMADE_INTERNAL=1 switch on the command line] [55:44][Changing GUID to GUIDInit in the RecordDebugEvent macro so that it expands properly] [56:31][Remove Name from the END_BLOCK macro] [57:05][Another benefit of using a "Single Compilation Unit Build" is that if we want to preprocess a file, we can easily do it] [59:32][Temporarily remove -DHANDMADE_INTERNAL=1 switch from the build.bat file and fix other build errors on data blocks] [1:02:01][Q&A][:speech] [1:02:42][@Cubercaleb][How the heck do you quickly get back into some obtuse code that you haven't looked at in 6 months?] [1:03:48][Wrap up. Thank you][:speech] [/video]