[Bf-blender-cvs] [af11366d406] greasepencil-object: Fix AA error after draw manager changes

Antonio Vazquez noreply at git.blender.org
Mon May 7 16:36:32 CEST 2018


Commit: af11366d40609c0cba6ae849993ae175b8a2aa45
Author: Antonio Vazquez
Date:   Mon May 7 16:36:23 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rBaf11366d40609c0cba6ae849993ae175b8a2aa45

Fix AA error after draw manager changes

The AA was not working and the stroke was not visible while drawing due some changes in the draw manager.

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

M	source/blender/draw/engines/gpencil/gpencil_engine.c
M	source/blender/draw/engines/gpencil/gpencil_engine.h
M	source/blender/draw/intern/DRW_render.h

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

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 99153bb0897..f6fbdee7499 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -409,7 +409,7 @@ static void GPENCIL_cache_init(void *vedata)
 		}
 
 		/* drawing buffer pass */
-		psl->drawing_pass = DRW_pass_create("GPencil Drawing Pass", DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND);
+		psl->drawing_pass = DRW_pass_create("GPencil Drawing Pass", DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS);
 
 		/* full screen pass to combine the result */
 		struct Gwn_Batch *quad = DRW_cache_fullscreen_quad_get();
@@ -732,13 +732,13 @@ static void GPENCIL_draw_scene(void *vedata)
 				}
 
 				if (end_grp >= init_grp) {
-					MULTISAMPLE_GP_SYNC_ENABLE(dfbl, fbl);
+					MULTISAMPLE_SYNC_ENABLE(dfbl, dtxl);
 
 					DRW_draw_pass_subset(psl->stroke_pass,
 						stl->shgroups[init_grp].shgrps_fill != NULL ? stl->shgroups[init_grp].shgrps_fill : stl->shgroups[init_grp].shgrps_stroke,
 						stl->shgroups[end_grp].shgrps_stroke);
 
-					MULTISAMPLE_GP_SYNC_DISABLE(dfbl, fbl);
+					MULTISAMPLE_GP_SYNC_DISABLE(dfbl, dtxl, fbl->vfx_fb_a);
 				}
 				/* Current buffer drawing */
 				if ((!is_render) && (gpd->sbuffer_size > 0)) {
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index 92ebddba4fe..11785af84db 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -54,25 +54,6 @@ struct GpencilColorData;
 
 #define GP_IS_CAMERAVIEW ((rv3d != NULL) && (rv3d->persp == RV3D_CAMOB && v3d->camera))
 
- /* anti aliasing macros using MSAA */
-#define MULTISAMPLE_GP_SYNC_ENABLE(dfbl, fbl) { \
-	if ((U.ogl_multisamples > 0) && (dfbl->multisample_fb != NULL)) { \
-		DRW_stats_query_start("GP Multisample Blit"); \
-		GPU_framebuffer_blit(fbl->vfx_fb_a, 0, dfbl->multisample_fb, 0, GPU_COLOR_BIT | GPU_DEPTH_BIT); \
-		GPU_framebuffer_bind(dfbl->multisample_fb); \
-		DRW_stats_query_end(); \
-	} \
-}
-
-#define MULTISAMPLE_GP_SYNC_DISABLE(dfbl, fbl) { \
-	if ((U.ogl_multisamples > 0) && (dfbl->multisample_fb != NULL)) { \
-		DRW_stats_query_start("GP Multisample Resolve"); \
-		GPU_framebuffer_blit(dfbl->multisample_fb, 0, fbl->vfx_fb_a, 0, GPU_COLOR_BIT | GPU_DEPTH_BIT); \
-		GPU_framebuffer_bind(fbl->vfx_fb_a); \
-		DRW_stats_query_end(); \
-	} \
-}
-
  /* *********** OBJECTS CACHE *********** */
 typedef struct GPencilVFXSwirl {
 	float loc[3];
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 6e3356a10c0..19a740ecfca 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -121,6 +121,16 @@ typedef char DRWViewportEmptyList;
 	} \
 }
 
+#define MULTISAMPLE_GP_SYNC_DISABLE(dfbl, dtxl, fb) { \
+	if (dfbl->multisample_fb != NULL) { \
+		DRW_stats_query_start("GP Multisample Resolve"); \
+		GPU_framebuffer_bind(fb); \
+		DRW_multisamples_resolve(dtxl->multisample_depth, dtxl->multisample_color); \
+		DRW_stats_query_end(); \
+	} \
+}
+
+
 
 
 typedef struct DrawEngineDataSize {



More information about the Bf-blender-cvs mailing list