[Bf-blender-cvs] [7a8a2211d18] master: Wireframe: Fix Artifacts with MSAA

Clément Foucault noreply at git.blender.org
Mon Feb 18 14:18:21 CET 2019


Commit: 7a8a2211d18cca711a122fd0f3c1bfbfa802e712
Author: Clément Foucault
Date:   Wed Feb 13 14:58:29 2019 +0100
Branches: master
https://developer.blender.org/rB7a8a2211d18cca711a122fd0f3c1bfbfa802e712

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.

===================================================================

M	source/blender/draw/modes/overlay_mode.c

===================================================================

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);
 }



More information about the Bf-blender-cvs mailing list