[Bf-blender-cvs] [8abbc7c97b1] temp-greasepencil-vfx: Cleanup: Reduce number of passes defined

Antonio Vazquez noreply at git.blender.org
Mon Jul 2 12:42:56 CEST 2018


Commit: 8abbc7c97b192c8c5b9ce3ed8795d58cf7fa495a
Author: Antonio Vazquez
Date:   Mon Jul 2 10:16:10 2018 +0200
Branches: temp-greasepencil-vfx
https://developer.blender.org/rB8abbc7c97b192c8c5b9ce3ed8795d58cf7fa495a

Cleanup: Reduce number of passes defined

Reuse the same pass for all effects.

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

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

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

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index 766a555b255..ffb99224100 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -207,14 +207,7 @@ typedef struct GPENCIL_PassList {
 	struct DRWPass *paper_pass;
 
 	/* effects */
-	struct DRWPass *fx_blur_pass;
-	struct DRWPass *fx_colorize_pass;
-	struct DRWPass *fx_flip_pass;
-	struct DRWPass *fx_light_pass;
-	struct DRWPass *fx_pixel_pass;
-	struct DRWPass *fx_rim_pass;
-	struct DRWPass *fx_swirl_pass;
-	struct DRWPass *fx_wave_pass;
+	struct DRWPass *fx_shader_pass;
 
 } GPENCIL_PassList;
 
