[Bf-blender-cvs] [250ba17c834] blender2.8: GP: Cleanup duplicate code

Antonioya noreply at git.blender.org
Thu Oct 11 15:18:38 CEST 2018


Commit: 250ba17c83411c77100c6ea974626b3787a465b0
Author: Antonioya
Date:   Thu Oct 11 15:18:26 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB250ba17c83411c77100c6ea974626b3787a465b0

GP: Cleanup duplicate code

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

M	source/blender/draw/engines/gpencil/gpencil_shader_fx.c

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

diff --git a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
index 9513f83191e..6a3cbd4b39b 100644
--- a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
+++ b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
@@ -857,10 +857,10 @@ static void draw_gpencil_blur_passes(
 	}
 }
 
-static void draw_gpencil_rim_blur(
-        struct GPENCIL_e_data *UNUSED(e_data),
+/* blur intermediate passes */
+static void draw_gpencil_midpass_blur(
         struct GPENCIL_Data *vedata,
-        struct RimShaderFxData *fxd)
+		struct ShaderFxData_Runtime *runtime)
 {
 	GPENCIL_PassList *psl = ((GPENCIL_Data *)vedata)->psl;
 	GPENCIL_FramebufferList *fbl = ((GPENCIL_Data *)vedata)->fbl;
@@ -869,7 +869,7 @@ static void draw_gpencil_rim_blur(
 	GPU_framebuffer_bind(fbl->temp_fb_b);
 	GPU_framebuffer_clear_color_depth(fbl->temp_fb_b, clearcol, 1.0f);
 	DRW_draw_pass_subset(psl->fx_shader_pass_blend,
-		fxd->runtime.fx_sh_b, fxd->runtime.fx_sh_b);
+		runtime->fx_sh_b, runtime->fx_sh_b);
 
 	/* copy pass from b for ping-pong frame buffers */
 	GPU_framebuffer_bind(fbl->temp_fb_fx);
@@ -911,12 +911,12 @@ static void draw_gpencil_rim_passes(
 			/* horizontal */
 			fxd->blur[0] = bx;
 			fxd->blur[1] = 0;
-			draw_gpencil_rim_blur(e_data, vedata, fxd);
+			draw_gpencil_midpass_blur(vedata, &fxd->runtime);
 
 			/* Vertical */
 			fxd->blur[0] = 0;
 			fxd->blur[1] = by;
-			draw_gpencil_rim_blur(e_data, vedata, fxd);
+			draw_gpencil_midpass_blur(vedata, &fxd->runtime);
 
 			fxd->blur[0] = bx;
 			fxd->blur[1] = by;
@@ -939,27 +939,6 @@ static void draw_gpencil_rim_passes(
 	DRW_draw_pass(psl->mix_pass_noblend);
 }
 
-/* blur shadow */
-static void draw_gpencil_shadow_blur(
-	struct GPENCIL_e_data *UNUSED(e_data),
-	struct GPENCIL_Data *vedata,
-	struct ShadowShaderFxData *fxd)
-{
-	GPENCIL_PassList *psl = ((GPENCIL_Data *)vedata)->psl;
-	GPENCIL_FramebufferList *fbl = ((GPENCIL_Data *)vedata)->fbl;
-	static float clearcol[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
-
-	GPU_framebuffer_bind(fbl->temp_fb_b);
-	GPU_framebuffer_clear_color_depth(fbl->temp_fb_b, clearcol, 1.0f);
-	DRW_draw_pass_subset(psl->fx_shader_pass_blend,
-		fxd->runtime.fx_sh_b, fxd->runtime.fx_sh_b);
-
-	/* copy pass from b for ping-pong frame buffers */
-	GPU_framebuffer_bind(fbl->temp_fb_fx);
-	GPU_framebuffer_clear_color_depth(fbl->temp_fb_fx, clearcol, 1.0f);
-	DRW_draw_pass(psl->mix_pass_noblend);
-}
-
 /* helper to draw SHADOW passes */
 static void draw_gpencil_shadow_passes(
 	struct GPENCIL_e_data *e_data,
@@ -994,12 +973,12 @@ static void draw_gpencil_shadow_passes(
 			/* horizontal */
 			fxd->blur[0] = bx;
 			fxd->blur[1] = 0;
-			draw_gpencil_shadow_blur(e_data, vedata, fxd);
+			draw_gpencil_midpass_blur(vedata, &fxd->runtime);
 
 			/* Vertical */
 			fxd->blur[0] = 0;
 			fxd->blur[1] = by;
-			draw_gpencil_shadow_blur(e_data, vedata, fxd);
+			draw_gpencil_midpass_blur(vedata, &fxd->runtime);
 
 			fxd->blur[0] = bx;
 			fxd->blur[1] = by;
@@ -1022,27 +1001,6 @@ static void draw_gpencil_shadow_passes(
 	DRW_draw_pass(psl->mix_pass_noblend);
 }
 
-/* blur glow */
-static void draw_gpencil_glow_blur(
-	struct GPENCIL_e_data *UNUSED(e_data),
-	struct GPENCIL_Data *vedata,
-	struct GlowShaderFxData *fxd)
-{
-	GPENCIL_PassList *psl = ((GPENCIL_Data *)vedata)->psl;
-	GPENCIL_FramebufferList *fbl = ((GPENCIL_Data *)vedata)->fbl;
-	static float clearcol[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
-
-	GPU_framebuffer_bind(fbl->temp_fb_b);
-	GPU_framebuffer_clear_color_depth(fbl->temp_fb_b, clearcol, 1.0f);
-	DRW_draw_pass_subset(psl->fx_shader_pass_blend,
-		fxd->runtime.fx_sh_b, fxd->runtime.fx_sh_b);
-
-	/* copy pass from b for ping-pong frame buffers */
-	GPU_framebuffer_bind(fbl->temp_fb_fx);
-	GPU_framebuffer_clear_color_depth(fbl->temp_fb_fx, clearcol, 1.0f);
-	DRW_draw_pass(psl->mix_pass_noblend);
-}
-
 /* helper to draw GLOW passes */
 static void draw_gpencil_glow_passes(
 	struct GPENCIL_e_data *e_data,
@@ -1077,12 +1035,12 @@ static void draw_gpencil_glow_passes(
 			/* horizontal */
 			fxd->blur[0] = bx;
 			fxd->blur[1] = 0;
-			draw_gpencil_glow_blur(e_data, vedata, fxd);
+			draw_gpencil_midpass_blur(vedata, &fxd->runtime);
 
 			/* Vertical */
 			fxd->blur[0] = 0;
 			fxd->blur[1] = by;
-			draw_gpencil_glow_blur(e_data, vedata, fxd);
+			draw_gpencil_midpass_blur(vedata, &fxd->runtime);
 
 			fxd->blur[0] = bx;
 			fxd->blur[1] = by;



More information about the Bf-blender-cvs mailing list