[video output=day625 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Fixing the \"Lighting\" Bug" vod_platform=youtube id=nIeqZzUPqp8 annotator=Miblo] [0:00][Welcome to the stream][:speech] [0:21][Look into our incorrect usage of _mm_blendv_ps() in the f32 version of SignOf()[ref site=Intel page="Intel Intrinsics Guide" url=https://software.intel.com/sites/landingpage/IntrinsicsGuide/]][:research :simd] [6:59][Fix the f32 SignOf() in :SIMD[ref site=Intel page="Intel Intrinsics Guide" url=https://software.intel.com/sites/landingpage/IntrinsicsGuide/]] [11:23][Hunt in vain for SignOrZero()][:research] [14:18][Determine to look at octahedral code to see if we're using SignOf() as SignOrZero()] [14:57][Fix compile errors in SignOf()] [15:16][Double-check our SignOf()][:research] [16:35][Update the f32_4x SignOf()][:simd] [19:53][Traverse the orphanage, and successfully provoke our :lighting bug][:run] [23:32][Exhibit our :lighting bug localised][:run] [23:47][Consider a possible :lighting quality improvement][:run] [25:16][Determine to investigate our :lighting bug][:run] [25:53][Try to provoke our :lighting bug in -Od][:run] [27:43][In -O2 our SpecValid and DiffuseValid values start at 0][:lighting :run] [28:11][Introduce ValidateTexel() and make BlockCopyAtlas() assert with ValidateAtlas()][:lighting] [31:17][Hit our top ValidateAtlas() assertion in BlockCopyAtlas()][:lighting :run] [32:46][Make SetLightAtlasTexels() assert with ValidateAtlas()][:lighting] [33:04][Never hit our assertion in SetLightAtlasTexels()][:lighting :run] [33:31][Use LIGHT_ATLAS_ASSERT() for our assertions][:lighting] [34:01][Hit none of our assertions][:lighting :run] [34:15][Try replacing LIGHT_ATLAS_ASSERT() with Assert() in BlockCopyAtlas()][:lighting] [34:49][Hit our ValidateAtlas() assertion in BlockCopyAtlas()][:lighting :run] [34:55][Replace Assert() with LIGHT_ATLAS_ASSERT() in BlockCopyAtlas()][:lighting] [35:06][Hit our ValidateAtlas() assertion in BlockCopyAtlas()][:lighting :run] [35:30][Describe our method for zeroing in on a bug, lacking a theory as to its source][:speech] [37:40][Plan our :lighting map validation][:research] [40:08][Make ComputeLightPropagationWork() assert with ValidateAtlas()][:lighting] [41:20][Hit our DiffuseAtlas assertion in ComputeLightPropagationWork() after FullCast()][:lighting :run] [42:07][Remove our ValidateAtlas() calls][:lighting] [42:34][Focus our :lighting map validation on FullCast()][:research] [44:53][Consult the chat for Japanese speakers][:speech] [45:12][@mas_ketta][Bikkuri shita!] [45:31][@drspectra][I mean it's 5:30 am in Japan] [45:55][@infinum][@handmade_hero How good is your Japanese?] [46:07][Request a link to Mr Yabatan making a hotpot, with his Dad on the phone[ref author="Mr Yabatan" title="お父さんと鍋パーティー!Nabe Party with my Dad!" publisher=YouTube url=https://www.youtube.com/watch?v=ogd5iVr4_cM]] [47:06][@thesandvichmaker][Foreigner meets Ramen 🍜 ラーメンで興奮する外国人![ref author="Mr Yabatan" title="Foreigner meets Ramen 🍜 ラーメンで興奮する外国人!" publisher=YouTube url=https://www.youtube.com/watch?v=k9EIo-J7WVY]] [48:11][@nestedmadness][@handmade_hero Talking about this?[ref author="Mr Yabatan" title="お父さんと鍋パーティー!Nabe Party with my Dad!" publisher=YouTube url=https://www.youtube.com/watch?v=ogd5iVr4_cM]] [48:42][Add ValidateAtlas() assertions in FullCast()][:lighting] [49:53][Hit our bottom SpecAtlas ValidateAtlas() assertion in FullCast()][:lighting :run] [50:16][Disable multithreading][:threading] [51:54][Try and hit our assertion in FullCast()][:lighting :run] [52:11][@mindmark42][I just checked the octrahedral paper.[ref title="Survey of Efficient Representations for Independent Unit Vectors" author="Zina H. Cigolle, Sam Donow, Daniel Evangelakos, Michael Mara, Morgan McGuire, Quirin Meyer" url=http://jcgt.org/published/0003/02/01/] It uses signNotZero()] [52:42][We hit our assertion in FullCast() single-threaded][:lighting :run :threading] [52:49][Focus our :lighting map validation on GridRayCast()][:research] [55:59][Request a reminder from chat to rerun the sphere generator][:speech] [56:22][Make GridRayCast() assert with ValidateTexel()][:lighting] [57:16][Hit our bottom 6th SpecAtlas ValidateTexel() assertion in GridRayCast()()][:lighting :run] [58:04][Fail to hit our assertion in -Od][:lighting :run] [58:44][Fail to hit our assertion in -O2, until hitting it on the bottom 7th SpecAtlas texel][:lighting :run] [59:46][Wonder if TransferPPS never gets initialised, causing our negative :lighting values][:research] [1:01:55][Make GridRayCast() initialise TransferPPS][:lighting] [1:02:13][Hit our bottom 7th SpecAtlas ValidateTexel() assertion in GridRayCast()][:lighting :run] [1:02:27][Scrutinise the TransferPPS values in GridRayCast()][:lighting :research] [1:04:48][Make GridRayCast() assert TransferPPS with ValidateTexel()][:lighting] [1:05:22][Hit our 1st TransferPPS ValidateTexel() assertion in GridRayCast()][:lighting :run] [1:05:55][Make GridRayCast() assert TransferPPS with ValidateTexel() upon setting it][:lighting] [1:06:35][Exhibit our :lighting bug without hitting an assertion, before hitting the TransferPPS one][:run] [1:07:42][Scrutinise our TransferPPS computation in GridRayCast()][:lighting :research] [1:10:01][Try to make GridRayCast() assert TransmissionLevel and HitRefColor with ValidateTexel()][:lighting] [1:10:50][Scrutinise our TransmissionLevel and HitRefColor computations in GridRayCast()][:lighting :research] [1:12:01][Introduce an f32_4x version of ValidateTexel()][:lighting] [1:14:04][Hit our 0th HitRefColor ValidateTexel() assertion in GridRayCast()][:lighting :run] [1:14:34][Scrutinise our HitRefColor computations in GridRayCast()][:lighting :research] [1:16:21][Make GridRayCast() assert HitRefColor with ValidateTexel() upon initialisation][:lighting] [1:16:32][Hit our TransferPPS ValidateTexel() assertion in GridRayCast() upon setting it][:lighting :run] [1:16:59][Make GridRayCast() assert HitRefColor with ValidateTexel() upon setting TransferPPS][:lighting] [1:17:10][Hit our 0th HitRefColor ValidateTexel() assertion in GridRayCast()][:lighting :run] [1:17:24][Scrutinise our HitRefColor usage in GridRayCast()][:lighting :research] [1:18:15][Make GridRayCast() assert Leaf.RefColor with ValidateTexel()][:lighting] [1:18:41][Hit our 0th Leaf.RefColor ValidateTexel() assertion in GridRayCast()][:lighting :run] [1:21:28][Focus our :lighting map validation on GridBuildSpatialPartition()][:research] [1:23:51][Make GridBuildSpatialPartition() assert Leaf.RefColor with ValidateTexel()][:lighting] [1:25:20][Hit our 0th Leaf.RefColor ValidateTexel() assertion in GridBuildSpatialPartition()][:lighting :run] [1:25:23][Make GridBuildSpatialPartition() clear the SpatialGridLeaves][:lighting :memory] [1:25:59][Hit our 0th Leaf.RefColor ValidateTexel() assertion in GridBuildSpatialPartition()][:lighting :run] [1:26:06][Fix parentheses of ZeroArray()][:memory] [1:26:37][Assert in GridBuildSpatialPartition() that we are in bounds][:lighting] [1:27:38][Do not hit our bounds-checking assertion in GridBuildSpatialPartition()][:lighting :run] [1:27:41][Make GridBuildSpatialPartition() assert Leaf.RefColor with ValidateTexel() upon initialisation][:lighting] [1:28:28][Do not hit our Leaf.RefColor initialisation assertion in GridBuildSpatialPartition()][:lighting :run] [1:28:32][Make GridBuildSpatialPartition() assert Leaf.RefColor with ValidateTexel() after fill-in][:lighting] [1:28:44][Hit our 0th Leaf.RefColor ValidateTexel() assertion in GridBuildSpatialPartition() after fill-in][:lighting :run] [1:28:48][Make GridBuildSpatialPartition() assert Leaf.RefColor with ValidateTexel() around their setting][:lighting] [1:30:06][Hit our 0th Leaf.RefColor ValidateTexel() assertion in GridBuildSpatialPartition() after setting][:lighting :run] [1:30:51][Make GridBuildSpatialPartition() assert Box->RefC with ValidateTexel()][:lighting] [1:31:28][Hit our Box->RefC ValidateTexel() assertion in GridBuildSpatialPartition()][:lighting :run] [1:32:20][Focus our validation on PushCube(), PushOccluder() and PushLight()][:lighting] [1:35:57][Hit our Box->RefC ValidateTexel() assertion in GridBuildSpatialPartition(), but none of the ones upstream][:lighting :run] [1:38:15][Scrutinise our upstream Box->RefC code][:lighting :research] [1:41:42][@codeslasher][@handmade_hero You are missing an assert in PushOccluder()][:lighting] [1:41:47][Make PushCube(), PushOccluder() and PushLight() assert Box->RefC with ValidateTexel()][:lighting] [1:42:20][Hit our Hit our ValidateAtlas() assertion in BlockCopyAtlas()][:lighting :run] [1:42:32][Hit our Box->RefC ValidateTexel() assertion in PushOccluder()][:lighting :run] [1:46:09][#if 0 out the Tag_Ghost indexing into MatchVector.E in UpdateAndRenderEntities()][:"entity system"] [1:48:10][Try to provoke our "lighting" bug][:lighting :run] [1:49:56][#define ValidateTexel() as VALIDATE_TEXEL()][:lighting] [1:53:17][:Run successfully][:lighting] [1:53:29][Re-enable multithreading][:lighting :threading] [1:53:44][:Run successfully][:lighting] [1:56:17][Reflect on our indexing bug, and our pincering method for debugging][:speech] [1:57:25][Make VALIDATE_TEXEL() self-assert, and #define ValidateAtlas() as VALIDATE_TEXEL_ATLAS()][:lighting] [1:59:33][:Run successfully][:lighting] [1:59:48][#define out LIGHT_ATLAS_ASSERT()][:lighting] [1:59:53][:Run successfully][:lighting] [2:00:18][Determine to improve the :lighting :filtering][:run] [2:00:48][Compile and invoke hhsphere][:admin :lighting] [2:03:05][Rebuild and :run the game][:lighting] [2:04:05][Make UpdateLighting() decrease tUpdateBlend from 8/60 to 1/60][:lighting] [2:04:48][Our :lighting is smoother but slower to update][:run] [2:05:23][Make UpdateLighting() increase tUpdateBlend from 1/60 to 4/60][:lighting] [2:05:37][Our :lighting is quicker to update, but doesn't propagate evenly][:run] [2:06:22][Q&A][:speech] [2:06:37][@mindmark42][Q: Is it only me or does the :lighting seem brighter with the blendv_ps fix?] [2:07:34][@piggybankstudios][Q: Is there a way to test my GLSL shader compilation success / failure on other GPUs without actually having to buy a bunch of GPUs myself?][:hardware] [2:08:25][@x13pixels][Whoa. Godbolt for shaders][:hardware] [2:09:41][@mmozeiko][There is Shader Playground[ref site="Shader Playground" url=http://shader-playground.timjones.io/] but that's only for shader libraries (parser / validation / some codegen), not using actual drivers to compile][:hardware] [2:10:09][@lederr][(Viewbot #420) MrDestructoid Hello Mr. Teapot, I am here to "view" your channel as was previously discussed] [2:10:26][Consider :lighting improvements][:speech] [2:11:46][@chepubelie][Q: Are you planning to release Star Code Galaxy[ref site="Star Code Galaxy" url=https://starcodegalaxy.com] this year? Will this project be like a [~hero Handmade Hero] where you make usage code first and everything from scratch?] [2:12:25][@1diogosantana][Are you in a tent?] [2:12:38][@tarriest_python][Q: Anyone know what browser [@cmuratori Casey] is using? I don't recognise it] [2:12:54][Thank you for joining][:speech] [/video]