Implementing a Custom Multisample Resolve
?
?
W, K, P / S, J, N Jump to previous / next marker
t / T Toggle theatre / SUPERtheatre mode
V Revert filter to original state Y Select link (requires manual Ctrl-c)
X, ShiftSpace Toggle category and focus previous
v Invert topics / media as per focus
Keyboard Navigation
Global Keys
[, < / ], > Jump to previous / next episodeW, K, P / S, J, N Jump to previous / next marker
t / T Toggle theatre / SUPERtheatre mode
V Revert filter to original state Y Select link (requires manual Ctrl-c)
Menu toggling
q Quotes r References f Filter y Link c CreditsIn-Menu Movement
a
w
s
s
d
h
j
k
l
←
↑
↓
↓
→
Quotes and References Menus
Enter Jump to timecodeQuotes, References and Credits Menus
o Open URL (in new tab)Filter Menu
x, Space Toggle category and focus nextX, ShiftSpace Toggle category and focus previous
v Invert topics / media as per focus
Filter and Link Menus
z Toggle filter / linking modeCredits Menu
Enter Open URL (in new tab)⏫
Previous: 'Trying Multisampled Depth Peels'
⏫
0:22Recap our depth-peeling-with-multisampling puzzler and set the stage for the day
0:22Recap our depth-peeling-with-multisampling puzzler and set the stage for the day
0:22Recap our depth-peeling-with-multisampling puzzler and set the stage for the day
3:52cheap and easy solution for enabling multisampled antialiasing on the target platform
3:52cheap and easy solution for enabling multisampled antialiasing on the target platform
3:52cheap and easy solution for enabling multisampled antialiasing on the target platform
5:30Describe an old method to perform smoothing, using glHint1 and glEdgeFlag2
5:30Describe an old method to perform smoothing, using glHint1 and glEdgeFlag2
5:30Describe an old method to perform smoothing, using glHint1 and glEdgeFlag2
10:19Consult the OpenGL 3.2 Specification for POLYGON_SMOOTH3
10:19Consult the OpenGL 3.2 Specification for POLYGON_SMOOTH3
10:19Consult the OpenGL 3.2 Specification for POLYGON_SMOOTH3
12:43handmade_opengl.cpp: Disable multisampling in OpenGLChangeToSettings()
12:43handmade_opengl.cpp: Disable multisampling in OpenGLChangeToSettings()
12:43handmade_opengl.cpp: Disable multisampling in OpenGLChangeToSettings()
13:32handmade_opengl.cpp: Try turning on GL_POLYGON_SMOOTH_HINT in OpenGLRenderCommands()
13:32handmade_opengl.cpp: Try turning on GL_POLYGON_SMOOTH_HINT in OpenGLRenderCommands()
13:32handmade_opengl.cpp: Try turning on GL_POLYGON_SMOOTH_HINT in OpenGLRenderCommands()
14:29Run the game and see no difference
14:29Run the game and see no difference
14:29Run the game and see no difference
15:59handmade_opengl.cpp: Reenable multisampling back on in OpenGLChangeToSettings(), and run the game to see that it's much slower
15:59handmade_opengl.cpp: Reenable multisampling back on in OpenGLChangeToSettings(), and run the game to see that it's much slower
15:59handmade_opengl.cpp: Reenable multisampling back on in OpenGLChangeToSettings(), and run the game to see that it's much slower
17:19Consider why the multisampling is so much slower
17:19Consider why the multisampling is so much slower
17:19Consider why the multisampling is so much slower
19:10win32_handmade.cpp: Switch to a lower resolution and run the game to see that the frame rate is fine now
19:10win32_handmade.cpp: Switch to a lower resolution and run the game to see that the frame rate is fine now
19:10win32_handmade.cpp: Switch to a lower resolution and run the game to see that the frame rate is fine now
20:00Inspect the artifacts caused by the multisampling failing to pick from the correct value for depth peeling
20:00Inspect the artifacts caused by the multisampling failing to pick from the correct value for depth peeling
20:00Inspect the artifacts caused by the multisampling failing to pick from the correct value for depth peeling
22:39Consult Wikipedia to see if the discard creates a place where things will get sampled more4
22:39Consult Wikipedia to see if the discard creates a place where things will get sampled more4
22:39Consult Wikipedia to see if the discard creates a place where things will get sampled more4
24:47Run the game and assess the quality improvement brought by multisampling, if only the depth picking was correct
24:47Run the game and assess the quality improvement brought by multisampling, if only the depth picking was correct
24:47Run the game and assess the quality improvement brought by multisampling, if only the depth picking was correct
28:25Consider drawing some structured art to help us diagnose this artifacting
28:25Consider drawing some structured art to help us diagnose this artifacting
28:25Consider drawing some structured art to help us diagnose this artifacting
30:45handmade_opengl.cpp: Make CompileZBiasProgram() hard set the ModColor.a to 0.5, and run the game to validate where the artifacts occur
30:45handmade_opengl.cpp: Make CompileZBiasProgram() hard set the ModColor.a to 0.5, and run the game to validate where the artifacts occur
30:45handmade_opengl.cpp: Make CompileZBiasProgram() hard set the ModColor.a to 0.5, and run the game to validate where the artifacts occur
33:07Consider the possibility that we don't have a problem at all, if we include the 1-pixel transparent border, or only evaluate the Z value at the centroid
33:07Consider the possibility that we don't have a problem at all, if we include the 1-pixel transparent border, or only evaluate the Z value at the centroid
33:07Consider the possibility that we don't have a problem at all, if we include the 1-pixel transparent border, or only evaluate the Z value at the centroid
35:42Consult the OpenGL ES Shading Language specification on the storage qualifiers centroid5
35:42Consult the OpenGL ES Shading Language specification on the storage qualifiers centroid5
35:42Consult the OpenGL ES Shading Language specification on the storage qualifiers centroid5
38:22handmade_opengl.cpp: Try to make CompileZBiasProgram() preserve the FragZ coordinate across all depth buffers
38:22handmade_opengl.cpp: Try to make CompileZBiasProgram() preserve the FragZ coordinate across all depth buffers
38:22handmade_opengl.cpp: Try to make CompileZBiasProgram() preserve the FragZ coordinate across all depth buffers
44:15Run the game to see Z-fighting
44:15Run the game to see Z-fighting
44:15Run the game to see Z-fighting
44:42handmade_opengl.cpp: Make CompileZBiasProgram() correctly set that FragZ
44:42handmade_opengl.cpp: Make CompileZBiasProgram() correctly set that FragZ
44:42handmade_opengl.cpp: Make CompileZBiasProgram() correctly set that FragZ
46:20Run the game and still see the artifacts
46:20Run the game and still see the artifacts
46:20Run the game and still see the artifacts
47:04handmade_opengl.cpp: Undo those changes in CompileZBiasProgram()
47:04handmade_opengl.cpp: Undo those changes in CompileZBiasProgram()
47:04handmade_opengl.cpp: Undo those changes in CompileZBiasProgram()
50:28Look closely at the tree bitmap, and consider inserting a 1-pixel border around everything
50:28Look closely at the tree bitmap, and consider inserting a 1-pixel border around everything
50:28Look closely at the tree bitmap, and consider inserting a 1-pixel border around everything
55:50Read about CLAMP_TO_BORDER in the OpenGL 3.2 spec6
55:50Read about CLAMP_TO_BORDER in the OpenGL 3.2 spec6
55:50Read about CLAMP_TO_BORDER in the OpenGL 3.2 spec6
58:11Read about gl_FragDepth in the OpenGL Shading Language 4.3 spec7
58:11Read about gl_FragDepth in the OpenGL Shading Language 4.3 spec7
58:11Read about gl_FragDepth in the OpenGL Shading Language 4.3 spec7
1:04:11Consider our two things at play: We only get artifacts where multisampling occurs at the edges of primitives; perhaps the resolve is picking a bad Z value
1:04:11Consider our two things at play: We only get artifacts where multisampling occurs at the edges of primitives; perhaps the resolve is picking a bad Z value
1:04:11Consider our two things at play: We only get artifacts where multisampling occurs at the edges of primitives; perhaps the resolve is picking a bad Z value
1:07:34handmade_opengl.cpp: Consider how to fix CompileResolveMultisample()
1:07:34handmade_opengl.cpp: Consider how to fix CompileResolveMultisample()
1:07:34handmade_opengl.cpp: Consider how to fix CompileResolveMultisample()
1:12:44handmade_opengl.cpp: Enable CompileResolveMultisample() to compute CombinedColor, and UseProgramBegin() to set up the color and depth samplers
1:12:44handmade_opengl.cpp: Enable CompileResolveMultisample() to compute CombinedColor, and UseProgramBegin() to set up the color and depth samplers
1:12:44handmade_opengl.cpp: Enable CompileResolveMultisample() to compute CombinedColor, and UseProgramBegin() to set up the color and depth samplers
1:15:50handmade_opengl.cpp: Make OpenGLRenderCommands() setup the framebuffers to pass to ResolveMultisample(), and fix compile errors
1:15:50handmade_opengl.cpp: Make OpenGLRenderCommands() setup the framebuffers to pass to ResolveMultisample(), and fix compile errors
1:15:50handmade_opengl.cpp: Make OpenGLRenderCommands() setup the framebuffers to pass to ResolveMultisample(), and fix compile errors
1:21:39handmade_opengl.cpp: Determine that the (f32)SampleCount line in CompileResolveMultisample() is causing the error
1:21:39handmade_opengl.cpp: Determine that the (f32)SampleCount line in CompileResolveMultisample() is causing the error
1:21:39handmade_opengl.cpp: Determine that the (f32)SampleCount line in CompileResolveMultisample() is causing the error
1:24:07handmade_opengl.cpp: Continue fixing compile errors in CompileResolveMultisample()
1:24:07handmade_opengl.cpp: Continue fixing compile errors in CompileResolveMultisample()
1:24:07handmade_opengl.cpp: Continue fixing compile errors in CompileResolveMultisample()
1:25:24Run successfully, but see nothing
1:25:24Run successfully, but see nothing
1:25:24Run successfully, but see nothing
1:26:35handmade_opengl.cpp: Make UseProgramBegin() set the Prog->SampleCount for CompileResolveMultisample() to use
1:26:35handmade_opengl.cpp: Make UseProgramBegin() set the Prog->SampleCount for CompileResolveMultisample() to use
1:26:35handmade_opengl.cpp: Make UseProgramBegin() set the Prog->SampleCount for CompileResolveMultisample() to use
1:28:35Run the game to see that the alpha value isn't getting written properly, and investigate why
1:28:35Run the game to see that the alpha value isn't getting written properly, and investigate why
1:28:35Run the game to see that the alpha value isn't getting written properly, and investigate why
1:30:23handmade_opengl.cpp: Make CompileResolveMultisample() disable GL_DEPTH_TEST, and run the game to see our old artifacts gone, but a new one present
1:30:23handmade_opengl.cpp: Make CompileResolveMultisample() disable GL_DEPTH_TEST, and run the game to see our old artifacts gone, but a new one present
1:30:23handmade_opengl.cpp: Make CompileResolveMultisample() disable GL_DEPTH_TEST, and run the game to see our old artifacts gone, but a new one present
1:32:41win32_handmade.cpp: Switch to a higher resolution, and run the game to see that this is still slow
1:32:41win32_handmade.cpp: Switch to a higher resolution, and run the game to see that this is still slow
1:32:41win32_handmade.cpp: Switch to a higher resolution, and run the game to see that this is still slow
1:35:16handmade_opengl.cpp: Assess OpenGLRenderCommands() and note that multisampling is not actually off
1:35:16handmade_opengl.cpp: Assess OpenGLRenderCommands() and note that multisampling is not actually off
1:35:16handmade_opengl.cpp: Assess OpenGLRenderCommands() and note that multisampling is not actually off
1:37:25Run the game to see that it looks the same whether multisampling is enabled or not
1:37:25Run the game to see that it looks the same whether multisampling is enabled or not
1:37:25Run the game to see that it looks the same whether multisampling is enabled or not
1:38:06handmade_opengl.cpp: Disable multisampling in OpenGLChangeToSettings() and run the game to see the debug information
1:38:06handmade_opengl.cpp: Disable multisampling in OpenGLChangeToSettings() and run the game to see the debug information
1:38:06handmade_opengl.cpp: Disable multisampling in OpenGLChangeToSettings() and run the game to see the debug information
1:39:12handmade_platform.h: Make DefaultRenderCommands() set the MultisamplingHint to false, and run the game to see that the multisampling is responsible for the debug system disappearing
1:39:12handmade_platform.h: Make DefaultRenderCommands() set the MultisamplingHint to false, and run the game to see that the multisampling is responsible for the debug system disappearing
1:39:12handmade_platform.h: Make DefaultRenderCommands() set the MultisamplingHint to false, and run the game to see that the multisampling is responsible for the debug system disappearing
1:41:17handmade_opengl.cpp: Determine that there's a problem in ResolveMultisample(), and investigate what
1:41:17handmade_opengl.cpp: Determine that there's a problem in ResolveMultisample(), and investigate what
1:41:17handmade_opengl.cpp: Determine that there's a problem in ResolveMultisample(), and investigate what
1:43:27handmade_opengl.cpp: Make ResolveMultisample() read from the correct framebuffer
1:43:27handmade_opengl.cpp: Make ResolveMultisample() read from the correct framebuffer
1:43:27handmade_opengl.cpp: Make ResolveMultisample() read from the correct framebuffer
1:44:38handmade_opengl.cpp: Try making OpenGLRenderCommands() follow both multisampling paths and run the game to verify that it is a state-based problem
1:44:38handmade_opengl.cpp: Try making OpenGLRenderCommands() follow both multisampling paths and run the game to verify that it is a state-based problem
1:44:38handmade_opengl.cpp: Try making OpenGLRenderCommands() follow both multisampling paths and run the game to verify that it is a state-based problem
1:45:26handmade_opengl.cpp: Reorder the OpenGL calls in ResolveMultisample() so that they are last-in-first-out
1:45:26handmade_opengl.cpp: Reorder the OpenGL calls in ResolveMultisample() so that they are last-in-first-out
1:45:26handmade_opengl.cpp: Reorder the OpenGL calls in ResolveMultisample() so that they are last-in-first-out
1:47:05Run the game to see that it works
1:47:05Run the game to see that it works
1:47:05Run the game to see that it works
1:48:59Q&A
🗩
1:48:59Q&A
🗩
1:48:59Q&A
🗩
1:56:18Compare the ATI FirePro V87008 with a modern GPU9
1:56:18Compare the ATI FirePro V87008 with a modern GPU9
1:56:18Compare the ATI FirePro V87008 with a modern GPU9
2:06:57A few words on the AVX512 instruction set and Larrabee
🗩
2:06:57A few words on the AVX512 instruction set and Larrabee
🗩
2:06:57A few words on the AVX512 instruction set and Larrabee
🗩
2:12:45Wrap it up
🗩
2:12:45Wrap it up
🗩
2:12:45Wrap it up
🗩
⏬
Next: 'Further Attempts at Multisampled Depth Peeling'
⏬