[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Separating the Renderer Completely (Part 2)" vod_platform=youtube id=RS4kudtk0Xw annotator=Miblo] [0:01][Set the stage for the day making the texture system optional][:speech] [2:14][A few words on ping-ponging between the renderer test bed and the full game, to gradually work the code away from the game, like in cookery][:api :speech] [4:16][Pull out non-generic parts of handmade_renderer.h into handmade_math.h and handmade_renderer_software.h][:api] [13:18][Work towards the removal of loaded_bitmap from handmade_renderer.h in favour of a unified texture :API][:speech] [18:55][Introduce renderer_texture to replace loaded_bitmap, propagating this replacement][:api :rendering] [29:56][:Run the game to see textured :rendering][:api] [30:08][Move loaded_bitmap out of handmade_renderer.h to guide our replacement of it][:api :rendering] [38:10][Create handmade_asset_rendering.cpp to contain the [~hero Handmade Hero]-specific functions from handmade_renderer.cpp][:admin] [40:57][Replace loaded_bitmap with software_texture][:api :rendering] [44:20][Change the :hardware renderer to use renderer_texture directly][:api :rendering] [50:18][:Run the game and encounter a "GL_INVALID_OPERATION" OpenGL Error][:api :hardware :rendering] [51:09][Fix RendererTextureFrom() to use the TextureHandle][:api :hardware :rendering] [51:37][:Run the game successfully][:api :hardware :rendering] [52:02][Remove RendererTextureFrom() in favour of passing Bitmap->TextureHandle to PushQuad() and PushCube()][:api :rendering] [52:26][Try to include handmade_renderer.cpp in win32_renderer_test.cpp, and set up to push our :lighting solution into the renderer][:api :rendering] [54:28][Move lighting_point_state, lighting_box and LIGHT_POINTS_PER_CHUNK into handmade_renderer.h][:api :lighting :rendering] [55:34][Try to let win32_renderer_test.cpp call PushFullClear()][:api :rendering] [55:59][:Run the renderer test, see no clear colour and investigate why][:api :rendering] [56:32][Make win32_renderer_test.cpp use PushFullClear() as the game uses it, performing the depth peel][:api :rendering] [58:15][:Run the renderer test to see our clear colour][:api :rendering] [58:34][Add a :camera in win32_renderer_test.cpp][:api :rendering] [1:02:54][Call PushCube() in win32_renderer_test.cpp][:api :rendering] [1:03:53][:Run the game and see no cube][:api :camera :rendering] [1:04:44][Set CameraDolly to 10.0f][:api :camera :rendering] [1:04:52][:Run the game, see the cube and tweak the :camera parameters][:api :rendering] [1:06:51][Consider how to proceed, tackling texturing][:"asset loading" :speech] [1:10:21][Set up win32_renderer_test.cpp to load a bitmap for passing to a texturing system[ref site=MSDN page="fopen_s, _wfopen_s" url=https://msdn.microsoft.com/en-us/library/z5hh6ee9.aspx]][:"asset loading"] [1:17:52][Make cube_test.bmp and sprite_test.bmp][:drawing] [1:22:03][Step through LoadBMP() in win32_renderer_test.cpp to see our bitmap loaded successfully][:"asset loading"] [1:22:28][Set up to submit our textures to the renderer as two types: odd-sized (slower) and 512×512 (faster)][:api :"asset loading" :rendering :speech] [1:27:43][Consider how to structure the two-tiered textured quads][:api :"asset loading" :rendering :speech] [1:31:10][Pull AddOp() and related structs into handmade_renderer.{cpp,h}][:api :"asset loading" :rendering] [1:45:09][:Run the game and crash in AtomicAddU64()][:threading] [1:45:42][Fix WinMainCRTStartup() to set the GameMemory.TextureQueue][:memory] [1:46:01][:Run the game successfully][:api :"asset loading" :memory :rendering :threading] [1:46:08][Determine to make the renderer use a fixed number of textures, to remove notion of allocating / deallocating textures, in favour of only updating them][:api :"asset loading" :rendering :speech] [1:49:28][Introduce renderer_texture_group and renderer_memory_layout][:api :"asset loading" :rendering] [1:56:06][Q&A][:speech] [1:56:31][@edvinholm][Q: How would you approach front-to-back :rendering?] [1:57:24][@edvinholm][@handmade_hero Yes][:rendering] [1:58:06][@nickito97][Q: Is including a cpp file generally a bad idea?][:language] [1:59:23][@iantjac][Q: Is it possible to make variadic functions in C, when compiling without a LIBC?][:language] [2:04:34][@oldganon][@handmade_hero Including varargs.h doesnt pull in libc][:language] [2:05:05][@snovind92][Q: Why would the person you are helping not want to use a game :engine if they are not too experienced with 3D programming?] [2:07:16][@xkrouzu][Q: Kinda new to the stream, but did you do any sort of batch :rendering (like rendering once by storing into a texture)?] [2:08:08][@nickito97][Q: Does the current renderer support arbitrary meshes or shaders?][:rendering] [2:08:47][@floorislava][Q: When the texture is sent to the GPU is it a 1\:1 size ratio or does it get compressed][:rendering] [2:09:11][@jim0_o][Q: Did you noticed that the stream went down for a minute at around minute 45 of this stream?] [2:10:06][@dudeinbasement1][Q: Thoughts on a simple handmade OBS?] [2:11:22][@vaualbus][Q: Would this texture system solve our binding texture timing?][:rendering] [2:11:39][@ponkkiz][Q: Where do you buy your cool hats?] [2:11:58][@kittehk][Q: Stupid question, but would there ever be a need to use compute shaders in the game, or are we staying away from this side of the :API?][:rendering] [2:12:20][@vaualbus][Q: I mean the time spent in glBindTexture()][:rendering] [2:13:09][@frostyninja][Q: Can we get another Lemongrab impersonation for my compilation?[ref site=YouTube page="CaseyLemongrab" url=https://youtu.be/ZHKGk3z54jE]] [2:16:03][@xghost7][Q: Why did you change to Visual Studio editor? You were using something else before, I think] [2:16:17][@vaualbus][Q: Any idea on how to handle different textures when using instancing :rendering? Pack all the textures in an array and write a custom sampler?][:"asset loading"] [2:17:20][@jhaxgaming][Q: Sorry to ask a noob question, but why do your function signatures use the internal keyword?][:language] [2:17:42][@naimlesson][Q: Do you know if DX12 is going to be needed for making use of the new hardware ray tracing stuff? What alternatives exists, and is it going to be worth it?][:api] [2:19:11][@vaualbus][Q: And there is a reason for that, [@cmuratori Casey]: if you include any cpp it will break as they define their version of internal somewhere in the STL][:language] [2:20:01][@nickito97][Q: What's wrong with STL?][:language] [2:23:39][@garryjohanson][Invasive list?][:language] [2:25:42][Close down shop][:speech] [/video]