[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="XBox Controller Stalls and Fixing GL Blit Gamma" vod_platform=youtube id=FRzg9eYHnTw annotator=Miblo] [0:08][Hype 4coder 4.0.2 super] [2:36][Recap and set the stage for the day] [3:09][Run the game and view the current state of the profiler] [4:52][handmade_debug.cpp: Review the profiling code] [8:40][handmade_debug.cpp: Note that we are using the EndClock value before it's been written] [9:33][handmade_debug.cpp: Compute that Duration in CollateDebugRecords and correctly set the ClockBasis] [11:31][Run the game and view our more plausible profile result] [12:44][handmade_debug.cpp: Reenable and rewrite the text on hover] [13:38][Run the game and view this text on hover] [14:39][Blackboard: Pointer alignment and random picking from an array] [17:06][handmade_debug.cpp: Make the Colors array be a non-multiple of four] [17:47][Run the game and see our different zones in the profiler] [19:13][handmade_render_group.cpp: Add SortBias to the object_transform so the SortKey automatically takes it into account] [20:38][On writing TODOs][quote 431] [22:13][handmade_debug.cpp: Introduce Transforms in DEBUGTextOp] [23:51][Run the game and note that our problem hasn't been fixed] [24:13][handmade_debug.h: Add Transforms to the debug_state] [25:55][handmade_debug.cpp: Initialise the Transforms in DEBUGStart] [26:58][handmade_debug.cpp: Pass BackingTransform to the PushRect calls in DrawProfileIn] [28:27][Run the game and view our profiler] [29:31][Blackboard: What the profiler is showing us may be happening after the point SwapBuffers is called] [34:18][Point out how useful profiling is] [36:43][win32_handmade.cpp: Investigate what's happening in our input processing] [39:53][Run the game and note that we need the ability to narrow in on a profile region] [40:42][win32_handmade.cpp: Comment out the "Input Processing" block] [41:06][Run the game and discover that the XBox controllers are taking 2,000,000 cycles to poll] [41:54][Describe and consider how to work around a well-known XInputGetState bug when polling XBox controllers] [45:45][win32_handmade.cpp: Introduce XBoxControllerPresent, assume they're all plugged in at startup and stop polling for them when we realise they're not] [48:44][Run the game and see none of that controller polling nonsense] [50:05][Discover that the software renderer does not draw the profiler properly] [51:24][handmade_opengl.cpp: Make glTexImage2D take GL_SRGB8_ALPHA8] [52:45][Run the game and see that that was the problem] [53:40][Explain how gamma is treated in the renderer] [55:31][Note that we need to reserve one texture at startup in case we would like to do OpenGL bitmap display] [56:18][Demo the bug with switching between the renderers] [57:27][win32_handmade.cpp: Introduce OpenGLReservedBlitTexture and set one of them Win32InitOpenGL] [58:57][Run the game and see that we now no longer have that bug, but do have a bug with pixel centers for the fonts] [1:00:40][Q&A] [1:01:08][@cmuratori][@insobot What do you think of Microsoft's Tay bot?] [1:01:22][insobot @cmuratori Oh wow. I guess i should say? Wow, thought i came] [1:01:30][@garlandobloom][Q: Can't remember what OpenGL considers the center of the pixel...?] [1:02:50][@jameswidman][Is romp just a synonym for clobber?] [1:02:56][@zargy][Will the opening cutscene be narrated?] [1:03:12][@erdomina][Could you elucidate further on the waiting for VSync in the profiler?] [1:05:42][@cubercaleb][I actually prefer the fonts that the software renderer produces. Is there anything we can do to make them look that way in GL?] [1:06:36][@lailynn7][Recommended entry-level programming language for aspiring game devs?] [1:10:54][@longboolean][Is there anything that can be done to help make it easier to hover / click on the debug visualization?] [1:12:06][insobot @popcorn0x90 You can implement most of it, replacing most of] [1:12:13][@ginger_bill][Are all the textures transferred every frame?] [1:14:40][@cubercaleb][In the debug UI will we be able to click on a frame and have it blit that frame?] [1:15:42][@xxmyrrdinxx][Could you explain in what consist the dynamic resolution? Texture rescale, viewport rescale?] [1:16:16][@dudeinbasement1][Are we going to have it auto-pause on long frames?] [1:16:38][@hwd2ro][What about checking for memory leaks?] [1:17:38][@zach211w][At what point would you make the transition from a more basic language like JavaScript over to a language like C?] [1:21:55][@dudeinbasement1][Sorry, have a fail-safe to see when we stutter to pause the system and debug it] [1:23:05][Close] [1:24:02][Promote 4coder] [/video]