Commit: ffbe876fddbd45a93dae4dc00a9ae2fc6541250f
Author: Antonio Vazquez
Date:   Mon Aug 14 15:49:41 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rBffbe876fddbd45a93dae4dc00a9ae2fc6541250f

New buffer use in Blur modifier

The previous version created a loop with the framebuffer. Now a ping pong 
framebuffer is used.

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

M       release/scripts/startup/bl_ui/properties_data_modifier.py
M       source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M       source/blender/draw/engines/gpencil/gpencil_engine.c
M       source/blender/draw/engines/gpencil/gpencil_engine.h
M       source/blender/draw/engines/gpencil/gpencil_vfx.c
M       source/blender/makesdna/DNA_modifier_types.h
M       source/blender/makesrna/intern/rna_modifier.c
M       source/blender/modifiers/intern/MOD_gpencilblur.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py 
b/release/scripts/startup/bl_ui/properties_data_modifier.py
index c3dca0089f7..6d8d5341278 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1789,11 +1789,6 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         col.label(text="Factor:")
         col.prop(md, "factor", text="")
 
-        layout.separator()
-
-        row = col.row(align=True)
-        row.prop(md, "samples", text="Samples")
-
     def GP_WAVE(self, layout, ob, md):
         row = layout.row(align=True)
         row.prop(md, "orientation", expand=True)
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index af4c9e4838e..052d78cc936 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -79,8 +79,17 @@ void gpencil_object_cache_add(tGPencilObjectCache *cache, 
Object *ob, int *gp_ca
        cache[*gp_cache_used].ob = ob;
        cache[*gp_cache_used].init_grp = 0;
        cache[*gp_cache_used].end_grp = -1;
-       cache[*gp_cache_used].init_vfx_sh = NULL;
-       cache[*gp_cache_used].end_vfx_sh = NULL;
+       cache[*gp_cache_used].init_vfx_wave_sh = NULL;
+       cache[*gp_cache_used].end_vfx_wave_sh = NULL;
+
+       cache[*gp_cache_used].init_vfx_blur_sh_1 = NULL;
+       cache[*gp_cache_used].end_vfx_blur_sh_1 = NULL;
+       cache[*gp_cache_used].init_vfx_blur_sh_2 = NULL;
+       cache[*gp_cache_used].end_vfx_blur_sh_2 = NULL;
+       cache[*gp_cache_used].init_vfx_blur_sh_3 = NULL;
+       cache[*gp_cache_used].end_vfx_blur_sh_3 = NULL;
+       cache[*gp_cache_used].init_vfx_blur_sh_4 = NULL;
+       cache[*gp_cache_used].end_vfx_blur_sh_4 = NULL;
 
        /* calculate zdepth from point of view */
        float zdepth = 0.0;
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 736f2fbb794..fbb051090d2 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -71,14 +71,23 @@ static void GPENCIL_engine_init(void *vedata)
                tex_color, ARRAY_SIZE(tex_color));
 
        /* vfx */
