[video output=day638 member=cmuratori stream_platform=twitch stream_username=handmade_hero  project=code title="Recording Diagram Commands" vod_platform=youtube id=8R4TvbuDrK8 annotator=Miblo]
[0:00][Recap and set the stage for the day][:speech]
[0:39][Thoughts on diagrammed debugging of our :collision system][:run]
[5:07][Describe our DIAGRAM_*() functions][:"debug system" :research]
[6:51][Introduce DIAGRAM_Color() and DIAGRAM_Thickness()][:"debug system"]
[9:01][Introduce diagram_entry and diagram_group structs][:"data structure" :"debug system"]
[14:24][Wonder how [@naysayer88 Jon] handles conditional compiling out of functions in JAI][:language :speech]
[15:03][Remove DIAGRAM_Phase() in favour of permitting nested diagrams at the Begin and End, and introduce DIAGRAM_Point(), DIAGRAM_Text() and DIAGRAM_Out()][:"debug system"]
[18:20][Check the chat for JAI info][:language :speech]
[18:49][Rename DIAGRAM_Text() to DIAGRAM_Overlay(), and make diagram_entry be a linked list in an arena][:"data structure" :"debug system"]
[20:36][Set up diagram_entry as a linked list, augmenting diagram_group with an Arena and PhaseDepth][:"data structure" :"debug system" :memory]
[23:01][Add Text to diagram_entry and rename DIAGRAM_Out() to DIAGRAM_Text()][:"data structure" :"debug system"]
[25:24][Introduce AppendDiagramEntry(), with thoughts on :threading and architecture-transparent debug systems][:"debug system" :memory]
[28:19][Fix up compile errors at diagramming calling sites, introducing DIAGRAM_IsOn()][:collision :"debug system"]
[35:22][Implement AppendDiagramEntry() and introduce diagram_attributes][:"data structure" :"debug system"]
[38:27][Introduce DIAGRAM_Stick()][:"debug system"]
[39:33][Implement DIAGRAM_Color() and DIAGRAM_Thickness()][:"debug system"]
[40:29][Continue to implement the AppendDiagramEntry() linked list][:"debug system"]
[42:54][Implement DIAGRAM_Sphere(), _Line(), _Box(), _Point() and _Overlay()][:"debug system"]
[44:43][Implement DIAGRAM_Begin() and DIAGRAM_End()][:"debug system"]
[46:03][Reflect on our diagramming code][:"debug system" :research]
[46:51][Consider recording the diagramming state for the renderer to track][:"debug system" :research]
[48:50][Make a union of the P\[\] and Attrib values in diagram_entry, including the Text buffer from diagram_attributes][:"data structure" :"debug system"]
[51:57][Implement DIAGRAM_Text(), augmenting diagram_group with a FormatBuffer\[1024\]][:"debug system" :"string manipulation"]
[57:06][Consider future work on our diagramming system][:"debug system" :research]
[59:12][Introduce RenderDiagrams()][:"debug system"]
[1:00:15][Hit a write access violation on DEBUG_RECORD_ALLOCATION() in PushSize_()][:collision :"debug system" :run]
[1:00:55][Compile in -Od and again hit that write access violation on DEBUG_RECORD_ALLOCATION() in PushSize_()][:collision :"debug system" :run]
[1:02:03][Investigate our write access violation on DEBUG_RECORD_ALLOCATION() in PushSize_()][:collision :"debug system" :research]
[1:03:35][Disable HANDMADE_DIAGRAMS][:"debug system"]
[1:04:12][Demo the memory arena viewer][:profiling :run]
[1:06:40][Our debug_event array in debug_table is 136 MiB][:"debug system" :memory :research]
[1:09:27][Increase our debug_event array to 2*64*65536 (544 MiB)][:"debug system" :memory]
[1:09:39][:Run the game]
[1:10:02][Revert our expansion of the debug_event array][:"debug system" :memory]
[1:10:10][Introduce DIAGRAM_Reset() for GAME_UPDATE_AND_RENDER() to call][:"debug system" :memory]
[1:14:44][In -O2, overflow the debug_event array via the :collision system][:"debug system" :run]
[1:15:06][In -Od, overflow the debug_event array via the diagramming system][:"debug system" :run]
[1:16:56][Increase our debug_event array to 2*64*65536 (544 MiB)][:"debug system" :memory]
[1:17:10][Again overflow the debug_event array via the diagramming system][:"debug system" :memory :run]
[1:17:56][Decrease our debug_event array to 2*16*65536 (136 MiB)][:"debug system" :memory]
[1:18:10][Step in to DIAGRAM_Reset() and through to diagramming calls][:"debug system" :memory :run]
[1:19:36][Determine to limit our diagramming to a particular entity][:"debug system" :research]
[1:21:20][Set up AppendDiagramEntry() to conditionally push on a diagram_entry][:"debug system"]
[1:23:01][:Run in -Od without overflowing the debug_event array][:"debug system"]
[1:23:05][:Run in -O2 without overflowing the debug_event array][:"debug system"]
[1:23:24][Introduce DIAGRAM_SetFilter() and DIAGRAM_Filter(), augmenting diagram_group with Filter and FilterPassed values][:"data structure" :"debug system"]
[1:27:57][:Run without overflowing the debug_event array][:"debug system"]
[1:28:53][Disable the :"debug visualisation" in the :"entity system"][:"debug system" :research]
[1:30:37][Q&A][:speech]
[1:31:16][@centhusiast][Q: Do you know about WebView2?[ref
    site="Microsoft Docs"
    page="Introduction to Microsoft Edge WebView2"
    url=https://docs.microsoft.com/en-us/microsoft-edge/webview2/]]
[1:32:22][@said6289][Q: What's sphere roll-off?][:collision]
[1:33:09][@jack_mousseau][Q: You made a note about rewinding a :memory arena? Does a rewind free the allocation?]
[1:34:21][@alexkelbo][Q: Shouldn't we add spatial partitioning for :collision and such at this point?]
[1:35:19][@mindmark42][Q: You mentioned you are doing :memory arenas differently now. What are you doing differently?]
[1:36:07][@matiasmunkp][Q: In the early videos you were mentioning if the series got enough attraction, you could probably look into adding :networking features. What is your stance on this now?[ref
    site="Star Code Galaxy"
    url=https://starcodegalaxy.com]]
[1:36:52][@jonathanlivingstone][Q: Why did you forward-declare the diagram functions in the header file? I thought you did the unity build system so you didn't need to do that kind of thing. Unless the #include order requires it?][:language]
[1:38:33][@botondar][Q: Off-topic: Do you know any particular reason why MSVC would optimize a piece of code better with /Ox instead of /O2 (2x speed-up)?][:language]
[1:39:20][Plug godbolt[ref
    site="Compiler Explorer"
    url=https://godbolt.org]][:language :research]
[1:42:28][@mindmark42][Q: Sorry but what do you mean by grow linearly? Is that like reallocating so it's contiguous?][:memory]
[1:43:02][@botondar][Q: (cont.) No, the code performs better with /Ox and not /O2 which doesn't make sense to me because /O2 enables more optimizations][:language]
[1:45:42][@philliptrudeau][Q: Would it be possible to render all of the unfiltered N-squared diagrams if the number of debug events was huge? Or are there just way way too many diagrams for that?][:"debug system"]
[1:47:05][Recommend making a highly optimised :"debug system" as a project][:speech]
[1:48:12][@xxthebigfoxx][Q: What do you use to build on Linux?][:language]
[1:48:31][@centhusiast][Q: Do you know that [@nothings Sean Barrett] is writing a C compiler. Are you going to use it?][:language]
[1:48:52][@xxthebigfoxx][Q: Any build system? Or just .sh files?][:language]
[1:49:21][Wrap it up with a glimpse into the future][:speech]
[/video]
