Commit: 651ea84471bd40d0c700c27faf53a0503bb08147
Author: Clément Foucault
Date:   Sun Apr 8 16:56:54 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB651ea84471bd40d0c700c27faf53a0503bb08147

Clay: Improve loading time.

Only compile hair shader if we need it.

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

M       source/blender/draw/engines/clay/clay_engine.c

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

diff --git a/source/blender/draw/engines/clay/clay_engine.c 
b/source/blender/draw/engines/clay/clay_engine.c
index c80e0cdf4f7..4976cd01d11 100644
--- a/source/blender/draw/engines/clay/clay_engine.c
+++ b/source/blender/draw/engines/clay/clay_engine.c
@@ -426,12 +426,6 @@ static void clay_engine_init(void *vedata)
                e_data.copy_sh = 
DRW_shader_create_fullscreen(datatoc_clay_copy_glsl, NULL);
        }
 
-       if (!e_data.hair_sh) {
-               e_data.hair_sh = DRW_shader_create(
-                       datatoc_clay_particle_vert_glsl, NULL, 
datatoc_clay_particle_strand_frag_glsl,
-                       "#define MAX_MATERIAL 512\n");
-       }
-
        if (!stl->storage) {
                stl->storage = MEM_callocN(sizeof(CLAY_Storage), 
"CLAY_Storage");
        }
@@ -604,6 +598,12 @@ static DRWShadingGroup *CLAY_hair_shgroup_create(DRWPass 
*pass, int id)
 {
        CLAY_ViewLayerData *sldata = CLAY_view_layer_data_get();
 
+       if (!e_data.hair_sh) {
+               e_data.hair_sh = DRW_shader_create(
+                       datatoc_clay_particle_vert_glsl, NULL, 
datatoc_clay_particle_strand_frag_glsl,
+                       "#define MAX_MATERIAL 512\n");
+       }
+
        DRWShadingGroup *grp = DRW_shgroup_create(e_data.hair_sh, pass);
        DRW_shgroup_uniform_texture(grp, "matcaps", e_data.matcap_array);
        DRW_shgroup_uniform_block(grp, "material_block", sldata->mat_ubo);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to