[video output=day228 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Waiting for Dependent Tasks on Metagame Mode Changes" vod_platform=youtube id=4sdqC9V4P_g annotator=Miblo] [0:13][Gift Received in the Mail: Owl of Shame Baby] [2:06][Recap and set the stage for the day] [5:14][Describe a threading bug in tasks which access the game's mode state and which persist] [7:53][Set out our choices for fixing this bug] [11:23][handmade.h: Add b32 DependsOnGameMode to task_with_memory] [13:30][handmade.cpp: Add Platform.CompleteAllWork and NeedToWait to SetGameMode] [20:10][Run the game and see that it does work right] [20:33][handmade_world_mode.cpp: Call PlayTitleScreen upon exiting from the game] [21:03][Debugger: Note that we may now be clearing a large block of memory to zero, run the game and use Debug->Break All to confirm that] [23:06][handmade.h: Introduce struct arena_push_params and inline arena_push_params in order to specify to the Push routines whether or not to clear to zero] [27:14][handmade.h: Introduce AlignNoClear and Align] [29:51][Propagate our new features to all of the Push calls that require it] [35:38][handmade.h: Introduce NoClear and finish writing these new functions] [37:28][Run the game and see that it runs much more snappily] [38:01][Consider making the memory arenas flow all the way down to the operating system level, making the debug system use a separate set of growable memory, and fixing the renderer's sorting] [41:00][handmade_render_group.cpp: Take a look at how the renderer currently works] [43:32][handmade_render_group.cpp: Consider removing the notion of the scanlines] [44:21][build.bat: Turn on HANDMADE_INTERNAL] [44:57][Run the game and watch our last frame time] [46:16][handmade_render_group.cpp: Remove the Even / Odd notion] [47:49][Run the game and enjoy our beautiful rendering] [48:12][handmade_optimized.cpp: Increment the Y counter by 1 rather than 2] [49:13][Run the game and see that we may have got a little faster] [49:52][handmade_render_group.cpp: Consider providing some way of knowing what we're sorting] [53:11][handmade_render_group.h: Add PushBufferElementCount to render_group to let us know how many elements have been pushed] [55:27][handmade_render_group.cpp: Introduce struct tile_sort_entry and use it in RenderGroupToOutput] [1:00:55][Run the game and see that it still works fine] [1:01:31][Q&A][:speech] [1:02:06][@serge_rgb][Could you tell us roughly how the expanding arena would be implemented?] [1:02:57][@insofaras][Is the lower level memory arena thing you mentioned for PC basically just what malloc / VirtualAlloc does?] [1:03:25][@SimonDenton][I got the K & R book to learn C. Any other useful resources? I take online stuff with a grain of salt] [1:03:36][@gasto5][Is interlaced the same as interleaved?] [1:04:33][@Connor_Rentz][What should I do with my life while Handmade Hero is on break?] [1:05:06][@cubercaleb][Which algorithm do you plan on using for sorting?] [1:05:43][@elxenoaizd][Why are we running in a windows application (using WinMain) instead of a console one (using regular main(int, char**)), and still RegisterClass, CreateWindow, etc?] [1:06:35][@cubercaleb][Why was the interleaving added in the first place?] [1:07:01][@insofaras][How many TODOs are there in the code now?] [1:07:29][@pragmascrypt][Is there much overhead to spawning the render threads every frame instead of keeping them around] [1:07:45][@Culver_Fly][Do you always start with software rendering when working on games?] [1:08:27][@groggeh][For new year's can we get a marathon?] [1:08:33][@RyanRies][Can you do really smooth animation in GDI, without vsync?] [1:09:16][@elxenoaizd][Simple question, but how do you forward declare a struct in pure C? If I have "typedef struct foo {...} foo;" how do I forward declare this? I tried typedef struct foo foo; but it didn't work] [1:09:49][@m1el][Do you have any optimization for not blending transparent pixels?] [1:11:18][@cubercaleb][Once you have sorting implemented, do you think you will change the renderer to draw front to back?] [1:11:40][@elxenoaizd][Thanks, I was just curious in my console question. But sometimes I write utils that I would like to live in the background and not be visible on the screen, so I use a Windows application and hide the window. Is there any way to use a console instead and hide that (from taskmgr, etc.)?] [1:12:08][@actbinary][Can you give a quick overview of the way memory is managed at the moment? PushArena / BeginTempArena, etc?] [1:12:46][Blackboard: Memory Arenas] [1:14:21][@Alfwich][Are you still using .bat file compilations?] [1:14:45][Wrap it up][:speech] [/video]