cinera_handmade.network/cmuratori/hero/code/code131.hmml

61 lines
4.1 KiB
Plaintext
Raw Permalink Normal View History

[video output=day131 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Asynchronous Ground Chunk Composition" vod_platform=youtube id=6blXhvPIz5g annotator=Miblo]
[2:40][Run the game and identify our slight problem]
[4:22][Why we couldn't generate the ground chunks on a separate thread]
[6:47][handmade.h: Allow PushSize_ to take an Alignment]
[8:15][Introduce AlignmentMask]
[10:13][Blackboard: Turning a power of 2 into a mask]
[13:03][Set the AlignmentOffset based on the AlignmentMask]
[16:47][Go over PushSize_ one more time]
[17:57][Debugger: Step through PushSize_]
[18:48][handmade.h: Add ## __VA__ARGS to these Push* definitions]
[20:58][handmade.cpp: Pass 16 to this PushSize call and run the game]
[21:57][Consider queueing up all of FillGroundChunk]
[23:16][Turn off TiledRenderGroupToOutput]
[23:40][handmade_render_group.cpp: Switch to the player's camera and walk around]
[24:12][On leaving part of what we're doing synchronous]
[25:48][Provide a temporary storage area to enable the background task to work without the data getting overwritten]
[27:11][handmade.h: Introduce GroundChunkArenas]
[28:55][Introduce task_with_memory]
[29:58][handmade.cpp: Create a bunch of Tasks which each create a SubArena]
[31:47][Look at how FillGroundChunk works]
[32:28][handmade.h: Make it implicit in task_with_memory that the memory is temporary]
[33:08][handmade.cpp: Implement BeginTaskWithMemory and EndTaskWithMemory]
[34:10][Do FillGroundChunk if BeginTaskWithMemory is true]
[36:01][Write BeginTaskWithMemory]
[38:48][Put TiledRenderGroupToOutput on the background threads]
[40:13][handmade_render_group.cpp: Introduce RenderGroupToOutput as a non-tiled version]
[42:21][handmade.cpp: Call RenderGroupToOutput]
[44:27][handmade_intrinsics.h: #define CompletePreviousWritesBeforeFutureWrites]
[45:20][handmade.cpp: Clean up]
[45:51][Do AllocateRenderGroup from &Task->Arena]
[46:55][Introduce fill_ground_chunk_work]
[47:51][Put fill_ground_chunk_work into PLATFORM_WORK_QUEUE_CALLBACK]
[48:30][Put fill_ground_chunk_work into FillGroundChunk and fill it out at the end]
[49:14][Call PlatformAddEntry]
[49:54][handmade.h: Implement GetArenaSizeRemaining]
[51:38][Introduce GetAlignmentOffset]
[52:57][Calculate that Result in GetArenaSizeRemaining and clean up]
[54:25][handmade.cpp: Cast GetArenaSizeRemaining to uint32 in FillGroundChunk]
[56:12][handmade.h: Implement SubArena]
[58:41][Walk through our new functionality]
[1:00:00][Debugger: Start stepping through the code]
[1:04:52][Debugger: NextInHash is not valid]
[1:05:52][handmade.h: Put the += Size in the correct spot in PushSize_]
[1:06:26][Debugger: Identify that MaxPushBufferSize needs to take PushStruct into account]
[1:06:47][handmade_render_group.cpp: Conditionally set MaxPushBufferSize in AllocateRenderGroup]
[1:08:00][Debugger: Continue stepping through and note that the TempCount is 2]
[1:08:38][handmade.cpp: Set Task->BeingUsed = true in BeginTaskWithMemory]
[1:08:52][Run the game successfully]
[1:09:32][handmade_render_group.cpp: Reenable the debug camera]
[1:11:13][Q&A][:speech]
[1:12:02][@nicstop][If one of the task_with_memory, which has several task_with_memory in front of it, calls EndTaskWithMemory first, will the stuff in front of it be screwed up? Or is this case not possible? Because I have a feeling that I don't understand something]
[1:12:28][Blackboard: What goes in the arenas and how they work]
[1:14:49][@poohshoes][We already had memory reserved for the GroundBuffers. Why couldn't we just use that memory for the threaded stuff?]
[1:16:10][@connorgroove][What are the lines on the screen?]
[1:16:58][win32_handmade.cpp: Set OffsetX and OffsetY to 0 in Win32DisplayBufferInWindow for now]
[1:19:29][@noxy_key][So you've basically constructed a task pool for ground chunks to run on another thread. Can you use this mechanism for other types of tasks as well?]
[1:19:49][@poohshoes][Why not put the stuff at the top of the transient arena (i.e. ground chunk bitmaps) into the permanent storage?]
[1:20:09][@ankut][Why does it flash magenta once in a while? Is it because we're drawing without the work being finished?]
[1:20:40][Wrap things up][:speech]
[/video]