diff --git a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
index e1518deb69f..ce47c7d4b63 100644
--- a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
+++ b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
@@ -208,7 +208,7 @@ static void DRW_gpencil_fx_blur(
 
 	struct Gwn_Batch *fxquad = DRW_cache_fullscreen_quad_get();
 
-	fx_shgrp = DRW_shgroup_create(e_data->gpencil_fx_blur_sh, psl->fx_blur_pass);
+	fx_shgrp = DRW_shgroup_create(e_data->gpencil_fx_blur_sh, psl->fx_shader_pass);
 	DRW_shgroup_call_add(fx_shgrp, fxquad, NULL);
 	DRW_shgroup_uniform_texture_ref(fx_shgrp, "strokeColor", &e_data->temp_color_tx_a);
 	DRW_shgroup_uniform_texture_ref(fx_shgrp, "strokeDepth", &e_data->temp_depth_tx_a);
@@ -238,7 +238,7 @@ static void DRW_gpencil_fx_colorize(
 	stl->fx[ob_idx].fx_colorize.factor = fxd->factor;
 
 	struct Gwn_Batch *fxquad = DRW_cache_fullscreen_quad_get();
-	fx_shgrp = DRW_shgroup_create(e_data->gpencil_fx_colorize_sh, psl->fx_colorize_pass);
+	fx_shgrp = DRW_shgroup_create(e_data->gpencil_fx_colorize_sh, psl->fx_shader_pass);
 	DRW_shgroup_call_add(fx_shgrp, fxquad, NULL);
 	DRW_shgroup_uniform_texture_ref(fx_shgrp, "strokeColor", &e_data->temp_color_tx_a);
 	DRW_shgroup_uniform_texture_ref(fx_shgrp, "strokeDepth", &e_data->temp_depth_tx_a);
@@ -276,7 +276,7 @@ static void DRW_gpencil_fx_flip(
 	};
 
 	struct Gwn_Batch *fxquad = DRW_cache_fullscreen_quad_get();
-	fx_shgrp = DRW_shgroup_create(e_data->gpencil_fx_flip_sh, psl->fx_flip_pass);
+	fx_shgrp = DRW_shgroup_create(e_data->gpencil_fx_flip_sh, psl->fx_shader_pass);
 	DRW_shgroup_call_add(fx_shgrp, fxquad, NULL);
 	DRW_shgroup_uniform_texture_ref(fx_shgrp, "strokeColor", &e_data->temp_color_tx_a);
 	DRW_shgroup_uniform_texture_ref(fx_shgrp, "strokeDepth", &e_data->temp_depth_tx_a);
@@ -306,7 +306,7 @@ static void DRW_gpencil_fx_light(
 	DRWShadingGroup *fx_shgrp;
 
 	struct Gwn_Batch *fxquad = DRW_cache_fullscreen_quad_get();
-	fx_shgrp = DRW_shgroup_create(e_data->gpencil_fx_light_sh, psl->fx_light_pass);
+	fx_shgrp = DRW_shgroup_create(e_data->gpencil_fx_light_sh, psl->fx_shader_pass);
 	DRW_shgroup_call_add(fx_shgrp, fxquad, NULL);
 	DRW_shgroup_uniform_texture_ref(fx_shgrp, "strokeColor", &e_data->temp_color_tx_a);
 	DRW_shgroup_uniform_texture_ref(fx_shgrp, "strokeDepth", &e_data->temp_depth_tx_a);
@@ -367,7 +367,7 @@ static void DRW_gpencil_fx_pixel(
 	stl->fx[ob_idx].fx_pixel.lines = (int)fxd->flag & FX_PIXEL_USE_LINES;
 
 	struct Gwn_Batch *fxquad = DRW_cache_fullscreen_quad_get();
-	fx_shgrp = DRW_shgroup_create(e_data->gpencil_fx_pixel_sh, psl->fx_pixel_pass);
+	fx_shgrp = DRW_shgroup_create(e_data->gpencil_fx_pixel_sh, psl->fx_shader_pass);
 	DRW_shgroup_call_add(fx_shgrp, fxquad, NULL);
 	DRW_shgroup_uniform_texture_ref(fx_shgrp, "strokeColor", &e_data->temp_color_tx_a);
 	DRW_shgroup_uniform_texture_ref(fx_shgrp, "strokeDepth", &e_data->temp_depth_tx_a);
@@ -407,7 +407,7 @@ static void DRW_gpencil_fx_rim(
 	stl->fx[ob_idx].fx_rim.mode = fxd->mode;
 
 	struct Gwn_Batch *fxquad = DRW_cache_fullscreen_quad_get();
-	fx_shgrp = DRW_shgroup_create(e_data->gpencil_fx_rim_sh, psl->fx_rim_pass);
+	fx_shgrp = DRW_shgroup_create(e_data->gpencil_fx_rim_sh, psl->fx_shader_pass);
 	DRW_shgroup_call_add(fx_shgrp, fxquad, NULL);
 	DRW_shgroup_uniform_texture_ref(fx_shgrp, "strokeColor", &e_data->temp_color_tx_a);
 	DRW_shgroup_uniform_texture_ref(fx_shgrp, "strokeDepth", &e_data->temp_depth_tx_a);
@@ -449,7 +449,7 @@ static void DRW_gpencil_fx_swirl(
 	stl->fx[ob_idx].fx_swirl.transparent = (int)fxd->flag & FX_SWIRL_MAKE_TRANSPARENT;
 
 	struct Gwn_Batch *fxquad = DRW_cache_fullscreen_quad_get();
-	fx_shgrp = DRW_shgroup_create(e_data->gpencil_fx_swirl_sh, psl->fx_swirl_pass);
+	fx_shgrp = DRW_shgroup_create(e_data->gpencil_fx_swirl_sh, psl->fx_shader_pass);
 	DRW_shgroup_call_add(fx_shgrp, fxquad, NULL);
 	DRW_shgroup_uniform_texture_ref(fx_shgrp, "strokeColor", &e_data->temp_color_tx_a);
 	DRW_shgroup_uniform_texture_ref(fx_shgrp, "strokeDepth", &e_data->temp_depth_tx_a);
@@ -490,7 +490,7 @@ static void DRW_gpencil_fx_wave(
 
 	struct Gwn_Batch *fxquad = DRW_cache_fullscreen_quad_get();
 
-	DRWShadingGroup *fx_shgrp = DRW_shgroup_create(e_data->gpencil_fx_wave_sh, psl->fx_wave_pass);
+	DRWShadingGroup *fx_shgrp = DRW_shgroup_create(e_data->gpencil_fx_wave_sh, psl->fx_shader_pass);
 	DRW_shgroup_call_add(fx_shgrp, fxquad, NULL);
 	DRW_shgroup_uniform_texture_ref(fx_shgrp, "strokeColor", &e_data->temp_color_tx_a);
 	DRW_shgroup_uniform_texture_ref(fx_shgrp, "strokeDepth", &e_data->temp_depth_tx_a);
@@ -553,22 +553,7 @@ void GPENCIL_create_fx_passes(GPENCIL_PassList *psl)
 {
 	DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND |
 		DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS;
-	/* FX passes */
-	psl->fx_blur_pass = DRW_pass_create("GPencil FX Blur Pass", state);
-
-	psl->fx_colorize_pass = DRW_pass_create("GPencil FX Colorize Pass", state);
-
-	psl->fx_flip_pass = DRW_pass_create("GPencil FX Flip Pass", state);
-
-	psl->fx_light_pass = DRW_pass_create("GPencil FX Light Pass", state);
-
-	psl->fx_pixel_pass = DRW_pass_create("GPencil FX Pixel Pass", state);
-
-	psl->fx_rim_pass = DRW_pass_create("GPencil FX Rim Pass", state);
-
-	psl->fx_swirl_pass = DRW_pass_create("GPencil FX Swirl Pass", state);
-
-	psl->fx_wave_pass = DRW_pass_create("GPencil FX Wave Pass", state);
+	psl->fx_shader_pass = DRW_pass_create("GPencil Shader FX Pass", state);
 }
 
 
@@ -669,7 +654,7 @@ static void gpencil_blur_passes(struct GPENCIL_e_data *e_data,
 		if (bx > 0) {
 			stl->fx[ob_idx].fx_blur.radius[0] = bx;
 			stl->fx[ob_idx].fx_blur.radius[1] = 0;
-			gpencil_draw_fx_pass(e_data, psl->fx_blur_pass,
+			gpencil_draw_fx_pass(e_data, psl->fx_shader_pass,
 								psl->mix_pass_noblend,
 								fbl, cache->fx_blur_sh);
 		}
@@ -677,7 +662,7 @@ static void gpencil_blur_passes(struct GPENCIL_e_data *e_data,
 		if (by > 0) {
 			stl->fx[ob_idx].fx_blur.radius[0] = 0;
 			stl->fx[ob_idx].fx_blur.radius[1] = by;
-			gpencil_draw_fx_pass(e_data, psl->fx_blur_pass,
+			gpencil_draw_fx_pass(e_data, psl->fx_shader_pass,
 								psl->mix_pass_noblend,
 								fbl, cache->fx_blur_sh);
 		}
@@ -704,49 +689,49 @@ void DRW_gpencil_fx_draw(struct GPENCIL_e_data *e_data,
 					break;
 				case eShaderFxType_Colorize:
 					if (cache->fx_colorize_sh) {
-						gpencil_draw_fx_pass(e_data, psl->fx_colorize_pass,
+						gpencil_draw_fx_pass(e_data, psl->fx_shader_pass,
 							psl->mix_pass_noblend,
 							fbl, cache->fx_colorize_sh);
 					}
 					break;
 				case eShaderFxType_Flip:
 					if (cache->fx_flip_sh) {
-						gpencil_draw_fx_pass(e_data, psl->fx_flip_pass,
+						gpencil_draw_fx_pass(e_data, psl->fx_shader_pass,
 											psl->mix_pass_noblend,
 											fbl, cache->fx_flip_sh);
 					}
 					break;
 				case eShaderFxType_Light:
 					if (cache->fx_light_sh) {
-						gpencil_draw_fx_pass(e_data, psl->fx_light_pass,
+						gpencil_draw_fx_pass(e_data, psl->fx_shader_pass,
 											psl->mix_pass_noblend,
 											fbl, cache->fx_light_sh);
 					}
 					break;
 				case eShaderFxType_Pixel:
 					if (cache->fx_pixel_sh) {
-						gpencil_draw_fx_pass(e_data, psl->fx_pixel_pass,
+						gpencil_draw_fx_pass(e_data, psl->fx_shader_pass,
 											psl->mix_pass_noblend,
 											fbl, cache->fx_pixel_sh);
 					}
 					break;
 				case eShaderFxType_Rim:
 					if (cache->fx_rim_sh) {
-						gpencil_draw_fx_pass(e_data, psl->fx_rim_pass,
+						gpencil_draw_fx_pass(e_data, psl->fx_shader_pass,
 							psl->mix_pass_noblend,
 							fbl, cache->fx_rim_sh);
 					}
 					break;
 				case eShaderFxType_Swirl:
 					if (cache->fx_swirl_sh) {
-						gpencil_draw_fx_pass(e_data, psl->fx_swirl_pass,
+						gpencil_draw_fx_pass(e_data, psl->fx_shader_pass,
 											psl->mix_pass_noblend,
 											fbl, cache->fx_swirl_sh);
 					}
 					break;
 				case eShaderFxType_Wave:
 					if (cache->fx_wave_sh) {
-						gpencil_draw_fx_pass(e_data, psl->fx_wave_pass,
+						gpencil_draw_fx_pass(e_data, psl->fx_shader_pass,
 											psl->mix_pass_noblend,
 											fbl, cache->fx_wave_sh);
 					}



More information about the Bf-blender-cvs mailing list