-       DRWFboTexture vfx_color[2] = { {
-                       &e_data.vfx_fbcolor_depth_tx, DRW_TEX_DEPTH_24, 
DRW_TEX_TEMP },
-                       { &e_data.vfx_fbcolor_color_tx, DRW_TEX_RGBA_16, 
DRW_TEX_TEMP }
+       DRWFboTexture vfx_color_a[2] = { {
+                       &e_data.vfx_fbcolor_depth_tx_a, DRW_TEX_DEPTH_24, 
DRW_TEX_TEMP },
+                       { &e_data.vfx_fbcolor_color_tx_a, DRW_TEX_RGBA_16, 
DRW_TEX_TEMP }
        };
        DRW_framebuffer_init(
-               &fbl->vfx_color_fb, &draw_engine_gpencil_type,
+               &fbl->vfx_color_fb_a, &draw_engine_gpencil_type,
                (int)viewport_size[0], (int)viewport_size[1],
-               vfx_color, ARRAY_SIZE(vfx_color));
+               vfx_color_a, ARRAY_SIZE(vfx_color_a));
+
+       DRWFboTexture vfx_color_b[2] = { {
+                       &e_data.vfx_fbcolor_depth_tx_b, DRW_TEX_DEPTH_24, 
DRW_TEX_TEMP },
+                       { &e_data.vfx_fbcolor_color_tx_b, DRW_TEX_RGBA_16, 
DRW_TEX_TEMP }
+       };
+       DRW_framebuffer_init(
+               &fbl->vfx_color_fb_b, &draw_engine_gpencil_type,
+               (int)viewport_size[0], (int)viewport_size[1],
+               vfx_color_b, ARRAY_SIZE(vfx_color_b));
 
        /* normal fill shader */
        if (!e_data.gpencil_fill_sh) {
@@ -245,11 +254,16 @@ static void GPENCIL_cache_init(void *vedata)
                psl->mix_vfx_pass = DRW_pass_create("GPencil Mix VFX Pass", 
DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND | DRW_STATE_WRITE_DEPTH | 
DRW_STATE_DEPTH_LESS);
                DRWShadingGroup *mix_vfx_shgrp = 
DRW_shgroup_create(e_data.gpencil_fullscreen_sh, psl->mix_vfx_pass);
                DRW_shgroup_call_add(mix_vfx_shgrp, vfxquad, NULL);
-               DRW_shgroup_uniform_buffer(mix_vfx_shgrp, "strokeColor", 
&e_data.vfx_fbcolor_color_tx);
-               DRW_shgroup_uniform_buffer(mix_vfx_shgrp, "strokeDepth", 
&e_data.vfx_fbcolor_depth_tx);
+               DRW_shgroup_uniform_buffer(mix_vfx_shgrp, "strokeColor", 
&e_data.vfx_fbcolor_color_tx_a);
+               DRW_shgroup_uniform_buffer(mix_vfx_shgrp, "strokeDepth", 
&e_data.vfx_fbcolor_depth_tx_a);
 
                /* VFX pass */
-               psl->vfx_pass = DRW_pass_create("GPencil VFX Pass", 
DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND | DRW_STATE_WRITE_DEPTH | 
DRW_STATE_DEPTH_LESS);
+               psl->vfx_wave_pass = DRW_pass_create("GPencil VFX Wave Pass", 
DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND | DRW_STATE_WRITE_DEPTH | 
DRW_STATE_DEPTH_LESS);
+
+               psl->vfx_blur_pass_1 = DRW_pass_create("GPencil VFX Blur Pass 
1", DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND | DRW_STATE_WRITE_DEPTH | 
DRW_STATE_DEPTH_LESS);
+               psl->vfx_blur_pass_2 = DRW_pass_create("GPencil VFX Blur Pass 
2", DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND | DRW_STATE_WRITE_DEPTH | 
DRW_STATE_DEPTH_LESS);
+               psl->vfx_blur_pass_3 = DRW_pass_create("GPencil VFX Blur Pass 
3", DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND | DRW_STATE_WRITE_DEPTH | 
DRW_STATE_DEPTH_LESS);
+               psl->vfx_blur_pass_4 = DRW_pass_create("GPencil VFX Blur Pass 
4", DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND | DRW_STATE_WRITE_DEPTH | 
DRW_STATE_DEPTH_LESS);
        }
 }
 
@@ -334,8 +348,11 @@ static void GPENCIL_draw_scene(void *vedata)
        DRW_framebuffer_texture_attach(fbl->temp_color_fb, 
e_data.temp_fbcolor_depth_tx, 0, 0);
        DRW_framebuffer_texture_attach(fbl->temp_color_fb, 
e_data.temp_fbcolor_color_tx, 0, 0);
 
-       DRW_framebuffer_texture_attach(fbl->vfx_color_fb, 
e_data.vfx_fbcolor_depth_tx, 0, 0);
-       DRW_framebuffer_texture_attach(fbl->vfx_color_fb, 
e_data.vfx_fbcolor_color_tx, 0, 0);
+       DRW_framebuffer_texture_attach(fbl->vfx_color_fb_a, 
e_data.vfx_fbcolor_depth_tx_a, 0, 0);
+       DRW_framebuffer_texture_attach(fbl->vfx_color_fb_a, 
e_data.vfx_fbcolor_color_tx_a, 0, 0);
+
+       DRW_framebuffer_texture_attach(fbl->vfx_color_fb_b, 
e_data.vfx_fbcolor_depth_tx_b, 0, 0);
+       DRW_framebuffer_texture_attach(fbl->vfx_color_fb_b, 
e_data.vfx_fbcolor_color_tx_b, 0, 0);
 
        /* Draw all pending objects */
        if (stl->g_data->gp_cache_used > 0) {
@@ -371,20 +388,45 @@ static void GPENCIL_draw_scene(void *vedata)
                        }
 
                        /* vfx pass */
