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

69 lines
6.0 KiB
Plaintext

[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="OpenGL VSync and sRGB Extensions" vod_platform=youtube id=1OMTFa09lHM annotator=Miblo]
[0:08][Reminder: The source code is not in the public domain yet]
[0:57][On the possibility of vomiting][quote 363]
[1:39][Recap and set the stage for the day]
[2:53][win32_handmade.cpp: Make Win32DisplayBufferInWindow take SortMemory]
[5:04][handmade_render.cpp: Make SortEntries take that SortMemory and continue cleaning up compile errors]
[7:13][handmade_render.cpp: Rename RenderGroupToOutput to TiledCommandsRender and make it take game_render_commands *Commands]
[8:39][handmade_render.cpp: Pull tile_render_work in from handmade_render_group.h]
[9:09][handmade_render.cpp: Rename RenderGroupToOutput to RenderCommandsToBitmap]
[9:54][handmade_render.cpp: Consider using the AddEntry call directly]
[11:16][win32.handmade.cpp: Make platform_api available to the renderer]
[12:11][win32_handmade.cpp: Continue cleaning up compile errors]
[21:29][handmade_platform.h: typedef u64 umm]
[22:48][handmade_render.cpp: Move DrawRectangleQuickly in from handmade_optimized.cpp]
[23:43][build.bat: Remove the handmade_optimized.cpp build]
[25:03][Build and run and crash in PushRenderElement]
[25:52][win32_handmade.cpp: Correctly allocate memory for the PushBuffer]
[26:29][Build and run successfully the first time!]
[27:25]["Everything just worked"][quote 364]
[28:08][win32_handmade.cpp: Introduce GlobalUseSoftwareRendering to enable us to switch between software and hardware rendering]
[29:42][Run the game and toggle between the renderers]
[33:28][Blackboard: VSync]
[36:47][Blackboard: glSwapInterval]
[38:58][Internet: docs.GL \[see Resources\]]
[39:32][Internet: WGL_EXT_swap_control \[see Resources\]]
[40:47][handmade_opengl.cpp: Try calling wglSwapInterval(0)]
[41:20][win32_handmade.cpp: Call wglGetProcAddress to get wglSwapIntervalEXT]
[43:20][win32_handmade.cpp: typedef BOOL WINAPI wgl_swap_interval_ext]
[44:52][Run the game and see that we're now running at a locked 60 FPS]
[45:52][win32_handmade.cpp: Note that we are not done yet]
[48:37][Run the game and note that our hardware renderer doesn't understand the fact that we're using sRGB]
[50:06][Internet: ARB_framebuffer_sRGB \[see Resources\]]
[53:09][handmade_render.cpp: Look at how our software renderer does gamma correction]
[56:45][win32_handmade.cpp: Conditionally use SRGB8_ALPHA8_EXT if the necessary extension is present]
[58:34][win32_handmade.cpp: Turn on GL_FRAMEBUFFER_SRGB]
[59:55][win32_handmade.cpp: #define the GL_ extensions we want]
[1:01:40][Blackboard: ARB - "Architecture Review Board"]
[1:02:46][win32_handmade.cpp: Comment out the checks to see if the extensions are available]
[1:03:34][Run the game and find that we have actual sRGB rendering happening]
[1:04:35][Q&A][:speech]
[1:05:35][@insofaras][Will you be implementing multiple render paths depending on the OpenGL context version or available extensions at runtime?]
[1:06:08][@TheSizik][Can you fix the Santa sorting?]
[1:06:20][handmade_cutscene.cpp: Fix the Santa sorting]
[1:09:46][@macielda][Your maximum frame time is about 2-3ms without VSync enabled, but with it enabled I see it stays at 16ms most of the time, but sometimes goes to 17ms. Does that mean it will skip a frame? Is that a problem with VSync?]
[1:10:16][Blackboard: SwapBuffers]
[1:15:08][@jd96x][Is object oriented programming bad in general or for game purposes, and why?]
[1:15:15][@rohit_n][I believe you do an strstr of GL_EXTENSIONS, then check if the end of the extension is null, a space or tab to see if it exists]
[1:15:34][@SoysauceTheKid][Is there any reason to make the swap interval larger than 1?]
[1:15:54][Blackboard: Swap interval]
[1:16:33][@m1el][Is there an asynchronous way to do VSync? I mean, a way to "ask" OpenGL if it has displayed the frame or how much time you have to wait until the frame is going to be displayed]
[1:17:20][@ezioauditorerevs][How would you allow the game to run at a non-60 FPS rate and not speed up / slow down the animation speed?]
[1:17:55][@elxenoaizd][Apologies if you explained this before. Since rotation is stored in the upper 3x3 part of the transform matrix, and Scale is stored in the 0,0, 1,1, 2,2 diagonal, how do the play well together? I mean, wouldn't changing the rotation or scale affect the other?]
[1:18:18][@QuikliGames][You mentioned 120hz. How do you handle skipping every other VSync event? Do you just detect the monitor refresh rate and if 120hz swap twice in a row?]
[1:18:41][@Connor_Rentz][If VSync is disabled in windows, will there be no VSync at all?]
[1:18:59][@ezioauditorerevs][The glove in the scene where Krampus is giving it to the kid looks a bit strange with the thumb pointing downwards]
[1:19:07][@Longboolean][Why does VSync cause input lag on some machines?]
[1:19:51][@ttbjm][What are the trade-offs of storing the textures on disk in the same linear colorspace format you are using?]
[1:20:37][@CFlickster][Any update on when to implement sound effects?]
[1:20:44][@garlandobloom][What is that bottle full of that Jon posted on twitter?]
[1:20:54][@Miblo][We're still fading from / to the desktop. Did you have to reimplement that? Is it being hardware rendered? Is the fade here to stay?]
[1:21:20][@stasrgba][With WglSwapInterval() do we still have to do Sleep at the end of the frame? Could you also comment on glFinish / glFlush and how they're used?]
[1:24:00][@insofaras][Will you use EXT_swap_tear? (-1 in the SwapInterval call)]
[1:24:07][@macielda][Should we wait after SwapBuffers if it returns too fast?]
[1:24:27][@Colt_Zero][Would it be better to minimize or maximize how much you do per frame? Like, would it be better to make your program take any time that it would be waiting for VSync, and instead focus it on performing more computations, even potentially computing things ahead of time?]
[1:25:24][@Tybereon][How do you easily detect if VSync is active?]
[1:25:51][@macielda][How do I VSync and prevent tearing with a dual-monitor setup? Is it any different than a single-monitor setup? \[see Resources\]]
[1:27:23][Conclude][:speech]
[/video]