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

61 lines
4.5 KiB
Plaintext
Raw Normal View History

[video output=day267 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Adding Per-Element Clipping Rectangles" vod_platform=youtube id=WX6r6S5Fm0I annotator=Miblo]
[1:00][Recap and set the stage for the day]
[5:07][Pig Hat Time]
[5:14][handmade_debug.h: Add Duration and DurationOfChildren to debug_profile_node in order to separate out the clocks]
[6:06][handmade_debug.cpp: Compute the DurationOfChildren and make the TopClocksList exclusive of the children]
[9:26]["Clocks without children"][quote 472]
[10:05][Run the game and see a clearer picture of where our time is being spent]
[11:47][handmade_world_mode.cpp: Make UpdateAndRenderWorld a TIMED_FUNCTION]
[12:42][Run the game and see what takes the time]
[14:30][handmade_debug_interface.h: Make RecordDebugEvent take Name rather than DEBUG_NAME]
[16:01][handmade_world_mode.cpp: Insert some TIMED_BLOCKs in UpdateAndRenderWorld]
[17:24][Run the game and see that GroundChunksOn takes up so much of the time]
[17:35][handmade_world_mode.cpp: Nuke GroundChunksOn and consult the profiler again]
[20:34][handmade_debug.cpp: Clip the profiler drawing to ProfileRect.Min.Y]
[26:47][Blackboard: Picking the correct line to clip to]
[27:32][handmade_debug.cpp: Make the profiler overdraw by one line]
[28:30][View the profiler and see this overdrawing]
[32:17][handmade_render_group.h and .cpp: Consider how to enable the bitmaps to be clipped]
[36:44][Blackboard: Respecifying bitmaps]
[39:02][handmade_render_group.h: Try to introduce render_entry_cliprect, to pass the clipping area down the stream]
[40:05][handmade_opengl.cpp: Consider the problem with sorting]
[42:26][handmade_render_group.h: Add ClipRect to render_entry_bitmap and ClipRectIndex to render_group_entry_header in order allow clipping while sorting]
[44:16][handmade_opengl.cpp: Call glScissor[ref
site="docs.GL"
page="glScissor"
url="http://docs.gl/gl2/glScissor"]]
[45:10][handmade_platform.h: Add ClipRectCount and *ClipRects to game_render_commands]
[49:29][handmade_render_group.h: Introduce game_render_clip_rect]
[52:21][handmade_render_group.h: Set CurrentClipRectIndex for the entire window in Perspective]
[55:37][handmade_render_group.cpp: Introduce PushClipRect]
[1:06:45][win32_handmade.cpp: Make Win32DisplayBufferInWindow take ClipRectMemory and to call LinearizeClipRects]
[1:10:33][handmade_render.cpp: Introduce LinearizeClipRects]
[1:16:27][Run the game and hit an InvalidDefaultCase]
[1:18:59][handmade_render_group.cpp: Guard against overflow in PushClipRect]
[1:22:30][handmade_debug.cpp: Do a PushClipRect in DrawTopClocksList]
[1:25:06][Debugger: Step into ClipRectIndex and inspect the values]
[1:26:05][handmade_opengl.cpp: Enable GL_SCISSOR_TEST]
[1:26:35][View our correctly clipping profiler]
[1:27:27][handmade_opengl.cpp: Disable GL_SCISSOR_TEST in OpenGLDisplayBitmap]
[1:28:00][handmade_render.cpp: Implement clipping in the software renderer]
[1:29:12][Blackboard: Intersecting tiles]
[1:32:01][View the profiler and see that it clips in both renderers]
[1:32:30][Q&A][:speech]
[1:34:11][@Popcorn0x90][What are top three reason for FPS to go down?]
[1:34:36][@sonoftheright][Will ClipRect be used outside of debug, and where?]
[1:35:46][@fierydrake][Can you elaborate on the ODE you plan to replace your drag function with in MoveEntity?]
[1:36:00][@fyoucon][How about making the toplist scrollable? Since we now clip it, can be painful when you start profiling a lot more]
[1:36:50][@blah238][When does clipping overdrawn areas cost more than just drawing them?]
[1:38:12][@sssmcgrath][That's not entirely true, the state change on the clip isn't free, and if the size change is minor it's probably not worth it]
[1:39:11][@Miblo][When you switch between the renderers, the viewing frame time is (obviously) affected. Are the clocks in our newly clipped box also affected by the renderers, i.e. ordered / distributed differently?]
[1:39:36][build.bat: Switch to -O2 and -DHANDMADE_SLOW=0 and view the profile]
[1:40:59][handmade_render.cpp: Ignore IGNORED_TIMED_FUNCTION and IGNORED_TIMED_BLOCK]
[1:45:05][handmade_render.cpp: Ignore DrawRectangle and "Pixel Fill"]
[1:47:14][@longboolean][What does OpenGL do when you enable gl_scissor_test? What is it testing for?]
[1:47:35][Blackboard: glScissor]
[1:48:22][Wrap it up][:speech]
[1:48:46][build.bat: Switch back to -Od and -DHANDMADE_SLOW=1]
[1:48:50][todo.txt: Update the TODO list]
[1:49:54][Announce that the forums will be going down this weekend \[note: actually the 22nd April\]][:speech]
[/video]