-                       if ((cache->init_vfx_sh) && (cache->init_vfx_sh)) {
-                               DRW_framebuffer_bind(fbl->vfx_color_fb);
+                       if ((cache->init_vfx_wave_sh) && 
(cache->init_vfx_wave_sh)) {
+                               DRW_framebuffer_bind(fbl->vfx_color_fb_a);
                                DRW_framebuffer_clear(true, true, false, 
clearcol, 1.0f);
 
-                               DRW_draw_pass_subset(psl->vfx_pass,
-                                       cache->init_vfx_sh,
-                                       cache->end_vfx_sh);
+                               /* wave or copy past */
+                               DRW_draw_pass_subset(psl->vfx_wave_pass,
+                                       cache->init_vfx_wave_sh,
+                                       cache->end_vfx_wave_sh);
+                               /* blur passes */
+                               if ((cache->init_vfx_blur_sh_1) && 
(cache->init_vfx_blur_sh_1)) {
+                                       
DRW_framebuffer_bind(fbl->vfx_color_fb_b);
+                                       DRW_framebuffer_clear(true, true, 
false, clearcol, 1.0f);
+                                       /* pass 1 */
+                                       
DRW_draw_pass_subset(psl->vfx_blur_pass_1,
+                                               cache->init_vfx_blur_sh_1,
+                                               cache->end_vfx_blur_sh_1);
+                                       /* pass 2 */
+                                       
DRW_framebuffer_bind(fbl->vfx_color_fb_a);
+                                       
DRW_draw_pass_subset(psl->vfx_blur_pass_2,
+                                               cache->init_vfx_blur_sh_2,
+                                               cache->end_vfx_blur_sh_2);
+                                       /* pass 3 */
+                                       
DRW_framebuffer_bind(fbl->vfx_color_fb_b);
+                                       
DRW_draw_pass_subset(psl->vfx_blur_pass_3,
+                                               cache->init_vfx_blur_sh_3,
+                                               cache->end_vfx_blur_sh_3);
+                                       /* pass 4 */
+                                       
DRW_framebuffer_bind(fbl->vfx_color_fb_a);
+                                       
DRW_draw_pass_subset(psl->vfx_blur_pass_4,
+                                               cache->init_vfx_blur_sh_4,
+                                               cache->end_vfx_blur_sh_4);
+                               }
                                /* Combine with scene buffer */
                                DRW_framebuffer_bind(dfbl->default_fb);
                                /* Mix VFX Pass */
                                DRW_draw_pass(psl->mix_vfx_pass);
                        }
                        else {
-                               /* Combine with scene buffer */
+                               /* Combine with scene buffer withou more passes 
*/
                                DRW_framebuffer_bind(dfbl->default_fb);
                                /* Mix Pass: DRW_STATE_WRITE_COLOR | 
DRW_STATE_BLEND | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS */
                                DRW_draw_pass(psl->mix_pass);
@@ -408,8 +450,11 @@ static void GPENCIL_draw_scene(void *vedata)
        DRW_framebuffer_texture_detach(e_data.temp_fbcolor_depth_tx);
        DRW_framebuffer_texture_detach(e_data.temp_fbcolor_color_tx);
 
-       DRW_framebuffer_texture_detach(e_data.vfx_fbcolor_depth_tx);
-       DRW_framebuffer_texture_detach(e_data.vfx_fbcolor_color_tx);
+       DRW_framebuffer_texture_detach(e_data.vfx_fbcolor_depth_tx_a);
+       DRW_framebuffer_texture_detach(e_data.vfx_fbcolor_color_tx_a);
+
+       DRW_framebuffer_texture_detach(e_data.vfx_fbcolor_depth_tx_b);
+       DRW_framebuffer_texture_detach(e_data.vfx_fbcolor_color_tx_b);
 
        /* attach again default framebuffer */
        DRW_framebuffer_bind(dfbl->default_fb);
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h 
b/source/blender/draw/engines/gpencil/gpencil_engine.h
index ea8e7db7e20..b663c4b4e1e 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -61,8 +61,16 @@ typedef struct GPencilVFXWave {
 typedef struct tGPencilObjectCache {
        struct Object *ob;
        int init_grp, end_grp;
-       DRWShadingGroup *init_vfx_sh;
-       DRWShadingGroup *end_vfx_sh;
+       DRWShadingGroup *init_vfx_wave_sh;
+       DRWShadingGroup *end_vfx_wave_sh;
+       DRWShadingGroup *init_vfx_blur_sh_1;
+       DRWShadingGroup *end_vfx_blur_sh_1;
+       DRWShadingGroup *init_vfx_blur_sh_2;
+       DRWShadingGroup *end_vfx_blur_sh_2;
+       DRWShadingGroup *init_vfx_blur_sh_3;
+       DRWShadingGroup *end_vfx_blur_sh_3;
+       DRWShadingGroup *init_vfx_blur_sh_4;
+       DRWShadingGroup *end_vfx_blur_sh_4;
        float zdepth;
 } tGPencilObjectCache;
 
@@ -111,13 +119,18 @@ typedef struct GPENCIL_PassList {
        struct DRWPass *drawing_pass;
        struct DRWPass *mix_pass;
        struct DRWPass *mix_vfx_pass;
-       struct DRWPass *vfx_pass;
+       struct DRWPass *vfx_wave_pass;
+       struct DRWPass *vfx_blur_pass_1;
+       struct DRWPass *vfx_blur_pass_2;
+       struct DRWPass *vfx_blur_pass_3;
+       struct DRWPass *vfx_blur_pass_4;
 } GPENCIL_PassList;
 
 typedef struct GPENCIL_FramebufferList {
        struct GPUFrameBuffer *fb;
        struct GPUFrameBuffer *temp_color_fb;
-       struct GPUFrameBuffer *vfx_color_fb;
+       struct GPUFrameBuffer *vfx_color_fb_a;
+       struct GPUFrameBuffer *vfx_color_fb_b;
 } GPENCIL_FramebufferList;
 
 typedef struct GPENCIL_TextureList {
@@ -162,8 +175,10 @@ typedef struct GPENCIL_e_data {
        struct GPUTexture *temp_fbcolor_depth_tx;
        struct GPUTexture *temp_fbcolor_color_tx;
        
-       struct GPUTexture *vfx_fbcolor_de

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to