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

50 lines
4.2 KiB
Plaintext
Raw Normal View History

[video output=day306 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Debugging Graph-based Sort" vod_platform=youtube id=bMjnXBR98UY annotator=Miblo]
[0:11][Recap and set the stage for the day]
[1:40][Run the game and see the current state]
[3:51]["Let's use the word "evolucent""][quote 497]
[4:06][handmade_render_group.cpp: Make PushRenderElement_() take and set the ScreenArea]
[5:01][handmade_render_group.cpp: Make PushRect() set the ScreenArea]
[6:54][handmade_render_group.cpp: Make PushBitmap() set a provisional ScreenArea for the sprite]
[8:10][Blackboard: The ScreenArea for Regular vs Rotated Sprites]
[11:51][handmade_render_group.h: Add ScreenArea to render_group and make Clear() take it]
[17:03][handmade_render_group.cpp: Make Perspective() set the ScreenArea]
[18:15][Debugger: Run the game, crash in BuildSpriteGraph() and inspect the ScreenArea values]
[20:18][handmade_render_group.cpp: Look through GetRenderEntityBasisP() and note that NearClipPlane is set so that 0 is clipped out]
[20:59][Debugger: Inspect the values of B]
[21:48][handmade_render_group.cpp: Assert in PushRenderElement_() that GetArea(ScreenArea) < 2000 * 2000]
[23:28][handmade_math.h: Introduce GetArea()]
[24:36][Debugger: Run the game and hit that assertion, then step out and see who called that function]
[26:13][handmade_render_group.cpp: Comment out that assertion, run the game and look at the actual bug]
[26:28][handmade_render.cpp: Reenable the PushStuct() call in SortEntries()]
[26:54][Run the game and see that we're running incredibly slowly]
[27:27][handmade_render.cpp: Make BuildSpriteGraph() and WalkSpriteGraph() a TIMED_FUNCTION]
[27:58][build.bat: Switch to -O2]
[28:24][Run the game and realise that we can't see the debug display because it isn't sorted correctly]
[29:06][build.bat: Switch back to -Od]
[29:52][Run the game and see that we're getting some pretty non sequitur results]
[30:46][handmade.cpp: Switch back to the title sequence in order to see how the sorting routine performs on these]
[31:43][Note that the drop shadow of the text is being sorted incorrectly]
[33:42][handmade_cutscene.cpp: Try and scramble the order of the first scene's layers]
[34:22][Run the game and see that the scene is now incorrectly sorted]
[35:25][Debugger: Break into BuildSpriteGraph() and inspect the values for A and B]
[35:56][handmade_render.cpp: Prevent BuildSpriteGraph() from comparing NodeIndexA with itself]
[36:51][Debugger: Break into BuildSpriteGraph() and see that A and B are now different]
[38:50][Debugger: Step through BuildSpriteGraph() and see if it behaves as expected]
[41:03][Debugger: Step through WalkSpriteGraph() and RecursiveFromToBack() and see if they behave as expected]
[45:37][Debugger: Step through OpenGLRenderCommands() and inspect the SortedIndices array]
[47:09][handmade_cutscene.cpp: Make RenderLayeredScene() DebugTag the cutscene layers]
[50:34][Debugger: Run the game, step through BuildSpriteGraph() and RecursiveFromToBack() and watch the DebugTag values]
[52:30][handmade_cutscene.cpp: Revert the cutscene layers to their original order]
[52:55][Debugger: Step through RecursiveFromToBack(), watch the DebugTag values and confirm that the code is doing what we think it is doing]
[54:27][handmade_render.cpp: Look through how the sort_sprite_bound flows through the functions]
[56:50][handmade_cutscene.cpp: Note the reason why the cutscene was sorting as it was]
[58:12][handmade_world_mode.cpp: Make UpdateAndRenderWorld() only generate one screen and disable the Monstar]
[1:00:18][handmade_world_mode.cpp: Prevent AddStandardRoom() from calling BeginGroundedEntity()]
[1:00:36][Run the game and hit the Assert in OpenGLRenderCommands() because ClipRectCount == 0]
[1:01:39][Debugger: Investigate how we ended up with no ClipRects]
[1:05:27][handmade_render_group.cpp: Make BeginRenderGroup() rather than Perspective() take the PixelWidth and PixelHeight in order to compute the ScreenArea, and call PushClipRect()]
[1:09:26][handmade_world_mode.cpp: Make AddStandardRoom() create one tile]
[1:09:57][Run the game and see that our sort appears to handle our Y-sprites just fine, but that our Z-sprites are all messed]
[1:10:32][Defer questions until Monday and end it now][:speech]
[/video]