Index hero/code597

This commit is contained in:
Matt Mascarenhas 2020-04-29 02:23:55 +01:00
parent 02a1c87a3a
commit 645c07389b
1 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,72 @@
[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Basic Kd-tree Construction" vod_platform=youtube id=OzoG0cuV5_A annotator=Miblo]
[0:01][Recap our Snuffleupagus oriented k-d tree implementation, and set the stage for the day][:"data structure" :lighting :speech]
[2:04][Introduce SplitKd() to replace SplitBox()][:"data structure" :lighting]
[2:52][Determine to divide up the :lighting box hierarchy the same as before][:"data structure" :research]
[3:54][Note that the current splitting code allows overlapping rectangles][:"data structure" :lighting :research]
[8:03][Begin to change RayCast() to handle overlapping rectangles][:"data structure" :lighting]
[10:30][Undo our changes to RayCast()][:"data structure" :lighting]
[11:43][Begin to make RayCast() use the FirstLeafIndex to permit overlapping rectangles][:"data structure" :lighting]
[14:43][Undo our changes to RayCast()][:"data structure" :lighting]
[15:05][Implement SplitKd() to split boxes in half along the k-d axis][:"data structure" :lighting]
[32:35][Consider packing the FirstLeafIndex, LeafCount and KdIndex into the Sides value][:"data structure" :lighting :research]
[33:54][Make SplitKd() pack the FirstLeafIndex, LeafCount and KdIndex into the Sides value][:"data structure" :lighting]
[38:37][Permit SplitKd() to push U16Max KdNodes, and clean up compile errors][:"data structure" :lighting]
[41:20][Enable SplitKd() to perform the actual split, adding to both sides if we split down the middle][:"data structure" :lighting]
[51:02][Make BuildSpatialPartitionForLighting() call SplitKd(), defining a LIGHTING_USE_OLD_KD switch][:"data structure" :lighting]
[53:50][:Run hhlightprof successfully with the old k-d way][:"data structure" :lighting]
[54:17][Toggle off LIGHTING_USE_OLD_KD and fix compile errors, augmenting lighting_solution with a RootKdValue][:"data structure" :lighting]
[56:54][:Run hhlightprof and hit a read access violation][:"data structure" :lighting]
[57:09][:Run hhlightprof and hit a read access violation on the KdNodes][:"data structure" :lighting]
[57:26][Make ProfileRun() allocate space for the KdNodes][:"data structure" :lighting :memory]
[58:29][:Run hhlightprof and apparently infinitely loop on SplitKd()][:"data structure" :lighting]
[59:10][Remove FirstLeafIndex, LeafCount and KdIndex from kd_tree_node, storing the KdIndex in the Sides value and introducing UNPACK_NEXT_KD_INDEX()][:"data structure" :lighting]
[1:05:12][Scour SplitKd() for bugs][:"data structure" :lighting :research]
[1:09:43][Step through SplitKd() to our feedback loop situation, and inspect the values][:"data structure" :lighting :run]
[1:12:36][~RemedyBG feature request: User-programmable data type watch summary / representation][:admin]
[1:18:38][Again step through SplitKd() and inspect the BoxBounds][:"data structure" :lighting :run]
[1:20:33][Enable SplitKd() to handle non-split leaves][:"data structure" :lighting]
[1:22:39][:Run hhlightprof without crashing][:"data structure" :lighting]
[1:22:53][Step through RayCast() and inspect its values, until hitting a write access violation][:"data structure" :lighting :run]
[1:25:20][:Run hhlightprof without completing the first ray cast pass][:"data structure" :lighting]
[1:26:13][Again step through RayCast() and inspect its values][:"data structure" :lighting :run]
[1:27:43][:Run hhlightprof in -O2 to completion of the first ray cast pass][:"data structure" :lighting]
[1:29:11][Switch to -Od and toggle on LIGHTING_USE_OLD_KD][:"data structure" :lighting]
[1:29:24][:Run hhlightprof to completion][:"data structure" :lighting]
[1:29:35][Toggle off LIGHTING_USE_OLD_KD][:"data structure" :lighting]
[1:29:45][Scour RayCast() for bugs][:"data structure" :lighting :research]
[1:30:43][Try restricting RayCast() to only traverse down the StartSide][:"data structure" :lighting]
[1:31:04][:Run hhlightprof to (non-instant) completion][:"data structure" :lighting]
[1:31:11][Continue to scour RayCast() for bugs][:"data structure" :lighting :research]
[1:32:37][:Run hhlightprof in -O2][:"data structure" :lighting]
[1:33:00][Make RayCast() increment the TotalPartitionsTested before pushing on the StartSide][:"data structure" :lighting]
[1:33:40][:Run hhlightprof in -O2][:"data structure" :lighting]
[1:33:56][Toggle on LIGHTING_USE_OLD_KD][:"data structure" :lighting]
[1:34:08][:Run hhlightprof to find that the new k-d implementation tests many more leaves][:"data structure" :lighting]
[1:34:53][Toggle off LIGHTING_USE_OLD_KD][:"data structure" :lighting]
[1:36:08][Try making SplitKd() build a more usable k-d tree][:"data structure" :lighting]
[1:38:15][:Run hhlightprof without completing][:"data structure" :lighting]
[1:38:41][Make ProfileRun() print out the KD Mode][:"data structure" :lighting]
[1:41:15][:Run hhlightprof][:"data structure" :lighting]
[1:41:21][Toggle on LIGHTING_USE_OLD_KD][:"data structure" :lighting]
[1:41:35][:Run hhlightprof to see that the new k-d implementation does not add many more leaves][:"data structure" :lighting]
[1:41:49][Scour RayCast() for bugs][:"data structure" :lighting :research]
[1:43:21][Try preventing RayCast() from descending the tree][:"data structure" :lighting]
[1:43:27][Old k-d hhlightprof leaves tested: 496197][:"data structure" :lighting :run]
[1:43:55][Toggle off LIGHTING_USE_OLD_KD][:"data structure" :lighting]
[1:44:09][New k-d hhlightprof leaves tested: 5773056][:"data structure" :lighting :run]
[1:45:10][Step through RayCast() in -Od to find 32 unsplit leaves][:"data structure" :lighting :run]
[1:46:24][Scour SplitKd() for bugs][:"data structure" :lighting :research]
[1:50:14][Try making SplitKd() split boxes that are on the PlaneD][:"data structure" :lighting]
[1:51:02][Step through SplitKd() to find that almost all boxes straddle the centre of the bounds][:"data structure" :lighting :run]
[1:53:09][Scour BuildSpatialPartitionForLighting() and SplitKd() for bugs][:"data structure" :lighting :research]
[1:55:11][Step through SplitKd() to find a 35 unit long box][:"data structure" :lighting :run]
[1:56:17][Scour ProfileRun() for bugs in transforming the box bounds][:"data structure" :lighting :research]
[1:57:22][Continue to step through SplitKd() to find identical BoxMax values for all boxes][:"data structure" :lighting :run]
[1:58:25][Step through the box bounds transformation in ProfileRun(), and on to SplitKd()][:"data structure" :lighting :run]
[2:01:48][Realise we incorrectly index into the Box, thanks to ~RemedyBG][:"data structure" :lighting :run]
[2:02:56][Fix SplitKd() to index into the Box using DimIndex rather than KdIndex][:"data structure" :lighting]
[2:03:19][:Run hhlightprof in -Od][:"data structure" :lighting]
[2:03:44][-O2 k-d hhlightprof leaves tested: 375920][:"data structure" :lighting :run]
[2:04:18][Let RayCast() traverse the whole tree][:"data structure" :lighting]
[2:04:32][:Run hhlightprof until… the heat death of the universe?][:"data structure" :lighting]
[/video]