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

53 lines
4.5 KiB
Plaintext

[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Optimizing Render Target Blends and Clears" vod_platform=youtube id=HB4Dl8NyE2Q annotator=Miblo]
[0:40][Run the game and set the stage for the day]
[1:55][handmade_render.cpp: Accelerate BlendRenderTarget() with SIMD instructions]
[11:06][Run the game and see that it's fine]
[11:40][handmade_render.cpp: Introduce ClearRectangle() based on BlendRenderTarget(), and make RenderCommandsToBitmap() call it]
[18:21][Run the game and see how that does]
[19:27][build.bat and win32_handmade.cpp: Switch to -Od and disable threading in order that we can step in to the code]
[21:13][Debugger: Step in to ClearRectangle() and inspect the Color values]
[22:10][handmade_render.cpp: Make ClearRectangle() correctly compute those Color values]
[23:46][Debugger: Step in to ClearRectangle() and inspect the Sr values]
[25:05][Blackboard: Operating on reciprocal square-root of X in such a way that we end up with the square-root]
[26:38][handmade_opengl.cpp: OpenGLRenderCommands() glClearColor()]
[27:51][Internet: Consult the EXT_framebuffer_sRGB documentation[ref
site="OpenGL"
page="EXT_framebuffer_sRGB"
url="https://www.opengl.org/registry/specs/EXT/framebuffer_sRGB.txt"]]
[28:15][handmade_render.cpp: Make ClearRectangle() operate in linear space, not gamma space]
[29:08][Run the game and see that we're a little better]
[29:55][handmade_render.cpp: Revert ClearRectangle() to operate in gamma space, and investigate why the clear color is not correct]
[31:59][handmade_render.cpp: Make BlendRenderTarget() use the SourceColor in the blend]
[35:09][Run the game and see that the alpha blending now works]
[35:41][handmade_entity.cpp: Make UpdateAndRenderEntities() draw the traversables at their full size]
[36:42][handmade_render.cpp: Investigate why the hero's body isn't being skewed correctly in the software renderer]
[37:43][Run the game and demo the incorrect bending]
[38:44][handmade_render.cpp: Trim out some superfluous stuff from DrawRectangleQuickly()]
[42:01][Run the game and demo our bugs]
[42:58][Debugger: Look through ClearRectangle() and consider what could be going wrong]
[47:10][handmade_render.cpp: Make ClearRectangle() set the Color values in the 65534 space]
[47:23][Run the game, see how close we are and wonder why we suddenly see pink upon switching back to the software renderer]
[48:17][handmade_opengl.cpp: Prevent OpenGLDisplayBitmap() from doing the blending]
[49:03][Run the game and see that we're good to go]
[50:37][handmade_render.cpp: Investigate why DrawRectangleQuickly() is not bending the hero correctly]
[57:12][handmade_render.cpp: Remove extraneous initialisations from DrawRectangleQuickly()][quote 515]
[58:52][Blackboard: Doing the dot-product on unit vectors vs vectors with length]
[1:00:54][Blackboard: Doing that in a non-orthogonal coordinate space]
[1:02:08][Q&A][:speech]
[1:02:37][@krrsplat][Earlier when that pink color showed up, that was the color you used long long ago when you were setting up the OpenGL renderer]
[1:02:56][Blackboard: Why we were seeing the pink]
[1:04:48][@thesizik][Are the PynX and V calculations correct?]
[1:05:16][@krrsplat][As far as the vectors go for movement, can you just add U and V to get the new movement?]
[1:05:34][@bryanwwag][Could normal maps be render targets here with appropriate enums / branching to blend / light, or do they still belong outside of the current render targets array?]
[1:06:14][@realist_01][Do you think you could transform this game into a network game that multiple players can have different kinds of character assets, and, if yes, will you consider doing it?]
[1:06:41][@thesizik][As in, it looked like there might be an X-Y swap in those two variables]
[1:07:20][@bryanwwag][Makes sense, I'm comparing it to deferred rendering, which I'm no expert on]
[1:08:27][@realist_01][You should do networking. You could charge for extra items or levels, etc. continuously, thus making you a "reliable" stream of money]
[1:08:37][@thesizik][I mean you used an X variable when you meant a Y variable]
[1:10:26][Blackboard: Inverting the matrix to solve for UV coordinates]
[1:13:30][@vorpleblade][What is the blackboard software you are using?]
[1:13:41][@realist_01][Nub3sock asked if you would consider local multiplayer]
[1:14:29][@Miblo][Speaking of normal maps, could we have used those to help sort the sprites? I know they don't give you 3D data, but is there anything in there that we could leverage?]
[1:16:45][Wrap it up][:speech]
[/video]