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

40 lines
3.3 KiB
Plaintext

[video output=day244 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Finishing Asynchronous Texture Downloads" vod_platform=youtube id=SWtV8B3rssw annotator=Miblo]
[0:55][Build and run the game and note that our textures don't get downloaded]
[1:32][Set the stage for the day with some thoughts on writing software from scratch and the occasional need to use systems which are black boxes]
[5:15][Debugger: Take a stroll through our new OpenGL code]
[9:08][win32_handmade.cpp: Make Win32InitOpenGL return an HGLRC]
[12:20][Debugger: Step into Win32InitOpenGL and consider creating the OpenGL context outside of the queue]
[13:46][win32_handmade.cpp: Claim the Window as a CS_OWNDC]
[14:25][Debugger: Step into Win32CreateOpenGLContextForWorkerThread]
[15:20][Explain what is happening in the debugger while two threads are initialising OpenGL]
[19:14][win32_handmade.cpp: Assert if wglMakeCurrent fails]
[19:52][Run the game and note that we never hit that assertion]
[20:33][Debugger: Step through Win32AllocateTexture]
[21:48][handmade_asset.cpp: Set FinalizeOperation to FinalizeAsset_Bitmap]
[22:32][win32_handmade.cpp: Put in the pointers to AllocateTexture and DeallocateTexture]
[23:05][Debugger: Step through Win32AllocateTexture and see the game correctly rendering in hardware]
[26:06]["I don't know how that ended up working"][quote 397]
[26:38][Mention the fact that there's no synchronisation between the texture downloading and the rendering, and describe our goal with regard to failure cases]
[33:16][handmade_opengl.cpp: Explain the importance of gamma correction]
[36:13][handmade_opengl.cpp: Explain why there are two separate enables for sRGB]
[38:20][Internet: Consult the OpenGL docs[ref
site=OpenGL
page="WGL_ARB_pixel_format"
url=https://www.opengl.org/registry/specs/ARB/wgl_pixel_format.txt][ref
site="OpenGL"
page="ARB_framebuffer_sRGB"
url="https://www.opengl.org/registry/specs/ARB/framebuffer_sRGB.txt"]]
[45:04][win32_handmade.cpp: typedef these WINAPI wgl_ functions and enable the extensions in Win32InitOpenGL]
[1:08:48][Q&A][:speech]
[1:09:10][@yoonfan][Don't you have a race condition according to the C11 and C++11 memory models when you set the texture handle from the worker thread and read it on the rendering thread without any synchronization? I think you need to use an atomic operation or the compiler could mess up the generated code]
[1:10:43][@cubercaleb][Why don't you render directly to the backbuffer at Molly?]
[1:14:20][@brokenopcode][FYI, no you can't change pixel format once it's been set. Need to create a temp window & context, get the wgl*arb function pointers, then destroy context & window and create new window and context with wgl*arb. Very annoying but that's how it works on windows as far as I know]
[1:15:09][@Zamar037][Will we be back to the debug code and finish it up after this, or have we finished it now?]
[1:15:23][@cubercaleb][Thanks for the in depth explanation. Will you be going over modern GL later?]
[1:17:15][@garryjohanson][Apparently in DirectX 12 you can select a separate context for different GPUs]
[1:18:10][@gasto5][Where did you upload the 4coder videos?]
[1:18:33][@d7samurai][Yes, D3D11, too]
[1:18:58][@cubercaleb][Couldn't you also use a PBO for streaming in textures?]
[1:20:35][Wrap it up][:speech]
[/video]