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

74 lines
5.6 KiB
Plaintext
Raw Normal View History

[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Shader Fallback sRGB" vod_platform=youtube id=PGNH3SKmgEo annotator=Miblo]
[0:04][Introduce our special guest, donated by @quartertron: @owlbot]
[1:31]["He kinda has a USB butt"][quote 557]
[4:42][Run the game to recap with a few words on supporting sRGB]
[8:58][handmade_opengl.h: Consider adding sRGBSupport to the open_gl struct]
[11:28][win32_handmade.cpp: Try setting WGL_CONTEXT_MAJOR_VERSION_ARB to 4, run the game and find that we don't get a context]
[13:42][handmade_opengl.cpp: Enable OpenGLInit() to call glTexImage2DMultisample() in order to check whether we support sRGB]
[16:58][Consult docs.GL to see if we can call glDeleteTextures()[ref
site="docs.GL"
page="glDeleteTextures"
url="http://docs.gl/gl3/glDeleteTextures"]]
[17:46][handmade_opengl.cpp: Continue making OpenGLInit() check support for and enable an sRGB framebuffer]
[25:54][Run the game and see that it's working]
[26:18][Blackboard: sRGB conversions]
[30:32][handmade_opengl.cpp: Enable OpenGLInit() to perform atomic tests on the sRGB conversions]
[38:06][handmade_render.cpp: Look at how DrawRectangleQuickly() performs the sRGB conversions]
[41:22][handmade_opengl.cpp: Enable the shader's FragmentCode to perform the sRGB conversion]
[42:47][Consult the The OpenGL Shading Language 1.50 Quick Reference Card to see how to do the sqrt[ref
site="OpenGL Registry"
page="The OpenGL Shading Language 1.50 Quick Reference Card"
url="https://www.khronos.org/files/opengl-quick-reference-card.pdf"]]
[43:08][handmade_opengl.cpp: Fix errors in OpenGLInit()]
[43:39][Run the game and note that our sprite colours are sRGB correct but that the other colours are not]
[48:34][handmade_opengl.cpp: Note that the rendering code contains duplication, and consider changing the format in which we submit textures]
[51:24][handmade_render_group.h: Introduce textured_vertex and render_entry_textured_quads structs]
[56:03][Blackboard: nVidia allows us to use a texture pointer in shaders]
[58:15][handmade_render_group.h: Spec out the render_entry_textured_quads struct]
[59:51][Blackboard: CPU vs GPU memory and mapping regions between them]
[1:05:25][Blackboard: Using locked memory to facilitate GPU transfers]
[1:08:25][handmade_render_group.h: Continue to spec out render_entry_textured_quads]
[1:11:28][handmade_opengl.cpp: Enable OpenGLRenderCommands() to process textured quads]
[1:17:38][handmade_opengl.cpp: Enable OpenGLRenderCommands() to specify the glColor4ub[ref
site="docs.GL"
page="glColor"
url="http://docs.gl/gl3/glColor"]]
[1:22:09][handmade_opengl.cpp: Try sending GL_QUADS and run the game to see that it's fine]
[1:23:35][A few words on texture atlases]
[1:24:47][handmade_opengl.cpp: Determine to feed some sprites to OpenGLRenderCommands()]
[1:26:05][handmade_platform.h: Make RenderCommandsStruct() take a VertexArray and consider how to write our loaded bitmaps out]
[1:29:26]["It's high allergy season here, folks, and I'm a snotty boy"][quote 558]
[1:29:32][handmade_render_group.h: Add CurrentQuads to the render_group struct and introduce Begin]
[1:31:23][handmade_render_group.cpp: Make PushBitmap() blow out the bitmap data inline]
[1:36:12][Check out the commotion]
[1:37:15]["It might be a protest, or it might be a parade of some kind"][quote 559]
[1:38:51][@quartertron][Live police & fire scanner[ref
site="KOMO News"
page="Live police & fire scanner"
url="http://komonews.com/live/live-police--fire-scanner-11-20-2015"]]
[1:40:11][handmade_render_group.cpp: Continue working on PushBitmap()]
[1:44:18][handmade_math.h: Introduce BGRAUnpack4x8(), BGRAPack4x8(), RGBAUnpack4x8() and RGBAPack4x8()]
[1:45:33][handmade_render_group.cpp: Enable PushBitmap() to pack the color]
[1:47:05][handmade_platform.h: Make RenderCommandsStruct() take a VertexCount]
[1:48:07][handmade_render_group.cpp: Enable PushBitmap() to write out the vertices and the render entry for the quads]
[1:53:50][Run the game to see that it is not exactly a stunning success, and investigate why we're not seeing the textures]
[1:55:45][Step in to OpenGLRenderCommands() and inspect the Bitmap and Vertex values]
[1:56:41][handmade_math.h: Make PushBitmap() multiply by 255 before passing the PremulColor to RGBAPack4x8()]
[1:57:29][Run the game to see some pretty good texture stretching]
[1:57:42][handmade_render_group.cpp: Make PushBitmap() set the axes correctly, and run the game to admire it]
[1:58:19][Q&A][:speech]
[1:58:40][@desuused][Emulating sRGB texture loads and sRGB fragment writes is not enough: sRGB also affects blending, which you can't emulate]
[2:01:07][@zilarrezko][Do you have a licence for all those cubes?]
[2:01:17][@rooctag][What texture will you use for rects and cubes?]
[2:01:52][@mtsmox][Is it worth testing sRGB and MSAA in the non-OpenGL compatibility mode?]
[2:03:07][@Jim0_o][Will you be using more than one ShaderProgram? If so, how do you minimize switching between programs when rendering?]
[2:04:20][@mtsmox][You could unset it and just see if the assert will fail?]
[2:05:18][win32_handmade.cpp: Research WGL_CONTEXT_PROFILE_MASK_ARB and specify the CORE_PROFILE in Win32OpenGLAttribs[ref
site="Khronos"
page="WGL_ARB_create_context"
url="https://www.khronos.org/registry/OpenGL/extensions/ARB/WGL_ARB_create_context.txt"]]
[2:06:09][Run the game and see that it unexpectedly works, then step through OpenGLInit() to see that it still errors out]
[2:07:55][@insofaras][Are you passing a major / minor version too? I think the bit might not be enabled sub 3.2?]
[2:09:36][Wind this down with the promise of a question for @insofaras and a mention of daylight savings time][:speech]
[/video]