Commit: b1e3bb9eb47e0a34a27b6db43cb62253e1a158b9
Author: Antonio Vazquez
Date:   Sat Mar 31 16:17:17 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rBb1e3bb9eb47e0a34a27b6db43cb62253e1a158b9

Cleanup: Move all Shader creation to engine_init

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

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

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

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index c525816ef9f..0518093cf3b 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -178,6 +178,39 @@ static void GPENCIL_engine_init(void *vedata)
                e_data.gpencil_drawing_fill_sh = 
GPU_shader_get_builtin_shader(GPU_SHADER_3D_SMOOTH_COLOR);
        }
 
+       /* full screen for mix zdepth*/
+       if (!e_data.gpencil_fullscreen_sh) {
+               e_data.gpencil_fullscreen_sh = 
DRW_shader_create_fullscreen(datatoc_gpencil_zdepth_mix_frag_glsl, NULL);
+       }
+       if (!e_data.gpencil_simple_fullscreen_sh) {
+               e_data.gpencil_simple_fullscreen_sh = 
DRW_shader_create_fullscreen(datatoc_gpencil_simple_mix_frag_glsl, NULL);
+       }
+       /* vfx shaders (all in screen space) */
+       if (!e_data.gpencil_vfx_blur_sh) {
+               e_data.gpencil_vfx_blur_sh = 
DRW_shader_create_fullscreen(datatoc_gpencil_gaussian_blur_frag_glsl, NULL);
+       }
+       if (!e_data.gpencil_vfx_wave_sh) {
+               e_data.gpencil_vfx_wave_sh = 
DRW_shader_create_fullscreen(datatoc_gpencil_wave_frag_glsl, NULL);
+       }
+       if (!e_data.gpencil_vfx_pixel_sh) {
+               e_data.gpencil_vfx_pixel_sh = 
DRW_shader_create_fullscreen(datatoc_gpencil_pixel_frag_glsl, NULL);
+       }
+       if (!e_data.gpencil_vfx_swirl_sh) {
+               e_data.gpencil_vfx_swirl_sh = 
DRW_shader_create_fullscreen(datatoc_gpencil_swirl_frag_glsl, NULL);
+       }
+       if (!e_data.gpencil_vfx_flip_sh) {
+               e_data.gpencil_vfx_flip_sh = 
DRW_shader_create_fullscreen(datatoc_gpencil_flip_frag_glsl, NULL);
+       }
+       if (!e_data.gpencil_vfx_light_sh) {
+               e_data.gpencil_vfx_light_sh = 
DRW_shader_create_fullscreen(datatoc_gpencil_light_frag_glsl, NULL);
+       }
+       if (!e_data.gpencil_painting_sh) {
+               e_data.gpencil_painting_sh = 
DRW_shader_create_fullscreen(datatoc_gpencil_painting_frag_glsl, NULL);
+       }
+       if (!e_data.gpencil_paper_sh) {
+               e_data.gpencil_paper_sh = 
DRW_shader_create_fullscreen(datatoc_gpencil_paper_frag_glsl, NULL);
+       }
+
        if (!stl->storage) {
                stl->storage = MEM_callocN(sizeof(GPENCIL_Storage), 
"GPENCIL_Storage");
        }
@@ -282,39 +315,6 @@ static void GPENCIL_cache_init(void *vedata)
        stl->g_data->gp_cache_size = 0;
        stl->g_data->gp_object_cache = NULL;
 
-       /* full screen for mix zdepth*/
-       if (!e_data.gpencil_fullscreen_sh) {
-               e_data.gpencil_fullscreen_sh = 
DRW_shader_create_fullscreen(datatoc_gpencil_zdepth_mix_frag_glsl, NULL);
-       }
-       if (!e_data.gpencil_simple_fullscreen_sh) {
-               e_data.gpencil_simple_fullscreen_sh = 
DRW_shader_create_fullscreen(datatoc_gpencil_simple_mix_frag_glsl, NULL);
-       }
-       /* vfx shaders (all in screen space) */
-       if (!e_data.gpencil_vfx_blur_sh) {
-               e_data.gpencil_vfx_blur_sh = 
DRW_shader_create_fullscreen(datatoc_gpencil_gaussian_blur_frag_glsl, NULL);
-       }
-       if (!e_data.gpencil_vfx_wave_sh) {
-               e_data.gpencil_vfx_wave_sh = 
DRW_shader_create_fullscreen(datatoc_gpencil_wave_frag_glsl, NULL);
-       }
-       if (!e_data.gpencil_vfx_pixel_sh) {
-               e_data.gpencil_vfx_pixel_sh = 
DRW_shader_create_fullscreen(datatoc_gpencil_pixel_frag_glsl, NULL);
-       }
-       if (!e_data.gpencil_vfx_swirl_sh) {
-               e_data.gpencil_vfx_swirl_sh = 
DRW_shader_create_fullscreen(datatoc_gpencil_swirl_frag_glsl, NULL);
-       }
-       if (!e_data.gpencil_vfx_flip_sh) {
-               e_data.gpencil_vfx_flip_sh = 
DRW_shader_create_fullscreen(datatoc_gpencil_flip_frag_glsl, NULL);
-       }
-       if (!e_data.gpencil_vfx_light_sh) {
-               e_data.gpencil_vfx_light_sh = 
DRW_shader_create_fullscreen(datatoc_gpencil_light_frag_glsl, NULL);
-       }
-       if (!e_data.gpencil_painting_sh) {
-               e_data.gpencil_painting_sh = 
DRW_shader_create_fullscreen(datatoc_gpencil_painting_frag_glsl, NULL);
-       }
-       if (!e_data.gpencil_paper_sh) {
-               e_data.gpencil_paper_sh = 
DRW_shader_create_fullscreen(datatoc_gpencil_paper_frag_glsl, NULL);
-       }
-
        {
                /* Stroke pass */
                psl->stroke_pass = DRW_pass_create("GPencil Stroke Pass", 
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_ALWAYS | 
DRW_STATE_BLEND);

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

Reply via email to