Eevee: No need to free all the gpu materials when world changes.
authorDalai Felinto <dfelinto@gmail.com>
Thu, 29 Jun 2017 16:56:38 +0000 (18:56 +0200)
committerDalai Felinto <dfelinto@gmail.com>
Thu, 29 Jun 2017 16:57:06 +0000 (18:57 +0200)
We have a world probe that is used to prevent exactly that.

source/blender/editors/render/render_update.c

index 2986ece028b59dcca7d9e6777ad9f338cd5b72f5..42d914b1a71bcf70153e8d60f48fe86a00d17656 100644 (file)
@@ -471,10 +471,8 @@ static void texture_changed(Main *bmain, Tex *tex)
        }
 }
 
        }
 }
 
-static void world_changed(Main *bmain, World *wo)
+static void world_changed(Main *UNUSED(bmain), World *wo)
 {
 {
-       Material *ma;
-
        /* icons */
        BKE_icon_changed(BKE_icon_id_ensure(&wo->id));
 
        /* icons */
        BKE_icon_changed(BKE_icon_id_ensure(&wo->id));
 
@@ -482,10 +480,6 @@ static void world_changed(Main *bmain, World *wo)
        wo->update_flag = 1;
        
        /* glsl */
        wo->update_flag = 1;
        
        /* glsl */
-       for (ma = bmain->mat.first; ma; ma = ma->id.next)
-               if (ma->gpumaterial.first)
-                       GPU_material_free(&ma->gpumaterial);
-
        if (defmaterial.gpumaterial.first)
                GPU_material_free(&defmaterial.gpumaterial);
        
        if (defmaterial.gpumaterial.first)
                GPU_material_free(&defmaterial.gpumaterial);