2020-05-09 20:59:36 +00:00
[video output=day507 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="LRU Texture Handle Reuse" vod_platform=youtube id=N882oz3Kv2A annotator=Miblo]
2018-12-20 23:07:26 +00:00
[0:00][Set the stage for an unannounced day mopping up issues[ref
site=GitHub
page="HandmadeHero / cpp"
url=https://github.com/HandmadeHero/cpp/issues]][:speech]
[1:47][Watch the cutscene for incorrect :rendering][:run]
[5:51][Watch the cutscene for a second time, considering that we have a texture transfer problem][:rendering :run]
[6:57][Refamiliarise ourselves with the texture transfer code][:hardware :rendering :research]
[14:50][Consult docs.GL on glTexImage3D[ref
site=docs.GL
page=glTexImage3D
url=http://docs.gl/gl3/glTexImage3D] and glPixelStore[ref
site=docs.GL
page=glPixelStore
url=http://docs.gl/gl3/glPixelStore]][:hardware :rendering :research]
[18:44][Consider instrumenting OpenGLManageTextures() and watch the cutscene to see our :rendering artifacts at different places][:hardware :rendering :run]
[21:54][Watch the cutscene under NSight][:hardware :rendering :run]
[24:36][Capture a frame during our glitch and inspect the textures][:hardware :rendering :run]
[28:48][Investigate whether or not we are properly reserving our texture transfer :memory][:hardware :rendering :research]
[37:45][Circular buffer usage cases][:blackboard :memory]
[42:05][Fix our circular buffer usage in BeginTextureOp(), replacing TransferMemoryUsedCount with TransferMemoryLastUsed in renderer_texture_queue][:memory :rendering]
[51:04][Watch the cutscene to see no texture transfer errors first time round][:hardware :memory :rendering :run]
[54:52][Find that the cutscene is busted second time round][:hardware :memory :rendering :run]
[56:40][Address the "Check z coordinates of cutscene" issue[ref
site=GitHub
page="HandmadeHero / cpp / Check z coordinates of cutscene"
url=https://github.com/HandmadeHero/cpp/issues/39]][:research]
[59:09][Make RenderCutsceneAtTime() start the cutscene at scene 6]
[1:00:17][Increase the Z of scene 6's fourth layer from -3.0 to -2.9]
[1:00:33][See fearful tears appear, and close that issue[ref
site=GitHub
page="HandmadeHero / cpp / Check z coordinates of cutscene"
url=https://github.com/HandmadeHero/cpp/issues/39]][:admin :run]
[1:01:29][Texture handle recycling][:"asset system" :memory :research]
[1:06:29][Implement least-recently-used (LRU) texture handle recycling in GetBitmap()][:"asset system" :memory]
[1:24:34][Initialise our LRU texture handle lists in AllocateGameAssets(), and introduce AcquireTextureHandle()][:"asset system" :memory]
[1:39:56][Watch the cutscene to find that our new LRU texture handle recycling has solved our problem][:"asset system" :memory :run]
[1:46:26][Close the "Add texture handle recycling to asset system" issue[ref
site=GitHub
page="HandmadeHero / cpp / Add texture handle recycling to asset system"
url=https://github.com/HandmadeHero/cpp/issues/79]][:admin :"asset system" :memory]
[1:47:00][Fix S32FromZ() to use the Ignored pointer[ref
site=GitHub
page="HandmadeHero / cpp / S32FromZ unused variable by mistake (minor)"
url=https://github.com/HandmadeHero/cpp/issues/40]]
[1:48:11][Close the "S32FromZ unused variable by mistake (minor)" issue[ref
site=GitHub
page="HandmadeHero / cpp / S32FromZ unused variable by mistake (minor)"
url=https://github.com/HandmadeHero/cpp/issues/40]]
[1:48:42]["Sign extension bug" issue[ref
site=GitHub
page="HandmadeHero / cpp / Sign extension bug"
url=https://github.com/HandmadeHero/cpp/issues/50]][:language :research]
[1:52:25][Step in to Win32ProcessPendingMessages() to see the sign extension occurring in the disassembly][:asm :language :run]
[1:53:00][Prevent IsDown in Win32ProcessPendingMessages() from being sign extended][:language]
[1:53:20][Step in to Win32ProcessPendingMessages() to see that sign extension no longer occurs][:asm :language :run]
[1:56:23][Close the "Sign extension bug" issue[ref
site=GitHub
page="HandmadeHero / cpp / Sign extension bug"
url=https://github.com/HandmadeHero/cpp/issues/50]][:admin :language]
[1:56:58]["Can still call OpenGL.DebugLightBufferTexIndex / OpenGL.DebugLightBufferIndex in release mode" issue[ref
site=GitHub
page="HandmadeHero / cpp / Can still call OpenGL.DebugLightBufferTexIndex / OpenGL.DebugLightBufferIndex in release mode"
url=https://github.com/HandmadeHero/cpp/issues/71]][:research]
[1:57:52][Remove DebugLightBufferIndex and DebugLightBufferTexIndex from the open_gl struct]
[1:58:17][Close that issue[ref
site=GitHub
page="HandmadeHero / cpp / Can still call OpenGL.DebugLightBufferTexIndex / OpenGL.DebugLightBufferIndex in release mode"
url=https://github.com/HandmadeHero/cpp/issues/71]][:admin]
[1:58:54]["Avoid hard dependency on OpenGL 4.2 (glTexStorage3D)" issue[ref
site=GitHub
page="HandmadeHero / cpp / Avoid hard dependency on OpenGL 4.2 (glTexStorage3D)"
url=https://github.com/HandmadeHero/cpp/issues/77]][:api :research]
[1:59:34][Make OpenGLInit() pass 0 as the level to the glTexImage3D() call][:api :hardware :rendering]
[2:00:08][Find that that works][:api :hardware :rendering :run]
[2:00:48][Close that issue[ref
site=GitHub
page="HandmadeHero / cpp / Avoid hard dependency on OpenGL 4.2 (glTexStorage3D)"
url=https://github.com/HandmadeHero/cpp/issues/77]][:admin :api :hardware :rendering]
[2:02:02][Q&A][:speech]
[2:02:54][@davechat][Q: Does ~4coder support indenting of shader code yet?]
[2:04:19][@bryanwwag][Q: Personally I've only ever used LRU caches. Have you ever used LFU, and has it worked well?][:memory]
[2:05:03][@bryanwwag][(least frequently used)[ref
site=Wikipedia
page="Cache replacement policies"
url=https://en.wikipedia.org/wiki/Cache_replacement_policies#Least-frequently_used_(LFU)]][:memory]
[2:11:05][@bryanwwag][LFU has more overhead than LRU. More accounting, but statistically it supposedly converges to the same expected values][:memory]
[2:12:26][Custom emotes][:art :speech]
[2:14:07][@mint_spider][Q: Owl of Shame emote, Pig Hat emote for starters]
[2:14:58][@thebirkisreal][Q: Go look at the Handmade Network discord's emotes]
[2:15:02][@garryjohanson][Q: [@naysayer88 Jon Blow]'s face]
[2:15:17][@se5a1][Lemongrab]
[2:15:57][Wrap it up][:speech]
[/video]