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

53 lines
4.0 KiB
Plaintext

[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Sorting Render Elements" vod_platform=youtube id=b6qZaqL7fxM annotator=Miblo]
[0:25][Recap and set the stage for the day]
[1:28][Run the game and hit an assertion]
[2:33][handmade_world_mode.cpp: Turn off FillGroundChunk]
[3:07][Run the game and note the lack of sprite sorting]
[4:34][handmade_world_mode.cpp: Turn FillGroundChunk back on and note that we need some room in which to do the sorting]
[5:29][Debugger: Step into AllocateRenderGroup]
[6:45][handmade.cpp: Increase the amount of memory allocated to this TranState]
[7:04][Debugger: Step into BeginRender and inspect Work->Task->Arena]
[8:03][handmade_world_mode.cpp: Make RenderGroup use 512KB]
[10:39][Blackboard: Render Sorting]
[13:56][Blackboard: Sort buffer]
[15:12][Blackboard: Producing the sort key]
[19:01]["For the love of god, Mischief"][quote 343]
[20:03][handmade_render_group.cpp: Consider how to sort]
[22:09][handmade_render_group.cpp: Find the PushBufferOffset for each Entry in RenderGroupToOutput, and make the function take SortEntryCount and *SortEntries]
[25:29][Blackboard: How we're currently rendering the screen]
[26:25][Consider how best to do this sort]
[28:37][handmade_render_group.h: Add u32 SortEntryAt to render_group]
[29:03][handmade_render_group.cpp: Set that SortEntryAt in AllocateRenderGroup and use it in PushRenderElement_]
[30:16][Blackboard: Pushing entries on from the top and sorts on from the bottom]
[30:57][handmade_render_group.cpp: Implement these pushes, and make PushRenderElement_ take r32 SortKey]
[33:11][handmade_render_group.cpp: Clean up compile errors and propagate the SortKey]
[38:39][Run the game and see that it isn't quite right]
[39:40][handmade_render_group.cpp: Reverse the sorting order]
[40:09][Run the game and see that it is now correct]
[40:20][Blackboard: The Clear was happening last, after rendering everything]
[41:05][handmade_render_group.cpp: Introduce SortEntries]
[43:13][Blackboard: Bubble Sort]
[47:36][handmade_render_group.cpp: Implement SortEntries as a Bubble Sort]
[50:47][Run the game and see that it might actually be right]
[51:51][handmade_world_mode.cpp: Give the GroundBuffer some zBias]
[52:48][handmade_world_mode.cpp: Turn off the GroundBuffer for now]
[53:08][Run the game and see that the sorting is working properly]
[53:59][handmade_world_mode.cpp: Increase the zBias and then apply the bias in the correct place]
[56:00][Run the game and see that it all works correctly now (apart from the torso being in front all the time)]
[56:28][Q&A]
[57:20][@Danyguag][Do you know the Vulkan release date?]
[57:56][@insobot][Well?]
[58:09][@grimjoey][Can you talk about pros and cons of heapsort and quicksort, and / or explain quaternions?]
[59:03][@evraire][Which sort are you planning to ultimately replace bubble sort with?]
[59:59][@Miblo][Bubble Sort is the simplest sort? I worked my way to doing a Selection Sort in my practices, so assume that must be down there for simplicity]
[1:00:41][@quikligames][n^2 is actually faster in most cases?]
[1:02:21][@angus_holder][Can't you just use binary insertion to put items into their correct position so the array is sorted the whole time? That way RenderGroupToOutput doesn't have to do anything]
[1:02:55][Blackboard: Sorting After vs Sorting During]
[1:05:31][@TheLagScript][Have you ever made something of this sort of a project before? When you stream, do you just do everything as you go, sort of "improv" coding, or do you do stuff off stream to prepare what you are actually going to code on stream?]
[1:07:07][@CFlickster][Are we going raid Shawn McGrath's stream tomorrow night after this one?]
[1:07:31][@slashac][How do you disable syntax highlight in Emacs while keeping comment and macro highlighted?]
[1:08:50][@TheLagScript][Is your Visual Studio "custom" theme anywhere? I really like it]
[1:09:54][Wrap it up]
[1:11:20][Shout out to HandmadeDev, who are building a community site for projects like Handmade Hero, with nicer forums]
[/video]