diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-02-13 16:58:29 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-02-18 16:17:57 +0300 |
commit | 7a8a2211d18cca711a122fd0f3c1bfbfa802e712 (patch) | |
tree | 6b8609cc99e958ce029c214bfa1853a0d1505b6b /source/blender/draw/modes | |
parent | 9c49c2ef0c52594a4ad6e90b617ec1007819a526 (diff) |
Wireframe: Fix Artifacts with MSAA
We blit the depth buffer into the MSAA depth buffer so that wires are
properly occluded. This also makes the "In front" option work with MSAA.
Diffstat (limited to 'source/blender/draw/modes')
-rw-r--r-- | source/blender/draw/modes/overlay_mode.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/draw/modes/overlay_mode.c b/source/blender/draw/modes/overlay_mode.c index 2a2e59d4595..e3e64ba6f22 100644 --- a/source/blender/draw/modes/overlay_mode.c +++ b/source/blender/draw/modes/overlay_mode.c @@ -379,8 +379,22 @@ static void overlay_draw_scene(void *vedata) MULTISAMPLE_SYNC_ENABLE(dfbl, dtxl); + if (dfbl->multisample_fb != NULL) { + DRW_stats_query_start("Multisample Blit"); + GPU_framebuffer_bind(dfbl->multisample_fb); + GPU_framebuffer_clear_color(dfbl->multisample_fb, (const float[4]){0.0f}); + /* Special blit: we need the original depth and stencil + * in the Multisample buffer. */ + GPU_framebuffer_blit(dfbl->default_fb, 0, + dfbl->multisample_fb, 0, + GPU_DEPTH_BIT | GPU_STENCIL_BIT); + DRW_stats_query_end(); + } + DRW_draw_pass(psl->face_wireframe_pass); + /* TODO(fclem): find a way to unify the multisample pass together + * (non meshes + armature + wireframe) */ MULTISAMPLE_SYNC_DISABLE(dfbl, dtxl); } |