[video output=day234 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Implementing Radix Sort" vod_platform=youtube id=jhGDPoSLJMo annotator=Miblo] [0:47][Recap and set the stage for the day] [1:22][handmade_render_group.cpp: Pull out the BubbleSort functionality into its own function] [2:40][Struggle with the headphone cable] [3:49]["I'm still being oppressed by The Cable Man"][quote 349] [3:55][Blackboard: Radix sort] [4:42][Blackboard: "Stable sort"] [9:54][Blackboard: "Some number of successive stable sorts on some part of the sort key"] [22:04][Blackboard: 8-bits] [22:44][Blackboard: How radix sort works] [27:34][handmade_render_group.cpp: Introduce RadixSort] [39:22][handmade_render_group.cpp: Introduce SortKeyToU32][quote 350] [39:43][Run the game and hit an assertion] [40:04][Debugger: Step through RadixSort and inspect Dest, First and Temp] [40:57][Blackboard: 32-bit IEEE float] [45:37][Debugger: Step into SortEntries and inspect Entries] [49:05][handmade_render_group.cpp: Cast to SortKey to u32] [49:25][Debugger: Inspect the casted Entries] [51:30][handmade_render_group.cpp: Consider inverting the meaning of the bits] [52:15][Blackboard: On flipping the bits] [53:03][handmade_render_group.cpp: Set Result = ~Result in SortKeyToU32] [53:45][Debugger: Step into SortKeyToU32 and inspect Result] [55:39][handmade_render_group.cpp: Feed some basic values to SortEntries and inspect them] [1:00:41][Baby Owl of Shame Moment: We need to iterate on the ByteIndex in eights] [1:01:33][Run the game and see that it works now] [1:02:26][Q&A][:speech] [1:02:54][@ratchetfreak][Why didn't you build merge sort from the bottom up? It makes ping-ponging the buffers much easier] [1:03:56][@fod669][Your radix sort looks like it's O(8n) because you're doing two passes over the list per byte. Couldn't you make it O(5n) by getting all the offsets / counts in one pass at the cost of 3 more 256 element arrays?] [1:06:19][@elxenoaizd][Off-topic: I'm a bit confused about axis-angle rotations vs quaternion rotations. I thought quaternions do represent an angle and axis of rotation. What's the difference?] [1:07:05][Blackboard: "Euler angles"] [1:08:29][Blackboard: "axis / angle"] [1:09:12][Blackboard: "quaternion"] [1:10:17][Blackboard: "exp map"] [1:11:53][@insofaras][I noticed the frame times are growing quite large now. Are you planning to optimize the software renderer further or switch to a hardware accelerated scheme?] [1:12:25][win32_handmade.cpp: Switch down to 960x540, disable the debug system and run the game] [1:14:13][Shut down the stream][:speech] [/video]